author | harlekin <harlekin> | 2002-02-17 18:34:25 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-02-17 18:34:25 (UTC) |
commit | 687d0c760684392c89f4e99fbf803c8f4d67b2b1 (patch) (unidiff) | |
tree | bb0a80e71a3272ab222a36836cc24c9fc9471f46 /core/pim/today/today.cpp | |
parent | f47194f17380a4af76d185036eff2dc4d1a44bed (diff) | |
download | opie-687d0c760684392c89f4e99fbf803c8f4d67b2b1.zip opie-687d0c760684392c89f4e99fbf803c8f4d67b2b1.tar.gz opie-687d0c760684392c89f4e99fbf803c8f4d67b2b1.tar.bz2 |
new config option to decide if to show all appointments, also fixes the empty calendar part -bug-
-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 | |||
@@ -44,13 +44,13 @@ | |||
44 | int MAX_LINES_TASK; | 44 | int MAX_LINES_TASK; |
45 | int MAX_CHAR_CLIP; | 45 | int MAX_CHAR_CLIP; |
46 | int MAX_LINES_MEET; | 46 | int MAX_LINES_MEET; |
47 | int SHOW_LOCATION; | 47 | 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 |
53 | * name 'name' and widget flags set to 'f' | 53 | * name 'name' and widget flags set to 'f' |
54 | */ | 54 | */ |
55 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 55 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
56 | : TodayBase( parent, name, fl ) | 56 | : TodayBase( parent, name, fl ) |
@@ -72,13 +72,14 @@ Today::Today( QWidget* parent, const char* name, WFlags fl ) | |||
72 | void Today::draw() | 72 | void Today::draw() |
73 | { | 73 | { |
74 | init(); | 74 | init(); |
75 | getDates(); | 75 | getDates(); |
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 | } |
81 | 82 | ||
82 | void Today::init() | 83 | void Today::init() |
83 | { | 84 | { |
84 | // read config | 85 | // read config |
@@ -92,12 +93,14 @@ void Today::init() | |||
92 | // how many lines should be showed in the datebook section | 93 | // how many lines should be showed in the datebook section |
93 | MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); | 94 | MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); |
94 | // If location is to be showed too, 1 to activate it. | 95 | // If location is to be showed too, 1 to activate it. |
95 | SHOW_LOCATION = cfg.readNumEntry("showlocation",1); | 96 | SHOW_LOCATION = cfg.readNumEntry("showlocation",1); |
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 | ||
100 | void Today::startConfig() | 103 | void Today::startConfig() |
101 | { | 104 | { |
102 | conf = new todayconfig ( this, "", true ); | 105 | conf = new todayconfig ( this, "", true ); |
103 | 106 | ||
@@ -116,26 +119,30 @@ void Today::startConfig() | |||
116 | // notes show box | 119 | // notes show box |
117 | conf->CheckBox2->setChecked(SHOW_NOTES); | 120 | conf->CheckBox2->setChecked(SHOW_NOTES); |
118 | // task lines | 121 | // task lines |
119 | conf->SpinBox2->setValue(MAX_LINES_TASK); | 122 | conf->SpinBox2->setValue(MAX_LINES_TASK); |
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 | ||
125 | int maxlinestask = conf->SpinBox2->value(); | 130 | int maxlinestask = conf->SpinBox2->value(); |
126 | int maxmeet = conf->SpinBox1->value(); | 131 | int maxmeet = conf->SpinBox1->value(); |
127 | int location = conf->CheckBox1->isChecked(); | 132 | int location = conf->CheckBox1->isChecked(); |
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); |
133 | cfg.writeEntry("maxlinesmeet",maxmeet); | 139 | cfg.writeEntry("maxlinesmeet",maxmeet); |
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(); |
138 | 145 | ||
139 | draw(); | 146 | draw(); |
140 | } | 147 | } |
141 | 148 | ||
@@ -166,13 +173,35 @@ void Today::getDates() | |||
166 | if ( count <= MAX_LINES_MEET ) | 173 | if ( count <= MAX_LINES_MEET ) |
167 | { | 174 | { |
168 | //only get events past current time (start or end??) | 175 | //only get events past current time (start or end??) |
169 | //cout << time.toString() << endl; | 176 | //cout << time.toString() << endl; |
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>"; |
175 | // include location or not | 204 | // include location or not |
176 | if (SHOW_LOCATION == 1) | 205 | if (SHOW_LOCATION == 1) |
177 | { | 206 | { |
178 | msg+= "<BR>" + (*it).location(); | 207 | msg+= "<BR>" + (*it).location(); |
@@ -187,12 +216,17 @@ void Today::getDates() | |||
187 | if (SHOW_NOTES == 1) | 216 | if (SHOW_NOTES == 1) |
188 | { | 217 | { |
189 | msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; | 218 | msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; |
190 | } | 219 | } |
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); |
195 | } | 229 | } |
196 | } | 230 | } |
197 | 231 | ||
198 | /* | 232 | /* |