-rw-r--r-- | noncore/net/mail/taskbarapplet/.cvsignore | 3 | ||||
-rw-r--r-- | noncore/net/mail/taskbarapplet/config.in | 4 | ||||
-rw-r--r-- | noncore/net/mail/taskbarapplet/mailapplet.cpp | 75 | ||||
-rw-r--r-- | noncore/net/mail/taskbarapplet/mailapplet.h | 32 | ||||
-rw-r--r-- | noncore/net/mail/taskbarapplet/mailappletimpl.cpp | 33 | ||||
-rw-r--r-- | noncore/net/mail/taskbarapplet/mailappletimpl.h | 27 | ||||
-rw-r--r-- | noncore/net/mail/taskbarapplet/opie-mailapplet.control | 10 | ||||
-rw-r--r-- | noncore/net/mail/taskbarapplet/taskbarapplet.pro | 12 |
8 files changed, 196 insertions, 0 deletions
diff --git a/noncore/net/mail/taskbarapplet/.cvsignore b/noncore/net/mail/taskbarapplet/.cvsignore new file mode 100644 index 0000000..1ee9a27 --- a/dev/null +++ b/noncore/net/mail/taskbarapplet/.cvsignore | |||
@@ -0,0 +1,3 @@ | |||
1 | *.moc | ||
2 | Makefile* | ||
3 | moc_* | ||
diff --git a/noncore/net/mail/taskbarapplet/config.in b/noncore/net/mail/taskbarapplet/config.in new file mode 100644 index 0000000..0e5469d --- a/dev/null +++ b/noncore/net/mail/taskbarapplet/config.in | |||
@@ -0,0 +1,4 @@ | |||
1 | config MAILAPPLET | ||
2 | boolean "mailapplet ( taskbar mail applet )" | ||
3 | default "y" | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && MAIL3 | ||
diff --git a/noncore/net/mail/taskbarapplet/mailapplet.cpp b/noncore/net/mail/taskbarapplet/mailapplet.cpp new file mode 100644 index 0000000..f3550c7 --- a/dev/null +++ b/noncore/net/mail/taskbarapplet/mailapplet.cpp | |||
@@ -0,0 +1,75 @@ | |||
1 | #include <qlayout.h> | ||
2 | #include <qpixmap.h> | ||
3 | #include <qlabel.h> | ||
4 | #include <qsound.h> | ||
5 | #include <qtimer.h> | ||
6 | #include <qdir.h> | ||
7 | |||
8 | #include <qpe/qcopenvelope_qws.h> | ||
9 | #include <qpe/resource.h> | ||
10 | #include <qpe/config.h> | ||
11 | |||
12 | #include <opie/odevice.h> | ||
13 | |||
14 | #include "mailapplet.h" | ||
15 | |||
16 | using namespace Opie; | ||
17 | |||
18 | MailApplet::MailApplet( QWidget *parent, const char *name, WFlags fl ) | ||
19 | : QButton( parent, name, fl ) { | ||
20 | |||
21 | m_config = new Config( "mail" ); | ||
22 | m_config->setGroup( "Applet" ); | ||
23 | |||
24 | QVBoxLayout *layout = new QVBoxLayout( this ); | ||
25 | layout->addItem( new QSpacerItem( 0,0 ) ); | ||
26 | |||
27 | QLabel *pixmap = new QLabel( this ); | ||
28 | pixmap->setPixmap( Resource::loadPixmap( "opiemail/mailchecker" ) ); | ||
29 | layout->addWidget( pixmap ); | ||
30 | |||
31 | layout->addItem( new QSpacerItem( 0,0 ) ); | ||
32 | |||
33 | hide(); | ||
34 | |||
35 | connect( this, SIGNAL( clicked() ), SLOT( slotClicked() ) ); | ||
36 | |||
37 | if ( !m_config->readBoolEntry( "Disabled", false ) ) { | ||
38 | m_intervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; | ||
39 | m_intervalTimer = new QTimer(); | ||
40 | m_intervalTimer->start( m_intervalMs ); | ||
41 | connect( m_intervalTimer, SIGNAL(timeout() ), SLOT( slotCheck() ) ); | ||
42 | |||
43 | QTimer::singleShot( 0, this, SLOT( slotCheck() ) ); | ||
44 | } | ||
45 | } | ||
46 | |||
47 | void MailApplet::drawButton(QPainter *) { } | ||
48 | void MailApplet::drawButtonText(QPainter *) { } | ||
49 | |||
50 | void MailApplet::slotClicked() { | ||
51 | qDebug( " CLICKED" ); | ||
52 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | ||
53 | e << QString( "opiemail" ); | ||
54 | |||
55 | ODevice *device = ODevice::inst(); | ||
56 | if ( !device-> ledList ( ). isEmpty ( ) ) { | ||
57 | OLed led = ( device-> ledList ( ). contains ( Led_Mail )) ? Led_Mail : device-> ledList ( ) [0]; | ||
58 | |||
59 | device->setLedState( led, Led_Off ); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | void MailApplet::slotCheck() { | ||
64 | // Check wether the check interval has been changed. | ||
65 | int newIntervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; | ||
66 | if ( newIntervalMs != m_intervalMs ) { | ||
67 | m_intervalTimer->changeInterval( newIntervalMs ); | ||
68 | m_intervalMs = newIntervalMs; | ||
69 | } | ||
70 | |||
71 | // go trough accounts and check here | ||
72 | // depending on result show or hide | ||
73 | // also trigger qcop call and save status to config | ||
74 | // get led to blink | ||
75 | } | ||
diff --git a/noncore/net/mail/taskbarapplet/mailapplet.h b/noncore/net/mail/taskbarapplet/mailapplet.h new file mode 100644 index 0000000..1c48b29 --- a/dev/null +++ b/noncore/net/mail/taskbarapplet/mailapplet.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #ifndef MAILAPPLET_H | ||
2 | #define MAILAPPLET_H | ||
3 | |||
4 | #include <qbutton.h> | ||
5 | |||
6 | class Config; | ||
7 | class QTimer; | ||
8 | |||
9 | class MailApplet : public QButton { | ||
10 | |||
11 | Q_OBJECT | ||
12 | |||
13 | public: | ||
14 | MailApplet(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); | ||
15 | |||
16 | protected: | ||
17 | void drawButton(QPainter *); | ||
18 | void drawButtonText(QPainter *); | ||
19 | void gotNewMail(); | ||
20 | |||
21 | protected slots: | ||
22 | void slotCheck(); | ||
23 | void slotClicked(); | ||
24 | private: | ||
25 | Config *m_config; | ||
26 | QTimer *m_intervalTimer; | ||
27 | int m_intervalMs; | ||
28 | |||
29 | }; | ||
30 | |||
31 | #endif | ||
32 | |||
diff --git a/noncore/net/mail/taskbarapplet/mailappletimpl.cpp b/noncore/net/mail/taskbarapplet/mailappletimpl.cpp new file mode 100644 index 0000000..26f6a6f --- a/dev/null +++ b/noncore/net/mail/taskbarapplet/mailappletimpl.cpp | |||
@@ -0,0 +1,33 @@ | |||
1 | #include "mailappletimpl.h" | ||
2 | #include "mailapplet.h" | ||
3 | |||
4 | MailAppletImpl::MailAppletImpl() | ||
5 | : m_mailApplet(0), ref(0) { | ||
6 | |||
7 | } | ||
8 | |||
9 | MailAppletImpl::~MailAppletImpl() { | ||
10 | delete m_mailApplet; | ||
11 | } | ||
12 | |||
13 | QWidget *MailAppletImpl::applet(QWidget *parent) { | ||
14 | if (!m_mailApplet) m_mailApplet = new MailApplet(parent); | ||
15 | return m_mailApplet; | ||
16 | } | ||
17 | |||
18 | int MailAppletImpl::position() const { | ||
19 | return 4; | ||
20 | } | ||
21 | |||
22 | QRESULT MailAppletImpl::queryInterface(const QUuid &uuid, QUnknownInterface **iface) { | ||
23 | *iface = 0; | ||
24 | if (uuid == IID_QUnknown) *iface = this; | ||
25 | else if (uuid == IID_TaskbarApplet) *iface = this; | ||
26 | |||
27 | if (*iface) (*iface)->addRef(); | ||
28 | return QS_OK; | ||
29 | } | ||
30 | |||
31 | Q_EXPORT_INTERFACE() { | ||
32 | Q_CREATE_INSTANCE( MailAppletImpl ) | ||
33 | } | ||
diff --git a/noncore/net/mail/taskbarapplet/mailappletimpl.h b/noncore/net/mail/taskbarapplet/mailappletimpl.h new file mode 100644 index 0000000..4f27eb3 --- a/dev/null +++ b/noncore/net/mail/taskbarapplet/mailappletimpl.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef MAILAPPLETIMPL_H | ||
2 | #define MAILAPPLETIMPL_H | ||
3 | |||
4 | #include <qpe/taskbarappletinterface.h> | ||
5 | |||
6 | class MailApplet; | ||
7 | |||
8 | class MailAppletImpl : public TaskbarAppletInterface { | ||
9 | |||
10 | public: | ||
11 | MailAppletImpl(); | ||
12 | virtual ~MailAppletImpl(); | ||
13 | |||
14 | QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ); | ||
15 | Q_REFCOUNT | ||
16 | |||
17 | virtual QWidget *applet( QWidget *parent ); | ||
18 | virtual int position() const; | ||
19 | |||
20 | private: | ||
21 | MailApplet *m_mailApplet; | ||
22 | ulong ref; | ||
23 | |||
24 | }; | ||
25 | |||
26 | #endif | ||
27 | |||
diff --git a/noncore/net/mail/taskbarapplet/opie-mailapplet.control b/noncore/net/mail/taskbarapplet/opie-mailapplet.control new file mode 100644 index 0000000..7dfd2a0 --- a/dev/null +++ b/noncore/net/mail/taskbarapplet/opie-mailapplet.control | |||
@@ -0,0 +1,10 @@ | |||
1 | Package: opie-mailapplet | ||
2 | Files: plugins/applets/libmailapplet.so* | ||
3 | Priority: optional | ||
4 | Section: opie/applications | ||
5 | Maintainer: | ||
6 | Architecture: arm | ||
7 | Version: $QPE_VERSION$EXTRAVERSION | ||
8 | Depends: task-opie-minimal, libopie1, opie-mail | ||
9 | Description: A Biff-Like mailchecker | ||
10 | License: LGPL | ||
diff --git a/noncore/net/mail/taskbarapplet/taskbarapplet.pro b/noncore/net/mail/taskbarapplet/taskbarapplet.pro new file mode 100644 index 0000000..3c658e3 --- a/dev/null +++ b/noncore/net/mail/taskbarapplet/taskbarapplet.pro | |||
@@ -0,0 +1,12 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG +=qt plugin warn_on release | ||
3 | HEADERS +=mailapplet.h \ | ||
4 | mailappletimpl.h | ||
5 | SOURCES +=mailapplet.cpp \ | ||
6 | mailappletimpl.cpp | ||
7 | INCLUDEPATH += $(OPIEDIR)/include | ||
8 | LIBS +=-lmailwrapper -lqpe -lopie | ||
9 | TARGET =mailapplet | ||
10 | DESTDIR +=$(OPIEDIR)/plugins/applets/ | ||
11 | |||
12 | include ( $(OPIEDIR)/include.pro ) | ||