summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/mail2/bend/bend.cpp15
-rw-r--r--noncore/unsupported/mail2/bend/bend.h2
-rw-r--r--noncore/unsupported/mail2/configdiagbase.ui2
3 files changed, 15 insertions, 4 deletions
diff --git a/noncore/unsupported/mail2/bend/bend.cpp b/noncore/unsupported/mail2/bend/bend.cpp
index b4da3ac..fe3b736 100644
--- a/noncore/unsupported/mail2/bend/bend.cpp
+++ b/noncore/unsupported/mail2/bend/bend.cpp
@@ -1,116 +1,127 @@
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 <qtimer.h> 5#include <qtimer.h>
5#include <qdir.h> 6#include <qdir.h>
6 7
7#include <qpe/qcopenvelope_qws.h> 8#include <qpe/qcopenvelope_qws.h>
8#include <qpe/resource.h> 9#include <qpe/resource.h>
9#include <qpe/config.h> 10#include <qpe/config.h>
10 11
11#include <stdlib.h> 12#include <stdlib.h>
12 13
13#include "configfile.h" 14#include "configfile.h"
14#include "imapresponse.h" 15#include "imapresponse.h"
15#include "imaphandler.h" 16#include "imaphandler.h"
16#include "zaurusstuff.h" 17#include "zaurusstuff.h"
17#include "bend.h" 18#include "bend.h"
18 19
19BenD::BenD(QWidget *parent, const char *name, WFlags fl) 20BenD::BenD(QWidget *parent, const char *name, WFlags fl)
20 : QButton(parent, name, fl) 21 : QButton(parent, name, fl)
21{ 22{
23 _zaurus = false;
24 if (QFile("/dev/sharp_buz").exists()) _zaurus = true;
25
22 _config = new Config("mail"); 26 _config = new Config("mail");
23 _config->setGroup("Settings"); 27 _config->setGroup("Settings");
24 28
25 QVBoxLayout *layout = new QVBoxLayout(this); 29 QVBoxLayout *layout = new QVBoxLayout(this);
26 layout->addItem(new QSpacerItem(0,0)); 30 layout->addItem(new QSpacerItem(0,0));
27 31
28 QLabel *pixmap = new QLabel(this); 32 QLabel *pixmap = new QLabel(this);
29 pixmap->setPixmap(Resource::loadPixmap("mail/mailchecker")); 33 pixmap->setPixmap(Resource::loadPixmap("mail/mailchecker"));
30 layout->addWidget(pixmap); 34 layout->addWidget(pixmap);
31 35
32 layout->addItem(new QSpacerItem(0,0)); 36 layout->addItem(new QSpacerItem(0,0));
33 37
34 hide(); 38 hide();
35 39
36 connect(this, SIGNAL(clicked()), SLOT(slotClicked())); 40 connect(this, SIGNAL(clicked()), SLOT(slotClicked()));
37 41
38 if (!_config->readBoolEntry("Disabled", false)) { 42 if (!_config->readBoolEntry("Disabled", false)) {
39 _intervalMs = _config->readNumEntry("CheckEvery", 5) * 60000; 43 _intervalMs = _config->readNumEntry("CheckEvery", 5) * 60000;
40 _intervalTimer = new QTimer(); 44 _intervalTimer = new QTimer();
41 _intervalTimer->start(_intervalMs); 45 _intervalTimer->start(_intervalMs);
42 connect(_intervalTimer, SIGNAL(timeout()), SLOT(slotCheck())); 46 connect(_intervalTimer, SIGNAL(timeout()), SLOT(slotCheck()));
43 47
44 QTimer::singleShot(0, this, SLOT(slotCheck())); 48 QTimer::singleShot(0, this, SLOT(slotCheck()));
45 } 49 }
46} 50}
47 51
48void BenD::drawButton(QPainter *) { } 52void BenD::drawButton(QPainter *) { }
49void BenD::drawButtonText(QPainter *) { } 53void BenD::drawButtonText(QPainter *) { }
50 54
51void BenD::slotClicked() 55void BenD::slotClicked()
52{ 56{
53 QCopEnvelope e("QPE/System", "execute(QString)"); 57 QCopEnvelope e("QPE/System", "execute(QString)");
54 e << QString("mail"); 58 e << QString("mail");
55 59
56 if (_ledOn) { 60 if (_ledOn) {
57 ZaurusStuff::blinkLedOff(); 61 ZaurusStuff::blinkLedOff();
58 _ledOn = false; 62 _ledOn = false;
59 } 63 }
60} 64}
61 65
62void BenD::slotCheck() 66void BenD::slotCheck()
63{ 67{
64 // Check wether the check interval has been changed. 68 // Check wether the check interval has been changed.
65 int newIntervalMs = _config->readNumEntry("CheckEvery", 5) * 60000; 69 int newIntervalMs = _config->readNumEntry("CheckEvery", 5) * 60000;
66 if (newIntervalMs != _intervalMs) { 70 if (newIntervalMs != _intervalMs) {
67 _intervalTimer->changeInterval(newIntervalMs); 71 _intervalTimer->changeInterval(newIntervalMs);
68 _intervalMs = newIntervalMs; 72 _intervalMs = newIntervalMs;
73#ifndef QT_NO_DEBUG
74 qWarning("BenD: Detected interval change");
75#endif
69 } 76 }
70 77
71 QValueList<Account> acList = ConfigFile::getAccounts(); 78 QValueList<Account> acList = ConfigFile::getAccounts();
72 QValueList<Account>::Iterator ot; 79 QValueList<Account>::Iterator ot;
73 for (ot = acList.begin(); ot != acList.end(); ot++) { 80 for (ot = acList.begin(); ot != acList.end(); ot++) {
74 if (!((*ot).imapServer().isEmpty() || 81 if (!((*ot).imapServer().isEmpty() ||
75 (*ot).imapPort().isEmpty() || 82 (*ot).imapPort().isEmpty() ||
76 (*ot).user().isEmpty() || 83 (*ot).user().isEmpty() ||
77 (*ot).pass().isEmpty())) { 84 (*ot).pass().isEmpty())) {
78 if (!((*ot).imapSsl() && 85 if (!((*ot).imapSsl() &&
79 (*ot).imapSslPort().isEmpty())) { 86 (*ot).imapSslPort().isEmpty())) {
80 IMAPHandler *handler = new IMAPHandler(*ot); 87 IMAPHandler *handler = new IMAPHandler(*ot);
81 handler->iStatus("INBOX", "RECENT"); 88 handler->iStatus("INBOX", "RECENT");
82 connect(handler, SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPStatus(IMAPResponse &))); 89 connect(handler, SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPStatus(IMAPResponse &)));
83 } 90 }
84 } 91 }
85 } 92 }
86} 93}
87 94
88void BenD::slotIMAPStatus(IMAPResponse &response) 95void BenD::slotIMAPStatus(IMAPResponse &response)
89{ 96{
90 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPStatus(IMAPResponse &))); 97 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPStatus(IMAPResponse &)));
91 98
92 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 99 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
93 if (response.STATUS()[0].recent().toInt() > 0) { 100 if (response.STATUS()[0].recent().toInt() > 0) {
94 if (isHidden()) show(); 101 if (isHidden()) show();
95 if (_config->readBoolEntry("BlinkLed", true)) 102 if (_config->readBoolEntry("BlinkLed", true))
96 ZaurusStuff::blinkLedOn(); 103 ZaurusStuff::blinkLedOn();
97 if (_config->readBoolEntry("PlaySound", false)) { 104 if (_config->readBoolEntry("PlaySound", false)) {
98 ZaurusStuff::buzzerOn(); 105 if (_zaurus) {
99 QTimer::singleShot(3000, this, SLOT(slotSoundOff())); 106 ZaurusStuff::buzzerOn();
107 QTimer::singleShot(3000, this, SLOT(slotSoundOff()));
108 } else {
109 QSound::play(Resource::findSound("mail/newmail"));
110 }
100 } 111 }
101 } else { 112 } else {
102 if (!isHidden()) hide(); 113 if (!isHidden()) hide();
103 if (!_ledOn) { 114 if (!_ledOn) {
104 ZaurusStuff::blinkLedOff(); 115 ZaurusStuff::blinkLedOff();
105 _ledOn = false; 116 _ledOn = false;
106 } 117 }
107 } 118 }
108 response.imapHandler()->iLogout(); 119 response.imapHandler()->iLogout();
109 } else qWarning("BenD: WARNING: Couldn't retrieve INBOX status."); 120 } else qWarning("BenD: WARNING: Couldn't retrieve INBOX status.");
110} 121}
111 122
112void BenD::slotSoundOff() 123void BenD::slotSoundOff()
113{ 124{
114 ZaurusStuff::buzzerOff(); 125 ZaurusStuff::buzzerOff();
115} 126}
116 127
diff --git a/noncore/unsupported/mail2/bend/bend.h b/noncore/unsupported/mail2/bend/bend.h
index cf50bc5..7972929 100644
--- a/noncore/unsupported/mail2/bend/bend.h
+++ b/noncore/unsupported/mail2/bend/bend.h
@@ -1,38 +1,38 @@
1#ifndef BEND_H 1#ifndef BEND_H
2#define BEND_H 2#define BEND_H
3 3
4#include <qbutton.h> 4#include <qbutton.h>
5 5
6class Config; 6class Config;
7class QTimer; 7class QTimer;
8class IMAPResponse; 8class IMAPResponse;
9 9
10class BenD : public QButton 10class BenD : public QButton
11{ 11{
12 Q_OBJECT 12 Q_OBJECT
13 13
14public: 14public:
15 BenD(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); 15 BenD(QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
16 16
17protected: 17protected:
18 void drawButton(QPainter *); 18 void drawButton(QPainter *);
19 void drawButtonText(QPainter *); 19 void drawButtonText(QPainter *);
20 void gotNewMail(); 20 void gotNewMail();
21 QString rot13(const QString &input); 21 QString rot13(const QString &input);
22 22
23protected slots: 23protected slots:
24 void slotCheck(); 24 void slotCheck();
25 void slotClicked(); 25 void slotClicked();
26 void slotSoundOff(); 26 void slotSoundOff();
27 void slotIMAPStatus(IMAPResponse &response); 27 void slotIMAPStatus(IMAPResponse &response);
28 28
29private: 29private:
30 Config *_config; 30 Config *_config;
31 QTimer *_intervalTimer; 31 QTimer *_intervalTimer;
32 int _intervalMs; 32 int _intervalMs;
33 bool _ledOn; 33 bool _zaurus, _ledOn;
34 34
35}; 35};
36 36
37#endif 37#endif
38 38
diff --git a/noncore/unsupported/mail2/configdiagbase.ui b/noncore/unsupported/mail2/configdiagbase.ui
index 754458a..dfe0db8 100644
--- a/noncore/unsupported/mail2/configdiagbase.ui
+++ b/noncore/unsupported/mail2/configdiagbase.ui
@@ -207,97 +207,97 @@
207 <name>layoutSpacing</name> 207 <name>layoutSpacing</name>
208 </property> 208 </property>
209 <grid> 209 <grid>
210 <property stdset="1"> 210 <property stdset="1">
211 <name>margin</name> 211 <name>margin</name>
212 <number>0</number> 212 <number>0</number>
213 </property> 213 </property>
214 <property stdset="1"> 214 <property stdset="1">
215 <name>spacing</name> 215 <name>spacing</name>
216 <number>3</number> 216 <number>3</number>
217 </property> 217 </property>
218 <widget row="1" column="0" rowspan="1" colspan="3" > 218 <widget row="1" column="0" rowspan="1" colspan="3" >
219 <class>QCheckBox</class> 219 <class>QCheckBox</class>
220 <property stdset="1"> 220 <property stdset="1">
221 <name>name</name> 221 <name>name</name>
222 <cstring>blinkLed</cstring> 222 <cstring>blinkLed</cstring>
223 </property> 223 </property>
224 <property stdset="1"> 224 <property stdset="1">
225 <name>sizePolicy</name> 225 <name>sizePolicy</name>
226 <sizepolicy> 226 <sizepolicy>
227 <hsizetype>3</hsizetype> 227 <hsizetype>3</hsizetype>
228 <vsizetype>0</vsizetype> 228 <vsizetype>0</vsizetype>
229 </sizepolicy> 229 </sizepolicy>
230 </property> 230 </property>
231 <property stdset="1"> 231 <property stdset="1">
232 <name>text</name> 232 <name>text</name>
233 <string>Blink LED (Zaurus only)</string> 233 <string>Blink LED (Zaurus only)</string>
234 </property> 234 </property>
235 </widget> 235 </widget>
236 <widget row="2" column="2" > 236 <widget row="2" column="2" >
237 <class>QToolButton</class> 237 <class>QToolButton</class>
238 <property stdset="1"> 238 <property stdset="1">
239 <name>name</name> 239 <name>name</name>
240 <cstring>testbutton</cstring> 240 <cstring>testbutton</cstring>
241 </property> 241 </property>
242 <property stdset="1"> 242 <property stdset="1">
243 <name>text</name> 243 <name>text</name>
244 <string> Test </string> 244 <string> Test </string>
245 </property> 245 </property>
246 </widget> 246 </widget>
247 <widget row="0" column="0" rowspan="1" colspan="3" > 247 <widget row="0" column="0" rowspan="1" colspan="3" >
248 <class>QCheckBox</class> 248 <class>QCheckBox</class>
249 <property stdset="1"> 249 <property stdset="1">
250 <name>name</name> 250 <name>name</name>
251 <cstring>playSound</cstring> 251 <cstring>playSound</cstring>
252 </property> 252 </property>
253 <property stdset="1"> 253 <property stdset="1">
254 <name>text</name> 254 <name>text</name>
255 <string>Play sound (Zaurus only)</string> 255 <string>Play sound</string>
256 </property> 256 </property>
257 </widget> 257 </widget>
258 <widget row="2" column="0" > 258 <widget row="2" column="0" >
259 <class>QLabel</class> 259 <class>QLabel</class>
260 <property stdset="1"> 260 <property stdset="1">
261 <name>name</name> 261 <name>name</name>
262 <cstring>TextLabel1</cstring> 262 <cstring>TextLabel1</cstring>
263 </property> 263 </property>
264 <property stdset="1"> 264 <property stdset="1">
265 <name>text</name> 265 <name>text</name>
266 <string>&lt;b&gt;Check&amp;nbsp;every</string> 266 <string>&lt;b&gt;Check&amp;nbsp;every</string>
267 </property> 267 </property>
268 </widget> 268 </widget>
269 <widget row="2" column="1" > 269 <widget row="2" column="1" >
270 <class>QSpinBox</class> 270 <class>QSpinBox</class>
271 <property stdset="1"> 271 <property stdset="1">
272 <name>name</name> 272 <name>name</name>
273 <cstring>checkDelay</cstring> 273 <cstring>checkDelay</cstring>
274 </property> 274 </property>
275 <property stdset="1"> 275 <property stdset="1">
276 <name>sizePolicy</name> 276 <name>sizePolicy</name>
277 <sizepolicy> 277 <sizepolicy>
278 <hsizetype>3</hsizetype> 278 <hsizetype>3</hsizetype>
279 <vsizetype>0</vsizetype> 279 <vsizetype>0</vsizetype>
280 </sizepolicy> 280 </sizepolicy>
281 </property> 281 </property>
282 <property stdset="1"> 282 <property stdset="1">
283 <name>suffix</name> 283 <name>suffix</name>
284 <string> min</string> 284 <string> min</string>
285 </property> 285 </property>
286 <property stdset="1"> 286 <property stdset="1">
287 <name>maxValue</name> 287 <name>maxValue</name>
288 <number>30</number> 288 <number>30</number>
289 </property> 289 </property>
290 <property stdset="1"> 290 <property stdset="1">
291 <name>minValue</name> 291 <name>minValue</name>
292 <number>1</number> 292 <number>1</number>
293 </property> 293 </property>
294 <property stdset="1"> 294 <property stdset="1">
295 <name>value</name> 295 <name>value</name>
296 <number>1</number> 296 <number>1</number>
297 </property> 297 </property>
298 </widget> 298 </widget>
299 </grid> 299 </grid>
300 </widget> 300 </widget>
301 <widget row="0" column="0" > 301 <widget row="0" column="0" >
302 <class>QCheckBox</class> 302 <class>QCheckBox</class>
303 <property stdset="1"> 303 <property stdset="1">