-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 4 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.cpp | 4 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 4 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 2 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.h | 2 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 2 | ||||
-rw-r--r-- | korganizer/searchdialog.cpp | 22 | ||||
-rw-r--r-- | korganizer/timespanview.cpp | 2 | ||||
-rw-r--r-- | libkcal/icalformatimpl.cpp | 6 | ||||
-rw-r--r-- | microkde/KDGanttMinimizeSplitter.cpp | 10 | ||||
-rw-r--r-- | microkde/kcalendarsystemgregorian.cpp | 8 |
11 files changed, 31 insertions, 35 deletions
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index 6fcd73f..9d8c5ce 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp | |||
@@ -269,113 +269,113 @@ void KAddressBookCardView::readConfig(KConfig *config) | |||
269 | mCardView->setItemWidth( config->readNumEntry( "ItemWidth", 200 ) ); | 269 | mCardView->setItemWidth( config->readNumEntry( "ItemWidth", 200 ) ); |
270 | mCardView->setItemMargin( config->readNumEntry( "ItemMargin", 0 ) ); | 270 | mCardView->setItemMargin( config->readNumEntry( "ItemMargin", 0 ) ); |
271 | mCardView->setItemSpacing( config->readNumEntry( "ItemSpacing", 10 ) ); | 271 | mCardView->setItemSpacing( config->readNumEntry( "ItemSpacing", 10 ) ); |
272 | mCardView->setSeparatorWidth( config->readNumEntry( "SeparatorWidth", 2 ) ); | 272 | mCardView->setSeparatorWidth( config->readNumEntry( "SeparatorWidth", 2 ) ); |
273 | 273 | ||
274 | #if 0 | 274 | #if 0 |
275 | // LR KABPrefs::instance()->mHonorSingleClick is handled and fixed in cardviews contentsMouseDoubleClickEven | 275 | // LR KABPrefs::instance()->mHonorSingleClick is handled and fixed in cardviews contentsMouseDoubleClickEven |
276 | disconnect(mCardView, SIGNAL(executed(CardViewItem *)), | 276 | disconnect(mCardView, SIGNAL(executed(CardViewItem *)), |
277 | this, SLOT(addresseeExecuted(CardViewItem *))); | 277 | this, SLOT(addresseeExecuted(CardViewItem *))); |
278 | 278 | ||
279 | if (KABPrefs::instance()->mHonorSingleClick) | 279 | if (KABPrefs::instance()->mHonorSingleClick) |
280 | connect(mCardView, SIGNAL(executed(CardViewItem *)), | 280 | connect(mCardView, SIGNAL(executed(CardViewItem *)), |
281 | this, SLOT(addresseeExecuted(CardViewItem *))); | 281 | this, SLOT(addresseeExecuted(CardViewItem *))); |
282 | else | 282 | else |
283 | connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), | 283 | connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), |
284 | this, SLOT(addresseeExecuted(CardViewItem *))); | 284 | this, SLOT(addresseeExecuted(CardViewItem *))); |
285 | #endif | 285 | #endif |
286 | 286 | ||
287 | connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), | 287 | connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), |
288 | this, SLOT(addresseeExecuted(CardViewItem *))); | 288 | this, SLOT(addresseeExecuted(CardViewItem *))); |
289 | } | 289 | } |
290 | 290 | ||
291 | void KAddressBookCardView::writeConfig( KConfig *config ) | 291 | void KAddressBookCardView::writeConfig( KConfig *config ) |
292 | { | 292 | { |
293 | config->writeEntry( "ItemWidth", mCardView->itemWidth() ); | 293 | config->writeEntry( "ItemWidth", mCardView->itemWidth() ); |
294 | KAddressBookView::writeConfig( config ); | 294 | KAddressBookView::writeConfig( config ); |
295 | } | 295 | } |
296 | void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) | 296 | void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) |
297 | { | 297 | { |
298 | mCardView->clear(); | 298 | mCardView->clear(); |
299 | if ( s.isEmpty() || s == "*" ) { | 299 | if ( s.isEmpty() || s == "*" ) { |
300 | refresh(); | 300 | refresh(); |
301 | return; | 301 | return; |
302 | } | 302 | } |
303 | QString pattern = s.lower()+"*"; | 303 | QString pattern = s.lower()+"*"; |
304 | QRegExp re; | 304 | QRegExp re; |
305 | re.setWildcard(true); // most people understand these better. | 305 | re.setWildcard(true); // most people understand these better. |
306 | re.setCaseSensitive(false); | 306 | re.setCaseSensitive(false); |
307 | re.setPattern( pattern ); | 307 | re.setPattern( pattern ); |
308 | if (!re.isValid()) | 308 | if (!re.isValid()) |
309 | return; | 309 | return; |
310 | mCardView->viewport()->setUpdatesEnabled( false ); | 310 | mCardView->viewport()->setUpdatesEnabled( false ); |
311 | KABC::Addressee::List addresseeList = addressees(); | 311 | KABC::Addressee::List addresseeList = addressees(); |
312 | KABC::Addressee::List::Iterator it; | 312 | KABC::Addressee::List::Iterator it; |
313 | if ( field ) { | 313 | if ( field ) { |
314 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 314 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
315 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 315 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
316 | continue; | 316 | continue; |
317 | #if QT_VERSION >= 300 | 317 | #if QT_VERSION >= 0x030000 |
318 | if (re.search(field->value( *it ).lower()) != -1) | 318 | if (re.search(field->value( *it ).lower()) != -1) |
319 | #else | 319 | #else |
320 | if (re.match(field->value( *it ).lower()) != -1) | 320 | if (re.match(field->value( *it ).lower()) != -1) |
321 | #endif | 321 | #endif |
322 | new AddresseeCardViewItem(fields(), mShowEmptyFields, | 322 | new AddresseeCardViewItem(fields(), mShowEmptyFields, |
323 | addressBook(), *it, mCardView); | 323 | addressBook(), *it, mCardView); |
324 | 324 | ||
325 | } | 325 | } |
326 | } else { | 326 | } else { |
327 | KABC::Field::List fieldList = allFields(); | 327 | KABC::Field::List fieldList = allFields(); |
328 | KABC::Field::List::ConstIterator fieldIt; | 328 | KABC::Field::List::ConstIterator fieldIt; |
329 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 329 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
330 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 330 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
331 | continue; | 331 | continue; |
332 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 332 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
333 | #if QT_VERSION >= 300 | 333 | #if QT_VERSION >= 0x030000 |
334 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 334 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
335 | #else | 335 | #else |
336 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 336 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
337 | #endif | 337 | #endif |
338 | { | 338 | { |
339 | new AddresseeCardViewItem(fields(), mShowEmptyFields, | 339 | new AddresseeCardViewItem(fields(), mShowEmptyFields, |
340 | addressBook(), *it, mCardView); | 340 | addressBook(), *it, mCardView); |
341 | break; | 341 | break; |
342 | } | 342 | } |
343 | } | 343 | } |
344 | } | 344 | } |
345 | } | 345 | } |
346 | mCardView->viewport()->setUpdatesEnabled( true ); | 346 | mCardView->viewport()->setUpdatesEnabled( true ); |
347 | mCardView->viewport()->update(); | 347 | mCardView->viewport()->update(); |
348 | if ( mCardView->firstItem() ) { | 348 | if ( mCardView->firstItem() ) { |
349 | mCardView->setCurrentItem ( mCardView->firstItem() ); | 349 | mCardView->setCurrentItem ( mCardView->firstItem() ); |
350 | mCardView->setSelected ( mCardView->firstItem() , true ); | 350 | mCardView->setSelected ( mCardView->firstItem() , true ); |
351 | } | 351 | } |
352 | else | 352 | else |
353 | emit selected(QString::null); | 353 | emit selected(QString::null); |
354 | } | 354 | } |
355 | QStringList KAddressBookCardView::selectedUids() | 355 | QStringList KAddressBookCardView::selectedUids() |
356 | { | 356 | { |
357 | QStringList uidList; | 357 | QStringList uidList; |
358 | CardViewItem *item; | 358 | CardViewItem *item; |
359 | AddresseeCardViewItem *aItem; | 359 | AddresseeCardViewItem *aItem; |
360 | 360 | ||
361 | for (item = mCardView->firstItem(); item; item = item->nextItem()) | 361 | for (item = mCardView->firstItem(); item; item = item->nextItem()) |
362 | { | 362 | { |
363 | if (item->isSelected()) | 363 | if (item->isSelected()) |
364 | { | 364 | { |
365 | #ifndef KAB_EMBEDDED | 365 | #ifndef KAB_EMBEDDED |
366 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); | 366 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); |
367 | #else //KAB_EMBEDDED | 367 | #else //KAB_EMBEDDED |
368 | aItem = (AddresseeCardViewItem*)(item); | 368 | aItem = (AddresseeCardViewItem*)(item); |
369 | #endif //KAB_EMBEDDED | 369 | #endif //KAB_EMBEDDED |
370 | if (aItem) | 370 | if (aItem) |
371 | uidList << aItem->addressee().uid(); | 371 | uidList << aItem->addressee().uid(); |
372 | } | 372 | } |
373 | } | 373 | } |
374 | 374 | ||
375 | return uidList; | 375 | return uidList; |
376 | } | 376 | } |
377 | 377 | ||
378 | void KAddressBookCardView::refresh(QString uid) | 378 | void KAddressBookCardView::refresh(QString uid) |
379 | { | 379 | { |
380 | CardViewItem *item; | 380 | CardViewItem *item; |
381 | AddresseeCardViewItem *aItem; | 381 | AddresseeCardViewItem *aItem; |
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp index ef0a23a..fb53215 100644 --- a/kaddressbook/views/kaddressbookiconview.cpp +++ b/kaddressbook/views/kaddressbookiconview.cpp | |||
@@ -227,113 +227,113 @@ void KAddressBookIconView::scrollDOWN() | |||
227 | { | 227 | { |
228 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | 228 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); |
229 | QApplication::postEvent( mIconView, ev ); | 229 | QApplication::postEvent( mIconView, ev ); |
230 | } | 230 | } |
231 | void KAddressBookIconView::readConfig(KConfig *config) | 231 | void KAddressBookIconView::readConfig(KConfig *config) |
232 | { | 232 | { |
233 | KAddressBookView::readConfig(config); | 233 | KAddressBookView::readConfig(config); |
234 | 234 | ||
235 | //US method executed is part of KIconView | 235 | //US method executed is part of KIconView |
236 | //US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), | 236 | //US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), |
237 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); | 237 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); |
238 | disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 238 | disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), |
239 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 239 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
240 | 240 | ||
241 | //US method executed is part of KIconView. Use selectionChanged instead | 241 | //US method executed is part of KIconView. Use selectionChanged instead |
242 | /*US | 242 | /*US |
243 | if (KABPrefs::instance()->mHonorSingleClick) | 243 | if (KABPrefs::instance()->mHonorSingleClick) |
244 | connect(mIconView, SIGNAL(executed(QIconViewItem *)), | 244 | connect(mIconView, SIGNAL(executed(QIconViewItem *)), |
245 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 245 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
246 | else | 246 | else |
247 | connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)), | 247 | connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)), |
248 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 248 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
249 | */ | 249 | */ |
250 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 250 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), |
251 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 251 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
252 | 252 | ||
253 | } | 253 | } |
254 | void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) | 254 | void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) |
255 | { | 255 | { |
256 | mIconView->clear(); | 256 | mIconView->clear(); |
257 | mIconList.clear(); | 257 | mIconList.clear(); |
258 | if ( s.isEmpty() || s == "*" ) { | 258 | if ( s.isEmpty() || s == "*" ) { |
259 | refresh(); | 259 | refresh(); |
260 | return; | 260 | return; |
261 | } | 261 | } |
262 | QString pattern = s.lower()+"*"; | 262 | QString pattern = s.lower()+"*"; |
263 | QRegExp re; | 263 | QRegExp re; |
264 | re.setWildcard(true); // most people understand these better. | 264 | re.setWildcard(true); // most people understand these better. |
265 | re.setCaseSensitive(false); | 265 | re.setCaseSensitive(false); |
266 | re.setPattern( pattern ); | 266 | re.setPattern( pattern ); |
267 | if (!re.isValid()) | 267 | if (!re.isValid()) |
268 | return; | 268 | return; |
269 | KABC::Addressee::List addresseeList = addressees(); | 269 | KABC::Addressee::List addresseeList = addressees(); |
270 | KABC::Addressee::List::Iterator it; | 270 | KABC::Addressee::List::Iterator it; |
271 | if ( field ) { | 271 | if ( field ) { |
272 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 272 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
273 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 273 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
274 | continue; | 274 | continue; |
275 | #if QT_VERSION >= 300 | 275 | #if QT_VERSION >= 0x030000 |
276 | if (re.search(field->value( *it ).lower()) != -1) | 276 | if (re.search(field->value( *it ).lower()) != -1) |
277 | #else | 277 | #else |
278 | if (re.match(field->value( *it ).lower()) != -1) | 278 | if (re.match(field->value( *it ).lower()) != -1) |
279 | #endif | 279 | #endif |
280 | mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); | 280 | mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); |
281 | 281 | ||
282 | 282 | ||
283 | } | 283 | } |
284 | } else { | 284 | } else { |
285 | KABC::Field::List fieldList = allFields(); | 285 | KABC::Field::List fieldList = allFields(); |
286 | KABC::Field::List::ConstIterator fieldIt; | 286 | KABC::Field::List::ConstIterator fieldIt; |
287 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 287 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
288 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 288 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
289 | continue; | 289 | continue; |
290 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 290 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
291 | #if QT_VERSION >= 300 | 291 | #if QT_VERSION >= 0x030000 |
292 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 292 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
293 | #else | 293 | #else |
294 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 294 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
295 | #endif | 295 | #endif |
296 | { | 296 | { |
297 | mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); | 297 | mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); |
298 | break; | 298 | break; |
299 | } | 299 | } |
300 | } | 300 | } |
301 | } | 301 | } |
302 | } | 302 | } |
303 | mIconView->arrangeItemsInGrid( true ); | 303 | mIconView->arrangeItemsInGrid( true ); |
304 | if ( mIconView->firstItem() ) { | 304 | if ( mIconView->firstItem() ) { |
305 | mIconView->setCurrentItem ( mIconView->firstItem() ); | 305 | mIconView->setCurrentItem ( mIconView->firstItem() ); |
306 | mIconView->setSelected ( mIconView->firstItem() , true ); | 306 | mIconView->setSelected ( mIconView->firstItem() , true ); |
307 | } | 307 | } |
308 | else | 308 | else |
309 | emit selected(QString::null); | 309 | emit selected(QString::null); |
310 | } | 310 | } |
311 | QStringList KAddressBookIconView::selectedUids() | 311 | QStringList KAddressBookIconView::selectedUids() |
312 | { | 312 | { |
313 | QStringList uidList; | 313 | QStringList uidList; |
314 | QIconViewItem *item; | 314 | QIconViewItem *item; |
315 | AddresseeIconViewItem *aItem; | 315 | AddresseeIconViewItem *aItem; |
316 | 316 | ||
317 | for (item = mIconView->firstItem(); item; item = item->nextItem()) | 317 | for (item = mIconView->firstItem(); item; item = item->nextItem()) |
318 | { | 318 | { |
319 | if (item->isSelected()) | 319 | if (item->isSelected()) |
320 | { | 320 | { |
321 | #ifndef KAB_EMBEDDED | 321 | #ifndef KAB_EMBEDDED |
322 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); | 322 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); |
323 | #else //KAB_EMBEDDED | 323 | #else //KAB_EMBEDDED |
324 | aItem = (AddresseeIconViewItem*)(item); | 324 | aItem = (AddresseeIconViewItem*)(item); |
325 | #endif //KAB_EMBEDDED | 325 | #endif //KAB_EMBEDDED |
326 | if (aItem) | 326 | if (aItem) |
327 | uidList << aItem->addressee().uid(); | 327 | uidList << aItem->addressee().uid(); |
328 | } | 328 | } |
329 | } | 329 | } |
330 | 330 | ||
331 | return uidList; | 331 | return uidList; |
332 | } | 332 | } |
333 | 333 | ||
334 | void KAddressBookIconView::refresh(QString uid) | 334 | void KAddressBookIconView::refresh(QString uid) |
335 | { | 335 | { |
336 | QIconViewItem *item; | 336 | QIconViewItem *item; |
337 | AddresseeIconViewItem *aItem; | 337 | AddresseeIconViewItem *aItem; |
338 | 338 | ||
339 | if ( uid.isNull() ) { | 339 | if ( uid.isNull() ) { |
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 7022dcb..69802a4 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp | |||
@@ -111,112 +111,112 @@ void KAddressBookTableView::reconstructListView() | |||
111 | connect(mListView, SIGNAL(startAddresseeDrag()), this, | 111 | connect(mListView, SIGNAL(startAddresseeDrag()), this, |
112 | SIGNAL(startDrag())); | 112 | SIGNAL(startDrag())); |
113 | connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, | 113 | connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, |
114 | SIGNAL(dropped(QDropEvent*))); | 114 | SIGNAL(dropped(QDropEvent*))); |
115 | 115 | ||
116 | if (KABPrefs::instance()->mHonorSingleClick) { | 116 | if (KABPrefs::instance()->mHonorSingleClick) { |
117 | // qDebug("KAddressBookTableView::reconstructListView single"); | 117 | // qDebug("KAddressBookTableView::reconstructListView single"); |
118 | connect(mListView, SIGNAL(executed(QListViewItem*)), | 118 | connect(mListView, SIGNAL(executed(QListViewItem*)), |
119 | this, SLOT(addresseeExecuted(QListViewItem*))); | 119 | this, SLOT(addresseeExecuted(QListViewItem*))); |
120 | } else { | 120 | } else { |
121 | // qDebug("KAddressBookTableView::reconstructListView double"); | 121 | // qDebug("KAddressBookTableView::reconstructListView double"); |
122 | connect(mListView, SIGNAL(doubleClicked(QListViewItem*)), | 122 | connect(mListView, SIGNAL(doubleClicked(QListViewItem*)), |
123 | this, SLOT(addresseeExecuted(QListViewItem*))); | 123 | this, SLOT(addresseeExecuted(QListViewItem*))); |
124 | } | 124 | } |
125 | connect(mListView, SIGNAL(returnPressed(QListViewItem*)), | 125 | connect(mListView, SIGNAL(returnPressed(QListViewItem*)), |
126 | this, SLOT(addresseeExecuted(QListViewItem*))); | 126 | this, SLOT(addresseeExecuted(QListViewItem*))); |
127 | connect(mListView, SIGNAL(signalDelete()), | 127 | connect(mListView, SIGNAL(signalDelete()), |
128 | this, SLOT(addresseeDeleted())); | 128 | this, SLOT(addresseeDeleted())); |
129 | 129 | ||
130 | //US performceimprovement. Refresh is done from the outside | 130 | //US performceimprovement. Refresh is done from the outside |
131 | //US refresh(); | 131 | //US refresh(); |
132 | 132 | ||
133 | mListView->setSorting( 0, true ); | 133 | mListView->setSorting( 0, true ); |
134 | mainLayout->addWidget( mListView ); | 134 | mainLayout->addWidget( mListView ); |
135 | mainLayout->activate(); | 135 | mainLayout->activate(); |
136 | mListView->show(); | 136 | mListView->show(); |
137 | } | 137 | } |
138 | 138 | ||
139 | void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) | 139 | void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) |
140 | { | 140 | { |
141 | mListView->clear(); | 141 | mListView->clear(); |
142 | if ( s.isEmpty() || s == "*" ) { | 142 | if ( s.isEmpty() || s == "*" ) { |
143 | refresh(); | 143 | refresh(); |
144 | return; | 144 | return; |
145 | } | 145 | } |
146 | QString pattern = s.lower()+"*"; | 146 | QString pattern = s.lower()+"*"; |
147 | QRegExp re; | 147 | QRegExp re; |
148 | re.setWildcard(true); // most people understand these better. | 148 | re.setWildcard(true); // most people understand these better. |
149 | re.setCaseSensitive(false); | 149 | re.setCaseSensitive(false); |
150 | re.setPattern( pattern ); | 150 | re.setPattern( pattern ); |
151 | if (!re.isValid()) | 151 | if (!re.isValid()) |
152 | return; | 152 | return; |
153 | KABC::Addressee::List addresseeList = addressees(); | 153 | KABC::Addressee::List addresseeList = addressees(); |
154 | KABC::Addressee::List::Iterator it; | 154 | KABC::Addressee::List::Iterator it; |
155 | if ( field ) { | 155 | if ( field ) { |
156 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 156 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
157 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 157 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
158 | continue; | 158 | continue; |
159 | #if QT_VERSION >= 300 | 159 | #if QT_VERSION >= 0x030000 |
160 | if (re.search(field->value( *it ).lower()) == 0) | 160 | if (re.search(field->value( *it ).lower()) == 0) |
161 | #else | 161 | #else |
162 | if (re.match(field->value( *it ).lower()) != -1) | 162 | if (re.match(field->value( *it ).lower()) != -1) |
163 | #endif | 163 | #endif |
164 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 164 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
165 | 165 | ||
166 | } | 166 | } |
167 | } else { | 167 | } else { |
168 | KABC::Field::List fieldList = allFields(); | 168 | KABC::Field::List fieldList = allFields(); |
169 | KABC::Field::List::ConstIterator fieldIt; | 169 | KABC::Field::List::ConstIterator fieldIt; |
170 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 170 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
171 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 171 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
172 | continue; | 172 | continue; |
173 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 173 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
174 | #if QT_VERSION >= 300 | 174 | #if QT_VERSION >= 0x030000 |
175 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 175 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
176 | #else | 176 | #else |
177 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 177 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
178 | #endif | 178 | #endif |
179 | { | 179 | { |
180 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 180 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
181 | break; | 181 | break; |
182 | } | 182 | } |
183 | } | 183 | } |
184 | } | 184 | } |
185 | } | 185 | } |
186 | // Sometimes the background pixmap gets messed up when we add lots | 186 | // Sometimes the background pixmap gets messed up when we add lots |
187 | // of items. | 187 | // of items. |
188 | mListView->repaint(); | 188 | mListView->repaint(); |
189 | if ( mListView->firstChild() ) { | 189 | if ( mListView->firstChild() ) { |
190 | mListView->setCurrentItem ( mListView->firstChild() ); | 190 | mListView->setCurrentItem ( mListView->firstChild() ); |
191 | mListView->setSelected ( mListView->firstChild(), true ); | 191 | mListView->setSelected ( mListView->firstChild(), true ); |
192 | } | 192 | } |
193 | else | 193 | else |
194 | emit selected(QString::null); | 194 | emit selected(QString::null); |
195 | 195 | ||
196 | } | 196 | } |
197 | void KAddressBookTableView::writeConfig(KConfig *config) | 197 | void KAddressBookTableView::writeConfig(KConfig *config) |
198 | { | 198 | { |
199 | KAddressBookView::writeConfig(config); | 199 | KAddressBookView::writeConfig(config); |
200 | 200 | ||
201 | mListView->saveLayout(config, config->group()); | 201 | mListView->saveLayout(config, config->group()); |
202 | } | 202 | } |
203 | 203 | ||
204 | void KAddressBookTableView::readConfig(KConfig *config) | 204 | void KAddressBookTableView::readConfig(KConfig *config) |
205 | { | 205 | { |
206 | KAddressBookView::readConfig( config ); | 206 | KAddressBookView::readConfig( config ); |
207 | // The config could have changed the fields, so we need to reconstruct | 207 | // The config could have changed the fields, so we need to reconstruct |
208 | // the listview. | 208 | // the listview. |
209 | reconstructListView(); | 209 | reconstructListView(); |
210 | 210 | ||
211 | // costum colors? | 211 | // costum colors? |
212 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) | 212 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) |
213 | { | 213 | { |
214 | QPalette p( mListView->palette() ); | 214 | QPalette p( mListView->palette() ); |
215 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); | 215 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); |
216 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); | 216 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); |
217 | c = p.color(QPalette::Normal, QColorGroup::Text ); | 217 | c = p.color(QPalette::Normal, QColorGroup::Text ); |
218 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); | 218 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); |
219 | c = p.color(QPalette::Normal, QColorGroup::Button ); | 219 | c = p.color(QPalette::Normal, QColorGroup::Button ); |
220 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); | 220 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); |
221 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); | 221 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); |
222 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); | 222 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); |
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index ead8628..21ecb73 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -19,97 +19,97 @@ | |||
19 | 19 | ||
20 | #include <klocale.h> | 20 | #include <klocale.h> |
21 | #include <kdebug.h> | 21 | #include <kdebug.h> |
22 | #include <qapp.h> | 22 | #include <qapp.h> |
23 | 23 | ||
24 | #include <kiconloader.h> | 24 | #include <kiconloader.h> |
25 | #include "kotodoviewitem.h" | 25 | #include "kotodoviewitem.h" |
26 | #include "kotodoview.h" | 26 | #include "kotodoview.h" |
27 | #include "koprefs.h" | 27 | #include "koprefs.h" |
28 | 28 | ||
29 | KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) | 29 | KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) |
30 | : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) | 30 | : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) |
31 | { | 31 | { |
32 | construct(); | 32 | construct(); |
33 | } | 33 | } |
34 | 34 | ||
35 | KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) | 35 | KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) |
36 | : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) | 36 | : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) |
37 | { | 37 | { |
38 | construct(); | 38 | construct(); |
39 | } | 39 | } |
40 | 40 | ||
41 | QString KOTodoViewItem::key(int column,bool) const | 41 | QString KOTodoViewItem::key(int column,bool) const |
42 | { | 42 | { |
43 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); | 43 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); |
44 | if (it == mKeyMap.end()) { | 44 | if (it == mKeyMap.end()) { |
45 | return text(column).lower(); | 45 | return text(column).lower(); |
46 | } else { | 46 | } else { |
47 | return *it; | 47 | return *it; |
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | void KOTodoViewItem:: setup() | 51 | void KOTodoViewItem:: setup() |
52 | { | 52 | { |
53 | 53 | ||
54 | int h = 20; | 54 | int h = 20; |
55 | if ( listView () ) { | 55 | if ( listView () ) { |
56 | QFontMetrics fm ( listView ()->font () ); | 56 | QFontMetrics fm ( listView ()->font () ); |
57 | h = fm.height(); | 57 | h = fm.height(); |
58 | } | 58 | } |
59 | setHeight( h ); | 59 | setHeight( h ); |
60 | 60 | ||
61 | } | 61 | } |
62 | void KOTodoViewItem::setSortKey(int column,const QString &key) | 62 | void KOTodoViewItem::setSortKey(int column,const QString &key) |
63 | { | 63 | { |
64 | mKeyMap.insert(column,key); | 64 | mKeyMap.insert(column,key); |
65 | } | 65 | } |
66 | 66 | ||
67 | #if QT_VERSION >= 300 | 67 | #if QT_VERSION >= 0x030000 |
68 | void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, | 68 | void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, |
69 | int y,int h) | 69 | int y,int h) |
70 | { | 70 | { |
71 | QListViewItem::paintBranches(p,cg,w,y,h); | 71 | QListViewItem::paintBranches(p,cg,w,y,h); |
72 | } | 72 | } |
73 | #else | 73 | #else |
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | void KOTodoViewItem::construct() | 76 | void KOTodoViewItem::construct() |
77 | { | 77 | { |
78 | // qDebug("KOTodoViewItem::construct() "); | 78 | // qDebug("KOTodoViewItem::construct() "); |
79 | m_init = true; | 79 | m_init = true; |
80 | QString keyd = "=="; | 80 | QString keyd = "=="; |
81 | QString keyt = "=="; | 81 | QString keyt = "=="; |
82 | QString skeyd = "=="; | 82 | QString skeyd = "=="; |
83 | QString skeyt = "=="; | 83 | QString skeyt = "=="; |
84 | 84 | ||
85 | setOn(mTodo->isCompleted()); | 85 | setOn(mTodo->isCompleted()); |
86 | setText(0,mTodo->summary()); | 86 | setText(0,mTodo->summary()); |
87 | setText(1,QString::number(mTodo->priority())); | 87 | setText(1,QString::number(mTodo->priority())); |
88 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 88 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
89 | if (mTodo->percentComplete()<100) { | 89 | if (mTodo->percentComplete()<100) { |
90 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 90 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
91 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 91 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
92 | } | 92 | } |
93 | else { | 93 | else { |
94 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 94 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
95 | else setSortKey(2,QString::number(99)); | 95 | else setSortKey(2,QString::number(99)); |
96 | } | 96 | } |
97 | if (mTodo->hasDueDate()) { | 97 | if (mTodo->hasDueDate()) { |
98 | setText(3, mTodo->dtDueDateStr()); | 98 | setText(3, mTodo->dtDueDateStr()); |
99 | QDate d = mTodo->dtDue().date(); | 99 | QDate d = mTodo->dtDue().date(); |
100 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 100 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
101 | // setSortKey(3,keyd); | 101 | // setSortKey(3,keyd); |
102 | if (mTodo->doesFloat()) { | 102 | if (mTodo->doesFloat()) { |
103 | setText(4,""); | 103 | setText(4,""); |
104 | } | 104 | } |
105 | else { | 105 | else { |
106 | setText(4,mTodo->dtDueTimeStr()); | 106 | setText(4,mTodo->dtDueTimeStr()); |
107 | QTime t = mTodo->dtDue().time(); | 107 | QTime t = mTodo->dtDue().time(); |
108 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 108 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
109 | //setSortKey(4,keyt); | 109 | //setSortKey(4,keyt); |
110 | } | 110 | } |
111 | } else { | 111 | } else { |
112 | setText(3,""); | 112 | setText(3,""); |
113 | setText(4,""); | 113 | setText(4,""); |
114 | } | 114 | } |
115 | setSortKey(3,keyd); | 115 | setSortKey(3,keyd); |
diff --git a/korganizer/kotodoviewitem.h b/korganizer/kotodoviewitem.h index 74dbe98..bd024c8 100644 --- a/korganizer/kotodoviewitem.h +++ b/korganizer/kotodoviewitem.h | |||
@@ -27,67 +27,67 @@ | |||
27 | #include <qlistbox.h> | 27 | #include <qlistbox.h> |
28 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qmap.h> | 30 | #include <qmap.h> |
31 | #include <qlistview.h> | 31 | #include <qlistview.h> |
32 | #include <qpainter.h> | 32 | #include <qpainter.h> |
33 | 33 | ||
34 | #include <libkcal/calendar.h> | 34 | #include <libkcal/calendar.h> |
35 | #include <libkcal/todo.h> | 35 | #include <libkcal/todo.h> |
36 | 36 | ||
37 | using namespace KCal; | 37 | using namespace KCal; |
38 | 38 | ||
39 | class KOTodoView; | 39 | class KOTodoView; |
40 | 40 | ||
41 | /** | 41 | /** |
42 | This class provides a way of displaying a single Event of Todo-Type in a | 42 | This class provides a way of displaying a single Event of Todo-Type in a |
43 | KTodoView. | 43 | KTodoView. |
44 | 44 | ||
45 | @author Cornelius Schumacher <schumacher@kde.org> | 45 | @author Cornelius Schumacher <schumacher@kde.org> |
46 | @see KOTodoView | 46 | @see KOTodoView |
47 | */ | 47 | */ |
48 | class KOTodoViewItem : public QCheckListItem | 48 | class KOTodoViewItem : public QCheckListItem |
49 | { | 49 | { |
50 | public: | 50 | public: |
51 | /** | 51 | /** |
52 | Constructor. | 52 | Constructor. |
53 | 53 | ||
54 | @param parent is the list view to which this item belongs. | 54 | @param parent is the list view to which this item belongs. |
55 | @param ev is the event to have the item display information for. | 55 | @param ev is the event to have the item display information for. |
56 | */ | 56 | */ |
57 | KOTodoViewItem(QListView *parent, Todo *todo, KOTodoView *kotodo); | 57 | KOTodoViewItem(QListView *parent, Todo *todo, KOTodoView *kotodo); |
58 | KOTodoViewItem(KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo); | 58 | KOTodoViewItem(KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo); |
59 | //~KOTodoViewItem() { qDebug("~KOTodoViewItem() %s ", text(0).latin1() );} | 59 | //~KOTodoViewItem() { qDebug("~KOTodoViewItem() %s ", text(0).latin1() );} |
60 | 60 | ||
61 | void construct(); | 61 | void construct(); |
62 | 62 | ||
63 | Todo *todo() { return mTodo; } | 63 | Todo *todo() { return mTodo; } |
64 | 64 | ||
65 | QString key(int, bool) const; | 65 | QString key(int, bool) const; |
66 | 66 | ||
67 | void setSortKey(int column,const QString &key); | 67 | void setSortKey(int column,const QString &key); |
68 | 68 | ||
69 | bool isAlternate(); | 69 | bool isAlternate(); |
70 | 70 | ||
71 | virtual void paintCell(QPainter *p, const QColorGroup &cg, | 71 | virtual void paintCell(QPainter *p, const QColorGroup &cg, |
72 | int column, int width, int alignment); | 72 | int column, int width, int alignment); |
73 | virtual void setup(); | 73 | virtual void setup(); |
74 | protected: | 74 | protected: |
75 | #if QT_VERSION >= 300 | 75 | #if QT_VERSION >= 0x030000 |
76 | void paintBranches(QPainter *p,const QColorGroup & cg,int w,int y,int h); | 76 | void paintBranches(QPainter *p,const QColorGroup & cg,int w,int y,int h); |
77 | #else | 77 | #else |
78 | #endif | 78 | #endif |
79 | virtual void stateChange(bool); | 79 | virtual void stateChange(bool); |
80 | void setMyPixmap(); | 80 | void setMyPixmap(); |
81 | 81 | ||
82 | private: | 82 | private: |
83 | Todo *mTodo; | 83 | Todo *mTodo; |
84 | KOTodoView *mTodoView; | 84 | KOTodoView *mTodoView; |
85 | 85 | ||
86 | QMap<int,QString> mKeyMap; | 86 | QMap<int,QString> mKeyMap; |
87 | uint m_odd : 1; | 87 | uint m_odd : 1; |
88 | uint m_known : 1; | 88 | uint m_known : 1; |
89 | uint m_unused : 30; | 89 | uint m_unused : 30; |
90 | bool m_init; | 90 | bool m_init; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | #endif | 93 | #endif |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index f6b7718..e255b83 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -530,59 +530,59 @@ void KOViewManager::showJournalView() | |||
530 | if (!mJournalView) { | 530 | if (!mJournalView) { |
531 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), | 531 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), |
532 | "KOViewManager::JournalView"); | 532 | "KOViewManager::JournalView"); |
533 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, | 533 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, |
534 | SLOT( updateConfig() ) ); | 534 | SLOT( updateConfig() ) ); |
535 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); | 535 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); |
536 | addView(mJournalView); | 536 | addView(mJournalView); |
537 | } | 537 | } |
538 | 538 | ||
539 | showView(mJournalView); | 539 | showView(mJournalView); |
540 | } | 540 | } |
541 | 541 | ||
542 | void KOViewManager::showTimeSpanView() | 542 | void KOViewManager::showTimeSpanView() |
543 | { | 543 | { |
544 | //mFlagShowNextxDays = false; | 544 | //mFlagShowNextxDays = false; |
545 | if (!mTimeSpanView) { | 545 | if (!mTimeSpanView) { |
546 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), | 546 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), |
547 | "KOViewManager::TimeSpanView"); | 547 | "KOViewManager::TimeSpanView"); |
548 | addView(mTimeSpanView); | 548 | addView(mTimeSpanView); |
549 | 549 | ||
550 | mTimeSpanView->readSettings(); | 550 | mTimeSpanView->readSettings(); |
551 | } | 551 | } |
552 | 552 | ||
553 | showView(mTimeSpanView); | 553 | showView(mTimeSpanView); |
554 | } | 554 | } |
555 | 555 | ||
556 | Incidence *KOViewManager::currentSelection() | 556 | Incidence *KOViewManager::currentSelection() |
557 | { | 557 | { |
558 | if (!mCurrentView) return 0; | 558 | if (!mCurrentView) return 0; |
559 | if ( mCurrentView == mListView ) { | 559 | if ( mCurrentView == mListView ) { |
560 | if ( mListView->currentItem() ) | 560 | if ( mListView->currentItem() ) |
561 | return mListView->currentItem(); | 561 | return mListView->currentItem(); |
562 | } | 562 | } |
563 | return mCurrentView->selectedIncidences().first(); | 563 | return mCurrentView->selectedIncidences().first(); |
564 | } | 564 | } |
565 | 565 | ||
566 | QDate KOViewManager::currentSelectionDate() | 566 | QDate KOViewManager::currentSelectionDate() |
567 | { | 567 | { |
568 | QDate qd; | 568 | QDate qd; |
569 | if (mCurrentView) { | 569 | if (mCurrentView) { |
570 | DateList qvl = mCurrentView->selectedDates(); | 570 | DateList qvl = mCurrentView->selectedDates(); |
571 | if (!qvl.isEmpty()) qd = qvl.first(); | 571 | if (!qvl.isEmpty()) qd = qvl.first(); |
572 | } | 572 | } |
573 | return qd; | 573 | return qd; |
574 | } | 574 | } |
575 | 575 | ||
576 | void KOViewManager::addView(KOrg::BaseView *view) | 576 | void KOViewManager::addView(KOrg::BaseView *view) |
577 | { | 577 | { |
578 | #if QT_VERSION >= 300 | 578 | #if QT_VERSION >= 0x030000 |
579 | mMainView->viewStack()->addWidget( view ); | 579 | mMainView->viewStack()->addWidget( view ); |
580 | #else | 580 | #else |
581 | mMainView->viewStack()->addWidget( view, 1 ); | 581 | mMainView->viewStack()->addWidget( view, 1 ); |
582 | #endif | 582 | #endif |
583 | } | 583 | } |
584 | 584 | ||
585 | void KOViewManager::setDocumentId( const QString &id ) | 585 | void KOViewManager::setDocumentId( const QString &id ) |
586 | { | 586 | { |
587 | if (mTodoView) mTodoView->setDocumentId( id ); | 587 | if (mTodoView) mTodoView->setDocumentId( id ); |
588 | } | 588 | } |
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 72ee1d2..39966b5 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp | |||
@@ -189,209 +189,209 @@ void SearchDialog::doSearch() | |||
189 | i18n("No event/todo were found matching\nyour search expression.\nUse the wildcard characters\n ' * ' and ' ? ' where needed.")); | 189 | i18n("No event/todo were found matching\nyour search expression.\nUse the wildcard characters\n ' * ' and ' ? ' where needed.")); |
190 | #ifndef DESKTOP_VERSION | 190 | #ifndef DESKTOP_VERSION |
191 | setCaption(i18n("Click OK to search ->")); | 191 | setCaption(i18n("Click OK to search ->")); |
192 | #else | 192 | #else |
193 | setCaption(i18n("KO/Pi Find ")); | 193 | setCaption(i18n("KO/Pi Find ")); |
194 | #endif | 194 | #endif |
195 | } else { | 195 | } else { |
196 | QString mess; | 196 | QString mess; |
197 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); | 197 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); |
198 | setCaption( i18n("KO/Pi Find: ") + mess); | 198 | setCaption( i18n("KO/Pi Find: ") + mess); |
199 | 199 | ||
200 | } | 200 | } |
201 | } | 201 | } |
202 | void SearchDialog::updateConfig() | 202 | void SearchDialog::updateConfig() |
203 | { | 203 | { |
204 | listView->updateConfig(); | 204 | listView->updateConfig(); |
205 | } | 205 | } |
206 | void SearchDialog::updateView() | 206 | void SearchDialog::updateView() |
207 | { | 207 | { |
208 | 208 | ||
209 | QRegExp re; | 209 | QRegExp re; |
210 | re.setWildcard(true); // most people understand these better. | 210 | re.setWildcard(true); // most people understand these better. |
211 | re.setCaseSensitive(false); | 211 | re.setCaseSensitive(false); |
212 | re.setPattern(searchEdit->text()); | 212 | re.setPattern(searchEdit->text()); |
213 | if (re.isValid()) { | 213 | if (re.isValid()) { |
214 | search(re); | 214 | search(re); |
215 | } else { | 215 | } else { |
216 | mMatchedEvents.clear(); | 216 | mMatchedEvents.clear(); |
217 | mMatchedTodos.clear(); | 217 | mMatchedTodos.clear(); |
218 | mMatchedJournals.clear(); | 218 | mMatchedJournals.clear(); |
219 | } | 219 | } |
220 | listView->setStartDate( mStartDate->date() ); | 220 | listView->setStartDate( mStartDate->date() ); |
221 | listView->showEvents(mMatchedEvents); | 221 | listView->showEvents(mMatchedEvents); |
222 | listView->addTodos(mMatchedTodos); | 222 | listView->addTodos(mMatchedTodos); |
223 | listView->addJournals(mMatchedJournals); | 223 | listView->addJournals(mMatchedJournals); |
224 | } | 224 | } |
225 | 225 | ||
226 | void SearchDialog::search(const QRegExp &re) | 226 | void SearchDialog::search(const QRegExp &re) |
227 | { | 227 | { |
228 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), | 228 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), |
229 | mEndDate->date(), | 229 | mEndDate->date(), |
230 | false /*mInclusiveCheck->isChecked()*/ ); | 230 | false /*mInclusiveCheck->isChecked()*/ ); |
231 | 231 | ||
232 | mMatchedEvents.clear(); | 232 | mMatchedEvents.clear(); |
233 | if ( mSearchEvent->isChecked() ) { | 233 | if ( mSearchEvent->isChecked() ) { |
234 | Event *ev; | 234 | Event *ev; |
235 | for(ev=events.first();ev;ev=events.next()) { | 235 | for(ev=events.first();ev;ev=events.next()) { |
236 | if (mSummaryCheck->isChecked()) { | 236 | if (mSummaryCheck->isChecked()) { |
237 | #if QT_VERSION >= 300 | 237 | #if QT_VERSION >= 0x030000 |
238 | if (re.search(ev->summary()) != -1) | 238 | if (re.search(ev->summary()) != -1) |
239 | #else | 239 | #else |
240 | if (re.match(ev->summary()) != -1) | 240 | if (re.match(ev->summary()) != -1) |
241 | #endif | 241 | #endif |
242 | { | 242 | { |
243 | mMatchedEvents.append(ev); | 243 | mMatchedEvents.append(ev); |
244 | continue; | 244 | continue; |
245 | } | 245 | } |
246 | } | 246 | } |
247 | if (mDescriptionCheck->isChecked()) { | 247 | if (mDescriptionCheck->isChecked()) { |
248 | #if QT_VERSION >= 300 | 248 | #if QT_VERSION >= 0x030000 |
249 | if (re.search(ev->description()) != -1) | 249 | if (re.search(ev->description()) != -1) |
250 | #else | 250 | #else |
251 | if (re.match(ev->description()) != -1) | 251 | if (re.match(ev->description()) != -1) |
252 | #endif | 252 | #endif |
253 | { | 253 | { |
254 | mMatchedEvents.append(ev); | 254 | mMatchedEvents.append(ev); |
255 | continue; | 255 | continue; |
256 | } | 256 | } |
257 | } | 257 | } |
258 | if (mCategoryCheck->isChecked()) { | 258 | if (mCategoryCheck->isChecked()) { |
259 | #if QT_VERSION >= 300 | 259 | #if QT_VERSION >= 0x030000 |
260 | if (re.search(ev->categoriesStr()) != -1) | 260 | if (re.search(ev->categoriesStr()) != -1) |
261 | #else | 261 | #else |
262 | if (re.match(ev->categoriesStr()) != -1) | 262 | if (re.match(ev->categoriesStr()) != -1) |
263 | #endif | 263 | #endif |
264 | { | 264 | { |
265 | mMatchedEvents.append(ev); | 265 | mMatchedEvents.append(ev); |
266 | continue; | 266 | continue; |
267 | } | 267 | } |
268 | } | 268 | } |
269 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { | 269 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { |
270 | QPtrList<Attendee> tmpAList = ev->attendees(); | 270 | QPtrList<Attendee> tmpAList = ev->attendees(); |
271 | Attendee *a; | 271 | Attendee *a; |
272 | for (a = tmpAList.first(); a; a = tmpAList.next()) { | 272 | for (a = tmpAList.first(); a; a = tmpAList.next()) { |
273 | if (mSearchAName->isChecked()) { | 273 | if (mSearchAName->isChecked()) { |
274 | #if QT_VERSION >= 300 | 274 | #if QT_VERSION >= 0x030000 |
275 | if (re.search(a->name()) != -1) | 275 | if (re.search(a->name()) != -1) |
276 | #else | 276 | #else |
277 | if (re.match(a->name()) != -1) | 277 | if (re.match(a->name()) != -1) |
278 | #endif | 278 | #endif |
279 | { | 279 | { |
280 | mMatchedEvents.append(ev); | 280 | mMatchedEvents.append(ev); |
281 | break; | 281 | break; |
282 | } | 282 | } |
283 | } | 283 | } |
284 | if (mSearchAEmail->isChecked()) { | 284 | if (mSearchAEmail->isChecked()) { |
285 | #if QT_VERSION >= 300 | 285 | #if QT_VERSION >= 0x030000 |
286 | if (re.search(a->email()) != -1) | 286 | if (re.search(a->email()) != -1) |
287 | #else | 287 | #else |
288 | if (re.match(a->email()) != -1) | 288 | if (re.match(a->email()) != -1) |
289 | #endif | 289 | #endif |
290 | { | 290 | { |
291 | mMatchedEvents.append(ev); | 291 | mMatchedEvents.append(ev); |
292 | break; | 292 | break; |
293 | } | 293 | } |
294 | } | 294 | } |
295 | } | 295 | } |
296 | } | 296 | } |
297 | } | 297 | } |
298 | } | 298 | } |
299 | QPtrList<Todo> todos = mCalendar->todos( ); | 299 | QPtrList<Todo> todos = mCalendar->todos( ); |
300 | mMatchedTodos.clear(); | 300 | mMatchedTodos.clear(); |
301 | if ( mSearchTodo->isChecked() ) { | 301 | if ( mSearchTodo->isChecked() ) { |
302 | Todo *tod; | 302 | Todo *tod; |
303 | for(tod=todos.first();tod;tod=todos.next()) { | 303 | for(tod=todos.first();tod;tod=todos.next()) { |
304 | if (mSummaryCheck->isChecked()) { | 304 | if (mSummaryCheck->isChecked()) { |
305 | #if QT_VERSION >= 300 | 305 | #if QT_VERSION >= 0x030000 |
306 | if (re.search(tod->summary()) != -1) | 306 | if (re.search(tod->summary()) != -1) |
307 | #else | 307 | #else |
308 | if (re.match(tod->summary()) != -1) | 308 | if (re.match(tod->summary()) != -1) |
309 | #endif | 309 | #endif |
310 | { | 310 | { |
311 | mMatchedTodos.append(tod); | 311 | mMatchedTodos.append(tod); |
312 | continue; | 312 | continue; |
313 | } | 313 | } |
314 | } | 314 | } |
315 | if (mDescriptionCheck->isChecked()) { | 315 | if (mDescriptionCheck->isChecked()) { |
316 | #if QT_VERSION >= 300 | 316 | #if QT_VERSION >= 0x030000 |
317 | if (re.search(tod->description()) != -1) | 317 | if (re.search(tod->description()) != -1) |
318 | #else | 318 | #else |
319 | if (re.match(tod->description()) != -1) | 319 | if (re.match(tod->description()) != -1) |
320 | #endif | 320 | #endif |
321 | { | 321 | { |
322 | mMatchedTodos.append(tod); | 322 | mMatchedTodos.append(tod); |
323 | continue; | 323 | continue; |
324 | } | 324 | } |
325 | } | 325 | } |
326 | if (mCategoryCheck->isChecked()) { | 326 | if (mCategoryCheck->isChecked()) { |
327 | #if QT_VERSION >= 300 | 327 | #if QT_VERSION >= 0x030000 |
328 | if (re.search(tod->categoriesStr()) != -1) | 328 | if (re.search(tod->categoriesStr()) != -1) |
329 | #else | 329 | #else |
330 | if (re.match(tod->categoriesStr()) != -1) | 330 | if (re.match(tod->categoriesStr()) != -1) |
331 | #endif | 331 | #endif |
332 | { | 332 | { |
333 | mMatchedTodos.append(tod); | 333 | mMatchedTodos.append(tod); |
334 | continue; | 334 | continue; |
335 | } | 335 | } |
336 | } | 336 | } |
337 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { | 337 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { |
338 | QPtrList<Attendee> tmpAList = tod->attendees(); | 338 | QPtrList<Attendee> tmpAList = tod->attendees(); |
339 | Attendee *a; | 339 | Attendee *a; |
340 | for (a = tmpAList.first(); a; a = tmpAList.next()) { | 340 | for (a = tmpAList.first(); a; a = tmpAList.next()) { |
341 | if (mSearchAName->isChecked()) { | 341 | if (mSearchAName->isChecked()) { |
342 | #if QT_VERSION >= 300 | 342 | #if QT_VERSION >= 0x030000 |
343 | if (re.search(a->name()) != -1) | 343 | if (re.search(a->name()) != -1) |
344 | #else | 344 | #else |
345 | if (re.match(a->name()) != -1) | 345 | if (re.match(a->name()) != -1) |
346 | #endif | 346 | #endif |
347 | { | 347 | { |
348 | mMatchedTodos.append(tod); | 348 | mMatchedTodos.append(tod); |
349 | break; | 349 | break; |
350 | } | 350 | } |
351 | } | 351 | } |
352 | if (mSearchAEmail->isChecked()) { | 352 | if (mSearchAEmail->isChecked()) { |
353 | #if QT_VERSION >= 300 | 353 | #if QT_VERSION >= 0x030000 |
354 | if (re.search(a->email()) != -1) | 354 | if (re.search(a->email()) != -1) |
355 | #else | 355 | #else |
356 | if (re.match(a->email()) != -1) | 356 | if (re.match(a->email()) != -1) |
357 | #endif | 357 | #endif |
358 | { | 358 | { |
359 | mMatchedTodos.append(tod); | 359 | mMatchedTodos.append(tod); |
360 | break; | 360 | break; |
361 | } | 361 | } |
362 | } | 362 | } |
363 | } | 363 | } |
364 | } | 364 | } |
365 | } | 365 | } |
366 | } | 366 | } |
367 | mMatchedJournals.clear(); | 367 | mMatchedJournals.clear(); |
368 | if (mSearchJournal->isChecked() ) { | 368 | if (mSearchJournal->isChecked() ) { |
369 | QPtrList<Journal> journals = mCalendar->journals( ); | 369 | QPtrList<Journal> journals = mCalendar->journals( ); |
370 | Journal* journ; | 370 | Journal* journ; |
371 | 371 | ||
372 | for(journ=journals.first();journ;journ=journals.next()) { | 372 | for(journ=journals.first();journ;journ=journals.next()) { |
373 | if ( journ->dtStart().date() <= mEndDate->date() | 373 | if ( journ->dtStart().date() <= mEndDate->date() |
374 | &&journ->dtStart().date() >= mStartDate->date()) { | 374 | &&journ->dtStart().date() >= mStartDate->date()) { |
375 | #if QT_VERSION >= 300 | 375 | #if QT_VERSION >= 0x030000 |
376 | if (re.search(journ->description()) != -1) | 376 | if (re.search(journ->description()) != -1) |
377 | #else | 377 | #else |
378 | if (re.match(journ->description()) != -1) | 378 | if (re.match(journ->description()) != -1) |
379 | #endif | 379 | #endif |
380 | { | 380 | { |
381 | mMatchedJournals.append(journ); | 381 | mMatchedJournals.append(journ); |
382 | continue; | 382 | continue; |
383 | } | 383 | } |
384 | } | 384 | } |
385 | } | 385 | } |
386 | } | 386 | } |
387 | 387 | ||
388 | } | 388 | } |
389 | /* | 389 | /* |
390 | void SearchDialog::keyPressEvent ( QKeyEvent *e) | 390 | void SearchDialog::keyPressEvent ( QKeyEvent *e) |
391 | { | 391 | { |
392 | 392 | ||
393 | e->ignore(); | 393 | e->ignore(); |
394 | 394 | ||
395 | } | 395 | } |
396 | */ | 396 | */ |
397 | //mMatchedJournals; | 397 | //mMatchedJournals; |
diff --git a/korganizer/timespanview.cpp b/korganizer/timespanview.cpp index 67a3811..df8ff88 100644 --- a/korganizer/timespanview.cpp +++ b/korganizer/timespanview.cpp | |||
@@ -60,97 +60,97 @@ TimeSpanView::TimeSpanView( QWidget *parent, const char *name ) : | |||
60 | mTimeLine,SLOT(setContentsPos(int))); | 60 | mTimeLine,SLOT(setContentsPos(int))); |
61 | } | 61 | } |
62 | 62 | ||
63 | TimeSpanView::~TimeSpanView() | 63 | TimeSpanView::~TimeSpanView() |
64 | { | 64 | { |
65 | } | 65 | } |
66 | 66 | ||
67 | QValueList<int> TimeSpanView::splitterSizes() | 67 | QValueList<int> TimeSpanView::splitterSizes() |
68 | { | 68 | { |
69 | return mSplitter->sizes(); | 69 | return mSplitter->sizes(); |
70 | } | 70 | } |
71 | 71 | ||
72 | void TimeSpanView::setSplitterSizes( QValueList<int> sizes ) | 72 | void TimeSpanView::setSplitterSizes( QValueList<int> sizes ) |
73 | { | 73 | { |
74 | mSplitter->setSizes( sizes ); | 74 | mSplitter->setSizes( sizes ); |
75 | } | 75 | } |
76 | 76 | ||
77 | void TimeSpanView::addItem( KCal::Event *event ) | 77 | void TimeSpanView::addItem( KCal::Event *event ) |
78 | { | 78 | { |
79 | new QListViewItem( mList, event->summary() ); | 79 | new QListViewItem( mList, event->summary() ); |
80 | 80 | ||
81 | QDateTime startDt = event->dtStart(); | 81 | QDateTime startDt = event->dtStart(); |
82 | QDateTime endDt = event->dtEnd(); | 82 | QDateTime endDt = event->dtEnd(); |
83 | 83 | ||
84 | // kdDebug() << "TimeSpanView::addItem(): start: " << startDt.toString() | 84 | // kdDebug() << "TimeSpanView::addItem(): start: " << startDt.toString() |
85 | // << " end: " << endDt.toString() << endl; | 85 | // << " end: " << endDt.toString() << endl; |
86 | 86 | ||
87 | int startSecs = mStartDate.secsTo( startDt ); | 87 | int startSecs = mStartDate.secsTo( startDt ); |
88 | int durationSecs = startDt.secsTo( endDt ); | 88 | int durationSecs = startDt.secsTo( endDt ); |
89 | 89 | ||
90 | // kdDebug() << "--- startSecs: " << startSecs << " dur: " << durationSecs << endl; | 90 | // kdDebug() << "--- startSecs: " << startSecs << " dur: " << durationSecs << endl; |
91 | 91 | ||
92 | int startX = mStartDate.secsTo( startDt ) / mSecsPerPixel; | 92 | int startX = mStartDate.secsTo( startDt ) / mSecsPerPixel; |
93 | int endX = startX + startDt.secsTo( endDt ) / mSecsPerPixel; | 93 | int endX = startX + startDt.secsTo( endDt ) / mSecsPerPixel; |
94 | 94 | ||
95 | // kdDebug() << "TimeSpanView::addItem(): s: " << startX << " e: " << endX << endl; | 95 | // kdDebug() << "TimeSpanView::addItem(): s: " << startX << " e: " << endX << endl; |
96 | 96 | ||
97 | mLineView->addLine( startX, endX ); | 97 | mLineView->addLine( startX, endX ); |
98 | } | 98 | } |
99 | 99 | ||
100 | void TimeSpanView::clear() | 100 | void TimeSpanView::clear() |
101 | { | 101 | { |
102 | mList->clear(); | 102 | mList->clear(); |
103 | mLineView->clear(); | 103 | mLineView->clear(); |
104 | } | 104 | } |
105 | 105 | ||
106 | void TimeSpanView::updateView() | 106 | void TimeSpanView::updateView() |
107 | { | 107 | { |
108 | #if QT_VERSION >= 300 | 108 | #if QT_VERSION >= 0x030000 |
109 | mLineView->updateContents(); | 109 | mLineView->updateContents(); |
110 | mTimeLine->updateContents(); | 110 | mTimeLine->updateContents(); |
111 | #else | 111 | #else |
112 | #endif | 112 | #endif |
113 | } | 113 | } |
114 | 114 | ||
115 | void TimeSpanView::setDateRange( const QDateTime &start, const QDateTime &end ) | 115 | void TimeSpanView::setDateRange( const QDateTime &start, const QDateTime &end ) |
116 | { | 116 | { |
117 | mStartDate = start; | 117 | mStartDate = start; |
118 | mEndDate = end; | 118 | mEndDate = end; |
119 | 119 | ||
120 | mTimeLine->setDateRange( start, end ); | 120 | mTimeLine->setDateRange( start, end ); |
121 | 121 | ||
122 | mSecsPerPixel = mStartDate.secsTo( mEndDate ) / mLineView->pixelWidth(); | 122 | mSecsPerPixel = mStartDate.secsTo( mEndDate ) / mLineView->pixelWidth(); |
123 | } | 123 | } |
124 | 124 | ||
125 | QDateTime TimeSpanView::startDateTime() | 125 | QDateTime TimeSpanView::startDateTime() |
126 | { | 126 | { |
127 | return mStartDate; | 127 | return mStartDate; |
128 | } | 128 | } |
129 | 129 | ||
130 | QDateTime TimeSpanView::endDateTime() | 130 | QDateTime TimeSpanView::endDateTime() |
131 | { | 131 | { |
132 | return mEndDate; | 132 | return mEndDate; |
133 | } | 133 | } |
134 | 134 | ||
135 | void TimeSpanView::zoomIn() | 135 | void TimeSpanView::zoomIn() |
136 | { | 136 | { |
137 | int span = mStartDate.daysTo( mEndDate ); | 137 | int span = mStartDate.daysTo( mEndDate ); |
138 | setDateRange( mStartDate.addDays( span / 4 ), mEndDate.addDays( span / -4 ) ); | 138 | setDateRange( mStartDate.addDays( span / 4 ), mEndDate.addDays( span / -4 ) ); |
139 | 139 | ||
140 | emit dateRangeChanged(); | 140 | emit dateRangeChanged(); |
141 | } | 141 | } |
142 | 142 | ||
143 | void TimeSpanView::zoomOut() | 143 | void TimeSpanView::zoomOut() |
144 | { | 144 | { |
145 | int span = mStartDate.daysTo( mEndDate ); | 145 | int span = mStartDate.daysTo( mEndDate ); |
146 | setDateRange( mStartDate.addDays( span / -4 ), mEndDate.addDays( span / 4 ) ); | 146 | setDateRange( mStartDate.addDays( span / -4 ), mEndDate.addDays( span / 4 ) ); |
147 | 147 | ||
148 | emit dateRangeChanged(); | 148 | emit dateRangeChanged(); |
149 | } | 149 | } |
150 | 150 | ||
151 | void TimeSpanView::centerView() | 151 | void TimeSpanView::centerView() |
152 | { | 152 | { |
153 | QScrollBar *scrollBar = mLineView->horizontalScrollBar(); | 153 | QScrollBar *scrollBar = mLineView->horizontalScrollBar(); |
154 | int min = scrollBar->minValue(); | 154 | int min = scrollBar->minValue(); |
155 | int max = scrollBar->maxValue(); | 155 | int max = scrollBar->maxValue(); |
156 | scrollBar->setValue( min + (max-min) / 2 ); | 156 | scrollBar->setValue( min + (max-min) / 2 ); |
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index c23978d..bd13132 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -158,101 +158,97 @@ icalcomponent *ICalFormatImpl::writeEvent(Event *event) | |||
158 | 158 | ||
159 | if (event->hasEndDate()) { | 159 | if (event->hasEndDate()) { |
160 | // end time | 160 | // end time |
161 | icaltimetype end; | 161 | icaltimetype end; |
162 | if (event->doesFloat()) { | 162 | if (event->doesFloat()) { |
163 | // kdDebug(5800) << "§§ Event " << event->summary() << " floats." << endl; | 163 | // kdDebug(5800) << "§§ Event " << event->summary() << " floats." << endl; |
164 | // +1 day because end date is non-inclusive. | 164 | // +1 day because end date is non-inclusive. |
165 | end = writeICalDate( event->dtEnd().date().addDays( 1 ) ); | 165 | end = writeICalDate( event->dtEnd().date().addDays( 1 ) ); |
166 | } else { | 166 | } else { |
167 | // kdDebug(5800) << "§§ Event " << event->summary() << " has time." << endl; | 167 | // kdDebug(5800) << "§§ Event " << event->summary() << " has time." << endl; |
168 | end = writeICalDateTime(event->dtEnd()); | 168 | end = writeICalDateTime(event->dtEnd()); |
169 | } | 169 | } |
170 | icalcomponent_add_property(vevent,icalproperty_new_dtend(end)); | 170 | icalcomponent_add_property(vevent,icalproperty_new_dtend(end)); |
171 | } | 171 | } |
172 | 172 | ||
173 | // TODO: attachments, resources | 173 | // TODO: attachments, resources |
174 | #if 0 | 174 | #if 0 |
175 | // attachments | 175 | // attachments |
176 | tmpStrList = anEvent->attachments(); | 176 | tmpStrList = anEvent->attachments(); |
177 | for ( QStringList::Iterator it = tmpStrList.begin(); | 177 | for ( QStringList::Iterator it = tmpStrList.begin(); |
178 | it != tmpStrList.end(); | 178 | it != tmpStrList.end(); |
179 | ++it ) | 179 | ++it ) |
180 | addPropValue(vevent, VCAttachProp, (*it).utf8()); | 180 | addPropValue(vevent, VCAttachProp, (*it).utf8()); |
181 | 181 | ||
182 | // resources | 182 | // resources |
183 | tmpStrList = anEvent->resources(); | 183 | tmpStrList = anEvent->resources(); |
184 | tmpStr = tmpStrList.join(";"); | 184 | tmpStr = tmpStrList.join(";"); |
185 | if (!tmpStr.isEmpty()) | 185 | if (!tmpStr.isEmpty()) |
186 | addPropValue(vevent, VCResourcesProp, tmpStr.utf8()); | 186 | addPropValue(vevent, VCResourcesProp, tmpStr.utf8()); |
187 | 187 | ||
188 | #endif | 188 | #endif |
189 | 189 | ||
190 | // Transparency | 190 | // Transparency |
191 | switch( event->transparency() ) { | 191 | switch( event->transparency() ) { |
192 | case Event::Transparent: | 192 | case Event::Transparent: |
193 | icalcomponent_add_property(vevent, icalproperty_new_transp(ICAL_TRANSP_TRANSPARENT)); | 193 | icalcomponent_add_property(vevent, icalproperty_new_transp(ICAL_TRANSP_TRANSPARENT)); |
194 | break; | 194 | break; |
195 | case Event::Opaque: | 195 | case Event::Opaque: |
196 | icalcomponent_add_property(vevent, icalproperty_new_transp(ICAL_TRANSP_OPAQUE)); | 196 | icalcomponent_add_property(vevent, icalproperty_new_transp(ICAL_TRANSP_OPAQUE)); |
197 | break; | 197 | break; |
198 | } | 198 | } |
199 | 199 | ||
200 | return vevent; | 200 | return vevent; |
201 | } | 201 | } |
202 | 202 | ||
203 | icalcomponent *ICalFormatImpl::writeFreeBusy(FreeBusy *freebusy, | 203 | icalcomponent *ICalFormatImpl::writeFreeBusy(FreeBusy *freebusy, |
204 | Scheduler::Method method) | 204 | Scheduler::Method method) |
205 | { | 205 | { |
206 | #if QT_VERSION >= 300 | 206 | |
207 | kdDebug(5800) << "icalformatimpl: writeFreeBusy: startDate: " | ||
208 | << freebusy->dtStart().toString("ddd MMMM d yyyy: h:m:s ap") << " End Date: " | ||
209 | << freebusy->dtEnd().toString("ddd MMMM d yyyy: h:m:s ap") << endl; | ||
210 | #endif | ||
211 | 207 | ||
212 | icalcomponent *vfreebusy = icalcomponent_new(ICAL_VFREEBUSY_COMPONENT); | 208 | icalcomponent *vfreebusy = icalcomponent_new(ICAL_VFREEBUSY_COMPONENT); |
213 | 209 | ||
214 | writeIncidenceBase(vfreebusy,freebusy); | 210 | writeIncidenceBase(vfreebusy,freebusy); |
215 | 211 | ||
216 | icalcomponent_add_property(vfreebusy, icalproperty_new_dtstart( | 212 | icalcomponent_add_property(vfreebusy, icalproperty_new_dtstart( |
217 | writeICalDateTime(freebusy->dtStart()))); | 213 | writeICalDateTime(freebusy->dtStart()))); |
218 | 214 | ||
219 | icalcomponent_add_property(vfreebusy, icalproperty_new_dtend( | 215 | icalcomponent_add_property(vfreebusy, icalproperty_new_dtend( |
220 | writeICalDateTime(freebusy->dtEnd()))); | 216 | writeICalDateTime(freebusy->dtEnd()))); |
221 | 217 | ||
222 | if (method == Scheduler::Request) { | 218 | if (method == Scheduler::Request) { |
223 | icalcomponent_add_property(vfreebusy,icalproperty_new_uid( | 219 | icalcomponent_add_property(vfreebusy,icalproperty_new_uid( |
224 | freebusy->uid().utf8())); | 220 | freebusy->uid().utf8())); |
225 | } | 221 | } |
226 | 222 | ||
227 | //Loops through all the periods in the freebusy object | 223 | //Loops through all the periods in the freebusy object |
228 | QValueList<Period> list = freebusy->busyPeriods(); | 224 | QValueList<Period> list = freebusy->busyPeriods(); |
229 | QValueList<Period>::Iterator it; | 225 | QValueList<Period>::Iterator it; |
230 | icalperiodtype period; | 226 | icalperiodtype period; |
231 | for (it = list.begin(); it!= list.end(); ++it) { | 227 | for (it = list.begin(); it!= list.end(); ++it) { |
232 | period.start = writeICalDateTime((*it).start()); | 228 | period.start = writeICalDateTime((*it).start()); |
233 | period.end = writeICalDateTime((*it).end()); | 229 | period.end = writeICalDateTime((*it).end()); |
234 | icalcomponent_add_property(vfreebusy, icalproperty_new_freebusy(period) ); | 230 | icalcomponent_add_property(vfreebusy, icalproperty_new_freebusy(period) ); |
235 | } | 231 | } |
236 | 232 | ||
237 | return vfreebusy; | 233 | return vfreebusy; |
238 | } | 234 | } |
239 | 235 | ||
240 | icalcomponent *ICalFormatImpl::writeJournal(Journal *journal) | 236 | icalcomponent *ICalFormatImpl::writeJournal(Journal *journal) |
241 | { | 237 | { |
242 | icalcomponent *vjournal = icalcomponent_new(ICAL_VJOURNAL_COMPONENT); | 238 | icalcomponent *vjournal = icalcomponent_new(ICAL_VJOURNAL_COMPONENT); |
243 | 239 | ||
244 | writeIncidence(vjournal,journal); | 240 | writeIncidence(vjournal,journal); |
245 | 241 | ||
246 | // start time | 242 | // start time |
247 | if (journal->dtStart().isValid()) { | 243 | if (journal->dtStart().isValid()) { |
248 | icaltimetype start; | 244 | icaltimetype start; |
249 | if (journal->doesFloat()) { | 245 | if (journal->doesFloat()) { |
250 | // kdDebug(5800) << "§§ Incidence " << event->summary() << " floats." << endl; | 246 | // kdDebug(5800) << "§§ Incidence " << event->summary() << " floats." << endl; |
251 | start = writeICalDate(journal->dtStart().date()); | 247 | start = writeICalDate(journal->dtStart().date()); |
252 | } else { | 248 | } else { |
253 | // kdDebug(5800) << "§§ incidence " << event->summary() << " has time." << endl; | 249 | // kdDebug(5800) << "§§ incidence " << event->summary() << " has time." << endl; |
254 | start = writeICalDateTime(journal->dtStart()); | 250 | start = writeICalDateTime(journal->dtStart()); |
255 | } | 251 | } |
256 | icalcomponent_add_property(vjournal,icalproperty_new_dtstart(start)); | 252 | icalcomponent_add_property(vjournal,icalproperty_new_dtstart(start)); |
257 | } | 253 | } |
258 | 254 | ||
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp index 60b8bc7..567ae54 100644 --- a/microkde/KDGanttMinimizeSplitter.cpp +++ b/microkde/KDGanttMinimizeSplitter.cpp | |||
@@ -1,88 +1,88 @@ | |||
1 | /* -*- Mode: C++ -*- | 1 | /* -*- Mode: C++ -*- |
2 | $Id$ | 2 | $Id$ |
3 | */ | 3 | */ |
4 | 4 | ||
5 | /**************************************************************************** | 5 | /**************************************************************************** |
6 | ** Copyright (C) 2002-2004 Klarälvdalens Datakonsult AB. All rights reserved. | 6 | ** Copyright (C) 2002-2004 Klarälvdalens Datakonsult AB. All rights reserved. |
7 | ** | 7 | ** |
8 | ** This file is part of the KDGantt library. | 8 | ** This file is part of the KDGantt library. |
9 | ** | 9 | ** |
10 | ** This file may be distributed and/or modified under the terms of the | 10 | ** This file may be distributed and/or modified under the terms of the |
11 | ** GNU General Public License version 2 as published by the Free Software | 11 | ** GNU General Public License version 2 as published by the Free Software |
12 | ** Foundation and appearing in the file LICENSE.GPL included in the | 12 | ** Foundation and appearing in the file LICENSE.GPL included in the |
13 | ** packaging of this file. | 13 | ** packaging of this file. |
14 | ** | 14 | ** |
15 | ** Licensees holding valid commercial KDGantt licenses may use this file in | 15 | ** Licensees holding valid commercial KDGantt licenses may use this file in |
16 | ** accordance with the KDGantt Commercial License Agreement provided with | 16 | ** accordance with the KDGantt Commercial License Agreement provided with |
17 | ** the Software. | 17 | ** the Software. |
18 | ** | 18 | ** |
19 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 19 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
20 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 20 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
21 | ** | 21 | ** |
22 | ** See http://www.klaralvdalens-datakonsult.se/Public/products/ for | 22 | ** See http://www.klaralvdalens-datakonsult.se/Public/products/ for |
23 | ** information about KDGantt Commercial License Agreements. | 23 | ** information about KDGantt Commercial License Agreements. |
24 | ** | 24 | ** |
25 | ** Contact info@klaralvdalens-datakonsult.se if any conditions of this | 25 | ** Contact info@klaralvdalens-datakonsult.se if any conditions of this |
26 | ** licensing are not clear to you. | 26 | ** licensing are not clear to you. |
27 | ** | 27 | ** |
28 | ** As a special exception, permission is given to link this program | 28 | ** As a special exception, permission is given to link this program |
29 | ** with any edition of Qt, and distribute the resulting executable, | 29 | ** with any edition of Qt, and distribute the resulting executable, |
30 | ** without including the source code for Qt in the source distribution. | 30 | ** without including the source code for Qt in the source distribution. |
31 | ** | 31 | ** |
32 | **********************************************************************/ | 32 | **********************************************************************/ |
33 | 33 | ||
34 | #include "KDGanttMinimizeSplitter.h" | 34 | #include "KDGanttMinimizeSplitter.h" |
35 | #ifndef QT_NO_SPLITTER___ | 35 | #ifndef QT_NO_SPLITTER___ |
36 | 36 | ||
37 | #include "qpainter.h" | 37 | #include "qpainter.h" |
38 | #include "qdrawutil.h" | 38 | #include "qdrawutil.h" |
39 | #include "qbitmap.h" | 39 | #include "qbitmap.h" |
40 | #if QT_VERSION >= 300 | 40 | #if QT_VERSION >= 0x030000 |
41 | #include "qptrlist.h" | 41 | #include "qptrlist.h" |
42 | #include "qmemarray.h" | 42 | #include "qmemarray.h" |
43 | #else | 43 | #else |
44 | #include <qlist.h> | 44 | #include <qlist.h> |
45 | #include <qarray.h> | 45 | #include <qarray.h> |
46 | #define QPtrList QList | 46 | #define QPtrList QList |
47 | #define QMemArray QArray | 47 | #define QMemArray QArray |
48 | #endif | 48 | #endif |
49 | #include "qlayoutengine_p.h" | 49 | #include "qlayoutengine_p.h" |
50 | #include "qobjectlist.h" | 50 | #include "qobjectlist.h" |
51 | #include "qstyle.h" | 51 | #include "qstyle.h" |
52 | #include "qapplication.h" //sendPostedEvents | 52 | #include "qapplication.h" //sendPostedEvents |
53 | #include <qvaluelist.h> | 53 | #include <qvaluelist.h> |
54 | #include <qcursor.h> | 54 | #include <qcursor.h> |
55 | #ifndef KDGANTT_MASTER_CVS | 55 | #ifndef KDGANTT_MASTER_CVS |
56 | //#include "KDGanttMinimizeSplitter.moc" | 56 | //#include "KDGanttMinimizeSplitter.moc" |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | 59 | ||
60 | 60 | ||
61 | #ifndef DOXYGEN_SKIP_INTERNAL | 61 | #ifndef DOXYGEN_SKIP_INTERNAL |
62 | 62 | ||
63 | #if QT_VERSION >= 232 | 63 | #if QT_VERSION >= 232 |
64 | static int mouseOffset; | 64 | static int mouseOffset; |
65 | static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky | 65 | static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky |
66 | 66 | ||
67 | 67 | ||
68 | KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o, | 68 | KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o, |
69 | KDGanttMinimizeSplitter *parent, const char * name ) | 69 | KDGanttMinimizeSplitter *parent, const char * name ) |
70 | : QWidget( parent, name ), _activeButton( 0 ), _collapsed( false ) | 70 | : QWidget( parent, name ), _activeButton( 0 ), _collapsed( false ) |
71 | { | 71 | { |
72 | 72 | ||
73 | if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->width() < 650 ) { | 73 | if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->width() < 650 ) { |
74 | mSizeHint = QSize(7,7); | 74 | mSizeHint = QSize(7,7); |
75 | mUseOffset = true; | 75 | mUseOffset = true; |
76 | } else { | 76 | } else { |
77 | mSizeHint = QSize(6,6); | 77 | mSizeHint = QSize(6,6); |
78 | mUseOffset = false; | 78 | mUseOffset = false; |
79 | } | 79 | } |
80 | s = parent; | 80 | s = parent; |
81 | setOrientation(o); | 81 | setOrientation(o); |
82 | setMouseTracking( true ); | 82 | setMouseTracking( true ); |
83 | //setMaximumHeight( 5 ); // test only | 83 | //setMaximumHeight( 5 ); // test only |
84 | } | 84 | } |
85 | 85 | ||
86 | QSize KDGanttSplitterHandle::sizeHint() const | 86 | QSize KDGanttSplitterHandle::sizeHint() const |
87 | { | 87 | { |
88 | return mSizeHint; | 88 | return mSizeHint; |
@@ -582,97 +582,97 @@ void KDGanttMinimizeSplitter::childEvent( QChildEvent *c ) | |||
582 | return; | 582 | return; |
583 | 583 | ||
584 | QSplitterLayoutStruct *s = data->list.first(); | 584 | QSplitterLayoutStruct *s = data->list.first(); |
585 | while ( s ) { | 585 | while ( s ) { |
586 | if ( s->wid == c->child() ) | 586 | if ( s->wid == c->child() ) |
587 | return; | 587 | return; |
588 | s = data->list.next(); | 588 | s = data->list.next(); |
589 | } | 589 | } |
590 | addWidget( (QWidget*)c->child() ); | 590 | addWidget( (QWidget*)c->child() ); |
591 | recalc( isVisible() ); | 591 | recalc( isVisible() ); |
592 | 592 | ||
593 | } else if ( c->type() == QEvent::ChildRemoved ) { | 593 | } else if ( c->type() == QEvent::ChildRemoved ) { |
594 | QSplitterLayoutStruct *p = 0; | 594 | QSplitterLayoutStruct *p = 0; |
595 | if ( data->list.count() > 1 ) | 595 | if ( data->list.count() > 1 ) |
596 | p = data->list.at(1); //remove handle _after_ first widget. | 596 | p = data->list.at(1); //remove handle _after_ first widget. |
597 | QSplitterLayoutStruct *s = data->list.first(); | 597 | QSplitterLayoutStruct *s = data->list.first(); |
598 | while ( s ) { | 598 | while ( s ) { |
599 | if ( s->wid == c->child() ) { | 599 | if ( s->wid == c->child() ) { |
600 | data->list.removeRef( s ); | 600 | data->list.removeRef( s ); |
601 | delete s; | 601 | delete s; |
602 | if ( p && p->isSplitter ) { | 602 | if ( p && p->isSplitter ) { |
603 | data->list.removeRef( p ); | 603 | data->list.removeRef( p ); |
604 | delete p->wid; //will call childEvent | 604 | delete p->wid; //will call childEvent |
605 | delete p; | 605 | delete p; |
606 | } | 606 | } |
607 | recalcId(); | 607 | recalcId(); |
608 | doResize(); | 608 | doResize(); |
609 | return; | 609 | return; |
610 | } | 610 | } |
611 | p = s; | 611 | p = s; |
612 | s = data->list.next(); | 612 | s = data->list.next(); |
613 | } | 613 | } |
614 | } | 614 | } |
615 | } | 615 | } |
616 | 616 | ||
617 | 617 | ||
618 | /*! | 618 | /*! |
619 | Shows a rubber band at position \a p. If \a p is negative, the | 619 | Shows a rubber band at position \a p. If \a p is negative, the |
620 | rubber band is removed. | 620 | rubber band is removed. |
621 | */ | 621 | */ |
622 | void KDGanttMinimizeSplitter::setRubberband( int p ) | 622 | void KDGanttMinimizeSplitter::setRubberband( int p ) |
623 | { | 623 | { |
624 | QPainter paint( this ); | 624 | QPainter paint( this ); |
625 | paint.setPen( gray ); | 625 | paint.setPen( gray ); |
626 | paint.setBrush( gray ); | 626 | paint.setBrush( gray ); |
627 | paint.setRasterOp( XorROP ); | 627 | paint.setRasterOp( XorROP ); |
628 | QRect r = contentsRect(); | 628 | QRect r = contentsRect(); |
629 | const int rBord = 3; //Themable???? | 629 | const int rBord = 3; //Themable???? |
630 | #if QT_VERSION >= 300 | 630 | #if QT_VERSION >= 0x030000 |
631 | int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); | 631 | int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); |
632 | #else | 632 | #else |
633 | int sw = style().splitterWidth(); | 633 | int sw = style().splitterWidth(); |
634 | #endif | 634 | #endif |
635 | if ( orient == Horizontal ) { | 635 | if ( orient == Horizontal ) { |
636 | if ( opaqueOldPos >= 0 ) | 636 | if ( opaqueOldPos >= 0 ) |
637 | paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(), | 637 | paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(), |
638 | 2*rBord, r.height() ); | 638 | 2*rBord, r.height() ); |
639 | if ( p >= 0 ) | 639 | if ( p >= 0 ) |
640 | paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() ); | 640 | paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() ); |
641 | } else { | 641 | } else { |
642 | if ( opaqueOldPos >= 0 ) | 642 | if ( opaqueOldPos >= 0 ) |
643 | paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord, | 643 | paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord, |
644 | r.width(), 2*rBord ); | 644 | r.width(), 2*rBord ); |
645 | if ( p >= 0 ) | 645 | if ( p >= 0 ) |
646 | paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord ); | 646 | paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord ); |
647 | } | 647 | } |
648 | opaqueOldPos = p; | 648 | opaqueOldPos = p; |
649 | } | 649 | } |
650 | 650 | ||
651 | 651 | ||
652 | /*! \reimp */ | 652 | /*! \reimp */ |
653 | bool KDGanttMinimizeSplitter::event( QEvent *e ) | 653 | bool KDGanttMinimizeSplitter::event( QEvent *e ) |
654 | { | 654 | { |
655 | if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) { | 655 | if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) { |
656 | recalc( isVisible() ); | 656 | recalc( isVisible() ); |
657 | if ( e->type() == QEvent::Show ) | 657 | if ( e->type() == QEvent::Show ) |
658 | data->firstShow = FALSE; | 658 | data->firstShow = FALSE; |
659 | } | 659 | } |
660 | return QWidget::event( e ); | 660 | return QWidget::event( e ); |
661 | } | 661 | } |
662 | 662 | ||
663 | 663 | ||
664 | /*! | 664 | /*! |
665 | \obsolete | 665 | \obsolete |
666 | 666 | ||
667 | Draws the splitter handle in the rectangle described by \a x, \a y, | 667 | Draws the splitter handle in the rectangle described by \a x, \a y, |
668 | \a w, \a h using painter \a p. | 668 | \a w, \a h using painter \a p. |
669 | \sa QStyle::drawPrimitive() | 669 | \sa QStyle::drawPrimitive() |
670 | */ | 670 | */ |
671 | void KDGanttMinimizeSplitter::drawSplitter( QPainter *p, | 671 | void KDGanttMinimizeSplitter::drawSplitter( QPainter *p, |
672 | QCOORD x, QCOORD y, QCOORD w, QCOORD h ) | 672 | QCOORD x, QCOORD y, QCOORD w, QCOORD h ) |
673 | { | 673 | { |
674 | #if 0 | 674 | #if 0 |
675 | // LR | 675 | // LR |
676 | style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(), | 676 | style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(), |
677 | (orientation() == Qt::Horizontal ? | 677 | (orientation() == Qt::Horizontal ? |
678 | QStyle::Style_Horizontal : 0)); | 678 | QStyle::Style_Horizontal : 0)); |
@@ -864,97 +864,97 @@ void KDGanttMinimizeSplitter::expandPos( int id, int* min, int* max ) | |||
864 | QWidget* w = s->wid; | 864 | QWidget* w = s->wid; |
865 | *max = pick( w->mapToParent( QPoint( w->width(), w->height() ) ) ) -8; | 865 | *max = pick( w->mapToParent( QPoint( w->width(), w->height() ) ) ) -8; |
866 | } | 866 | } |
867 | } | 867 | } |
868 | 868 | ||
869 | 869 | ||
870 | /*! | 870 | /*! |
871 | Returns the valid range of the splitter with id \a id in \a *min and \a *max. | 871 | Returns the valid range of the splitter with id \a id in \a *min and \a *max. |
872 | 872 | ||
873 | \sa idAfter() | 873 | \sa idAfter() |
874 | */ | 874 | */ |
875 | 875 | ||
876 | void KDGanttMinimizeSplitter::getRange( int id, int *min, int *max ) | 876 | void KDGanttMinimizeSplitter::getRange( int id, int *min, int *max ) |
877 | { | 877 | { |
878 | int minB = 0;//before | 878 | int minB = 0;//before |
879 | int maxB = 0; | 879 | int maxB = 0; |
880 | int minA = 0; | 880 | int minA = 0; |
881 | int maxA = 0;//after | 881 | int maxA = 0;//after |
882 | int n = data->list.count(); | 882 | int n = data->list.count(); |
883 | if ( id < 0 || id >= n ) | 883 | if ( id < 0 || id >= n ) |
884 | return; | 884 | return; |
885 | int i; | 885 | int i; |
886 | for ( i = 0; i < id; i++ ) { | 886 | for ( i = 0; i < id; i++ ) { |
887 | QSplitterLayoutStruct *s = data->list.at(i); | 887 | QSplitterLayoutStruct *s = data->list.at(i); |
888 | if ( s->wid->isHidden() ) { | 888 | if ( s->wid->isHidden() ) { |
889 | //ignore | 889 | //ignore |
890 | } else if ( s->isSplitter ) { | 890 | } else if ( s->isSplitter ) { |
891 | minB += s->sizer; | 891 | minB += s->sizer; |
892 | maxB += s->sizer; | 892 | maxB += s->sizer; |
893 | } else { | 893 | } else { |
894 | minB += pick( minSize(s->wid) ); | 894 | minB += pick( minSize(s->wid) ); |
895 | maxB += pick( s->wid->maximumSize() ); | 895 | maxB += pick( s->wid->maximumSize() ); |
896 | } | 896 | } |
897 | } | 897 | } |
898 | for ( i = id; i < n; i++ ) { | 898 | for ( i = id; i < n; i++ ) { |
899 | QSplitterLayoutStruct *s = data->list.at(i); | 899 | QSplitterLayoutStruct *s = data->list.at(i); |
900 | if ( s->wid->isHidden() ) { | 900 | if ( s->wid->isHidden() ) { |
901 | //ignore | 901 | //ignore |
902 | } else if ( s->isSplitter ) { | 902 | } else if ( s->isSplitter ) { |
903 | minA += s->sizer; | 903 | minA += s->sizer; |
904 | maxA += s->sizer; | 904 | maxA += s->sizer; |
905 | } else { | 905 | } else { |
906 | minA += pick( minSize(s->wid) ); | 906 | minA += pick( minSize(s->wid) ); |
907 | maxA += pick( s->wid->maximumSize() ); | 907 | maxA += pick( s->wid->maximumSize() ); |
908 | } | 908 | } |
909 | } | 909 | } |
910 | QRect r = contentsRect(); | 910 | QRect r = contentsRect(); |
911 | if ( orient == Horizontal && false ) { | 911 | if ( orient == Horizontal && false ) { |
912 | #if QT_VERSION >= 300 | 912 | #if QT_VERSION >= 0x030000 |
913 | int splitterWidth = style().pixelMetric(QStyle::PM_SplitterWidth, this); | 913 | int splitterWidth = style().pixelMetric(QStyle::PM_SplitterWidth, this); |
914 | #else | 914 | #else |
915 | int splitterWidth = style().splitterWidth(); | 915 | int splitterWidth = style().splitterWidth(); |
916 | #endif | 916 | #endif |
917 | 917 | ||
918 | if ( min ) | 918 | if ( min ) |
919 | *min = pick(r.topRight()) - QMIN( maxB, pick(r.size())-minA ) - splitterWidth; | 919 | *min = pick(r.topRight()) - QMIN( maxB, pick(r.size())-minA ) - splitterWidth; |
920 | if ( max ) | 920 | if ( max ) |
921 | *max = pick(r.topRight()) - QMAX( minB, pick(r.size())-maxA ) - splitterWidth; | 921 | *max = pick(r.topRight()) - QMAX( minB, pick(r.size())-maxA ) - splitterWidth; |
922 | } else { | 922 | } else { |
923 | if ( min ) | 923 | if ( min ) |
924 | *min = pick(r.topLeft()) + QMAX( minB, pick(r.size())-maxA ); | 924 | *min = pick(r.topLeft()) + QMAX( minB, pick(r.size())-maxA ); |
925 | if ( max ) | 925 | if ( max ) |
926 | *max = pick(r.topLeft()) + QMIN( maxB, pick(r.size())-minA ); | 926 | *max = pick(r.topLeft()) + QMIN( maxB, pick(r.size())-minA ); |
927 | } | 927 | } |
928 | } | 928 | } |
929 | 929 | ||
930 | 930 | ||
931 | /*! | 931 | /*! |
932 | Returns the closest legal position to \a p of the splitter with id \a id. | 932 | Returns the closest legal position to \a p of the splitter with id \a id. |
933 | 933 | ||
934 | \sa idAfter() | 934 | \sa idAfter() |
935 | */ | 935 | */ |
936 | 936 | ||
937 | int KDGanttMinimizeSplitter::adjustPos( int p, int id ) | 937 | int KDGanttMinimizeSplitter::adjustPos( int p, int id ) |
938 | { | 938 | { |
939 | int min = 0; | 939 | int min = 0; |
940 | int max = 0; | 940 | int max = 0; |
941 | getRange( id, &min, &max ); | 941 | getRange( id, &min, &max ); |
942 | p = QMAX( min, QMIN( p, max ) ); | 942 | p = QMAX( min, QMIN( p, max ) ); |
943 | 943 | ||
944 | return p; | 944 | return p; |
945 | } | 945 | } |
946 | 946 | ||
947 | 947 | ||
948 | void KDGanttMinimizeSplitter::doResize() | 948 | void KDGanttMinimizeSplitter::doResize() |
949 | { | 949 | { |
950 | QRect r = contentsRect(); | 950 | QRect r = contentsRect(); |
951 | int i; | 951 | int i; |
952 | int n = data->list.count(); | 952 | int n = data->list.count(); |
953 | QMemArray<QLayoutStruct> a( n ); | 953 | QMemArray<QLayoutStruct> a( n ); |
954 | for ( i = 0; i< n; i++ ) { | 954 | for ( i = 0; i< n; i++ ) { |
955 | a[i].init(); | 955 | a[i].init(); |
956 | QSplitterLayoutStruct *s = data->list.at(i); | 956 | QSplitterLayoutStruct *s = data->list.at(i); |
957 | if ( s->wid->isHidden() ) { | 957 | if ( s->wid->isHidden() ) { |
958 | a[i].stretch = 0; | 958 | a[i].stretch = 0; |
959 | a[i].sizeHint = a[i].minimumSize = 0; | 959 | a[i].sizeHint = a[i].minimumSize = 0; |
960 | a[i].maximumSize = 0; | 960 | a[i].maximumSize = 0; |
@@ -1342,97 +1342,97 @@ QValueList<int> KDGanttMinimizeSplitter::sizes() const | |||
1342 | 1342 | ||
1343 | /*! | 1343 | /*! |
1344 | Sets the size parameters to the values given in \a list. | 1344 | Sets the size parameters to the values given in \a list. |
1345 | If the splitter is horizontal, the values set the sizes from | 1345 | If the splitter is horizontal, the values set the sizes from |
1346 | left to right. If it is vertical, the sizes are applied from | 1346 | left to right. If it is vertical, the sizes are applied from |
1347 | top to bottom. | 1347 | top to bottom. |
1348 | Extra values in \a list are ignored. | 1348 | Extra values in \a list are ignored. |
1349 | 1349 | ||
1350 | If \a list contains too few values, the result is undefined | 1350 | If \a list contains too few values, the result is undefined |
1351 | but the program will still be well-behaved. | 1351 | but the program will still be well-behaved. |
1352 | 1352 | ||
1353 | \sa sizes() | 1353 | \sa sizes() |
1354 | */ | 1354 | */ |
1355 | 1355 | ||
1356 | void KDGanttMinimizeSplitter::setSizes( QValueList<int> list ) | 1356 | void KDGanttMinimizeSplitter::setSizes( QValueList<int> list ) |
1357 | { | 1357 | { |
1358 | processChildEvents(); | 1358 | processChildEvents(); |
1359 | QValueList<int>::Iterator it = list.begin(); | 1359 | QValueList<int>::Iterator it = list.begin(); |
1360 | QSplitterLayoutStruct *s = data->list.first(); | 1360 | QSplitterLayoutStruct *s = data->list.first(); |
1361 | while ( s && it != list.end() ) { | 1361 | while ( s && it != list.end() ) { |
1362 | if ( !s->isSplitter ) { | 1362 | if ( !s->isSplitter ) { |
1363 | s->sizer = *it; | 1363 | s->sizer = *it; |
1364 | ++it; | 1364 | ++it; |
1365 | } | 1365 | } |
1366 | s = data->list.next(); | 1366 | s = data->list.next(); |
1367 | } | 1367 | } |
1368 | doResize(); | 1368 | doResize(); |
1369 | } | 1369 | } |
1370 | 1370 | ||
1371 | 1371 | ||
1372 | /*! | 1372 | /*! |
1373 | Gets all posted child events, ensuring that the internal state of | 1373 | Gets all posted child events, ensuring that the internal state of |
1374 | the splitter is consistent. | 1374 | the splitter is consistent. |
1375 | */ | 1375 | */ |
1376 | 1376 | ||
1377 | void KDGanttMinimizeSplitter::processChildEvents() | 1377 | void KDGanttMinimizeSplitter::processChildEvents() |
1378 | { | 1378 | { |
1379 | QApplication::sendPostedEvents( this, QEvent::ChildInserted ); | 1379 | QApplication::sendPostedEvents( this, QEvent::ChildInserted ); |
1380 | } | 1380 | } |
1381 | 1381 | ||
1382 | 1382 | ||
1383 | /*! | 1383 | /*! |
1384 | \reimp | 1384 | \reimp |
1385 | */ | 1385 | */ |
1386 | 1386 | ||
1387 | void KDGanttMinimizeSplitter::styleChange( QStyle& old ) | 1387 | void KDGanttMinimizeSplitter::styleChange( QStyle& old ) |
1388 | { | 1388 | { |
1389 | 1389 | ||
1390 | #if QT_VERSION >= 300 | 1390 | #if QT_VERSION >= 0x030000 |
1391 | int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); | 1391 | int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); |
1392 | #else | 1392 | #else |
1393 | int sw = style().splitterWidth(); | 1393 | int sw = style().splitterWidth(); |
1394 | #endif | 1394 | #endif |
1395 | QSplitterLayoutStruct *s = data->list.first(); | 1395 | QSplitterLayoutStruct *s = data->list.first(); |
1396 | while ( s ) { | 1396 | while ( s ) { |
1397 | if ( s->isSplitter ) | 1397 | if ( s->isSplitter ) |
1398 | s->sizer = sw; | 1398 | s->sizer = sw; |
1399 | s = data->list.next(); | 1399 | s = data->list.next(); |
1400 | } | 1400 | } |
1401 | doResize(); | 1401 | doResize(); |
1402 | QFrame::styleChange( old ); | 1402 | QFrame::styleChange( old ); |
1403 | } | 1403 | } |
1404 | 1404 | ||
1405 | #endif | 1405 | #endif |
1406 | 1406 | ||
1407 | /*! | 1407 | /*! |
1408 | Specifies the direction of the minimize buttons. | 1408 | Specifies the direction of the minimize buttons. |
1409 | If the orientation of the splitter is horizontal then with | 1409 | If the orientation of the splitter is horizontal then with |
1410 | KDGanttMinimizeSplitter::Left or KDGanttMinimizeSplitter::Right should be used, | 1410 | KDGanttMinimizeSplitter::Left or KDGanttMinimizeSplitter::Right should be used, |
1411 | otherwise either KDGanttMinimizeSplitter::Up or KDGanttMinimizeSplitter::Down | 1411 | otherwise either KDGanttMinimizeSplitter::Up or KDGanttMinimizeSplitter::Down |
1412 | should be used. | 1412 | should be used. |
1413 | */ | 1413 | */ |
1414 | void KDGanttMinimizeSplitter::setMinimizeDirection( Direction direction ) | 1414 | void KDGanttMinimizeSplitter::setMinimizeDirection( Direction direction ) |
1415 | { | 1415 | { |
1416 | _direction = direction; | 1416 | _direction = direction; |
1417 | } | 1417 | } |
1418 | 1418 | ||
1419 | /*! | 1419 | /*! |
1420 | Returns the direction of the minimize buttons. | 1420 | Returns the direction of the minimize buttons. |
1421 | */ | 1421 | */ |
1422 | KDGanttMinimizeSplitter::Direction KDGanttMinimizeSplitter::minimizeDirection() const | 1422 | KDGanttMinimizeSplitter::Direction KDGanttMinimizeSplitter::minimizeDirection() const |
1423 | { | 1423 | { |
1424 | return _direction; | 1424 | return _direction; |
1425 | } | 1425 | } |
1426 | 1426 | ||
1427 | /* | 1427 | /* |
1428 | This is a copy of qGeomCalc() in qlayoutengine.cpp which | 1428 | This is a copy of qGeomCalc() in qlayoutengine.cpp which |
1429 | unfortunately isn't exported. | 1429 | unfortunately isn't exported. |
1430 | */ | 1430 | */ |
1431 | static inline int toFixed( int i ) { return i * 256; } | 1431 | static inline int toFixed( int i ) { return i * 256; } |
1432 | static inline int fRound( int i ) { | 1432 | static inline int fRound( int i ) { |
1433 | return ( i % 256 < 128 ) ? i / 256 : 1 + i / 256; | 1433 | return ( i % 256 < 128 ) ? i / 256 : 1 + i / 256; |
1434 | } | 1434 | } |
1435 | void kdganttGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int pos, | 1435 | void kdganttGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int pos, |
1436 | int space, int spacer ) | 1436 | int space, int spacer ) |
1437 | { | 1437 | { |
1438 | typedef int fixed; | 1438 | typedef int fixed; |
diff --git a/microkde/kcalendarsystemgregorian.cpp b/microkde/kcalendarsystemgregorian.cpp index 7c5b62a..cc12b9f 100644 --- a/microkde/kcalendarsystemgregorian.cpp +++ b/microkde/kcalendarsystemgregorian.cpp | |||
@@ -9,115 +9,115 @@ | |||
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | // Derived gregorian kde calendar class | 21 | // Derived gregorian kde calendar class |
22 | // Just a schema. | 22 | // Just a schema. |
23 | 23 | ||
24 | #include <qdatetime.h> | 24 | #include <qdatetime.h> |
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | 26 | ||
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | #include <kdebug.h> | 28 | #include <kdebug.h> |
29 | 29 | ||
30 | #include "kcalendarsystemgregorian.h" | 30 | #include "kcalendarsystemgregorian.h" |
31 | 31 | ||
32 | KCalendarSystemGregorian::KCalendarSystemGregorian(const KLocale * locale) | 32 | KCalendarSystemGregorian::KCalendarSystemGregorian(const KLocale * locale) |
33 | : KCalendarSystem(locale) | 33 | : KCalendarSystem(locale) |
34 | { | 34 | { |
35 | kdDebug(5400) << "Created gregorian calendar" << endl; | 35 | kdDebug(5400) << "Created gregorian calendar" << endl; |
36 | } | 36 | } |
37 | 37 | ||
38 | KCalendarSystemGregorian::~KCalendarSystemGregorian() | 38 | KCalendarSystemGregorian::~KCalendarSystemGregorian() |
39 | { | 39 | { |
40 | } | 40 | } |
41 | 41 | ||
42 | int KCalendarSystemGregorian::year(const QDate& date) const | 42 | int KCalendarSystemGregorian::year(const QDate& date) const |
43 | { | 43 | { |
44 | // kdDebug(5400) << "Gregorian year..." << endl; | 44 | // kdDebug(5400) << "Gregorian year..." << endl; |
45 | return date.year(); | 45 | return date.year(); |
46 | } | 46 | } |
47 | 47 | ||
48 | int KCalendarSystemGregorian::monthsInYear( const QDate & ) const | 48 | int KCalendarSystemGregorian::monthsInYear( const QDate & ) const |
49 | { | 49 | { |
50 | // kdDebug(5400) << "Gregorian monthsInYear" << endl; | 50 | // kdDebug(5400) << "Gregorian monthsInYear" << endl; |
51 | 51 | ||
52 | return 12; | 52 | return 12; |
53 | } | 53 | } |
54 | 54 | ||
55 | int KCalendarSystemGregorian::weeksInYear(int year) const | 55 | int KCalendarSystemGregorian::weeksInYear(int year) const |
56 | { | 56 | { |
57 | #if QT_VERSION >= 300 | 57 | #if QT_VERSION >= 0x030000 |
58 | QDate temp; | 58 | QDate temp; |
59 | temp.setYMD(year, 12, 31); | 59 | temp.setYMD(year, 12, 31); |
60 | 60 | ||
61 | // If the last day of the year is in the first week, we have to check the | 61 | // If the last day of the year is in the first week, we have to check the |
62 | // week before | 62 | // week before |
63 | if ( temp.weekNumber() == 1 ) | 63 | if ( temp.weekNumber() == 1 ) |
64 | temp.addDays(-7); | 64 | temp.addDays(-7); |
65 | 65 | ||
66 | return temp.weekNumber(); | 66 | return temp.weekNumber(); |
67 | #else | 67 | #else |
68 | return 52; | 68 | return 52; |
69 | #endif | 69 | #endif |
70 | } | 70 | } |
71 | 71 | ||
72 | int KCalendarSystemGregorian::weekNumber(const QDate& date, | 72 | int KCalendarSystemGregorian::weekNumber(const QDate& date, |
73 | int * yearNum) const | 73 | int * yearNum) const |
74 | { | 74 | { |
75 | #if QT_VERSION >= 300 | 75 | #if QT_VERSION >= 0x030000 |
76 | return date.weekNumber(yearNum); | 76 | return date.weekNumber(yearNum); |
77 | #else | 77 | #else |
78 | return 1; | 78 | return 1; |
79 | #endif | 79 | #endif |
80 | } | 80 | } |
81 | 81 | ||
82 | QString KCalendarSystemGregorian::monthName(const QDate& date, | 82 | QString KCalendarSystemGregorian::monthName(const QDate& date, |
83 | bool shortName) const | 83 | bool shortName) const |
84 | { | 84 | { |
85 | return monthName(month(date), shortName); | 85 | return monthName(month(date), shortName); |
86 | } | 86 | } |
87 | 87 | ||
88 | QString KCalendarSystemGregorian::monthNamePossessive(const QDate& date, bool shortName) const | 88 | QString KCalendarSystemGregorian::monthNamePossessive(const QDate& date, bool shortName) const |
89 | { | 89 | { |
90 | return monthNamePossessive(month(date), shortName); | 90 | return monthNamePossessive(month(date), shortName); |
91 | } | 91 | } |
92 | 92 | ||
93 | QString KCalendarSystemGregorian::monthName(int month, bool shortName) const | 93 | QString KCalendarSystemGregorian::monthName(int month, bool shortName) const |
94 | { | 94 | { |
95 | // kdDebug(5400) << "Gregorian getMonthName" << endl; | 95 | // kdDebug(5400) << "Gregorian getMonthName" << endl; |
96 | 96 | ||
97 | if ( shortName ) | 97 | if ( shortName ) |
98 | switch ( month ) | 98 | switch ( month ) |
99 | { | 99 | { |
100 | case 1: | 100 | case 1: |
101 | return locale()->translate("January", "Jan"); | 101 | return locale()->translate("January", "Jan"); |
102 | case 2: | 102 | case 2: |
103 | return locale()->translate("February", "Feb"); | 103 | return locale()->translate("February", "Feb"); |
104 | case 3: | 104 | case 3: |
105 | return locale()->translate("March", "Mar"); | 105 | return locale()->translate("March", "Mar"); |
106 | case 4: | 106 | case 4: |
107 | return locale()->translate("April", "Apr"); | 107 | return locale()->translate("April", "Apr"); |
108 | case 5: | 108 | case 5: |
109 | return locale()->translate("May short", "May"); | 109 | return locale()->translate("May short", "May"); |
110 | case 6: | 110 | case 6: |
111 | return locale()->translate("June", "Jun"); | 111 | return locale()->translate("June", "Jun"); |
112 | case 7: | 112 | case 7: |
113 | return locale()->translate("July", "Jul"); | 113 | return locale()->translate("July", "Jul"); |
114 | case 8: | 114 | case 8: |
115 | return locale()->translate("August", "Aug"); | 115 | return locale()->translate("August", "Aug"); |
116 | case 9: | 116 | case 9: |
117 | return locale()->translate("September", "Sep"); | 117 | return locale()->translate("September", "Sep"); |
118 | case 10: | 118 | case 10: |
119 | return locale()->translate("October", "Oct"); | 119 | return locale()->translate("October", "Oct"); |
120 | case 11: | 120 | case 11: |
121 | return locale()->translate("November", "Nov"); | 121 | return locale()->translate("November", "Nov"); |
122 | case 12: | 122 | case 12: |
123 | return locale()->translate("December", "Dec"); | 123 | return locale()->translate("December", "Dec"); |
@@ -186,111 +186,111 @@ QString KCalendarSystemGregorian::monthNamePossessive(int month, | |||
186 | return locale()->translate("of November", "of Nov"); | 186 | return locale()->translate("of November", "of Nov"); |
187 | case 12: | 187 | case 12: |
188 | return locale()->translate("of December", "of Dec"); | 188 | return locale()->translate("of December", "of Dec"); |
189 | } | 189 | } |
190 | else | 190 | else |
191 | switch ( month ) | 191 | switch ( month ) |
192 | { | 192 | { |
193 | case 1: | 193 | case 1: |
194 | return locale()->translate("of January"); | 194 | return locale()->translate("of January"); |
195 | case 2: | 195 | case 2: |
196 | return locale()->translate("of February"); | 196 | return locale()->translate("of February"); |
197 | case 3: | 197 | case 3: |
198 | return locale()->translate("of March"); | 198 | return locale()->translate("of March"); |
199 | case 4: | 199 | case 4: |
200 | return locale()->translate("of April"); | 200 | return locale()->translate("of April"); |
201 | case 5: | 201 | case 5: |
202 | return locale()->translate("of May long", "of May"); | 202 | return locale()->translate("of May long", "of May"); |
203 | case 6: | 203 | case 6: |
204 | return locale()->translate("of June"); | 204 | return locale()->translate("of June"); |
205 | case 7: | 205 | case 7: |
206 | return locale()->translate("of July"); | 206 | return locale()->translate("of July"); |
207 | case 8: | 207 | case 8: |
208 | return locale()->translate("of August"); | 208 | return locale()->translate("of August"); |
209 | case 9: | 209 | case 9: |
210 | return locale()->translate("of September"); | 210 | return locale()->translate("of September"); |
211 | case 10: | 211 | case 10: |
212 | return locale()->translate("of October"); | 212 | return locale()->translate("of October"); |
213 | case 11: | 213 | case 11: |
214 | return locale()->translate("of November"); | 214 | return locale()->translate("of November"); |
215 | case 12: | 215 | case 12: |
216 | return locale()->translate("of December"); | 216 | return locale()->translate("of December"); |
217 | } | 217 | } |
218 | 218 | ||
219 | return QString::null; | 219 | return QString::null; |
220 | } | 220 | } |
221 | 221 | ||
222 | bool KCalendarSystemGregorian::setYMD(QDate & date, int y, int m, int d) const | 222 | bool KCalendarSystemGregorian::setYMD(QDate & date, int y, int m, int d) const |
223 | { | 223 | { |
224 | // We don't want Qt to add 1900 to them | 224 | // We don't want Qt to add 1900 to them |
225 | if ( y >= 0 && y <= 99 ) | 225 | if ( y >= 0 && y <= 99 ) |
226 | return false; | 226 | return false; |
227 | 227 | ||
228 | // QDate supports gregorian internally | 228 | // QDate supports gregorian internally |
229 | return date.setYMD(y, m, d); | 229 | return date.setYMD(y, m, d); |
230 | } | 230 | } |
231 | 231 | ||
232 | QDate KCalendarSystemGregorian::addYears(const QDate & date, int nyears) const | 232 | QDate KCalendarSystemGregorian::addYears(const QDate & date, int nyears) const |
233 | { | 233 | { |
234 | #if QT_VERSION >= 300 | 234 | #if QT_VERSION >= 0x030000 |
235 | return date.addYears(nyears); | 235 | return date.addYears(nyears); |
236 | #else | 236 | #else |
237 | int year = date.year() + nyears; | 237 | int year = date.year() + nyears; |
238 | int month = date.month(); | 238 | int month = date.month(); |
239 | int day = date.day(); | 239 | int day = date.day(); |
240 | QDate newDate( year, month, 1 ); | 240 | QDate newDate( year, month, 1 ); |
241 | if ( day > newDate.daysInMonth() ) day = newDate.daysInMonth(); | 241 | if ( day > newDate.daysInMonth() ) day = newDate.daysInMonth(); |
242 | return QDate( year, month, day ); | 242 | return QDate( year, month, day ); |
243 | #endif | 243 | #endif |
244 | } | 244 | } |
245 | 245 | ||
246 | QDate KCalendarSystemGregorian::addMonths(const QDate & date, int nmonths) const | 246 | QDate KCalendarSystemGregorian::addMonths(const QDate & date, int nmonths) const |
247 | { | 247 | { |
248 | #if QT_VERSION >= 300 | 248 | #if QT_VERSION >= 0x030000 |
249 | return date.addMonths(nmonths); | 249 | return date.addMonths(nmonths); |
250 | #else | 250 | #else |
251 | int month = date.month(); | 251 | int month = date.month(); |
252 | int nyears; | 252 | int nyears; |
253 | if ( nmonths >= 0 ) { | 253 | if ( nmonths >= 0 ) { |
254 | month += nmonths; | 254 | month += nmonths; |
255 | nyears = ( month - 1 ) / 12; | 255 | nyears = ( month - 1 ) / 12; |
256 | month = ( ( month - 1 ) % 12 ) + 1; | 256 | month = ( ( month - 1 ) % 12 ) + 1; |
257 | } else { | 257 | } else { |
258 | nyears = nmonths / 12; | 258 | nyears = nmonths / 12; |
259 | // nmonths += nyears * 12; | 259 | // nmonths += nyears * 12; |
260 | nmonths = nmonths % 12; | 260 | nmonths = nmonths % 12; |
261 | month += nmonths; | 261 | month += nmonths; |
262 | if ( month <= 0 ) { | 262 | if ( month <= 0 ) { |
263 | month += 12; | 263 | month += 12; |
264 | --nyears; | 264 | --nyears; |
265 | } | 265 | } |
266 | } | 266 | } |
267 | int year = date.year() + nyears; | 267 | int year = date.year() + nyears; |
268 | int day = date.day(); | 268 | int day = date.day(); |
269 | QDate newDate( year, month, 1 ); | 269 | QDate newDate( year, month, 1 ); |
270 | if ( day > newDate.daysInMonth() ) day = newDate.daysInMonth(); | 270 | if ( day > newDate.daysInMonth() ) day = newDate.daysInMonth(); |
271 | return QDate( year, month, day ); | 271 | return QDate( year, month, day ); |
272 | #endif | 272 | #endif |
273 | } | 273 | } |
274 | 274 | ||
275 | QDate KCalendarSystemGregorian::addDays(const QDate & date, int ndays) const | 275 | QDate KCalendarSystemGregorian::addDays(const QDate & date, int ndays) const |
276 | { | 276 | { |
277 | return date.addDays(ndays); | 277 | return date.addDays(ndays); |
278 | } | 278 | } |
279 | 279 | ||
280 | QString KCalendarSystemGregorian::weekDayName(int col, bool shortName) const | 280 | QString KCalendarSystemGregorian::weekDayName(int col, bool shortName) const |
281 | { | 281 | { |
282 | // ### Should this really be different to each calendar system? Or are we | 282 | // ### Should this really be different to each calendar system? Or are we |
283 | // only going to support weeks with 7 days? | 283 | // only going to support weeks with 7 days? |
284 | 284 | ||
285 | //kdDebug(5400) << "Gregorian wDayName" << endl; | 285 | //kdDebug(5400) << "Gregorian wDayName" << endl; |
286 | return locale()->weekDayName(col, shortName); | 286 | return locale()->weekDayName(col, shortName); |
287 | } | 287 | } |
288 | 288 | ||
289 | QString KCalendarSystemGregorian::weekDayName(const QDate& date, bool shortName) const | 289 | QString KCalendarSystemGregorian::weekDayName(const QDate& date, bool shortName) const |
290 | { | 290 | { |
291 | return weekDayName(dayOfWeek(date), shortName); | 291 | return weekDayName(dayOfWeek(date), shortName); |
292 | } | 292 | } |
293 | 293 | ||
294 | 294 | ||
295 | int KCalendarSystemGregorian::dayOfWeek(const QDate& date) const | 295 | int KCalendarSystemGregorian::dayOfWeek(const QDate& date) const |
296 | { | 296 | { |