add more spacing
[personal-kdebase.git] / workspace / plasma / dataengines / places / jobs.h
blobe6867cd78a3882d3f4e73678ece413d1507dcb6d
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
19 #ifndef JOBS_H
20 #define JOBS_H
22 #include "modeljob.h"
24 class AddEditPlaceJob : public ModelJob
26 public:
27 AddEditPlaceJob(KFilePlacesModel* model,
28 QModelIndex index,
29 const QVariantMap& parameters,
30 QObject* parent = 0)
31 : ModelJob(parent, model, index, (index.isValid() ? "Edit" : "Add"), parameters)
32 , m_text(parameters["Name"].toString())
33 , m_url(parameters["Url"].toUrl())
34 , m_icon(parameters["Icon"].toString())
37 void start()
39 if (m_index.isValid()) {
40 m_model->editPlace(m_index, m_text, m_url, m_icon);
41 } else {
42 m_model->addPlace(m_text, m_url, m_icon);
46 private:
47 QString m_text;
48 KUrl m_url;
49 QString m_icon;
52 class RemovePlaceJob : public ModelJob
54 public:
55 RemovePlaceJob(KFilePlacesModel* model, const QModelIndex& index,
56 QObject* parent)
57 : ModelJob(parent, model, index, "Remove")
60 void start()
62 m_model->removePlace(m_index);
66 class ShowPlaceJob : public ModelJob
68 public:
69 ShowPlaceJob(KFilePlacesModel* model, const QModelIndex& index,
70 bool show = true, QObject* parent = 0)
71 : ModelJob(parent, model, index, (show ? "Show" : "Hide"))
72 , m_show(show)
75 void start()
77 m_model->setPlaceHidden(m_index, m_show);
80 private:
81 bool m_show;
84 class TeardownDeviceJob : public ModelJob
86 public:
87 TeardownDeviceJob(KFilePlacesModel* model, const QModelIndex& index,
88 QObject* parent = 0)
89 : ModelJob(parent, model, index, "Teardown Device")
92 void start()
94 m_model->requestTeardown(m_index);
98 #include "setupdevicejob.h"
100 #endif // JOBS_H