1 /***************************************************************************
2 * Copyright (C) 2008 Rob Scheepmaker <r.scheepmaker@student.utwente.nl> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
18 ***************************************************************************/
20 #include "extendertask.h"
23 #include <QtGui/QWidget> // QWIDGETSIZE_MAX
25 #include <plasma/popupapplet.h>
26 #include <plasma/widgets/iconwidget.h>
32 class ExtenderTask::Private
35 Private(Plasma::PopupApplet
*systemTray
, Task
*q
)
38 systemTray(systemTray
)
46 Plasma::IconWidget
*iconWidget
;
47 Plasma::PopupApplet
*systemTray
;
51 ExtenderTask::ExtenderTask(Plasma::PopupApplet
*systemTray
)
52 : d(new Private(systemTray
, this))
58 ExtenderTask::~ExtenderTask()
60 emit
taskDeleted(d
->typeId
);
65 bool ExtenderTask::isEmbeddable() const
70 bool ExtenderTask::isValid() const
75 bool ExtenderTask::isHideable() const
80 QString
ExtenderTask::name() const
82 return i18n("Show or hide notifications and jobs");
86 QString
ExtenderTask::typeId() const
88 //FIXME: what should we return here?
89 return "toggle_extender";
93 QIcon
ExtenderTask::icon() const
98 void ExtenderTask::setIcon(const QString
&icon
)
102 d
->iconWidget
->setIcon(icon
);
106 QGraphicsWidget
* ExtenderTask::createWidget(Plasma::Applet
*host
)
108 d
->iconWidget
= new Plasma::IconWidget(host
);
109 d
->iconWidget
->setToolTip(i18n("Toggle visibility of notifications and jobs"));
110 d
->iconWidget
->setIcon(d
->iconName
);
111 d
->iconWidget
->setMinimumSize(22, 22);
112 d
->iconWidget
->setMaximumSize(26, QWIDGETSIZE_MAX
);
113 connect(d
->iconWidget
, SIGNAL(clicked()), d
->systemTray
, SLOT(togglePopup()));
114 return d
->iconWidget
;
120 #include "extendertask.moc"