author | harlekin <harlekin> | 2004-01-05 16:03:29 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-01-05 16:03:29 (UTC) |
commit | 9acbe167d22cf1bed17a0361fdcdadf7581d8127 (patch) (side-by-side diff) | |
tree | 41d8d8e5b2e243f1c9842452565c1e9c04d44250 /noncore/net/mail/taskbarapplet | |
parent | 22e51ed82162ef307f3f8cef21d3288147f18cad (diff) | |
download | opie-9acbe167d22cf1bed17a0361fdcdadf7581d8127.zip opie-9acbe167d22cf1bed17a0361fdcdadf7581d8127.tar.gz opie-9acbe167d22cf1bed17a0361fdcdadf7581d8127.tar.bz2 |
integration of mailbox status stuff
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 @@ #include <qpe/config.h> #include <opie/odevice.h> +#include <qlist.h> + +#include <libmailwrapper/settings.h> #include "mailapplet.h" @@ -40,8 +43,13 @@ MailApplet::MailApplet( QWidget *parent, const char *name, WFlags fl ) m_intervalTimer->start( m_intervalMs ); connect( m_intervalTimer, SIGNAL(timeout() ), SLOT( slotCheck() ) ); - QTimer::singleShot( 0, this, SLOT( slotCheck() ) ); + // delay 5 sec until the whole mail backend gets started .-) + QTimer::singleShot( 5000, this, SLOT( startup() ) ); + } } + +MailApplet::~MailApplet() { + delete m_statusMail; } void MailApplet::drawButton(QPainter *) { } @@ -58,6 +66,15 @@ void MailApplet::slotClicked() { device->setLedState( led, Led_Off ); } + + // m_statusMails->reset_status(); +} + +void MailApplet::startup() { + Settings *settings = new Settings(); + QList<Account> ma = settings->getAccounts(); + StatusMail m_statusMail = StatusMail( ma ); + delete settings; } void MailApplet::slotCheck() { @@ -68,9 +85,12 @@ void MailApplet::slotCheck() { m_intervalMs = newIntervalMs; } - int newMails = 0; - if ( true ) { + folderStat stat; + m_statusMail->check_current_stat( stat ); + + qDebug( QString( "test %1" ).arg( stat.message_unseen ) ); + if ( stat.message_unseen > 0 ) { ODevice *device = ODevice::inst(); if ( isHidden() ) show(); if ( m_config->readBoolEntry( "BlinkLed", true ) ) { @@ -82,12 +102,13 @@ void MailApplet::slotCheck() { if ( m_config->readBoolEntry( "PlaySound", false ) ) device->alarmSound(); + qDebug( QString( "test %1" ).arg( stat.message_unseen ) ); + Config cfg( "mail" ); cfg.setGroup( "Status" ); - cfg.writeEntry( "NewMails", newMails ); // todo - + cfg.writeEntry( "NewMails", ( int )stat.message_unseen ); QCopEnvelope env( "QPE/Pim", "newMails(int)" ); - env << newMails; + env << stat.message_unseen; } else { 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 @@ #include <qbutton.h> +#include <libmailwrapper/statusmail.h> + class Config; class QTimer; @@ -12,6 +14,7 @@ class MailApplet : public QButton { public: MailApplet( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); + ~MailApplet(); protected: void drawButton(QPainter *); @@ -19,12 +22,14 @@ protected: void gotNewMail(); protected slots: + void startup(); void slotCheck(); void slotClicked(); private: Config *m_config; QTimer *m_intervalTimer; int m_intervalMs; + StatusMail* m_statusMail; }; 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 \ mailappletimpl.h SOURCES += mailapplet.cpp \ mailappletimpl.cpp -INCLUDEPATH += $(OPIEDIR)/include +INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/noncore/net/mail LIBS += -lmailwrapper -lqpe -lopie TARGET = mailapplet DESTDIR += $(OPIEDIR)/plugins/applets/ |