setAspectRatioMode(Plasma::ConstrainedSquare);
int iconSize = IconSize(KIconLoader::Desktop);
resize(iconSize * 2, iconSize * 2);
- setAcceptDrops(true);
- connect(&m_timer, SIGNAL(timeout()), this, SLOT(minimizeAll()));
}
void ShowDesktop::init()
layout->setContentsMargins(0, 0, 0, 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);
- registerAsDragHandle(icon);
connect(icon, SIGNAL(clicked()), this, SLOT(minimizeAll()));
- Plasma::ToolTipContent toolTipData(i18n("Show the Desktop"),
- i18n("Minimize all open windows and show the Desktop"),
- icon->icon().pixmap(IconSize(KIconLoader::Desktop)));
+ Plasma::ToolTipContent toolTipData(
+ i18n("Show the Desktop"),
+ i18n("Minimize all open windows and show the Desktop"),
+ icon->icon().pixmap(IconSize(KIconLoader::Desktop))
+ );
Plasma::ToolTipManager::self()->setContent(this, toolTipData);
NETRootInfo info(QX11Info::display(), NET::Supported);
void ShowDesktop::minimizeAll()
{
- m_timer.stop();
if (m_wm2ShowingDesktop) {
NETRootInfo info(QX11Info::display(), 0);
#ifndef MINIMIZE_ONLY
}
}
-void ShowDesktop::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
-{
- m_timer.start(750);
- event->accept();
-}
-
-void ShowDesktop::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
-{
- m_timer.stop();
-}
-
#ifndef MINIMIZE_ONLY
void ShowDesktop::delay()
{
//#define MINIMIZE_ONLY
#include <Plasma/Applet>
-#include <QTimer>
-#include <QtGui/qgraphicssceneevent.h>
class ShowDesktop : public Plasma::Applet
{
#endif
protected:
- void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
- void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const;
private slots:
bool m_down;
bool m_goingDown;
#endif
- QTimer m_timer;
};
K_EXPORT_PLASMA_APPLET(showdesktop, ShowDesktop)