author | harlekin <harlekin> | 2003-02-10 21:28:14 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-02-10 21:28:14 (UTC) |
commit | bbb3cdf8f91d567f6c2e786bd144b64bd679ff9a (patch) (unidiff) | |
tree | 9c622e670cab66c44d9bd079707945cf3c9bcb89 /core/pim/today/plugins/mail | |
parent | de272b8c47c3960a3fe574317fe2e6fb0c32e4af (diff) | |
download | opie-bbb3cdf8f91d567f6c2e786bd144b64bd679ff9a.zip opie-bbb3cdf8f91d567f6c2e786bd144b64bd679ff9a.tar.gz opie-bbb3cdf8f91d567f6c2e786bd144b64bd679ff9a.tar.bz2 |
adapted to new refresh, datebookplugin still need some work
-rw-r--r-- | core/pim/today/plugins/mail/mailplugin.cpp | 17 | ||||
-rw-r--r-- | core/pim/today/plugins/mail/mailplugin.h | 6 | ||||
-rw-r--r-- | core/pim/today/plugins/mail/mailpluginwidget.cpp | 33 | ||||
-rw-r--r-- | core/pim/today/plugins/mail/mailpluginwidget.h | 6 |
4 files changed, 48 insertions, 14 deletions
diff --git a/core/pim/today/plugins/mail/mailplugin.cpp b/core/pim/today/plugins/mail/mailplugin.cpp index d497970..a37d506 100644 --- a/core/pim/today/plugins/mail/mailplugin.cpp +++ b/core/pim/today/plugins/mail/mailplugin.cpp | |||
@@ -13,19 +13,19 @@ | |||
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | 17 | ||
18 | #include "mailplugin.h" | 18 | #include "mailplugin.h" |
19 | #include "mailpluginwidget.h" | ||
20 | |||
21 | 19 | ||
22 | MailPlugin::MailPlugin() { | 20 | MailPlugin::MailPlugin() { |
21 | m_widget = 0l; | ||
23 | } | 22 | } |
24 | 23 | ||
25 | MailPlugin::~MailPlugin() { | 24 | MailPlugin::~MailPlugin() { |
25 | delete m_widget; | ||
26 | } | 26 | } |
27 | 27 | ||
28 | QString MailPlugin::pluginName() const { | 28 | QString MailPlugin::pluginName() const { |
29 | return QObject::tr( "Mail plugin" ); | 29 | return QObject::tr( "Mail plugin" ); |
30 | } | 30 | } |
31 | 31 | ||
@@ -35,26 +35,35 @@ double MailPlugin::versionNumber() const { | |||
35 | 35 | ||
36 | QString MailPlugin::pixmapNameWidget() const { | 36 | QString MailPlugin::pixmapNameWidget() const { |
37 | return "mail/desktopicon"; | 37 | return "mail/desktopicon"; |
38 | } | 38 | } |
39 | 39 | ||
40 | QWidget* MailPlugin::widget( QWidget * wid ) { | 40 | QWidget* MailPlugin::widget( QWidget * wid ) { |
41 | return new MailPluginWidget( wid, "Mail" ); | 41 | if(!m_widget) { |
42 | m_widget = new MailPluginWidget( wid, "Datebook" ); | ||
43 | } | ||
44 | return m_widget; | ||
42 | } | 45 | } |
43 | 46 | ||
47 | |||
44 | QString MailPlugin::pixmapNameConfig() const { | 48 | QString MailPlugin::pixmapNameConfig() const { |
45 | return 0l; | 49 | return 0l; |
46 | } | 50 | } |
47 | 51 | ||
48 | TodayConfigWidget* MailPlugin::configWidget( QWidget* wid ) { | 52 | TodayConfigWidget* MailPlugin::configWidget( QWidget* ) { |
49 | return 0l; | 53 | return 0l; |
50 | } | 54 | } |
51 | 55 | ||
52 | QString MailPlugin::appName() const { | 56 | QString MailPlugin::appName() const { |
53 | return "mail"; | 57 | return "mail"; |
54 | } | 58 | } |
55 | 59 | ||
56 | 60 | ||
57 | bool MailPlugin::excludeFromRefresh() const { | 61 | bool MailPlugin::excludeFromRefresh() const { |
58 | return false; | 62 | return false; |
59 | } | 63 | } |
60 | 64 | ||
65 | void MailPlugin::refresh() { | ||
66 | if ( m_widget ) { | ||
67 | m_widget->refresh(); | ||
68 | } | ||
69 | } | ||
diff --git a/core/pim/today/plugins/mail/mailplugin.h b/core/pim/today/plugins/mail/mailplugin.h index c937b9e..67fac0c 100644 --- a/core/pim/today/plugins/mail/mailplugin.h +++ b/core/pim/today/plugins/mail/mailplugin.h | |||
@@ -24,12 +24,14 @@ | |||
24 | #include <opie/tododb.h> | 24 | #include <opie/tododb.h> |
25 | #include <opie/oclickablelabel.h> | 25 | #include <opie/oclickablelabel.h> |
26 | 26 | ||
27 | #include <opie/todayplugininterface.h> | 27 | #include <opie/todayplugininterface.h> |
28 | #include <opie/todayconfigwidget.h> | 28 | #include <opie/todayconfigwidget.h> |
29 | 29 | ||
30 | #include "mailpluginwidget.h" | ||
31 | |||
30 | class MailPlugin : public TodayPluginObject { | 32 | class MailPlugin : public TodayPluginObject { |
31 | 33 | ||
32 | public: | 34 | public: |
33 | MailPlugin(); | 35 | MailPlugin(); |
34 | ~MailPlugin(); | 36 | ~MailPlugin(); |
35 | 37 | ||
@@ -38,9 +40,13 @@ public: | |||
38 | QString pixmapNameWidget() const; | 40 | QString pixmapNameWidget() const; |
39 | QWidget* widget(QWidget *); | 41 | QWidget* widget(QWidget *); |
40 | QString pixmapNameConfig() const; | 42 | QString pixmapNameConfig() const; |
41 | TodayConfigWidget* configWidget(QWidget *); | 43 | TodayConfigWidget* configWidget(QWidget *); |
42 | QString appName() const; | 44 | QString appName() const; |
43 | bool excludeFromRefresh() const; | 45 | bool excludeFromRefresh() const; |
46 | void refresh(); | ||
47 | |||
48 | private: | ||
49 | MailPluginWidget *m_widget; | ||
44 | }; | 50 | }; |
45 | 51 | ||
46 | #endif | 52 | #endif |
diff --git a/core/pim/today/plugins/mail/mailpluginwidget.cpp b/core/pim/today/plugins/mail/mailpluginwidget.cpp index a6f3562..aad1d07 100644 --- a/core/pim/today/plugins/mail/mailpluginwidget.cpp +++ b/core/pim/today/plugins/mail/mailpluginwidget.cpp | |||
@@ -27,44 +27,59 @@ | |||
27 | 27 | ||
28 | #include "mailpluginwidget.h" | 28 | #include "mailpluginwidget.h" |
29 | 29 | ||
30 | MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name) | 30 | MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name) |
31 | : QWidget(parent, name ) { | 31 | : QWidget(parent, name ) { |
32 | 32 | ||
33 | m_mailLabel = 0l; | ||
34 | m_layout = 0l; | ||
35 | |||
36 | if ( m_mailLabel ) { | ||
37 | delete m_mailLabel; | ||
38 | } | ||
39 | m_mailLabel = new OClickableLabel( this ); | ||
40 | m_mailLabel->setMaximumHeight( 15 ); | ||
41 | connect( m_mailLabel, SIGNAL( clicked() ), this, SLOT( startMail() ) ); | ||
42 | |||
43 | if ( m_layout ) { | ||
44 | delete m_layout; | ||
45 | } | ||
46 | m_layout = new QHBoxLayout( this ); | ||
47 | m_layout->setAutoAdd( true ); | ||
48 | |||
33 | readConfig(); | 49 | readConfig(); |
34 | getInfo(); | 50 | getInfo(); |
35 | } | 51 | } |
36 | 52 | ||
37 | MailPluginWidget::~MailPluginWidget() { | 53 | MailPluginWidget::~MailPluginWidget() { |
54 | delete m_mailLabel; | ||
55 | delete m_layout; | ||
38 | } | 56 | } |
39 | 57 | ||
40 | 58 | ||
41 | void MailPluginWidget::readConfig() { | 59 | void MailPluginWidget::readConfig() { |
42 | Config cfg( "todaymailplugin" ); | 60 | Config cfg( "todaymailplugin" ); |
43 | cfg.setGroup( "config" ); | 61 | cfg.setGroup( "config" ); |
44 | } | 62 | } |
45 | 63 | ||
46 | 64 | ||
47 | void MailPluginWidget::getInfo() { | 65 | void MailPluginWidget::refresh() { |
48 | 66 | getInfo(); | |
49 | QHBoxLayout* layout = new QHBoxLayout( this ); | 67 | } |
50 | 68 | ||
51 | mailLabel = new OClickableLabel( this ); | 69 | void MailPluginWidget::getInfo() { |
52 | mailLabel->setMaximumHeight( 15 ); | ||
53 | connect( mailLabel, SIGNAL( clicked() ), this, SLOT( startMail() ) ); | ||
54 | 70 | ||
55 | Config cfg( "opiemail" ); | 71 | Config cfg( "opiemail" ); |
56 | cfg.setGroup( "today" ); | 72 | cfg.setGroup( "today" ); |
57 | 73 | ||
58 | int NEW_MAILS = cfg.readNumEntry( "newmails", 0 ); | 74 | int NEW_MAILS = cfg.readNumEntry( "newmails", 0 ); |
59 | int OUTGOING = cfg.readNumEntry( "outgoing", 0 ); | 75 | int OUTGOING = cfg.readNumEntry( "outgoing", 0 ); |
60 | 76 | ||
61 | QString output = QObject::tr( "<b>%1</b> new mail(s), <b>%2</b> outgoing" ).arg( NEW_MAILS ).arg( OUTGOING ); | 77 | //QString output = QObject::tr( "<b>%1</b> new mail(s), <b>%2</b> outgoing" ).arg( NEW_MAILS ).arg( OUTGOING ); |
62 | 78 | ||
63 | mailLabel->setText( output ); | 79 | m_mailLabel->setText( QObject::tr( "<b>%1</b> new mail(s), <b>%2</b> outgoing" ).arg( NEW_MAILS ).arg( OUTGOING ) ); |
64 | layout->addWidget( mailLabel ); | ||
65 | } | 80 | } |
66 | 81 | ||
67 | /** | 82 | /** |
68 | * launches datebook | 83 | * launches datebook |
69 | */ | 84 | */ |
70 | void MailPluginWidget::startMail() { | 85 | void MailPluginWidget::startMail() { |
diff --git a/core/pim/today/plugins/mail/mailpluginwidget.h b/core/pim/today/plugins/mail/mailpluginwidget.h index 2feef80..c678833 100644 --- a/core/pim/today/plugins/mail/mailpluginwidget.h +++ b/core/pim/today/plugins/mail/mailpluginwidget.h | |||
@@ -17,12 +17,13 @@ | |||
17 | 17 | ||
18 | #ifndef MAIL_PLUGIN_WIDGET_H | 18 | #ifndef MAIL_PLUGIN_WIDGET_H |
19 | #define MAIL_PLUGIN_WIDGET_H | 19 | #define MAIL_PLUGIN_WIDGET_H |
20 | 20 | ||
21 | #include <qstring.h> | 21 | #include <qstring.h> |
22 | #include <qwidget.h> | 22 | #include <qwidget.h> |
23 | #include <qlayout.h> | ||
23 | 24 | ||
24 | #include <opie/tododb.h> | 25 | #include <opie/tododb.h> |
25 | #include <opie/oclickablelabel.h> | 26 | #include <opie/oclickablelabel.h> |
26 | 27 | ||
27 | class MailPluginWidget : public QWidget { | 28 | class MailPluginWidget : public QWidget { |
28 | 29 | ||
@@ -30,16 +31,19 @@ class MailPluginWidget : public QWidget { | |||
30 | 31 | ||
31 | 32 | ||
32 | public: | 33 | public: |
33 | MailPluginWidget( QWidget *parent, const char *name ); | 34 | MailPluginWidget( QWidget *parent, const char *name ); |
34 | ~MailPluginWidget(); | 35 | ~MailPluginWidget(); |
35 | 36 | ||
37 | void refresh(); | ||
38 | |||
36 | protected slots: | 39 | protected slots: |
37 | void startMail(); | 40 | void startMail(); |
38 | 41 | ||
39 | private: | 42 | private: |
40 | OClickableLabel *mailLabel; | 43 | OClickableLabel* m_mailLabel; |
44 | QHBoxLayout* m_layout; | ||
41 | void readConfig(); | 45 | void readConfig(); |
42 | void getInfo(); | 46 | void getInfo(); |
43 | }; | 47 | }; |
44 | 48 | ||
45 | #endif | 49 | #endif |