Diffstat (limited to 'noncore/net/mail/taskbarapplet') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/taskbarapplet/mailapplet.cpp | 33 | ||||
-rw-r--r-- | noncore/net/mail/taskbarapplet/mailapplet.h | 5 | ||||
-rw-r--r-- | noncore/net/mail/taskbarapplet/taskbarapplet.pro | 2 |
3 files changed, 33 insertions, 7 deletions
diff --git a/noncore/net/mail/taskbarapplet/mailapplet.cpp b/noncore/net/mail/taskbarapplet/mailapplet.cpp index 5ba7085..f81dce8 100644 --- a/noncore/net/mail/taskbarapplet/mailapplet.cpp +++ b/noncore/net/mail/taskbarapplet/mailapplet.cpp | |||
@@ -10,6 +10,9 @@ | |||
10 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
11 | 11 | ||
12 | #include <opie/odevice.h> | 12 | #include <opie/odevice.h> |
13 | #include <qlist.h> | ||
14 | |||
15 | #include <libmailwrapper/settings.h> | ||
13 | 16 | ||
14 | #include "mailapplet.h" | 17 | #include "mailapplet.h" |
15 | 18 | ||
@@ -40,8 +43,13 @@ MailApplet::MailApplet( QWidget *parent, const char *name, WFlags fl ) | |||
40 | m_intervalTimer->start( m_intervalMs ); | 43 | m_intervalTimer->start( m_intervalMs ); |
41 | connect( m_intervalTimer, SIGNAL(timeout() ), SLOT( slotCheck() ) ); | 44 | connect( m_intervalTimer, SIGNAL(timeout() ), SLOT( slotCheck() ) ); |
42 | 45 | ||
43 | QTimer::singleShot( 0, this, SLOT( slotCheck() ) ); | 46 | // delay 5 sec until the whole mail backend gets started .-) |
47 | QTimer::singleShot( 5000, this, SLOT( startup() ) ); | ||
48 | } | ||
44 | } | 49 | } |
50 | |||
51 | MailApplet::~MailApplet() { | ||
52 | delete m_statusMail; | ||
45 | } | 53 | } |
46 | 54 | ||
47 | void MailApplet::drawButton(QPainter *) { } | 55 | void MailApplet::drawButton(QPainter *) { } |
@@ -58,6 +66,15 @@ void MailApplet::slotClicked() { | |||
58 | 66 | ||
59 | device->setLedState( led, Led_Off ); | 67 | device->setLedState( led, Led_Off ); |
60 | } | 68 | } |
69 | |||
70 | // m_statusMails->reset_status(); | ||
71 | } | ||
72 | |||
73 | void MailApplet::startup() { | ||
74 | Settings *settings = new Settings(); | ||
75 | QList<Account> ma = settings->getAccounts(); | ||
76 | StatusMail m_statusMail = StatusMail( ma ); | ||
77 | delete settings; | ||
61 | } | 78 | } |
62 | 79 | ||
63 | void MailApplet::slotCheck() { | 80 | void MailApplet::slotCheck() { |
@@ -68,9 +85,12 @@ void MailApplet::slotCheck() { | |||
68 | m_intervalMs = newIntervalMs; | 85 | m_intervalMs = newIntervalMs; |
69 | } | 86 | } |
70 | 87 | ||
71 | int newMails = 0; | ||
72 | 88 | ||
73 | if ( true ) { | 89 | folderStat stat; |
90 | m_statusMail->check_current_stat( stat ); | ||
91 | |||
92 | qDebug( QString( "test %1" ).arg( stat.message_unseen ) ); | ||
93 | if ( stat.message_unseen > 0 ) { | ||
74 | ODevice *device = ODevice::inst(); | 94 | ODevice *device = ODevice::inst(); |
75 | if ( isHidden() ) show(); | 95 | if ( isHidden() ) show(); |
76 | if ( m_config->readBoolEntry( "BlinkLed", true ) ) { | 96 | if ( m_config->readBoolEntry( "BlinkLed", true ) ) { |
@@ -82,12 +102,13 @@ void MailApplet::slotCheck() { | |||
82 | if ( m_config->readBoolEntry( "PlaySound", false ) ) | 102 | if ( m_config->readBoolEntry( "PlaySound", false ) ) |
83 | device->alarmSound(); | 103 | device->alarmSound(); |
84 | 104 | ||
105 | qDebug( QString( "test %1" ).arg( stat.message_unseen ) ); | ||
106 | |||
85 | Config cfg( "mail" ); | 107 | Config cfg( "mail" ); |
86 | cfg.setGroup( "Status" ); | 108 | cfg.setGroup( "Status" ); |
87 | cfg.writeEntry( "NewMails", newMails ); // todo | 109 | cfg.writeEntry( "NewMails", ( int )stat.message_unseen ); |
88 | |||
89 | QCopEnvelope env( "QPE/Pim", "newMails(int)" ); | 110 | QCopEnvelope env( "QPE/Pim", "newMails(int)" ); |
90 | env << newMails; | 111 | env << stat.message_unseen; |
91 | 112 | ||
92 | } else { | 113 | } else { |
93 | ODevice *device = ODevice::inst(); | 114 | ODevice *device = ODevice::inst(); |
diff --git a/noncore/net/mail/taskbarapplet/mailapplet.h b/noncore/net/mail/taskbarapplet/mailapplet.h index 34bdc22..8369176 100644 --- a/noncore/net/mail/taskbarapplet/mailapplet.h +++ b/noncore/net/mail/taskbarapplet/mailapplet.h | |||
@@ -3,6 +3,8 @@ | |||
3 | 3 | ||
4 | #include <qbutton.h> | 4 | #include <qbutton.h> |
5 | 5 | ||
6 | #include <libmailwrapper/statusmail.h> | ||
7 | |||
6 | class Config; | 8 | class Config; |
7 | class QTimer; | 9 | class QTimer; |
8 | 10 | ||
@@ -12,6 +14,7 @@ class MailApplet : public QButton { | |||
12 | 14 | ||
13 | public: | 15 | public: |
14 | MailApplet( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); | 16 | MailApplet( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); |
17 | ~MailApplet(); | ||
15 | 18 | ||
16 | protected: | 19 | protected: |
17 | void drawButton(QPainter *); | 20 | void drawButton(QPainter *); |
@@ -19,12 +22,14 @@ protected: | |||
19 | void gotNewMail(); | 22 | void gotNewMail(); |
20 | 23 | ||
21 | protected slots: | 24 | protected slots: |
25 | void startup(); | ||
22 | void slotCheck(); | 26 | void slotCheck(); |
23 | void slotClicked(); | 27 | void slotClicked(); |
24 | private: | 28 | private: |
25 | Config *m_config; | 29 | Config *m_config; |
26 | QTimer *m_intervalTimer; | 30 | QTimer *m_intervalTimer; |
27 | int m_intervalMs; | 31 | int m_intervalMs; |
32 | StatusMail* m_statusMail; | ||
28 | 33 | ||
29 | }; | 34 | }; |
30 | 35 | ||
diff --git a/noncore/net/mail/taskbarapplet/taskbarapplet.pro b/noncore/net/mail/taskbarapplet/taskbarapplet.pro index 3c658e3..c54e87f 100644 --- a/noncore/net/mail/taskbarapplet/taskbarapplet.pro +++ b/noncore/net/mail/taskbarapplet/taskbarapplet.pro | |||
@@ -4,7 +4,7 @@ HEADERS += mailapplet.h \ | |||
4 | mailappletimpl.h | 4 | mailappletimpl.h |
5 | SOURCES +=mailapplet.cpp \ | 5 | SOURCES +=mailapplet.cpp \ |
6 | mailappletimpl.cpp | 6 | mailappletimpl.cpp |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/noncore/net/mail |
8 | LIBS +=-lmailwrapper -lqpe -lopie | 8 | LIBS +=-lmailwrapper -lqpe -lopie |
9 | TARGET =mailapplet | 9 | TARGET =mailapplet |
10 | DESTDIR +=$(OPIEDIR)/plugins/applets/ | 10 | DESTDIR +=$(OPIEDIR)/plugins/applets/ |