Diffstat (limited to 'noncore/net/mail/taskbarapplet') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/taskbarapplet/mailapplet.cpp | 32 | ||||
-rw-r--r-- | noncore/net/mail/taskbarapplet/mailapplet.h | 2 |
2 files changed, 31 insertions, 3 deletions
diff --git a/noncore/net/mail/taskbarapplet/mailapplet.cpp b/noncore/net/mail/taskbarapplet/mailapplet.cpp index f3550c7..8bf4b89 100644 --- a/noncore/net/mail/taskbarapplet/mailapplet.cpp +++ b/noncore/net/mail/taskbarapplet/mailapplet.cpp | |||
@@ -59,17 +59,45 @@ void MailApplet::slotClicked() { | |||
59 | device->setLedState( led, Led_Off ); | 59 | device->setLedState( led, Led_Off ); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | void MailApplet::slotCheck() { | 63 | void MailApplet::slotCheck() { |
64 | // Check wether the check interval has been changed. | 64 | // Check wether the check interval has been changed. |
65 | int newIntervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; | 65 | int newIntervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; |
66 | if ( newIntervalMs != m_intervalMs ) { | 66 | if ( newIntervalMs != m_intervalMs ) { |
67 | m_intervalTimer->changeInterval( newIntervalMs ); | 67 | m_intervalTimer->changeInterval( newIntervalMs ); |
68 | m_intervalMs = newIntervalMs; | 68 | m_intervalMs = newIntervalMs; |
69 | } | 69 | } |
70 | 70 | ||
71 | int newMails = 0; | ||
72 | |||
73 | if ( true ) { | ||
74 | ODevice *device = ODevice::inst(); | ||
75 | if ( isHidden() ) show(); | ||
76 | if ( m_config->readBoolEntry( "BlinkLed", true ) ) { | ||
77 | if ( !device-> ledList ( ).isEmpty( ) ) { | ||
78 | OLed led = ( device->ledList( ).contains( Led_Mail ) ) ? Led_Mail : device->ledList( ) [0]; | ||
79 | device->setLedState( led, device->ledStateList( led ).contains( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On ); | ||
80 | } | ||
81 | } | ||
82 | if ( m_config->readBoolEntry( "PlaySound", false ) ) | ||
83 | device->alarmSound(); | ||
84 | |||
85 | Config cfg( "mail" ); | ||
86 | cfg.setGroup( "Status" ); | ||
87 | cfg.writeEntry( "NewMails", newMails ); // todo | ||
88 | |||
89 | QCopEnvelope env( "QPE/Pim", "newMails(int)" ); | ||
90 | env << newMails; | ||
91 | |||
92 | } else { | ||
93 | ODevice *device = ODevice::inst(); | ||
94 | if ( !isHidden() ) hide(); | ||
95 | if ( !device-> ledList( ).isEmpty( ) ) { | ||
96 | OLed led = ( device->ledList( ).contains( Led_Mail ) ) ? Led_Mail : device->ledList( ) [0]; | ||
97 | device->setLedState( led, Led_Off ); | ||
98 | } | ||
99 | } | ||
100 | |||
71 | // go trough accounts and check here | 101 | // go trough accounts and check here |
72 | // depending on result show or hide | ||
73 | // also trigger qcop call and save status to config | 102 | // also trigger qcop call and save status to config |
74 | // get led to blink | ||
75 | } | 103 | } |
diff --git a/noncore/net/mail/taskbarapplet/mailapplet.h b/noncore/net/mail/taskbarapplet/mailapplet.h index 1c48b29..34bdc22 100644 --- a/noncore/net/mail/taskbarapplet/mailapplet.h +++ b/noncore/net/mail/taskbarapplet/mailapplet.h | |||
@@ -2,25 +2,25 @@ | |||
2 | #define MAILAPPLET_H | 2 | #define MAILAPPLET_H |
3 | 3 | ||
4 | #include <qbutton.h> | 4 | #include <qbutton.h> |
5 | 5 | ||
6 | class Config; | 6 | class Config; |
7 | class QTimer; | 7 | class QTimer; |
8 | 8 | ||
9 | class MailApplet : public QButton { | 9 | class MailApplet : public QButton { |
10 | 10 | ||
11 | Q_OBJECT | 11 | Q_OBJECT |
12 | 12 | ||
13 | public: | 13 | public: |
14 | MailApplet(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); | 14 | MailApplet( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); |
15 | 15 | ||
16 | protected: | 16 | protected: |
17 | void drawButton(QPainter *); | 17 | void drawButton(QPainter *); |
18 | void drawButtonText(QPainter *); | 18 | void drawButtonText(QPainter *); |
19 | void gotNewMail(); | 19 | void gotNewMail(); |
20 | 20 | ||
21 | protected slots: | 21 | protected slots: |
22 | void slotCheck(); | 22 | void slotCheck(); |
23 | void slotClicked(); | 23 | void slotClicked(); |
24 | private: | 24 | private: |
25 | Config *m_config; | 25 | Config *m_config; |
26 | QTimer *m_intervalTimer; | 26 | QTimer *m_intervalTimer; |