author | zautrix <zautrix> | 2005-02-07 21:06:04 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-07 21:06:04 (UTC) |
commit | edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e (patch) (unidiff) | |
tree | 7653e521f003a0c4e316530d38c09f3190c4edaf | |
parent | da5e47069d88fa9aa656423ce4c60bf505728e1c (diff) | |
download | kdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.zip kdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.tar.gz kdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.tar.bz2 |
recurrence fixes
-rw-r--r-- | korganizer/koeventviewer.cpp | 23 | ||||
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 24 | ||||
-rw-r--r-- | libkcal/recurrence.cpp | 2 | ||||
-rw-r--r-- | microkde/kdeui/ktoolbar.cpp | 2 | ||||
-rw-r--r-- | microkde/kdeui/ktoolbar.h | 2 |
5 files changed, 32 insertions, 21 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index de11c13..39921a0 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -114,398 +114,401 @@ void KOEventViewer::setSource(const QString& n) | |||
114 | if ( "uid:"+a->uid() == n ) { | 114 | if ( "uid:"+a->uid() == n ) { |
115 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); | 115 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); |
116 | return; | 116 | return; |
117 | } | 117 | } |
118 | } | 118 | } |
119 | } | 119 | } |
120 | return; | 120 | return; |
121 | } | 121 | } |
122 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 122 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
123 | // the result should now arrive through method insertAttendees | 123 | // the result should now arrive through method insertAttendees |
124 | //QString uid = "uid:"+(*it).uid(); | 124 | //QString uid = "uid:"+(*it).uid(); |
125 | #endif | 125 | #endif |
126 | if ( n.left(6) == "mailto" ) { | 126 | if ( n.left(6) == "mailto" ) { |
127 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); | 127 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); |
128 | #ifndef DESKTOP_VERSION | 128 | #ifndef DESKTOP_VERSION |
129 | if ( n.mid(7,3) == "ALL" ) { | 129 | if ( n.mid(7,3) == "ALL" ) { |
130 | qDebug("all "); | 130 | qDebug("all "); |
131 | mailToAttendees( true ); | 131 | mailToAttendees( true ); |
132 | } else if ( n.mid(7,4) == "RSVP" ) { | 132 | } else if ( n.mid(7,4) == "RSVP" ) { |
133 | mailToAttendees( false ); | 133 | mailToAttendees( false ); |
134 | qDebug("rsvp "); | 134 | qDebug("rsvp "); |
135 | } else { | 135 | } else { |
136 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); | 136 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); |
137 | e << n.mid(7); | 137 | e << n.mid(7); |
138 | } | 138 | } |
139 | #endif | 139 | #endif |
140 | 140 | ||
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
144 | #ifndef KORG_NODCOP | 144 | #ifndef KORG_NODCOP |
145 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; | 145 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; |
146 | QString tmpStr; | 146 | QString tmpStr; |
147 | if (n.startsWith("mailto:")) { | 147 | if (n.startsWith("mailto:")) { |
148 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); | 148 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); |
149 | //emit showIncidence(n); | 149 | //emit showIncidence(n); |
150 | return; | 150 | return; |
151 | } else if (n.startsWith("uid:")) { | 151 | } else if (n.startsWith("uid:")) { |
152 | DCOPClient *client = KApplication::kApplication()->dcopClient(); | 152 | DCOPClient *client = KApplication::kApplication()->dcopClient(); |
153 | const QByteArray noParamData; | 153 | const QByteArray noParamData; |
154 | const QByteArray paramData; | 154 | const QByteArray paramData; |
155 | QByteArray replyData; | 155 | QByteArray replyData; |
156 | QCString replyTypeStr; | 156 | QCString replyTypeStr; |
157 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) | 157 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) |
158 | bool foundAbbrowser = PING_ABBROWSER; | 158 | bool foundAbbrowser = PING_ABBROWSER; |
159 | 159 | ||
160 | if (foundAbbrowser) { | 160 | if (foundAbbrowser) { |
161 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor | 161 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor |
162 | //client->send("kaddressbook","KAddressBookIface", | 162 | //client->send("kaddressbook","KAddressBookIface", |
163 | QDataStream arg(paramData, IO_WriteOnly); | 163 | QDataStream arg(paramData, IO_WriteOnly); |
164 | arg << n.mid(6); | 164 | arg << n.mid(6); |
165 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); | 165 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); |
166 | return; | 166 | return; |
167 | } else { | 167 | } else { |
168 | /* | 168 | /* |
169 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. | 169 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. |
170 | We start it without its main interface | 170 | We start it without its main interface |
171 | */ | 171 | */ |
172 | KIconLoader* iconLoader = new KIconLoader(); | 172 | KIconLoader* iconLoader = new KIconLoader(); |
173 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); | 173 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); |
174 | ActionManager::setStartedKAddressBook(true); | 174 | ActionManager::setStartedKAddressBook(true); |
175 | tmpStr = "kaddressbook --editor-only --uid "; | 175 | tmpStr = "kaddressbook --editor-only --uid "; |
176 | tmpStr += KProcess::quote(n.mid(6)); | 176 | tmpStr += KProcess::quote(n.mid(6)); |
177 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); | 177 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); |
178 | return; | 178 | return; |
179 | } | 179 | } |
180 | } else { | 180 | } else { |
181 | //QTextBrowser::setSource(n); | 181 | //QTextBrowser::setSource(n); |
182 | } | 182 | } |
183 | #endif | 183 | #endif |
184 | } | 184 | } |
185 | void KOEventViewer::mailToAttendees( bool all ) | 185 | void KOEventViewer::mailToAttendees( bool all ) |
186 | { | 186 | { |
187 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); | 187 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); |
188 | if (attendees.count() == 0) return; | 188 | if (attendees.count() == 0) return; |
189 | QStringList nameList; | 189 | QStringList nameList; |
190 | QStringList emailList; | 190 | QStringList emailList; |
191 | QStringList uidList; | 191 | QStringList uidList; |
192 | Attendee* a; | 192 | Attendee* a; |
193 | for(a=attendees.first();a;a=attendees.next()) { | 193 | for(a=attendees.first();a;a=attendees.next()) { |
194 | if ( !all && !a->RSVP() ) continue; | 194 | if ( !all && !a->RSVP() ) continue; |
195 | if (!a->email().isEmpty()) { | 195 | if (!a->email().isEmpty()) { |
196 | nameList.append (a->name() ); | 196 | nameList.append (a->name() ); |
197 | emailList.append (a->email() ); | 197 | emailList.append (a->email() ); |
198 | uidList.append (a->uid() ); | 198 | uidList.append (a->uid() ); |
199 | } | 199 | } |
200 | } | 200 | } |
201 | QString uid = "ComposeMailUIpick2"+mMailSubject; | 201 | QString uid = "ComposeMailUIpick2"+mMailSubject; |
202 | #ifndef DESKTOP_VERSION | 202 | #ifndef DESKTOP_VERSION |
203 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 203 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
204 | #endif | 204 | #endif |
205 | 205 | ||
206 | } | 206 | } |
207 | void KOEventViewer::addTag(const QString & tag,const QString & text) | 207 | void KOEventViewer::addTag(const QString & tag,const QString & text) |
208 | { | 208 | { |
209 | int number=text.contains("\n"); | 209 | int number=text.contains("\n"); |
210 | QString str = "<" + tag + ">"; | 210 | QString str = "<" + tag + ">"; |
211 | QString tmpText=text; | 211 | QString tmpText=text; |
212 | QString tmpStr=str; | 212 | QString tmpStr=str; |
213 | if(number !=-1) | 213 | if(number !=-1) |
214 | { | 214 | { |
215 | if (number > 0) { | 215 | if (number > 0) { |
216 | int pos=0; | 216 | int pos=0; |
217 | QString tmp; | 217 | QString tmp; |
218 | for(int i=0;i<=number;i++) { | 218 | for(int i=0;i<=number;i++) { |
219 | pos=tmpText.find("\n"); | 219 | pos=tmpText.find("\n"); |
220 | tmp=tmpText.left(pos); | 220 | tmp=tmpText.left(pos); |
221 | tmpText=tmpText.right(tmpText.length()-pos-1); | 221 | tmpText=tmpText.right(tmpText.length()-pos-1); |
222 | tmpStr+=tmp+"<br>"; | 222 | tmpStr+=tmp+"<br>"; |
223 | } | 223 | } |
224 | } | 224 | } |
225 | else tmpStr += tmpText; | 225 | else tmpStr += tmpText; |
226 | tmpStr+="</" + tag + ">"; | 226 | tmpStr+="</" + tag + ">"; |
227 | mText.append(tmpStr); | 227 | mText.append(tmpStr); |
228 | } | 228 | } |
229 | else | 229 | else |
230 | { | 230 | { |
231 | str += text + "</" + tag + ">"; | 231 | str += text + "</" + tag + ">"; |
232 | mText.append(str); | 232 | mText.append(str); |
233 | } | 233 | } |
234 | } | 234 | } |
235 | 235 | ||
236 | void KOEventViewer::setColorMode( int m ) | 236 | void KOEventViewer::setColorMode( int m ) |
237 | { | 237 | { |
238 | mColorMode = m; | 238 | mColorMode = m; |
239 | } | 239 | } |
240 | void KOEventViewer::appendEvent(Event *event, int mode ) | 240 | void KOEventViewer::appendEvent(Event *event, int mode ) |
241 | { | 241 | { |
242 | mMailSubject = ""; | 242 | mMailSubject = ""; |
243 | mCurrentIncidence = event; | 243 | mCurrentIncidence = event; |
244 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 244 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
245 | topLevelWidget()->setCaption(i18n("Event Viewer")); | 245 | topLevelWidget()->setCaption(i18n("Event Viewer")); |
246 | if ( mode == 0 ) { | 246 | if ( mode == 0 ) { |
247 | addTag("h2",event->summary()); | 247 | addTag("h2",event->summary()); |
248 | } | 248 | } |
249 | else { | 249 | else { |
250 | if ( mColorMode == 1 ) { | 250 | if ( mColorMode == 1 ) { |
251 | mText +="<font color=\"#00A000\">"; | 251 | mText +="<font color=\"#00A000\">"; |
252 | } | 252 | } |
253 | if ( mColorMode == 2 ) { | 253 | if ( mColorMode == 2 ) { |
254 | mText +="<font color=\"#C00000\">"; | 254 | mText +="<font color=\"#C00000\">"; |
255 | } | 255 | } |
256 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 256 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
257 | if ( mode == 1 ) { | 257 | if ( mode == 1 ) { |
258 | addTag("h2",i18n( "Local: " ) +event->summary()); | 258 | addTag("h2",i18n( "Local: " ) +event->summary()); |
259 | } else { | 259 | } else { |
260 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 260 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
261 | } | 261 | } |
262 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 262 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
263 | if ( mColorMode ) | 263 | if ( mColorMode ) |
264 | mText += "</font>"; | 264 | mText += "</font>"; |
265 | } | 265 | } |
266 | mMailSubject += i18n( "Meeting " )+ event->summary(); | 266 | mMailSubject += i18n( "Meeting " )+ event->summary(); |
267 | if (event->cancelled ()) { | 267 | if (event->cancelled ()) { |
268 | mText +="<font color=\"#B00000\">"; | 268 | mText +="<font color=\"#B00000\">"; |
269 | addTag("i",i18n("This event has been cancelled!")); | 269 | addTag("i",i18n("This event has been cancelled!")); |
270 | mText.append("<br>"); | 270 | mText.append("<br>"); |
271 | mText += "</font>"; | 271 | mText += "</font>"; |
272 | mMailSubject += i18n("(cancelled)"); | 272 | mMailSubject += i18n("(cancelled)"); |
273 | } | 273 | } |
274 | if (!event->location().isEmpty()) { | 274 | if (!event->location().isEmpty()) { |
275 | addTag("b",i18n("Location: ")); | 275 | addTag("b",i18n("Location: ")); |
276 | mText.append(event->location()+"<br>"); | 276 | mText.append(event->location()+"<br>"); |
277 | mMailSubject += i18n(" at ") + event->location(); | 277 | mMailSubject += i18n(" at ") + event->location(); |
278 | } | 278 | } |
279 | if (event->doesFloat()) { | 279 | if (event->doesFloat()) { |
280 | if (event->isMultiDay()) { | 280 | if (event->isMultiDay()) { |
281 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 281 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
282 | .arg(event->dtStartDateStr(shortDate)) | 282 | .arg(event->dtStartDateStr(shortDate)) |
283 | .arg(event->dtEndDateStr(shortDate))); | 283 | .arg(event->dtEndDateStr(shortDate))); |
284 | } else { | 284 | } else { |
285 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 285 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
286 | } | 286 | } |
287 | } else { | 287 | } else { |
288 | if (event->isMultiDay()) { | 288 | if (event->isMultiDay()) { |
289 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 289 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
290 | .arg(event->dtStartStr( shortDate))); | 290 | .arg(event->dtStartStr( shortDate))); |
291 | mText.append(i18n("<p><b>To:</b> %1</p>") | 291 | mText.append(i18n("<p><b>To:</b> %1</p>") |
292 | .arg(event->dtEndStr(shortDate))); | 292 | .arg(event->dtEndStr(shortDate))); |
293 | } else { | 293 | } else { |
294 | mText.append(i18n("<p><b>On:</b> %1</p> ") | 294 | mText.append(i18n("<p><b>On:</b> %1</p> ") |
295 | .arg(event->dtStartDateStr( shortDate ))); | 295 | .arg(event->dtStartDateStr( shortDate ))); |
296 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 296 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
297 | .arg(event->dtStartTimeStr()) | 297 | .arg(event->dtStartTimeStr()) |
298 | .arg(event->dtEndTimeStr())); | 298 | .arg(event->dtEndTimeStr())); |
299 | } | 299 | } |
300 | } | 300 | } |
301 | 301 | ||
302 | if (event->recurrence()->doesRecur()) { | 302 | if (event->recurrence()->doesRecur()) { |
303 | 303 | ||
304 | QString recurText = event->recurrence()->recurrenceText(); | 304 | QString recurText = event->recurrence()->recurrenceText(); |
305 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 305 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
306 | bool last; | 306 | bool ok; |
307 | QDate start = QDate::currentDate(); | 307 | QDate start = QDate::currentDate(); |
308 | QDate next; | 308 | QDateTime next; |
309 | next = event->recurrence()->getPreviousDate( start , &last ); | 309 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); |
310 | if ( !last ) { | 310 | if ( ok ) { |
311 | next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); | ||
312 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 311 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
313 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); | 312 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); |
314 | QDateTime nextdt = QDateTime( next, event->dtStart().time()); | 313 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); |
315 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true ); | ||
316 | 314 | ||
317 | } else { | 315 | } else { |
318 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 316 | bool last; |
319 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); | 317 | QDate nextd; |
318 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); | ||
319 | if ( last ) { | ||
320 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | ||
321 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | ||
322 | } | ||
320 | } | 323 | } |
321 | } else { | 324 | } else { |
322 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); | 325 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); |
323 | 326 | ||
324 | } | 327 | } |
325 | 328 | ||
326 | 329 | ||
327 | if (event->isAlarmEnabled()) { | 330 | if (event->isAlarmEnabled()) { |
328 | Alarm *alarm =event->alarms().first() ; | 331 | Alarm *alarm =event->alarms().first() ; |
329 | QDateTime t = alarm->time(); | 332 | QDateTime t = alarm->time(); |
330 | int min = t.secsTo( event->dtStart() )/60; | 333 | int min = t.secsTo( event->dtStart() )/60; |
331 | QString s =i18n("( %1 min before )").arg( min ); | 334 | QString s =i18n("( %1 min before )").arg( min ); |
332 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 335 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
333 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 336 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
334 | //addTag("p",s); | 337 | //addTag("p",s); |
335 | } | 338 | } |
336 | 339 | ||
337 | addTag("b",i18n("Access: ")); | 340 | addTag("b",i18n("Access: ")); |
338 | mText.append(event->secrecyStr()+"<br>"); | 341 | mText.append(event->secrecyStr()+"<br>"); |
339 | if (!event->description().isEmpty()) { | 342 | if (!event->description().isEmpty()) { |
340 | addTag("p",i18n("<b>Details: </b>")); | 343 | addTag("p",i18n("<b>Details: </b>")); |
341 | addTag("p",event->description()); | 344 | addTag("p",event->description()); |
342 | } | 345 | } |
343 | 346 | ||
344 | formatCategories(event); | 347 | formatCategories(event); |
345 | 348 | ||
346 | formatReadOnly(event); | 349 | formatReadOnly(event); |
347 | formatAttendees(event); | 350 | formatAttendees(event); |
348 | 351 | ||
349 | setText(mText); | 352 | setText(mText); |
350 | //QWhatsThis::add(this,mText); | 353 | //QWhatsThis::add(this,mText); |
351 | 354 | ||
352 | } | 355 | } |
353 | 356 | ||
354 | void KOEventViewer::appendTodo(Todo *event, int mode ) | 357 | void KOEventViewer::appendTodo(Todo *event, int mode ) |
355 | { | 358 | { |
356 | mMailSubject = ""; | 359 | mMailSubject = ""; |
357 | mCurrentIncidence = event; | 360 | mCurrentIncidence = event; |
358 | topLevelWidget()->setCaption(i18n("Todo Viewer")); | 361 | topLevelWidget()->setCaption(i18n("Todo Viewer")); |
359 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 362 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
360 | if (mode == 0 ) | 363 | if (mode == 0 ) |
361 | addTag("h2",event->summary()); | 364 | addTag("h2",event->summary()); |
362 | else { | 365 | else { |
363 | if ( mColorMode == 1 ) { | 366 | if ( mColorMode == 1 ) { |
364 | mText +="<font color=\"#00A000\">"; | 367 | mText +="<font color=\"#00A000\">"; |
365 | } | 368 | } |
366 | if ( mColorMode == 2 ) { | 369 | if ( mColorMode == 2 ) { |
367 | mText +="<font color=\"#B00000\">"; | 370 | mText +="<font color=\"#B00000\">"; |
368 | } | 371 | } |
369 | if ( mode == 1 ) { | 372 | if ( mode == 1 ) { |
370 | addTag("h2",i18n( "Local: " ) +event->summary()); | 373 | addTag("h2",i18n( "Local: " ) +event->summary()); |
371 | } else { | 374 | } else { |
372 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 375 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
373 | } | 376 | } |
374 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 377 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
375 | if ( mColorMode ) | 378 | if ( mColorMode ) |
376 | mText += "</font>"; | 379 | mText += "</font>"; |
377 | } | 380 | } |
378 | mMailSubject += i18n( "Todo " )+ event->summary(); | 381 | mMailSubject += i18n( "Todo " )+ event->summary(); |
379 | 382 | ||
380 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 383 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
381 | mText +="<font color=\"#B00000\">"; | 384 | mText +="<font color=\"#B00000\">"; |
382 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); | 385 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); |
383 | mText += "</font>"; | 386 | mText += "</font>"; |
384 | } else { | 387 | } else { |
385 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 388 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
386 | .arg(event->percentComplete())); | 389 | .arg(event->percentComplete())); |
387 | } | 390 | } |
388 | 391 | ||
389 | if (event->cancelled ()) { | 392 | if (event->cancelled ()) { |
390 | mText +="<font color=\"#B00000\">"; | 393 | mText +="<font color=\"#B00000\">"; |
391 | addTag("i",i18n("This todo has been cancelled!")); | 394 | addTag("i",i18n("This todo has been cancelled!")); |
392 | mText.append("<br>"); | 395 | mText.append("<br>"); |
393 | mText += "</font>"; | 396 | mText += "</font>"; |
394 | mMailSubject += i18n("(cancelled)"); | 397 | mMailSubject += i18n("(cancelled)"); |
395 | } | 398 | } |
396 | 399 | ||
397 | if (!event->location().isEmpty()) { | 400 | if (!event->location().isEmpty()) { |
398 | addTag("b",i18n("Location: ")); | 401 | addTag("b",i18n("Location: ")); |
399 | mText.append(event->location()+"<br>"); | 402 | mText.append(event->location()+"<br>"); |
400 | mMailSubject += i18n(" at ") + event->location(); | 403 | mMailSubject += i18n(" at ") + event->location(); |
401 | } | 404 | } |
402 | if (event->hasStartDate()) { | 405 | if (event->hasStartDate()) { |
403 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); | 406 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); |
404 | } | 407 | } |
405 | if (event->hasDueDate()) { | 408 | if (event->hasDueDate()) { |
406 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 409 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
407 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | 410 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); |
408 | } | 411 | } |
409 | addTag("b",i18n("Access: ")); | 412 | addTag("b",i18n("Access: ")); |
410 | mText.append(event->secrecyStr()+"<br>"); | 413 | mText.append(event->secrecyStr()+"<br>"); |
411 | if (!event->description().isEmpty()) { | 414 | if (!event->description().isEmpty()) { |
412 | addTag("p",i18n("<b>Details: </b>")); | 415 | addTag("p",i18n("<b>Details: </b>")); |
413 | addTag("p",event->description()); | 416 | addTag("p",event->description()); |
414 | } | 417 | } |
415 | 418 | ||
416 | formatCategories(event); | 419 | formatCategories(event); |
417 | 420 | ||
418 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 421 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
419 | .arg(QString::number(event->priority()))); | 422 | .arg(QString::number(event->priority()))); |
420 | 423 | ||
421 | formatReadOnly(event); | 424 | formatReadOnly(event); |
422 | formatAttendees(event); | 425 | formatAttendees(event); |
423 | if ( event->relatedTo() ) { | 426 | if ( event->relatedTo() ) { |
424 | addTag("b",i18n("Parent todo:<br>")); | 427 | addTag("b",i18n("Parent todo:<br>")); |
425 | mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); | 428 | mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); |
426 | } | 429 | } |
427 | QPtrList<Incidence> Relations = event->relations(); | 430 | QPtrList<Incidence> Relations = event->relations(); |
428 | Incidence *to; | 431 | Incidence *to; |
429 | if ( Relations.first() ) | 432 | if ( Relations.first() ) |
430 | addTag("b",i18n("Sub todos:<br>")); | 433 | addTag("b",i18n("Sub todos:<br>")); |
431 | for (to=Relations.first();to;to=Relations.next()) { | 434 | for (to=Relations.first();to;to=Relations.next()) { |
432 | mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); | 435 | mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); |
433 | 436 | ||
434 | } | 437 | } |
435 | setText(mText); | 438 | setText(mText); |
436 | } | 439 | } |
437 | 440 | ||
438 | void KOEventViewer::formatCategories(Incidence *event) | 441 | void KOEventViewer::formatCategories(Incidence *event) |
439 | { | 442 | { |
440 | if (!event->categoriesStr().isEmpty()) { | 443 | if (!event->categoriesStr().isEmpty()) { |
441 | if (event->categories().count() == 1) { | 444 | if (event->categories().count() == 1) { |
442 | addTag("h3",i18n("Category")); | 445 | addTag("h3",i18n("Category")); |
443 | } else { | 446 | } else { |
444 | addTag("h3",i18n("Categories")); | 447 | addTag("h3",i18n("Categories")); |
445 | } | 448 | } |
446 | addTag("p",event->categoriesStr()); | 449 | addTag("p",event->categoriesStr()); |
447 | } | 450 | } |
448 | } | 451 | } |
449 | void KOEventViewer::formatAttendees(Incidence *event) | 452 | void KOEventViewer::formatAttendees(Incidence *event) |
450 | { | 453 | { |
451 | QPtrList<Attendee> attendees = event->attendees(); | 454 | QPtrList<Attendee> attendees = event->attendees(); |
452 | if (attendees.count()) { | 455 | if (attendees.count()) { |
453 | 456 | ||
454 | 457 | ||
455 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 458 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
456 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); | 459 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); |
457 | addTag("h3",i18n("Organizer")); | 460 | addTag("h3",i18n("Organizer")); |
458 | mText.append("<ul><li>"); | 461 | mText.append("<ul><li>"); |
459 | #ifndef KORG_NOKABC | 462 | #ifndef KORG_NOKABC |
460 | 463 | ||
461 | #ifdef DESKTOP_VERSION | 464 | #ifdef DESKTOP_VERSION |
462 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 465 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
463 | KABC::Addressee::List addressList; | 466 | KABC::Addressee::List addressList; |
464 | addressList = add_book->findByEmail(event->organizer()); | 467 | addressList = add_book->findByEmail(event->organizer()); |
465 | KABC::Addressee o = addressList.first(); | 468 | KABC::Addressee o = addressList.first(); |
466 | if (!o.isEmpty() && addressList.size()<2) { | 469 | if (!o.isEmpty() && addressList.size()<2) { |
467 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 470 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
468 | mText += o.formattedName(); | 471 | mText += o.formattedName(); |
469 | mText += "</a>\n"; | 472 | mText += "</a>\n"; |
470 | } else { | 473 | } else { |
471 | mText.append(event->organizer()); | 474 | mText.append(event->organizer()); |
472 | } | 475 | } |
473 | #else //DESKTOP_VERSION | 476 | #else //DESKTOP_VERSION |
474 | mText += "<a href=\"uid:organizer\">"; | 477 | mText += "<a href=\"uid:organizer\">"; |
475 | mText += event->organizer(); | 478 | mText += event->organizer(); |
476 | mText += "</a>\n"; | 479 | mText += "</a>\n"; |
477 | #endif //DESKTOP_VERSION | 480 | #endif //DESKTOP_VERSION |
478 | 481 | ||
479 | 482 | ||
480 | #else | 483 | #else |
481 | mText.append(event->organizer()); | 484 | mText.append(event->organizer()); |
482 | #endif | 485 | #endif |
483 | 486 | ||
484 | if (iconPath) { | 487 | if (iconPath) { |
485 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 488 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
486 | mText += "<IMG src=\"" + iconPath + "\">"; | 489 | mText += "<IMG src=\"" + iconPath + "\">"; |
487 | mText += "</a>\n"; | 490 | mText += "</a>\n"; |
488 | } | 491 | } |
489 | mText.append("</li></ul>"); | 492 | mText.append("</li></ul>"); |
490 | 493 | ||
491 | addTag("h3",i18n("Attendees")); | 494 | addTag("h3",i18n("Attendees")); |
492 | Attendee *a; | 495 | Attendee *a; |
493 | mText.append("<ul>"); | 496 | mText.append("<ul>"); |
494 | int a_count = 0; | 497 | int a_count = 0; |
495 | int a_count_nr = 0; | 498 | int a_count_nr = 0; |
496 | 499 | ||
497 | for(a=attendees.first();a;a=attendees.next()) { | 500 | for(a=attendees.first();a;a=attendees.next()) { |
498 | #ifndef KORG_NOKABC | 501 | #ifndef KORG_NOKABC |
499 | #ifdef DESKTOP_VERSION | 502 | #ifdef DESKTOP_VERSION |
500 | if (a->name().isEmpty()) { | 503 | if (a->name().isEmpty()) { |
501 | addressList = add_book->findByEmail(a->email()); | 504 | addressList = add_book->findByEmail(a->email()); |
502 | KABC::Addressee o = addressList.first(); | 505 | KABC::Addressee o = addressList.first(); |
503 | if (!o.isEmpty() && addressList.size()<2) { | 506 | if (!o.isEmpty() && addressList.size()<2) { |
504 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 507 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
505 | mText += o.formattedName(); | 508 | mText += o.formattedName(); |
506 | mText += "</a>\n"; | 509 | mText += "</a>\n"; |
507 | } else { | 510 | } else { |
508 | mText += "<li>"; | 511 | mText += "<li>"; |
509 | mText.append(a->email()); | 512 | mText.append(a->email()); |
510 | mText += "\n"; | 513 | mText += "\n"; |
511 | } | 514 | } |
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 6d07d4c..0d9c3f4 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -1,309 +1,315 @@ | |||
1 | #include "kincidenceformatter.h" | 1 | #include "kincidenceformatter.h" |
2 | #include <kstaticdeleter.h> | 2 | #include <kstaticdeleter.h> |
3 | #include <kglobal.h> | 3 | #include <kglobal.h> |
4 | #include <klocale.h> | 4 | #include <klocale.h> |
5 | #ifdef DEKTOP_VERSION | 5 | #ifdef DEKTOP_VERSION |
6 | #include <kabc/stdaddressbook.h> | 6 | #include <kabc/stdaddressbook.h> |
7 | #define size count | 7 | #define size count |
8 | #endif | 8 | #endif |
9 | 9 | ||
10 | KIncidenceFormatter* KIncidenceFormatter::mInstance = 0; | 10 | KIncidenceFormatter* KIncidenceFormatter::mInstance = 0; |
11 | static KStaticDeleter<KIncidenceFormatter> insd; | 11 | static KStaticDeleter<KIncidenceFormatter> insd; |
12 | 12 | ||
13 | QString KIncidenceFormatter::getFormattedText( Incidence * inc ) | 13 | QString KIncidenceFormatter::getFormattedText( Incidence * inc ) |
14 | { | 14 | { |
15 | // #ifndef QT_NO_INPUTDIALOG | 15 | // #ifndef QT_NO_INPUTDIALOG |
16 | // return QInputDialog::getItem( caption, label, items, current, editable ); | 16 | // return QInputDialog::getItem( caption, label, items, current, editable ); |
17 | // #else | 17 | // #else |
18 | // return QString::null; | 18 | // return QString::null; |
19 | // #endif | 19 | // #endif |
20 | mText = ""; | 20 | mText = ""; |
21 | if ( inc->type() == "Event" ) | 21 | if ( inc->type() == "Event" ) |
22 | setEvent((Event *) inc ); | 22 | setEvent((Event *) inc ); |
23 | else if ( inc->type() == "Todo" ) | 23 | else if ( inc->type() == "Todo" ) |
24 | setTodo((Todo *) inc ); | 24 | setTodo((Todo *) inc ); |
25 | return mText; | 25 | return mText; |
26 | } | 26 | } |
27 | 27 | ||
28 | KIncidenceFormatter* KIncidenceFormatter::instance() | 28 | KIncidenceFormatter* KIncidenceFormatter::instance() |
29 | { | 29 | { |
30 | if (!mInstance) { | 30 | if (!mInstance) { |
31 | mInstance = insd.setObject(new KIncidenceFormatter()); | 31 | mInstance = insd.setObject(new KIncidenceFormatter()); |
32 | } | 32 | } |
33 | return mInstance; | 33 | return mInstance; |
34 | } | 34 | } |
35 | KIncidenceFormatter::~KIncidenceFormatter() | 35 | KIncidenceFormatter::~KIncidenceFormatter() |
36 | { | 36 | { |
37 | if (mInstance == this) | 37 | if (mInstance == this) |
38 | mInstance = insd.setObject(0); | 38 | mInstance = insd.setObject(0); |
39 | //qDebug("KIncidenceFormatter::~KIncidenceFormatter "); | 39 | //qDebug("KIncidenceFormatter::~KIncidenceFormatter "); |
40 | } | 40 | } |
41 | KIncidenceFormatter::KIncidenceFormatter() | 41 | KIncidenceFormatter::KIncidenceFormatter() |
42 | { | 42 | { |
43 | mColorMode = 0; | 43 | mColorMode = 0; |
44 | } | 44 | } |
45 | void KIncidenceFormatter::setEvent(Event *event) | 45 | void KIncidenceFormatter::setEvent(Event *event) |
46 | { | 46 | { |
47 | int mode = 0; | 47 | int mode = 0; |
48 | mCurrentIncidence = event; | 48 | mCurrentIncidence = event; |
49 | bool shortDate = true; | 49 | bool shortDate = true; |
50 | if ( mode == 0 ) { | 50 | if ( mode == 0 ) { |
51 | addTag("h3",event->summary()); | 51 | addTag("h3",event->summary()); |
52 | } | 52 | } |
53 | else { | 53 | else { |
54 | if ( mColorMode == 1 ) { | 54 | if ( mColorMode == 1 ) { |
55 | mText +="<font color=\"#00A000\">"; | 55 | mText +="<font color=\"#00A000\">"; |
56 | } | 56 | } |
57 | if ( mColorMode == 2 ) { | 57 | if ( mColorMode == 2 ) { |
58 | mText +="<font color=\"#C00000\">"; | 58 | mText +="<font color=\"#C00000\">"; |
59 | } | 59 | } |
60 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 60 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
61 | if ( mode == 1 ) { | 61 | if ( mode == 1 ) { |
62 | addTag("h2",i18n( "Local: " ) +event->summary()); | 62 | addTag("h2",i18n( "Local: " ) +event->summary()); |
63 | } else { | 63 | } else { |
64 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 64 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
65 | } | 65 | } |
66 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 66 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
67 | if ( mColorMode ) | 67 | if ( mColorMode ) |
68 | mText += "</font>"; | 68 | mText += "</font>"; |
69 | } | 69 | } |
70 | if (event->cancelled ()) { | 70 | if (event->cancelled ()) { |
71 | mText +="<font color=\"#B00000\">"; | 71 | mText +="<font color=\"#B00000\">"; |
72 | addTag("i",i18n("This event has been cancelled!")); | 72 | addTag("i",i18n("This event has been cancelled!")); |
73 | mText.append("<br>"); | 73 | mText.append("<br>"); |
74 | mText += "</font>"; | 74 | mText += "</font>"; |
75 | } | 75 | } |
76 | if (!event->location().isEmpty()) { | 76 | if (!event->location().isEmpty()) { |
77 | addTag("b",i18n("Location: ")); | 77 | addTag("b",i18n("Location: ")); |
78 | mText.append(event->location()+"<br>"); | 78 | mText.append(event->location()+"<br>"); |
79 | } | 79 | } |
80 | if (event->doesFloat()) { | 80 | if (event->doesFloat()) { |
81 | if (event->isMultiDay()) { | 81 | if (event->isMultiDay()) { |
82 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 82 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
83 | .arg(event->dtStartDateStr(shortDate)) | 83 | .arg(event->dtStartDateStr(shortDate)) |
84 | .arg(event->dtEndDateStr(shortDate))); | 84 | .arg(event->dtEndDateStr(shortDate))); |
85 | } else { | 85 | } else { |
86 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 86 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
87 | } | 87 | } |
88 | } else { | 88 | } else { |
89 | if (event->isMultiDay()) { | 89 | if (event->isMultiDay()) { |
90 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 90 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
91 | .arg(event->dtStartStr( shortDate))); | 91 | .arg(event->dtStartStr( shortDate))); |
92 | mText.append(i18n("<p><b>To:</b> %1</p>") | 92 | mText.append(i18n("<p><b>To:</b> %1</p>") |
93 | .arg(event->dtEndStr(shortDate))); | 93 | .arg(event->dtEndStr(shortDate))); |
94 | } else { | 94 | } else { |
95 | mText.append(i18n("<p><b>On:</b> %1</p> ") | 95 | mText.append(i18n("<p><b>On:</b> %1</p> ") |
96 | .arg(event->dtStartDateStr( shortDate ))); | 96 | .arg(event->dtStartDateStr( shortDate ))); |
97 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 97 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
98 | .arg(event->dtStartTimeStr()) | 98 | .arg(event->dtStartTimeStr()) |
99 | .arg(event->dtEndTimeStr())); | 99 | .arg(event->dtEndTimeStr())); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | if (event->recurrence()->doesRecur()) { | 103 | if (event->recurrence()->doesRecur()) { |
104 | 104 | ||
105 | QString recurText = event->recurrence()->recurrenceText(); | 105 | QString recurText = event->recurrence()->recurrenceText(); |
106 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 106 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
107 | bool last; | 107 | |
108 | bool ok; | ||
108 | QDate start = QDate::currentDate(); | 109 | QDate start = QDate::currentDate(); |
109 | QDate next; | 110 | QDateTime next; |
110 | next = event->recurrence()->getPreviousDate( start , &last ); | 111 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); |
111 | if ( !last ) { | 112 | if ( ok ) { |
112 | next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); | 113 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
113 | addTag("p",i18n("Next recurrence is on: ")+ KGlobal::locale()->formatDate( next, shortDate ) ); | 114 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); |
114 | //addTag("p", KGlobal::locale()->formatDate( next, shortDate )); | 115 | |
115 | } else { | 116 | } else { |
116 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 117 | bool last; |
117 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); | 118 | QDate nextd; |
119 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); | ||
120 | if ( last ) { | ||
121 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | ||
122 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | ||
123 | } | ||
118 | } | 124 | } |
119 | } | 125 | } |
120 | 126 | ||
121 | 127 | ||
122 | if (event->isAlarmEnabled()) { | 128 | if (event->isAlarmEnabled()) { |
123 | Alarm *alarm =event->alarms().first() ; | 129 | Alarm *alarm =event->alarms().first() ; |
124 | QDateTime t = alarm->time(); | 130 | QDateTime t = alarm->time(); |
125 | int min = t.secsTo( event->dtStart() )/60; | 131 | int min = t.secsTo( event->dtStart() )/60; |
126 | QString s =i18n("(%1 min before)").arg( min ); | 132 | QString s =i18n("(%1 min before)").arg( min ); |
127 | addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); | 133 | addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); |
128 | //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 134 | //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
129 | //addTag("p",s); | 135 | //addTag("p",s); |
130 | } | 136 | } |
131 | 137 | ||
132 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); | 138 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); |
133 | // mText.append(event->secrecyStr()+"<br>"); | 139 | // mText.append(event->secrecyStr()+"<br>"); |
134 | formatCategories(event); | 140 | formatCategories(event); |
135 | if (!event->description().isEmpty()) { | 141 | if (!event->description().isEmpty()) { |
136 | addTag("p",i18n("<b>Details: </b>")); | 142 | addTag("p",i18n("<b>Details: </b>")); |
137 | addTag("p",event->description()); | 143 | addTag("p",event->description()); |
138 | } | 144 | } |
139 | 145 | ||
140 | 146 | ||
141 | formatReadOnly(event); | 147 | formatReadOnly(event); |
142 | formatAttendees(event); | 148 | formatAttendees(event); |
143 | 149 | ||
144 | 150 | ||
145 | } | 151 | } |
146 | 152 | ||
147 | void KIncidenceFormatter::setTodo(Todo *event ) | 153 | void KIncidenceFormatter::setTodo(Todo *event ) |
148 | { | 154 | { |
149 | int mode = 0; | 155 | int mode = 0; |
150 | mCurrentIncidence = event; | 156 | mCurrentIncidence = event; |
151 | bool shortDate = true; | 157 | bool shortDate = true; |
152 | if (mode == 0 ) | 158 | if (mode == 0 ) |
153 | addTag("h3",event->summary()); | 159 | addTag("h3",event->summary()); |
154 | else { | 160 | else { |
155 | if ( mColorMode == 1 ) { | 161 | if ( mColorMode == 1 ) { |
156 | mText +="<font color=\"#00A000\">"; | 162 | mText +="<font color=\"#00A000\">"; |
157 | } | 163 | } |
158 | if ( mColorMode == 2 ) { | 164 | if ( mColorMode == 2 ) { |
159 | mText +="<font color=\"#B00000\">"; | 165 | mText +="<font color=\"#B00000\">"; |
160 | } | 166 | } |
161 | if ( mode == 1 ) { | 167 | if ( mode == 1 ) { |
162 | addTag("h2",i18n( "Local: " ) +event->summary()); | 168 | addTag("h2",i18n( "Local: " ) +event->summary()); |
163 | } else { | 169 | } else { |
164 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 170 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
165 | } | 171 | } |
166 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 172 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
167 | if ( mColorMode ) | 173 | if ( mColorMode ) |
168 | mText += "</font>"; | 174 | mText += "</font>"; |
169 | } | 175 | } |
170 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 176 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
171 | mText +="<font color=\"#B00000\">"; | 177 | mText +="<font color=\"#B00000\">"; |
172 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); | 178 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); |
173 | mText += "</font>"; | 179 | mText += "</font>"; |
174 | } else { | 180 | } else { |
175 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 181 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
176 | .arg(event->percentComplete())); | 182 | .arg(event->percentComplete())); |
177 | } | 183 | } |
178 | if (event->cancelled ()) { | 184 | if (event->cancelled ()) { |
179 | mText +="<font color=\"#B00000\">"; | 185 | mText +="<font color=\"#B00000\">"; |
180 | addTag("i",i18n("This todo has been cancelled!")); | 186 | addTag("i",i18n("This todo has been cancelled!")); |
181 | mText.append("<br>"); | 187 | mText.append("<br>"); |
182 | mText += "</font>"; | 188 | mText += "</font>"; |
183 | } | 189 | } |
184 | 190 | ||
185 | if (!event->location().isEmpty()) { | 191 | if (!event->location().isEmpty()) { |
186 | addTag("b",i18n("Location: ")); | 192 | addTag("b",i18n("Location: ")); |
187 | mText.append(event->location()+"<br>"); | 193 | mText.append(event->location()+"<br>"); |
188 | } | 194 | } |
189 | if (event->hasDueDate()) { | 195 | if (event->hasDueDate()) { |
190 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); | 196 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); |
191 | } | 197 | } |
192 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 198 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
193 | .arg(QString::number(event->priority()))); | 199 | .arg(QString::number(event->priority()))); |
194 | 200 | ||
195 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); | 201 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); |
196 | formatCategories(event); | 202 | formatCategories(event); |
197 | if (!event->description().isEmpty()) { | 203 | if (!event->description().isEmpty()) { |
198 | addTag("p",i18n("<b>Details: </b>")); | 204 | addTag("p",i18n("<b>Details: </b>")); |
199 | addTag("p",event->description()); | 205 | addTag("p",event->description()); |
200 | } | 206 | } |
201 | 207 | ||
202 | 208 | ||
203 | 209 | ||
204 | formatReadOnly(event); | 210 | formatReadOnly(event); |
205 | formatAttendees(event); | 211 | formatAttendees(event); |
206 | 212 | ||
207 | } | 213 | } |
208 | 214 | ||
209 | void KIncidenceFormatter::setJournal(Journal* ) | 215 | void KIncidenceFormatter::setJournal(Journal* ) |
210 | { | 216 | { |
211 | 217 | ||
212 | } | 218 | } |
213 | 219 | ||
214 | void KIncidenceFormatter::formatCategories(Incidence *event) | 220 | void KIncidenceFormatter::formatCategories(Incidence *event) |
215 | { | 221 | { |
216 | if (!event->categoriesStr().isEmpty()) { | 222 | if (!event->categoriesStr().isEmpty()) { |
217 | addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() ); | 223 | addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() ); |
218 | //mText.append(event->categoriesStr()); | 224 | //mText.append(event->categoriesStr()); |
219 | } | 225 | } |
220 | } | 226 | } |
221 | void KIncidenceFormatter::addTag(const QString & tag,const QString & text) | 227 | void KIncidenceFormatter::addTag(const QString & tag,const QString & text) |
222 | { | 228 | { |
223 | int number=text.contains("\n"); | 229 | int number=text.contains("\n"); |
224 | QString str = "<" + tag + ">"; | 230 | QString str = "<" + tag + ">"; |
225 | QString tmpText=text; | 231 | QString tmpText=text; |
226 | QString tmpStr=str; | 232 | QString tmpStr=str; |
227 | if(number !=-1) | 233 | if(number !=-1) |
228 | { | 234 | { |
229 | if (number > 0) { | 235 | if (number > 0) { |
230 | int pos=0; | 236 | int pos=0; |
231 | QString tmp; | 237 | QString tmp; |
232 | for(int i=0;i<=number;i++) { | 238 | for(int i=0;i<=number;i++) { |
233 | pos=tmpText.find("\n"); | 239 | pos=tmpText.find("\n"); |
234 | tmp=tmpText.left(pos); | 240 | tmp=tmpText.left(pos); |
235 | tmpText=tmpText.right(tmpText.length()-pos-1); | 241 | tmpText=tmpText.right(tmpText.length()-pos-1); |
236 | tmpStr+=tmp+"<br>"; | 242 | tmpStr+=tmp+"<br>"; |
237 | } | 243 | } |
238 | } | 244 | } |
239 | else tmpStr += tmpText; | 245 | else tmpStr += tmpText; |
240 | tmpStr+="</" + tag + ">"; | 246 | tmpStr+="</" + tag + ">"; |
241 | mText.append(tmpStr); | 247 | mText.append(tmpStr); |
242 | } | 248 | } |
243 | else | 249 | else |
244 | { | 250 | { |
245 | str += text + "</" + tag + ">"; | 251 | str += text + "</" + tag + ">"; |
246 | mText.append(str); | 252 | mText.append(str); |
247 | } | 253 | } |
248 | } | 254 | } |
249 | 255 | ||
250 | void KIncidenceFormatter::formatAttendees(Incidence *event) | 256 | void KIncidenceFormatter::formatAttendees(Incidence *event) |
251 | { | 257 | { |
252 | QPtrList<Attendee> attendees = event->attendees(); | 258 | QPtrList<Attendee> attendees = event->attendees(); |
253 | if (attendees.count()) { | 259 | if (attendees.count()) { |
254 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 260 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
255 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); | 261 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); |
256 | addTag("h3",i18n("Organizer")); | 262 | addTag("h3",i18n("Organizer")); |
257 | mText.append("<ul><li>"); | 263 | mText.append("<ul><li>"); |
258 | #if 0 | 264 | #if 0 |
259 | //ndef KORG_NOKABC | 265 | //ndef KORG_NOKABC |
260 | 266 | ||
261 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 267 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
262 | KABC::Addressee::List addressList; | 268 | KABC::Addressee::List addressList; |
263 | addressList = add_book->findByEmail(event->organizer()); | 269 | addressList = add_book->findByEmail(event->organizer()); |
264 | KABC::Addressee o = addressList.first(); | 270 | KABC::Addressee o = addressList.first(); |
265 | if (!o.isEmpty() && addressList.size()<2) { | 271 | if (!o.isEmpty() && addressList.size()<2) { |
266 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 272 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
267 | mText += o.formattedName(); | 273 | mText += o.formattedName(); |
268 | mText += "</a>\n"; | 274 | mText += "</a>\n"; |
269 | } else { | 275 | } else { |
270 | mText.append(event->organizer()); | 276 | mText.append(event->organizer()); |
271 | } | 277 | } |
272 | #else | 278 | #else |
273 | mText.append(event->organizer()); | 279 | mText.append(event->organizer()); |
274 | #endif | 280 | #endif |
275 | if (iconPath) { | 281 | if (iconPath) { |
276 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 282 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
277 | mText += "<IMG src=\"" + iconPath + "\">"; | 283 | mText += "<IMG src=\"" + iconPath + "\">"; |
278 | mText += "</a>\n"; | 284 | mText += "</a>\n"; |
279 | } | 285 | } |
280 | mText.append("</li></ul>"); | 286 | mText.append("</li></ul>"); |
281 | 287 | ||
282 | addTag("h3",i18n("Attendees")); | 288 | addTag("h3",i18n("Attendees")); |
283 | Attendee *a; | 289 | Attendee *a; |
284 | mText.append("<ul>"); | 290 | mText.append("<ul>"); |
285 | for(a=attendees.first();a;a=attendees.next()) { | 291 | for(a=attendees.first();a;a=attendees.next()) { |
286 | #if 0 | 292 | #if 0 |
287 | //ndef KORG_NOKABC | 293 | //ndef KORG_NOKABC |
288 | if (a->name().isEmpty()) { | 294 | if (a->name().isEmpty()) { |
289 | addressList = add_book->findByEmail(a->email()); | 295 | addressList = add_book->findByEmail(a->email()); |
290 | KABC::Addressee o = addressList.first(); | 296 | KABC::Addressee o = addressList.first(); |
291 | if (!o.isEmpty() && addressList.size()<2) { | 297 | if (!o.isEmpty() && addressList.size()<2) { |
292 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 298 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
293 | mText += o.formattedName(); | 299 | mText += o.formattedName(); |
294 | mText += "</a>\n"; | 300 | mText += "</a>\n"; |
295 | } else { | 301 | } else { |
296 | mText += "<li>"; | 302 | mText += "<li>"; |
297 | mText.append(a->email()); | 303 | mText.append(a->email()); |
298 | mText += "\n"; | 304 | mText += "\n"; |
299 | } | 305 | } |
300 | } else { | 306 | } else { |
301 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 307 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
302 | if (!a->name().isEmpty()) mText += a->name(); | 308 | if (!a->name().isEmpty()) mText += a->name(); |
303 | else mText += a->email(); | 309 | else mText += a->email(); |
304 | mText += "</a>\n"; | 310 | mText += "</a>\n"; |
305 | } | 311 | } |
306 | #else | 312 | #else |
307 | //qDebug("nokabc "); | 313 | //qDebug("nokabc "); |
308 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 314 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
309 | if (!a->name().isEmpty()) mText += a->name(); | 315 | if (!a->name().isEmpty()) mText += a->name(); |
diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp index e84f672..5181eaf 100644 --- a/libkcal/recurrence.cpp +++ b/libkcal/recurrence.cpp | |||
@@ -690,671 +690,673 @@ void Recurrence::addMonthlyDay(short _rDay) | |||
690 | || _rDay == 0 || _rDay > 31 || _rDay < -31) // invalid day number | 690 | || _rDay == 0 || _rDay > 31 || _rDay < -31) // invalid day number |
691 | return; | 691 | return; |
692 | for (int* it = rMonthDays.first(); it; it = rMonthDays.next()) { | 692 | for (int* it = rMonthDays.first(); it; it = rMonthDays.next()) { |
693 | if (_rDay == *it) | 693 | if (_rDay == *it) |
694 | return; // this day is already in the list - avoid duplication | 694 | return; // this day is already in the list - avoid duplication |
695 | } | 695 | } |
696 | int *tmpDay = new int; | 696 | int *tmpDay = new int; |
697 | *tmpDay = _rDay; | 697 | *tmpDay = _rDay; |
698 | rMonthDays.append(tmpDay); | 698 | rMonthDays.append(tmpDay); |
699 | 699 | ||
700 | if (mCompatVersion < 310 && mCompatDuration > 0) { | 700 | if (mCompatVersion < 310 && mCompatDuration > 0) { |
701 | // Backwards compatibility for KDE < 3.1. | 701 | // Backwards compatibility for KDE < 3.1. |
702 | // rDuration was set to the number of time periods to recur. | 702 | // rDuration was set to the number of time periods to recur. |
703 | // Convert this to the number of occurrences. | 703 | // Convert this to the number of occurrences. |
704 | int monthsAhead = (mCompatDuration-1+mRecurExDatesCount) * rFreq; | 704 | int monthsAhead = (mCompatDuration-1+mRecurExDatesCount) * rFreq; |
705 | int month = mRecurStart.date().month() - 1 + monthsAhead; | 705 | int month = mRecurStart.date().month() - 1 + monthsAhead; |
706 | QDate end(mRecurStart.date().year() + month/12, month%12 + 1, 31); | 706 | QDate end(mRecurStart.date().year() + month/12, month%12 + 1, 31); |
707 | rDuration = INT_MAX; // ensure that recurCalc() does its job correctly | 707 | rDuration = INT_MAX; // ensure that recurCalc() does its job correctly |
708 | rDuration = recurCalc(COUNT_TO_DATE, end); | 708 | rDuration = recurCalc(COUNT_TO_DATE, end); |
709 | } | 709 | } |
710 | 710 | ||
711 | if (mParent) mParent->updated(); | 711 | if (mParent) mParent->updated(); |
712 | } | 712 | } |
713 | 713 | ||
714 | void Recurrence::setYearly(int type, int _rFreq, int _rDuration) | 714 | void Recurrence::setYearly(int type, int _rFreq, int _rDuration) |
715 | { | 715 | { |
716 | if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1) | 716 | if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1) |
717 | return; | 717 | return; |
718 | if (mCompatVersion < 310) | 718 | if (mCompatVersion < 310) |
719 | mCompatDuration = (_rDuration > 0) ? _rDuration : 0; | 719 | mCompatDuration = (_rDuration > 0) ? _rDuration : 0; |
720 | setYearly_(type, mFeb29YearlyDefaultType, _rFreq, _rDuration); | 720 | setYearly_(type, mFeb29YearlyDefaultType, _rFreq, _rDuration); |
721 | } | 721 | } |
722 | 722 | ||
723 | void Recurrence::setYearly(int type, int _rFreq, const QDate &_rEndDate) | 723 | void Recurrence::setYearly(int type, int _rFreq, const QDate &_rEndDate) |
724 | { | 724 | { |
725 | if (mRecurReadOnly) return; | 725 | if (mRecurReadOnly) return; |
726 | rEndDateTime.setDate(_rEndDate); | 726 | rEndDateTime.setDate(_rEndDate); |
727 | rEndDateTime.setTime(mRecurStart.time()); | 727 | rEndDateTime.setTime(mRecurStart.time()); |
728 | mCompatDuration = 0; | 728 | mCompatDuration = 0; |
729 | setYearly_(type, mFeb29YearlyDefaultType, _rFreq, 0); | 729 | setYearly_(type, mFeb29YearlyDefaultType, _rFreq, 0); |
730 | } | 730 | } |
731 | 731 | ||
732 | void Recurrence::setYearlyByDate(Feb29Type type, int _rFreq, int _rDuration) | 732 | void Recurrence::setYearlyByDate(Feb29Type type, int _rFreq, int _rDuration) |
733 | { | 733 | { |
734 | if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1) | 734 | if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1) |
735 | return; | 735 | return; |
736 | if (mCompatVersion < 310) | 736 | if (mCompatVersion < 310) |
737 | mCompatDuration = (_rDuration > 0) ? _rDuration : 0; | 737 | mCompatDuration = (_rDuration > 0) ? _rDuration : 0; |
738 | setYearly_(rYearlyMonth, type, _rFreq, _rDuration); | 738 | setYearly_(rYearlyMonth, type, _rFreq, _rDuration); |
739 | } | 739 | } |
740 | 740 | ||
741 | void Recurrence::setYearlyByDate(Feb29Type type, int _rFreq, const QDate &_rEndDate) | 741 | void Recurrence::setYearlyByDate(Feb29Type type, int _rFreq, const QDate &_rEndDate) |
742 | { | 742 | { |
743 | if (mRecurReadOnly) return; | 743 | if (mRecurReadOnly) return; |
744 | rEndDateTime.setDate(_rEndDate); | 744 | rEndDateTime.setDate(_rEndDate); |
745 | rEndDateTime.setTime(mRecurStart.time()); | 745 | rEndDateTime.setTime(mRecurStart.time()); |
746 | mCompatDuration = 0; | 746 | mCompatDuration = 0; |
747 | setYearly_(rYearlyMonth, type, _rFreq, 0); | 747 | setYearly_(rYearlyMonth, type, _rFreq, 0); |
748 | } | 748 | } |
749 | 749 | ||
750 | void Recurrence::addYearlyMonthPos(short _rPos, const QBitArray &_rDays) | 750 | void Recurrence::addYearlyMonthPos(short _rPos, const QBitArray &_rDays) |
751 | { | 751 | { |
752 | if (recurs == rYearlyPos) | 752 | if (recurs == rYearlyPos) |
753 | addMonthlyPos_(_rPos, _rDays); | 753 | addMonthlyPos_(_rPos, _rDays); |
754 | } | 754 | } |
755 | 755 | ||
756 | const QPtrList<int> &Recurrence::yearNums() const | 756 | const QPtrList<int> &Recurrence::yearNums() const |
757 | { | 757 | { |
758 | return rYearNums; | 758 | return rYearNums; |
759 | } | 759 | } |
760 | void Recurrence::addYearlyMonth(short _rPos ) | 760 | void Recurrence::addYearlyMonth(short _rPos ) |
761 | { | 761 | { |
762 | if (mRecurReadOnly || recurs != rYearlyMonth) // invalid day/month number | 762 | if (mRecurReadOnly || recurs != rYearlyMonth) // invalid day/month number |
763 | return; | 763 | return; |
764 | rMonthPos *tmpPos = new rMonthPos; | 764 | rMonthPos *tmpPos = new rMonthPos; |
765 | if ( _rPos > 0) { | 765 | if ( _rPos > 0) { |
766 | tmpPos->rPos = _rPos; | 766 | tmpPos->rPos = _rPos; |
767 | tmpPos->negative = false; | 767 | tmpPos->negative = false; |
768 | } else { | 768 | } else { |
769 | tmpPos->rPos = -_rPos; // take abs() | 769 | tmpPos->rPos = -_rPos; // take abs() |
770 | tmpPos->negative = true; | 770 | tmpPos->negative = true; |
771 | } | 771 | } |
772 | rMonthPositions.append(tmpPos); | 772 | rMonthPositions.append(tmpPos); |
773 | } | 773 | } |
774 | void Recurrence::addYearlyNum(short _rNum) | 774 | void Recurrence::addYearlyNum(short _rNum) |
775 | { | 775 | { |
776 | if (mRecurReadOnly | 776 | if (mRecurReadOnly |
777 | || (recurs != rYearlyMonth && recurs != rYearlyDay && recurs != rYearlyPos) | 777 | || (recurs != rYearlyMonth && recurs != rYearlyDay && recurs != rYearlyPos) |
778 | || _rNum <= 0) // invalid day/month number | 778 | || _rNum <= 0) // invalid day/month number |
779 | return; | 779 | return; |
780 | 780 | ||
781 | if (mCompatVersion < 310 && mCompatRecurs == rYearlyDay) { | 781 | if (mCompatVersion < 310 && mCompatRecurs == rYearlyDay) { |
782 | // Backwards compatibility for KDE < 3.1. | 782 | // Backwards compatibility for KDE < 3.1. |
783 | // Dates were stored as day numbers, with a fiddle to take account of leap years. | 783 | // Dates were stored as day numbers, with a fiddle to take account of leap years. |
784 | // Convert the day number to a month. | 784 | // Convert the day number to a month. |
785 | if (_rNum <= 0 || _rNum > 366 || (_rNum == 366 && mRecurStart.date().daysInYear() < 366)) | 785 | if (_rNum <= 0 || _rNum > 366 || (_rNum == 366 && mRecurStart.date().daysInYear() < 366)) |
786 | return; // invalid day number | 786 | return; // invalid day number |
787 | _rNum = QDate(mRecurStart.date().year(), 1, 1).addDays(_rNum - 1).month(); | 787 | _rNum = QDate(mRecurStart.date().year(), 1, 1).addDays(_rNum - 1).month(); |
788 | } else | 788 | } else |
789 | if ((recurs == rYearlyMonth || recurs == rYearlyPos) && _rNum > 12 | 789 | if ((recurs == rYearlyMonth || recurs == rYearlyPos) && _rNum > 12 |
790 | || recurs == rYearlyDay && _rNum > 366) | 790 | || recurs == rYearlyDay && _rNum > 366) |
791 | return; // invalid day number | 791 | return; // invalid day number |
792 | 792 | ||
793 | uint i = 0; | 793 | uint i = 0; |
794 | for (int* it = rYearNums.first(); it && _rNum >= *it; it = rYearNums.next()) { | 794 | for (int* it = rYearNums.first(); it && _rNum >= *it; it = rYearNums.next()) { |
795 | if (_rNum == *it) | 795 | if (_rNum == *it) |
796 | return; // this day/month is already in the list - avoid duplication | 796 | return; // this day/month is already in the list - avoid duplication |
797 | ++i; | 797 | ++i; |
798 | } | 798 | } |
799 | 799 | ||
800 | int *tmpNum = new int; | 800 | int *tmpNum = new int; |
801 | *tmpNum = _rNum; | 801 | *tmpNum = _rNum; |
802 | rYearNums.insert(i, tmpNum); // insert the day/month in a sorted position | 802 | rYearNums.insert(i, tmpNum); // insert the day/month in a sorted position |
803 | 803 | ||
804 | if (mCompatVersion < 310 && mCompatDuration > 0) { | 804 | if (mCompatVersion < 310 && mCompatDuration > 0) { |
805 | // Backwards compatibility for KDE < 3.1. | 805 | // Backwards compatibility for KDE < 3.1. |
806 | // rDuration was set to the number of time periods to recur. | 806 | // rDuration was set to the number of time periods to recur. |
807 | // Convert this to the number of occurrences. | 807 | // Convert this to the number of occurrences. |
808 | QDate end(mRecurStart.date().year() + (mCompatDuration-1+mRecurExDatesCount)*rFreq, 12, 31); | 808 | QDate end(mRecurStart.date().year() + (mCompatDuration-1+mRecurExDatesCount)*rFreq, 12, 31); |
809 | rDuration = INT_MAX; // ensure that recurCalc() does its job correctly | 809 | rDuration = INT_MAX; // ensure that recurCalc() does its job correctly |
810 | rDuration = recurCalc(COUNT_TO_DATE, end); | 810 | rDuration = recurCalc(COUNT_TO_DATE, end); |
811 | } | 811 | } |
812 | 812 | ||
813 | if (mParent) mParent->updated(); | 813 | if (mParent) mParent->updated(); |
814 | } | 814 | } |
815 | 815 | ||
816 | 816 | ||
817 | QDateTime Recurrence::getNextDateTime(const QDateTime &preDateTime, bool *last) const | 817 | QDateTime Recurrence::getNextDateTime(const QDateTime &preDateTime, bool *last) const |
818 | { | 818 | { |
819 | if (last) | 819 | if (last) |
820 | *last = false; | 820 | *last = false; |
821 | int freq; | 821 | int freq; |
822 | switch (recurs) | 822 | switch (recurs) |
823 | { | 823 | { |
824 | case rMinutely: | 824 | case rMinutely: |
825 | freq = rFreq * 60; | 825 | freq = rFreq * 60; |
826 | break; | 826 | break; |
827 | case rHourly: | 827 | case rHourly: |
828 | freq = rFreq * 3600; | 828 | freq = rFreq * 3600; |
829 | break; | 829 | break; |
830 | case rDaily: | 830 | case rDaily: |
831 | case rWeekly: | 831 | case rWeekly: |
832 | case rMonthlyPos: | 832 | case rMonthlyPos: |
833 | case rMonthlyDay: | 833 | case rMonthlyDay: |
834 | case rYearlyMonth: | 834 | case rYearlyMonth: |
835 | case rYearlyDay: | 835 | case rYearlyDay: |
836 | case rYearlyPos: { | 836 | case rYearlyPos: { |
837 | QDate preDate = preDateTime.date(); | 837 | QDate preDate = preDateTime.date(); |
838 | if (!mFloats && mRecurStart.time() > preDateTime.time()) | 838 | if (!mFloats && mRecurStart.time() > preDateTime.time()) |
839 | preDate = preDate.addDays(-1); | 839 | preDate = preDate.addDays(-1); |
840 | return QDateTime(getNextDateNoTime(preDate, last), mRecurStart.time()); | 840 | return QDateTime(getNextDateNoTime(preDate, last), mRecurStart.time()); |
841 | } | 841 | } |
842 | default: | 842 | default: |
843 | return QDateTime(); | 843 | return QDateTime(); |
844 | } | 844 | } |
845 | 845 | ||
846 | // It's a sub-daily recurrence | 846 | // It's a sub-daily recurrence |
847 | if (preDateTime < mRecurStart) | 847 | if (preDateTime < mRecurStart) |
848 | return mRecurStart; | 848 | return mRecurStart; |
849 | int count = mRecurStart.secsTo(preDateTime) / freq + 2; | 849 | int count = mRecurStart.secsTo(preDateTime) / freq + 2; |
850 | if (rDuration > 0) { | 850 | if (rDuration > 0) { |
851 | if (count > rDuration) | 851 | if (count > rDuration) |
852 | return QDateTime(); | 852 | return QDateTime(); |
853 | if (last && count == rDuration) | 853 | if (last && count == rDuration) |
854 | *last = true; | 854 | *last = true; |
855 | } | 855 | } |
856 | QDateTime endtime = mRecurStart.addSecs((count - 1)*freq); | 856 | QDateTime endtime = mRecurStart.addSecs((count - 1)*freq); |
857 | if (rDuration == 0) { | 857 | if (rDuration == 0) { |
858 | if (endtime > rEndDateTime) | 858 | if (endtime > rEndDateTime) |
859 | return QDateTime(); | 859 | return QDateTime(); |
860 | if (last && endtime == rEndDateTime) | 860 | if (last && endtime == rEndDateTime) |
861 | *last = true; | 861 | *last = true; |
862 | } | 862 | } |
863 | return endtime; | 863 | return endtime; |
864 | } | 864 | } |
865 | 865 | ||
866 | QDate Recurrence::getNextDate(const QDate &preDate, bool *last) const | 866 | QDate Recurrence::getNextDate(const QDate &preDate, bool *last) const |
867 | { | 867 | { |
868 | if (last) | 868 | if (last) |
869 | *last = false; | 869 | *last = false; |
870 | switch (recurs) | 870 | switch (recurs) |
871 | { | 871 | { |
872 | case rMinutely: | 872 | case rMinutely: |
873 | case rHourly: | 873 | case rHourly: |
874 | return getNextDateTime(QDateTime(preDate, QTime(23,59,59)), last).date(); | 874 | return getNextDateTime(QDateTime(preDate, QTime(23,59,59)), last).date(); |
875 | case rDaily: | 875 | case rDaily: |
876 | case rWeekly: | 876 | case rWeekly: |
877 | case rMonthlyPos: | 877 | case rMonthlyPos: |
878 | case rMonthlyDay: | 878 | case rMonthlyDay: |
879 | case rYearlyMonth: | 879 | case rYearlyMonth: |
880 | case rYearlyDay: | 880 | case rYearlyDay: |
881 | case rYearlyPos: | 881 | case rYearlyPos: |
882 | qDebug("Recurrence::getNextDate: MAY BE BROKEN "); | ||
882 | return getNextDateNoTime(preDate, last); | 883 | return getNextDateNoTime(preDate, last); |
883 | default: | 884 | default: |
884 | return QDate(); | 885 | return QDate(); |
885 | } | 886 | } |
886 | } | 887 | } |
887 | 888 | ||
888 | 889 | ||
889 | QDateTime Recurrence::getPreviousDateTime(const QDateTime &afterDateTime, bool *last) const | 890 | QDateTime Recurrence::getPreviousDateTime(const QDateTime &afterDateTime, bool *last) const |
890 | { | 891 | { |
891 | if (last) | 892 | if (last) |
892 | *last = false; | 893 | *last = false; |
893 | int freq; | 894 | int freq; |
894 | switch (recurs) | 895 | switch (recurs) |
895 | { | 896 | { |
896 | case rMinutely: | 897 | case rMinutely: |
897 | freq = rFreq * 60; | 898 | freq = rFreq * 60; |
898 | break; | 899 | break; |
899 | case rHourly: | 900 | case rHourly: |
900 | freq = rFreq * 3600; | 901 | freq = rFreq * 3600; |
901 | break; | 902 | break; |
902 | case rDaily: | 903 | case rDaily: |
903 | case rWeekly: | 904 | case rWeekly: |
904 | case rMonthlyPos: | 905 | case rMonthlyPos: |
905 | case rMonthlyDay: | 906 | case rMonthlyDay: |
906 | case rYearlyMonth: | 907 | case rYearlyMonth: |
907 | case rYearlyDay: | 908 | case rYearlyDay: |
908 | case rYearlyPos: { | 909 | case rYearlyPos: { |
909 | QDate afterDate = afterDateTime.date(); | 910 | QDate afterDate = afterDateTime.date(); |
910 | if (!mFloats && mRecurStart.time() < afterDateTime.time()) | 911 | if (!mFloats && mRecurStart.time() < afterDateTime.time()) |
911 | afterDate = afterDate.addDays(1); | 912 | afterDate = afterDate.addDays(1); |
912 | return QDateTime(getPreviousDateNoTime(afterDate, last), mRecurStart.time()); | 913 | return QDateTime(getPreviousDateNoTime(afterDate, last), mRecurStart.time()); |
913 | } | 914 | } |
914 | default: | 915 | default: |
915 | return QDateTime(); | 916 | return QDateTime(); |
916 | } | 917 | } |
917 | 918 | ||
918 | // It's a sub-daily recurrence | 919 | // It's a sub-daily recurrence |
919 | if (afterDateTime <= mRecurStart) | 920 | if (afterDateTime <= mRecurStart) |
920 | return QDateTime(); | 921 | return QDateTime(); |
921 | int count = (mRecurStart.secsTo(afterDateTime) - 1) / freq + 1; | 922 | int count = (mRecurStart.secsTo(afterDateTime) - 1) / freq + 1; |
922 | if (rDuration > 0) { | 923 | if (rDuration > 0) { |
923 | if (count > rDuration) | 924 | if (count > rDuration) |
924 | count = rDuration; | 925 | count = rDuration; |
925 | if (last && count == rDuration) | 926 | if (last && count == rDuration) |
926 | *last = true; | 927 | *last = true; |
927 | } | 928 | } |
928 | QDateTime endtime = mRecurStart.addSecs((count - 1)*freq); | 929 | QDateTime endtime = mRecurStart.addSecs((count - 1)*freq); |
929 | if (rDuration == 0) { | 930 | if (rDuration == 0) { |
930 | if (endtime > rEndDateTime) | 931 | if (endtime > rEndDateTime) |
931 | endtime = rEndDateTime; | 932 | endtime = rEndDateTime; |
932 | if (last && endtime == rEndDateTime) | 933 | if (last && endtime == rEndDateTime) |
933 | *last = true; | 934 | *last = true; |
934 | } | 935 | } |
935 | return endtime; | 936 | return endtime; |
936 | } | 937 | } |
937 | 938 | ||
938 | QDate Recurrence::getPreviousDate(const QDate &afterDate, bool *last) const | 939 | QDate Recurrence::getPreviousDate(const QDate &afterDate, bool *last) const |
939 | { | 940 | { |
940 | if (last) | 941 | if (last) |
941 | *last = false; | 942 | *last = false; |
942 | switch (recurs) | 943 | switch (recurs) |
943 | { | 944 | { |
944 | case rMinutely: | 945 | case rMinutely: |
945 | case rHourly: | 946 | case rHourly: |
946 | return getPreviousDateTime(QDateTime(afterDate, QTime(0,0,0)), last).date(); | 947 | return getPreviousDateTime(QDateTime(afterDate, QTime(0,0,0)), last).date(); |
947 | case rDaily: | 948 | case rDaily: |
948 | case rWeekly: | 949 | case rWeekly: |
949 | case rMonthlyPos: | 950 | case rMonthlyPos: |
950 | case rMonthlyDay: | 951 | case rMonthlyDay: |
951 | case rYearlyMonth: | 952 | case rYearlyMonth: |
952 | case rYearlyDay: | 953 | case rYearlyDay: |
953 | case rYearlyPos: | 954 | case rYearlyPos: |
954 | return getPreviousDateNoTime(afterDate, last); | 955 | return getPreviousDateNoTime(afterDate, last); |
955 | default: | 956 | default: |
956 | return QDate(); | 957 | return QDate(); |
957 | } | 958 | } |
958 | } | 959 | } |
959 | 960 | ||
960 | 961 | ||
961 | /***************************** PROTECTED FUNCTIONS ***************************/ | 962 | /***************************** PROTECTED FUNCTIONS ***************************/ |
962 | 963 | ||
963 | bool Recurrence::recursSecondly(const QDate &qd, int secondFreq) const | 964 | bool Recurrence::recursSecondly(const QDate &qd, int secondFreq) const |
964 | { | 965 | { |
965 | if ((qd >= mRecurStart.date()) && | 966 | if ((qd >= mRecurStart.date()) && |
966 | ((rDuration > 0) && (qd <= endDate()) || | 967 | ((rDuration > 0) && (qd <= endDate()) || |
967 | ((rDuration == 0) && (qd <= rEndDateTime.date())) || | 968 | ((rDuration == 0) && (qd <= rEndDateTime.date())) || |
968 | (rDuration == -1))) { | 969 | (rDuration == -1))) { |
969 | // The date queried falls within the range of the event. | 970 | // The date queried falls within the range of the event. |
970 | if (secondFreq < 24*3600) | 971 | if (secondFreq < 24*3600) |
971 | return true; // the event recurs at least once each day | 972 | return true; // the event recurs at least once each day |
972 | int after = mRecurStart.secsTo(QDateTime(qd)); | 973 | int after = mRecurStart.secsTo(QDateTime(qd)); |
973 | if (after / secondFreq != (after + 24*3600) / secondFreq) | 974 | if (after / secondFreq != (after + 24*3600) / secondFreq) |
974 | return true; | 975 | return true; |
975 | } | 976 | } |
976 | return false; | 977 | return false; |
977 | } | 978 | } |
978 | 979 | ||
979 | bool Recurrence::recursMinutelyAt(const QDateTime &dt, int minuteFreq) const | 980 | bool Recurrence::recursMinutelyAt(const QDateTime &dt, int minuteFreq) const |
980 | { | 981 | { |
981 | if ((dt >= mRecurStart) && | 982 | if ((dt >= mRecurStart) && |
982 | ((rDuration > 0) && (dt <= endDateTime()) || | 983 | ((rDuration > 0) && (dt <= endDateTime()) || |
983 | ((rDuration == 0) && (dt <= rEndDateTime)) || | 984 | ((rDuration == 0) && (dt <= rEndDateTime)) || |
984 | (rDuration == -1))) { | 985 | (rDuration == -1))) { |
985 | // The time queried falls within the range of the event. | 986 | // The time queried falls within the range of the event. |
986 | if (((mRecurStart.secsTo(dt) / 60) % minuteFreq) == 0) | 987 | if (((mRecurStart.secsTo(dt) / 60) % minuteFreq) == 0) |
987 | return true; | 988 | return true; |
988 | } | 989 | } |
989 | return false; | 990 | return false; |
990 | } | 991 | } |
991 | 992 | ||
992 | bool Recurrence::recursDaily(const QDate &qd) const | 993 | bool Recurrence::recursDaily(const QDate &qd) const |
993 | { | 994 | { |
994 | QDate dStart = mRecurStart.date(); | 995 | QDate dStart = mRecurStart.date(); |
995 | if ((dStart.daysTo(qd) % rFreq) == 0) { | 996 | if ((dStart.daysTo(qd) % rFreq) == 0) { |
996 | // The date is a day which recurs | 997 | // The date is a day which recurs |
997 | if (qd >= dStart | 998 | if (qd >= dStart |
998 | && ((rDuration > 0 && qd <= endDate()) || | 999 | && ((rDuration > 0 && qd <= endDate()) || |
999 | (rDuration == 0 && qd <= rEndDateTime.date()) || | 1000 | (rDuration == 0 && qd <= rEndDateTime.date()) || |
1000 | rDuration == -1)) { | 1001 | rDuration == -1)) { |
1001 | // The date queried falls within the range of the event. | 1002 | // The date queried falls within the range of the event. |
1002 | return true; | 1003 | return true; |
1003 | } | 1004 | } |
1004 | } | 1005 | } |
1005 | return false; | 1006 | return false; |
1006 | } | 1007 | } |
1007 | 1008 | ||
1008 | bool Recurrence::recursWeekly(const QDate &qd) const | 1009 | bool Recurrence::recursWeekly(const QDate &qd) const |
1009 | { | 1010 | { |
1010 | QDate dStart = mRecurStart.date(); | 1011 | QDate dStart = mRecurStart.date(); |
1011 | if ((dStart.daysTo(qd)/7) % rFreq == 0) { | 1012 | if ((dStart.daysTo(qd)/7) % rFreq == 0) { |
1012 | // The date is in a week which recurs | 1013 | // The date is in a week which recurs |
1013 | if (qd >= dStart | 1014 | if (qd >= dStart |
1014 | && ((rDuration > 0 && qd <= endDate()) || | 1015 | && ((rDuration > 0 && qd <= endDate()) || |
1015 | (rDuration == 0 && qd <= rEndDateTime.date()) || | 1016 | (rDuration == 0 && qd <= rEndDateTime.date()) || |
1016 | rDuration == -1)) { | 1017 | rDuration == -1)) { |
1017 | // The date queried falls within the range of the event. | 1018 | // The date queried falls within the range of the event. |
1018 | // check if the bits set match today. | 1019 | // check if the bits set match today. |
1019 | int i = qd.dayOfWeek()-1; | 1020 | int i = qd.dayOfWeek()-1; |
1020 | if (rDays.testBit((uint) i)) | 1021 | if (rDays.testBit((uint) i)) |
1021 | return true; | 1022 | return true; |
1022 | } | 1023 | } |
1023 | } | 1024 | } |
1024 | return false; | 1025 | return false; |
1025 | } | 1026 | } |
1026 | 1027 | ||
1027 | bool Recurrence::recursMonthly(const QDate &qd) const | 1028 | bool Recurrence::recursMonthly(const QDate &qd) const |
1028 | { | 1029 | { |
1029 | QDate dStart = mRecurStart.date(); | 1030 | QDate dStart = mRecurStart.date(); |
1030 | int year = qd.year(); | 1031 | int year = qd.year(); |
1031 | int month = qd.month(); | 1032 | int month = qd.month(); |
1032 | int day = qd.day(); | 1033 | int day = qd.day(); |
1033 | // calculate how many months ahead this date is from the original | 1034 | // calculate how many months ahead this date is from the original |
1034 | // event's date | 1035 | // event's date |
1035 | int monthsAhead = (year - dStart.year()) * 12 + (month - dStart.month()); | 1036 | int monthsAhead = (year - dStart.year()) * 12 + (month - dStart.month()); |
1036 | if ((monthsAhead % rFreq) == 0) { | 1037 | if ((monthsAhead % rFreq) == 0) { |
1037 | // The date is in a month which recurs | 1038 | // The date is in a month which recurs |
1038 | if (qd >= dStart | 1039 | if (qd >= dStart |
1039 | && ((rDuration > 0 && qd <= endDate()) || | 1040 | && ((rDuration > 0 && qd <= endDate()) || |
1040 | (rDuration == 0 && qd <= rEndDateTime.date()) || | 1041 | (rDuration == 0 && qd <= rEndDateTime.date()) || |
1041 | rDuration == -1)) { | 1042 | rDuration == -1)) { |
1042 | // The date queried falls within the range of the event. | 1043 | // The date queried falls within the range of the event. |
1043 | QValueList<int> days; | 1044 | QValueList<int> days; |
1044 | int daysInMonth = qd.daysInMonth(); | 1045 | int daysInMonth = qd.daysInMonth(); |
1045 | if (recurs == rMonthlyDay) | 1046 | if (recurs == rMonthlyDay) |
1046 | getMonthlyDayDays(days, daysInMonth); | 1047 | getMonthlyDayDays(days, daysInMonth); |
1047 | else if (recurs == rMonthlyPos) | 1048 | else if (recurs == rMonthlyPos) |
1048 | getMonthlyPosDays(days, daysInMonth, QDate(year, month, 1).dayOfWeek()); | 1049 | getMonthlyPosDays(days, daysInMonth, QDate(year, month, 1).dayOfWeek()); |
1049 | for (QValueList<int>::Iterator it = days.begin(); it != days.end(); ++it) { | 1050 | for (QValueList<int>::Iterator it = days.begin(); it != days.end(); ++it) { |
1050 | if (*it == day) | 1051 | if (*it == day) |
1051 | return true; | 1052 | return true; |
1052 | } | 1053 | } |
1053 | // no dates matched | 1054 | // no dates matched |
1054 | } | 1055 | } |
1055 | } | 1056 | } |
1056 | return false; | 1057 | return false; |
1057 | } | 1058 | } |
1058 | 1059 | ||
1059 | bool Recurrence::recursYearlyByMonth(const QDate &qd) const | 1060 | bool Recurrence::recursYearlyByMonth(const QDate &qd) const |
1060 | { | 1061 | { |
1061 | QDate dStart = mRecurStart.date(); | 1062 | QDate dStart = mRecurStart.date(); |
1062 | int startDay = dStart.day(); | 1063 | int startDay = dStart.day(); |
1063 | int qday = qd.day(); | 1064 | int qday = qd.day(); |
1064 | int qmonth = qd.month(); | 1065 | int qmonth = qd.month(); |
1065 | int qyear = qd.year(); | 1066 | int qyear = qd.year(); |
1066 | bool match = (qday == startDay); | 1067 | bool match = (qday == startDay); |
1067 | if (!match && startDay == 29 && dStart.month() == 2) { | 1068 | if (!match && startDay == 29 && dStart.month() == 2) { |
1068 | // It's a recurrence on February 29th | 1069 | // It's a recurrence on February 29th |
1069 | switch (mFeb29YearlyType) { | 1070 | switch (mFeb29YearlyType) { |
1070 | case rFeb28: | 1071 | case rFeb28: |
1071 | if (qday == 28 && qmonth == 2 && !QDate::leapYear(qyear)) | 1072 | if (qday == 28 && qmonth == 2 && !QDate::leapYear(qyear)) |
1072 | match = true; | 1073 | match = true; |
1073 | break; | 1074 | break; |
1074 | case rMar1: | 1075 | case rMar1: |
1075 | if (qday == 1 && qmonth == 3 && !QDate::leapYear(qyear)) { | 1076 | if (qday == 1 && qmonth == 3 && !QDate::leapYear(qyear)) { |
1076 | qmonth = 2; | 1077 | qmonth = 2; |
1077 | match = true; | 1078 | match = true; |
1078 | } | 1079 | } |
1079 | break; | 1080 | break; |
1080 | case rFeb29: | 1081 | case rFeb29: |
1081 | break; | 1082 | break; |
1082 | } | 1083 | } |
1083 | } | 1084 | } |
1084 | 1085 | ||
1085 | if (match) { | 1086 | if (match) { |
1086 | // The day of the month matches. Calculate how many years ahead | 1087 | // The day of the month matches. Calculate how many years ahead |
1087 | // this date is from the original event's date. | 1088 | // this date is from the original event's date. |
1088 | int yearsAhead = (qyear - dStart.year()); | 1089 | int yearsAhead = (qyear - dStart.year()); |
1089 | if (yearsAhead % rFreq == 0) { | 1090 | if (yearsAhead % rFreq == 0) { |
1090 | // The date is in a year which recurs | 1091 | // The date is in a year which recurs |
1091 | if (qd >= dStart | 1092 | if (qd >= dStart |
1092 | && ((rDuration > 0 && qd <= endDate()) || | 1093 | && ((rDuration > 0 && qd <= endDate()) || |
1093 | (rDuration == 0 && qd <= rEndDateTime.date()) || | 1094 | (rDuration == 0 && qd <= rEndDateTime.date()) || |
1094 | rDuration == -1)) { | 1095 | rDuration == -1)) { |
1095 | // The date queried falls within the range of the event. | 1096 | // The date queried falls within the range of the event. |
1096 | int i = qmonth; | 1097 | int i = qmonth; |
1097 | for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) { | 1098 | for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) { |
1098 | if (i == *qlin.current()) | 1099 | if (i == *qlin.current()) |
1099 | return true; | 1100 | return true; |
1100 | } | 1101 | } |
1101 | } | 1102 | } |
1102 | } | 1103 | } |
1103 | } | 1104 | } |
1104 | return false; | 1105 | return false; |
1105 | } | 1106 | } |
1106 | 1107 | ||
1107 | bool Recurrence::recursYearlyByPos(const QDate &qd) const | 1108 | bool Recurrence::recursYearlyByPos(const QDate &qd) const |
1108 | { | 1109 | { |
1109 | QDate dStart = mRecurStart.date(); | 1110 | QDate dStart = mRecurStart.date(); |
1110 | int year = qd.year(); | 1111 | int year = qd.year(); |
1111 | int month = qd.month(); | 1112 | int month = qd.month(); |
1112 | int day = qd.day(); | 1113 | int day = qd.day(); |
1113 | // calculate how many years ahead this date is from the original | 1114 | // calculate how many years ahead this date is from the original |
1114 | // event's date | 1115 | // event's date |
1115 | int yearsAhead = (year - dStart.year()); | 1116 | int yearsAhead = (year - dStart.year()); |
1116 | if (yearsAhead % rFreq == 0) { | 1117 | if (yearsAhead % rFreq == 0) { |
1117 | // The date is in a year which recurs | 1118 | // The date is in a year which recurs |
1118 | if (qd >= dStart | 1119 | if (qd >= dStart |
1119 | && ((rDuration > 0 && qd <= endDate()) || | 1120 | && ((rDuration > 0 && qd <= endDate()) || |
1120 | (rDuration == 0 && qd <= rEndDateTime.date()) || | 1121 | (rDuration == 0 && qd <= rEndDateTime.date()) || |
1121 | rDuration == -1)) { | 1122 | rDuration == -1)) { |
1122 | // The date queried falls within the range of the event. | 1123 | // The date queried falls within the range of the event. |
1123 | for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) { | 1124 | for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) { |
1124 | if (month == *qlin.current()) { | 1125 | if (month == *qlin.current()) { |
1125 | // The month recurs | 1126 | // The month recurs |
1126 | QValueList<int> days; | 1127 | QValueList<int> days; |
1127 | getMonthlyPosDays(days, qd.daysInMonth(), QDate(year, month, 1).dayOfWeek()); | 1128 | getMonthlyPosDays(days, qd.daysInMonth(), QDate(year, month, 1).dayOfWeek()); |
1128 | for (QValueList<int>::Iterator it = days.begin(); it != days.end(); ++it) { | 1129 | for (QValueList<int>::Iterator it = days.begin(); it != days.end(); ++it) { |
1129 | if (*it == day) | 1130 | if (*it == day) |
1130 | return true; | 1131 | return true; |
1131 | } | 1132 | } |
1132 | } | 1133 | } |
1133 | } | 1134 | } |
1134 | } | 1135 | } |
1135 | } | 1136 | } |
1136 | return false; | 1137 | return false; |
1137 | } | 1138 | } |
1138 | 1139 | ||
1139 | bool Recurrence::recursYearlyByDay(const QDate &qd) const | 1140 | bool Recurrence::recursYearlyByDay(const QDate &qd) const |
1140 | { | 1141 | { |
1141 | QDate dStart = mRecurStart.date(); | 1142 | QDate dStart = mRecurStart.date(); |
1142 | // calculate how many years ahead this date is from the original | 1143 | // calculate how many years ahead this date is from the original |
1143 | // event's date | 1144 | // event's date |
1144 | int yearsAhead = (qd.year() - dStart.year()); | 1145 | int yearsAhead = (qd.year() - dStart.year()); |
1145 | if (yearsAhead % rFreq == 0) { | 1146 | if (yearsAhead % rFreq == 0) { |
1146 | // The date is in a year which recurs | 1147 | // The date is in a year which recurs |
1147 | if (qd >= dStart | 1148 | if (qd >= dStart |
1148 | && ((rDuration > 0 && qd <= endDate()) || | 1149 | && ((rDuration > 0 && qd <= endDate()) || |
1149 | (rDuration == 0 && qd <= rEndDateTime.date()) || | 1150 | (rDuration == 0 && qd <= rEndDateTime.date()) || |
1150 | rDuration == -1)) { | 1151 | rDuration == -1)) { |
1151 | // The date queried falls within the range of the event. | 1152 | // The date queried falls within the range of the event. |
1152 | int i = qd.dayOfYear(); | 1153 | int i = qd.dayOfYear(); |
1153 | for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) { | 1154 | for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) { |
1154 | if (i == *qlin.current()) | 1155 | if (i == *qlin.current()) |
1155 | return true; | 1156 | return true; |
1156 | } | 1157 | } |
1157 | } | 1158 | } |
1158 | } | 1159 | } |
1159 | return false; | 1160 | return false; |
1160 | } | 1161 | } |
1161 | 1162 | ||
1162 | /* Get the date of the next recurrence, after the specified date. | 1163 | /* Get the date of the next recurrence, after the specified date. |
1163 | * If 'last' is non-null, '*last' is set to true if the next recurrence is the | 1164 | * If 'last' is non-null, '*last' is set to true if the next recurrence is the |
1164 | * last recurrence, else false. | 1165 | * last recurrence, else false. |
1165 | * Reply = date of next recurrence, or invalid date if none. | 1166 | * Reply = date of next recurrence, or invalid date if none. |
1166 | */ | 1167 | */ |
1167 | QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const | 1168 | QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const |
1168 | { | 1169 | { |
1170 | |||
1169 | if (last) | 1171 | if (last) |
1170 | *last = false; | 1172 | *last = false; |
1171 | QDate dStart = mRecurStart.date(); | 1173 | QDate dStart = mRecurStart.date(); |
1172 | if (preDate < dStart) | 1174 | if (preDate < dStart) |
1173 | return dStart; | 1175 | return dStart; |
1174 | QDate earliestDate = preDate.addDays(1); | 1176 | QDate earliestDate = preDate.addDays(1); |
1175 | QDate nextDate; | 1177 | QDate nextDate; |
1176 | 1178 | ||
1177 | switch (recurs) { | 1179 | switch (recurs) { |
1178 | case rDaily: | 1180 | case rDaily: |
1179 | nextDate = dStart.addDays((dStart.daysTo(preDate)/rFreq + 1) * rFreq); | 1181 | nextDate = dStart.addDays((dStart.daysTo(preDate)/rFreq + 1) * rFreq); |
1180 | break; | 1182 | break; |
1181 | 1183 | ||
1182 | case rWeekly: { | 1184 | case rWeekly: { |
1183 | QDate start = dStart.addDays(1 - dStart.dayOfWeek()); // start of week for dStart | 1185 | QDate start = dStart.addDays(1 - dStart.dayOfWeek()); // start of week for dStart |
1184 | int earliestDayOfWeek = earliestDate.dayOfWeek(); | 1186 | int earliestDayOfWeek = earliestDate.dayOfWeek(); |
1185 | int weeksAhead = start.daysTo(earliestDate) / 7; | 1187 | int weeksAhead = start.daysTo(earliestDate) / 7; |
1186 | int notThisWeek = weeksAhead % rFreq; // zero if this week is a recurring week | 1188 | int notThisWeek = weeksAhead % rFreq; // zero if this week is a recurring week |
1187 | weeksAhead -= notThisWeek; // latest week which recurred | 1189 | weeksAhead -= notThisWeek; // latest week which recurred |
1188 | int weekday = 0; | 1190 | int weekday = 0; |
1189 | // First check for any remaining day this week, if this week is a recurring week | 1191 | // First check for any remaining day this week, if this week is a recurring week |
1190 | if (!notThisWeek) | 1192 | if (!notThisWeek) |
1191 | weekday = getFirstDayInWeek(earliestDayOfWeek); | 1193 | weekday = getFirstDayInWeek(earliestDayOfWeek); |
1192 | // Check for a day in the next scheduled week | 1194 | // Check for a day in the next scheduled week |
1193 | if (!weekday && earliestDayOfWeek > 1) | 1195 | if (!weekday && earliestDayOfWeek > 1) |
1194 | weekday = getFirstDayInWeek(rWeekStart) + rFreq*7; | 1196 | weekday = getFirstDayInWeek(rWeekStart) + rFreq*7; |
1195 | if (weekday) | 1197 | if (weekday) |
1196 | nextDate = start.addDays(weeksAhead*7 + weekday - 1); | 1198 | nextDate = start.addDays(weeksAhead*7 + weekday - 1); |
1197 | break; | 1199 | break; |
1198 | } | 1200 | } |
1199 | case rMonthlyDay: | 1201 | case rMonthlyDay: |
1200 | case rMonthlyPos: { | 1202 | case rMonthlyPos: { |
1201 | int startYear = dStart.year(); | 1203 | int startYear = dStart.year(); |
1202 | int startMonth = dStart.month(); // 1..12 | 1204 | int startMonth = dStart.month(); // 1..12 |
1203 | int earliestYear = earliestDate.year(); | 1205 | int earliestYear = earliestDate.year(); |
1204 | int monthsAhead = (earliestYear - startYear)*12 + earliestDate.month() - startMonth; | 1206 | int monthsAhead = (earliestYear - startYear)*12 + earliestDate.month() - startMonth; |
1205 | int notThisMonth = monthsAhead % rFreq; // zero if this month is a recurring month | 1207 | int notThisMonth = monthsAhead % rFreq; // zero if this month is a recurring month |
1206 | monthsAhead -= notThisMonth; // latest month which recurred | 1208 | monthsAhead -= notThisMonth; // latest month which recurred |
1207 | // Check for the first later day in the current month | 1209 | // Check for the first later day in the current month |
1208 | if (!notThisMonth) | 1210 | if (!notThisMonth) |
1209 | nextDate = getFirstDateInMonth(earliestDate); | 1211 | nextDate = getFirstDateInMonth(earliestDate); |
1210 | if (!nextDate.isValid() && earliestDate.day() > 1) { | 1212 | if (!nextDate.isValid() && earliestDate.day() > 1) { |
1211 | // Check for a day in the next scheduled month | 1213 | // Check for a day in the next scheduled month |
1212 | int months = startMonth - 1 + monthsAhead + rFreq; | 1214 | int months = startMonth - 1 + monthsAhead + rFreq; |
1213 | nextDate = getFirstDateInMonth(QDate(startYear + months/12, months%12 + 1, 1)); | 1215 | nextDate = getFirstDateInMonth(QDate(startYear + months/12, months%12 + 1, 1)); |
1214 | } | 1216 | } |
1215 | break; | 1217 | break; |
1216 | } | 1218 | } |
1217 | case rYearlyMonth: | 1219 | case rYearlyMonth: |
1218 | case rYearlyPos: | 1220 | case rYearlyPos: |
1219 | case rYearlyDay: { | 1221 | case rYearlyDay: { |
1220 | int startYear = dStart.year(); | 1222 | int startYear = dStart.year(); |
1221 | int yearsAhead = earliestDate.year() - startYear; | 1223 | int yearsAhead = earliestDate.year() - startYear; |
1222 | int notThisYear = yearsAhead % rFreq; // zero if this year is a recurring year | 1224 | int notThisYear = yearsAhead % rFreq; // zero if this year is a recurring year |
1223 | yearsAhead -= notThisYear; // latest year which recurred | 1225 | yearsAhead -= notThisYear; // latest year which recurred |
1224 | // Check for the first later date in the current year | 1226 | // Check for the first later date in the current year |
1225 | if (!notThisYear) | 1227 | if (!notThisYear) |
1226 | nextDate = getFirstDateInYear(earliestDate); | 1228 | nextDate = getFirstDateInYear(earliestDate); |
1227 | // Check for a date in the next scheduled year | 1229 | // Check for a date in the next scheduled year |
1228 | if (!nextDate.isValid() && earliestDate.dayOfYear() > 1) | 1230 | if (!nextDate.isValid() && earliestDate.dayOfYear() > 1) |
1229 | nextDate = getFirstDateInYear(QDate(startYear + yearsAhead + rFreq, 1, 1)); | 1231 | nextDate = getFirstDateInYear(QDate(startYear + yearsAhead + rFreq, 1, 1)); |
1230 | break; | 1232 | break; |
1231 | } | 1233 | } |
1232 | case rNone: | 1234 | case rNone: |
1233 | default: | 1235 | default: |
1234 | return QDate(); | 1236 | return QDate(); |
1235 | } | 1237 | } |
1236 | 1238 | ||
1237 | if (rDuration >= 0 && nextDate.isValid()) { | 1239 | if (rDuration >= 0 && nextDate.isValid()) { |
1238 | // Check that the date found is within the range of the recurrence | 1240 | // Check that the date found is within the range of the recurrence |
1239 | QDate end = endDate(); | 1241 | QDate end = endDate(); |
1240 | if (nextDate > end) | 1242 | if (nextDate > end) |
1241 | return QDate(); | 1243 | return QDate(); |
1242 | if (last && nextDate == end) | 1244 | if (last && nextDate == end) |
1243 | *last = true; | 1245 | *last = true; |
1244 | } | 1246 | } |
1245 | return nextDate; | 1247 | return nextDate; |
1246 | } | 1248 | } |
1247 | 1249 | ||
1248 | /* Get the date of the last previous recurrence, before the specified date. | 1250 | /* Get the date of the last previous recurrence, before the specified date. |
1249 | * Reply = date of previous recurrence, or invalid date if none. | 1251 | * Reply = date of previous recurrence, or invalid date if none. |
1250 | */ | 1252 | */ |
1251 | QDate Recurrence::getPreviousDateNoTime(const QDate &afterDate, bool *last) const | 1253 | QDate Recurrence::getPreviousDateNoTime(const QDate &afterDate, bool *last) const |
1252 | { | 1254 | { |
1253 | if (last) | 1255 | if (last) |
1254 | *last = false; | 1256 | *last = false; |
1255 | QDate dStart = mRecurStart.date(); | 1257 | QDate dStart = mRecurStart.date(); |
1256 | QDate latestDate = afterDate.addDays(-1); | 1258 | QDate latestDate = afterDate.addDays(-1); |
1257 | if (latestDate < dStart) | 1259 | if (latestDate < dStart) |
1258 | return QDate(); | 1260 | return QDate(); |
1259 | QDate prevDate; | 1261 | QDate prevDate; |
1260 | 1262 | ||
1261 | switch (recurs) { | 1263 | switch (recurs) { |
1262 | case rDaily: | 1264 | case rDaily: |
1263 | prevDate = dStart.addDays((dStart.daysTo(latestDate) / rFreq) * rFreq); | 1265 | prevDate = dStart.addDays((dStart.daysTo(latestDate) / rFreq) * rFreq); |
1264 | break; | 1266 | break; |
1265 | 1267 | ||
1266 | case rWeekly: { | 1268 | case rWeekly: { |
1267 | QDate start = dStart.addDays(1 - dStart.dayOfWeek()); // start of week for dStart | 1269 | QDate start = dStart.addDays(1 - dStart.dayOfWeek()); // start of week for dStart |
1268 | int latestDayOfWeek = latestDate.dayOfWeek(); | 1270 | int latestDayOfWeek = latestDate.dayOfWeek(); |
1269 | int weeksAhead = start.daysTo(latestDate) / 7; | 1271 | int weeksAhead = start.daysTo(latestDate) / 7; |
1270 | int notThisWeek = weeksAhead % rFreq; // zero if this week is a recurring week | 1272 | int notThisWeek = weeksAhead % rFreq; // zero if this week is a recurring week |
1271 | weeksAhead -= notThisWeek; // latest week which recurred | 1273 | weeksAhead -= notThisWeek; // latest week which recurred |
1272 | int weekday = 0; | 1274 | int weekday = 0; |
1273 | // First check for any previous day this week, if this week is a recurring week | 1275 | // First check for any previous day this week, if this week is a recurring week |
1274 | if (!notThisWeek) | 1276 | if (!notThisWeek) |
1275 | weekday = getLastDayInWeek(latestDayOfWeek); | 1277 | weekday = getLastDayInWeek(latestDayOfWeek); |
1276 | // Check for a day in the previous scheduled week | 1278 | // Check for a day in the previous scheduled week |
1277 | if (!weekday) { | 1279 | if (!weekday) { |
1278 | int weekEnd = (rWeekStart + 5)%7 + 1; | 1280 | int weekEnd = (rWeekStart + 5)%7 + 1; |
1279 | if (latestDayOfWeek < weekEnd) { | 1281 | if (latestDayOfWeek < weekEnd) { |
1280 | if (!notThisWeek) | 1282 | if (!notThisWeek) |
1281 | weeksAhead -= rFreq; | 1283 | weeksAhead -= rFreq; |
1282 | weekday = getLastDayInWeek(weekEnd); | 1284 | weekday = getLastDayInWeek(weekEnd); |
1283 | } | 1285 | } |
1284 | } | 1286 | } |
1285 | if (weekday) | 1287 | if (weekday) |
1286 | prevDate = start.addDays(weeksAhead*7 + weekday - 1); | 1288 | prevDate = start.addDays(weeksAhead*7 + weekday - 1); |
1287 | break; | 1289 | break; |
1288 | } | 1290 | } |
1289 | case rMonthlyDay: | 1291 | case rMonthlyDay: |
1290 | case rMonthlyPos: { | 1292 | case rMonthlyPos: { |
1291 | int startYear = dStart.year(); | 1293 | int startYear = dStart.year(); |
1292 | int startMonth = dStart.month(); // 1..12 | 1294 | int startMonth = dStart.month(); // 1..12 |
1293 | int latestYear = latestDate.year(); | 1295 | int latestYear = latestDate.year(); |
1294 | int monthsAhead = (latestYear - startYear)*12 + latestDate.month() - startMonth; | 1296 | int monthsAhead = (latestYear - startYear)*12 + latestDate.month() - startMonth; |
1295 | int notThisMonth = monthsAhead % rFreq; // zero if this month is a recurring month | 1297 | int notThisMonth = monthsAhead % rFreq; // zero if this month is a recurring month |
1296 | monthsAhead -= notThisMonth; // latest month which recurred | 1298 | monthsAhead -= notThisMonth; // latest month which recurred |
1297 | // Check for the last earlier day in the current month | 1299 | // Check for the last earlier day in the current month |
1298 | if (!notThisMonth) | 1300 | if (!notThisMonth) |
1299 | prevDate = getLastDateInMonth(latestDate); | 1301 | prevDate = getLastDateInMonth(latestDate); |
1300 | if (!prevDate.isValid() && latestDate.day() < latestDate.daysInMonth()) { | 1302 | if (!prevDate.isValid() && latestDate.day() < latestDate.daysInMonth()) { |
1301 | // Check for a day in the previous scheduled month | 1303 | // Check for a day in the previous scheduled month |
1302 | if (!notThisMonth) | 1304 | if (!notThisMonth) |
1303 | monthsAhead -= rFreq; | 1305 | monthsAhead -= rFreq; |
1304 | int months = startMonth + monthsAhead; // get the month after the one that recurs | 1306 | int months = startMonth + monthsAhead; // get the month after the one that recurs |
1305 | prevDate = getLastDateInMonth(QDate(startYear + months/12, months%12 + 1, 1).addDays(-1)); | 1307 | prevDate = getLastDateInMonth(QDate(startYear + months/12, months%12 + 1, 1).addDays(-1)); |
1306 | } | 1308 | } |
1307 | break; | 1309 | break; |
1308 | } | 1310 | } |
1309 | case rYearlyMonth: | 1311 | case rYearlyMonth: |
1310 | case rYearlyPos: | 1312 | case rYearlyPos: |
1311 | case rYearlyDay: { | 1313 | case rYearlyDay: { |
1312 | int startYear = dStart.year(); | 1314 | int startYear = dStart.year(); |
1313 | int yearsAhead = latestDate.year() - startYear; | 1315 | int yearsAhead = latestDate.year() - startYear; |
1314 | int notThisYear = yearsAhead % rFreq; // zero if this year is a recurring year | 1316 | int notThisYear = yearsAhead % rFreq; // zero if this year is a recurring year |
1315 | yearsAhead -= notThisYear; // latest year which recurred | 1317 | yearsAhead -= notThisYear; // latest year which recurred |
1316 | // Check for the first later date in the current year | 1318 | // Check for the first later date in the current year |
1317 | if (!notThisYear) | 1319 | if (!notThisYear) |
1318 | prevDate = getLastDateInYear(latestDate); | 1320 | prevDate = getLastDateInYear(latestDate); |
1319 | if (!prevDate.isValid() && latestDate.dayOfYear() < latestDate.daysInYear()) { | 1321 | if (!prevDate.isValid() && latestDate.dayOfYear() < latestDate.daysInYear()) { |
1320 | // Check for a date in the next scheduled year | 1322 | // Check for a date in the next scheduled year |
1321 | if (!notThisYear) | 1323 | if (!notThisYear) |
1322 | yearsAhead -= rFreq; | 1324 | yearsAhead -= rFreq; |
1323 | prevDate = getLastDateInYear(QDate(startYear + yearsAhead, 12, 31)); | 1325 | prevDate = getLastDateInYear(QDate(startYear + yearsAhead, 12, 31)); |
1324 | } | 1326 | } |
1325 | break; | 1327 | break; |
1326 | } | 1328 | } |
1327 | case rNone: | 1329 | case rNone: |
1328 | default: | 1330 | default: |
1329 | return QDate(); | 1331 | return QDate(); |
1330 | } | 1332 | } |
1331 | 1333 | ||
1332 | if (prevDate.isValid()) { | 1334 | if (prevDate.isValid()) { |
1333 | // Check that the date found is within the range of the recurrence | 1335 | // Check that the date found is within the range of the recurrence |
1334 | if (prevDate < dStart) | 1336 | if (prevDate < dStart) |
1335 | return QDate(); | 1337 | return QDate(); |
1336 | if (rDuration >= 0) { | 1338 | if (rDuration >= 0) { |
1337 | QDate end = endDate(); | 1339 | QDate end = endDate(); |
1338 | if (prevDate >= end) { | 1340 | if (prevDate >= end) { |
1339 | if (last) | 1341 | if (last) |
1340 | *last = true; | 1342 | *last = true; |
1341 | return end; | 1343 | return end; |
1342 | } | 1344 | } |
1343 | } | 1345 | } |
1344 | } | 1346 | } |
1345 | return prevDate; | 1347 | return prevDate; |
1346 | } | 1348 | } |
1347 | 1349 | ||
1348 | void Recurrence::setDailySub(short type, int freq, int duration) | 1350 | void Recurrence::setDailySub(short type, int freq, int duration) |
1349 | { | 1351 | { |
1350 | recurs = type; | 1352 | recurs = type; |
1351 | rFreq = freq; | 1353 | rFreq = freq; |
1352 | rDuration = duration; | 1354 | rDuration = duration; |
1353 | rMonthPositions.clear(); | 1355 | rMonthPositions.clear(); |
1354 | rMonthDays.clear(); | 1356 | rMonthDays.clear(); |
1355 | rYearNums.clear(); | 1357 | rYearNums.clear(); |
1356 | if (type != rDaily) | 1358 | if (type != rDaily) |
1357 | mFloats = false; // sub-daily types can't be floating | 1359 | mFloats = false; // sub-daily types can't be floating |
1358 | 1360 | ||
1359 | if (mParent) mParent->updated(); | 1361 | if (mParent) mParent->updated(); |
1360 | } | 1362 | } |
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp index 09ad0c8..35d4916 100644 --- a/microkde/kdeui/ktoolbar.cpp +++ b/microkde/kdeui/ktoolbar.cpp | |||
@@ -689,385 +689,385 @@ void KToolBar::setCurrentComboItem (int id, int index) | |||
689 | if (comboBox) | 689 | if (comboBox) |
690 | comboBox->setCurrentItem( index ); | 690 | comboBox->setCurrentItem( index ); |
691 | } | 691 | } |
692 | 692 | ||
693 | 693 | ||
694 | void KToolBar::changeComboItem (int id, const QString& text, int index) | 694 | void KToolBar::changeComboItem (int id, const QString& text, int index) |
695 | { | 695 | { |
696 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 696 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
697 | if ( it == id2widget.end() ) | 697 | if ( it == id2widget.end() ) |
698 | return; | 698 | return; |
699 | //US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it ); | 699 | //US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it ); |
700 | QComboBox * comboBox = (QComboBox *)( *it ); | 700 | QComboBox * comboBox = (QComboBox *)( *it ); |
701 | if (comboBox) | 701 | if (comboBox) |
702 | comboBox->changeItem( text, index ); | 702 | comboBox->changeItem( text, index ); |
703 | } | 703 | } |
704 | 704 | ||
705 | 705 | ||
706 | void KToolBar::clearCombo (int id) | 706 | void KToolBar::clearCombo (int id) |
707 | { | 707 | { |
708 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 708 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
709 | if ( it == id2widget.end() ) | 709 | if ( it == id2widget.end() ) |
710 | return; | 710 | return; |
711 | //US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it ); | 711 | //US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it ); |
712 | QComboBox * comboBox = (QComboBox *)( *it ); | 712 | QComboBox * comboBox = (QComboBox *)( *it ); |
713 | if (comboBox) | 713 | if (comboBox) |
714 | comboBox->clear(); | 714 | comboBox->clear(); |
715 | } | 715 | } |
716 | 716 | ||
717 | 717 | ||
718 | QString KToolBar::getComboItem (int id, int index) const | 718 | QString KToolBar::getComboItem (int id, int index) const |
719 | { | 719 | { |
720 | Id2WidgetMap::ConstIterator it = id2widget.find( id ); | 720 | Id2WidgetMap::ConstIterator it = id2widget.find( id ); |
721 | if ( it == id2widget.end() ) | 721 | if ( it == id2widget.end() ) |
722 | return QString::null; | 722 | return QString::null; |
723 | //US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it ); | 723 | //US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it ); |
724 | QComboBox * comboBox = (QComboBox *)( *it ); | 724 | QComboBox * comboBox = (QComboBox *)( *it ); |
725 | return comboBox ? comboBox->text( index ) : QString::null; | 725 | return comboBox ? comboBox->text( index ) : QString::null; |
726 | } | 726 | } |
727 | 727 | ||
728 | 728 | ||
729 | KComboBox * KToolBar::getCombo(int id) | 729 | KComboBox * KToolBar::getCombo(int id) |
730 | { | 730 | { |
731 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 731 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
732 | if ( it == id2widget.end() ) | 732 | if ( it == id2widget.end() ) |
733 | return 0; | 733 | return 0; |
734 | //US return dynamic_cast<KComboBox *>( *it ); | 734 | //US return dynamic_cast<KComboBox *>( *it ); |
735 | return (KComboBox *)( *it ); | 735 | return (KComboBox *)( *it ); |
736 | } | 736 | } |
737 | 737 | ||
738 | 738 | ||
739 | KLineEdit * KToolBar::getLined (int id) | 739 | KLineEdit * KToolBar::getLined (int id) |
740 | { | 740 | { |
741 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 741 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
742 | if ( it == id2widget.end() ) | 742 | if ( it == id2widget.end() ) |
743 | return 0; | 743 | return 0; |
744 | //US return dynamic_cast<KLineEdit *>( *it ); | 744 | //US return dynamic_cast<KLineEdit *>( *it ); |
745 | return (KLineEdit *)( *it ); | 745 | return (KLineEdit *)( *it ); |
746 | } | 746 | } |
747 | 747 | ||
748 | 748 | ||
749 | KToolBarButton * KToolBar::getButton (int id) | 749 | KToolBarButton * KToolBar::getButton (int id) |
750 | { | 750 | { |
751 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 751 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
752 | if ( it == id2widget.end() ) | 752 | if ( it == id2widget.end() ) |
753 | return 0; | 753 | return 0; |
754 | //US return dynamic_cast<KToolBarButton *>( *it ); | 754 | //US return dynamic_cast<KToolBarButton *>( *it ); |
755 | return (KToolBarButton *)( *it ); | 755 | return (KToolBarButton *)( *it ); |
756 | } | 756 | } |
757 | 757 | ||
758 | 758 | ||
759 | void KToolBar::alignItemRight (int id, bool right ) | 759 | void KToolBar::alignItemRight (int id, bool right ) |
760 | { | 760 | { |
761 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 761 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
762 | if ( it == id2widget.end() ) | 762 | if ( it == id2widget.end() ) |
763 | return; | 763 | return; |
764 | if ( rightAligned && !right && (*it) == rightAligned ) | 764 | if ( rightAligned && !right && (*it) == rightAligned ) |
765 | rightAligned = 0; | 765 | rightAligned = 0; |
766 | if ( (*it) && right ) | 766 | if ( (*it) && right ) |
767 | rightAligned = (*it); | 767 | rightAligned = (*it); |
768 | } | 768 | } |
769 | 769 | ||
770 | 770 | ||
771 | QWidget *KToolBar::getWidget (int id) | 771 | QWidget *KToolBar::getWidget (int id) |
772 | { | 772 | { |
773 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 773 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
774 | return ( it == id2widget.end() ) ? 0 : (*it); | 774 | return ( it == id2widget.end() ) ? 0 : (*it); |
775 | } | 775 | } |
776 | 776 | ||
777 | 777 | ||
778 | void KToolBar::setItemAutoSized (int id, bool yes ) | 778 | void KToolBar::setItemAutoSized (int id, bool yes ) |
779 | { | 779 | { |
780 | QWidget *w = getWidget(id); | 780 | QWidget *w = getWidget(id); |
781 | if ( w && yes ) | 781 | if ( w && yes ) |
782 | setStretchableWidget( w ); | 782 | setStretchableWidget( w ); |
783 | } | 783 | } |
784 | 784 | ||
785 | 785 | ||
786 | void KToolBar::clear () | 786 | void KToolBar::clear () |
787 | { | 787 | { |
788 | QToolBar::clear(); | 788 | QToolBar::clear(); |
789 | widget2id.clear(); | 789 | widget2id.clear(); |
790 | id2widget.clear(); | 790 | id2widget.clear(); |
791 | } | 791 | } |
792 | 792 | ||
793 | 793 | ||
794 | void KToolBar::removeItem(int id) | 794 | void KToolBar::removeItem(int id) |
795 | { | 795 | { |
796 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 796 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
797 | if ( it == id2widget.end() ) | 797 | if ( it == id2widget.end() ) |
798 | { | 798 | { |
799 | kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl; | 799 | kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl; |
800 | return; | 800 | return; |
801 | } | 801 | } |
802 | QWidget * w = (*it); | 802 | QWidget * w = (*it); |
803 | id2widget.remove( id ); | 803 | id2widget.remove( id ); |
804 | widget2id.remove( w ); | 804 | widget2id.remove( w ); |
805 | widgets.removeRef( w ); | 805 | widgets.removeRef( w ); |
806 | delete w; | 806 | delete w; |
807 | } | 807 | } |
808 | 808 | ||
809 | 809 | ||
810 | void KToolBar::removeItemDelayed(int id) | 810 | void KToolBar::removeItemDelayed(int id) |
811 | { | 811 | { |
812 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 812 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
813 | if ( it == id2widget.end() ) | 813 | if ( it == id2widget.end() ) |
814 | { | 814 | { |
815 | kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl; | 815 | kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl; |
816 | return; | 816 | return; |
817 | } | 817 | } |
818 | QWidget * w = (*it); | 818 | QWidget * w = (*it); |
819 | id2widget.remove( id ); | 819 | id2widget.remove( id ); |
820 | widget2id.remove( w ); | 820 | widget2id.remove( w ); |
821 | widgets.removeRef( w ); | 821 | widgets.removeRef( w ); |
822 | 822 | ||
823 | w->blockSignals(true); | 823 | w->blockSignals(true); |
824 | d->idleButtons.append(w); | 824 | d->idleButtons.append(w); |
825 | layoutTimer->start( 50, TRUE ); | 825 | layoutTimer->start( 50, TRUE ); |
826 | } | 826 | } |
827 | 827 | ||
828 | 828 | ||
829 | void KToolBar::hideItem (int id) | 829 | void KToolBar::hideItem (int id) |
830 | { | 830 | { |
831 | QWidget *w = getWidget(id); | 831 | QWidget *w = getWidget(id); |
832 | if ( w ) | 832 | if ( w ) |
833 | w->hide(); | 833 | w->hide(); |
834 | } | 834 | } |
835 | 835 | ||
836 | 836 | ||
837 | void KToolBar::showItem (int id) | 837 | void KToolBar::showItem (int id) |
838 | { | 838 | { |
839 | QWidget *w = getWidget(id); | 839 | QWidget *w = getWidget(id); |
840 | if ( w ) | 840 | if ( w ) |
841 | w->show(); | 841 | w->show(); |
842 | } | 842 | } |
843 | 843 | ||
844 | 844 | ||
845 | int KToolBar::itemIndex (int id) | 845 | int KToolBar::itemIndex (int id) |
846 | { | 846 | { |
847 | QWidget *w = getWidget(id); | 847 | QWidget *w = getWidget(id); |
848 | return w ? widgets.findRef(w) : -1; | 848 | return w ? widgets.findRef(w) : -1; |
849 | } | 849 | } |
850 | 850 | ||
851 | 851 | ||
852 | void KToolBar::setFullSize(bool flag ) | 852 | void KToolBar::setFullSize(bool flag ) |
853 | { | 853 | { |
854 | setHorizontalStretchable( flag ); | 854 | setHorizontalStretchable( flag ); |
855 | setVerticalStretchable( flag ); | 855 | setVerticalStretchable( flag ); |
856 | } | 856 | } |
857 | 857 | ||
858 | 858 | ||
859 | bool KToolBar::fullSize() const | 859 | bool KToolBar::fullSize() const |
860 | { | 860 | { |
861 | return isHorizontalStretchable() || isVerticalStretchable(); | 861 | return isHorizontalStretchable() || isVerticalStretchable(); |
862 | } | 862 | } |
863 | 863 | ||
864 | 864 | ||
865 | void KToolBar::enableMoving(bool flag ) | 865 | void KToolBar::enableMoving(bool flag ) |
866 | { | 866 | { |
867 | //US setMovingEnabled(flag); | 867 | //US setMovingEnabled(flag); |
868 | this->mainWindow()->setToolBarsMovable(flag); | 868 | this->mainWindow()->setToolBarsMovable(flag); |
869 | } | 869 | } |
870 | 870 | ||
871 | 871 | ||
872 | void KToolBar::setBarPos (BarPosition bpos) | 872 | void KToolBar::setBarPos (BarPosition bpos) |
873 | { | 873 | { |
874 | if ( !mainWindow() ) | 874 | if ( !mainWindow() ) |
875 | return; | 875 | return; |
876 | //US mainWindow()->moveDockWindow( this, (Dock)bpos ); | 876 | //US mainWindow()->moveDockWindow( this, (Dock)bpos ); |
877 | mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos ); | 877 | mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos ); |
878 | } | 878 | } |
879 | 879 | ||
880 | 880 | ||
881 | KToolBar::BarPosition KToolBar::barPos() const | 881 | const KToolBar::BarPosition KToolBar::barPos() |
882 | { | 882 | { |
883 | if ( !(QMainWindow*)mainWindow() ) | 883 | if ( !(QMainWindow*)mainWindow() ) |
884 | return KToolBar::Top; | 884 | return KToolBar::Top; |
885 | //US Dock dock; | 885 | //US Dock dock; |
886 | QMainWindow::ToolBarDock dock; | 886 | QMainWindow::ToolBarDock dock; |
887 | int dm1, dm2; | 887 | int dm1, dm2; |
888 | bool dm3; | 888 | bool dm3; |
889 | ((QMainWindow*)mainWindow())->getLocation( (QToolBar*)this, dock, dm1, dm3, dm2 ); | 889 | ((QMainWindow*)mainWindow())->getLocation( (QToolBar*)this, dock, dm1, dm3, dm2 ); |
890 | //US if ( dock == DockUnmanaged ) { | 890 | //US if ( dock == DockUnmanaged ) { |
891 | if ( dock == QMainWindow::Unmanaged ) { | 891 | if ( dock == QMainWindow::Unmanaged ) { |
892 | return (KToolBar::BarPosition)Top; | 892 | return (KToolBar::BarPosition)Top; |
893 | } | 893 | } |
894 | return (BarPosition)dock; | 894 | return (BarPosition)dock; |
895 | } | 895 | } |
896 | 896 | ||
897 | 897 | ||
898 | bool KToolBar::enable(BarStatus stat) | 898 | bool KToolBar::enable(BarStatus stat) |
899 | { | 899 | { |
900 | bool mystat = isVisible(); | 900 | bool mystat = isVisible(); |
901 | 901 | ||
902 | if ( (stat == Toggle && mystat) || stat == Hide ) | 902 | if ( (stat == Toggle && mystat) || stat == Hide ) |
903 | hide(); | 903 | hide(); |
904 | else | 904 | else |
905 | show(); | 905 | show(); |
906 | 906 | ||
907 | return isVisible() == mystat; | 907 | return isVisible() == mystat; |
908 | } | 908 | } |
909 | 909 | ||
910 | 910 | ||
911 | void KToolBar::setMaxHeight ( int h ) | 911 | void KToolBar::setMaxHeight ( int h ) |
912 | { | 912 | { |
913 | setMaximumHeight( h ); | 913 | setMaximumHeight( h ); |
914 | } | 914 | } |
915 | 915 | ||
916 | int KToolBar::maxHeight() | 916 | int KToolBar::maxHeight() |
917 | { | 917 | { |
918 | return maximumHeight(); | 918 | return maximumHeight(); |
919 | } | 919 | } |
920 | 920 | ||
921 | 921 | ||
922 | void KToolBar::setMaxWidth (int dw) | 922 | void KToolBar::setMaxWidth (int dw) |
923 | { | 923 | { |
924 | setMaximumWidth( dw ); | 924 | setMaximumWidth( dw ); |
925 | } | 925 | } |
926 | 926 | ||
927 | 927 | ||
928 | int KToolBar::maxWidth() | 928 | int KToolBar::maxWidth() |
929 | { | 929 | { |
930 | return maximumWidth(); | 930 | return maximumWidth(); |
931 | } | 931 | } |
932 | 932 | ||
933 | 933 | ||
934 | void KToolBar::setTitle (const QString& _title) | 934 | void KToolBar::setTitle (const QString& _title) |
935 | { | 935 | { |
936 | setLabel( _title ); | 936 | setLabel( _title ); |
937 | } | 937 | } |
938 | 938 | ||
939 | 939 | ||
940 | void KToolBar::enableFloating (bool ) | 940 | void KToolBar::enableFloating (bool ) |
941 | { | 941 | { |
942 | } | 942 | } |
943 | 943 | ||
944 | 944 | ||
945 | void KToolBar::setIconText(IconText it) | 945 | void KToolBar::setIconText(IconText it) |
946 | { | 946 | { |
947 | setIconText( it, true ); | 947 | setIconText( it, true ); |
948 | } | 948 | } |
949 | 949 | ||
950 | 950 | ||
951 | void KToolBar::setIconText(IconText icontext, bool update) | 951 | void KToolBar::setIconText(IconText icontext, bool update) |
952 | { | 952 | { |
953 | bool doUpdate=false; | 953 | bool doUpdate=false; |
954 | 954 | ||
955 | if (icontext != d->m_iconText) { | 955 | if (icontext != d->m_iconText) { |
956 | d->m_iconText = icontext; | 956 | d->m_iconText = icontext; |
957 | doUpdate=true; | 957 | doUpdate=true; |
958 | } | 958 | } |
959 | 959 | ||
960 | if (update == false) | 960 | if (update == false) |
961 | return; | 961 | return; |
962 | 962 | ||
963 | if (doUpdate) | 963 | if (doUpdate) |
964 | emit modechange(); // tell buttons what happened | 964 | emit modechange(); // tell buttons what happened |
965 | 965 | ||
966 | // ugly hack to force a QMainWindow::triggerLayout( TRUE ) | 966 | // ugly hack to force a QMainWindow::triggerLayout( TRUE ) |
967 | if ( mainWindow() ) { | 967 | if ( mainWindow() ) { |
968 | QMainWindow *mw = mainWindow(); | 968 | QMainWindow *mw = mainWindow(); |
969 | mw->setUpdatesEnabled( FALSE ); | 969 | mw->setUpdatesEnabled( FALSE ); |
970 | mw->setToolBarsMovable( !mw->toolBarsMovable() ); | 970 | mw->setToolBarsMovable( !mw->toolBarsMovable() ); |
971 | mw->setToolBarsMovable( !mw->toolBarsMovable() ); | 971 | mw->setToolBarsMovable( !mw->toolBarsMovable() ); |
972 | mw->setUpdatesEnabled( TRUE ); | 972 | mw->setUpdatesEnabled( TRUE ); |
973 | } | 973 | } |
974 | } | 974 | } |
975 | 975 | ||
976 | 976 | ||
977 | KToolBar::IconText KToolBar::iconText() const | 977 | KToolBar::IconText KToolBar::iconText() const |
978 | { | 978 | { |
979 | return d->m_iconText; | 979 | return d->m_iconText; |
980 | } | 980 | } |
981 | 981 | ||
982 | 982 | ||
983 | void KToolBar::setIconSize(int size) | 983 | void KToolBar::setIconSize(int size) |
984 | { | 984 | { |
985 | setIconSize( size, true ); | 985 | setIconSize( size, true ); |
986 | } | 986 | } |
987 | 987 | ||
988 | void KToolBar::setIconSize(int size, bool update) | 988 | void KToolBar::setIconSize(int size, bool update) |
989 | { | 989 | { |
990 | bool doUpdate=false; | 990 | bool doUpdate=false; |
991 | 991 | ||
992 | if ( size != d->m_iconSize ) { | 992 | if ( size != d->m_iconSize ) { |
993 | d->m_iconSize = size; | 993 | d->m_iconSize = size; |
994 | doUpdate=true; | 994 | doUpdate=true; |
995 | } | 995 | } |
996 | 996 | ||
997 | if (update == false) | 997 | if (update == false) |
998 | return; | 998 | return; |
999 | 999 | ||
1000 | if (doUpdate) | 1000 | if (doUpdate) |
1001 | emit modechange(); // tell buttons what happened | 1001 | emit modechange(); // tell buttons what happened |
1002 | 1002 | ||
1003 | // ugly hack to force a QMainWindow::triggerLayout( TRUE ) | 1003 | // ugly hack to force a QMainWindow::triggerLayout( TRUE ) |
1004 | if ( mainWindow() ) { | 1004 | if ( mainWindow() ) { |
1005 | QMainWindow *mw = mainWindow(); | 1005 | QMainWindow *mw = mainWindow(); |
1006 | mw->setUpdatesEnabled( FALSE ); | 1006 | mw->setUpdatesEnabled( FALSE ); |
1007 | mw->setToolBarsMovable( !mw->toolBarsMovable() ); | 1007 | mw->setToolBarsMovable( !mw->toolBarsMovable() ); |
1008 | mw->setToolBarsMovable( !mw->toolBarsMovable() ); | 1008 | mw->setToolBarsMovable( !mw->toolBarsMovable() ); |
1009 | mw->setUpdatesEnabled( TRUE ); | 1009 | mw->setUpdatesEnabled( TRUE ); |
1010 | } | 1010 | } |
1011 | } | 1011 | } |
1012 | 1012 | ||
1013 | 1013 | ||
1014 | int KToolBar::iconSize() const | 1014 | int KToolBar::iconSize() const |
1015 | { | 1015 | { |
1016 | /*US | 1016 | /*US |
1017 | if ( !d->m_iconSize ) // default value? | 1017 | if ( !d->m_iconSize ) // default value? |
1018 | { | 1018 | { |
1019 | if (!::qstrcmp(QObject::name(), "mainToolBar")) | 1019 | if (!::qstrcmp(QObject::name(), "mainToolBar")) |
1020 | return KGlobal::iconLoader()->currentSize(KIcon::MainToolbar); | 1020 | return KGlobal::iconLoader()->currentSize(KIcon::MainToolbar); |
1021 | else | 1021 | else |
1022 | return KGlobal::iconLoader()->currentSize(KIcon::Toolbar); | 1022 | return KGlobal::iconLoader()->currentSize(KIcon::Toolbar); |
1023 | } | 1023 | } |
1024 | return d->m_iconSize; | 1024 | return d->m_iconSize; |
1025 | */ | 1025 | */ |
1026 | int ret = 18; | 1026 | int ret = 18; |
1027 | if ( QApplication::desktop()->width() > 320 ) | 1027 | if ( QApplication::desktop()->width() > 320 ) |
1028 | ret = 30; | 1028 | ret = 30; |
1029 | return ret; | 1029 | return ret; |
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | 1032 | ||
1033 | void KToolBar::setEnableContextMenu(bool enable ) | 1033 | void KToolBar::setEnableContextMenu(bool enable ) |
1034 | { | 1034 | { |
1035 | d->m_enableContext = enable; | 1035 | d->m_enableContext = enable; |
1036 | } | 1036 | } |
1037 | 1037 | ||
1038 | 1038 | ||
1039 | bool KToolBar::contextMenuEnabled() const | 1039 | bool KToolBar::contextMenuEnabled() const |
1040 | { | 1040 | { |
1041 | return d->m_enableContext; | 1041 | return d->m_enableContext; |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | 1044 | ||
1045 | void KToolBar::setItemNoStyle(int id, bool no_style ) | 1045 | void KToolBar::setItemNoStyle(int id, bool no_style ) |
1046 | { | 1046 | { |
1047 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 1047 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
1048 | if ( it == id2widget.end() ) | 1048 | if ( it == id2widget.end() ) |
1049 | return; | 1049 | return; |
1050 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); | 1050 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); |
1051 | KToolBarButton * button = (KToolBarButton *)( *it ); | 1051 | KToolBarButton * button = (KToolBarButton *)( *it ); |
1052 | if (button) | 1052 | if (button) |
1053 | button->setNoStyle( no_style ); | 1053 | button->setNoStyle( no_style ); |
1054 | } | 1054 | } |
1055 | 1055 | ||
1056 | 1056 | ||
1057 | void KToolBar::setFlat (bool flag) | 1057 | void KToolBar::setFlat (bool flag) |
1058 | { | 1058 | { |
1059 | if ( !mainWindow() ) | 1059 | if ( !mainWindow() ) |
1060 | return; | 1060 | return; |
1061 | if ( flag ) | 1061 | if ( flag ) |
1062 | //US mainWindow()->moveDockWindow( this, DockMinimized ); | 1062 | //US mainWindow()->moveDockWindow( this, DockMinimized ); |
1063 | mainWindow()->moveToolBar( this, QMainWindow::Minimized ); | 1063 | mainWindow()->moveToolBar( this, QMainWindow::Minimized ); |
1064 | else | 1064 | else |
1065 | //US mainWindow()->moveDockWindow( this, DockTop ); | 1065 | //US mainWindow()->moveDockWindow( this, DockTop ); |
1066 | mainWindow()->moveToolBar( this, QMainWindow::Top ); | 1066 | mainWindow()->moveToolBar( this, QMainWindow::Top ); |
1067 | // And remember to save the new look later | 1067 | // And remember to save the new look later |
1068 | /*US | 1068 | /*US |
1069 | if ( mainWindow()->inherits( "KMainWindow" ) ) | 1069 | if ( mainWindow()->inherits( "KMainWindow" ) ) |
1070 | static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); | 1070 | static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); |
1071 | */ | 1071 | */ |
1072 | } | 1072 | } |
1073 | 1073 | ||
diff --git a/microkde/kdeui/ktoolbar.h b/microkde/kdeui/ktoolbar.h index 49ff856..7a5c114 100644 --- a/microkde/kdeui/ktoolbar.h +++ b/microkde/kdeui/ktoolbar.h | |||
@@ -557,385 +557,385 @@ public: | |||
557 | 557 | ||
558 | /** | 558 | /** |
559 | * Inserts @p text in combobox @p id at position @p index. | 559 | * Inserts @p text in combobox @p id at position @p index. |
560 | */ | 560 | */ |
561 | void insertComboItem (int id, const QString& text, int index); | 561 | void insertComboItem (int id, const QString& text, int index); |
562 | 562 | ||
563 | /** | 563 | /** |
564 | * Inserts @p list in combobox @p id at position @p index. | 564 | * Inserts @p list in combobox @p id at position @p index. |
565 | */ | 565 | */ |
566 | void insertComboList (int id, const QStringList &list, int index); | 566 | void insertComboList (int id, const QStringList &list, int index); |
567 | 567 | ||
568 | /** | 568 | /** |
569 | * Removes item @p index from combobox @p id. | 569 | * Removes item @p index from combobox @p id. |
570 | */ | 570 | */ |
571 | void removeComboItem (int id, int index); | 571 | void removeComboItem (int id, int index); |
572 | 572 | ||
573 | /** | 573 | /** |
574 | * Sets item @p index to be current item in combobox @p id. | 574 | * Sets item @p index to be current item in combobox @p id. |
575 | */ | 575 | */ |
576 | void setCurrentComboItem (int id, int index); | 576 | void setCurrentComboItem (int id, int index); |
577 | 577 | ||
578 | /** | 578 | /** |
579 | * Changes item @p index in combobox @p id to text. | 579 | * Changes item @p index in combobox @p id to text. |
580 | * | 580 | * |
581 | * @p index = -1 refers current item (one displayed in the button). | 581 | * @p index = -1 refers current item (one displayed in the button). |
582 | */ | 582 | */ |
583 | void changeComboItem (int id, const QString& text, int index=-1); | 583 | void changeComboItem (int id, const QString& text, int index=-1); |
584 | 584 | ||
585 | /** | 585 | /** |
586 | * Clears the combobox @p id. | 586 | * Clears the combobox @p id. |
587 | * | 587 | * |
588 | * Does not delete it or hide it. | 588 | * Does not delete it or hide it. |
589 | */ | 589 | */ |
590 | void clearCombo (int id); | 590 | void clearCombo (int id); |
591 | 591 | ||
592 | /** | 592 | /** |
593 | * Returns text of item @p index from combobox @p id. | 593 | * Returns text of item @p index from combobox @p id. |
594 | * | 594 | * |
595 | * @p index = -1 refers to current item. | 595 | * @p index = -1 refers to current item. |
596 | */ | 596 | */ |
597 | 597 | ||
598 | QString getComboItem (int id, int index=-1) const; | 598 | QString getComboItem (int id, int index=-1) const; |
599 | 599 | ||
600 | /** | 600 | /** |
601 | * Returns a pointer to the combobox. | 601 | * Returns a pointer to the combobox. |
602 | * | 602 | * |
603 | * Example: | 603 | * Example: |
604 | * <pre> | 604 | * <pre> |
605 | * KComboBox *combo = toolbar->getCombo(combo_id); | 605 | * KComboBox *combo = toolbar->getCombo(combo_id); |
606 | * </pre> | 606 | * </pre> |
607 | * That way you can get access to other public methods | 607 | * That way you can get access to other public methods |
608 | * that @ref KComboBox provides. | 608 | * that @ref KComboBox provides. |
609 | */ | 609 | */ |
610 | KComboBox * getCombo(int id); | 610 | KComboBox * getCombo(int id); |
611 | 611 | ||
612 | /** | 612 | /** |
613 | * Returns a pointer to KToolBarLined. | 613 | * Returns a pointer to KToolBarLined. |
614 | * | 614 | * |
615 | * Example: | 615 | * Example: |
616 | * <pre> | 616 | * <pre> |
617 | * KLineEdit * lined = toolbar->getKToolBarLined(lined_id); | 617 | * KLineEdit * lined = toolbar->getKToolBarLined(lined_id); |
618 | * </pre> | 618 | * </pre> |
619 | * That way you can get access to other public methods | 619 | * That way you can get access to other public methods |
620 | * that @ref KLineEdit provides. @ref KLineEdit is the same thing | 620 | * that @ref KLineEdit provides. @ref KLineEdit is the same thing |
621 | * as @ref QLineEdit plus completion signals. | 621 | * as @ref QLineEdit plus completion signals. |
622 | */ | 622 | */ |
623 | KLineEdit * getLined (int id); | 623 | KLineEdit * getLined (int id); |
624 | 624 | ||
625 | /** | 625 | /** |
626 | * Returns a pointer to KToolBarButton. | 626 | * Returns a pointer to KToolBarButton. |
627 | * | 627 | * |
628 | * Example: | 628 | * Example: |
629 | * <pre> | 629 | * <pre> |
630 | * KToolBarButton * button = toolbar->getButton(button_id); | 630 | * KToolBarButton * button = toolbar->getButton(button_id); |
631 | * </pre> | 631 | * </pre> |
632 | * That way you can get access to other public methods | 632 | * That way you can get access to other public methods |
633 | * that @ref KToolBarButton provides. | 633 | * that @ref KToolBarButton provides. |
634 | * | 634 | * |
635 | * Using this method is not recommended. | 635 | * Using this method is not recommended. |
636 | */ | 636 | */ |
637 | KToolBarButton * getButton (int id); | 637 | KToolBarButton * getButton (int id); |
638 | 638 | ||
639 | /** | 639 | /** |
640 | * Align item to the right. | 640 | * Align item to the right. |
641 | * | 641 | * |
642 | * This works only if toolbar is set to full width. | 642 | * This works only if toolbar is set to full width. |
643 | * @see setFullWidth() | 643 | * @see setFullWidth() |
644 | */ | 644 | */ |
645 | void alignItemRight (int id, bool right = true); | 645 | void alignItemRight (int id, bool right = true); |
646 | 646 | ||
647 | /** | 647 | /** |
648 | * Returns a pointer to an inserted widget. | 648 | * Returns a pointer to an inserted widget. |
649 | * | 649 | * |
650 | * Wrong ids are not tested. | 650 | * Wrong ids are not tested. |
651 | * You can do with this whatever you want, | 651 | * You can do with this whatever you want, |
652 | * except change its height (hardcoded). If you change its width | 652 | * except change its height (hardcoded). If you change its width |
653 | * you will probably have to call QToolBar::updateRects(true) | 653 | * you will probably have to call QToolBar::updateRects(true) |
654 | * @see QWidget | 654 | * @see QWidget |
655 | * @see updateRects() | 655 | * @see updateRects() |
656 | * | 656 | * |
657 | * KDE4: make this const! | 657 | * KDE4: make this const! |
658 | */ | 658 | */ |
659 | QWidget *getWidget (int id); | 659 | QWidget *getWidget (int id); |
660 | 660 | ||
661 | /** | 661 | /** |
662 | * Set item autosized. | 662 | * Set item autosized. |
663 | * | 663 | * |
664 | * This works only if the toolbar is set to full width. | 664 | * This works only if the toolbar is set to full width. |
665 | * Only @p one item can be autosized, and it has to be | 665 | * Only @p one item can be autosized, and it has to be |
666 | * the last left-aligned item. Items that come after this must be right | 666 | * the last left-aligned item. Items that come after this must be right |
667 | * aligned. Items that can be right aligned are Lineds, Frames, Widgets and | 667 | * aligned. Items that can be right aligned are Lineds, Frames, Widgets and |
668 | * Combos. An autosized item will resize itself whenever the toolbar geometry | 668 | * Combos. An autosized item will resize itself whenever the toolbar geometry |
669 | * changes to the last right-aligned item (or to end of toolbar if there | 669 | * changes to the last right-aligned item (or to end of toolbar if there |
670 | * are no right-aligned items.) | 670 | * are no right-aligned items.) |
671 | * @see setFullWidth() | 671 | * @see setFullWidth() |
672 | * @see alignItemRight() | 672 | * @see alignItemRight() |
673 | */ | 673 | */ |
674 | void setItemAutoSized (int id, bool yes = true); | 674 | void setItemAutoSized (int id, bool yes = true); |
675 | 675 | ||
676 | /** | 676 | /** |
677 | * Remove all items. | 677 | * Remove all items. |
678 | * | 678 | * |
679 | * The toolbar is redrawn after it. | 679 | * The toolbar is redrawn after it. |
680 | */ | 680 | */ |
681 | void clear (); | 681 | void clear (); |
682 | 682 | ||
683 | /** | 683 | /** |
684 | * Remove item @p id. | 684 | * Remove item @p id. |
685 | * | 685 | * |
686 | * Item is deleted. Toolbar is redrawn after it. | 686 | * Item is deleted. Toolbar is redrawn after it. |
687 | */ | 687 | */ |
688 | void removeItem (int id); | 688 | void removeItem (int id); |
689 | 689 | ||
690 | /** | 690 | /** |
691 | * Remove item @p id. | 691 | * Remove item @p id. |
692 | * | 692 | * |
693 | * Item is deleted when toolbar is redrawn. | 693 | * Item is deleted when toolbar is redrawn. |
694 | */ | 694 | */ |
695 | void removeItemDelayed (int id); | 695 | void removeItemDelayed (int id); |
696 | 696 | ||
697 | /** | 697 | /** |
698 | * Hide item. | 698 | * Hide item. |
699 | */ | 699 | */ |
700 | void hideItem (int id); | 700 | void hideItem (int id); |
701 | 701 | ||
702 | /** | 702 | /** |
703 | * Show item. | 703 | * Show item. |
704 | */ | 704 | */ |
705 | void showItem (int id); | 705 | void showItem (int id); |
706 | 706 | ||
707 | /** | 707 | /** |
708 | * Returns the index of the given item. | 708 | * Returns the index of the given item. |
709 | * | 709 | * |
710 | * KDE4: make this const! | 710 | * KDE4: make this const! |
711 | */ | 711 | */ |
712 | int itemIndex (int id); | 712 | int itemIndex (int id); |
713 | 713 | ||
714 | /** | 714 | /** |
715 | * Set toolbar to full parent size (default). | 715 | * Set toolbar to full parent size (default). |
716 | * | 716 | * |
717 | * In full size mode the bar | 717 | * In full size mode the bar |
718 | * extends over the parent's full width or height. If the mode is disabled | 718 | * extends over the parent's full width or height. If the mode is disabled |
719 | * the toolbar tries to take as much space as it needs without wrapping, but | 719 | * the toolbar tries to take as much space as it needs without wrapping, but |
720 | * it does not exceed the parent box. You can force a certain width or | 720 | * it does not exceed the parent box. You can force a certain width or |
721 | * height with @ref setMaxWidth() or @ref setMaxHeight(). | 721 | * height with @ref setMaxWidth() or @ref setMaxHeight(). |
722 | * | 722 | * |
723 | * If you want to use right-aligned items or auto-sized items you must use | 723 | * If you want to use right-aligned items or auto-sized items you must use |
724 | * full size mode. | 724 | * full size mode. |
725 | */ | 725 | */ |
726 | void setFullSize(bool flag = true); | 726 | void setFullSize(bool flag = true); |
727 | 727 | ||
728 | /** | 728 | /** |
729 | * @return @p true if the full-size mode is enabled. Otherwise | 729 | * @return @p true if the full-size mode is enabled. Otherwise |
730 | * it returns @false. | 730 | * it returns @false. |
731 | */ | 731 | */ |
732 | bool fullSize() const; | 732 | bool fullSize() const; |
733 | 733 | ||
734 | /** | 734 | /** |
735 | * @deprecated use setMovingEnabled(bool) instead. | 735 | * @deprecated use setMovingEnabled(bool) instead. |
736 | * Enable or disable moving of toolbar. | 736 | * Enable or disable moving of toolbar. |
737 | */ | 737 | */ |
738 | void enableMoving(bool flag = true); | 738 | void enableMoving(bool flag = true); |
739 | 739 | ||
740 | /** | 740 | /** |
741 | * Set position of toolbar. | 741 | * Set position of toolbar. |
742 | * @see BarPosition() | 742 | * @see BarPosition() |
743 | */ | 743 | */ |
744 | void setBarPos (BarPosition bpos); | 744 | void setBarPos (BarPosition bpos); |
745 | 745 | ||
746 | /** | 746 | /** |
747 | * Returns position of toolbar. | 747 | * Returns position of toolbar. |
748 | */ | 748 | */ |
749 | BarPosition barPos() const; | 749 | const BarPosition barPos(); |
750 | 750 | ||
751 | /** | 751 | /** |
752 | * @deprecated | 752 | * @deprecated |
753 | * Show, hide, or toggle toolbar. | 753 | * Show, hide, or toggle toolbar. |
754 | * | 754 | * |
755 | * This method is provided for compatibility only, | 755 | * This method is provided for compatibility only, |
756 | * please use show() and/or hide() instead. | 756 | * please use show() and/or hide() instead. |
757 | * @see BarStatus | 757 | * @see BarStatus |
758 | */ | 758 | */ |
759 | bool enable(BarStatus stat); | 759 | bool enable(BarStatus stat); |
760 | 760 | ||
761 | /** | 761 | /** |
762 | * @deprecated | 762 | * @deprecated |
763 | * Use setMaximumHeight() instead. | 763 | * Use setMaximumHeight() instead. |
764 | */ | 764 | */ |
765 | void setMaxHeight (int h); // Set max height for vertical toolbars | 765 | void setMaxHeight (int h); // Set max height for vertical toolbars |
766 | 766 | ||
767 | /** | 767 | /** |
768 | * @deprecated | 768 | * @deprecated |
769 | * Use maximumHeight() instead. | 769 | * Use maximumHeight() instead. |
770 | * Returns the value that was set with @ref setMaxHeight(). | 770 | * Returns the value that was set with @ref setMaxHeight(). |
771 | */ | 771 | */ |
772 | int maxHeight(); | 772 | int maxHeight(); |
773 | 773 | ||
774 | /** | 774 | /** |
775 | * @deprecated | 775 | * @deprecated |
776 | * Use setMaximumWidth() instead. | 776 | * Use setMaximumWidth() instead. |
777 | * Set maximal width of horizontal (top or bottom) toolbar. | 777 | * Set maximal width of horizontal (top or bottom) toolbar. |
778 | */ | 778 | */ |
779 | void setMaxWidth (int dw); | 779 | void setMaxWidth (int dw); |
780 | 780 | ||
781 | /** | 781 | /** |
782 | * @deprecated | 782 | * @deprecated |
783 | * Use maximumWidth() instead. | 783 | * Use maximumWidth() instead. |
784 | * Returns the value that was set with @ref setMaxWidth(). | 784 | * Returns the value that was set with @ref setMaxWidth(). |
785 | */ | 785 | */ |
786 | int maxWidth(); | 786 | int maxWidth(); |
787 | 787 | ||
788 | /** | 788 | /** |
789 | * Set title for toolbar when it floats. | 789 | * Set title for toolbar when it floats. |
790 | * | 790 | * |
791 | * Titles are however not (yet) | 791 | * Titles are however not (yet) |
792 | * visible. You can't change toolbar's title while it's floating. | 792 | * visible. You can't change toolbar's title while it's floating. |
793 | */ | 793 | */ |
794 | void setTitle (const QString& _title); | 794 | void setTitle (const QString& _title); |
795 | 795 | ||
796 | /** | 796 | /** |
797 | * @deprecated | 797 | * @deprecated |
798 | * Use enableMoving() instead. | 798 | * Use enableMoving() instead. |
799 | */ | 799 | */ |
800 | void enableFloating (bool arrrrrrgh); | 800 | void enableFloating (bool arrrrrrgh); |
801 | 801 | ||
802 | /** | 802 | /** |
803 | * Set the kind of painting for buttons. | 803 | * Set the kind of painting for buttons. |
804 | * | 804 | * |
805 | * Choose from: | 805 | * Choose from: |
806 | * @li IconOnly (only icons), | 806 | * @li IconOnly (only icons), |
807 | * @li IconTextRight (icon and text, text is left from icons), | 807 | * @li IconTextRight (icon and text, text is left from icons), |
808 | * @li TextOnly (only text), | 808 | * @li TextOnly (only text), |
809 | * @li IconTextBottom (icons and text, text is under icons). | 809 | * @li IconTextBottom (icons and text, text is under icons). |
810 | * @see IconText | 810 | * @see IconText |
811 | * | 811 | * |
812 | */ | 812 | */ |
813 | void setIconText(IconText it); | 813 | void setIconText(IconText it); |
814 | // Note: don't merge with the next one, it breaks Qt properties | 814 | // Note: don't merge with the next one, it breaks Qt properties |
815 | 815 | ||
816 | /** | 816 | /** |
817 | * Similar to @ref setIconText(IconText it) but allows you to | 817 | * Similar to @ref setIconText(IconText it) but allows you to |
818 | * disable or enable updating. If @p update is false, then the | 818 | * disable or enable updating. If @p update is false, then the |
819 | * buttons will not be updated. This is useful only if you know | 819 | * buttons will not be updated. This is useful only if you know |
820 | * that you will be forcing an update later. | 820 | * that you will be forcing an update later. |
821 | */ | 821 | */ |
822 | void setIconText(IconText it, bool update); | 822 | void setIconText(IconText it, bool update); |
823 | 823 | ||
824 | /** | 824 | /** |
825 | * @return The current text style for buttons. | 825 | * @return The current text style for buttons. |
826 | */ | 826 | */ |
827 | IconText iconText() const; | 827 | IconText iconText() const; |
828 | 828 | ||
829 | /** | 829 | /** |
830 | * Set the icon size to load. Usually you should not call | 830 | * Set the icon size to load. Usually you should not call |
831 | * this, the icon size is taken care of by KIconLoader | 831 | * this, the icon size is taken care of by KIconLoader |
832 | * and globally configured. | 832 | * and globally configured. |
833 | * By default, the toolbar will load icons of size 32 for main | 833 | * By default, the toolbar will load icons of size 32 for main |
834 | * toolbars and 22 for other toolbars | 834 | * toolbars and 22 for other toolbars |
835 | * @see KIconLoader. | 835 | * @see KIconLoader. |
836 | * | 836 | * |
837 | * @param size The size to use | 837 | * @param size The size to use |
838 | */ | 838 | */ |
839 | void setIconSize(int size); | 839 | void setIconSize(int size); |
840 | // Note: don't merge with the next one, it breaks Qt properties | 840 | // Note: don't merge with the next one, it breaks Qt properties |
841 | 841 | ||
842 | /** | 842 | /** |
843 | * Same as @ref setIconText(int size) but allows you | 843 | * Same as @ref setIconText(int size) but allows you |
844 | * to disable the toolbar update. | 844 | * to disable the toolbar update. |
845 | * | 845 | * |
846 | * @param size The size to use | 846 | * @param size The size to use |
847 | * @param update If true, then the toolbar will be updated after | 847 | * @param update If true, then the toolbar will be updated after |
848 | * this | 848 | * this |
849 | */ | 849 | */ |
850 | void setIconSize(int size, bool update); | 850 | void setIconSize(int size, bool update); |
851 | 851 | ||
852 | /** | 852 | /** |
853 | * @return The current icon size for buttons. | 853 | * @return The current icon size for buttons. |
854 | */ | 854 | */ |
855 | int iconSize() const; | 855 | int iconSize() const; |
856 | 856 | ||
857 | /** | 857 | /** |
858 | * This allows you to enable or disable the context menu. | 858 | * This allows you to enable or disable the context menu. |
859 | * | 859 | * |
860 | * @param enable If false, then the context menu will be disabled | 860 | * @param enable If false, then the context menu will be disabled |
861 | */ | 861 | */ |
862 | void setEnableContextMenu(bool enable = true); | 862 | void setEnableContextMenu(bool enable = true); |
863 | 863 | ||
864 | /** | 864 | /** |
865 | * Returns whether or not the context menu is disabled | 865 | * Returns whether or not the context menu is disabled |
866 | * | 866 | * |
867 | * @return The context menu state | 867 | * @return The context menu state |
868 | */ | 868 | */ |
869 | bool contextMenuEnabled() const; | 869 | bool contextMenuEnabled() const; |
870 | 870 | ||
871 | /** | 871 | /** |
872 | * This will inform a toolbar button to ignore certain style | 872 | * This will inform a toolbar button to ignore certain style |
873 | * changes. Specifically, it will ignore IconText (always IconOnly) | 873 | * changes. Specifically, it will ignore IconText (always IconOnly) |
874 | * and will not allow image effects to apply. | 874 | * and will not allow image effects to apply. |
875 | * | 875 | * |
876 | * @param id The button to exclude from styles | 876 | * @param id The button to exclude from styles |
877 | * @param no_style If true, then it is excluded (default: true). | 877 | * @param no_style If true, then it is excluded (default: true). |
878 | */ | 878 | */ |
879 | void setItemNoStyle(int id, bool no_style = true); | 879 | void setItemNoStyle(int id, bool no_style = true); |
880 | 880 | ||
881 | void setFlat (bool flag); | 881 | void setFlat (bool flag); |
882 | 882 | ||
883 | /** | 883 | /** |
884 | * @return the number of items in the toolbar | 884 | * @return the number of items in the toolbar |
885 | */ | 885 | */ |
886 | int count() const; | 886 | int count() const; |
887 | 887 | ||
888 | /** | 888 | /** |
889 | * Instruct the toolbar to save it's current state to either the app | 889 | * Instruct the toolbar to save it's current state to either the app |
890 | * config file or to the XML-GUI resource file (whichever has | 890 | * config file or to the XML-GUI resource file (whichever has |
891 | * precedence). | 891 | * precedence). |
892 | */ | 892 | */ |
893 | void saveState(); | 893 | void saveState(); |
894 | 894 | ||
895 | /** | 895 | /** |
896 | * Save the toolbar settings to group @p configGroup in @p config. | 896 | * Save the toolbar settings to group @p configGroup in @p config. |
897 | */ | 897 | */ |
898 | void saveSettings(KConfig *config, const QString &configGroup); | 898 | void saveSettings(KConfig *config, const QString &configGroup); |
899 | 899 | ||
900 | /** | 900 | /** |
901 | * Read the toolbar settings from group @p configGroup in @p config | 901 | * Read the toolbar settings from group @p configGroup in @p config |
902 | * and apply them. | 902 | * and apply them. |
903 | */ | 903 | */ |
904 | void applySettings(KConfig *config, const QString &configGroup); | 904 | void applySettings(KConfig *config, const QString &configGroup); |
905 | 905 | ||
906 | /** | 906 | /** |
907 | * Tell the toolbar what XML-GUI resource file it should use to save | 907 | * Tell the toolbar what XML-GUI resource file it should use to save |
908 | * it's state. The state of the toolbar (position, size, etc) is | 908 | * it's state. The state of the toolbar (position, size, etc) is |
909 | * saved in KConfig files if the application does not use XML-GUI.. | 909 | * saved in KConfig files if the application does not use XML-GUI.. |
910 | * but if the app does, then it's saved the XML file. This function | 910 | * but if the app does, then it's saved the XML file. This function |
911 | * allows this to happen. | 911 | * allows this to happen. |
912 | * | 912 | * |
913 | * @param xmlfile The XML-GUI resource file to write to | 913 | * @param xmlfile The XML-GUI resource file to write to |
914 | * @param xml The DOM document for the XML-GUI building | 914 | * @param xml The DOM document for the XML-GUI building |
915 | */ | 915 | */ |
916 | // void setXML(const QString& xmlfile, const QDomDocument& xml); | 916 | // void setXML(const QString& xmlfile, const QDomDocument& xml); |
917 | /* @internal */ | 917 | /* @internal */ |
918 | void setXMLGUIClient( KXMLGUIClient *client ); | 918 | void setXMLGUIClient( KXMLGUIClient *client ); |
919 | 919 | ||
920 | /** | 920 | /** |
921 | * Assign a (translated) text to this toolbar. This is used | 921 | * Assign a (translated) text to this toolbar. This is used |
922 | * for the tooltip on the handle, and when listing the toolbars. | 922 | * for the tooltip on the handle, and when listing the toolbars. |
923 | */ | 923 | */ |
924 | void setText( const QString & txt ); | 924 | void setText( const QString & txt ); |
925 | 925 | ||
926 | /** | 926 | /** |
927 | * @return the toolbar's text. | 927 | * @return the toolbar's text. |
928 | */ | 928 | */ |
929 | QString text() const; | 929 | QString text() const; |
930 | 930 | ||
931 | void setStretchableWidget( QWidget *w ); | 931 | void setStretchableWidget( QWidget *w ); |
932 | QSizePolicy sizePolicy() const; | 932 | QSizePolicy sizePolicy() const; |
933 | bool highlight() const; | 933 | bool highlight() const; |
934 | QSize sizeHint() const; | 934 | QSize sizeHint() const; |
935 | QSize minimumSizeHint() const; | 935 | QSize minimumSizeHint() const; |
936 | QSize minimumSize() const; | 936 | QSize minimumSize() const; |
937 | 937 | ||
938 | void hide(); | 938 | void hide(); |
939 | void show(); | 939 | void show(); |
940 | 940 | ||
941 | void updateRects( bool = FALSE ) {} | 941 | void updateRects( bool = FALSE ) {} |