author | harlekin <harlekin> | 2004-01-03 20:47:29 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-01-03 20:47:29 (UTC) |
commit | a89470252ffae1670e12ef5d81db08d0e27af265 (patch) (unidiff) | |
tree | a00495b5427fe8b3d7f482bd9d61c80083c71ba4 | |
parent | 047436e254964558bfdbb1d84a79a2686f8e0b09 (diff) | |
download | opie-a89470252ffae1670e12ef5d81db08d0e27af265.zip opie-a89470252ffae1670e12ef5d81db08d0e27af265.tar.gz opie-a89470252ffae1670e12ef5d81db08d0e27af265.tar.bz2 |
apdated to new mailer
-rw-r--r-- | core/pim/today/plugins/mail/mailpluginwidget.cpp | 38 | ||||
-rw-r--r-- | core/pim/today/plugins/mail/mailpluginwidget.h | 8 |
2 files changed, 35 insertions, 11 deletions
diff --git a/core/pim/today/plugins/mail/mailpluginwidget.cpp b/core/pim/today/plugins/mail/mailpluginwidget.cpp index 646996a..f717116 100644 --- a/core/pim/today/plugins/mail/mailpluginwidget.cpp +++ b/core/pim/today/plugins/mail/mailpluginwidget.cpp | |||
@@ -1,80 +1,98 @@ | |||
1 | /* | 1 | /* |
2 | * mailpluginwidget.cpp | 2 | * mailpluginwidget.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002,2003 by Maximilian Reiß | 4 | * copyright : (c) 2002,2003,2004 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #include <qpe/config.h> | 17 | #include <qpe/config.h> |
18 | #include <qpe/qcopenvelope_qws.h> | 18 | #include <qpe/qcopenvelope_qws.h> |
19 | 19 | ||
20 | #include "mailpluginwidget.h" | 20 | #include "mailpluginwidget.h" |
21 | 21 | ||
22 | MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name) | 22 | MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name) |
23 | : QWidget(parent, name ) { | 23 | : QWidget(parent, name ) { |
24 | 24 | ||
25 | m_mailLabel = 0l; | 25 | m_mailLabel = 0l; |
26 | m_layout = 0l; | 26 | m_layout = 0l; |
27 | 27 | ||
28 | if ( m_mailLabel ) { | 28 | if ( m_mailLabel ) { |
29 | delete m_mailLabel; | 29 | delete m_mailLabel; |
30 | } | 30 | } |
31 | m_mailLabel = new OClickableLabel( this ); | 31 | m_mailLabel = new OClickableLabel( this ); |
32 | //m_mailLabel->setMaximumHeight( 15 ); | ||
33 | connect( m_mailLabel, SIGNAL( clicked() ), this, SLOT( startMail() ) ); | 32 | connect( m_mailLabel, SIGNAL( clicked() ), this, SLOT( startMail() ) ); |
34 | 33 | ||
35 | if ( m_layout ) { | 34 | if ( m_layout ) { |
36 | delete m_layout; | 35 | delete m_layout; |
37 | } | 36 | } |
38 | m_layout = new QHBoxLayout( this ); | 37 | m_layout = new QHBoxLayout( this ); |
39 | m_layout->setAutoAdd( true ); | 38 | m_layout->setAutoAdd( true ); |
40 | 39 | ||
40 | |||
41 | #if defined(Q_WS_QWS) | ||
42 | #if !defined(QT_NO_COP) | ||
43 | QCopChannel *qCopChannel = new QCopChannel( "QPE/Pim" , this ); | ||
44 | connect ( qCopChannel, SIGNAL( received( const QCString &, const QByteArray &) ), | ||
45 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); | ||
46 | #endif | ||
47 | #endif | ||
48 | |||
41 | readConfig(); | 49 | readConfig(); |
42 | getInfo(); | 50 | getInfo(); |
43 | } | 51 | } |
44 | 52 | ||
53 | |||
54 | void MailPluginWidget::channelReceived( const QCString &msg, const QByteArray & data ) { | ||
55 | QDataStream stream( data, IO_ReadOnly ); | ||
56 | if ( msg == "outgoingMails(int)" ) { | ||
57 | stream >> m_outgoing; | ||
58 | } else if ( msg == "newMails(int)" ) { | ||
59 | stream >> m_newMails; | ||
60 | } | ||
61 | getInfo(); | ||
62 | } | ||
45 | MailPluginWidget::~MailPluginWidget() { | 63 | MailPluginWidget::~MailPluginWidget() { |
46 | delete m_mailLabel; | 64 | delete m_mailLabel; |
47 | delete m_layout; | 65 | delete m_layout; |
48 | } | 66 | } |
49 | 67 | ||
50 | 68 | ||
51 | void MailPluginWidget::readConfig() { | 69 | void MailPluginWidget::readConfig() { |
52 | Config cfg( "todaymailplugin" ); | 70 | Config cfg( "todaymailplugin" ); |
53 | cfg.setGroup( "config" ); | 71 | cfg.setGroup( "config" ); |
72 | |||
73 | Config cfg2( "mail" ); | ||
74 | cfg2.setGroup( "Status" ); | ||
75 | |||
76 | m_newMails = cfg2.readNumEntry( "newmails", 0 ); | ||
77 | m_outgoing = cfg2.readNumEntry( "outgoing", 0 ); | ||
54 | } | 78 | } |
55 | 79 | ||
56 | 80 | ||
57 | void MailPluginWidget::refresh() { | 81 | void MailPluginWidget::refresh() { |
58 | getInfo(); | 82 | getInfo(); |
59 | } | 83 | } |
60 | 84 | ||
61 | void MailPluginWidget::getInfo() { | 85 | void MailPluginWidget::getInfo() { |
62 | 86 | ||
63 | Config cfg( "opiemail" ); | ||
64 | cfg.setGroup( "today" ); | ||
65 | |||
66 | int NEW_MAILS = cfg.readNumEntry( "newmails", 0 ); | ||
67 | int OUTGOING = cfg.readNumEntry( "outgoing", 0 ); | ||
68 | 87 | ||
69 | //QString output = QObject::tr( "<b>%1</b> new mail(s), <b>%2</b> outgoing" ).arg( NEW_MAILS ).arg( OUTGOING ); | ||
70 | 88 | ||
71 | m_mailLabel->setText( QObject::tr( "<b>%1</b> new mail(s), <b>%2</b> outgoing" ).arg( NEW_MAILS ).arg( OUTGOING ) ); | 89 | m_mailLabel->setText( QObject::tr( "<b>%1</b> new mail(s), <b>%2</b> outgoing" ).arg( m_newMails ).arg( m_outgoing ) ); |
72 | } | 90 | } |
73 | 91 | ||
74 | /** | 92 | /** |
75 | * launches datebook | 93 | * launches datebook |
76 | */ | 94 | */ |
77 | void MailPluginWidget::startMail() { | 95 | void MailPluginWidget::startMail() { |
78 | QCopEnvelope e("QPE/System", "execute(QString)"); | 96 | QCopEnvelope e("QPE/System", "execute(QString)"); |
79 | e << QString( "mail" ); | 97 | e << QString( "opiemail" ); |
80 | } | 98 | } |
diff --git a/core/pim/today/plugins/mail/mailpluginwidget.h b/core/pim/today/plugins/mail/mailpluginwidget.h index a3b1388..6d16d2c 100644 --- a/core/pim/today/plugins/mail/mailpluginwidget.h +++ b/core/pim/today/plugins/mail/mailpluginwidget.h | |||
@@ -1,44 +1,50 @@ | |||
1 | /* | 1 | /* |
2 | * mailpluginwidget.h | 2 | * mailpluginwidget.h |
3 | * | 3 | * |
4 | * copyright : (c) 2002,2003 by Maximilian Reiß | 4 | * copyright : (c) 2002,2003,2004 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #ifndef MAIL_PLUGIN_WIDGET_H | 17 | #ifndef MAIL_PLUGIN_WIDGET_H |
18 | #define MAIL_PLUGIN_WIDGET_H | 18 | #define MAIL_PLUGIN_WIDGET_H |
19 | 19 | ||
20 | #include <qlayout.h> | 20 | #include <qlayout.h> |
21 | 21 | ||
22 | #include <opie/oclickablelabel.h> | 22 | #include <opie/oclickablelabel.h> |
23 | 23 | ||
24 | class MailPluginWidget : public QWidget { | 24 | class MailPluginWidget : public QWidget { |
25 | 25 | ||
26 | Q_OBJECT | 26 | Q_OBJECT |
27 | 27 | ||
28 | public: | 28 | public: |
29 | MailPluginWidget( QWidget *parent, const char *name ); | 29 | MailPluginWidget( QWidget *parent, const char *name ); |
30 | ~MailPluginWidget(); | 30 | ~MailPluginWidget(); |
31 | 31 | ||
32 | void refresh(); | 32 | void refresh(); |
33 | 33 | ||
34 | protected slots: | 34 | protected slots: |
35 | void startMail(); | 35 | void startMail(); |
36 | 36 | ||
37 | private: | 37 | private: |
38 | OClickableLabel* m_mailLabel; | 38 | OClickableLabel* m_mailLabel; |
39 | QHBoxLayout* m_layout; | 39 | QHBoxLayout* m_layout; |
40 | void readConfig(); | 40 | void readConfig(); |
41 | void getInfo(); | 41 | void getInfo(); |
42 | |||
43 | int m_newMails; | ||
44 | int m_outgoing; | ||
45 | |||
46 | private slots: | ||
47 | void channelReceived(const QCString &msg, const QByteArray & data); | ||
42 | }; | 48 | }; |
43 | 49 | ||
44 | #endif | 50 | #endif |