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

Plasma

jobs.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2008  Alex Merry <alex.merry@kdemail.net>
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin St, Fifth Floor,
00017  * Boston, MA  02110-1301  USA
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 

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