mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-24 02:42:52 +00:00
kdeplasma-addons: do not register the showdesktop applet icon as drag handle
the feature to minimize on drag can be implemented by sub-classing Plasma::IconWidget but I dont need that kind of feature and it was borked Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
1c8b53127e
commit
b812f49201
2 changed files with 7 additions and 24 deletions
|
@ -37,8 +37,6 @@ ShowDesktop::ShowDesktop(QObject *parent, const QVariantList &args)
|
||||||
setAspectRatioMode(Plasma::ConstrainedSquare);
|
setAspectRatioMode(Plasma::ConstrainedSquare);
|
||||||
int iconSize = IconSize(KIconLoader::Desktop);
|
int iconSize = IconSize(KIconLoader::Desktop);
|
||||||
resize(iconSize * 2, iconSize * 2);
|
resize(iconSize * 2, iconSize * 2);
|
||||||
setAcceptDrops(true);
|
|
||||||
connect(&m_timer, SIGNAL(timeout()), this, SLOT(minimizeAll()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowDesktop::init()
|
void ShowDesktop::init()
|
||||||
|
@ -49,14 +47,16 @@ void ShowDesktop::init()
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
|
|
||||||
Plasma::IconWidget *icon = new Plasma::IconWidget(KIcon("user-desktop"), QString(), this);
|
Plasma::IconWidget *icon = new Plasma::IconWidget(this);
|
||||||
|
icon->setIcon(KIcon("user-desktop"));
|
||||||
layout->addItem(icon);
|
layout->addItem(icon);
|
||||||
registerAsDragHandle(icon);
|
|
||||||
connect(icon, SIGNAL(clicked()), this, SLOT(minimizeAll()));
|
connect(icon, SIGNAL(clicked()), this, SLOT(minimizeAll()));
|
||||||
|
|
||||||
Plasma::ToolTipContent toolTipData(i18n("Show the Desktop"),
|
Plasma::ToolTipContent toolTipData(
|
||||||
|
i18n("Show the Desktop"),
|
||||||
i18n("Minimize all open windows and show the Desktop"),
|
i18n("Minimize all open windows and show the Desktop"),
|
||||||
icon->icon().pixmap(IconSize(KIconLoader::Desktop)));
|
icon->icon().pixmap(IconSize(KIconLoader::Desktop))
|
||||||
|
);
|
||||||
Plasma::ToolTipManager::self()->setContent(this, toolTipData);
|
Plasma::ToolTipManager::self()->setContent(this, toolTipData);
|
||||||
|
|
||||||
NETRootInfo info(QX11Info::display(), NET::Supported);
|
NETRootInfo info(QX11Info::display(), NET::Supported);
|
||||||
|
@ -79,7 +79,6 @@ void ShowDesktop::init()
|
||||||
|
|
||||||
void ShowDesktop::minimizeAll()
|
void ShowDesktop::minimizeAll()
|
||||||
{
|
{
|
||||||
m_timer.stop();
|
|
||||||
if (m_wm2ShowingDesktop) {
|
if (m_wm2ShowingDesktop) {
|
||||||
NETRootInfo info(QX11Info::display(), 0);
|
NETRootInfo info(QX11Info::display(), 0);
|
||||||
#ifndef MINIMIZE_ONLY
|
#ifndef MINIMIZE_ONLY
|
||||||
|
@ -94,17 +93,6 @@ void ShowDesktop::minimizeAll()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowDesktop::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
|
|
||||||
{
|
|
||||||
m_timer.start(750);
|
|
||||||
event->accept();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShowDesktop::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
|
|
||||||
{
|
|
||||||
m_timer.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef MINIMIZE_ONLY
|
#ifndef MINIMIZE_ONLY
|
||||||
void ShowDesktop::delay()
|
void ShowDesktop::delay()
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
//#define MINIMIZE_ONLY
|
//#define MINIMIZE_ONLY
|
||||||
|
|
||||||
#include <Plasma/Applet>
|
#include <Plasma/Applet>
|
||||||
#include <QTimer>
|
|
||||||
#include <QtGui/qgraphicssceneevent.h>
|
|
||||||
|
|
||||||
class ShowDesktop : public Plasma::Applet
|
class ShowDesktop : public Plasma::Applet
|
||||||
{
|
{
|
||||||
|
@ -40,8 +38,6 @@ public slots:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
|
|
||||||
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
|
|
||||||
QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const;
|
QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -53,7 +49,6 @@ private:
|
||||||
bool m_down;
|
bool m_down;
|
||||||
bool m_goingDown;
|
bool m_goingDown;
|
||||||
#endif
|
#endif
|
||||||
QTimer m_timer;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
K_EXPORT_PLASMA_APPLET(showdesktop, ShowDesktop)
|
K_EXPORT_PLASMA_APPLET(showdesktop, ShowDesktop)
|
||||||
|
|
Loading…
Add table
Reference in a new issue