summaryrefslogtreecommitdiff
Unidiff
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 eb6d47a..781cfcf 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
@@ -55,87 +55,87 @@ void DatebookPluginWidget::readConfig() {
55 m_moreDays = cfg.readNumEntry( "moredays", 0 ); 55 m_moreDays = cfg.readNumEntry( "moredays", 0 );
56 m_timeExtraLine = cfg.readNumEntry( "timeextraline", 1 ); 56 m_timeExtraLine = cfg.readNumEntry( "timeextraline", 1 );
57 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); 57 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
58} 58}
59 59
60void DatebookPluginWidget::reinitialize() { 60void DatebookPluginWidget::reinitialize() {
61 readConfig(); 61 readConfig();
62 refresh(); 62 refresh();
63} 63}
64 64
65void DatebookPluginWidget::refresh() { 65void DatebookPluginWidget::refresh() {
66 m_eventsList.clear(); 66 m_eventsList.clear();
67 67
68 if ( m_layoutDates ) { 68 if ( m_layoutDates ) {
69 delete m_layoutDates; 69 delete m_layoutDates;
70 } 70 }
71 m_layoutDates = new QVBoxLayout( this ); 71 m_layoutDates = new QVBoxLayout( this );
72 m_layoutDates->setAutoAdd( true ); 72 m_layoutDates->setAutoAdd( true );
73 73
74 getDates(); 74 getDates();
75} 75}
76 76
77/** 77/**
78 * Get all events that are in the datebook xml file for today 78 * Get all events that are in the datebook xml file for today
79 */ 79 */
80void DatebookPluginWidget::getDates() { 80void DatebookPluginWidget::getDates() {
81 81
82 82
83 if ( db ) { 83 if ( db ) {
84 delete db; 84 delete db;
85 } 85 }
86 db = new DateBookDB; 86 db = new DateBookDB;
87 87
88 QDate date = QDate::currentDate(); 88 QDate date = QDate::currentDate();
89 QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); 89 QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) );
90 qBubbleSort( list ); 90 qBubbleSort( list );
91 int count = 0; 91 int count = 0;
92 92
93 if ( list.count() > 0 ) { 93 if ( list.count() > 0 ) {
94 94
95 for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) { 95 for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) {
96 96
97 if ( count < m_max_lines_meet ) { 97 if ( count < m_max_lines_meet ) {
98 if ( !m_onlyLater ) { 98 if ( !m_onlyLater ) {
99 count++; 99 count++;
100 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine, m_maxCharClip ); 100 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine, m_maxCharClip );
101 m_eventsList.append( l ); 101 m_eventsList.append( l );
102 l->show(); 102 l->show();
103 QObject::connect ( l, SIGNAL( editEvent(const Event&) ), l, SLOT( editEventSlot(const Event&) ) ); 103 QObject::connect ( l, SIGNAL( editEvent(const Event&) ), l, SLOT( editEventSlot(const Event&) ) );
104 } else { 104 } else {
105 if ( ( QDateTime::currentDateTime() <= (*it).event().end() ) 105 if ( ( QDateTime::currentDateTime() <= (*it).event().end() )
106 // Show events which span over many days and are not elapsed. 106 // Show events which span over many days and are not elapsed.
107 || ( ( (*it).event().start().date() != date ) && ( QDateTime::currentDateTime() <= (*it).event().end() ) ) 107 || ( ( (*it).event().start().date() != date ) && ( QDateTime::currentDateTime() <= (*it).event().end() ) )
108 // Show repeated event for today that is not elapsed. 108 // Show repeated event for today that is not elapsed.
109 || ( ( (*it).event().repeatType() != Event::NoRepeat ) 109 || ( ( (*it).event().repeatType() != Event::NoRepeat )
110 && ( ( date.dayOfWeek() == (*it).date().dayOfWeek() ) 110 && ( ( date.dayOfWeek() == (*it).date().dayOfWeek() )
111 && ( QTime::currentTime() < (*it).event().start().time() ) ) ) 111 && ( QTime::currentTime() < (*it).event().start().time() ) ) )
112 // Show repeated event for next days. 112 // Show repeated event for next days.
113 || ( ( (*it).event().repeatType() != Event::NoRepeat ) 113 || ( ( (*it).event().repeatType() != Event::NoRepeat )
114 && ( date.dayOfWeek() != (*it).date().dayOfWeek() ) ) 114 && ( date.dayOfWeek() != (*it).date().dayOfWeek() ) )
115 ) 115 )
116 { 116 {
117 count++; 117 count++;
118 // show only later appointments 118 // show only later appointments
119 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine ); 119 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine, m_maxCharClip );
120 m_eventsList.append( l ); 120 m_eventsList.append( l );
121 l->show(); 121 l->show();
122 QObject::connect ( l, SIGNAL( editEvent(const Event&) ), l, SLOT( editEventSlot(const Event&) ) ); 122 QObject::connect ( l, SIGNAL( editEvent(const Event&) ), l, SLOT( editEventSlot(const Event&) ) );
123 } 123 }
124 } 124 }
125 } 125 }
126 } 126 }
127 if ( m_onlyLater && count == 0 ) { 127 if ( m_onlyLater && count == 0 ) {
128 QLabel* noMoreEvents = new QLabel( this ); 128 QLabel* noMoreEvents = new QLabel( this );
129 m_eventsList.append( noMoreEvents ); 129 m_eventsList.append( noMoreEvents );
130 noMoreEvents->show(); 130 noMoreEvents->show();
131 noMoreEvents->setText( QObject::tr( "No more appointments today" ) ); 131 noMoreEvents->setText( QObject::tr( "No more appointments today" ) );
132 } 132 }
133 } else { 133 } else {
134 QLabel* noEvents = new QLabel( this ); 134 QLabel* noEvents = new QLabel( this );
135 m_eventsList.append( noEvents ); 135 m_eventsList.append( noEvents );
136 noEvents->show(); 136 noEvents->show();
137 noEvents->setText( QObject::tr( "No appointments today" ) ); 137 noEvents->setText( QObject::tr( "No appointments today" ) );
138 } 138 }
139} 139}
140 140
141 141