author | conber <conber> | 2002-06-19 13:33:18 (UTC) |
---|---|---|
committer | conber <conber> | 2002-06-19 13:33:18 (UTC) |
commit | 6eed7b58b02de6efb49a67f3da3dabbd3aeaa27b (patch) (unidiff) | |
tree | 834e7d2d431cf5264c86c468d1e24364da618661 | |
parent | 952cb1ec42e827f1bc45f9d3f0a1b685ff545790 (diff) | |
download | opie-6eed7b58b02de6efb49a67f3da3dabbd3aeaa27b.zip opie-6eed7b58b02de6efb49a67f3da3dabbd3aeaa27b.tar.gz opie-6eed7b58b02de6efb49a67f3da3dabbd3aeaa27b.tar.bz2 |
changed bend to use ODevice
-rw-r--r-- | noncore/unsupported/mail2/bend/bend.cpp | 44 | ||||
-rw-r--r-- | noncore/unsupported/mail2/bend/bend.h | 3 |
2 files changed, 14 insertions, 33 deletions
diff --git a/noncore/unsupported/mail2/bend/bend.cpp b/noncore/unsupported/mail2/bend/bend.cpp index fe3b736..681aca2 100644 --- a/noncore/unsupported/mail2/bend/bend.cpp +++ b/noncore/unsupported/mail2/bend/bend.cpp | |||
@@ -8,22 +8,18 @@ | |||
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 <stdlib.h> | 12 | #include <opie/odevice.h> |
13 | 13 | ||
14 | #include "configfile.h" | ||
15 | #include "imapresponse.h" | 14 | #include "imapresponse.h" |
16 | #include "imaphandler.h" | 15 | #include "imaphandler.h" |
17 | #include "zaurusstuff.h" | 16 | #include "configfile.h" |
18 | #include "bend.h" | 17 | #include "bend.h" |
19 | 18 | ||
20 | BenD::BenD(QWidget *parent, const char *name, WFlags fl) | 19 | BenD::BenD(QWidget *parent, const char *name, WFlags fl) |
21 | : QButton(parent, name, fl) | 20 | : QButton(parent, name, fl) |
22 | { | 21 | { |
23 | _zaurus = false; | ||
24 | if (QFile("/dev/sharp_buz").exists()) _zaurus = true; | ||
25 | |||
26 | _config = new Config("mail"); | 22 | _config = new Config("mail"); |
27 | _config->setGroup("Settings"); | 23 | _config->setGroup("Settings"); |
28 | 24 | ||
29 | QVBoxLayout *layout = new QVBoxLayout(this); | 25 | QVBoxLayout *layout = new QVBoxLayout(this); |
@@ -55,13 +51,12 @@ void BenD::drawButtonText(QPainter *) { } | |||
55 | void BenD::slotClicked() | 51 | void BenD::slotClicked() |
56 | { | 52 | { |
57 | QCopEnvelope e("QPE/System", "execute(QString)"); | 53 | QCopEnvelope e("QPE/System", "execute(QString)"); |
58 | e << QString("mail"); | 54 | e << QString("mail"); |
59 | 55 | ||
60 | if (_ledOn) { | 56 | ODevice *device = ODevice::inst(); |
61 | ZaurusStuff::blinkLedOff(); | 57 | if (device->led(1) == OLED_BlinkSlow) |
62 | _ledOn = false; | 58 | device->setLed(1, OLED_Off); |
63 | } | ||
64 | } | 59 | } |
65 | 60 | ||
66 | void BenD::slotCheck() | 61 | void BenD::slotCheck() |
67 | { | 62 | { |
@@ -97,31 +92,20 @@ void BenD::slotIMAPStatus(IMAPResponse &response) | |||
97 | disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPStatus(IMAPResponse &))); | 92 | disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPStatus(IMAPResponse &))); |
98 | 93 | ||
99 | if (response.statusResponse().status() == IMAPResponseEnums::OK) { | 94 | if (response.statusResponse().status() == IMAPResponseEnums::OK) { |
100 | if (response.STATUS()[0].recent().toInt() > 0) { | 95 | if (response.STATUS()[0].recent().toInt() > 0) { |
96 | ODevice *device = ODevice::inst(); | ||
101 | if (isHidden()) show(); | 97 | if (isHidden()) show(); |
102 | if (_config->readBoolEntry("BlinkLed", true)) | 98 | if (_config->readBoolEntry("BlinkLed", true)) |
103 | ZaurusStuff::blinkLedOn(); | 99 | device->setLed(1, OLED_BlinkSlow); |
104 | if (_config->readBoolEntry("PlaySound", false)) { | 100 | if (_config->readBoolEntry("PlaySound", false)) |
105 | if (_zaurus) { | 101 | device->alarmSound(); |
106 | ZaurusStuff::buzzerOn(); | ||
107 | QTimer::singleShot(3000, this, SLOT(slotSoundOff())); | ||
108 | } else { | ||
109 | QSound::play(Resource::findSound("mail/newmail")); | ||
110 | } | ||
111 | } | ||
112 | } else { | 102 | } else { |
103 | ODevice *device = ODevice::inst(); | ||
113 | if (!isHidden()) hide(); | 104 | if (!isHidden()) hide(); |
114 | if (!_ledOn) { | 105 | if (device->led(1) == OLED_BlinkSlow) |
115 | ZaurusStuff::blinkLedOff(); | 106 | device->setLed(1, OLED_Off); |
116 | _ledOn = false; | ||
117 | } | ||
118 | } | 107 | } |
119 | response.imapHandler()->iLogout(); | 108 | response.imapHandler()->iLogout(); |
120 | } else qWarning("BenD: WARNING: Couldn't retrieve INBOX status."); | 109 | } else qWarning("BenD: WARNING: Couldn't retrieve INBOX status."); |
121 | } | 110 | } |
122 | 111 | ||
123 | void BenD::slotSoundOff() | ||
124 | { | ||
125 | ZaurusStuff::buzzerOff(); | ||
126 | } | ||
127 | |||
diff --git a/noncore/unsupported/mail2/bend/bend.h b/noncore/unsupported/mail2/bend/bend.h index 7972929..233c552 100644 --- a/noncore/unsupported/mail2/bend/bend.h +++ b/noncore/unsupported/mail2/bend/bend.h | |||
@@ -17,21 +17,18 @@ public: | |||
17 | protected: | 17 | protected: |
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); | ||
22 | 21 | ||
23 | protected slots: | 22 | protected slots: |
24 | void slotCheck(); | 23 | void slotCheck(); |
25 | void slotClicked(); | 24 | void slotClicked(); |
26 | void slotSoundOff(); | ||
27 | void slotIMAPStatus(IMAPResponse &response); | 25 | void slotIMAPStatus(IMAPResponse &response); |
28 | 26 | ||
29 | private: | 27 | private: |
30 | Config *_config; | 28 | Config *_config; |
31 | QTimer *_intervalTimer; | 29 | QTimer *_intervalTimer; |
32 | int _intervalMs; | 30 | int _intervalMs; |
33 | bool _zaurus, _ledOn; | ||
34 | 31 | ||
35 | }; | 32 | }; |
36 | 33 | ||
37 | #endif | 34 | #endif |