summaryrefslogtreecommitdiff
authoralwin <alwin>2004-01-06 12:57:52 (UTC)
committer alwin <alwin>2004-01-06 12:57:52 (UTC)
commit46753cb77877f4807ab9b1ba3e6c7a4eed7bc1bd (patch) (unidiff)
treecd0b99b0856f65499f7d15aaf5670822183dd660
parent71b6178795294dcdc85dee7a8ec8e8470c5b06e0 (diff)
downloadopie-46753cb77877f4807ab9b1ba3e6c7a4eed7bc1bd.zip
opie-46753cb77877f4807ab9b1ba3e6c7a4eed7bc1bd.tar.gz
opie-46753cb77877f4807ab9b1ba3e6c7a4eed7bc1bd.tar.bz2
status of pop3 accounts slightly reworked
when starting opiemail from taskbar applet the status will be reset
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.cpp9
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.h1
-rw-r--r--noncore/net/mail/libmailwrapper/statusmail.cpp8
-rw-r--r--noncore/net/mail/taskbarapplet/mailapplet.cpp2
4 files changed, 16 insertions, 4 deletions
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp
index d8a36e7..bf91c63 100644
--- a/noncore/net/mail/libmailwrapper/mailtypes.cpp
+++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp
@@ -324,12 +324,21 @@ void encodedString::setContent(const char*nContent,int nSize)
324 if (nSize>0 && nContent) { 324 if (nSize>0 && nContent) {
325 content = (char*)malloc(nSize*sizeof(char)); 325 content = (char*)malloc(nSize*sizeof(char));
326 memcpy(content,nContent,nSize); 326 memcpy(content,nContent,nSize);
327 size = nSize; 327 size = nSize;
328 } 328 }
329} 329}
330 330
331void encodedString::setContent(char*nContent,int nSize) 331void encodedString::setContent(char*nContent,int nSize)
332{ 332{
333 content = nContent; 333 content = nContent;
334 size = nSize; 334 size = nSize;
335} 335}
336
337folderStat&folderStat::operator=(const folderStat&old)
338{
339 message_count = old.message_count;
340 message_unseen = old.message_unseen;
341 message_recent = old.message_recent;
342 return *this;
343}
344
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h
index 05c4816..b2047cb 100644
--- a/noncore/net/mail/libmailwrapper/mailtypes.h
+++ b/noncore/net/mail/libmailwrapper/mailtypes.h
@@ -178,15 +178,16 @@ protected:
178 unsigned int size; 178 unsigned int size;
179 179
180 void init(); 180 void init();
181 void copy_old(const encodedString&old); 181 void copy_old(const encodedString&old);
182 void clean(); 182 void clean();
183}; 183};
184 184
185struct folderStat 185struct folderStat
186{ 186{
187 unsigned int message_count; 187 unsigned int message_count;
188 unsigned int message_unseen; 188 unsigned int message_unseen;
189 unsigned int message_recent; 189 unsigned int message_recent;
190 folderStat&operator=(const folderStat&old);
190}; 191};
191 192
192#endif 193#endif
diff --git a/noncore/net/mail/libmailwrapper/statusmail.cpp b/noncore/net/mail/libmailwrapper/statusmail.cpp
index 98f6204..1d7d559 100644
--- a/noncore/net/mail/libmailwrapper/statusmail.cpp
+++ b/noncore/net/mail/libmailwrapper/statusmail.cpp
@@ -31,31 +31,33 @@ void StatusMail::initAccounts(QList<Account>&accounts)
31 IMAPaccount*ima = static_cast<IMAPaccount *>(it); 31 IMAPaccount*ima = static_cast<IMAPaccount *>(it);
32 current = AbstractMail::getWrapper(ima); 32 current = AbstractMail::getWrapper(ima);
33 connectionList.append(current); 33 connectionList.append(current);
34 current->statusFolder(currentStat); 34 current->statusFolder(currentStat);
35 currentImapStat.message_count+=currentStat.message_unseen; 35 currentImapStat.message_count+=currentStat.message_unseen;
36 currentImapStat.message_count+=currentStat.message_recent; 36 currentImapStat.message_count+=currentStat.message_recent;
37 currentImapStat.message_count+=currentStat.message_count; 37 currentImapStat.message_count+=currentStat.message_count;
38 } else if ( it->getType().compare( "POP3" ) == 0 ) { 38 } else if ( it->getType().compare( "POP3" ) == 0 ) {
39 POP3account *pop3 = static_cast<POP3account *>(it); 39 POP3account *pop3 = static_cast<POP3account *>(it);
40 current = AbstractMail::getWrapper(pop3); 40 current = AbstractMail::getWrapper(pop3);
41 connectionList.append(current); 41 connectionList.append(current);
42 current->statusFolder(currentStat); 42 current->statusFolder(currentStat);
43 currentPop3Stat.message_count+=currentStat.message_unseen;
44 currentPop3Stat.message_count+=currentStat.message_recent;
45 currentPop3Stat.message_count+=currentStat.message_count; 43 currentPop3Stat.message_count+=currentStat.message_count;
46 } 44 }
47 current->logout(); 45 current->logout();
48 } 46 }
49 lastPop3Stat = currentPop3Stat; 47 qDebug("Pop3 init count: %i",currentPop3Stat.message_count);
48 currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0;
49 lastPop3Stat.message_unseen = currentPop3Stat.message_unseen;
50 lastPop3Stat.message_recent = currentPop3Stat.message_recent;
51 lastPop3Stat.message_count = currentPop3Stat.message_count;
50} 52}
51 53
52void StatusMail::reset_status() 54void StatusMail::reset_status()
53{ 55{
54 lastPop3Stat = currentPop3Stat; 56 lastPop3Stat = currentPop3Stat;
55} 57}
56 58
57void StatusMail::check_current_stat(folderStat&targetStat) 59void StatusMail::check_current_stat(folderStat&targetStat)
58{ 60{
59 AbstractMail*it = 0; 61 AbstractMail*it = 0;
60 folderStat currentStat; 62 folderStat currentStat;
61 currentPop3Stat.message_recent = 0; 63 currentPop3Stat.message_recent = 0;
diff --git a/noncore/net/mail/taskbarapplet/mailapplet.cpp b/noncore/net/mail/taskbarapplet/mailapplet.cpp
index 991b5fb..6078013 100644
--- a/noncore/net/mail/taskbarapplet/mailapplet.cpp
+++ b/noncore/net/mail/taskbarapplet/mailapplet.cpp
@@ -61,25 +61,25 @@ void MailApplet::mouseReleaseEvent( QMouseEvent* e ) {
61 61
62void MailApplet::slotClicked() { 62void MailApplet::slotClicked() {
63 QCopEnvelope e( "QPE/System", "execute(QString)" ); 63 QCopEnvelope e( "QPE/System", "execute(QString)" );
64 e << QString( "opiemail" ); 64 e << QString( "opiemail" );
65 65
66 ODevice *device = ODevice::inst(); 66 ODevice *device = ODevice::inst();
67 if ( !device-> ledList().isEmpty() ) { 67 if ( !device-> ledList().isEmpty() ) {
68 OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0]; 68 OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0];
69 69
70 device->setLedState( led, Led_Off ); 70 device->setLedState( led, Led_Off );
71 } 71 }
72 72
73 // m_statusMails->reset_status(); 73 if (m_statusMail) m_statusMail->reset_status();
74} 74}
75 75
76void MailApplet::startup() { 76void MailApplet::startup() {
77 Settings *settings = new Settings(); 77 Settings *settings = new Settings();
78 QList<Account> ma = settings->getAccounts(); 78 QList<Account> ma = settings->getAccounts();
79 m_statusMail = new StatusMail( ma ); 79 m_statusMail = new StatusMail( ma );
80 delete settings; 80 delete settings;
81 81
82 m_intervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; 82 m_intervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000;
83 m_intervalTimer = new QTimer(); 83 m_intervalTimer = new QTimer();
84 m_intervalTimer->start( m_intervalMs ); 84 m_intervalTimer->start( m_intervalMs );
85 connect( m_intervalTimer, SIGNAL( timeout() ), this, SLOT( slotCheck() ) ); 85 connect( m_intervalTimer, SIGNAL( timeout() ), this, SLOT( slotCheck() ) );