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 | 3 |
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 a8ce059..c6aa2a6 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp | |||
@@ -26,70 +26,71 @@ | |||
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qtl.h> | 27 | #include <qtl.h> |
28 | #include <qscrollview.h> | 28 | #include <qscrollview.h> |
29 | #include <qtimer.h> | 29 | #include <qtimer.h> |
30 | 30 | ||
31 | DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name) | 31 | DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name) |
32 | : QWidget(parent, name ) { | 32 | : QWidget(parent, name ) { |
33 | db = 0l; | 33 | db = 0l; |
34 | readConfig(); | 34 | readConfig(); |
35 | getDates(); | 35 | getDates(); |
36 | } | 36 | } |
37 | 37 | ||
38 | DatebookPluginWidget::~DatebookPluginWidget() { | 38 | DatebookPluginWidget::~DatebookPluginWidget() { |
39 | delete db; | 39 | delete db; |
40 | } | 40 | } |
41 | 41 | ||
42 | 42 | ||
43 | void DatebookPluginWidget::readConfig() { | 43 | void DatebookPluginWidget::readConfig() { |
44 | Config cfg( "todaydatebookplugin" ); | 44 | Config cfg( "todaydatebookplugin" ); |
45 | cfg.setGroup( "config" ); | 45 | cfg.setGroup( "config" ); |
46 | m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); | 46 | m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); |
47 | m_show_location = cfg.readNumEntry( "showlocation", 1 ); | 47 | m_show_location = cfg.readNumEntry( "showlocation", 1 ); |
48 | m_show_notes = cfg.readNumEntry( "shownotes", 0 ); | 48 | m_show_notes = cfg.readNumEntry( "shownotes", 0 ); |
49 | m_onlyLater = cfg.readNumEntry( "onlylater", 1 ); | 49 | m_onlyLater = cfg.readNumEntry( "onlylater", 1 ); |
50 | m_moreDays = cfg.readNumEntry( "moredays", 0 ); | ||
50 | } | 51 | } |
51 | 52 | ||
52 | 53 | ||
53 | /** | 54 | /** |
54 | * Get all events that are in the datebook xml file for today | 55 | * Get all events that are in the datebook xml file for today |
55 | */ | 56 | */ |
56 | void DatebookPluginWidget::getDates() { | 57 | void DatebookPluginWidget::getDates() { |
57 | 58 | ||
58 | 59 | ||
59 | QDate date = QDate::currentDate(); | 60 | QDate date = QDate::currentDate(); |
60 | 61 | ||
61 | QVBoxLayout* layoutDates = new QVBoxLayout( this ); | 62 | QVBoxLayout* layoutDates = new QVBoxLayout( this ); |
62 | layoutDates->setSpacing( 1 ); | 63 | layoutDates->setSpacing( 1 ); |
63 | layoutDates->setMargin( 1 ); | 64 | layoutDates->setMargin( 1 ); |
64 | 65 | ||
65 | if ( db ) { | 66 | if ( db ) { |
66 | delete db; | 67 | delete db; |
67 | } | 68 | } |
68 | 69 | ||
69 | db = new DateBookDB; | 70 | db = new DateBookDB; |
70 | 71 | ||
71 | QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date ); | 72 | QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); |
72 | 73 | ||
73 | qBubbleSort( list ); | 74 | qBubbleSort( list ); |
74 | 75 | ||
75 | Config config( "qpe" ); | 76 | Config config( "qpe" ); |
76 | 77 | ||
77 | int count=0; | 78 | int count=0; |
78 | 79 | ||
79 | if ( list.count() > 0 ) { | 80 | if ( list.count() > 0 ) { |
80 | 81 | ||
81 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); it!=list.end(); ++it ) { | 82 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); it!=list.end(); ++it ) { |
82 | 83 | ||
83 | if ( count <= m_max_lines_meet ) { | 84 | if ( count <= m_max_lines_meet ) { |
84 | QTime time = QTime::currentTime(); | 85 | QTime time = QTime::currentTime(); |
85 | 86 | ||
86 | if ( !m_onlyLater ) { | 87 | if ( !m_onlyLater ) { |
87 | count++; | 88 | count++; |
88 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); | 89 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); |
89 | layoutDates->addWidget( l ); | 90 | layoutDates->addWidget( l ); |
90 | QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) ); | 91 | QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) ); |
91 | } else if ( ( time.toString() <= TimeString::dateString( (*it).event().end() ) ) ) { | 92 | } else if ( ( time.toString() <= TimeString::dateString( (*it).event().end() ) ) ) { |
92 | count++; | 93 | count++; |
93 | // show only later appointments | 94 | // show only later appointments |
94 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); | 95 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); |
95 | layoutDates->addWidget( l ); | 96 | layoutDates->addWidget( l ); |