summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-02-10 23:42:49 (UTC)
committer harlekin <harlekin>2003-02-10 23:42:49 (UTC)
commit4abed72fea334ebfda6b146f70542dad522424b7 (patch) (unidiff)
treefc106623928f2fabc604d06f1c73b73ae9811512
parent871eadc731c0c05c553b8edc8c0e3198127057b6 (diff)
downloadopie-4abed72fea334ebfda6b146f70542dad522424b7.zip
opie-4abed72fea334ebfda6b146f70542dad522424b7.tar.gz
opie-4abed72fea334ebfda6b146f70542dad522424b7.tar.bz2
fix refresh
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.cpp12
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.h5
2 files changed, 9 insertions, 8 deletions
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
index 9a18408..3a7360d 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
@@ -38,7 +38,6 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name)
38 } 38 }
39 db = new DateBookDB; 39 db = new DateBookDB;
40 40
41
42 if ( m_layoutDates ) { 41 if ( m_layoutDates ) {
43 delete m_layoutDates; 42 delete m_layoutDates;
44 } 43 }
@@ -68,10 +67,6 @@ void DatebookPluginWidget::readConfig() {
68} 67}
69 68
70void DatebookPluginWidget::refresh() { 69void DatebookPluginWidget::refresh() {
71 DateBookEvent* ev;
72 for ( ev = m_eventsList.first(); ev != 0; ev = m_eventsList.next() ) {
73 delete ev;
74 }
75 m_eventsList.clear(); 70 m_eventsList.clear();
76 getDates(); 71 getDates();
77} 72}
@@ -86,7 +81,6 @@ void DatebookPluginWidget::getDates() {
86 qBubbleSort( list ); 81 qBubbleSort( list );
87 int count = 0; 82 int count = 0;
88 83
89 qDebug( QString("List count %1" ).arg(list.count() ) );
90 if ( list.count() > 0 ) { 84 if ( list.count() > 0 ) {
91 85
92 for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) { 86 for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) {
@@ -96,22 +90,28 @@ void DatebookPluginWidget::getDates() {
96 count++; 90 count++;
97 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); 91 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
98 m_eventsList.append( l ); 92 m_eventsList.append( l );
93 l->show();
99 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); 94 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
100 } else if ( QDateTime::currentDateTime() <= (*it).event().end() ) { 95 } else if ( QDateTime::currentDateTime() <= (*it).event().end() ) {
101 count++; 96 count++;
102 // show only later appointments 97 // show only later appointments
103 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); 98 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
104 m_eventsList.append( l ); 99 m_eventsList.append( l );
100 l->show();
105 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); 101 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
106 } 102 }
107 } 103 }
108 } 104 }
109 if ( m_onlyLater && count == 0 ) { 105 if ( m_onlyLater && count == 0 ) {
110 QLabel* noMoreEvents = new QLabel( this ); 106 QLabel* noMoreEvents = new QLabel( this );
107 m_eventsList.append( noMoreEvents );
108 noMoreEvents->show();
111 noMoreEvents->setText( QObject::tr( "No more appointments today" ) ); 109 noMoreEvents->setText( QObject::tr( "No more appointments today" ) );
112 } 110 }
113 } else { 111 } else {
114 QLabel* noEvents = new QLabel( this ); 112 QLabel* noEvents = new QLabel( this );
113 m_eventsList.append( noEvents );
114 noEvents->show();
115 noEvents->setText( QObject::tr( "No appointments today" ) ); 115 noEvents->setText( QObject::tr( "No appointments today" ) );
116 } 116 }
117} 117}
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.h b/core/pim/today/plugins/datebook/datebookpluginwidget.h
index 8380bc7..e10f059 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.h
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.h
@@ -20,6 +20,7 @@
20#include <qstring.h> 20#include <qstring.h>
21#include <qwidget.h> 21#include <qwidget.h>
22#include <qlayout.h> 22#include <qlayout.h>
23#include <qguardedptr.h>
23#include <qlist.h> 24#include <qlist.h>
24 25
25#include <qpe/datebookdb.h> 26#include <qpe/datebookdb.h>
@@ -38,8 +39,8 @@ public:
38 39
39private: 40private:
40 DateBookDB* db; 41 DateBookDB* db;
41 QVBoxLayout* m_layoutDates; 42 QGuardedPtr<QVBoxLayout> m_layoutDates;
42 QList<DateBookEvent> m_eventsList; 43 QList<QWidget> m_eventsList;
43 void readConfig(); 44 void readConfig();
44 void getDates(); 45 void getDates();
45 46