-rw-r--r-- | noncore/net/mail/taskbarapplet/mailapplet.cpp | 93 | ||||
-rw-r--r-- | noncore/net/mail/taskbarapplet/mailapplet.h | 2 |
2 files changed, 45 insertions, 50 deletions
diff --git a/noncore/net/mail/taskbarapplet/mailapplet.cpp b/noncore/net/mail/taskbarapplet/mailapplet.cpp index ce1e7ac..b777ecf 100644 --- a/noncore/net/mail/taskbarapplet/mailapplet.cpp +++ b/noncore/net/mail/taskbarapplet/mailapplet.cpp | |||
@@ -22,7 +22,4 @@ MailApplet::MailApplet( QWidget *parent ) | |||
22 | 22 | ||
23 | m_config = new Config( "mail" ); | 23 | setFixedHeight(AppLnk::smallIconSize()); |
24 | m_config->setGroup( "Applet" ); | 24 | setMinimumWidth(AppLnk::smallIconSize()); |
25 | |||
26 | //setFixedWidth( AppLnk::smallIconSize() ); | ||
27 | setFixedHeight( AppLnk::smallIconSize() ); | ||
28 | 25 | ||
@@ -40,7 +37,3 @@ MailApplet::MailApplet( QWidget *parent ) | |||
40 | 37 | ||
41 | if ( !m_config->readBoolEntry( "Disabled", false ) ) { | 38 | QTimer::singleShot( 5000, this, SLOT( startup() ) ); |
42 | // delay 5 sec until the whole mail backend gets started .-) | ||
43 | QTimer::singleShot( 5000, this, SLOT( startup() ) ); | ||
44 | } | ||
45 | repaint( true ); | ||
46 | } | 39 | } |
@@ -51,4 +44,2 @@ MailApplet::~MailApplet() { | |||
51 | delete m_statusMail; | 44 | delete m_statusMail; |
52 | if ( m_config ) | ||
53 | delete m_config; | ||
54 | } | 45 | } |
@@ -74,12 +65,10 @@ void MailApplet::mouseReleaseEvent( QMouseEvent* e ) { | |||
74 | 65 | ||
75 | void MailApplet::slotClicked() { | 66 | void MailApplet::slotClicked() |
76 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 67 | { |
77 | e << QString( "opiemail" ); | 68 | { |
78 | 69 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | |
79 | ODevice *device = ODevice::inst(); | 70 | e << QString( "opiemail" ); |
80 | if ( !device-> ledList().isEmpty() ) { | ||
81 | OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0]; | ||
82 | |||
83 | device->setLedState( led, Led_Off ); | ||
84 | } | 71 | } |
72 | |||
73 | ledOnOff(false); | ||
85 | if (m_statusMail) | 74 | if (m_statusMail) |
@@ -103,2 +92,11 @@ void MailApplet::startup() | |||
103 | 92 | ||
93 | void MailApplet::ledOnOff(bool how) | ||
94 | { | ||
95 | ODevice *device = ODevice::inst(); | ||
96 | if ( !device->ledList().isEmpty() ) { | ||
97 | OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0]; | ||
98 | device->setLedState( led, (how?(device->ledStateList( led ).contains( Led_BlinkSlow )?Led_BlinkSlow:Led_On):Led_Off) ); | ||
99 | } | ||
100 | } | ||
101 | |||
104 | void MailApplet::slotCheck() { | 102 | void MailApplet::slotCheck() { |
@@ -106,3 +104,6 @@ void MailApplet::slotCheck() { | |||
106 | odebug << "MailApplet::slotCheck()" << oendl; | 104 | odebug << "MailApplet::slotCheck()" << oendl; |
107 | int newIntervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; | 105 | Config m_config( "mail" ); |
106 | m_config.setGroup( "Applet" ); | ||
107 | |||
108 | int newIntervalMs = m_config.readNumEntry( "CheckEvery", 5 ) * 60000; | ||
108 | if ( newIntervalMs != m_intervalMs ) { | 109 | if ( newIntervalMs != m_intervalMs ) { |
@@ -111,7 +112,12 @@ void MailApplet::slotCheck() { | |||
111 | } | 112 | } |
112 | 113 | if ( m_config.readBoolEntry( "Disabled", false ) ) { | |
114 | hide(); | ||
115 | ledOnOff(false); | ||
116 | odebug << "MailApplet::slotCheck() - disabled" << oendl; | ||
117 | return; | ||
118 | } | ||
113 | if (m_statusMail == 0) { | 119 | if (m_statusMail == 0) { |
120 | odebug << "MailApplet::slotCheck() - no mailhandle" << oendl; | ||
114 | return; | 121 | return; |
115 | } | 122 | } |
116 | |||
117 | folderStat stat; | 123 | folderStat stat; |
@@ -125,21 +131,15 @@ void MailApplet::slotCheck() { | |||
125 | if (newMailsOld != m_newMails) { | 131 | if (newMailsOld != m_newMails) { |
126 | ODevice *device = ODevice::inst(); | 132 | if ( m_config.readBoolEntry( "BlinkLed", true ) ) { |
127 | if ( m_config->readBoolEntry( "BlinkLed", true ) ) { | 133 | ledOnOff(true); |
128 | if ( !device->ledList().isEmpty() ) { | ||
129 | OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0]; | ||
130 | device->setLedState( led, device->ledStateList( led ).contains( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On ); | ||
131 | } | ||
132 | } | 134 | } |
133 | if ( m_config->readBoolEntry( "PlaySound", false ) ) | 135 | if ( m_config.readBoolEntry( "PlaySound", false ) ) |
134 | device->playAlarmSound(); | 136 | ODevice::inst()->playAlarmSound(); |
135 | } | 137 | m_config.setGroup( "Status" ); |
136 | Config cfg( "mail" ); | 138 | m_config.writeEntry( "newMails", m_newMails ); |
137 | cfg.setGroup( "Status" ); | 139 | { |
138 | cfg.writeEntry( "newMails", m_newMails ); | 140 | QCopEnvelope env( "QPE/Pim", "newMails(int)" ); |
139 | { | 141 | env << m_newMails; |
140 | QCopEnvelope env( "QPE/Pim", "newMails(int)" ); | 142 | } |
141 | env << m_newMails; | 143 | setText(QString::number( m_newMails )); |
142 | } | 144 | } |
143 | setText(QString::number( m_newMails )); | ||
144 | // repaint( true ); | ||
145 | } else { | 145 | } else { |
@@ -148,11 +148,6 @@ void MailApplet::slotCheck() { | |||
148 | hide(); | 148 | hide(); |
149 | if ( !device->ledList().isEmpty() ) { | ||
150 | OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0]; | ||
151 | device->setLedState( led, Led_Off ); | ||
152 | } | ||
153 | |||
154 | if ( newMailsOld != m_newMails ) { | 149 | if ( newMailsOld != m_newMails ) { |
155 | Config cfg( "mail" ); | 150 | ledOnOff(false); |
156 | cfg.setGroup( "Status" ); | 151 | m_config.setGroup( "Status" ); |
157 | cfg.writeEntry( "newMails", m_newMails ); | 152 | m_config.writeEntry( "newMails", m_newMails ); |
158 | QCopEnvelope env( "QPE/Pim", "newMails(int)" ); | 153 | QCopEnvelope env( "QPE/Pim", "newMails(int)" ); |
diff --git a/noncore/net/mail/taskbarapplet/mailapplet.h b/noncore/net/mail/taskbarapplet/mailapplet.h index f28f274..f46bf19 100644 --- a/noncore/net/mail/taskbarapplet/mailapplet.h +++ b/noncore/net/mail/taskbarapplet/mailapplet.h | |||
@@ -23,2 +23,3 @@ protected: | |||
23 | void paintEvent( QPaintEvent* ); | 23 | void paintEvent( QPaintEvent* ); |
24 | static void ledOnOff(bool); | ||
24 | 25 | ||
@@ -29,3 +30,2 @@ protected slots: | |||
29 | private: | 30 | private: |
30 | Config *m_config; | ||
31 | QTimer *m_intervalTimer; | 31 | QTimer *m_intervalTimer; |