author | harlekin <harlekin> | 2004-01-04 15:47:32 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-01-04 15:47:32 (UTC) |
commit | 59fee003137f5fd7782e3a42159e53424d100e67 (patch) (unidiff) | |
tree | dae5f375349ff02ac96f9bd309aeea52837003cd | |
parent | 5c4c2a789c19e727bb9ca323ea1fec1b7d1bd057 (diff) | |
download | opie-59fee003137f5fd7782e3a42159e53424d100e67.zip opie-59fee003137f5fd7782e3a42159e53424d100e67.tar.gz opie-59fee003137f5fd7782e3a42159e53424d100e67.tar.bz2 |
config taskbar applet
-rw-r--r-- | noncore/net/mail/mail.pro | 3 | ||||
-rw-r--r-- | noncore/net/mail/settingsdialog.cpp | 15 | ||||
-rw-r--r-- | noncore/net/mail/settingsdialogui.ui | 120 | ||||
-rw-r--r-- | noncore/net/mail/taskbarapplet/mailapplet.cpp | 32 | ||||
-rw-r--r-- | noncore/net/mail/taskbarapplet/mailapplet.h | 2 |
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 | |||
@@ -1,52 +1,53 @@ | |||
1 | CONFIG += qt warn_on debug quick-app | 1 | CONFIG += qt warn_on debug quick-app |
2 | 2 | ||
3 | HEADERS = defines.h \ | 3 | HEADERS = defines.h \ |
4 | editaccounts.h \ | 4 | editaccounts.h \ |
5 | composemail.h \ | 5 | composemail.h \ |
6 | accountview.h \ | 6 | accountview.h \ |
7 | mainwindow.h \ | 7 | mainwindow.h \ |
8 | viewmail.h \ | 8 | viewmail.h \ |
9 | viewmailbase.h \ | 9 | viewmailbase.h \ |
10 | opiemail.h \ | 10 | opiemail.h \ |
11 | mailistviewitem.h \ | 11 | mailistviewitem.h \ |
12 | settingsdialog.h \ | 12 | settingsdialog.h \ |
13 | statuswidget.h \ | 13 | statuswidget.h \ |
14 | newmaildir.h | 14 | newmaildir.h |
15 | 15 | ||
16 | SOURCES = main.cpp \ | 16 | SOURCES = main.cpp \ |
17 | opiemail.cpp \ | 17 | opiemail.cpp \ |
18 | mainwindow.cpp \ | 18 | mainwindow.cpp \ |
19 | accountview.cpp \ | 19 | accountview.cpp \ |
20 | composemail.cpp \ | 20 | composemail.cpp \ |
21 | addresspicker.cpp \ | 21 | addresspicker.cpp \ |
22 | editaccounts.cpp \ | 22 | editaccounts.cpp \ |
23 | viewmail.cpp \ | 23 | viewmail.cpp \ |
24 | viewmailbase.cpp \ | 24 | viewmailbase.cpp \ |
25 | settingsdialog.cpp \ | 25 | settingsdialog.cpp \ |
26 | statuswidget.cpp \ | 26 | statuswidget.cpp \ |
27 | newmaildir.cpp | 27 | newmaildir.cpp |
28 | 28 | ||
29 | INTERFACES = editaccountsui.ui \ | 29 | INTERFACES = 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 | ||
41 | INCLUDEPATH += $(OPIEDIR)/include | 42 | INCLUDEPATH += $(OPIEDIR)/include |
42 | 43 | ||
43 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) | 44 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) |
44 | contains( CONFTEST, y ){ | 45 | contains( 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 | ||
50 | TARGET = opiemail | 51 | TARGET = opiemail |
51 | 52 | ||
52 | include ( $(OPIEDIR)/include.pro ) | 53 | include ( $(OPIEDIR)/include.pro ) |
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 | ||
8 | SettingsDialog::SettingsDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 9 | SettingsDialog::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 | ||
14 | SettingsDialog::~SettingsDialog() { | 15 | SettingsDialog::~SettingsDialog() { |
15 | 16 | ||
16 | } | 17 | } |
17 | 18 | ||
18 | void SettingsDialog::readConfig() { | 19 | void 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 | ||
26 | void SettingsDialog::writeConfig() { | 33 | void 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 | ||
35 | void SettingsDialog::accept() { | 46 | void 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 | |||
@@ -1,158 +1,276 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
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> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>3</number> | 31 | <number>3</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>3</number> | 35 | <number>3</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QTabWidget</class> | 38 | <class>QTabWidget</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>TabWidget2</cstring> | 41 | <cstring>TabWidget2</cstring> |
42 | </property> | 42 | </property> |
43 | <property> | 43 | <property> |
44 | <name>layoutMargin</name> | 44 | <name>layoutMargin</name> |
45 | </property> | 45 | </property> |
46 | <property> | 46 | <property> |
47 | <name>layoutSpacing</name> | 47 | <name>layoutSpacing</name> |
48 | </property> | 48 | </property> |
49 | <widget> | 49 | <widget> |
50 | <class>QWidget</class> | 50 | <class>QWidget</class> |
51 | <property stdset="1"> | 51 | <property stdset="1"> |
52 | <name>name</name> | 52 | <name>name</name> |
53 | <cstring>tab</cstring> | 53 | <cstring>tab</cstring> |
54 | </property> | 54 | </property> |
55 | <attribute> | 55 | <attribute> |
56 | <name>title</name> | 56 | <name>title</name> |
57 | <string>View Mail</string> | 57 | <string>View Mail</string> |
58 | </attribute> | 58 | </attribute> |
59 | <vbox> | 59 | <vbox> |
60 | <property stdset="1"> | 60 | <property stdset="1"> |
61 | <name>margin</name> | 61 | <name>margin</name> |
62 | <number>3</number> | 62 | <number>3</number> |
63 | </property> | 63 | </property> |
64 | <property stdset="1"> | 64 | <property stdset="1"> |
65 | <name>spacing</name> | 65 | <name>spacing</name> |
66 | <number>3</number> | 66 | <number>3</number> |
67 | </property> | 67 | </property> |
68 | <widget> | 68 | <widget> |
69 | <class>QCheckBox</class> | 69 | <class>QCheckBox</class> |
70 | <property stdset="1"> | 70 | <property stdset="1"> |
71 | <name>name</name> | 71 | <name>name</name> |
72 | <cstring>showHtmlButton</cstring> | 72 | <cstring>showHtmlButton</cstring> |
73 | </property> | 73 | </property> |
74 | <property stdset="1"> | 74 | <property stdset="1"> |
75 | <name>text</name> | 75 | <name>text</name> |
76 | <string>View mail as Html</string> | 76 | <string>View mail as Html</string> |
77 | </property> | 77 | </property> |
78 | </widget> | 78 | </widget> |
79 | <spacer> | 79 | <spacer> |
80 | <property> | 80 | <property> |
81 | <name>name</name> | 81 | <name>name</name> |
82 | <cstring>Spacer1</cstring> | 82 | <cstring>Spacer1</cstring> |
83 | </property> | 83 | </property> |
84 | <property stdset="1"> | 84 | <property stdset="1"> |
85 | <name>orientation</name> | 85 | <name>orientation</name> |
86 | <enum>Vertical</enum> | 86 | <enum>Vertical</enum> |
87 | </property> | 87 | </property> |
88 | <property stdset="1"> | 88 | <property stdset="1"> |
89 | <name>sizeType</name> | 89 | <name>sizeType</name> |
90 | <enum>Expanding</enum> | 90 | <enum>Expanding</enum> |
91 | </property> | 91 | </property> |
92 | <property> | 92 | <property> |
93 | <name>sizeHint</name> | 93 | <name>sizeHint</name> |
94 | <size> | 94 | <size> |
95 | <width>20</width> | 95 | <width>20</width> |
96 | <height>20</height> | 96 | <height>20</height> |
97 | </size> | 97 | </size> |
98 | </property> | 98 | </property> |
99 | </spacer> | 99 | </spacer> |
100 | </vbox> | 100 | </vbox> |
101 | </widget> | 101 | </widget> |
102 | <widget> | 102 | <widget> |
103 | <class>QWidget</class> | 103 | <class>QWidget</class> |
104 | <property stdset="1"> | 104 | <property stdset="1"> |
105 | <name>name</name> | 105 | <name>name</name> |
106 | <cstring>tab</cstring> | 106 | <cstring>tab</cstring> |
107 | </property> | 107 | </property> |
108 | <attribute> | 108 | <attribute> |
109 | <name>title</name> | 109 | <name>title</name> |
110 | <string>Compose Mail</string> | 110 | <string>Compose Mail</string> |
111 | </attribute> | 111 | </attribute> |
112 | <vbox> | 112 | <vbox> |
113 | <property stdset="1"> | 113 | <property stdset="1"> |
114 | <name>margin</name> | 114 | <name>margin</name> |
115 | <number>3</number> | 115 | <number>3</number> |
116 | </property> | 116 | </property> |
117 | <property stdset="1"> | 117 | <property stdset="1"> |
118 | <name>spacing</name> | 118 | <name>spacing</name> |
119 | <number>3</number> | 119 | <number>3</number> |
120 | </property> | 120 | </property> |
121 | <widget> | 121 | <widget> |
122 | <class>QCheckBox</class> | 122 | <class>QCheckBox</class> |
123 | <property stdset="1"> | 123 | <property stdset="1"> |
124 | <name>name</name> | 124 | <name>name</name> |
125 | <cstring>checkBoxLater</cstring> | 125 | <cstring>checkBoxLater</cstring> |
126 | </property> | 126 | </property> |
127 | <property stdset="1"> | 127 | <property stdset="1"> |
128 | <name>text</name> | 128 | <name>text</name> |
129 | <string>Send mails later ( enqueue in outbox )</string> | 129 | <string>Send mails later ( enqueue in outbox )</string> |
130 | </property> | 130 | </property> |
131 | </widget> | 131 | </widget> |
132 | <spacer> | 132 | <spacer> |
133 | <property> | 133 | <property> |
134 | <name>name</name> | 134 | <name>name</name> |
135 | <cstring>Spacer2</cstring> | 135 | <cstring>Spacer2</cstring> |
136 | </property> | 136 | </property> |
137 | <property stdset="1"> | 137 | <property stdset="1"> |
138 | <name>orientation</name> | 138 | <name>orientation</name> |
139 | <enum>Vertical</enum> | 139 | <enum>Vertical</enum> |
140 | </property> | 140 | </property> |
141 | <property stdset="1"> | 141 | <property stdset="1"> |
142 | <name>sizeType</name> | 142 | <name>sizeType</name> |
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 | |||
@@ -1,75 +1,103 @@ | |||
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( "opiemail/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; | ||
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 | |||
@@ -1,32 +1,32 @@ | |||
1 | #ifndef MAILAPPLET_H | 1 | #ifndef MAILAPPLET_H |
2 | #define MAILAPPLET_H | 2 | #define MAILAPPLET_H |
3 | 3 | ||
4 | #include <qbutton.h> | 4 | #include <qbutton.h> |
5 | 5 | ||
6 | class Config; | 6 | class Config; |
7 | class QTimer; | 7 | class QTimer; |
8 | 8 | ||
9 | class MailApplet : public QButton { | 9 | class MailApplet : public QButton { |
10 | 10 | ||
11 | Q_OBJECT | 11 | Q_OBJECT |
12 | 12 | ||
13 | public: | 13 | public: |
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 | ||
16 | protected: | 16 | protected: |
17 | void drawButton(QPainter *); | 17 | void drawButton(QPainter *); |
18 | void drawButtonText(QPainter *); | 18 | void drawButtonText(QPainter *); |
19 | void gotNewMail(); | 19 | void gotNewMail(); |
20 | 20 | ||
21 | protected slots: | 21 | protected slots: |
22 | void slotCheck(); | 22 | void slotCheck(); |
23 | void slotClicked(); | 23 | void slotClicked(); |
24 | private: | 24 | private: |
25 | Config *m_config; | 25 | Config *m_config; |
26 | QTimer *m_intervalTimer; | 26 | QTimer *m_intervalTimer; |
27 | int m_intervalMs; | 27 | int m_intervalMs; |
28 | 28 | ||
29 | }; | 29 | }; |
30 | 30 | ||
31 | #endif | 31 | #endif |
32 | 32 | ||