Plasma
placeservice.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "placeservice.h"
00021 #include "jobs.h"
00022
00023 #include <KDebug>
00024
00025
00026 PlaceService::PlaceService(QObject* parent,
00027 KFilePlacesModel* model,
00028 QModelIndex index)
00029 : Plasma::Service(parent),
00030 m_model(model),
00031 m_index(index)
00032 {
00033 setName("places");
00034 if (m_index.isValid()) {
00035 Q_ASSERT(m_index.model() == model);
00036 setDestination(QString::number(m_index.row()));
00037 kDebug() << "Created a place service for" << destination();
00038 } else {
00039 kDebug() << "Created a dead place service";
00040 }
00041 }
00042
00043 Plasma::ServiceJob* PlaceService::createJob(const QString& operation,
00044 QMap<QString,QVariant>& parameters)
00045 {
00046 kDebug() << "Job" << operation << "with arguments" << parameters << "requested";
00047 if (operation == "Add") {
00048 return new AddEditPlaceJob(m_model, m_index, parameters, this);
00049 } else if (operation == "Edit") {
00050 return new AddEditPlaceJob(m_model, QModelIndex(), parameters, this);
00051 } else if (operation == "Remove") {
00052 return new RemovePlaceJob(m_model, m_index, this);
00053 } else if (operation == "Hide") {
00054 return new ShowPlaceJob(m_model, m_index, false, this);
00055 } else if (operation == "Show") {
00056 return new ShowPlaceJob(m_model, m_index, true, this);
00057 } else if (operation == "Setup Device") {
00058 return new SetupDeviceJob(m_model, m_index, this);
00059 } else if (operation == "Teardown Device") {
00060 return new TeardownDeviceJob(m_model, m_index, this);
00061 } else {
00062
00063 return 0;
00064 }
00065 }
00066
00067 #include "placeservice.moc"
00068
00069