summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/statusmail.cpp10
-rw-r--r--noncore/net/mail/libmailwrapper/statusmail.h10
-rw-r--r--noncore/net/mail/taskbarapplet/mailapplet.cpp33
-rw-r--r--noncore/net/mail/taskbarapplet/mailapplet.h5
-rw-r--r--noncore/net/mail/taskbarapplet/taskbarapplet.pro2
5 files changed, 42 insertions, 18 deletions
diff --git a/noncore/net/mail/libmailwrapper/statusmail.cpp b/noncore/net/mail/libmailwrapper/statusmail.cpp
index 3e1d8d1..9f4c47c 100644
--- a/noncore/net/mail/libmailwrapper/statusmail.cpp
+++ b/noncore/net/mail/libmailwrapper/statusmail.cpp
@@ -1,7 +1,5 @@
#include "statusmail.h"
-#include "mailtypes.h"
-#include "abstractmail.h"
#include <qlist.h>
-StatusMail::StatusMail(QList<Account>*list)
+StatusMail::StatusMail(QList<Account>&list)
{
@@ -21,5 +19,5 @@ StatusMail::~StatusMail()
-void StatusMail::initAccounts(QList<Account>*accounts)
+void StatusMail::initAccounts(QList<Account>&accounts)
{
- if (!accounts) return;
+
Account *it;
@@ -27,3 +25,3 @@ void StatusMail::initAccounts(QList<Account>*accounts)
AbstractMail * current = 0;
- for ( it = accounts->first(); it; it = accounts->next() ) {
+ for ( it = accounts.first(); it; it = accounts.next() ) {
if ( it->getType().compare( "IMAP" ) == 0 ) {
diff --git a/noncore/net/mail/libmailwrapper/statusmail.h b/noncore/net/mail/libmailwrapper/statusmail.h
index 498f7a3..2637232 100644
--- a/noncore/net/mail/libmailwrapper/statusmail.h
+++ b/noncore/net/mail/libmailwrapper/statusmail.h
@@ -3,5 +3,5 @@
-#include <settings.h>
-#include <abstractmail.h>
-#include <mailtypes.h>
+#include "settings.h"
+#include "abstractmail.h"
+#include "mailtypes.h"
@@ -10,3 +10,3 @@ class StatusMail
public:
- StatusMail(QList<Account>*list);
+ StatusMail(QList<Account>&list);
virtual ~StatusMail();
@@ -19,3 +19,3 @@ public:
protected:
- void initAccounts(QList<Account>*list);
+ void initAccounts(QList<Account>&accounts);
/* this must be cause we have to calculate the recent for pop3*/
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>
@@ -42,4 +45,9 @@ 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() ) );
+ }
}
+
+MailApplet::~MailApplet() {
+ delete m_statusMail;
}
@@ -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;
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
@@ -5,2 +5,4 @@
+#include <libmailwrapper/statusmail.h>
+
class Config;
@@ -14,2 +16,3 @@ public:
MailApplet( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 );
+ ~MailApplet();
@@ -21,2 +24,3 @@ protected:
protected slots:
+ void startup();
void slotCheck();
@@ -27,2 +31,3 @@ private:
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
@@ -6,3 +6,3 @@ SOURCES += mailapplet.cpp \
mailappletimpl.cpp
-INCLUDEPATH += $(OPIEDIR)/include
+INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/noncore/net/mail
LIBS += -lmailwrapper -lqpe -lopie