-rw-r--r-- | core/pim/today/today.cpp | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index eb8b50c..0f6e598 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -48,5 +48,5 @@ int SHOW_LOCATION; | |||
48 | int SHOW_NOTES; | 48 | int SHOW_NOTES; |
49 | // show only later dates | 49 | // show only later dates |
50 | int ONLY_LATER = 1; | 50 | int ONLY_LATER; |
51 | /* | 51 | /* |
52 | * Constructs a Example which is a child of 'parent', with the | 52 | * Constructs a Example which is a child of 'parent', with the |
@@ -76,5 +76,6 @@ void Today::draw() | |||
76 | getMail(); | 76 | getMail(); |
77 | getTodo(); | 77 | getTodo(); |
78 | QTimer::singleShot( 60*1000, this, SLOT(draw()) ); | 78 | // how often refresh |
79 | QTimer::singleShot( 30*1000, this, SLOT(draw()) ); | ||
79 | 80 | ||
80 | } | 81 | } |
@@ -96,4 +97,6 @@ void Today::init() | |||
96 | // if notes should be shown | 97 | // if notes should be shown |
97 | SHOW_NOTES = cfg.readNumEntry("shownotes",0); | 98 | SHOW_NOTES = cfg.readNumEntry("shownotes",0); |
99 | ONLY_LATER = cfg.readNumEntry("onlylater",1); | ||
100 | |||
98 | } | 101 | } |
99 | 102 | ||
@@ -120,5 +123,7 @@ void Today::startConfig() | |||
120 | // clip when? | 123 | // clip when? |
121 | conf->SpinBox7->setValue(MAX_CHAR_CLIP); | 124 | conf->SpinBox7->setValue(MAX_CHAR_CLIP); |
122 | 125 | // only later | |
126 | conf->CheckBox3->setChecked(ONLY_LATER); | ||
127 | |||
123 | conf->exec(); | 128 | conf->exec(); |
124 | 129 | ||
@@ -128,5 +133,6 @@ void Today::startConfig() | |||
128 | int notes = conf->CheckBox2->isChecked(); | 133 | int notes = conf->CheckBox2->isChecked(); |
129 | int maxcharclip = conf->SpinBox7->value(); | 134 | int maxcharclip = conf->SpinBox7->value(); |
130 | 135 | int onlylater = conf->CheckBox3->isChecked(); | |
136 | |||
131 | cfg.writeEntry("maxlinestask",maxlinestask); | 137 | cfg.writeEntry("maxlinestask",maxlinestask); |
132 | cfg.writeEntry("maxcharclip", maxcharclip); | 138 | cfg.writeEntry("maxcharclip", maxcharclip); |
@@ -134,4 +140,5 @@ void Today::startConfig() | |||
134 | cfg.writeEntry("showlocation",location); | 140 | cfg.writeEntry("showlocation",location); |
135 | cfg.writeEntry("shownotes", notes); | 141 | cfg.writeEntry("shownotes", notes); |
142 | cfg.writeEntry("onlylater", onlylater); | ||
136 | // sync it to "disk" | 143 | // sync it to "disk" |
137 | cfg.write(); | 144 | cfg.write(); |
@@ -170,5 +177,27 @@ void Today::getDates() | |||
170 | //cout << TimeString::dateString((*it).event().end()) << endl; | 177 | //cout << TimeString::dateString((*it).event().end()) << endl; |
171 | // still some bug in here, 1 h off | 178 | // still some bug in here, 1 h off |
172 | if ((time.toString() <= TimeString::dateString((*it).event().end())) && ONLY_LATER ) | 179 | |
180 | // decide if to get all day or only later appointments | ||
181 | if (!ONLY_LATER) | ||
182 | { | ||
183 | msg += "<B>" + (*it).description() + "</B>"; | ||
184 | // include location or not | ||
185 | if (SHOW_LOCATION == 1) | ||
186 | { | ||
187 | msg+= "<BR>" + (*it).location(); | ||
188 | } | ||
189 | msg += "<BR>" | ||
190 | // start time of event | ||
191 | + TimeString::timeString(QTime((*it).event().start().time()) ) | ||
192 | // end time of event | ||
193 | + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ) | ||
194 | + "<BR>"; | ||
195 | // include possible note or not | ||
196 | if (SHOW_NOTES == 1) | ||
197 | { | ||
198 | msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; | ||
199 | } | ||
200 | } | ||
201 | else if ((time.toString() <= TimeString::dateString((*it).event().end())) && ONLY_LATER ) | ||
173 | { | 202 | { |
174 | msg += "<B>" + (*it).description() + "</B>"; | 203 | msg += "<B>" + (*it).description() + "</B>"; |
@@ -191,4 +220,9 @@ void Today::getDates() | |||
191 | } | 220 | } |
192 | } | 221 | } |
222 | |||
223 | if (msg.isEmpty()) | ||
224 | { | ||
225 | msg = "No more appointments today"; | ||
226 | } | ||
193 | } | 227 | } |
194 | DatesField->setText(msg); | 228 | DatesField->setText(msg); |