summaryrefslogtreecommitdiff
path: root/noncore/net/mail/taskbarapplet/mailapplet.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mail/taskbarapplet/mailapplet.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/taskbarapplet/mailapplet.cpp35
1 files changed, 28 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
@@ -12,2 +12,5 @@
#include <opie/odevice.h>
+#include <qlist.h>
+
+#include <libmailwrapper/settings.h>
@@ -34,3 +37,3 @@ MailApplet::MailApplet( QWidget *parent, const char *name, WFlags fl )
- connect( this, SIGNAL( clicked() ), SLOT( slotClicked() ) );
+ connect( this, SIGNAL( clicked() ), SLOT( slotClicked() ) );
@@ -42,3 +45,4 @@ MailApplet::MailApplet( QWidget *parent, const char *name, WFlags fl )
- QTimer::singleShot( 0, this, SLOT( slotCheck() ) );
+ // delay 5 sec until the whole mail backend gets started .-)
+ QTimer::singleShot( 5000, this, SLOT( startup() ) );
}
@@ -46,2 +50,6 @@ MailApplet::MailApplet( QWidget *parent, const char *name, WFlags fl )
+MailApplet::~MailApplet() {
+ delete m_statusMail;
+}
+
void MailApplet::drawButton(QPainter *) { }
@@ -60,2 +68,11 @@ void MailApplet::slotClicked() {
}
+
+ // m_statusMails->reset_status();
+}
+
+void MailApplet::startup() {
+ Settings *settings = new Settings();
+ QList<Account> ma = settings->getAccounts();
+ StatusMail m_statusMail = StatusMail( ma );
+ delete settings;
}
@@ -70,5 +87,8 @@ void MailApplet::slotCheck() {
- 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();
@@ -84,8 +104,9 @@ void MailApplet::slotCheck() {
+ 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;