summaryrefslogtreecommitdiffstats
path: root/kmail/kmsystemtray.h
blob: 0472a98cb375197038f7291ccb9a1c922655ea4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/***************************************************************************
              kmsystemtray.h  -  description
               -------------------
  begin                : Fri Aug 31 22:38:44 EDT 2001
  copyright            : (C) 2001 by Ryan Breen
  email                : [email protected]
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KMSYSTEMTRAY_H
#define KMSYSTEMTRAY_H

#include <ksystemtray.h>

#include <tqmap.h>
#include <tqguardedptr.h>
#include <tqvaluevector.h>
#include <tqpixmap.h>
#include <tqimage.h>

#include <time.h>

class KMFolder;
class KMMainWidget;
class TQMouseEvent;
class TDEPopupMenu;
class TQPoint;

/**
 * KMSystemTray extends KSystemTray and handles system
 * tray notification for KMail
 */
class KMSystemTray : public KSystemTray
{
  TQ_OBJECT
  
public:
  /** construtor */
  KMSystemTray(TQWidget* parent=0, const char *name=0);
  /** destructor */
  ~KMSystemTray();

  void setMode(int mode);
  int mode() const;

  void hideKMail();
  bool hasUnreadMail() const;

public slots:
  void foldersChanged();

private slots:
  void updateNewMessageNotification(KMFolder * folder);
  void selectedAccount(int);
  void updateNewMessages();
  void tray_quit();

protected:
  void mousePressEvent(TQMouseEvent *);
  bool mainWindowIsOnCurrentDesktop();
  void showKMail();
  void buildPopupMenu();
  void updateCount();
  void resizeEvent(TQResizeEvent *);

  TQString prettyName(KMFolder *);

private:

  bool mParentVisible;
  TQPoint mPosOfMainWin;
  int mDesktopOfMainWin;

  int mMode;
  int mCount;
  int mNewMessagePopupId;

  TDEPopupMenu * mPopupMenu;
  TQPixmap mDefaultIcon;
  TQImage mLightIconImage;

  TQValueVector<KMFolder*> mPopupFolders;
  TQMap<TQGuardedPtr<KMFolder>, int> mFoldersWithUnread;
  TQMap<TQGuardedPtr<KMFolder>, bool> mPendingUpdates;
  TQTimer *mUpdateTimer;
  time_t mLastUpdate;
};

#endif