• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Plasma

taskjob.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 2008 Alain Boyer <alainboyer@gmail.com>
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU Library General Public License version 2 as
00006  * published by the Free Software Foundation
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  * GNU General Public License for more details
00012  *
00013  * You should have received a copy of the GNU Library General Public
00014  * License along with this program; if not, write to the
00015  * Free Software Foundation, Inc.,
00016  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00017  */
00018 
00019 #include "taskjob.h"
00020 
00021 TaskJob::TaskJob(TaskSource *source, const QString &operation, QMap<QString, QVariant> &parameters, QObject *parent) :
00022     ServiceJob(source->objectName(), operation, parameters, parent),
00023     m_source(source)
00024 {
00025 }
00026 
00027 TaskJob::~TaskJob()
00028 {
00029 }
00030 
00031 void TaskJob::start()
00032 {
00033     // only a subset of task operations are exported
00034     QString operation = operationName();
00035     if (operation.startsWith("set")) {
00036         if (operation == "setMaximized") {
00037             m_source->getTask()->setMaximized(parameters().value("maximized").toBool());
00038             setResult(true);
00039             return;
00040         }
00041         else if (operation == "setMinimized") {
00042             m_source->getTask()->setIconified(parameters().value("minimized").toBool());
00043             setResult(true);
00044             return;
00045         }
00046         else if (operation == "setShaded") {
00047             m_source->getTask()->setShaded(parameters().value("shaded").toBool());
00048             setResult(true);
00049             return;
00050         }
00051         else if (operation == "setFullScreen") {
00052             m_source->getTask()->setFullScreen(parameters().value("fullScreen").toBool());
00053             setResult(true);
00054             return;
00055         }
00056         else if (operation == "setAlwaysOnTop") {
00057             m_source->getTask()->setAlwaysOnTop(parameters().value("alwaysOnTop").toBool());
00058             setResult(true);
00059             return;
00060         }
00061         else if (operation == "setKeptBelowOthers") {
00062             m_source->getTask()->setKeptBelowOthers(parameters().value("keptBelowOthers").toBool());
00063             setResult(true);
00064             return;
00065         }
00066     }
00067     else if (operation.startsWith("toggle")) {
00068         if (operation == "toggleMaximized") {
00069             m_source->getTask()->toggleMaximized();
00070             setResult(true);
00071             return;
00072         }
00073         else if (operation == "toggleMinimized") {
00074             m_source->getTask()->toggleIconified();
00075             setResult(true);
00076             return;
00077         }
00078         else if (operation == "toggleShaded") {
00079             m_source->getTask()->toggleShaded();
00080             setResult(true);
00081             return;
00082         }
00083         else if (operation == "toggleFullScreen") {
00084             m_source->getTask()->toggleFullScreen();
00085             setResult(true);
00086             return;
00087         }
00088         else if (operation == "toggleAlwaysOnTop") {
00089             m_source->getTask()->toggleAlwaysOnTop();
00090             setResult(true);
00091             return;
00092         }
00093         else if (operation == "toggleKeptBelowOthers") {
00094             m_source->getTask()->toggleKeptBelowOthers();
00095             setResult(true);
00096             return;
00097         }
00098     }
00099     else {
00100         if (operation == "restore") {
00101             m_source->getTask()->restore();
00102             setResult(true);
00103             return;
00104         }
00105         else if (operation == "raise") {
00106             m_source->getTask()->raise();
00107             setResult(true);
00108             return;
00109         }
00110         else if (operation == "lower") {
00111             m_source->getTask()->lower();
00112             setResult(true);
00113             return;
00114         }
00115         else if (operation == "activate") {
00116             m_source->getTask()->activate();
00117             setResult(true);
00118             return;
00119         }
00120         else if (operation == "activateRaiseOrMaximize") {
00121             m_source->getTask()->activateRaiseOrIconify();
00122             setResult(true);
00123             return;
00124         }
00125         else if (operation == "close") {
00126             m_source->getTask()->close();
00127             setResult(true);
00128             return;
00129         }
00130         else if (operation == "toDesktop") {
00131             m_source->getTask()->toDesktop(parameters().value("desktop").toInt());
00132             setResult(true);
00133             return;
00134         }
00135         else if (operation == "toCurrentDesktop") {
00136             m_source->getTask()->toCurrentDesktop();
00137             setResult(true);
00138             return;
00139         }
00140     }
00141     setResult(false);
00142 }
00143 
00144 #include "taskjob.moc"

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal