author | harlekin <harlekin> | 2002-11-27 14:19:09 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-11-27 14:19:09 (UTC) |
commit | 5f0c90d4b6972c1ad22ba20b45cd1d3f88298099 (patch) (unidiff) | |
tree | 0cd24ab2ff259a76e06d7940b9de03a2b067d57a /core | |
parent | a75b95fd9f89fc80e867c0efb5837178cab56cbb (diff) | |
download | opie-5f0c90d4b6972c1ad22ba20b45cd1d3f88298099.zip opie-5f0c90d4b6972c1ad22ba20b45cd1d3f88298099.tar.gz opie-5f0c90d4b6972c1ad22ba20b45cd1d3f88298099.tar.bz2 |
ability to show next days too added
6 files changed, 57 insertions, 18 deletions
diff --git a/core/pim/today/plugins/datebook/datebookevent.cpp b/core/pim/today/plugins/datebook/datebookevent.cpp index 0a0d186..8277529 100644 --- a/core/pim/today/plugins/datebook/datebookevent.cpp +++ b/core/pim/today/plugins/datebook/datebookevent.cpp | |||
@@ -56,11 +56,14 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | |||
56 | && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59" ) ) { | 56 | && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59" ) ) { |
57 | msg += "<br>All day"; | 57 | msg += "<br>All day"; |
58 | } else { | 58 | } else { |
59 | // start time of event | 59 | // start time of event |
60 | msg += "<br>" + ampmTime(QTime( (ev).event().start().time() ) ) | 60 | QDate tempDate = (ev).event().start().date(); |
61 | msg += "<br>" | ||
62 | + ampmTime( QTime( (ev).event().start().time() ) ) | ||
61 | // end time of event | 63 | // end time of event |
62 | + "<b> - </b>" + ampmTime(QTime( (ev).event().end().time() ) ); | 64 | + "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) ) |
65 | + differDate( tempDate ); | ||
63 | } | 66 | } |
64 | 67 | ||
65 | // include possible note or not | 68 | // include possible note or not |
66 | if ( show_notes ) { | 69 | if ( show_notes ) { |
@@ -94,8 +97,25 @@ QString DateBookEvent::ampmTime( QTime tm ) { | |||
94 | return s; | 97 | return s; |
95 | } | 98 | } |
96 | } | 99 | } |
97 | 100 | ||
101 | QString DateBookEvent::differDate( QDate date ) { | ||
102 | QDate currentDate = QDate::currentDate(); | ||
103 | QString returnText = "<font color = #407DD9><b> "; | ||
104 | int differDate = currentDate.daysTo( date ); | ||
105 | if ( currentDate.dayOfWeek() == date.dayOfWeek() ) { | ||
106 | returnText += "" ; | ||
107 | // not working right for recurring events | ||
108 | //} else if ( differDate == 1 ) { | ||
109 | //returnText += tr( "tomorrow" ); | ||
110 | } else { | ||
111 | //returnText += tr( "in %1 days" ).arg( differDate ); | ||
112 | returnText += " [ " + date.dayName( date.dayOfWeek() ) + " ] "; | ||
113 | } | ||
114 | returnText += "</b></font>"; | ||
115 | return returnText; | ||
116 | } | ||
117 | |||
98 | 118 | ||
99 | /** | 119 | /** |
100 | * starts the edit dialog as known from datebook | 120 | * starts the edit dialog as known from datebook |
101 | */ | 121 | */ |
diff --git a/core/pim/today/plugins/datebook/datebookevent.h b/core/pim/today/plugins/datebook/datebookevent.h index 7b0371a..f8a9c03 100644 --- a/core/pim/today/plugins/datebook/datebookevent.h +++ b/core/pim/today/plugins/datebook/datebookevent.h | |||
@@ -25,23 +25,24 @@ class DateBookEvent: public OClickableLabel { | |||
25 | 25 | ||
26 | Q_OBJECT | 26 | Q_OBJECT |
27 | 27 | ||
28 | public: | 28 | public: |
29 | DateBookEvent(const EffectiveEvent &ev, | 29 | DateBookEvent( const EffectiveEvent &ev, |
30 | QWidget* parent = 0, | 30 | QWidget* parent = 0, |
31 | bool show_location = 0, | 31 | bool show_location = 0, |
32 | bool show_notes = 0, | 32 | bool show_notes = 0, |
33 | int maxCharClip = 0, | 33 | int maxCharClip = 0, |
34 | const char* name = 0, | 34 | const char* name = 0, |
35 | WFlags fl = 0); | 35 | WFlags fl = 0 ); |
36 | signals: | 36 | signals: |
37 | void editEvent(const Event &e); | 37 | void editEvent( const Event &e ); |
38 | private slots: | 38 | private slots: |
39 | void editEventSlot(const Event &e); | 39 | void editEventSlot( const Event &e ); |
40 | void editMe(); | 40 | void editMe(); |
41 | private: | 41 | private: |
42 | DateBookDB *db; | 42 | DateBookDB *db; |
43 | QString ampmTime(QTime); | 43 | QString ampmTime( QTime ); |
44 | QString differDate( QDate date ); | ||
44 | const EffectiveEvent event; | 45 | const EffectiveEvent event; |
45 | bool ampm; | 46 | bool ampm; |
46 | }; | 47 | }; |
47 | 48 | ||
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp index e93c82c..0fc38de 100644 --- a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp | |||
@@ -34,8 +34,10 @@ DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name) | |||
34 | TextLabel6->setText( tr( "Show only later\n appointments") ); | 34 | TextLabel6->setText( tr( "Show only later\n appointments") ); |
35 | CheckBox3 = new QCheckBox ( box3, "CheckBox3" ); | 35 | CheckBox3 = new QCheckBox ( box3, "CheckBox3" ); |
36 | QWhatsThis::add( CheckBox3 , tr( "Check this if only appointments later then current time should be shown" ) ); | 36 | QWhatsThis::add( CheckBox3 , tr( "Check this if only appointments later then current time should be shown" ) ); |
37 | 37 | ||
38 | |||
39 | |||
38 | QHBox *box4 = new QHBox( this ); | 40 | QHBox *box4 = new QHBox( this ); |
39 | QLabel *TextLabel3 = new QLabel( box4, "TextLabel3" ); | 41 | QLabel *TextLabel3 = new QLabel( box4, "TextLabel3" ); |
40 | TextLabel3->setText( tr( "How many \nappointment\n" | 42 | TextLabel3->setText( tr( "How many \nappointment\n" |
41 | "should be \nshown?" ) ); | 43 | "should be \nshown?" ) ); |
@@ -43,12 +45,23 @@ DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name) | |||
43 | QWhatsThis::add( SpinBox1 , tr( "How many appointments should be shown maximal. In chronical order" ) ); | 45 | QWhatsThis::add( SpinBox1 , tr( "How many appointments should be shown maximal. In chronical order" ) ); |
44 | SpinBox1->setMaxValue( 10 ); | 46 | SpinBox1->setMaxValue( 10 ); |
45 | SpinBox1->setValue( 5 ); | 47 | SpinBox1->setValue( 5 ); |
46 | 48 | ||
49 | |||
50 | QHBox *box5 = new QHBox( this ); | ||
51 | QLabel *TextLabelDays = new QLabel( box5 ); | ||
52 | TextLabelDays->setText( tr( "How many more days" ) ); | ||
53 | SpinBox2 = new QSpinBox( box5, "SpinBox2" ); | ||
54 | QWhatsThis::add( SpinBox2 , tr( "How many more days should be in the range" ) ); | ||
55 | SpinBox2->setMaxValue( 7 ); | ||
56 | SpinBox2->setSuffix( tr( " day(s)" ) ); | ||
57 | SpinBox2->setSpecialValueText ( tr("only today") ); | ||
58 | |||
47 | layout->addWidget( box1 ); | 59 | layout->addWidget( box1 ); |
48 | layout->addWidget( box2 ); | 60 | layout->addWidget( box2 ); |
49 | layout->addWidget( box3 ); | 61 | layout->addWidget( box3 ); |
50 | layout->addWidget( box4 ); | 62 | layout->addWidget( box4 ); |
63 | layout->addWidget( box5 ); | ||
51 | 64 | ||
52 | readConfig(); | 65 | readConfig(); |
53 | } | 66 | } |
54 | 67 | ||
@@ -63,8 +76,10 @@ void DatebookPluginConfig::readConfig() { | |||
63 | m_show_notes = cfg.readNumEntry( "shownotes", 0 ); | 76 | m_show_notes = cfg.readNumEntry( "shownotes", 0 ); |
64 | CheckBox2->setChecked( m_show_notes ); | 77 | CheckBox2->setChecked( m_show_notes ); |
65 | m_only_later = cfg.readNumEntry( "onlylater", 1 ); | 78 | m_only_later = cfg.readNumEntry( "onlylater", 1 ); |
66 | CheckBox3->setChecked( m_only_later ); | 79 | CheckBox3->setChecked( m_only_later ); |
80 | m_more_days = cfg.readNumEntry( "moredays", 0 ); | ||
81 | SpinBox2->setValue( m_more_days ); | ||
67 | } | 82 | } |
68 | 83 | ||
69 | 84 | ||
70 | void DatebookPluginConfig::writeConfig() { | 85 | void DatebookPluginConfig::writeConfig() { |
@@ -76,10 +91,12 @@ void DatebookPluginConfig::writeConfig() { | |||
76 | m_show_location = CheckBox1->isChecked(); | 91 | m_show_location = CheckBox1->isChecked(); |
77 | cfg.writeEntry( "showlocation", m_show_location); | 92 | cfg.writeEntry( "showlocation", m_show_location); |
78 | m_show_notes = CheckBox2->isChecked(); | 93 | m_show_notes = CheckBox2->isChecked(); |
79 | cfg.writeEntry( "shownotes", m_show_notes ); | 94 | cfg.writeEntry( "shownotes", m_show_notes ); |
80 | m_only_later = CheckBox3->isChecked(); | 95 | m_only_later = CheckBox3->isChecked(); |
81 | cfg.writeEntry( "onlylater", m_only_later ); | 96 | cfg.writeEntry( "onlylater", m_only_later ); |
97 | m_more_days = SpinBox2->value(); | ||
98 | cfg.writeEntry( "moredays", m_more_days ); | ||
82 | cfg.write(); | 99 | cfg.write(); |
83 | } | 100 | } |
84 | 101 | ||
85 | DatebookPluginConfig::~DatebookPluginConfig() { | 102 | DatebookPluginConfig::~DatebookPluginConfig() { |
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.h b/core/pim/today/plugins/datebook/datebookpluginconfig.h index feba9ee..6c32ae9 100644 --- a/core/pim/today/plugins/datebook/datebookpluginconfig.h +++ b/core/pim/today/plugins/datebook/datebookpluginconfig.h | |||
@@ -27,8 +27,10 @@ private: | |||
27 | QCheckBox* CheckBox2; | 27 | QCheckBox* CheckBox2; |
28 | QCheckBox* CheckBox1; | 28 | QCheckBox* CheckBox1; |
29 | QCheckBox* CheckBox3; | 29 | QCheckBox* CheckBox3; |
30 | QSpinBox* SpinBox1; | 30 | QSpinBox* SpinBox1; |
31 | QSpinBox* SpinBox2; | ||
32 | |||
31 | 33 | ||
32 | // how many lines should be showed in the datebook section | 34 | // how many lines should be showed in the datebook section |
33 | int m_max_lines_meet; | 35 | int m_max_lines_meet; |
34 | // If location is to be showed too, 1 to activate it. | 36 | // If location is to be showed too, 1 to activate it. |
@@ -36,13 +38,10 @@ private: | |||
36 | // if notes should be shown | 38 | // if notes should be shown |
37 | int m_show_notes; | 39 | int m_show_notes; |
38 | // should only later appointments be shown or all for the current day. | 40 | // should only later appointments be shown or all for the current day. |
39 | int m_only_later; | 41 | int m_only_later; |
40 | 42 | int m_more_days; | |
41 | 43 | ||
42 | }; | 44 | }; |
43 | 45 | ||
44 | 46 | ||
45 | |||
46 | |||
47 | |||
48 | #endif | 47 | #endif |
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 | |||
@@ -46,8 +46,9 @@ void DatebookPluginWidget::readConfig() { | |||
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 | /** |
@@ -67,9 +68,9 @@ void DatebookPluginWidget::getDates() { | |||
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" ); |
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.h b/core/pim/today/plugins/datebook/datebookpluginwidget.h index 1720bb2..3ebbc3d 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.h +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.h | |||
@@ -45,8 +45,9 @@ private: | |||
45 | // if notes should be shown | 45 | // if notes should be shown |
46 | bool m_show_notes; | 46 | bool m_show_notes; |
47 | // should only later appointments be shown or all for the current day. | 47 | // should only later appointments be shown or all for the current day. |
48 | bool m_onlyLater; | 48 | bool m_onlyLater; |
49 | int m_moreDays; | ||
49 | 50 | ||
50 | }; | 51 | }; |
51 | 52 | ||
52 | #endif | 53 | #endif |