-rw-r--r-- | noncore/net/mail/taskbarapplet/mailapplet.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/mail/taskbarapplet/mailapplet.cpp b/noncore/net/mail/taskbarapplet/mailapplet.cpp index 8bf4b89..5ba7085 100644 --- a/noncore/net/mail/taskbarapplet/mailapplet.cpp +++ b/noncore/net/mail/taskbarapplet/mailapplet.cpp | |||
@@ -1,92 +1,92 @@ | |||
1 | #include <qlayout.h> | 1 | #include <qlayout.h> |
2 | #include <qpixmap.h> | 2 | #include <qpixmap.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qsound.h> | 4 | #include <qsound.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdir.h> | 6 | #include <qdir.h> |
7 | 7 | ||
8 | #include <qpe/qcopenvelope_qws.h> | 8 | #include <qpe/qcopenvelope_qws.h> |
9 | #include <qpe/resource.h> | 9 | #include <qpe/resource.h> |
10 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
11 | 11 | ||
12 | #include <opie/odevice.h> | 12 | #include <opie/odevice.h> |
13 | 13 | ||
14 | #include "mailapplet.h" | 14 | #include "mailapplet.h" |
15 | 15 | ||
16 | using namespace Opie; | 16 | using namespace Opie; |
17 | 17 | ||
18 | MailApplet::MailApplet( QWidget *parent, const char *name, WFlags fl ) | 18 | MailApplet::MailApplet( QWidget *parent, const char *name, WFlags fl ) |
19 | : QButton( parent, name, fl ) { | 19 | : QButton( parent, name, fl ) { |
20 | 20 | ||
21 | m_config = new Config( "mail" ); | 21 | m_config = new Config( "mail" ); |
22 | m_config->setGroup( "Applet" ); | 22 | m_config->setGroup( "Applet" ); |
23 | 23 | ||
24 | QVBoxLayout *layout = new QVBoxLayout( this ); | 24 | QVBoxLayout *layout = new QVBoxLayout( this ); |
25 | layout->addItem( new QSpacerItem( 0,0 ) ); | 25 | layout->addItem( new QSpacerItem( 0,0 ) ); |
26 | 26 | ||
27 | QLabel *pixmap = new QLabel( this ); | 27 | QLabel *pixmap = new QLabel( this ); |
28 | pixmap->setPixmap( Resource::loadPixmap( "opiemail/mailchecker" ) ); | 28 | pixmap->setPixmap( Resource::loadPixmap( "mail/mailchecker" ) ); |
29 | layout->addWidget( pixmap ); | 29 | layout->addWidget( pixmap ); |
30 | 30 | ||
31 | layout->addItem( new QSpacerItem( 0,0 ) ); | 31 | layout->addItem( new QSpacerItem( 0,0 ) ); |
32 | 32 | ||
33 | hide(); | 33 | hide(); |
34 | 34 | ||
35 | connect( this, SIGNAL( clicked() ), SLOT( slotClicked() ) ); | 35 | connect( this, SIGNAL( clicked() ), SLOT( slotClicked() ) ); |
36 | 36 | ||
37 | if ( !m_config->readBoolEntry( "Disabled", false ) ) { | 37 | if ( !m_config->readBoolEntry( "Disabled", false ) ) { |
38 | m_intervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; | 38 | m_intervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; |
39 | m_intervalTimer = new QTimer(); | 39 | m_intervalTimer = new QTimer(); |
40 | m_intervalTimer->start( m_intervalMs ); | 40 | m_intervalTimer->start( m_intervalMs ); |
41 | connect( m_intervalTimer, SIGNAL(timeout() ), SLOT( slotCheck() ) ); | 41 | connect( m_intervalTimer, SIGNAL(timeout() ), SLOT( slotCheck() ) ); |
42 | 42 | ||
43 | QTimer::singleShot( 0, this, SLOT( slotCheck() ) ); | 43 | QTimer::singleShot( 0, this, SLOT( slotCheck() ) ); |
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
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; | 71 | int newMails = 0; |
72 | 72 | ||
73 | if ( true ) { | 73 | if ( true ) { |
74 | ODevice *device = ODevice::inst(); | 74 | ODevice *device = ODevice::inst(); |
75 | if ( isHidden() ) show(); | 75 | if ( isHidden() ) show(); |
76 | if ( m_config->readBoolEntry( "BlinkLed", true ) ) { | 76 | if ( m_config->readBoolEntry( "BlinkLed", true ) ) { |
77 | if ( !device-> ledList ( ).isEmpty( ) ) { | 77 | if ( !device-> ledList ( ).isEmpty( ) ) { |
78 | OLed led = ( device->ledList( ).contains( Led_Mail ) ) ? Led_Mail : device->ledList( ) [0]; | 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 ); | 79 | device->setLedState( led, device->ledStateList( led ).contains( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On ); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | if ( m_config->readBoolEntry( "PlaySound", false ) ) | 82 | if ( m_config->readBoolEntry( "PlaySound", false ) ) |
83 | device->alarmSound(); | 83 | device->alarmSound(); |
84 | 84 | ||
85 | Config cfg( "mail" ); | 85 | Config cfg( "mail" ); |
86 | cfg.setGroup( "Status" ); | 86 | cfg.setGroup( "Status" ); |
87 | cfg.writeEntry( "NewMails", newMails ); // todo | 87 | cfg.writeEntry( "NewMails", newMails ); // todo |
88 | 88 | ||
89 | QCopEnvelope env( "QPE/Pim", "newMails(int)" ); | 89 | QCopEnvelope env( "QPE/Pim", "newMails(int)" ); |
90 | env << newMails; | 90 | env << newMails; |
91 | 91 | ||
92 | } else { | 92 | } else { |