2
* Copyright 2009 Aaron Seigo <aseigo@kde.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Library General Public License as
6
* published by the Free Software Foundation; either version 2, 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 Library General Public
15
* License 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.
23
#include <QGraphicsLinearLayout>
25
#include <Plasma/Applet>
26
#include <Plasma/Containment>
27
#include <Plasma/Corona>
29
namespace WorkspaceScripting
39
QWeakPointer<Plasma::Applet> applet;
42
Widget::Widget(Plasma::Applet *applet, QObject *parent)
44
d(new Widget::Private)
47
setCurrentConfigGroup(QStringList());
48
setCurrentGlobalConfigGroup(QStringList());
53
reloadConfigIfNeeded();
57
uint Widget::id() const
60
return d->applet.data()->id();
66
QString Widget::type() const
69
return d->applet.data()->pluginName();
78
d->applet.data()->destroy();
83
void Widget::setGlobalShortcut(const QString &shortcut)
86
d->applet.data()->setGlobalShortcut(KShortcut(shortcut));
90
QString Widget::globalShorcut() const
93
return d->applet.data()->globalShortcut().toString();
99
Plasma::Applet *Widget::applet() const
101
return d->applet.data();
104
int Widget::index() const
110
Plasma::Applet *applet = d->applet.data();
111
Plasma::Containment *c = applet->containment();
116
QGraphicsLayout *layout = c->layout();
121
for (int i = 0; i < layout->count(); ++i) {
122
if (layout->itemAt(i) == applet) {
130
void Widget::setIndex(int index)
136
Plasma::Applet *applet = d->applet.data();
137
Plasma::Containment *c = applet->containment();
142
//FIXME: this is hackish. would be nice to define this for gridlayouts too
143
QGraphicsLinearLayout *layout = dynamic_cast<QGraphicsLinearLayout *>(c->layout());
148
layout->insertItem(index, applet);
151
QRectF Widget::geometry() const
154
return d->applet.data()->geometry();
160
void Widget::setGeometry(const QRectF &geometry)
163
d->applet.data()->setGeometry(geometry);
167
void Widget::showConfigurationInterface()
170
d->applet.data()->showConfigurationInterface();
176
#include "widget.moc"