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

Engines

placeservice.cpp

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 
00020 #include "placeservice.h"
00021 #include "jobs.h"
00022 
00023 #include <KDebug>
00024 
00025 
00026 PlaceService::PlaceService(QObject* parent,
00027                            KFilePlacesModel* model,
00028                            QModelIndex index)
00029     : Plasma::Service(parent),
00030       m_model(model),
00031       m_index(index)
00032 {
00033     setName("places");
00034     if (m_index.isValid()) {
00035         Q_ASSERT(m_index.model() == model);
00036         setDestination(QString::number(m_index.row()));
00037         kDebug() << "Created a place service for" << destination();
00038     } else {
00039         kDebug() << "Created a dead place service";
00040     }
00041 }
00042 
00043 Plasma::ServiceJob* PlaceService::createJob(const QString& operation,
00044                                             QMap<QString,QVariant>& parameters)
00045 {
00046     kDebug() << "Job" << operation << "with arguments" << parameters << "requested";
00047     if (operation == "Add") {
00048         return new AddEditPlaceJob(m_model, m_index, parameters, this);
00049     } else if (operation == "Edit") {
00050         return new AddEditPlaceJob(m_model, QModelIndex(), parameters, this);
00051     } else if (operation == "Remove") {
00052         return new RemovePlaceJob(m_model, m_index, this);
00053     } else if (operation == "Hide") {
00054         return new ShowPlaceJob(m_model, m_index, false, this);
00055     } else if (operation == "Show") {
00056         return new ShowPlaceJob(m_model, m_index, true, this);
00057     } else if (operation == "Setup Device") {
00058         return new SetupDeviceJob(m_model, m_index, this);
00059     } else if (operation == "Teardown Device") {
00060         return new TeardownDeviceJob(m_model, m_index, this);
00061     } else {
00062         // FIXME: BAD!  No!
00063         return 0;
00064     }
00065 }
00066 
00067 #include "placeservice.moc"
00068 
00069 // vim: sw=4 sts=4 et tw=100

Engines

Skip menu "Engines"
  • 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