summaryrefslogtreecommitdiff
authorharlekin <harlekin>2004-01-04 15:47:32 (UTC)
committer harlekin <harlekin>2004-01-04 15:47:32 (UTC)
commit59fee003137f5fd7782e3a42159e53424d100e67 (patch) (unidiff)
treedae5f375349ff02ac96f9bd309aeea52837003cd
parent5c4c2a789c19e727bb9ca323ea1fec1b7d1bd057 (diff)
downloadopie-59fee003137f5fd7782e3a42159e53424d100e67.zip
opie-59fee003137f5fd7782e3a42159e53424d100e67.tar.gz
opie-59fee003137f5fd7782e3a42159e53424d100e67.tar.bz2
config taskbar applet
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/mail.pro3
-rw-r--r--noncore/net/mail/settingsdialog.cpp15
-rw-r--r--noncore/net/mail/settingsdialogui.ui120
-rw-r--r--noncore/net/mail/taskbarapplet/mailapplet.cpp32
-rw-r--r--noncore/net/mail/taskbarapplet/mailapplet.h2
5 files changed, 165 insertions, 7 deletions
diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro
index a96c88e..96ffaa8 100644
--- a/noncore/net/mail/mail.pro
+++ b/noncore/net/mail/mail.pro
@@ -27,25 +27,26 @@ SOURCES = main.cpp \
27 newmaildir.cpp 27 newmaildir.cpp
28 28
29INTERFACES = editaccountsui.ui \ 29INTERFACES = editaccountsui.ui \
30 selectmailtypeui.ui \ 30 selectmailtypeui.ui \
31 imapconfigui.ui \ 31 imapconfigui.ui \
32 pop3configui.ui \ 32 pop3configui.ui \
33 nntpconfigui.ui \ 33 nntpconfigui.ui \
34 smtpconfigui.ui \ 34 smtpconfigui.ui \
35 addresspickerui.ui \ 35 addresspickerui.ui \
36 composemailui.ui \ 36 composemailui.ui \
37 settingsdialogui.ui \ 37 settingsdialogui.ui \
38 statuswidgetui.ui \ 38 statuswidgetui.ui \
39 newmaildirui.ui 39 newmaildirui.ui
40
40 41
41INCLUDEPATH += $(OPIEDIR)/include 42INCLUDEPATH += $(OPIEDIR)/include
42 43
43CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) 44CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX )
44contains( CONFTEST, y ){ 45contains( CONFTEST, y ){
45 LIBS += -lqpe -lopie -lmailwrapper -liconv 46 LIBS += -lqpe -lopie -lmailwrapper -liconv
46}else{ 47}else{
47 LIBS += -lqpe -lopie -lmailwrapper 48 LIBS += -lqpe -lopie -lmailwrapper
48} 49}
49 50
50TARGET = opiemail 51TARGET = opiemail
51 52
diff --git a/noncore/net/mail/settingsdialog.cpp b/noncore/net/mail/settingsdialog.cpp
index f9de405..061ea72 100644
--- a/noncore/net/mail/settingsdialog.cpp
+++ b/noncore/net/mail/settingsdialog.cpp
@@ -1,38 +1,49 @@
1#include <qcheckbox.h> 1#include <qcheckbox.h>
2#include <qspinbox.h>
2 3
3#include <qpe/config.h> 4#include <qpe/config.h>
4 5
5#include "settingsdialog.h" 6#include "settingsdialog.h"
6 7
7 8
8SettingsDialog::SettingsDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 9SettingsDialog::SettingsDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
9 : SettingsDialogUI( parent, name, modal, fl ) { 10 : SettingsDialogUI( parent, name, modal, fl ) {
10 11
11 readConfig(); 12 readConfig();
12} 13}
13 14
14SettingsDialog::~SettingsDialog() { 15SettingsDialog::~SettingsDialog() {
15 16
16} 17}
17 18
18void SettingsDialog::readConfig() { 19void SettingsDialog::readConfig() {
19 Config cfg("mail"); 20 Config cfg("mail");
20 cfg.setGroup( "Settings" ); 21 cfg.setGroup( "Settings" );
21 showHtmlButton->setChecked( cfg.readBoolEntry( "showHtml", false ) ); 22 showHtmlButton->setChecked( cfg.readBoolEntry( "showHtml", false ) );
22 cfg.setGroup( "Compose" ); 23 cfg.setGroup( "Compose" );
23 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); 24 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
25 cfg.setGroup( "Applet" );
26 cbEnableTaskbarApplet->setChecked( cfg.readBoolEntry( "Disabled", false ) );
27 spCheckOften->setValue( cfg.readNumEntry( "CheckEvery", 5 ) );
28 cbBlinkLed->setChecked( cfg.readBoolEntry( "BlinkLed", true ) );
29 cbPlaySound->setChecked( cfg.readBoolEntry( "PlaySound", false ) );
30
24} 31}
25 32
26void SettingsDialog::writeConfig() { 33void SettingsDialog::writeConfig() {
27 Config cfg( "mail" ); 34 Config cfg( "mail" );
28 cfg.setGroup( "Settings" ); 35 cfg.setGroup( "Settings" );
29 cfg.writeEntry( "showHtml", showHtmlButton->isChecked() ); 36 cfg.writeEntry( "showHtml", showHtmlButton->isChecked() );
30 cfg.setGroup( "Compose" ); 37 cfg.setGroup( "Compose" );
31 cfg.writeEntry( "sendLater", checkBoxLater->isChecked() );; 38 cfg.writeEntry( "sendLater", checkBoxLater->isChecked() );
32 39 cfg.setGroup( "Applet" );
40 cfg.writeEntry( "Disabled", cbEnableTaskbarApplet->isChecked() );
41 cfg.writeEntry( "CheckEvery", spCheckOften->value() );
42 cfg.writeEntry( "BlinkLed", cbBlinkLed->isChecked() );
43 cfg.writeEntry( "PlaySound", cbPlaySound->isChecked() );
33} 44}
34 45
35void SettingsDialog::accept() { 46void SettingsDialog::accept() {
36 writeConfig(); 47 writeConfig();
37 QDialog::accept(); 48 QDialog::accept();
38} 49}
diff --git a/noncore/net/mail/settingsdialogui.ui b/noncore/net/mail/settingsdialogui.ui
index c5589dc..a078168 100644
--- a/noncore/net/mail/settingsdialogui.ui
+++ b/noncore/net/mail/settingsdialogui.ui
@@ -2,25 +2,25 @@
2<class>SettingsDialogUI</class> 2<class>SettingsDialogUI</class>
3<widget> 3<widget>
4 <class>QDialog</class> 4 <class>QDialog</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>SettingsDialogUI</cstring> 7 <cstring>SettingsDialogUI</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>324</width> 14 <width>320</width>
15 <height>379</height> 15 <height>379</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>Settings Dialog</string> 20 <string>Settings Dialog</string>
21 </property> 21 </property>
22 <property> 22 <property>
23 <name>layoutMargin</name> 23 <name>layoutMargin</name>
24 </property> 24 </property>
25 <property> 25 <property>
26 <name>layoutSpacing</name> 26 <name>layoutSpacing</name>
@@ -143,16 +143,134 @@
143 <enum>Expanding</enum> 143 <enum>Expanding</enum>
144 </property> 144 </property>
145 <property> 145 <property>
146 <name>sizeHint</name> 146 <name>sizeHint</name>
147 <size> 147 <size>
148 <width>20</width> 148 <width>20</width>
149 <height>20</height> 149 <height>20</height>
150 </size> 150 </size>
151 </property> 151 </property>
152 </spacer> 152 </spacer>
153 </vbox> 153 </vbox>
154 </widget> 154 </widget>
155 <widget>
156 <class>QWidget</class>
157 <property stdset="1">
158 <name>name</name>
159 <cstring>tab</cstring>
160 </property>
161 <attribute>
162 <name>title</name>
163 <string>Taskbar Applet</string>
164 </attribute>
165 <vbox>
166 <property stdset="1">
167 <name>margin</name>
168 <number>3</number>
169 </property>
170 <property stdset="1">
171 <name>spacing</name>
172 <number>3</number>
173 </property>
174 <widget>
175 <class>QCheckBox</class>
176 <property stdset="1">
177 <name>name</name>
178 <cstring>cbEnableTaskbarApplet</cstring>
179 </property>
180 <property stdset="1">
181 <name>text</name>
182 <string>Enable Taskbar Applet</string>
183 </property>
184 </widget>
185 <widget>
186 <class>QLayoutWidget</class>
187 <property stdset="1">
188 <name>name</name>
189 <cstring>Layout2</cstring>
190 </property>
191 <hbox>
192 <property stdset="1">
193 <name>margin</name>
194 <number>0</number>
195 </property>
196 <property stdset="1">
197 <name>spacing</name>
198 <number>6</number>
199 </property>
200 <widget>
201 <class>QSpinBox</class>
202 <property stdset="1">
203 <name>name</name>
204 <cstring>spCheckOften</cstring>
205 </property>
206 <property stdset="1">
207 <name>suffix</name>
208 <string> min</string>
209 </property>
210 <property stdset="1">
211 <name>value</name>
212 <number>5</number>
213 </property>
214 </widget>
215 <widget>
216 <class>QLabel</class>
217 <property stdset="1">
218 <name>name</name>
219 <cstring>TextLabel1</cstring>
220 </property>
221 <property stdset="1">
222 <name>text</name>
223 <string>Check how often</string>
224 </property>
225 </widget>
226 </hbox>
227 </widget>
228 <widget>
229 <class>QCheckBox</class>
230 <property stdset="1">
231 <name>name</name>
232 <cstring>cbBlinkLed</cstring>
233 </property>
234 <property stdset="1">
235 <name>text</name>
236 <string>Blink Led when new mails arrive</string>
237 </property>
238 </widget>
239 <widget>
240 <class>QCheckBox</class>
241 <property stdset="1">
242 <name>name</name>
243 <cstring>cbPlaySound</cstring>
244 </property>
245 <property stdset="1">
246 <name>text</name>
247 <string>Play Sound when new mails arrive</string>
248 </property>
249 </widget>
250 <spacer>
251 <property>
252 <name>name</name>
253 <cstring>Spacer3</cstring>
254 </property>
255 <property stdset="1">
256 <name>orientation</name>
257 <enum>Vertical</enum>
258 </property>
259 <property stdset="1">
260 <name>sizeType</name>
261 <enum>Expanding</enum>
262 </property>
263 <property>
264 <name>sizeHint</name>
265 <size>
266 <width>20</width>
267 <height>20</height>
268 </size>
269 </property>
270 </spacer>
271 </vbox>
272 </widget>
155 </widget> 273 </widget>
156 </vbox> 274 </vbox>
157</widget> 275</widget>
158</UI> 276</UI>
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
@@ -59,17 +59,45 @@ void MailApplet::slotClicked() {
59 device->setLedState( led, Led_Off ); 59 device->setLedState( led, Led_Off );
60 } 60 }
61} 61}
62 62
63void MailApplet::slotCheck() { 63void 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}
diff --git a/noncore/net/mail/taskbarapplet/mailapplet.h b/noncore/net/mail/taskbarapplet/mailapplet.h
index 1c48b29..34bdc22 100644
--- a/noncore/net/mail/taskbarapplet/mailapplet.h
+++ b/noncore/net/mail/taskbarapplet/mailapplet.h
@@ -2,25 +2,25 @@
2#define MAILAPPLET_H 2#define MAILAPPLET_H
3 3
4#include <qbutton.h> 4#include <qbutton.h>
5 5
6class Config; 6class Config;
7class QTimer; 7class QTimer;
8 8
9class MailApplet : public QButton { 9class MailApplet : public QButton {
10 10
11 Q_OBJECT 11 Q_OBJECT
12 12
13public: 13public:
14 MailApplet(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); 14 MailApplet( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 );
15 15
16protected: 16protected:
17 void drawButton(QPainter *); 17 void drawButton(QPainter *);
18 void drawButtonText(QPainter *); 18 void drawButtonText(QPainter *);
19 void gotNewMail(); 19 void gotNewMail();
20 20
21protected slots: 21protected slots:
22 void slotCheck(); 22 void slotCheck();
23 void slotClicked(); 23 void slotClicked();
24private: 24private:
25 Config *m_config; 25 Config *m_config;
26 QTimer *m_intervalTimer; 26 QTimer *m_intervalTimer;