Plasma
jobs.h
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 #ifndef JOBS_H
00020 #define JOBS_H
00021
00022 #include "modeljob.h"
00023
00024 class AddEditPlaceJob : public ModelJob
00025 {
00026 public:
00027 AddEditPlaceJob(KFilePlacesModel* model,
00028 QModelIndex index,
00029 const QVariantMap& parameters,
00030 QObject* parent = 0)
00031 : ModelJob(parent, model, index, (index.isValid() ? "Edit" : "Add"), parameters)
00032 , m_text(parameters["Name"].toString())
00033 , m_url(parameters["Url"].toUrl())
00034 , m_icon(parameters["Icon"].toString())
00035 {}
00036
00037 void start()
00038 {
00039 if (m_index.isValid()) {
00040 m_model->editPlace(m_index, m_text, m_url, m_icon);
00041 } else {
00042 m_model->addPlace(m_text, m_url, m_icon);
00043 }
00044 }
00045
00046 private:
00047 QString m_text;
00048 KUrl m_url;
00049 QString m_icon;
00050 };
00051
00052 class RemovePlaceJob : public ModelJob
00053 {
00054 public:
00055 RemovePlaceJob(KFilePlacesModel* model, const QModelIndex& index,
00056 QObject* parent)
00057 : ModelJob(parent, model, index, "Remove")
00058 {}
00059
00060 void start()
00061 {
00062 m_model->removePlace(m_index);
00063 }
00064 };
00065
00066 class ShowPlaceJob : public ModelJob
00067 {
00068 public:
00069 ShowPlaceJob(KFilePlacesModel* model, const QModelIndex& index,
00070 bool show = true, QObject* parent = 0)
00071 : ModelJob(parent, model, index, (show ? "Show" : "Hide"))
00072 , m_show(show)
00073 {}
00074
00075 void start()
00076 {
00077 m_model->setPlaceHidden(m_index, m_show);
00078 }
00079
00080 private:
00081 bool m_show;
00082 };
00083
00084 class TeardownDeviceJob : public ModelJob
00085 {
00086 public:
00087 TeardownDeviceJob(KFilePlacesModel* model, const QModelIndex& index,
00088 QObject* parent = 0)
00089 : ModelJob(parent, model, index, "Teardown Device")
00090 {}
00091
00092 void start()
00093 {
00094 m_model->requestTeardown(m_index);
00095 }
00096 };
00097
00098 #include "setupdevicejob.h"
00099
00100 #endif // JOBS_H
00101