1 /***************************************************************************
2 * Copyright (C) 2008 by Lukas Appelhans *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
20 #include "quicklaunchIcon.h"
22 #include <QGraphicsSceneContextMenuEvent>
23 #include <QGraphicsSceneDragDropEvent>
28 #include "quicklaunchApplet.h"
30 QuicklaunchIcon::QuicklaunchIcon(const KUrl
& appUrl
, const KIcon
& icon
, QuicklaunchApplet
*parent
)
31 : Plasma::IconWidget(icon
, QString(), parent
),
37 connect(this, SIGNAL(clicked()), SLOT(execute()));
40 QuicklaunchIcon::~QuicklaunchIcon()
44 KUrl
QuicklaunchIcon::url() const
49 void QuicklaunchIcon::execute()
51 new KRun(m_appUrl
, 0);
54 void QuicklaunchIcon::contextMenuEvent(QGraphicsSceneContextMenuEvent
*event
)
57 m
.addAction(m_launcher
->action("configure"));
59 m
.addActions(m_launcher
->contextActions(this));
61 m
.addAction(m_launcher
->action("remove"));
62 m
.exec(event
->screenPos());
65 /*bool QuicklaunchIcon::eventFilter(QObject * object, QEvent * event)
67 if (event->type() != QEvent::GraphicsSceneMouseMove) {
68 return Plasma::IconWidget::eventFilter(object, event);
71 QDrag * drag = new QDrag(static_cast<QGraphicsSceneMouseEvent*>(event)->widget());
72 QMimeData * data = new QMimeData;
75 urls.populateMimeData(data);
76 drag->setMimeData(data);