~blue-shell/blue-shell/kde-workspace-systemsettings-qml-4.9

« back to all changes in this revision

Viewing changes to ksystraycmd/ksystraycmd.h

  • Committer: Richard J. Moore
  • Date: 2001-08-18 00:38:05 UTC
  • Revision ID: git-v1:adc23beb62af921ece4521c9623f19ec9bf4e663
Move ksystrayproxy from kdenonbeta and renamed to ksystraycmd

svn path=/trunk/kdebase/ksystraycmd/; revision=110820

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- c++ -*-
 
2
 
 
3
#ifndef KSYSTRAYCMD_H
 
4
#define KSYSTRAYCMD_H
 
5
 
 
6
#include <qlabel.h>
 
7
#include <kwin.h>
 
8
 
 
9
class KShellProcess;
 
10
class KWinModule;
 
11
 
 
12
/**
 
13
 * Provides a system tray icon for a normal window.
 
14
 *
 
15
 * @author Richard Moore, rich@kde.org
 
16
 * @version $Id$
 
17
 */
 
18
class KSysTrayCmd : public QLabel
 
19
{
 
20
  Q_OBJECT
 
21
public:
 
22
  KSysTrayCmd();
 
23
  ~KSysTrayCmd();
 
24
 
 
25
  void setCommand( const QString &cmd ) { command = cmd; }
 
26
  void setPattern( const QString &regexp ) { window = regexp; }
 
27
  void setStartOnShow( bool enable ) { lazyStart = enable; }
 
28
  void setNoQuit( bool enable ) { noquit = enable; }
 
29
  void setDefaultTip( const QString &tip ) { tooltip = tip; }
 
30
  bool hasTargetWindow() const { return (win != 0); }
 
31
  bool hasRunningClient() const { return (client != 0); }
 
32
  const QString &errorMsg() const { return errStr; }
 
33
 
 
34
  bool start();
 
35
 
 
36
public slots:
 
37
  void refresh();
 
38
 
 
39
  void showWindow();
 
40
  void hideWindow();
 
41
  void toggleWindow() { if ( isVisible ) hideWindow(); else showWindow(); }
 
42
 
 
43
  void setTargetWindow( WId w );
 
44
  void execContextMenu( const QPoint &pos );
 
45
 
 
46
  void quit();
 
47
 
 
48
protected slots:
 
49
  void clientExited();
 
50
 
 
51
  void windowAdded(WId w);
 
52
  void windowChanged(WId w);
 
53
 
 
54
protected:
 
55
  bool startClient();
 
56
  void checkExistingWindows();
 
57
  void setTargetWindow( const KWin::Info &info );
 
58
 
 
59
  void mousePressEvent( QMouseEvent *e );
 
60
  void enterEvent( QEvent* );
 
61
 
 
62
private:
 
63
  QString command;
 
64
  QString window;
 
65
  QString tooltip;
 
66
  bool isVisible;
 
67
  bool lazyStart;
 
68
  bool noquit;
 
69
 
 
70
  WId win;
 
71
  KShellProcess *client;
 
72
  KWinModule *kwinmodule;
 
73
  QString errStr;
 
74
};
 
75
 
 
76
#endif // KSYSTRAYCMD_H