summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-02-10 21:28:14 (UTC)
committer harlekin <harlekin>2003-02-10 21:28:14 (UTC)
commitbbb3cdf8f91d567f6c2e786bd144b64bd679ff9a (patch) (side-by-side diff)
tree9c622e670cab66c44d9bd079707945cf3c9bcb89
parentde272b8c47c3960a3fe574317fe2e6fb0c32e4af (diff)
downloadopie-bbb3cdf8f91d567f6c2e786bd144b64bd679ff9a.zip
opie-bbb3cdf8f91d567f6c2e786bd144b64bd679ff9a.tar.gz
opie-bbb3cdf8f91d567f6c2e786bd144b64bd679ff9a.tar.bz2
adapted to new refresh, datebookplugin still need some work
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/TODO2
-rw-r--r--core/pim/today/changelog1
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.cpp14
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.h6
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.cpp53
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.h8
-rw-r--r--core/pim/today/plugins/mail/mailplugin.cpp17
-rw-r--r--core/pim/today/plugins/mail/mailplugin.h6
-rw-r--r--core/pim/today/plugins/mail/mailpluginwidget.cpp33
-rw-r--r--core/pim/today/plugins/mail/mailpluginwidget.h6
-rw-r--r--core/pim/today/plugins/todolist/todoplugin.cpp16
-rw-r--r--core/pim/today/plugins/todolist/todoplugin.h8
-rw-r--r--core/pim/today/plugins/todolist/todopluginwidget.cpp34
-rw-r--r--core/pim/today/plugins/todolist/todopluginwidget.h4
-rw-r--r--core/pim/today/today.cpp42
15 files changed, 174 insertions, 76 deletions
diff --git a/core/pim/today/TODO b/core/pim/today/TODO
index 4dc22aa..04354e7 100644
--- a/core/pim/today/TODO
+++ b/core/pim/today/TODO
@@ -6,4 +6,2 @@ TODO for today:
-* show "upcoming appointents the next days
-
* show alarm icons on alarm events (partly done)
diff --git a/core/pim/today/changelog b/core/pim/today/changelog
index ea618c8..500090d 100644
--- a/core/pim/today/changelog
+++ b/core/pim/today/changelog
@@ -3,2 +3,3 @@
* datebook plugin now can now also show following days
++ changed refresh
* fixed one mem leak
diff --git a/core/pim/today/plugins/datebook/datebookplugin.cpp b/core/pim/today/plugins/datebook/datebookplugin.cpp
index eda84be..2ac7d01 100644
--- a/core/pim/today/plugins/datebook/datebookplugin.cpp
+++ b/core/pim/today/plugins/datebook/datebookplugin.cpp
@@ -21,3 +21,2 @@
#include "datebookplugin.h"
-#include "datebookpluginwidget.h"
#include "datebookpluginconfig.h"
@@ -26,2 +25,3 @@
DatebookPlugin::DatebookPlugin() {
+ m_widget = 0;
}
@@ -29,2 +29,3 @@ DatebookPlugin::DatebookPlugin() {
DatebookPlugin::~DatebookPlugin() {
+ delete m_widget;
}
@@ -44,3 +45,6 @@ QString DatebookPlugin::pixmapNameWidget() const {
QWidget* DatebookPlugin::widget( QWidget* wid ) {
- return new DatebookPluginWidget( wid, "Datebook" );
+ if(!m_widget) {
+ m_widget = new DatebookPluginWidget( wid, "Datebook" );
+ }
+ return m_widget;
}
@@ -62 +66,7 @@ bool DatebookPlugin::excludeFromRefresh() const {
}
+
+void DatebookPlugin::refresh() {
+ if ( m_widget ) {
+ m_widget->refresh();
+ }
+}
diff --git a/core/pim/today/plugins/datebook/datebookplugin.h b/core/pim/today/plugins/datebook/datebookplugin.h
index 13c62a9..644a614 100644
--- a/core/pim/today/plugins/datebook/datebookplugin.h
+++ b/core/pim/today/plugins/datebook/datebookplugin.h
@@ -25,2 +25,4 @@
+#include "datebookpluginwidget.h"
+
class DatebookPlugin : public TodayPluginObject {
@@ -39,2 +41,6 @@ public:
bool excludeFromRefresh() const;
+ void refresh();
+
+ private:
+ DatebookPluginWidget *m_widget;
};
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
index c6aa2a6..e2f492e 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
@@ -1,2 +1,2 @@
-/*
+ /*
* datebookpluginwidget.cpp
@@ -18,3 +18,2 @@
#include "datebookpluginwidget.h"
-#include "datebookevent.h"
@@ -32,3 +31,17 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name)
: QWidget(parent, name ) {
+
db = 0l;
+ m_layoutDates = 0l;
+
+ if ( db ) {
+ delete db;
+ }
+ db = new DateBookDB;
+
+ if ( m_layoutDates ) {
+ delete m_layoutDates;
+ }
+ m_layoutDates = new QVBoxLayout( this );
+ m_layoutDates->setAutoAdd( true );
+
readConfig();
@@ -39,2 +52,3 @@ DatebookPluginWidget::~DatebookPluginWidget() {
delete db;
+ delete m_layoutDates;
}
@@ -52,2 +66,9 @@ void DatebookPluginWidget::readConfig() {
+void DatebookPluginWidget::refresh() {
+ DateBookEvent* ev;
+ for ( ev = m_eventsList.first(); ev != 0; ev = m_eventsList.next() ) {
+ delete ev;
+ }
+ getDates();
+}
@@ -58,21 +79,7 @@ void DatebookPluginWidget::getDates() {
-
QDate date = QDate::currentDate();
- QVBoxLayout* layoutDates = new QVBoxLayout( this );
- layoutDates->setSpacing( 1 );
- layoutDates->setMargin( 1 );
-
- if ( db ) {
- delete db;
- }
-
- db = new DateBookDB;
-
QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) );
-
qBubbleSort( list );
-
- Config config( "qpe" );
-
+ //Config config( "qpe" );
int count=0;
@@ -81,3 +88,3 @@ void DatebookPluginWidget::getDates() {
- for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); it!=list.end(); ++it ) {
+ for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) {
@@ -89,4 +96,4 @@ void DatebookPluginWidget::getDates() {
DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
- layoutDates->addWidget( l );
- QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) );
+ m_eventsList.append( l );
+ QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
} else if ( ( time.toString() <= TimeString::dateString( (*it).event().end() ) ) ) {
@@ -95,4 +102,4 @@ void DatebookPluginWidget::getDates() {
DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
- layoutDates->addWidget( l );
- QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) );
+ m_eventsList.append( l );
+ QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
}
@@ -103,3 +110,2 @@ void DatebookPluginWidget::getDates() {
noMoreEvents->setText( QObject::tr( "No more appointments today" ) );
- layoutDates->addWidget( noMoreEvents );
}
@@ -108,3 +114,2 @@ void DatebookPluginWidget::getDates() {
noEvents->setText( QObject::tr( "No appointments today" ) );
- layoutDates->addWidget( noEvents );
}
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.h b/core/pim/today/plugins/datebook/datebookpluginwidget.h
index 3ebbc3d..8380bc7 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.h
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.h
@@ -21,2 +21,4 @@
#include <qwidget.h>
+#include <qlayout.h>
+#include <qlist.h>
@@ -25,2 +27,3 @@
+#include "datebookevent.h"
@@ -33,3 +36,3 @@ public:
~DatebookPluginWidget();
-
+ void refresh();
@@ -37,2 +40,4 @@ private:
DateBookDB* db;
+ QVBoxLayout* m_layoutDates;
+ QList<DateBookEvent> m_eventsList;
void readConfig();
@@ -40,2 +45,3 @@ private:
+
// how many lines should be showed in the datebook section
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
@@ -18,6 +18,5 @@
#include "mailplugin.h"
-#include "mailpluginwidget.h"
-
MailPlugin::MailPlugin() {
+ m_widget = 0l;
}
@@ -25,2 +24,3 @@ MailPlugin::MailPlugin() {
MailPlugin::~MailPlugin() {
+ delete m_widget;
}
@@ -40,5 +40,9 @@ QString MailPlugin::pixmapNameWidget() const {
QWidget* MailPlugin::widget( QWidget * wid ) {
- return new MailPluginWidget( wid, "Mail" );
+ if(!m_widget) {
+ m_widget = new MailPluginWidget( wid, "Datebook" );
+ }
+ return m_widget;
}
+
QString MailPlugin::pixmapNameConfig() const {
@@ -47,3 +51,3 @@ QString MailPlugin::pixmapNameConfig() const {
-TodayConfigWidget* MailPlugin::configWidget( QWidget* wid ) {
+TodayConfigWidget* MailPlugin::configWidget( QWidget* ) {
return 0l;
@@ -60 +64,6 @@ bool MailPlugin::excludeFromRefresh() const {
+void MailPlugin::refresh() {
+ if ( m_widget ) {
+ m_widget->refresh();
+ }
+}
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
@@ -29,2 +29,4 @@
+#include "mailpluginwidget.h"
+
class MailPlugin : public TodayPluginObject {
@@ -43,2 +45,6 @@ public:
bool excludeFromRefresh() const;
+ void refresh();
+
+ private:
+ MailPluginWidget *m_widget;
};
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
@@ -32,2 +32,18 @@ MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name)
+ m_mailLabel = 0l;
+ m_layout = 0l;
+
+ if ( m_mailLabel ) {
+ delete m_mailLabel;
+ }
+ m_mailLabel = new OClickableLabel( this );
+ m_mailLabel->setMaximumHeight( 15 );
+ connect( m_mailLabel, SIGNAL( clicked() ), this, SLOT( startMail() ) );
+
+ if ( m_layout ) {
+ delete m_layout;
+ }
+ m_layout = new QHBoxLayout( this );
+ m_layout->setAutoAdd( true );
+
readConfig();
@@ -37,2 +53,4 @@ MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name)
MailPluginWidget::~MailPluginWidget() {
+ delete m_mailLabel;
+ delete m_layout;
}
@@ -46,9 +64,7 @@ void MailPluginWidget::readConfig() {
-void MailPluginWidget::getInfo() {
-
- QHBoxLayout* layout = new QHBoxLayout( this );
+void MailPluginWidget::refresh() {
+ getInfo();
+}
- mailLabel = new OClickableLabel( this );
- mailLabel->setMaximumHeight( 15 );
- connect( mailLabel, SIGNAL( clicked() ), this, SLOT( startMail() ) );
+void MailPluginWidget::getInfo() {
@@ -60,6 +76,5 @@ void MailPluginWidget::getInfo() {
- QString output = QObject::tr( "<b>%1</b> new mail(s), <b>%2</b> outgoing" ).arg( NEW_MAILS ).arg( OUTGOING );
+ //QString output = QObject::tr( "<b>%1</b> new mail(s), <b>%2</b> outgoing" ).arg( NEW_MAILS ).arg( OUTGOING );
- mailLabel->setText( output );
- layout->addWidget( mailLabel );
+ m_mailLabel->setText( QObject::tr( "<b>%1</b> new mail(s), <b>%2</b> outgoing" ).arg( NEW_MAILS ).arg( OUTGOING ) );
}
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
@@ -22,2 +22,3 @@
#include <qwidget.h>
+#include <qlayout.h>
@@ -34,2 +35,4 @@ public:
~MailPluginWidget();
+
+ void refresh();
@@ -39,3 +42,4 @@ protected slots:
private:
- OClickableLabel *mailLabel;
+ OClickableLabel* m_mailLabel;
+ QHBoxLayout* m_layout;
void readConfig();
diff --git a/core/pim/today/plugins/todolist/todoplugin.cpp b/core/pim/today/plugins/todolist/todoplugin.cpp
index b5abbd3..1238f92 100644
--- a/core/pim/today/plugins/todolist/todoplugin.cpp
+++ b/core/pim/today/plugins/todolist/todoplugin.cpp
@@ -20,3 +20,2 @@
#include "todopluginconfig.h"
-#include "todopluginwidget.h"
@@ -24,2 +23,3 @@
TodolistPlugin::TodolistPlugin() {
+ m_widget = 0l;
}
@@ -27,2 +27,3 @@ TodolistPlugin::TodolistPlugin() {
TodolistPlugin::~TodolistPlugin() {
+ delete m_widget;
}
@@ -34,3 +35,3 @@ QString TodolistPlugin::pluginName() const {
double TodolistPlugin::versionNumber() const {
- return 0.8;
+ return 0.9;
}
@@ -42,3 +43,6 @@ QString TodolistPlugin::pixmapNameWidget() const {
QWidget* TodolistPlugin::widget( QWidget *wid ) {
- return new TodolistPluginWidget( wid, "Todolist" );
+ if(!m_widget) {
+ m_widget = new TodolistPluginWidget( wid, "Todolist" );
+ }
+ return m_widget;
}
@@ -61 +65,7 @@ bool TodolistPlugin::excludeFromRefresh() const {
}
+
+void TodolistPlugin::refresh() {
+ if ( m_widget ) {
+ m_widget->refresh();
+ }
+}
diff --git a/core/pim/today/plugins/todolist/todoplugin.h b/core/pim/today/plugins/todolist/todoplugin.h
index f98afdb..6106d0c 100644
--- a/core/pim/today/plugins/todolist/todoplugin.h
+++ b/core/pim/today/plugins/todolist/todoplugin.h
@@ -26,2 +26,4 @@
+#include "todopluginwidget.h"
+
class TodolistPlugin : public TodayPluginObject {
@@ -31,3 +33,3 @@ public:
~TodolistPlugin();
-
+
QString pluginName() const;
@@ -40,2 +42,6 @@ public:
bool excludeFromRefresh() const;
+ void refresh();
+
+ private:
+ TodolistPluginWidget *m_widget;
};
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.cpp b/core/pim/today/plugins/todolist/todopluginwidget.cpp
index 773e5cf..3242dac 100644
--- a/core/pim/today/plugins/todolist/todopluginwidget.cpp
+++ b/core/pim/today/plugins/todolist/todopluginwidget.cpp
@@ -32,4 +32,5 @@ TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name )
- todoLabel = 0l;
todo = 0l;
+ layoutTodo = 0l;
+ todoLabel = 0l;
@@ -38,3 +39,2 @@ TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name )
}
-
todo = new OTodoAccess();
@@ -42,2 +42,16 @@ TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name )
+ if ( layoutTodo ) {
+ delete layoutTodo;
+ }
+ layoutTodo = new QVBoxLayout( this );
+ layoutTodo->setAutoAdd( true );
+
+
+ if ( todoLabel ) {
+ delete todoLabel;
+ }
+ todoLabel = new OClickableLabel( this );
+
+ connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) );
+
readConfig();
@@ -48,2 +62,4 @@ TodolistPluginWidget::~TodolistPluginWidget() {
delete todo;
+ delete todoLabel;
+ delete layoutTodo;
}
@@ -58,2 +74,5 @@ void TodolistPluginWidget::readConfig() {
+void TodolistPluginWidget:: refresh() {
+ getTodo();
+}
@@ -64,10 +83,2 @@ void TodolistPluginWidget::getTodo() {
- QVBoxLayout* layoutTodo = new QVBoxLayout( this );
-
- if ( todoLabel ) {
- delete todoLabel;
- }
-
- todoLabel = new OClickableLabel( this );
- connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) );
@@ -88,3 +99,3 @@ void TodolistPluginWidget::getTodo() {
tmpout += "<font color=#e00000><b>-" + desc.mid( 0, m_maxCharClip ) + "</b></font><br>";
- ammount++;
+ ammount++ ;
}
@@ -120,3 +131,2 @@ void TodolistPluginWidget::getTodo() {
todoLabel->setText( output );
- layoutTodo->addWidget( todoLabel );
}
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.h b/core/pim/today/plugins/todolist/todopluginwidget.h
index 37b0ee1..0d0deb5 100644
--- a/core/pim/today/plugins/todolist/todopluginwidget.h
+++ b/core/pim/today/plugins/todolist/todopluginwidget.h
@@ -21,2 +21,3 @@
#include <qwidget.h>
+#include <qlayout.h>
@@ -35,2 +36,4 @@ public:
+ void refresh();
+
protected slots:
@@ -40,2 +43,3 @@ private:
OClickableLabel *todoLabel;
+ QVBoxLayout* layoutTodo;
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 91028c8..1f758f2 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -72,3 +72,4 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
m_refreshTimer->start( 15000 );
- refresh();
+ init();
+ loadPlugins();
showMaximized();
@@ -138,2 +139,17 @@ void Today::init() {
setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) );
+
+
+ // qDebug(" refresh ");
+ // set the date in top label
+ QDate date = QDate::currentDate();
+ QString time = ( tr( date.toString() ) );
+
+ DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) );
+
+ if ( layout ) {
+ delete layout;
+ }
+ layout = new QVBoxLayout( this );
+ layout->addWidget( Frame );
+ layout->addWidget( OwnerField );
}
@@ -268,2 +284,3 @@ void Today::loadPlugins() {
}
+ draw();
}
@@ -342,3 +359,3 @@ void Today::startConfig() {
}
- refresh();
+ loadPlugins();
} else {
@@ -357,18 +374,9 @@ void Today::refresh() {
- // qDebug(" refresh ");
- // set the date in top label
- QDate date = QDate::currentDate();
- QString time = ( tr( date.toString() ) );
-
- DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) );
-
- if ( layout ) {
- delete layout;
+ QValueList<TodayPlugin>::Iterator it;
+ for ( it = pluginList.begin(); it != pluginList.end(); ++it ) {
+ if ( !(*it).excludeRefresh ) {
+ (*it).guiPart->refresh();
+ qDebug( "refresh" );
+ }
}
- layout = new QVBoxLayout( this );
- layout->addWidget( Frame );
- layout->addWidget( OwnerField );
-
- loadPlugins();
- draw();
}