Diffstat (limited to 'noncore/net/mail/taskbarapplet/mailapplet.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/taskbarapplet/mailapplet.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/noncore/net/mail/taskbarapplet/mailapplet.cpp b/noncore/net/mail/taskbarapplet/mailapplet.cpp index f3550c7..8bf4b89 100644 --- a/noncore/net/mail/taskbarapplet/mailapplet.cpp +++ b/noncore/net/mail/taskbarapplet/mailapplet.cpp | |||
@@ -47,29 +47,57 @@ MailApplet::MailApplet( QWidget *parent, const char *name, WFlags fl ) | |||
47 | void MailApplet::drawButton(QPainter *) { } | 47 | void MailApplet::drawButton(QPainter *) { } |
48 | void MailApplet::drawButtonText(QPainter *) { } | 48 | void MailApplet::drawButtonText(QPainter *) { } |
49 | 49 | ||
50 | void MailApplet::slotClicked() { | 50 | void MailApplet::slotClicked() { |
51 | qDebug( " CLICKED" ); | 51 | qDebug( " CLICKED" ); |
52 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 52 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
53 | e << QString( "opiemail" ); | 53 | e << QString( "opiemail" ); |
54 | 54 | ||
55 | ODevice *device = ODevice::inst(); | 55 | ODevice *device = ODevice::inst(); |
56 | if ( !device-> ledList ( ). isEmpty ( ) ) { | 56 | if ( !device-> ledList ( ). isEmpty ( ) ) { |
57 | OLed led = ( device-> ledList ( ). contains ( Led_Mail )) ? Led_Mail : device-> ledList ( ) [0]; | 57 | OLed led = ( device-> ledList ( ). contains ( Led_Mail )) ? Led_Mail : device-> ledList ( ) [0]; |
58 | 58 | ||
59 | device->setLedState( led, Led_Off ); | 59 | device->setLedState( led, Led_Off ); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | void MailApplet::slotCheck() { | 63 | void MailApplet::slotCheck() { |
64 | // Check wether the check interval has been changed. | 64 | // Check wether the check interval has been changed. |
65 | int newIntervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; | 65 | int newIntervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; |
66 | if ( newIntervalMs != m_intervalMs ) { | 66 | if ( newIntervalMs != m_intervalMs ) { |
67 | m_intervalTimer->changeInterval( newIntervalMs ); | 67 | m_intervalTimer->changeInterval( newIntervalMs ); |
68 | m_intervalMs = newIntervalMs; | 68 | m_intervalMs = newIntervalMs; |
69 | } | 69 | } |
70 | 70 | ||
71 | int newMails = 0; | ||
72 | |||
73 | if ( true ) { | ||
74 | ODevice *device = ODevice::inst(); | ||
75 | if ( isHidden() ) show(); | ||
76 | if ( m_config->readBoolEntry( "BlinkLed", true ) ) { | ||
77 | if ( !device-> ledList ( ).isEmpty( ) ) { | ||
78 | OLed led = ( device->ledList( ).contains( Led_Mail ) ) ? Led_Mail : device->ledList( ) [0]; | ||
79 | device->setLedState( led, device->ledStateList( led ).contains( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On ); | ||
80 | } | ||
81 | } | ||
82 | if ( m_config->readBoolEntry( "PlaySound", false ) ) | ||
83 | device->alarmSound(); | ||
84 | |||
85 | Config cfg( "mail" ); | ||
86 | cfg.setGroup( "Status" ); | ||
87 | cfg.writeEntry( "NewMails", newMails ); // todo | ||
88 | |||
89 | QCopEnvelope env( "QPE/Pim", "newMails(int)" ); | ||
90 | env << newMails; | ||
91 | |||
92 | } else { | ||
93 | ODevice *device = ODevice::inst(); | ||
94 | if ( !isHidden() ) hide(); | ||
95 | if ( !device-> ledList( ).isEmpty( ) ) { | ||
96 | OLed led = ( device->ledList( ).contains( Led_Mail ) ) ? Led_Mail : device->ledList( ) [0]; | ||
97 | device->setLedState( led, Led_Off ); | ||
98 | } | ||
99 | } | ||
100 | |||
71 | // go trough accounts and check here | 101 | // go trough accounts and check here |
72 | // depending on result show or hide | ||
73 | // also trigger qcop call and save status to config | 102 | // also trigger qcop call and save status to config |
74 | // get led to blink | ||
75 | } | 103 | } |