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

Applets

extendertask.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2008 Rob Scheepmaker <r.scheepmaker@student.utwente.nl> *
00003  *                                                                         *
00004  *   This program is free software; you can redistribute it and/or modify  *
00005  *   it under the terms of the GNU General Public License as published by  *
00006  *   the Free Software Foundation; either version 2 of the License, or     *
00007  *   (at your option) any later version.                                   *
00008  *                                                                         *
00009  *   This program 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         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU General Public License     *
00015  *   along with this program; if not, write to the                         *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
00018  ***************************************************************************/
00019 
00020 #include "extendertask.h"
00021 #include <fixx11h.h>
00022 
00023 #include <QtGui/QWidget> // QWIDGETSIZE_MAX
00024 
00025 #include <plasma/popupapplet.h>
00026 #include <plasma/widgets/iconwidget.h>
00027 
00028 
00029 namespace SystemTray
00030 {
00031 
00032 class ExtenderTask::Private
00033 {
00034 public:
00035     Private(Plasma::PopupApplet *systemTray, Task *q)
00036         : q(q),
00037           iconWidget(0),
00038           systemTray(systemTray)
00039     {
00040     }
00041 
00042     Task *q;
00043     QString typeId;
00044     QString iconName;
00045     QIcon icon;
00046     Plasma::IconWidget *iconWidget;
00047     Plasma::PopupApplet *systemTray;
00048 };
00049 
00050 
00051 ExtenderTask::ExtenderTask(Plasma::PopupApplet *systemTray)
00052     : d(new Private(systemTray, this))
00053 {
00054     setOrder(Last);
00055 }
00056 
00057 
00058 ExtenderTask::~ExtenderTask()
00059 {
00060     emit taskDeleted(d->typeId);
00061     delete d;
00062 }
00063 
00064 
00065 bool ExtenderTask::isEmbeddable() const
00066 {
00067     return true;
00068 }
00069 
00070 bool ExtenderTask::isValid() const
00071 {
00072     return true;
00073 }
00074 
00075 bool ExtenderTask::isHideable() const
00076 {
00077     return false;
00078 }
00079 
00080 QString ExtenderTask::name() const
00081 {
00082     return i18n("Show or hide notifications and jobs");
00083 }
00084 
00085 
00086 QString ExtenderTask::typeId() const
00087 {
00088     //FIXME: what should we return here?
00089     return "toggle_extender";
00090 }
00091 
00092 
00093 QIcon ExtenderTask::icon() const
00094 {
00095     return d->icon;
00096 }
00097 
00098 void ExtenderTask::setIcon(const QString &icon)
00099 {
00100     d->iconName = icon;
00101     if (d->iconWidget) {
00102         d->iconWidget->setIcon(icon);
00103     }
00104 }
00105 
00106 QGraphicsWidget* ExtenderTask::createWidget(Plasma::Applet *host)
00107 {
00108     d->iconWidget = new Plasma::IconWidget(host);
00109     d->iconWidget->setToolTip(i18n("Toggle visibility of notifications and jobs"));
00110     d->iconWidget->setIcon(d->iconName);
00111     d->iconWidget->setMinimumSize(22, 22);
00112     d->iconWidget->setMaximumSize(26, QWIDGETSIZE_MAX);
00113     connect(d->iconWidget, SIGNAL(clicked()), d->systemTray, SLOT(togglePopup()));
00114     return d->iconWidget;
00115 }
00116 
00117 
00118 }
00119 
00120 #include "extendertask.moc"

Applets

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