summaryrefslogtreecommitdiff
path: root/noncore/net/mail
Unidiff
Diffstat (limited to 'noncore/net/mail') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/taskbarapplet/mailapplet.cpp51
1 files changed, 33 insertions, 18 deletions
diff --git a/noncore/net/mail/taskbarapplet/mailapplet.cpp b/noncore/net/mail/taskbarapplet/mailapplet.cpp
index 2fc1d01..9c0d32f 100644
--- a/noncore/net/mail/taskbarapplet/mailapplet.cpp
+++ b/noncore/net/mail/taskbarapplet/mailapplet.cpp
@@ -12,6 +12,9 @@
12 12
13#include "mailapplet.h" 13#include "mailapplet.h"
14 14
15/* UNIX */
16#include <signal.h>
17
15using namespace Opie::Core; 18using namespace Opie::Core;
16 19
17MailApplet::MailApplet( QWidget *parent ) 20MailApplet::MailApplet( QWidget *parent )
@@ -28,6 +31,13 @@ MailApplet::MailApplet( QWidget *parent )
28 m_newMails = 0; 31 m_newMails = 0;
29 m_statusMail = 0l; 32 m_statusMail = 0l;
30 33
34 /* for networking we must block SIGPIPE and Co. */
35 struct sigaction blocking_action,temp_action;
36 blocking_action.sa_handler = SIG_IGN;
37 sigemptyset(&(blocking_action.sa_mask));
38 blocking_action.sa_flags = 0;
39 sigaction(SIGPIPE,&blocking_action,&temp_action);
40
31 if ( !m_config->readBoolEntry( "Disabled", false ) ) { 41 if ( !m_config->readBoolEntry( "Disabled", false ) ) {
32 // delay 5 sec until the whole mail backend gets started .-) 42 // delay 5 sec until the whole mail backend gets started .-)
33 QTimer::singleShot( 5000, this, SLOT( startup() ) ); 43 QTimer::singleShot( 5000, this, SLOT( startup() ) );
@@ -69,20 +79,20 @@ void MailApplet::slotClicked() {
69 79
70 device->setLedState( led, Led_Off ); 80 device->setLedState( led, Led_Off );
71 } 81 }
72
73 if (m_statusMail) 82 if (m_statusMail)
74 m_statusMail->reset_status(); 83 m_statusMail->reset_status();
75
76 hide(); 84 hide();
77} 85}
78 86
79void MailApplet::startup() { 87void MailApplet::startup()
88{
80 Settings *settings = new Settings(); 89 Settings *settings = new Settings();
81 QList<Account> ma = settings->getAccounts(); 90 QList<Account> ma = settings->getAccounts();
82 m_statusMail = new StatusMail( ma ); 91 m_statusMail = new StatusMail( ma );
83 delete settings; 92 delete settings;
84 93
85 m_intervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; 94 //m_intervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000;
95 m_intervalMs = 100;
86 m_intervalTimer = new QTimer(); 96 m_intervalTimer = new QTimer();
87 m_intervalTimer->start( m_intervalMs ); 97 m_intervalTimer->start( m_intervalMs );
88 connect( m_intervalTimer, SIGNAL( timeout() ), this, SLOT( slotCheck() ) ); 98 connect( m_intervalTimer, SIGNAL( timeout() ), this, SLOT( slotCheck() ) );
@@ -90,6 +100,7 @@ void MailApplet::startup() {
90 100
91void MailApplet::slotCheck() { 101void MailApplet::slotCheck() {
92 // Check wether the check interval has been changed. 102 // Check wether the check interval has been changed.
103 odebug << "MailApplet::slotCheck()" << oendl;
93 int newIntervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; 104 int newIntervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000;
94 if ( newIntervalMs != m_intervalMs ) { 105 if ( newIntervalMs != m_intervalMs ) {
95 m_intervalTimer->changeInterval( newIntervalMs ); 106 m_intervalTimer->changeInterval( newIntervalMs );
@@ -104,27 +115,31 @@ void MailApplet::slotCheck() {
104 m_statusMail->check_current_stat( stat ); 115 m_statusMail->check_current_stat( stat );
105 int newMailsOld = m_newMails; 116 int newMailsOld = m_newMails;
106 m_newMails = stat.message_unseen; 117 m_newMails = stat.message_unseen;
107 odebug << QString( "test %1" ).arg( m_newMails ) << oendl; 118 odebug << QString( "test %1" ).arg( m_newMails ) << oendl;
108 if ( m_newMails > 0 && newMailsOld != m_newMails ) { 119 if ( m_newMails > 0) {
109 ODevice *device = ODevice::inst(); 120 if (isHidden())
110 if ( isHidden() )
111 show(); 121 show();
112 if ( m_config->readBoolEntry( "BlinkLed", true ) ) { 122 if (newMailsOld != m_newMails) {
113 if ( !device->ledList().isEmpty() ) { 123 ODevice *device = ODevice::inst();
114 OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0]; 124 if ( m_config->readBoolEntry( "BlinkLed", true ) ) {
115 device->setLedState( led, device->ledStateList( led ).contains( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On ); 125 if ( !device->ledList().isEmpty() ) {
126 OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0];
127 device->setLedState( led, device->ledStateList( led ).contains( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On );
128 }
116 } 129 }
130 if ( m_config->readBoolEntry( "PlaySound", false ) )
131 device->playAlarmSound();
117 } 132 }
118 if ( m_config->readBoolEntry( "PlaySound", false ) )
119 device->playAlarmSound();
120
121 Config cfg( "mail" ); 133 Config cfg( "mail" );
122 cfg.setGroup( "Status" ); 134 cfg.setGroup( "Status" );
123 cfg.writeEntry( "newMails", m_newMails ); 135 cfg.writeEntry( "newMails", m_newMails );
124 QCopEnvelope env( "QPE/Pim", "newMails(int)" ); 136 {
125 env << m_newMails; 137 odebug << "QCop abschicken" << oendl;
138 QCopEnvelope env( "QPE/Pim", "newMails(int)" );
139 env << m_newMails;
140 }
141 odebug << "QCop abschicken done" << oendl;
126 repaint( true ); 142 repaint( true );
127
128 } else { 143 } else {
129 ODevice *device = ODevice::inst(); 144 ODevice *device = ODevice::inst();
130 if ( !isHidden() ) 145 if ( !isHidden() )