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

Applets

quicklaunchIcon.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2008 by Lukas Appelhans                                 *
00003  *   l.appelhans@gmx.de                                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
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 /*bool QuicklaunchIcon::eventFilter(QObject * object, QEvent * event)
00066 {
00067     if (event->type() != QEvent::GraphicsSceneMouseMove) {
00068         return Plasma::IconWidget::eventFilter(object, event);
00069     }
00070 
00071     QDrag * drag = new QDrag(static_cast<QGraphicsSceneMouseEvent*>(event)->widget());
00072     QMimeData * data = new QMimeData;
00073     KUrl::List urls;
00074     urls << m_appUrl;
00075     urls.populateMimeData(data);
00076     drag->setMimeData(data);
00077     drag->exec();
00078     event->accept();
00079     return true;
00080 }*/

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