summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show 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.cpp45
-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.h6
-rw-r--r--core/pim/today/plugins/todolist/todopluginwidget.cpp32
-rw-r--r--core/pim/today/plugins/todolist/todopluginwidget.h4
-rw-r--r--core/pim/today/today.cpp42
15 files changed, 168 insertions, 70 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
@@ -5,6 +5,4 @@ TODO for today:
- autostart on retail rom (Z)
-* 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
@@ -2,4 +2,5 @@
* 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
@@ -20,12 +20,13 @@
#include "datebookevent.h"
#include "datebookplugin.h"
-#include "datebookpluginwidget.h"
#include "datebookpluginconfig.h"
DatebookPlugin::DatebookPlugin() {
+ m_widget = 0;
}
DatebookPlugin::~DatebookPlugin() {
+ delete m_widget;
}
@@ -43,5 +44,8 @@ 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;
}
@@ -61,2 +65,8 @@ bool DatebookPlugin::excludeFromRefresh() const {
return false;
}
+
+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
@@ -24,4 +24,6 @@
#include <opie/todayplugininterface.h>
+#include "datebookpluginwidget.h"
+
class DatebookPlugin : public TodayPluginObject {
@@ -38,4 +40,8 @@ public:
QString appName() const;
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
@@ -17,5 +17,4 @@
#include "datebookpluginwidget.h"
-#include "datebookevent.h"
#include <qpe/timestring.h>
@@ -31,5 +30,19 @@
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();
getDates();
@@ -38,4 +51,5 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name)
DatebookPluginWidget::~DatebookPluginWidget() {
delete db;
+ delete m_layoutDates;
}
@@ -51,4 +65,11 @@ void DatebookPluginWidget::readConfig() {
}
+void DatebookPluginWidget::refresh() {
+ DateBookEvent* ev;
+ for ( ev = m_eventsList.first(); ev != 0; ev = m_eventsList.next() ) {
+ delete ev;
+ }
+ getDates();
+}
/**
@@ -57,23 +78,9 @@ void DatebookPluginWidget::readConfig() {
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;
@@ -88,5 +95,5 @@ void DatebookPluginWidget::getDates() {
count++;
DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
- layoutDates->addWidget( l );
+ 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() ) ) ) {
@@ -94,5 +101,5 @@ void DatebookPluginWidget::getDates() {
// show only later appointments
DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
- layoutDates->addWidget( l );
+ m_eventsList.append( l );
QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) );
}
@@ -102,10 +109,8 @@ void DatebookPluginWidget::getDates() {
QLabel* noMoreEvents = new QLabel( this );
noMoreEvents->setText( QObject::tr( "No more appointments today" ) );
- layoutDates->addWidget( noMoreEvents );
}
} else {
QLabel* noEvents = new QLabel( this );
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
@@ -20,8 +20,11 @@
#include <qstring.h>
#include <qwidget.h>
+#include <qlayout.h>
+#include <qlist.h>
#include <qpe/datebookdb.h>
#include <opie/oclickablelabel.h>
+#include "datebookevent.h"
class DatebookPluginWidget : public QWidget {
@@ -32,11 +35,14 @@ public:
DatebookPluginWidget( QWidget *parent, const char *name );
~DatebookPluginWidget();
-
+ void refresh();
private:
DateBookDB* db;
+ QVBoxLayout* m_layoutDates;
+ QList<DateBookEvent> m_eventsList;
void readConfig();
void getDates();
+
// how many lines should be showed in the datebook section
int m_max_lines_meet;
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
@@ -17,11 +17,11 @@
#include "mailplugin.h"
-#include "mailpluginwidget.h"
-
MailPlugin::MailPlugin() {
+ m_widget = 0l;
}
MailPlugin::~MailPlugin() {
+ delete m_widget;
}
@@ -39,12 +39,16 @@ 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 {
return 0l;
}
-TodayConfigWidget* MailPlugin::configWidget( QWidget* wid ) {
+TodayConfigWidget* MailPlugin::configWidget( QWidget* ) {
return 0l;
}
@@ -59,2 +63,7 @@ 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
@@ -28,4 +28,6 @@
#include <opie/todayconfigwidget.h>
+#include "mailpluginwidget.h"
+
class MailPlugin : public TodayPluginObject {
@@ -42,4 +44,8 @@ public:
QString appName() const;
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
@@ -31,4 +31,20 @@ MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name)
: QWidget(parent, 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();
getInfo();
@@ -36,4 +52,6 @@ MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name)
MailPluginWidget::~MailPluginWidget() {
+ delete m_mailLabel;
+ delete m_layout;
}
@@ -45,11 +63,9 @@ 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() {
Config cfg( "opiemail" );
@@ -59,8 +75,7 @@ void MailPluginWidget::getInfo() {
int OUTGOING = cfg.readNumEntry( "outgoing", 0 );
- 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
@@ -21,4 +21,5 @@
#include <qstring.h>
#include <qwidget.h>
+#include <qlayout.h>
#include <opie/tododb.h>
@@ -34,9 +35,12 @@ public:
~MailPluginWidget();
+ void refresh();
+
protected slots:
void startMail();
private:
- OClickableLabel *mailLabel;
+ OClickableLabel* m_mailLabel;
+ QHBoxLayout* m_layout;
void readConfig();
void getInfo();
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
@@ -19,11 +19,12 @@
#include "todoplugin.h"
#include "todopluginconfig.h"
-#include "todopluginwidget.h"
TodolistPlugin::TodolistPlugin() {
+ m_widget = 0l;
}
TodolistPlugin::~TodolistPlugin() {
+ delete m_widget;
}
@@ -33,5 +34,5 @@ QString TodolistPlugin::pluginName() const {
double TodolistPlugin::versionNumber() const {
- return 0.8;
+ return 0.9;
}
@@ -41,5 +42,8 @@ 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;
}
@@ -60,2 +64,8 @@ bool TodolistPlugin::excludeFromRefresh() const {
return false;
}
+
+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
@@ -25,4 +25,6 @@
#include <opie/todayplugininterface.h>
+#include "todopluginwidget.h"
+
class TodolistPlugin : public TodayPluginObject {
@@ -39,4 +41,8 @@ public:
QString appName() const;
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
@@ -31,14 +31,28 @@ TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name )
: QWidget( parent, name ) {
- todoLabel = 0l;
todo = 0l;
+ layoutTodo = 0l;
+ todoLabel = 0l;
if ( todo ) {
delete todo;
}
-
todo = new OTodoAccess();
todo->load();
+ 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();
getTodo();
@@ -47,4 +61,6 @@ TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name )
TodolistPluginWidget::~TodolistPluginWidget() {
delete todo;
+ delete todoLabel;
+ delete layoutTodo;
}
@@ -57,4 +73,7 @@ void TodolistPluginWidget::readConfig() {
}
+void TodolistPluginWidget:: refresh() {
+ getTodo();
+}
/**
@@ -63,12 +82,4 @@ void TodolistPluginWidget::readConfig() {
void TodolistPluginWidget::getTodo() {
- QVBoxLayout* layoutTodo = new QVBoxLayout( this );
-
- if ( todoLabel ) {
- delete todoLabel;
- }
-
- todoLabel = new OClickableLabel( this );
- connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) );
QString output;
@@ -119,5 +130,4 @@ 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
@@ -20,4 +20,5 @@
#include <qstring.h>
#include <qwidget.h>
+#include <qlayout.h>
#include <opie/otodo.h>
@@ -34,4 +35,6 @@ public:
~TodolistPluginWidget();
+ void refresh();
+
protected slots:
void startTodolist();
@@ -39,4 +42,5 @@ protected slots:
private:
OClickableLabel *todoLabel;
+ QVBoxLayout* layoutTodo;
OTodoAccess *todo;
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
@@ -71,5 +71,6 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
m_refreshTimer->start( 15000 );
- refresh();
+ init();
+ loadPlugins();
showMaximized();
}
@@ -137,4 +138,19 @@ void Today::init() {
m_iconSize = cfg.readNumEntry( "IconSize", 18 );
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 );
}
@@ -267,4 +283,5 @@ void Today::loadPlugins() {
}
}
+ draw();
}
@@ -341,5 +358,5 @@ void Today::startConfig() {
confWidget->writeConfig();
}
- refresh();
+ loadPlugins();
} else {
// since refresh is not called in that case , reconnect the signal
@@ -356,20 +373,11 @@ void Today::refresh() {
init();
- // 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();
}