summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-03-23 15:25:36 (UTC)
committer harlekin <harlekin>2003-03-23 15:25:36 (UTC)
commit9c539b9626f0a3ffca47e9b1247cb727539b46c6 (patch) (unidiff)
treea094b7ea93a645a2af08e44627737b0433f59fce
parent34d831699c7a7be4bd81cd7d7336b66b53ef78d9 (diff)
downloadopie-9c539b9626f0a3ffca47e9b1247cb727539b46c6.zip
opie-9c539b9626f0a3ffca47e9b1247cb727539b46c6.tar.gz
opie-9c539b9626f0a3ffca47e9b1247cb727539b46c6.tar.bz2
count right number of max showing events
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
index 781e3a4..1970654 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
@@ -46,80 +46,80 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name )
46 readConfig(); 46 readConfig();
47 getDates(); 47 getDates();
48 m_layoutDates->addStretch(5); 48 m_layoutDates->addStretch(5);
49} 49}
50 50
51DatebookPluginWidget::~DatebookPluginWidget() { 51DatebookPluginWidget::~DatebookPluginWidget() {
52 delete db; 52 delete db;
53 delete m_layoutDates; 53 delete m_layoutDates;
54} 54}
55 55
56 56
57void DatebookPluginWidget::readConfig() { 57void DatebookPluginWidget::readConfig() {
58 Config cfg( "todaydatebookplugin" ); 58 Config cfg( "todaydatebookplugin" );
59 cfg.setGroup( "config" ); 59 cfg.setGroup( "config" );
60 m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); 60 m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 );
61 m_show_location = cfg.readNumEntry( "showlocation", 1 ); 61 m_show_location = cfg.readNumEntry( "showlocation", 1 );
62 m_show_notes = cfg.readNumEntry( "shownotes", 0 ); 62 m_show_notes = cfg.readNumEntry( "shownotes", 0 );
63 m_onlyLater = cfg.readNumEntry( "onlylater", 1 ); 63 m_onlyLater = cfg.readNumEntry( "onlylater", 1 );
64 m_moreDays = cfg.readNumEntry( "moredays", 0 ); 64 m_moreDays = cfg.readNumEntry( "moredays", 0 );
65} 65}
66 66
67void DatebookPluginWidget::refresh() { 67void DatebookPluginWidget::refresh() {
68 m_eventsList.clear(); 68 m_eventsList.clear();
69 69
70 if ( m_layoutDates ) { 70 if ( m_layoutDates ) {
71 delete m_layoutDates; 71 delete m_layoutDates;
72 } 72 }
73 m_layoutDates = new QVBoxLayout( this ); 73 m_layoutDates = new QVBoxLayout( this );
74 m_layoutDates->setAutoAdd( true ); 74 m_layoutDates->setAutoAdd( true );
75 75
76 getDates(); 76 getDates();
77 m_layoutDates->addStretch(5); 77 m_layoutDates->addStretch(5);
78} 78}
79 79
80/** 80/**
81 * Get all events that are in the datebook xml file for today 81 * Get all events that are in the datebook xml file for today
82 */ 82 */
83void DatebookPluginWidget::getDates() { 83void DatebookPluginWidget::getDates() {
84 84
85 QDate date = QDate::currentDate(); 85 QDate date = QDate::currentDate();
86 QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); 86 QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) );
87 qBubbleSort( list ); 87 qBubbleSort( list );
88 int count = 0; 88 int count = 0;
89 89
90 if ( list.count() > 0 ) { 90 if ( list.count() > 0 ) {
91 91
92 for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) { 92 for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) {
93 93
94 if ( count <= m_max_lines_meet ) { 94 if ( count < m_max_lines_meet ) {
95 if ( !m_onlyLater ) { 95 if ( !m_onlyLater ) {
96 count++; 96 count++;
97 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); 97 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
98 m_eventsList.append( l ); 98 m_eventsList.append( l );
99 l->show(); 99 l->show();
100 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); 100 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
101 } else if ( QDateTime::currentDateTime() <= (*it).event().end() || (*it).event().start().date() != date ) { 101 } else if ( QDateTime::currentDateTime() <= (*it).event().end() || (*it).event().start().date() != date ) {
102 count++; 102 count++;
103 // show only later appointments 103 // show only later appointments
104 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); 104 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
105 m_eventsList.append( l ); 105 m_eventsList.append( l );
106 l->show(); 106 l->show();
107 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); 107 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
108 } 108 }
109 } 109 }
110 } 110 }
111 if ( m_onlyLater && count == 0 ) { 111 if ( m_onlyLater && count == 0 ) {
112 QLabel* noMoreEvents = new QLabel( this ); 112 QLabel* noMoreEvents = new QLabel( this );
113 m_eventsList.append( noMoreEvents ); 113 m_eventsList.append( noMoreEvents );
114 noMoreEvents->show(); 114 noMoreEvents->show();
115 noMoreEvents->setText( QObject::tr( "No more appointments today" ) ); 115 noMoreEvents->setText( QObject::tr( "No more appointments today" ) );
116 } 116 }
117 } else { 117 } else {
118 QLabel* noEvents = new QLabel( this ); 118 QLabel* noEvents = new QLabel( this );
119 m_eventsList.append( noEvents ); 119 m_eventsList.append( noEvents );
120 noEvents->show(); 120 noEvents->show();
121 noEvents->setText( QObject::tr( "No appointments today" ) ); 121 noEvents->setText( QObject::tr( "No appointments today" ) );
122 } 122 }
123} 123}
124 124
125 125