Applets
quicklaunchIcon.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "quicklaunchIcon.h"
00021
00022 #include <QGraphicsSceneContextMenuEvent>
00023 #include <QGraphicsSceneDragDropEvent>
00024
00025 #include <KMenu>
00026 #include <KRun>
00027
00028 #include "quicklaunchApplet.h"
00029
00030 QuicklaunchIcon::QuicklaunchIcon(const KUrl & appUrl, const KIcon & icon, QuicklaunchApplet *parent)
00031 : Plasma::IconWidget(icon, QString(), parent),
00032 m_launcher(parent),
00033 m_appUrl(appUrl),
00034 m_removeAction(0)
00035 {
00036 setAcceptDrops(true);
00037 connect(this, SIGNAL(clicked()), SLOT(execute()));
00038 }
00039
00040 QuicklaunchIcon::~QuicklaunchIcon()
00041 {
00042 }
00043
00044 KUrl QuicklaunchIcon::url() const
00045 {
00046 return m_appUrl;
00047 }
00048
00049 void QuicklaunchIcon::execute()
00050 {
00051 new KRun(m_appUrl, 0);
00052 }
00053
00054 void QuicklaunchIcon::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
00055 {
00056 KMenu m;
00057 m.addAction(m_launcher->action("configure"));
00058 m.addSeparator();
00059 m.addActions(m_launcher->contextActions(this));
00060 m.addSeparator();
00061 m.addAction(m_launcher->action("remove"));
00062 m.exec(event->screenPos());
00063 }
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080