add more spacing
[personal-kdebase.git] / workspace / plasma / dataengines / places / placeservice.cpp
blob857992beeb354035445ded26c2de23f230125faf
1 /*
2 * Copyright 2008 Alex Merry <alex.merry@kdemail.net>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301 USA
20 #include "placeservice.h"
21 #include "jobs.h"
23 #include <KDebug>
26 PlaceService::PlaceService(QObject* parent,
27 KFilePlacesModel* model,
28 QModelIndex index)
29 : Plasma::Service(parent),
30 m_model(model),
31 m_index(index)
33 setName("places");
34 if (m_index.isValid()) {
35 Q_ASSERT(m_index.model() == model);
36 setDestination(QString::number(m_index.row()));
37 kDebug() << "Created a place service for" << destination();
38 } else {
39 kDebug() << "Created a dead place service";
43 Plasma::ServiceJob* PlaceService::createJob(const QString& operation,
44 QMap<QString,QVariant>& parameters)
46 kDebug() << "Job" << operation << "with arguments" << parameters << "requested";
47 if (operation == "Add") {
48 return new AddEditPlaceJob(m_model, m_index, parameters, this);
49 } else if (operation == "Edit") {
50 return new AddEditPlaceJob(m_model, QModelIndex(), parameters, this);
51 } else if (operation == "Remove") {
52 return new RemovePlaceJob(m_model, m_index, this);
53 } else if (operation == "Hide") {
54 return new ShowPlaceJob(m_model, m_index, false, this);
55 } else if (operation == "Show") {
56 return new ShowPlaceJob(m_model, m_index, true, this);
57 } else if (operation == "Setup Device") {
58 return new SetupDeviceJob(m_model, m_index, this);
59 } else if (operation == "Teardown Device") {
60 return new TeardownDeviceJob(m_model, m_index, this);
61 } else {
62 // FIXME: BAD! No!
63 return 0;
67 #include "placeservice.moc"
69 // vim: sw=4 sts=4 et tw=100