summaryrefslogtreecommitdiff
authorharlekin <harlekin>2004-01-04 12:14:32 (UTC)
committer harlekin <harlekin>2004-01-04 12:14:32 (UTC)
commit2ebf36bb85cb9a38348286b31492adf65fa792e3 (patch) (side-by-side diff)
tree5b3e9b1a60721ffbe8a7f05326c6a4090d481b30
parent4b272adb6de68199b63f002d9e8e778d09742b72 (diff)
downloadopie-2ebf36bb85cb9a38348286b31492adf65fa792e3.zip
opie-2ebf36bb85cb9a38348286b31492adf65fa792e3.tar.gz
opie-2ebf36bb85cb9a38348286b31492adf65fa792e3.tar.bz2
beginning of the mail taskbar applet
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/taskbarapplet/.cvsignore3
-rw-r--r--noncore/net/mail/taskbarapplet/config.in4
-rw-r--r--noncore/net/mail/taskbarapplet/mailapplet.cpp75
-rw-r--r--noncore/net/mail/taskbarapplet/mailapplet.h32
-rw-r--r--noncore/net/mail/taskbarapplet/mailappletimpl.cpp33
-rw-r--r--noncore/net/mail/taskbarapplet/mailappletimpl.h27
-rw-r--r--noncore/net/mail/taskbarapplet/opie-mailapplet.control10
-rw-r--r--noncore/net/mail/taskbarapplet/taskbarapplet.pro12
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 @@
+*.moc
+Makefile*
+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 @@
+ config MAILAPPLET
+ boolean "mailapplet ( taskbar mail applet )"
+ default "y"
+ 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 @@
+#include <qlayout.h>
+#include <qpixmap.h>
+#include <qlabel.h>
+#include <qsound.h>
+#include <qtimer.h>
+#include <qdir.h>
+
+#include <qpe/qcopenvelope_qws.h>
+#include <qpe/resource.h>
+#include <qpe/config.h>
+
+#include <opie/odevice.h>
+
+#include "mailapplet.h"
+
+using namespace Opie;
+
+MailApplet::MailApplet( QWidget *parent, const char *name, WFlags fl )
+ : QButton( parent, name, fl ) {
+
+ m_config = new Config( "mail" );
+ m_config->setGroup( "Applet" );
+
+ QVBoxLayout *layout = new QVBoxLayout( this );
+ layout->addItem( new QSpacerItem( 0,0 ) );
+
+ QLabel *pixmap = new QLabel( this );
+ pixmap->setPixmap( Resource::loadPixmap( "opiemail/mailchecker" ) );
+ layout->addWidget( pixmap );
+
+ layout->addItem( new QSpacerItem( 0,0 ) );
+
+ hide();
+
+ connect( this, SIGNAL( clicked() ), SLOT( slotClicked() ) );
+
+ if ( !m_config->readBoolEntry( "Disabled", false ) ) {
+ m_intervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000;
+ m_intervalTimer = new QTimer();
+ m_intervalTimer->start( m_intervalMs );
+ connect( m_intervalTimer, SIGNAL(timeout() ), SLOT( slotCheck() ) );
+
+ QTimer::singleShot( 0, this, SLOT( slotCheck() ) );
+ }
+}
+
+void MailApplet::drawButton(QPainter *) { }
+void MailApplet::drawButtonText(QPainter *) { }
+
+void MailApplet::slotClicked() {
+ qDebug( " CLICKED" );
+ QCopEnvelope e( "QPE/System", "execute(QString)" );
+ e << QString( "opiemail" );
+
+ ODevice *device = ODevice::inst();
+ if ( !device-> ledList ( ). isEmpty ( ) ) {
+ OLed led = ( device-> ledList ( ). contains ( Led_Mail )) ? Led_Mail : device-> ledList ( ) [0];
+
+ device->setLedState( led, Led_Off );
+ }
+}
+
+void MailApplet::slotCheck() {
+ // Check wether the check interval has been changed.
+ int newIntervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000;
+ if ( newIntervalMs != m_intervalMs ) {
+ m_intervalTimer->changeInterval( newIntervalMs );
+ m_intervalMs = newIntervalMs;
+ }
+
+ // go trough accounts and check here
+ // depending on result show or hide
+ // also trigger qcop call and save status to config
+ // get led to blink
+}
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 @@
+#ifndef MAILAPPLET_H
+#define MAILAPPLET_H
+
+#include <qbutton.h>
+
+class Config;
+class QTimer;
+
+class MailApplet : public QButton {
+
+ Q_OBJECT
+
+public:
+ MailApplet(QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
+
+protected:
+ void drawButton(QPainter *);
+ void drawButtonText(QPainter *);
+ void gotNewMail();
+
+protected slots:
+ void slotCheck();
+ void slotClicked();
+private:
+ Config *m_config;
+ QTimer *m_intervalTimer;
+ int m_intervalMs;
+
+};
+
+#endif
+
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 @@
+#include "mailappletimpl.h"
+#include "mailapplet.h"
+
+MailAppletImpl::MailAppletImpl()
+ : m_mailApplet(0), ref(0) {
+
+}
+
+MailAppletImpl::~MailAppletImpl() {
+ delete m_mailApplet;
+}
+
+QWidget *MailAppletImpl::applet(QWidget *parent) {
+ if (!m_mailApplet) m_mailApplet = new MailApplet(parent);
+ return m_mailApplet;
+}
+
+int MailAppletImpl::position() const {
+ return 4;
+}
+
+QRESULT MailAppletImpl::queryInterface(const QUuid &uuid, QUnknownInterface **iface) {
+ *iface = 0;
+ if (uuid == IID_QUnknown) *iface = this;
+ else if (uuid == IID_TaskbarApplet) *iface = this;
+
+ if (*iface) (*iface)->addRef();
+ return QS_OK;
+}
+
+Q_EXPORT_INTERFACE() {
+ Q_CREATE_INSTANCE( MailAppletImpl )
+}
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 @@
+#ifndef MAILAPPLETIMPL_H
+#define MAILAPPLETIMPL_H
+
+#include <qpe/taskbarappletinterface.h>
+
+class MailApplet;
+
+class MailAppletImpl : public TaskbarAppletInterface {
+
+public:
+ MailAppletImpl();
+ virtual ~MailAppletImpl();
+
+ QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface );
+ Q_REFCOUNT
+
+ virtual QWidget *applet( QWidget *parent );
+ virtual int position() const;
+
+private:
+ MailApplet *m_mailApplet;
+ ulong ref;
+
+};
+
+#endif
+
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 @@
+Package: opie-mailapplet
+Files: plugins/applets/libmailapplet.so*
+Priority: optional
+Section: opie/applications
+Maintainer:
+Architecture: arm
+Version: $QPE_VERSION$EXTRAVERSION
+Depends: task-opie-minimal, libopie1, opie-mail
+Description: A Biff-Like mailchecker
+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 @@
+TEMPLATE = lib
+CONFIG += qt plugin warn_on release
+HEADERS += mailapplet.h \
+ mailappletimpl.h
+SOURCES += mailapplet.cpp \
+ mailappletimpl.cpp
+INCLUDEPATH += $(OPIEDIR)/include
+LIBS += -lmailwrapper -lqpe -lopie
+TARGET = mailapplet
+DESTDIR += $(OPIEDIR)/plugins/applets/
+
+include ( $(OPIEDIR)/include.pro )