summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/mail2/bend/bend.cpp44
-rw-r--r--noncore/unsupported/mail2/bend/bend.h3
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
@@ -6,26 +6,22 @@
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 <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
20BenD::BenD(QWidget *parent, const char *name, WFlags fl) 19BenD::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);
30 layout->addItem(new QSpacerItem(0,0)); 26 layout->addItem(new QSpacerItem(0,0));
31 27
@@ -53,17 +49,16 @@ void BenD::drawButton(QPainter *) { }
53void BenD::drawButtonText(QPainter *) { } 49void BenD::drawButtonText(QPainter *) { }
54 50
55void BenD::slotClicked() 51void 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
66void BenD::slotCheck() 61void BenD::slotCheck()
67{ 62{
68 // Check wether the check interval has been changed. 63 // Check wether the check interval has been changed.
69 int newIntervalMs = _config->readNumEntry("CheckEvery", 5) * 60000; 64 int newIntervalMs = _config->readNumEntry("CheckEvery", 5) * 60000;
@@ -95,33 +90,22 @@ void BenD::slotCheck()
95void BenD::slotIMAPStatus(IMAPResponse &response) 90void BenD::slotIMAPStatus(IMAPResponse &response)
96{ 91{
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
123void 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
@@ -15,24 +15,21 @@ public:
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);
22 21
23protected slots: 22protected 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
29private: 27private:
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
38 35