-rw-r--r-- | noncore/net/mail/taskbarapplet/mailapplet.cpp | 51 |
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 | |||
@@ -14,2 +14,5 @@ | |||
14 | 14 | ||
15 | /* UNIX */ | ||
16 | #include <signal.h> | ||
17 | |||
15 | using namespace Opie::Core; | 18 | using namespace Opie::Core; |
@@ -30,2 +33,9 @@ MailApplet::MailApplet( QWidget *parent ) | |||
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 ) ) { |
@@ -71,6 +81,4 @@ void MailApplet::slotClicked() { | |||
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(); |
@@ -78,3 +86,4 @@ void MailApplet::slotClicked() { | |||
78 | 86 | ||
79 | void MailApplet::startup() { | 87 | void MailApplet::startup() |
88 | { | ||
80 | Settings *settings = new Settings(); | 89 | Settings *settings = new Settings(); |
@@ -84,3 +93,4 @@ void MailApplet::startup() { | |||
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(); |
@@ -92,2 +102,3 @@ void 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; |
@@ -106,16 +117,17 @@ void MailApplet::slotCheck() { | |||
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" ); |
@@ -123,6 +135,9 @@ void MailApplet::slotCheck() { | |||
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 { |