add more spacing
[personal-kdebase.git] / workspace / plasma / dataengines / tasks / taskjob.cpp
blob7ef30faac2fda30c3dc7774290ef5558c113214c
1 /*
2 * Copyright 2008 Alain Boyer <alainboyer@gmail.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License version 2 as
6 * published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details
13 * You should have received a copy of the GNU Library General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #include "taskjob.h"
21 TaskJob::TaskJob(TaskSource *source, const QString &operation, QMap<QString, QVariant> &parameters, QObject *parent) :
22 ServiceJob(source->objectName(), operation, parameters, parent),
23 m_source(source)
27 TaskJob::~TaskJob()
31 void TaskJob::start()
33 // only a subset of task operations are exported
34 QString operation = operationName();
35 if (operation.startsWith("set")) {
36 if (operation == "setMaximized") {
37 m_source->getTask()->setMaximized(parameters().value("maximized").toBool());
38 setResult(true);
39 return;
41 else if (operation == "setMinimized") {
42 m_source->getTask()->setIconified(parameters().value("minimized").toBool());
43 setResult(true);
44 return;
46 else if (operation == "setShaded") {
47 m_source->getTask()->setShaded(parameters().value("shaded").toBool());
48 setResult(true);
49 return;
51 else if (operation == "setFullScreen") {
52 m_source->getTask()->setFullScreen(parameters().value("fullScreen").toBool());
53 setResult(true);
54 return;
56 else if (operation == "setAlwaysOnTop") {
57 m_source->getTask()->setAlwaysOnTop(parameters().value("alwaysOnTop").toBool());
58 setResult(true);
59 return;
61 else if (operation == "setKeptBelowOthers") {
62 m_source->getTask()->setKeptBelowOthers(parameters().value("keptBelowOthers").toBool());
63 setResult(true);
64 return;
67 else if (operation.startsWith("toggle")) {
68 if (operation == "toggleMaximized") {
69 m_source->getTask()->toggleMaximized();
70 setResult(true);
71 return;
73 else if (operation == "toggleMinimized") {
74 m_source->getTask()->toggleIconified();
75 setResult(true);
76 return;
78 else if (operation == "toggleShaded") {
79 m_source->getTask()->toggleShaded();
80 setResult(true);
81 return;
83 else if (operation == "toggleFullScreen") {
84 m_source->getTask()->toggleFullScreen();
85 setResult(true);
86 return;
88 else if (operation == "toggleAlwaysOnTop") {
89 m_source->getTask()->toggleAlwaysOnTop();
90 setResult(true);
91 return;
93 else if (operation == "toggleKeptBelowOthers") {
94 m_source->getTask()->toggleKeptBelowOthers();
95 setResult(true);
96 return;
99 else {
100 if (operation == "restore") {
101 m_source->getTask()->restore();
102 setResult(true);
103 return;
105 else if (operation == "raise") {
106 m_source->getTask()->raise();
107 setResult(true);
108 return;
110 else if (operation == "lower") {
111 m_source->getTask()->lower();
112 setResult(true);
113 return;
115 else if (operation == "activate") {
116 m_source->getTask()->activate();
117 setResult(true);
118 return;
120 else if (operation == "activateRaiseOrMaximize") {
121 m_source->getTask()->activateRaiseOrIconify();
122 setResult(true);
123 return;
125 else if (operation == "close") {
126 m_source->getTask()->close();
127 setResult(true);
128 return;
130 else if (operation == "toDesktop") {
131 m_source->getTask()->toDesktop(parameters().value("desktop").toInt());
132 setResult(true);
133 return;
135 else if (operation == "toCurrentDesktop") {
136 m_source->getTask()->toCurrentDesktop();
137 setResult(true);
138 return;
141 setResult(false);
144 #include "taskjob.moc"