summaryrefslogtreecommitdiffstats
path: root/ksystraycmd/ksystraycmd.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /ksystraycmd/ksystraycmd.h
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksystraycmd/ksystraycmd.h')
-rw-r--r--ksystraycmd/ksystraycmd.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/ksystraycmd/ksystraycmd.h b/ksystraycmd/ksystraycmd.h
new file mode 100644
index 000000000..ecb670fd5
--- /dev/null
+++ b/ksystraycmd/ksystraycmd.h
@@ -0,0 +1,89 @@
+// -*- c++ -*-
+
+#ifndef KSYSTRAYCMD_H
+#define KSYSTRAYCMD_H
+
+#include <qlabel.h>
+#include <kwin.h>
+
+class KShellProcess;
+class KWinModule;
+
+/**
+ * Provides a system tray icon for a normal window.
+ *
+ * @author Richard Moore, rich@kde.org
+ */
+class KSysTrayCmd : public QLabel
+{
+ Q_OBJECT
+public:
+ KSysTrayCmd();
+ ~KSysTrayCmd();
+
+ void setWindow( WId w ) { win = w; }
+ void setCommand( const QString &cmd ) { command = cmd; }
+ void setPattern( const QString &regexp ) { window = regexp; }
+ void setStartOnShow( bool enable ) { lazyStart = enable; isVisible = !enable; }
+ void setNoQuit( bool enable ) { noquit = enable; }
+ void setQuitOnHide( bool enable ) { quitOnHide = enable; }
+ void setOnTop( bool enable ) { onTop = enable; }
+ void setOwnIcon( bool enable ) { ownIcon = enable; }
+ void setDefaultTip( const QString &tip ) { tooltip = tip; }
+ bool hasTargetWindow() const { return (win != 0); }
+ bool hasRunningClient() const { return (client != 0); }
+ const QString &errorMsg() const { return errStr; }
+
+ bool start();
+
+ static WId findRealWindow( WId w, int depth = 0 );
+
+public slots:
+ void refresh();
+
+ void showWindow();
+ void hideWindow();
+ void toggleWindow() { if ( isVisible ) hideWindow(); else showWindow(); }
+
+ void setTargetWindow( WId w );
+ void execContextMenu( const QPoint &pos );
+
+ void quit();
+ void quitClient();
+
+protected slots:
+ void clientExited();
+
+ void windowAdded(WId w);
+ void windowChanged(WId w);
+
+protected:
+ bool startClient();
+ void checkExistingWindows();
+ void setTargetWindow( const KWin::WindowInfo &info );
+
+ void mousePressEvent( QMouseEvent *e );
+
+private:
+ QString command;
+ QString window;
+ QString tooltip;
+ bool isVisible;
+ bool lazyStart;
+ bool noquit;
+ bool quitOnHide;
+ bool onTop; ///< tells if window must stay on top or not
+ bool ownIcon; ///< tells if the ksystraycmd icon must be used in systray
+
+ WId win;
+ KShellProcess *client;
+ KWinModule *kwinmodule;
+ QString errStr;
+
+ /** Memorized 'top' position of the window*/
+ int top;
+ /** Memorized 'left' position of the window*/
+ int left;
+};
+
+#endif // KSYSTRAYCMD_H