summaryrefslogtreecommitdiff
path: root/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
Unidiff
Diffstat (limited to 'core/pim/today/plugins/datebook/datebookpluginwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
index 0820802..eb6d47a 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
@@ -45,24 +45,25 @@ DatebookPluginWidget::~DatebookPluginWidget() {
45} 45}
46 46
47 47
48void DatebookPluginWidget::readConfig() { 48void DatebookPluginWidget::readConfig() {
49 Config cfg( "todaydatebookplugin" ); 49 Config cfg( "todaydatebookplugin" );
50 cfg.setGroup( "config" ); 50 cfg.setGroup( "config" );
51 m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); 51 m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 );
52 m_show_location = cfg.readNumEntry( "showlocation", 1 ); 52 m_show_location = cfg.readNumEntry( "showlocation", 1 );
53 m_show_notes = cfg.readNumEntry( "shownotes", 0 ); 53 m_show_notes = cfg.readNumEntry( "shownotes", 0 );
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 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
57} 58}
58 59
59void DatebookPluginWidget::reinitialize() { 60void DatebookPluginWidget::reinitialize() {
60 readConfig(); 61 readConfig();
61 refresh(); 62 refresh();
62} 63}
63 64
64void DatebookPluginWidget::refresh() { 65void DatebookPluginWidget::refresh() {
65 m_eventsList.clear(); 66 m_eventsList.clear();
66 67
67 if ( m_layoutDates ) { 68 if ( m_layoutDates ) {
68 delete m_layoutDates; 69 delete m_layoutDates;
@@ -87,25 +88,25 @@ void DatebookPluginWidget::getDates() {
87 QDate date = QDate::currentDate(); 88 QDate date = QDate::currentDate();
88 QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); 89 QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) );
89 qBubbleSort( list ); 90 qBubbleSort( list );
90 int count = 0; 91 int count = 0;
91 92
92 if ( list.count() > 0 ) { 93 if ( list.count() > 0 ) {
93 94
94 for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) { 95 for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) {
95 96
96 if ( count < m_max_lines_meet ) { 97 if ( count < m_max_lines_meet ) {
97 if ( !m_onlyLater ) { 98 if ( !m_onlyLater ) {
98 count++; 99 count++;
99 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine ); 100 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine, m_maxCharClip );
100 m_eventsList.append( l ); 101 m_eventsList.append( l );
101 l->show(); 102 l->show();
102 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&) ) );
103 } else { 104 } else {
104 if ( ( QDateTime::currentDateTime() <= (*it).event().end() ) 105 if ( ( QDateTime::currentDateTime() <= (*it).event().end() )
105 // Show events which span over many days and are not elapsed. 106 // Show events which span over many days and are not elapsed.
106 || ( ( (*it).event().start().date() != date ) && ( QDateTime::currentDateTime() <= (*it).event().end() ) ) 107 || ( ( (*it).event().start().date() != date ) && ( QDateTime::currentDateTime() <= (*it).event().end() ) )
107 // Show repeated event for today that is not elapsed. 108 // Show repeated event for today that is not elapsed.
108 || ( ( (*it).event().repeatType() != Event::NoRepeat ) 109 || ( ( (*it).event().repeatType() != Event::NoRepeat )
109 && ( ( date.dayOfWeek() == (*it).date().dayOfWeek() ) 110 && ( ( date.dayOfWeek() == (*it).date().dayOfWeek() )
110 && ( QTime::currentTime() < (*it).event().start().time() ) ) ) 111 && ( QTime::currentTime() < (*it).event().start().time() ) ) )
111 // Show repeated event for next days. 112 // Show repeated event for next days.