summaryrefslogtreecommitdiff
authorharlekin <harlekin>2004-01-05 16:22:01 (UTC)
committer harlekin <harlekin>2004-01-05 16:22:01 (UTC)
commit642fd965cca78fe4398cbe12afcd15cd2f2257ad (patch) (unidiff)
tree6fe94acc252dca7aed314e439ad6603b676ff149
parent9acbe167d22cf1bed17a0361fdcdadf7581d8127 (diff)
downloadopie-642fd965cca78fe4398cbe12afcd15cd2f2257ad.zip
opie-642fd965cca78fe4398cbe12afcd15cd2f2257ad.tar.gz
opie-642fd965cca78fe4398cbe12afcd15cd2f2257ad.tar.bz2
prevent segfaults
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/taskbarapplet/mailapplet.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/net/mail/taskbarapplet/mailapplet.cpp b/noncore/net/mail/taskbarapplet/mailapplet.cpp
index f81dce8..31d5bfe 100644
--- a/noncore/net/mail/taskbarapplet/mailapplet.cpp
+++ b/noncore/net/mail/taskbarapplet/mailapplet.cpp
@@ -22,47 +22,49 @@ MailApplet::MailApplet( QWidget *parent, const char *name, WFlags fl )
22 : QButton( parent, name, fl ) { 22 : QButton( parent, name, fl ) {
23 23
24 m_config = new Config( "mail" ); 24 m_config = new Config( "mail" );
25 m_config->setGroup( "Applet" ); 25 m_config->setGroup( "Applet" );
26 26
27 QVBoxLayout *layout = new QVBoxLayout( this ); 27 QVBoxLayout *layout = new QVBoxLayout( this );
28 layout->addItem( new QSpacerItem( 0,0 ) ); 28 layout->addItem( new QSpacerItem( 0,0 ) );
29 29
30 QLabel *pixmap = new QLabel( this ); 30 QLabel *pixmap = new QLabel( this );
31 pixmap->setPixmap( Resource::loadPixmap( "mail/mailchecker" ) ); 31 pixmap->setPixmap( Resource::loadPixmap( "mail/mailchecker" ) );
32 layout->addWidget( pixmap ); 32 layout->addWidget( pixmap );
33 33
34 layout->addItem( new QSpacerItem( 0,0 ) ); 34 layout->addItem( new QSpacerItem( 0,0 ) );
35 35
36 hide(); 36 hide();
37 37
38 m_statusMail = 0;
39
38 connect( this, SIGNAL( clicked() ), SLOT( slotClicked() ) ); 40 connect( this, SIGNAL( clicked() ), SLOT( slotClicked() ) );
39 41
40 if ( !m_config->readBoolEntry( "Disabled", false ) ) { 42 if ( !m_config->readBoolEntry( "Disabled", false ) ) {
41 m_intervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; 43 m_intervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000;
42 m_intervalTimer = new QTimer(); 44 m_intervalTimer = new QTimer();
43 m_intervalTimer->start( m_intervalMs ); 45 m_intervalTimer->start( m_intervalMs );
44 connect( m_intervalTimer, SIGNAL(timeout() ), SLOT( slotCheck() ) ); 46 connect( m_intervalTimer, SIGNAL(timeout() ), SLOT( slotCheck() ) );
45 47
46 // delay 5 sec until the whole mail backend gets started .-) 48 // delay 5 sec until the whole mail backend gets started .-)
47 QTimer::singleShot( 5000, this, SLOT( startup() ) ); 49 QTimer::singleShot( 5000, this, SLOT( startup() ) );
48 } 50 }
49} 51}
50 52
51MailApplet::~MailApplet() { 53MailApplet::~MailApplet() {
52 delete m_statusMail; 54 if (m_statusMail) delete m_statusMail;
53} 55}
54 56
55void MailApplet::drawButton(QPainter *) { } 57void MailApplet::drawButton(QPainter *) { }
56void MailApplet::drawButtonText(QPainter *) { } 58void MailApplet::drawButtonText(QPainter *) { }
57 59
58void MailApplet::slotClicked() { 60void MailApplet::slotClicked() {
59 qDebug( " CLICKED" ); 61 qDebug( " CLICKED" );
60 QCopEnvelope e( "QPE/System", "execute(QString)" ); 62 QCopEnvelope e( "QPE/System", "execute(QString)" );
61 e << QString( "opiemail" ); 63 e << QString( "opiemail" );
62 64
63 ODevice *device = ODevice::inst(); 65 ODevice *device = ODevice::inst();
64 if ( !device-> ledList ( ). isEmpty ( ) ) { 66 if ( !device-> ledList ( ). isEmpty ( ) ) {
65 OLed led = ( device-> ledList ( ). contains ( Led_Mail )) ? Led_Mail : device-> ledList ( ) [0]; 67 OLed led = ( device-> ledList ( ). contains ( Led_Mail )) ? Led_Mail : device-> ledList ( ) [0];
66 68
67 device->setLedState( led, Led_Off ); 69 device->setLedState( led, Led_Off );
68 } 70 }