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