-rw-r--r-- | kaddressbook/kabcore.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/mainembedded.cpp | 124 | ||||
-rw-r--r-- | kaddressbook/views/contactlistview.cpp | 2 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 5 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 13 | ||||
-rw-r--r-- | korganizer/main.cpp | 2 | ||||
-rw-r--r-- | pwmanager/pwmanager/getmasterpwwnd_emb.cpp | 11 |
7 files changed, 35 insertions, 128 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 1074a62..c4382d6 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -295,192 +295,194 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const | |||
295 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 295 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
296 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); | 296 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); |
297 | 297 | ||
298 | 298 | ||
299 | #ifndef KAB_EMBEDDED | 299 | #ifndef KAB_EMBEDDED |
300 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 300 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
301 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 301 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
302 | 302 | ||
303 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 303 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
304 | SLOT( browse( const QString& ) ) ); | 304 | SLOT( browse( const QString& ) ) ); |
305 | 305 | ||
306 | 306 | ||
307 | mAddressBookService = new KAddressBookService( this ); | 307 | mAddressBookService = new KAddressBookService( this ); |
308 | 308 | ||
309 | #endif //KAB_EMBEDDED | 309 | #endif //KAB_EMBEDDED |
310 | 310 | ||
311 | mMessageTimer = new QTimer( this ); | 311 | mMessageTimer = new QTimer( this ); |
312 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); | 312 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); |
313 | mEditorDialog = 0; | 313 | mEditorDialog = 0; |
314 | createAddresseeEditorDialog( this ); | 314 | createAddresseeEditorDialog( this ); |
315 | setModified( false ); | 315 | setModified( false ); |
316 | mBRdisabled = 0; | 316 | mBRdisabled = 0; |
317 | #ifndef DESKTOP_VERSION | 317 | #ifndef DESKTOP_VERSION |
318 | infrared = 0; | 318 | infrared = 0; |
319 | #endif | 319 | #endif |
320 | toggleBeamReceive( ); | 320 | toggleBeamReceive( ); |
321 | } | 321 | } |
322 | 322 | ||
323 | KABCore::~KABCore() | 323 | KABCore::~KABCore() |
324 | { | 324 | { |
325 | // save(); | 325 | // save(); |
326 | //saveSettings(); | 326 | //saveSettings(); |
327 | //KABPrefs::instance()->writeConfig(); | 327 | //KABPrefs::instance()->writeConfig(); |
328 | delete AddresseeConfig::instance(); | 328 | delete AddresseeConfig::instance(); |
329 | mAddressBook = 0; | 329 | mAddressBook = 0; |
330 | KABC::StdAddressBook::close(); | 330 | KABC::StdAddressBook::close(); |
331 | 331 | ||
332 | delete syncManager; | 332 | delete syncManager; |
333 | #ifndef DESKTOP_VERSION | 333 | #ifndef DESKTOP_VERSION |
334 | if ( infrared ) | 334 | if ( infrared ) |
335 | delete infrared; | 335 | delete infrared; |
336 | #endif | 336 | #endif |
337 | } | 337 | } |
338 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | 338 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) |
339 | { | 339 | { |
340 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); | 340 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); |
341 | if ( cmsg == "setDocument(QString)" ) { | 341 | if ( cmsg == "setDocument(QString)" ) { |
342 | QDataStream stream( data, IO_ReadOnly ); | 342 | QDataStream stream( data, IO_ReadOnly ); |
343 | QString fileName; | 343 | QString fileName; |
344 | stream >> fileName; | 344 | stream >> fileName; |
345 | recieve( fileName ); | 345 | recieve( fileName ); |
346 | return; | 346 | return; |
347 | } | 347 | } |
348 | } | 348 | } |
349 | void KABCore::toggleBeamReceive( ) | 349 | void KABCore::toggleBeamReceive( ) |
350 | { | 350 | { |
351 | if ( mBRdisabled ) | 351 | if ( mBRdisabled ) |
352 | return; | 352 | return; |
353 | #ifndef DESKTOP_VERSION | 353 | #ifndef DESKTOP_VERSION |
354 | if ( infrared ) { | 354 | if ( infrared ) { |
355 | qDebug("AB disable BeamReceive "); | 355 | qDebug("AB disable BeamReceive "); |
356 | delete infrared; | 356 | delete infrared; |
357 | infrared = 0; | 357 | infrared = 0; |
358 | mActionBR->setChecked(false); | 358 | mActionBR->setChecked(false); |
359 | return; | 359 | return; |
360 | } | 360 | } |
361 | qDebug("AB enable BeamReceive "); | 361 | qDebug("AB enable BeamReceive "); |
362 | mActionBR->setChecked(true); | 362 | mActionBR->setChecked(true); |
363 | 363 | ||
364 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | 364 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; |
365 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | 365 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); |
366 | #endif | 366 | #endif |
367 | } | 367 | } |
368 | 368 | ||
369 | 369 | ||
370 | void KABCore::disableBR(bool b) | 370 | void KABCore::disableBR(bool b) |
371 | { | 371 | { |
372 | #ifndef DESKTOP_VERSION | 372 | #ifndef DESKTOP_VERSION |
373 | if ( b ) { | 373 | if ( b ) { |
374 | if ( infrared ) { | 374 | if ( infrared ) { |
375 | toggleBeamReceive( ); | 375 | toggleBeamReceive( ); |
376 | } | 376 | } |
377 | mBRdisabled = true; | 377 | mBRdisabled = true; |
378 | } else { | 378 | } else { |
379 | if ( mBRdisabled ) { | 379 | if ( mBRdisabled ) { |
380 | mBRdisabled = false; | 380 | mBRdisabled = false; |
381 | //toggleBeamReceive( ); | 381 | //toggleBeamReceive( ); |
382 | } | 382 | } |
383 | } | 383 | } |
384 | #endif | 384 | #endif |
385 | 385 | ||
386 | } | 386 | } |
387 | void KABCore::recieve( QString fn ) | 387 | void KABCore::recieve( QString fn ) |
388 | { | 388 | { |
389 | //qDebug("KABCore::recieve "); | 389 | //qDebug("KABCore::recieve "); |
390 | int count = mAddressBook->importFromFile( fn, true ); | 390 | int count = mAddressBook->importFromFile( fn, true ); |
391 | if ( count ) | ||
392 | setModified( true ); | ||
391 | mViewManager->refreshView(); | 393 | mViewManager->refreshView(); |
392 | message(i18n("%1 contact(s) received!").arg( count )); | 394 | message(i18n("%1 contact(s) received!").arg( count )); |
393 | topLevelWidget()->showMaximized(); | 395 | topLevelWidget()->showMaximized(); |
394 | topLevelWidget()->raise(); | 396 | topLevelWidget()->raise(); |
395 | } | 397 | } |
396 | void KABCore::restoreSettings() | 398 | void KABCore::restoreSettings() |
397 | { | 399 | { |
398 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 400 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
399 | 401 | ||
400 | bool state; | 402 | bool state; |
401 | 403 | ||
402 | if (mMultipleViewsAtOnce) | 404 | if (mMultipleViewsAtOnce) |
403 | state = KABPrefs::instance()->mDetailsPageVisible; | 405 | state = KABPrefs::instance()->mDetailsPageVisible; |
404 | else | 406 | else |
405 | state = false; | 407 | state = false; |
406 | 408 | ||
407 | mActionDetails->setChecked( state ); | 409 | mActionDetails->setChecked( state ); |
408 | setDetailsVisible( state ); | 410 | setDetailsVisible( state ); |
409 | 411 | ||
410 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 412 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
411 | 413 | ||
412 | mActionJumpBar->setChecked( state ); | 414 | mActionJumpBar->setChecked( state ); |
413 | setJumpButtonBarVisible( state ); | 415 | setJumpButtonBarVisible( state ); |
414 | /*US | 416 | /*US |
415 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 417 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
416 | if ( splitterSize.count() == 0 ) { | 418 | if ( splitterSize.count() == 0 ) { |
417 | splitterSize.append( width() / 2 ); | 419 | splitterSize.append( width() / 2 ); |
418 | splitterSize.append( width() / 2 ); | 420 | splitterSize.append( width() / 2 ); |
419 | } | 421 | } |
420 | mMiniSplitter->setSizes( splitterSize ); | 422 | mMiniSplitter->setSizes( splitterSize ); |
421 | if ( mExtensionBarSplitter ) { | 423 | if ( mExtensionBarSplitter ) { |
422 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 424 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
423 | if ( splitterSize.count() == 0 ) { | 425 | if ( splitterSize.count() == 0 ) { |
424 | splitterSize.append( width() / 2 ); | 426 | splitterSize.append( width() / 2 ); |
425 | splitterSize.append( width() / 2 ); | 427 | splitterSize.append( width() / 2 ); |
426 | } | 428 | } |
427 | mExtensionBarSplitter->setSizes( splitterSize ); | 429 | mExtensionBarSplitter->setSizes( splitterSize ); |
428 | 430 | ||
429 | } | 431 | } |
430 | */ | 432 | */ |
431 | mViewManager->restoreSettings(); | 433 | mViewManager->restoreSettings(); |
432 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 434 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
433 | mExtensionManager->restoreSettings(); | 435 | mExtensionManager->restoreSettings(); |
434 | #ifdef DESKTOP_VERSION | 436 | #ifdef DESKTOP_VERSION |
435 | int wid = width(); | 437 | int wid = width(); |
436 | if ( wid < 10 ) | 438 | if ( wid < 10 ) |
437 | wid = 400; | 439 | wid = 400; |
438 | #else | 440 | #else |
439 | int wid = QApplication::desktop()->width(); | 441 | int wid = QApplication::desktop()->width(); |
440 | if ( wid < 640 ) | 442 | if ( wid < 640 ) |
441 | wid = QApplication::desktop()->height(); | 443 | wid = QApplication::desktop()->height(); |
442 | #endif | 444 | #endif |
443 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | 445 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; |
444 | if ( true /*splitterSize.count() == 0*/ ) { | 446 | if ( true /*splitterSize.count() == 0*/ ) { |
445 | splitterSize.append( wid / 2 ); | 447 | splitterSize.append( wid / 2 ); |
446 | splitterSize.append( wid / 2 ); | 448 | splitterSize.append( wid / 2 ); |
447 | } | 449 | } |
448 | mMiniSplitter->setSizes( splitterSize ); | 450 | mMiniSplitter->setSizes( splitterSize ); |
449 | if ( mExtensionBarSplitter ) { | 451 | if ( mExtensionBarSplitter ) { |
450 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 452 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
451 | if ( true /*splitterSize.count() == 0*/ ) { | 453 | if ( true /*splitterSize.count() == 0*/ ) { |
452 | splitterSize.append( wid / 2 ); | 454 | splitterSize.append( wid / 2 ); |
453 | splitterSize.append( wid / 2 ); | 455 | splitterSize.append( wid / 2 ); |
454 | } | 456 | } |
455 | mExtensionBarSplitter->setSizes( splitterSize ); | 457 | mExtensionBarSplitter->setSizes( splitterSize ); |
456 | 458 | ||
457 | } | 459 | } |
458 | 460 | ||
459 | 461 | ||
460 | } | 462 | } |
461 | 463 | ||
462 | void KABCore::saveSettings() | 464 | void KABCore::saveSettings() |
463 | { | 465 | { |
464 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 466 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
465 | if ( mExtensionBarSplitter ) | 467 | if ( mExtensionBarSplitter ) |
466 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 468 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
467 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 469 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
468 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 470 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
469 | #ifndef KAB_EMBEDDED | 471 | #ifndef KAB_EMBEDDED |
470 | 472 | ||
471 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 473 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
472 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 474 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
473 | #endif //KAB_EMBEDDED | 475 | #endif //KAB_EMBEDDED |
474 | mExtensionManager->saveSettings(); | 476 | mExtensionManager->saveSettings(); |
475 | mViewManager->saveSettings(); | 477 | mViewManager->saveSettings(); |
476 | 478 | ||
477 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 479 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
478 | } | 480 | } |
479 | 481 | ||
480 | KABC::AddressBook *KABCore::addressBook() const | 482 | KABC::AddressBook *KABCore::addressBook() const |
481 | { | 483 | { |
482 | return mAddressBook; | 484 | return mAddressBook; |
483 | } | 485 | } |
484 | 486 | ||
485 | KConfig *KABCore::config() | 487 | KConfig *KABCore::config() |
486 | { | 488 | { |
@@ -2786,118 +2788,120 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | |||
2786 | if ( syncManager->mWriteBackFile ) | 2788 | if ( syncManager->mWriteBackFile ) |
2787 | { | 2789 | { |
2788 | if ( external ) | 2790 | if ( external ) |
2789 | abLocal.removeSyncAddressees( !isXML); | 2791 | abLocal.removeSyncAddressees( !isXML); |
2790 | qDebug("Saving remote AB "); | 2792 | qDebug("Saving remote AB "); |
2791 | if ( ! abLocal.saveAB()) | 2793 | if ( ! abLocal.saveAB()) |
2792 | qDebug("Error writing back AB to file "); | 2794 | qDebug("Error writing back AB to file "); |
2793 | if ( isXML ) { | 2795 | if ( isXML ) { |
2794 | // afterwrite processing | 2796 | // afterwrite processing |
2795 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2797 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); |
2796 | } | 2798 | } |
2797 | } | 2799 | } |
2798 | } | 2800 | } |
2799 | setModified(); | 2801 | setModified(); |
2800 | 2802 | ||
2801 | } | 2803 | } |
2802 | if ( syncOK ) | 2804 | if ( syncOK ) |
2803 | mViewManager->refreshView(); | 2805 | mViewManager->refreshView(); |
2804 | return syncOK; | 2806 | return syncOK; |
2805 | 2807 | ||
2806 | } | 2808 | } |
2807 | 2809 | ||
2808 | 2810 | ||
2809 | //this is a overwritten callbackmethods from the syncinterface | 2811 | //this is a overwritten callbackmethods from the syncinterface |
2810 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) | 2812 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) |
2811 | { | 2813 | { |
2812 | if ( resource == "phone" ) | 2814 | if ( resource == "phone" ) |
2813 | return syncPhone(); | 2815 | return syncPhone(); |
2814 | disableBR( true ); | 2816 | disableBR( true ); |
2815 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 2817 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
2816 | 2818 | ||
2817 | AddressBook abLocal( resource,"syncContact"); | 2819 | AddressBook abLocal( resource,"syncContact"); |
2818 | bool syncOK = false; | 2820 | bool syncOK = false; |
2819 | if ( abLocal.load() ) { | 2821 | if ( abLocal.load() ) { |
2820 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 2822 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
2821 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2823 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2822 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); | 2824 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); |
2823 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 2825 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
2824 | if ( syncOK ) { | 2826 | if ( syncOK ) { |
2825 | if ( syncManager->mWriteBackFile ) { | 2827 | if ( syncManager->mWriteBackFile ) { |
2826 | abLocal.removeSyncAddressees( false ); | 2828 | abLocal.removeSyncAddressees( false ); |
2827 | abLocal.saveAB(); | 2829 | abLocal.saveAB(); |
2828 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2830 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); |
2829 | } | 2831 | } |
2830 | } | 2832 | } |
2831 | setModified(); | 2833 | setModified(); |
2832 | } | 2834 | } |
2833 | if ( syncOK ) | 2835 | if ( syncOK ) |
2834 | mViewManager->refreshView(); | 2836 | mViewManager->refreshView(); |
2835 | disableBR( false ); | 2837 | disableBR( false ); |
2836 | return syncOK; | 2838 | return syncOK; |
2837 | 2839 | ||
2838 | } | 2840 | } |
2839 | void KABCore::message( QString m ) | 2841 | void KABCore::message( QString m ) |
2840 | { | 2842 | { |
2841 | topLevelWidget()->setCaption( m ); | 2843 | topLevelWidget()->setCaption( m ); |
2842 | mMessageTimer->start( 15000, true ); | 2844 | mMessageTimer->start( 15000, true ); |
2843 | } | 2845 | } |
2844 | bool KABCore::syncPhone() | 2846 | bool KABCore::syncPhone() |
2845 | { | 2847 | { |
2846 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2848 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2847 | QString fileName = getPhoneFile(); | 2849 | QString fileName = getPhoneFile(); |
2848 | if ( !PhoneAccess::readFromPhone( fileName) ) { | 2850 | if ( !PhoneAccess::readFromPhone( fileName) ) { |
2849 | message(i18n("Phone access failed!")); | 2851 | message(i18n("Phone access failed!")); |
2850 | return false; | 2852 | return false; |
2851 | } | 2853 | } |
2852 | AddressBook abLocal( fileName,"syncContact"); | 2854 | AddressBook abLocal( fileName,"syncContact"); |
2853 | bool syncOK = false; | 2855 | bool syncOK = false; |
2854 | { | 2856 | { |
2855 | abLocal.importFromFile( fileName ); | 2857 | abLocal.importFromFile( fileName ); |
2856 | qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 2858 | qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
2857 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2859 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2858 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); | 2860 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); |
2859 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 2861 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
2860 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 2862 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
2861 | if ( syncOK ) { | 2863 | if ( syncOK ) { |
2862 | if ( syncManager->mWriteBackFile ) { | 2864 | if ( syncManager->mWriteBackFile ) { |
2863 | abLocal.removeSyncAddressees( true ); | 2865 | abLocal.removeSyncAddressees( true ); |
2864 | abLocal.saveABphone( fileName ); | 2866 | abLocal.saveABphone( fileName ); |
2865 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); | 2867 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); |
2866 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); | 2868 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); |
2867 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2869 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); |
2868 | } | 2870 | } |
2869 | } | 2871 | } |
2870 | setModified(); | 2872 | setModified(); |
2871 | } | 2873 | } |
2872 | if ( syncOK ) | 2874 | if ( syncOK ) |
2873 | mViewManager->refreshView(); | 2875 | mViewManager->refreshView(); |
2874 | return syncOK; | 2876 | return syncOK; |
2875 | } | 2877 | } |
2876 | void KABCore::getFile( bool success ) | 2878 | void KABCore::getFile( bool success ) |
2877 | { | 2879 | { |
2878 | if ( ! success ) { | 2880 | if ( ! success ) { |
2879 | message( i18n("Error receiving file. Nothing changed!") ); | 2881 | message( i18n("Error receiving file. Nothing changed!") ); |
2880 | return; | 2882 | return; |
2881 | } | 2883 | } |
2882 | mAddressBook->importFromFile( sentSyncFile() , false, true ); | 2884 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); |
2885 | if ( count ) | ||
2886 | setModified( true ); | ||
2883 | message( i18n("Pi-Sync successful!") ); | 2887 | message( i18n("Pi-Sync successful!") ); |
2884 | mViewManager->refreshView(); | 2888 | mViewManager->refreshView(); |
2885 | } | 2889 | } |
2886 | void KABCore::syncFileRequest() | 2890 | void KABCore::syncFileRequest() |
2887 | { | 2891 | { |
2888 | mAddressBook->export2File( sentSyncFile() ); | 2892 | mAddressBook->export2File( sentSyncFile() ); |
2889 | } | 2893 | } |
2890 | QString KABCore::sentSyncFile() | 2894 | QString KABCore::sentSyncFile() |
2891 | { | 2895 | { |
2892 | #ifdef DESKTOP_VERSION | 2896 | #ifdef DESKTOP_VERSION |
2893 | return locateLocal( "tmp", "copysyncab.vcf" ); | 2897 | return locateLocal( "tmp", "copysyncab.vcf" ); |
2894 | #else | 2898 | #else |
2895 | return QString( "/tmp/copysyncab.vcf" ); | 2899 | return QString( "/tmp/copysyncab.vcf" ); |
2896 | #endif | 2900 | #endif |
2897 | } | 2901 | } |
2898 | 2902 | ||
2899 | void KABCore::setCaptionBack() | 2903 | void KABCore::setCaptionBack() |
2900 | { | 2904 | { |
2901 | mMessageTimer->stop(); | 2905 | mMessageTimer->stop(); |
2902 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); | 2906 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); |
2903 | } | 2907 | } |
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp index a2ff1e9..40089a1 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp | |||
@@ -1,215 +1,95 @@ | |||
1 | #ifndef DESKTOP_VERSION | 1 | #ifndef DESKTOP_VERSION |
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qcopchannel_qws.h> | 3 | #include <qcopchannel_qws.h> |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #else | 5 | #else |
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | #include <qwindowsstyle.h> | 7 | #include <qwindowsstyle.h> |
8 | #include <qplatinumstyle.h> | 8 | #include <qplatinumstyle.h> |
9 | #include <qmainwindow.h> | 9 | #include <qmainwindow.h> |
10 | #endif | 10 | #endif |
11 | 11 | ||
12 | #include <qtextcodec.h> | ||
12 | #include <kstandarddirs.h> | 13 | #include <kstandarddirs.h> |
13 | #include <qregexp.h> | 14 | #include <qregexp.h> |
14 | #include <kglobal.h> | 15 | #include <kglobal.h> |
15 | #include <stdio.h> | 16 | #include <stdio.h> |
16 | #include <qdir.h> | 17 | #include <qdir.h> |
17 | #include "kaddressbookmain.h" | 18 | #include "kaddressbookmain.h" |
18 | #include "externalapphandler.h" | 19 | #include "externalapphandler.h" |
19 | #include <libkdepim/kpimglobalprefs.h> | 20 | #include <libkdepim/kpimglobalprefs.h> |
20 | 21 | ||
21 | int main( int argc, char **argv ) | 22 | int main( int argc, char **argv ) |
22 | { | 23 | { |
23 | #ifndef DESKTOP_VERSION | 24 | #ifndef DESKTOP_VERSION |
24 | QPEApplication a( argc, argv ); | 25 | QPEApplication a( argc, argv ); |
25 | a.setKeepRunning (); | 26 | a.setKeepRunning (); |
26 | #else | 27 | #else |
27 | QApplication a( argc, argv ); | 28 | QApplication a( argc, argv ); |
28 | QApplication::setStyle( new QPlatinumStyle ()); | 29 | QApplication::setStyle( new QPlatinumStyle ()); |
29 | QString hdir = QDir::homeDirPath(); | 30 | QString hdir = QDir::homeDirPath(); |
30 | // there is a bug when creating dirs for WIN 98 | 31 | // there is a bug when creating dirs for WIN 98 |
31 | // it is difficult to fix, because we have no WIN 98 runnung | 32 | // it is difficult to fix, because we have no WIN 98 runnung |
32 | // such that we try it to create the dirs at startup here | 33 | // such that we try it to create the dirs at startup here |
33 | if ( hdir == "C:\\" ) { // win 98 or ME | 34 | if ( hdir == "C:\\" ) { // win 98 or ME |
34 | QDir app_dir; | 35 | QDir app_dir; |
35 | if ( !app_dir.exists("C:\\kdepim") ) | 36 | if ( !app_dir.exists("C:\\kdepim") ) |
36 | app_dir.mkdir ("C:\\kdepim"); | 37 | app_dir.mkdir ("C:\\kdepim"); |
37 | if ( !app_dir.exists("C:\\kdepim\\apps") ) | 38 | if ( !app_dir.exists("C:\\kdepim\\apps") ) |
38 | app_dir.mkdir ("C:\\kdepim\\apps"); | 39 | app_dir.mkdir ("C:\\kdepim\\apps"); |
39 | if ( !app_dir.exists("C:\\kdepim\\config") ) | 40 | if ( !app_dir.exists("C:\\kdepim\\config") ) |
40 | app_dir.mkdir ("C:\\kdepim\\config"); | 41 | app_dir.mkdir ("C:\\kdepim\\config"); |
41 | if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) | 42 | if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) |
42 | app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); | 43 | app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); |
43 | } | 44 | } |
44 | #endif | 45 | #endif |
45 | 46 | ||
46 | bool exitHelp = false; | 47 | bool exitHelp = false; |
47 | if ( argc > 1 ) { | 48 | if ( argc > 1 ) { |
48 | QString command = argv[1]; | 49 | QString command = argv[1]; |
49 | if ( command == "-help" ){ | 50 | if ( command == "-help" ){ |
50 | printf("KA/E command line commands:\n"); | 51 | printf("KA/E command line commands:\n"); |
51 | printf(" no command: Start KA/E in usual way\n"); | 52 | printf(" no command: Start KA/E in usual way\n"); |
52 | printf(" -help: This output\n"); | 53 | printf(" -help: This output\n"); |
53 | printf(" KA/E is exiting now. Bye!\n"); | 54 | printf(" KA/E is exiting now. Bye!\n"); |
54 | exitHelp = true; | 55 | exitHelp = true; |
55 | } | 56 | } |
56 | } | 57 | } |
57 | if ( ! exitHelp ) { | 58 | if ( ! exitHelp ) { |
58 | 59 | ||
59 | KGlobal::setAppName( "kaddressbook" ); | 60 | KGlobal::setAppName( "kaddressbook" ); |
60 | #ifndef DESKTOP_VERSION | 61 | #ifndef DESKTOP_VERSION |
61 | if ( QApplication::desktop()->width() > 320 ) | 62 | if ( QApplication::desktop()->width() > 320 ) |
62 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); | 63 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); |
63 | else | 64 | else |
64 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); | 65 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); |
65 | #else | 66 | #else |
66 | QString fileName ; | 67 | QString fileName ; |
67 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; | 68 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; |
68 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 69 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
69 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); | 70 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); |
70 | 71 | ||
71 | #endif | 72 | #endif |
72 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); | 73 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); |
73 | KAddressBookMain m ; | 74 | KAddressBookMain m ; |
74 | //US MainWindow m; | 75 | //US MainWindow m; |
75 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 76 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
76 | 77 | ||
77 | { | 78 | { |
78 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 79 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
79 | } | 80 | } |
80 | #ifndef DESKTOP_VERSION | 81 | #ifndef DESKTOP_VERSION |
81 | a.showMainWidget( &m ); | 82 | a.showMainWidget( &m ); |
82 | 83 | ||
83 | #else | 84 | #else |
84 | a.setMainWidget( &m ); | 85 | a.setMainWidget( &m ); |
85 | m.resize (640, 480 ); | 86 | m.resize (640, 480 ); |
86 | m.show(); | 87 | m.show(); |
87 | #endif | 88 | #endif |
88 | a.exec(); | 89 | a.exec(); |
89 | 90 | ||
90 | 91 | ||
91 | } | 92 | } |
92 | qDebug("KA: Bye! "); | 93 | qDebug("KA: Bye! "); |
93 | } | 94 | } |
94 | 95 | ||
95 | /* | ||
96 | #include <stdlib.h> | ||
97 | |||
98 | #include <qstring.h> | ||
99 | |||
100 | #include <kabc/stdaddressbook.h> | ||
101 | #include <kaboutdata.h> | ||
102 | #include <kcmdlineargs.h> | ||
103 | #include <kcrash.h> | ||
104 | #include <kdebug.h> | ||
105 | #include <klocale.h> | ||
106 | #include <kstartupinfo.h> | ||
107 | #include <kuniqueapplication.h> | ||
108 | #include <kwin.h> | ||
109 | |||
110 | #include "kaddressbookmain.h" | ||
111 | #include "kabcore.h" | ||
112 | |||
113 | extern "C" { | ||
114 | |||
115 | void crashHandler( int ) | ||
116 | { | ||
117 | KABC::StdAddressBook::handleCrash(); | ||
118 | ::exit( 0 ); | ||
119 | } | ||
120 | |||
121 | } | ||
122 | |||
123 | class KAddressBookApp : public KUniqueApplication { | ||
124 | public: | ||
125 | KAddressBookApp() : mMainWin( 0 ) {} | ||
126 | ~KAddressBookApp() {} | ||
127 | |||
128 | int newInstance(); | ||
129 | |||
130 | private: | ||
131 | KAddressBookMain *mMainWin; | ||
132 | }; | ||
133 | |||
134 | int KAddressBookApp::newInstance() | ||
135 | { | ||
136 | if ( isRestored() ) { | ||
137 | // There can only be one main window | ||
138 | if ( KMainWindow::canBeRestored( 1 ) ) { | ||
139 | mMainWin = new KAddressBookMain; | ||
140 | mMainWin->show(); | ||
141 | mMainWin->restore( 1 ); | ||
142 | } | ||
143 | } else { | ||
144 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); | ||
145 | |||
146 | QCString addrStr = args->getOption( "addr" ); | ||
147 | QCString uidStr = args->getOption( "uid" ); | ||
148 | QString addr; | ||
149 | QString uid; | ||
150 | if ( !addrStr.isEmpty() ) | ||
151 | addr = QString::fromLocal8Bit( addrStr ); | ||
152 | if ( !uidStr.isEmpty() ) | ||
153 | uid = QString::fromLocal8Bit( uidStr ); | ||
154 | |||
155 | |||
156 | if ( args->isSet( "editor-only" ) ) { | ||
157 | if ( !mMainWin ) | ||
158 | mMainWin = new KAddressBookMain; | ||
159 | KStartupInfo::appStarted(); | ||
160 | mMainWin->hide(); | ||
161 | } else { | ||
162 | if ( mMainWin ) { | ||
163 | mMainWin->show(); | ||
164 | KWin::setActiveWindow( mMainWin->winId() ); | ||
165 | } else { | ||
166 | mMainWin = new KAddressBookMain; | ||
167 | mMainWin->show(); | ||
168 | } | ||
169 | } | ||
170 | // Can not see why anyone would pass both a uid and an email address, so I'll leave it that two contact editors will show if they do | ||
171 | if ( !addr.isEmpty() ) | ||
172 | mMainWin->addEmail( addr ); | ||
173 | |||
174 | if ( !uid.isEmpty() ) | ||
175 | mMainWin->showContactEditor( uid ); | ||
176 | if ( args->isSet( "new-contact" ) ) { | ||
177 | mMainWin->newContact(); | ||
178 | } | ||
179 | } | ||
180 | |||
181 | KCrash::setEmergencySaveFunction( crashHandler ); | ||
182 | |||
183 | return 0; | ||
184 | } | ||
185 | |||
186 | // the dummy argument is required, because KMail apparently sends an empty | ||
187 | // argument. | ||
188 | static KCmdLineOptions kmoptions[] = | ||
189 | { | ||
190 | { "a", 0 , 0 }, | ||
191 | { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 }, | ||
192 | { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 }, | ||
193 | { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 }, | ||
194 | { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 }, | ||
195 | { "+[argument]", I18N_NOOP( "dummy argument" ), 0}, | ||
196 | { 0, 0, 0} | ||
197 | }; | ||
198 | |||
199 | int main( int argc, char *argv[] ) | ||
200 | { | ||
201 | KLocale::setMainCatalogue( "kaddressbook" ); | ||
202 | |||
203 | KCmdLineArgs::init( argc, argv, KABCore::createAboutData() ); | ||
204 | KCmdLineArgs::addCmdLineOptions( kmoptions ); | ||
205 | KUniqueApplication::addCmdLineOptions(); | ||
206 | |||
207 | if ( !KAddressBookApp::start() ) | ||
208 | exit( 0 ); | ||
209 | |||
210 | KAddressBookApp app; | ||
211 | KGlobal::locale()->insertCatalogue( "libkdepim" ); | ||
212 | |||
213 | return app.exec(); | ||
214 | } | ||
215 | */ | ||
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp index c74f8cf..5fb4163 100644 --- a/kaddressbook/views/contactlistview.cpp +++ b/kaddressbook/views/contactlistview.cpp | |||
@@ -75,218 +75,220 @@ void DynamicTip::maybeTip( const QPoint &pos ) | |||
75 | if (!plvi) | 75 | if (!plvi) |
76 | return; | 76 | return; |
77 | 77 | ||
78 | if (ishidden) { | 78 | if (ishidden) { |
79 | QString s; | 79 | QString s; |
80 | QRect r = plv->itemRect( lvi ); | 80 | QRect r = plv->itemRect( lvi ); |
81 | r.moveBy( posVp.x(), posVp.y() ); | 81 | r.moveBy( posVp.x(), posVp.y() ); |
82 | 82 | ||
83 | //kdDebug() << "Tip rec: " << r.x() << "," << r.y() << "," << r.width() | 83 | //kdDebug() << "Tip rec: " << r.x() << "," << r.y() << "," << r.width() |
84 | // << "," << r.height() << endl; | 84 | // << "," << r.height() << endl; |
85 | 85 | ||
86 | KABC::Addressee a = plvi->addressee(); | 86 | KABC::Addressee a = plvi->addressee(); |
87 | if (a.isEmpty()) | 87 | if (a.isEmpty()) |
88 | return; | 88 | return; |
89 | 89 | ||
90 | s += i18n("label: value", "%1: %2").arg(a.formattedNameLabel()) | 90 | s += i18n("label: value", "%1: %2").arg(a.formattedNameLabel()) |
91 | .arg(a.formattedName()); | 91 | .arg(a.formattedName()); |
92 | 92 | ||
93 | s += '\n'; | 93 | s += '\n'; |
94 | s += i18n("label: value", "%1: %2").arg(a.organizationLabel()) | 94 | s += i18n("label: value", "%1: %2").arg(a.organizationLabel()) |
95 | .arg(a.organization()); | 95 | .arg(a.organization()); |
96 | 96 | ||
97 | QString notes = a.note().stripWhiteSpace(); | 97 | QString notes = a.note().stripWhiteSpace(); |
98 | if ( !notes.isEmpty() ) { | 98 | if ( !notes.isEmpty() ) { |
99 | notes += '\n'; | 99 | notes += '\n'; |
100 | s += '\n' + i18n("label: value", "%1: \n").arg(a.noteLabel()); | 100 | s += '\n' + i18n("label: value", "%1: \n").arg(a.noteLabel()); |
101 | QFontMetrics fm( font() ); | 101 | QFontMetrics fm( font() ); |
102 | 102 | ||
103 | // Begin word wrap code based on QMultiLineEdit code | 103 | // Begin word wrap code based on QMultiLineEdit code |
104 | int i = 0; | 104 | int i = 0; |
105 | bool doBreak = false; | 105 | bool doBreak = false; |
106 | int linew = 0; | 106 | int linew = 0; |
107 | int lastSpace = -1; | 107 | int lastSpace = -1; |
108 | int a = 0; | 108 | int a = 0; |
109 | int lastw = 0; | 109 | int lastw = 0; |
110 | 110 | ||
111 | while ( i < int(notes.length()) ) { | 111 | while ( i < int(notes.length()) ) { |
112 | doBreak = FALSE; | 112 | doBreak = FALSE; |
113 | if ( notes[i] != '\n' ) | 113 | if ( notes[i] != '\n' ) |
114 | linew += fm.width( notes[i] ); | 114 | linew += fm.width( notes[i] ); |
115 | 115 | ||
116 | if ( lastSpace >= a && notes[i] != '\n' ) | 116 | if ( lastSpace >= a && notes[i] != '\n' ) |
117 | if (linew >= parentWidget()->width()) { | 117 | if (linew >= parentWidget()->width()) { |
118 | doBreak = TRUE; | 118 | doBreak = TRUE; |
119 | if ( lastSpace > a ) { | 119 | if ( lastSpace > a ) { |
120 | i = lastSpace; | 120 | i = lastSpace; |
121 | linew = lastw; | 121 | linew = lastw; |
122 | } | 122 | } |
123 | else | 123 | else |
124 | i = QMAX( a, i-1 ); | 124 | i = QMAX( a, i-1 ); |
125 | } | 125 | } |
126 | 126 | ||
127 | if ( notes[i] == '\n' || doBreak ) { | 127 | if ( notes[i] == '\n' || doBreak ) { |
128 | s += notes.mid( a, i - a + (doBreak?1:0) ) +"\n"; | 128 | s += notes.mid( a, i - a + (doBreak?1:0) ) +"\n"; |
129 | 129 | ||
130 | a = i + 1; | 130 | a = i + 1; |
131 | lastSpace = a; | 131 | lastSpace = a; |
132 | linew = 0; | 132 | linew = 0; |
133 | } | 133 | } |
134 | 134 | ||
135 | if ( notes[i].isSpace() ) { | 135 | if ( notes[i].isSpace() ) { |
136 | lastSpace = i; | 136 | lastSpace = i; |
137 | lastw = linew; | 137 | lastw = linew; |
138 | } | 138 | } |
139 | 139 | ||
140 | if ( lastSpace <= a ) { | 140 | if ( lastSpace <= a ) { |
141 | lastw = linew; | 141 | lastw = linew; |
142 | } | 142 | } |
143 | 143 | ||
144 | ++i; | 144 | ++i; |
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
148 | tip( r, s ); | 148 | tip( r, s ); |
149 | } | 149 | } |
150 | else | 150 | else |
151 | hide(); | 151 | hide(); |
152 | ishidden = !ishidden; | 152 | ishidden = !ishidden; |
153 | 153 | ||
154 | } | 154 | } |
155 | 155 | ||
156 | /////////////////////////// | 156 | /////////////////////////// |
157 | // ContactListViewItem Methods | 157 | // ContactListViewItem Methods |
158 | 158 | ||
159 | ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, | 159 | ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, |
160 | ContactListView *parent, | 160 | ContactListView *parent, |
161 | KABC::AddressBook *doc, | 161 | KABC::AddressBook *doc, |
162 | const KABC::Field::List &fields ) | 162 | const KABC::Field::List &fields ) |
163 | : KListViewItem(parent), mAddressee(a), mFields( fields ), | 163 | : KListViewItem(parent), mAddressee(a), mFields( fields ), |
164 | parentListView( parent ), mDocument(doc) | 164 | parentListView( parent ), mDocument(doc) |
165 | { | 165 | { |
166 | refresh(); | 166 | refresh(); |
167 | } | 167 | } |
168 | 168 | ||
169 | QString ContactListViewItem::key(int column, bool ascending) const | 169 | QString ContactListViewItem::key(int column, bool ascending) const |
170 | { | 170 | { |
171 | #ifndef DESKTOP_VERSION | ||
171 | int lan = KGlobal::locale()->language(); | 172 | int lan = KGlobal::locale()->language(); |
172 | //qDebug("language %d ", lan); | 173 | //qDebug("language %d ", lan); |
173 | if ( lan == 1 ) { //GERMAN | 174 | if ( lan == 1 ) { //GERMAN |
174 | QString ret = QListViewItem::key(column, ascending).utf8(); | 175 | QString ret = QListViewItem::key(column, ascending).utf8(); |
175 | int start = -1; | 176 | int start = -1; |
176 | while ( (start = ret.find( 'ä', start+1)) > 0 ) { | 177 | while ( (start = ret.find( 'ä', start+1)) > 0 ) { |
177 | ret.at(start-1) = 'a'; | 178 | ret.at(start-1) = 'a'; |
178 | } | 179 | } |
179 | start = -1; | 180 | start = -1; |
180 | while ( (start = ret.find( 'ö', start+1)) > 0 ) { | 181 | while ( (start = ret.find( 'ö', start+1)) > 0 ) { |
181 | ret.at(start-1) = 'o'; | 182 | ret.at(start-1) = 'o'; |
182 | } | 183 | } |
183 | start = -1; | 184 | start = -1; |
184 | while ( (start = ret.find( 'ü', start+1)) > 0 ) { | 185 | while ( (start = ret.find( 'ü', start+1)) > 0 ) { |
185 | ret.at(start-1) = 'o'; | 186 | ret.at(start-1) = 'o'; |
186 | } | 187 | } |
187 | start = -1; | 188 | start = -1; |
188 | while ( (start = ret.find( 'ß', start+1)) > 0 ) { | 189 | while ( (start = ret.find( 'ß', start+1)) > 0 ) { |
189 | ret.at(start-1) = 's'; | 190 | ret.at(start-1) = 's'; |
190 | } | 191 | } |
191 | //qDebug("conv string %s ", ret.latin1()); | 192 | //qDebug("conv string %s ", ret.latin1()); |
192 | 193 | ||
193 | return ret; | 194 | return ret; |
194 | 195 | ||
195 | } | 196 | } |
196 | else | 197 | else |
198 | #endif | ||
197 | return QListViewItem::key(column, ascending).lower(); | 199 | return QListViewItem::key(column, ascending).lower(); |
198 | } | 200 | } |
199 | 201 | ||
200 | void ContactListViewItem::paintCell(QPainter * p, | 202 | void ContactListViewItem::paintCell(QPainter * p, |
201 | const QColorGroup & cg, | 203 | const QColorGroup & cg, |
202 | int column, | 204 | int column, |
203 | int width, | 205 | int width, |
204 | int align) | 206 | int align) |
205 | { | 207 | { |
206 | KListViewItem::paintCell(p, cg, column, width, align); | 208 | KListViewItem::paintCell(p, cg, column, width, align); |
207 | 209 | ||
208 | if ( !p ) | 210 | if ( !p ) |
209 | return; | 211 | return; |
210 | 212 | ||
211 | if (parentListView->singleLine()) { | 213 | if (parentListView->singleLine()) { |
212 | p->setPen( parentListView->alternateColor() ); | 214 | p->setPen( parentListView->alternateColor() ); |
213 | p->drawLine( 0, height() - 1, width, height() - 1 ); | 215 | p->drawLine( 0, height() - 1, width, height() - 1 ); |
214 | } | 216 | } |
215 | } | 217 | } |
216 | 218 | ||
217 | 219 | ||
218 | ContactListView *ContactListViewItem::parent() | 220 | ContactListView *ContactListViewItem::parent() |
219 | { | 221 | { |
220 | return parentListView; | 222 | return parentListView; |
221 | } | 223 | } |
222 | 224 | ||
223 | 225 | ||
224 | void ContactListViewItem::refresh() | 226 | void ContactListViewItem::refresh() |
225 | { | 227 | { |
226 | // Update our addressee, since it may have changed else were | 228 | // Update our addressee, since it may have changed else were |
227 | mAddressee = mDocument->findByUid(mAddressee.uid()); | 229 | mAddressee = mDocument->findByUid(mAddressee.uid()); |
228 | if (mAddressee.isEmpty()) | 230 | if (mAddressee.isEmpty()) |
229 | return; | 231 | return; |
230 | 232 | ||
231 | int i = 0; | 233 | int i = 0; |
232 | KABC::Field::List::ConstIterator it; | 234 | KABC::Field::List::ConstIterator it; |
233 | for( it = mFields.begin(); it != mFields.end(); ++it ) { | 235 | for( it = mFields.begin(); it != mFields.end(); ++it ) { |
234 | setText( i++, (*it)->value( mAddressee ) ); | 236 | setText( i++, (*it)->value( mAddressee ) ); |
235 | } | 237 | } |
236 | } | 238 | } |
237 | 239 | ||
238 | /////////////////////////////// | 240 | /////////////////////////////// |
239 | // ContactListView | 241 | // ContactListView |
240 | 242 | ||
241 | ContactListView::ContactListView(KAddressBookTableView *view, | 243 | ContactListView::ContactListView(KAddressBookTableView *view, |
242 | KABC::AddressBook* /* doc */, | 244 | KABC::AddressBook* /* doc */, |
243 | QWidget *parent, | 245 | QWidget *parent, |
244 | const char *name ) | 246 | const char *name ) |
245 | : KListView( parent, name ), | 247 | : KListView( parent, name ), |
246 | pabWidget( view ), | 248 | pabWidget( view ), |
247 | oldColumn( 0 ) | 249 | oldColumn( 0 ) |
248 | { | 250 | { |
249 | mABackground = true; | 251 | mABackground = true; |
250 | mSingleLine = false; | 252 | mSingleLine = false; |
251 | mToolTips = true; | 253 | mToolTips = true; |
252 | #ifndef KAB_EMBEDDED | 254 | #ifndef KAB_EMBEDDED |
253 | mAlternateColor = KGlobalSettings::alternateBackgroundColor(); | 255 | mAlternateColor = KGlobalSettings::alternateBackgroundColor(); |
254 | #else //KAB_EMBEDDED | 256 | #else //KAB_EMBEDDED |
255 | mAlternateColor = QColor(240, 240, 240); | 257 | mAlternateColor = QColor(240, 240, 240); |
256 | #endif //KAB_EMBEDDED | 258 | #endif //KAB_EMBEDDED |
257 | 259 | ||
258 | setAlternateBackgroundEnabled(mABackground); | 260 | setAlternateBackgroundEnabled(mABackground); |
259 | setAcceptDrops( true ); | 261 | setAcceptDrops( true ); |
260 | viewport()->setAcceptDrops( true ); | 262 | viewport()->setAcceptDrops( true ); |
261 | setAllColumnsShowFocus( true ); | 263 | setAllColumnsShowFocus( true ); |
262 | setShowSortIndicator(true); | 264 | setShowSortIndicator(true); |
263 | 265 | ||
264 | setSelectionModeExt( KListView::Extended ); | 266 | setSelectionModeExt( KListView::Extended ); |
265 | setDropVisualizer(false); | 267 | setDropVisualizer(false); |
266 | // setFrameStyle(QFrame::NoFrame); | 268 | // setFrameStyle(QFrame::NoFrame); |
267 | //setLineWidth ( 0 ); | 269 | //setLineWidth ( 0 ); |
268 | //setMidLineWidth ( 0 ); | 270 | //setMidLineWidth ( 0 ); |
269 | //setMargin ( 0 ); | 271 | //setMargin ( 0 ); |
270 | #ifndef KAB_EMBEDDED | 272 | #ifndef KAB_EMBEDDED |
271 | connect(this, SIGNAL(dropped(QDropEvent*)), | 273 | connect(this, SIGNAL(dropped(QDropEvent*)), |
272 | this, SLOT(itemDropped(QDropEvent*))); | 274 | this, SLOT(itemDropped(QDropEvent*))); |
273 | #endif //KAB_EMBEDDED | 275 | #endif //KAB_EMBEDDED |
274 | 276 | ||
275 | 277 | ||
276 | new DynamicTip( this ); | 278 | new DynamicTip( this ); |
277 | } | 279 | } |
278 | 280 | ||
279 | void ContactListView::setAlternateColor(const QColor &m_AlternateColor) | 281 | void ContactListView::setAlternateColor(const QColor &m_AlternateColor) |
280 | { | 282 | { |
281 | mAlternateColor = m_AlternateColor; | 283 | mAlternateColor = m_AlternateColor; |
282 | } | 284 | } |
283 | 285 | ||
284 | void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect ) | 286 | void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect ) |
285 | { | 287 | { |
286 | QBrush b = palette().brush(QPalette::Active, QColorGroup::Base); | 288 | QBrush b = palette().brush(QPalette::Active, QColorGroup::Base); |
287 | 289 | ||
288 | // Get the brush, which will have the background pixmap if there is one. | 290 | // Get the brush, which will have the background pixmap if there is one. |
289 | if (b.pixmap()) | 291 | if (b.pixmap()) |
290 | { | 292 | { |
291 | p->drawTiledPixmap( rect.left(), rect.top(), rect.width(), rect.height(), | 293 | p->drawTiledPixmap( rect.left(), rect.top(), rect.width(), rect.height(), |
292 | *(b.pixmap()), | 294 | *(b.pixmap()), |
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index e938e4e..1fcc977 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -402,179 +402,180 @@ void KOEventViewer::formatAttendees(Incidence *event) | |||
402 | if (attendees.count()) { | 402 | if (attendees.count()) { |
403 | 403 | ||
404 | 404 | ||
405 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 405 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
406 | addTag("h3",i18n("Organizer")); | 406 | addTag("h3",i18n("Organizer")); |
407 | mText.append("<ul><li>"); | 407 | mText.append("<ul><li>"); |
408 | #ifndef KORG_NOKABC | 408 | #ifndef KORG_NOKABC |
409 | 409 | ||
410 | #ifdef DESKTOP_VERSION | 410 | #ifdef DESKTOP_VERSION |
411 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 411 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
412 | KABC::Addressee::List addressList; | 412 | KABC::Addressee::List addressList; |
413 | addressList = add_book->findByEmail(event->organizer()); | 413 | addressList = add_book->findByEmail(event->organizer()); |
414 | KABC::Addressee o = addressList.first(); | 414 | KABC::Addressee o = addressList.first(); |
415 | if (!o.isEmpty() && addressList.size()<2) { | 415 | if (!o.isEmpty() && addressList.size()<2) { |
416 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 416 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
417 | mText += o.formattedName(); | 417 | mText += o.formattedName(); |
418 | mText += "</a>\n"; | 418 | mText += "</a>\n"; |
419 | } else { | 419 | } else { |
420 | mText.append(event->organizer()); | 420 | mText.append(event->organizer()); |
421 | } | 421 | } |
422 | #else //DESKTOP_VERSION | 422 | #else //DESKTOP_VERSION |
423 | mText += "<a href=\"uid:organizer\">"; | 423 | mText += "<a href=\"uid:organizer\">"; |
424 | mText += event->organizer(); | 424 | mText += event->organizer(); |
425 | mText += "</a>\n"; | 425 | mText += "</a>\n"; |
426 | #endif //DESKTOP_VERSION | 426 | #endif //DESKTOP_VERSION |
427 | 427 | ||
428 | 428 | ||
429 | #else | 429 | #else |
430 | mText.append(event->organizer()); | 430 | mText.append(event->organizer()); |
431 | #endif | 431 | #endif |
432 | 432 | ||
433 | if (iconPath) { | 433 | if (iconPath) { |
434 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 434 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
435 | mText += "<IMG src=\"" + iconPath + "\">"; | 435 | mText += "<IMG src=\"" + iconPath + "\">"; |
436 | mText += "</a>\n"; | 436 | mText += "</a>\n"; |
437 | } | 437 | } |
438 | mText.append("</li></ul>"); | 438 | mText.append("</li></ul>"); |
439 | 439 | ||
440 | addTag("h3",i18n("Attendees")); | 440 | addTag("h3",i18n("Attendees")); |
441 | Attendee *a; | 441 | Attendee *a; |
442 | mText.append("<ul>"); | 442 | mText.append("<ul>"); |
443 | for(a=attendees.first();a;a=attendees.next()) { | 443 | for(a=attendees.first();a;a=attendees.next()) { |
444 | #ifndef KORG_NOKABC | 444 | #ifndef KORG_NOKABC |
445 | #ifdef DESKTOP_VERSION | 445 | #ifdef DESKTOP_VERSION |
446 | if (a->name().isEmpty()) { | 446 | if (a->name().isEmpty()) { |
447 | addressList = add_book->findByEmail(a->email()); | 447 | addressList = add_book->findByEmail(a->email()); |
448 | KABC::Addressee o = addressList.first(); | 448 | KABC::Addressee o = addressList.first(); |
449 | if (!o.isEmpty() && addressList.size()<2) { | 449 | if (!o.isEmpty() && addressList.size()<2) { |
450 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 450 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
451 | mText += o.formattedName(); | 451 | mText += o.formattedName(); |
452 | mText += "</a>\n"; | 452 | mText += "</a>\n"; |
453 | } else { | 453 | } else { |
454 | mText += "<li>"; | 454 | mText += "<li>"; |
455 | mText.append(a->email()); | 455 | mText.append(a->email()); |
456 | mText += "\n"; | 456 | mText += "\n"; |
457 | } | 457 | } |
458 | } else { | 458 | } else { |
459 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 459 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
460 | if (!a->name().isEmpty()) mText += a->name(); | 460 | if (!a->name().isEmpty()) mText += a->name(); |
461 | else mText += a->email(); | 461 | else mText += a->email(); |
462 | mText += "</a>\n"; | 462 | mText += "</a>\n"; |
463 | } | 463 | } |
464 | #else //DESKTOP_VERSION | 464 | #else //DESKTOP_VERSION |
465 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 465 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
466 | if (!a->name().isEmpty()) mText += a->name(); | 466 | if (!a->name().isEmpty()) mText += a->name(); |
467 | else mText += a->email(); | 467 | else mText += a->email(); |
468 | mText += "</a>\n"; | 468 | mText += "</a>\n"; |
469 | #endif //DESKTOP_VERSION | 469 | #endif //DESKTOP_VERSION |
470 | #else | 470 | #else |
471 | //qDebug("nokabc "); | 471 | //qDebug("nokabc "); |
472 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 472 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
473 | if (!a->name().isEmpty()) mText += a->name(); | 473 | if (!a->name().isEmpty()) mText += a->name(); |
474 | else mText += a->email(); | 474 | else mText += a->email(); |
475 | mText += "</a>\n"; | 475 | mText += "</a>\n"; |
476 | #endif | 476 | #endif |
477 | 477 | ||
478 | 478 | ||
479 | if (!a->email().isEmpty()) { | 479 | if (!a->email().isEmpty()) { |
480 | if (iconPath) { | 480 | if (iconPath) { |
481 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; | 481 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; |
482 | mText += "<IMG src=\"" + iconPath + "\">"; | 482 | mText += "<IMG src=\"" + iconPath + "\">"; |
483 | mText += "</a>\n"; | 483 | mText += "</a>\n"; |
484 | } | 484 | } |
485 | } | 485 | } |
486 | if (a->status() != Attendee::NeedsAction ) | 486 | if (a->status() != Attendee::NeedsAction ) |
487 | mText +="[" + a->statusStr() + "] "; | 487 | mText +="[" + a->statusStr() + "] "; |
488 | if (a->role() == Attendee::Chair ) | 488 | if (a->role() == Attendee::Chair ) |
489 | mText +="(" + a->roleStr().left(1) + ".)"; | 489 | mText +="(" + a->roleStr().left(1) + ".)"; |
490 | } | 490 | } |
491 | mText.append("</li></ul>"); | 491 | mText.append("</li></ul>"); |
492 | } | 492 | } |
493 | 493 | ||
494 | } | 494 | } |
495 | void KOEventViewer::appendJournal(Journal *jour, int mode ) | 495 | void KOEventViewer::appendJournal(Journal *jour, int mode ) |
496 | { | 496 | { |
497 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 497 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
498 | if (mode == 0 ) | 498 | if (mode == 0 ) { |
499 | addTag("h2",i18n("Journal from: ")); | 499 | addTag("h2",i18n("Journal from: ")); |
500 | } | ||
500 | else { | 501 | else { |
501 | if ( mode == 1 ) { | 502 | if ( mode == 1 ) { |
502 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); | 503 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); |
503 | } else { | 504 | } else { |
504 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); | 505 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); |
505 | } | 506 | } |
506 | addTag("h3",i18n( "Last modified " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); | ||
507 | } | 507 | } |
508 | topLevelWidget()->setCaption("Journal Viewer"); | 508 | topLevelWidget()->setCaption("Journal Viewer"); |
509 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); | 509 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); |
510 | addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); | ||
510 | if (!jour->description().isEmpty()) { | 511 | if (!jour->description().isEmpty()) { |
511 | addTag("p",jour->description()); | 512 | addTag("p",jour->description()); |
512 | } | 513 | } |
513 | setText(mText); | 514 | setText(mText); |
514 | } | 515 | } |
515 | 516 | ||
516 | void KOEventViewer::formatReadOnly(Incidence *event) | 517 | void KOEventViewer::formatReadOnly(Incidence *event) |
517 | { | 518 | { |
518 | if (event->isReadOnly()) { | 519 | if (event->isReadOnly()) { |
519 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); | 520 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); |
520 | } | 521 | } |
521 | } | 522 | } |
522 | void KOEventViewer::setSyncMode( bool b ) | 523 | void KOEventViewer::setSyncMode( bool b ) |
523 | { | 524 | { |
524 | mSyncMode = b; | 525 | mSyncMode = b; |
525 | } | 526 | } |
526 | 527 | ||
527 | 528 | ||
528 | void KOEventViewer::setTodo(Todo *event, bool clearV ) | 529 | void KOEventViewer::setTodo(Todo *event, bool clearV ) |
529 | { | 530 | { |
530 | if ( clearV ) | 531 | if ( clearV ) |
531 | clearEvents(); | 532 | clearEvents(); |
532 | if ( mSyncMode ) { | 533 | if ( mSyncMode ) { |
533 | if ( clearV ) | 534 | if ( clearV ) |
534 | appendTodo(event,1 ); | 535 | appendTodo(event,1 ); |
535 | else | 536 | else |
536 | appendTodo(event,2); | 537 | appendTodo(event,2); |
537 | } else | 538 | } else |
538 | appendTodo(event); | 539 | appendTodo(event); |
539 | } | 540 | } |
540 | void KOEventViewer::setJournal(Journal *event, bool clearV ) | 541 | void KOEventViewer::setJournal(Journal *event, bool clearV ) |
541 | { | 542 | { |
542 | if ( clearV ) | 543 | if ( clearV ) |
543 | clearEvents(); | 544 | clearEvents(); |
544 | if ( mSyncMode ) { | 545 | if ( mSyncMode ) { |
545 | if ( clearV ) | 546 | if ( clearV ) |
546 | appendJournal(event, 1); | 547 | appendJournal(event, 1); |
547 | else | 548 | else |
548 | appendJournal(event, 2); | 549 | appendJournal(event, 2); |
549 | } else | 550 | } else |
550 | appendJournal(event); | 551 | appendJournal(event); |
551 | } | 552 | } |
552 | 553 | ||
553 | void KOEventViewer::setEvent(Event *event) | 554 | void KOEventViewer::setEvent(Event *event) |
554 | { | 555 | { |
555 | clearEvents(); | 556 | clearEvents(); |
556 | if ( mSyncMode ) | 557 | if ( mSyncMode ) |
557 | appendEvent(event, 1); | 558 | appendEvent(event, 1); |
558 | else | 559 | else |
559 | appendEvent(event); | 560 | appendEvent(event); |
560 | } | 561 | } |
561 | 562 | ||
562 | void KOEventViewer::addEvent(Event *event) | 563 | void KOEventViewer::addEvent(Event *event) |
563 | { | 564 | { |
564 | if ( mSyncMode ) | 565 | if ( mSyncMode ) |
565 | appendEvent(event, 2); | 566 | appendEvent(event, 2); |
566 | else | 567 | else |
567 | appendEvent(event); | 568 | appendEvent(event); |
568 | } | 569 | } |
569 | 570 | ||
570 | void KOEventViewer::clearEvents(bool now) | 571 | void KOEventViewer::clearEvents(bool now) |
571 | { | 572 | { |
572 | mText = ""; | 573 | mText = ""; |
573 | if (now) setText(mText); | 574 | if (now) setText(mText); |
574 | } | 575 | } |
575 | 576 | ||
576 | void KOEventViewer::addText(QString text) | 577 | void KOEventViewer::addText(QString text) |
577 | { | 578 | { |
578 | mText.append(text); | 579 | mText.append(text); |
579 | setText(mText); | 580 | setText(mText); |
580 | } | 581 | } |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 9a3ba73..bafd349 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -1,273 +1,279 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1999 Preston Brown | 3 | Copyright (c) 1999 Preston Brown |
4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qlistview.h> | 25 | #include <qlistview.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
29 | #include <qprogressbar.h> | 29 | #include <qprogressbar.h> |
30 | #include <qfileinfo.h> | 30 | #include <qfileinfo.h> |
31 | #include <qmessagebox.h> | 31 | #include <qmessagebox.h> |
32 | #include <qdialog.h> | 32 | #include <qdialog.h> |
33 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
34 | #include <qdir.h> | 34 | #include <qdir.h> |
35 | #include <qregexp.h> | ||
35 | 36 | ||
36 | #include <klocale.h> | 37 | #include <klocale.h> |
37 | #include <kdebug.h> | 38 | #include <kdebug.h> |
38 | #include <kiconloader.h> | 39 | #include <kiconloader.h> |
39 | #include <kglobal.h> | 40 | #include <kglobal.h> |
40 | 41 | ||
41 | #include <libkcal/calendar.h> | 42 | #include <libkcal/calendar.h> |
42 | #include <libkcal/calendarlocal.h> | 43 | #include <libkcal/calendarlocal.h> |
43 | #include <libkcal/icalformat.h> | 44 | #include <libkcal/icalformat.h> |
44 | #include <libkcal/vcalformat.h> | 45 | #include <libkcal/vcalformat.h> |
45 | #include <libkcal/recurrence.h> | 46 | #include <libkcal/recurrence.h> |
46 | #include <libkcal/filestorage.h> | 47 | #include <libkcal/filestorage.h> |
47 | #include <libkdepim/categoryselectdialog.h> | 48 | #include <libkdepim/categoryselectdialog.h> |
48 | #ifndef DESKTOP_VERSION | 49 | #ifndef DESKTOP_VERSION |
49 | #include <qpe/qpeapplication.h> | 50 | #include <qpe/qpeapplication.h> |
50 | #else | 51 | #else |
51 | #include <qapplication.h> | 52 | #include <qapplication.h> |
52 | #endif | 53 | #endif |
53 | 54 | ||
54 | #ifndef KORG_NOPRINTER | 55 | #ifndef KORG_NOPRINTER |
55 | #include "calprinter.h" | 56 | #include "calprinter.h" |
56 | #endif | 57 | #endif |
57 | #include "koglobals.h" | 58 | #include "koglobals.h" |
58 | #include "koprefs.h" | 59 | #include "koprefs.h" |
59 | #include "kfiledialog.h" | 60 | #include "kfiledialog.h" |
60 | 61 | ||
61 | #include "kolistview.h" | 62 | #include "kolistview.h" |
62 | 63 | ||
63 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) | 64 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) |
64 | { | 65 | { |
65 | mItem = item; | 66 | mItem = item; |
66 | mDate = date; | 67 | mDate = date; |
67 | } | 68 | } |
68 | 69 | ||
69 | ListItemVisitor::~ListItemVisitor() | 70 | ListItemVisitor::~ListItemVisitor() |
70 | { | 71 | { |
71 | } | 72 | } |
72 | 73 | ||
73 | bool ListItemVisitor::visit(Event *e) | 74 | bool ListItemVisitor::visit(Event *e) |
74 | { | 75 | { |
75 | 76 | ||
76 | bool ok = false; | 77 | bool ok = false; |
77 | QString start, end; | 78 | QString start, end; |
78 | if ( e->doesRecur() ) { | 79 | if ( e->doesRecur() ) { |
79 | QDate d = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); | 80 | QDate d = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); |
80 | if ( ok ) { | 81 | if ( ok ) { |
81 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); | 82 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); |
82 | start = KGlobal::locale()->formatDate(d,true); | 83 | start = KGlobal::locale()->formatDate(d,true); |
83 | end = KGlobal::locale()->formatDate(d.addDays( days),true); | 84 | end = KGlobal::locale()->formatDate(d.addDays( days),true); |
84 | } | 85 | } |
85 | 86 | ||
86 | } | 87 | } |
87 | if ( ! ok ) { | 88 | if ( ! ok ) { |
88 | start =e->dtStartDateStr(); | 89 | start =e->dtStartDateStr(); |
89 | end = e->dtEndDateStr(); | 90 | end = e->dtEndDateStr(); |
90 | } | 91 | } |
91 | mItem->setText(0,e->summary()); | 92 | mItem->setText(0,e->summary()); |
92 | mItem->setText(1,start); | 93 | mItem->setText(1,start); |
93 | mItem->setText(2,e->dtStartTimeStr()); | 94 | mItem->setText(2,e->dtStartTimeStr()); |
94 | mItem->setText(3,end); | 95 | mItem->setText(3,end); |
95 | mItem->setText(4,e->dtEndTimeStr()); | 96 | mItem->setText(4,e->dtEndTimeStr()); |
96 | mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); | 97 | mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); |
97 | mItem->setText(6, e->recurrence()->recurrenceText()); | 98 | mItem->setText(6, e->recurrence()->recurrenceText()); |
98 | mItem->setText(7,"---"); | 99 | mItem->setText(7,"---"); |
99 | mItem->setText(8,"---"); | 100 | mItem->setText(8,"---"); |
100 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); | 101 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); |
101 | mItem->setText(10,e->categoriesStr()); | 102 | mItem->setText(10,e->categoriesStr()); |
102 | 103 | ||
103 | QString key; | 104 | QString key; |
104 | QDate d = e->dtStart().date(); | 105 | QDate d = e->dtStart().date(); |
105 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); | 106 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); |
106 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute()); | 107 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute()); |
107 | mItem->setSortKey(1,key); | 108 | mItem->setSortKey(1,key); |
108 | 109 | ||
109 | d = e->dtEnd().date(); | 110 | d = e->dtEnd().date(); |
110 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); | 111 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); |
111 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute()); | 112 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute()); |
112 | mItem->setSortKey(3,key); | 113 | mItem->setSortKey(3,key); |
113 | 114 | ||
114 | return true; | 115 | return true; |
115 | } | 116 | } |
116 | 117 | ||
117 | bool ListItemVisitor::visit(Todo *t) | 118 | bool ListItemVisitor::visit(Todo *t) |
118 | { | 119 | { |
119 | mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); | 120 | mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); |
120 | if (t->hasStartDate()) { | 121 | if (t->hasStartDate()) { |
121 | mItem->setText(1,t->dtStartDateStr()); | 122 | mItem->setText(1,t->dtStartDateStr()); |
122 | if (t->doesFloat()) { | 123 | if (t->doesFloat()) { |
123 | mItem->setText(2,"---"); | 124 | mItem->setText(2,"---"); |
124 | } else { | 125 | } else { |
125 | mItem->setText(2,t->dtStartTimeStr()); | 126 | mItem->setText(2,t->dtStartTimeStr()); |
126 | } | 127 | } |
127 | } else { | 128 | } else { |
128 | mItem->setText(1,"---"); | 129 | mItem->setText(1,"---"); |
129 | mItem->setText(2,"---"); | 130 | mItem->setText(2,"---"); |
130 | } | 131 | } |
131 | mItem->setText(3,"---"); | 132 | mItem->setText(3,"---"); |
132 | mItem->setText(4,"---"); | 133 | mItem->setText(4,"---"); |
133 | mItem->setText(5,"---"); | 134 | mItem->setText(5,"---"); |
134 | mItem->setText(6,"---"); | 135 | mItem->setText(6,"---"); |
135 | if (t->hasDueDate()) { | 136 | if (t->hasDueDate()) { |
136 | mItem->setText(7,t->dtDueDateStr()); | 137 | mItem->setText(7,t->dtDueDateStr()); |
137 | if (t->doesFloat()) { | 138 | if (t->doesFloat()) { |
138 | mItem->setText(8,"---"); | 139 | mItem->setText(8,"---"); |
139 | } else { | 140 | } else { |
140 | mItem->setText(8,t->dtDueTimeStr()); | 141 | mItem->setText(8,t->dtDueTimeStr()); |
141 | } | 142 | } |
142 | } else { | 143 | } else { |
143 | mItem->setText(7,"---"); | 144 | mItem->setText(7,"---"); |
144 | mItem->setText(8,"---"); | 145 | mItem->setText(8,"---"); |
145 | } | 146 | } |
146 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); | 147 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); |
147 | mItem->setText(10,t->categoriesStr()); | 148 | mItem->setText(10,t->categoriesStr()); |
148 | 149 | ||
149 | QString key; | 150 | QString key; |
150 | QDate d; | 151 | QDate d; |
151 | if (t->hasDueDate()) { | 152 | if (t->hasDueDate()) { |
152 | d = t->dtDue().date(); | 153 | d = t->dtDue().date(); |
153 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 154 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
154 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 155 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
155 | mItem->setSortKey(7,key); | 156 | mItem->setSortKey(7,key); |
156 | } | 157 | } |
157 | if ( t->hasStartDate() ) { | 158 | if ( t->hasStartDate() ) { |
158 | d = t->dtStart().date(); | 159 | d = t->dtStart().date(); |
159 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 160 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); |
160 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 161 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
161 | mItem->setSortKey(1,key); | 162 | mItem->setSortKey(1,key); |
162 | } | 163 | } |
163 | return true; | 164 | return true; |
164 | } | 165 | } |
165 | 166 | ||
166 | bool ListItemVisitor::visit(Journal * j) | 167 | bool ListItemVisitor::visit(Journal * j) |
167 | { | 168 | { |
168 | mItem->setText(0,i18n("Journal")); | 169 | QString des = j->description().left(50); |
170 | des = des.simplifyWhiteSpace (); | ||
171 | des.replace (QRegExp ("\\n"),"" ); | ||
172 | des.replace (QRegExp ("\\r"),"" ); | ||
173 | mItem->setText(0,i18n("Journal")+": "+des.left(25)); | ||
169 | mItem->setText(1,j->dtStartDateStr()); | 174 | mItem->setText(1,j->dtStartDateStr()); |
170 | mItem->setText(2,"---"); | 175 | mItem->setText(2,"---"); |
171 | mItem->setText(3,"---"); | 176 | mItem->setText(3,"---"); |
172 | mItem->setText(4,"---"); | 177 | mItem->setText(4,"---"); |
173 | mItem->setText(5,"---"); | 178 | mItem->setText(5,"---"); |
174 | mItem->setText(6,"---"); | 179 | mItem->setText(6,"---"); |
175 | mItem->setText(7,j->dtStartDateStr()); | 180 | mItem->setText(7,j->dtStartDateStr()); |
176 | mItem->setText(8,"---"); | 181 | mItem->setText(8,"---"); |
177 | mItem->setText(9,"---"); | 182 | mItem->setText(9,"---"); |
183 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); | ||
178 | 184 | ||
179 | QString key; | 185 | QString key; |
180 | QDate d = j->dtStart().date(); | 186 | QDate d = j->dtStart().date(); |
181 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 187 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
182 | mItem->setSortKey(1,key); | 188 | mItem->setSortKey(1,key); |
183 | mItem->setSortKey(7,key); | 189 | mItem->setSortKey(7,key); |
184 | 190 | ||
185 | return true; | 191 | return true; |
186 | } | 192 | } |
187 | 193 | ||
188 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 194 | KOListView::KOListView(Calendar *calendar, QWidget *parent, |
189 | const char *name) | 195 | const char *name) |
190 | : KOEventView(calendar, parent, name) | 196 | : KOEventView(calendar, parent, name) |
191 | { | 197 | { |
192 | mActiveItem = 0; | 198 | mActiveItem = 0; |
193 | mListView = new KOListViewListView(this); | 199 | mListView = new KOListViewListView(this); |
194 | mListView->addColumn(i18n("Summary")); | 200 | mListView->addColumn(i18n("Summary")); |
195 | mListView->addColumn(i18n("Start Date")); | 201 | mListView->addColumn(i18n("Start Date")); |
196 | mListView->addColumn(i18n("Start Time")); | 202 | mListView->addColumn(i18n("Start Time")); |
197 | mListView->addColumn(i18n("End Date")); | 203 | mListView->addColumn(i18n("End Date")); |
198 | mListView->addColumn(i18n("End Time")); | 204 | mListView->addColumn(i18n("End Time")); |
199 | mListView->addColumn(i18n("Alarm")); // alarm set? | 205 | mListView->addColumn(i18n("Alarm")); // alarm set? |
200 | mListView->addColumn(i18n("Recurs")); // recurs? | 206 | mListView->addColumn(i18n("Recurs")); // recurs? |
201 | mListView->addColumn(i18n("Due Date")); | 207 | mListView->addColumn(i18n("Due Date")); |
202 | mListView->addColumn(i18n("Due Time")); | 208 | mListView->addColumn(i18n("Due Time")); |
203 | mListView->addColumn(i18n("Cancelled")); | 209 | mListView->addColumn(i18n("Cancelled")); |
204 | mListView->addColumn(i18n("Categories")); | 210 | mListView->addColumn(i18n("Categories")); |
205 | 211 | ||
206 | mListView->setColumnAlignment(0,AlignLeft); | 212 | mListView->setColumnAlignment(0,AlignLeft); |
207 | mListView->setColumnAlignment(1,AlignLeft); | 213 | mListView->setColumnAlignment(1,AlignLeft); |
208 | mListView->setColumnAlignment(2,AlignHCenter); | 214 | mListView->setColumnAlignment(2,AlignHCenter); |
209 | mListView->setColumnAlignment(3,AlignLeft); | 215 | mListView->setColumnAlignment(3,AlignLeft); |
210 | mListView->setColumnAlignment(4,AlignHCenter); | 216 | mListView->setColumnAlignment(4,AlignHCenter); |
211 | mListView->setColumnAlignment(5,AlignLeft); | 217 | mListView->setColumnAlignment(5,AlignLeft); |
212 | mListView->setColumnAlignment(6,AlignLeft); | 218 | mListView->setColumnAlignment(6,AlignLeft); |
213 | mListView->setColumnAlignment(7,AlignLeft); | 219 | mListView->setColumnAlignment(7,AlignLeft); |
214 | mListView->setColumnAlignment(8,AlignLeft); | 220 | mListView->setColumnAlignment(8,AlignLeft); |
215 | mListView->setColumnAlignment(9,AlignLeft); | 221 | mListView->setColumnAlignment(9,AlignLeft); |
216 | mListView->setColumnAlignment(10,AlignLeft); | 222 | mListView->setColumnAlignment(10,AlignLeft); |
217 | 223 | ||
218 | int iii = 0; | 224 | int iii = 0; |
219 | for ( iii = 0; iii< 10 ; ++iii ) | 225 | for ( iii = 0; iii< 10 ; ++iii ) |
220 | mListView->setColumnWidthMode( iii, QListView::Manual ); | 226 | mListView->setColumnWidthMode( iii, QListView::Manual ); |
221 | 227 | ||
222 | QBoxLayout *layoutTop = new QVBoxLayout(this); | 228 | QBoxLayout *layoutTop = new QVBoxLayout(this); |
223 | layoutTop->addWidget(mListView); | 229 | layoutTop->addWidget(mListView); |
224 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 230 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
225 | mPopupMenu = eventPopup(); | 231 | mPopupMenu = eventPopup(); |
226 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 232 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
227 | i18n("Select all"),this, | 233 | i18n("Select all"),this, |
228 | SLOT(allSelection()),true); | 234 | SLOT(allSelection()),true); |
229 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 235 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
230 | i18n("Deselect All"),this, | 236 | i18n("Deselect All"),this, |
231 | SLOT(clearSelection()),true); | 237 | SLOT(clearSelection()),true); |
232 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 238 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
233 | i18n("Delete all selected"),this, | 239 | i18n("Delete all selected"),this, |
234 | SLOT(deleteAll()),true); | 240 | SLOT(deleteAll()),true); |
235 | mPopupMenu->insertSeparator(); | 241 | mPopupMenu->insertSeparator(); |
236 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 242 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
237 | i18n("Save selected to file..."),this, | 243 | i18n("Save selected to file..."),this, |
238 | SLOT(saveToFile()),true); | 244 | SLOT(saveToFile()),true); |
239 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 245 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
240 | i18n("Save Journal/Description..."),this, | 246 | i18n("Save Journal/Description..."),this, |
241 | SLOT(saveDescriptionToFile()),true); | 247 | SLOT(saveDescriptionToFile()),true); |
242 | mPopupMenu->insertSeparator(); | 248 | mPopupMenu->insertSeparator(); |
243 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 249 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
244 | i18n("Add Categ. to selected..."),this, | 250 | i18n("Add Categ. to selected..."),this, |
245 | SLOT(addCat()),true); | 251 | SLOT(addCat()),true); |
246 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 252 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
247 | i18n("Set Categ. for selected..."),this, | 253 | i18n("Set Categ. for selected..."),this, |
248 | SLOT(setCat()),true); | 254 | SLOT(setCat()),true); |
249 | mPopupMenu->insertSeparator(); | 255 | mPopupMenu->insertSeparator(); |
250 | 256 | ||
251 | 257 | ||
252 | #ifndef DESKTOP_VERSION | 258 | #ifndef DESKTOP_VERSION |
253 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 259 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
254 | i18n("Beam selected via IR"),this, | 260 | i18n("Beam selected via IR"),this, |
255 | SLOT(beamSelected()),true); | 261 | SLOT(beamSelected()),true); |
256 | #endif | 262 | #endif |
257 | /* | 263 | /* |
258 | mPopupMenu = new QPopupMenu; | 264 | mPopupMenu = new QPopupMenu; |
259 | mPopupMenu->insertItem(i18n("Edit Event"), this, | 265 | mPopupMenu->insertItem(i18n("Edit Event"), this, |
260 | SLOT (editEvent())); | 266 | SLOT (editEvent())); |
261 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, | 267 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, |
262 | SLOT (deleteEvent())); | 268 | SLOT (deleteEvent())); |
263 | mPopupMenu->insertSeparator(); | 269 | mPopupMenu->insertSeparator(); |
264 | mPopupMenu->insertItem(i18n("Show Dates"), this, | 270 | mPopupMenu->insertItem(i18n("Show Dates"), this, |
265 | SLOT(showDates())); | 271 | SLOT(showDates())); |
266 | mPopupMenu->insertItem(i18n("Hide Dates"), this, | 272 | mPopupMenu->insertItem(i18n("Hide Dates"), this, |
267 | SLOT(hideDates())); | 273 | SLOT(hideDates())); |
268 | */ | 274 | */ |
269 | QObject::connect(mListView,SIGNAL( newEvent()), | 275 | QObject::connect(mListView,SIGNAL( newEvent()), |
270 | this,SIGNAL(signalNewEvent())); | 276 | this,SIGNAL(signalNewEvent())); |
271 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), | 277 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), |
272 | this,SLOT(defaultItemAction(QListViewItem *))); | 278 | this,SLOT(defaultItemAction(QListViewItem *))); |
273 | QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, | 279 | QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, |
@@ -596,197 +602,202 @@ void KOListView::deleteAll() | |||
596 | 602 | ||
597 | } | 603 | } |
598 | int KOListView::maxDatesHint() | 604 | int KOListView::maxDatesHint() |
599 | { | 605 | { |
600 | return 0; | 606 | return 0; |
601 | } | 607 | } |
602 | 608 | ||
603 | int KOListView::currentDateCount() | 609 | int KOListView::currentDateCount() |
604 | { | 610 | { |
605 | return 0; | 611 | return 0; |
606 | } | 612 | } |
607 | 613 | ||
608 | QPtrList<Incidence> KOListView::selectedIncidences() | 614 | QPtrList<Incidence> KOListView::selectedIncidences() |
609 | { | 615 | { |
610 | QPtrList<Incidence> eventList; | 616 | QPtrList<Incidence> eventList; |
611 | QListViewItem *item = mListView->firstChild (); | 617 | QListViewItem *item = mListView->firstChild (); |
612 | while ( item ) { | 618 | while ( item ) { |
613 | if ( item->isSelected() ) { | 619 | if ( item->isSelected() ) { |
614 | eventList.append(((KOListViewItem *)item)->data()); | 620 | eventList.append(((KOListViewItem *)item)->data()); |
615 | } | 621 | } |
616 | 622 | ||
617 | item = item->nextSibling(); | 623 | item = item->nextSibling(); |
618 | } | 624 | } |
619 | 625 | ||
620 | // // QListViewItem *item = mListView->selectedItem(); | 626 | // // QListViewItem *item = mListView->selectedItem(); |
621 | //if (item) eventList.append(((KOListViewItem *)item)->data()); | 627 | //if (item) eventList.append(((KOListViewItem *)item)->data()); |
622 | 628 | ||
623 | return eventList; | 629 | return eventList; |
624 | } | 630 | } |
625 | 631 | ||
626 | DateList KOListView::selectedDates() | 632 | DateList KOListView::selectedDates() |
627 | { | 633 | { |
628 | DateList eventList; | 634 | DateList eventList; |
629 | return eventList; | 635 | return eventList; |
630 | } | 636 | } |
631 | 637 | ||
632 | void KOListView::showDates(bool show) | 638 | void KOListView::showDates(bool show) |
633 | { | 639 | { |
634 | // Shouldn't we set it to a value greater 0? When showDates is called with | 640 | // Shouldn't we set it to a value greater 0? When showDates is called with |
635 | // show == true at first, then the columnwidths are set to zero. | 641 | // show == true at first, then the columnwidths are set to zero. |
636 | static int oldColWidth1 = 0; | 642 | static int oldColWidth1 = 0; |
637 | static int oldColWidth3 = 0; | 643 | static int oldColWidth3 = 0; |
638 | 644 | ||
639 | if (!show) { | 645 | if (!show) { |
640 | oldColWidth1 = mListView->columnWidth(1); | 646 | oldColWidth1 = mListView->columnWidth(1); |
641 | oldColWidth3 = mListView->columnWidth(3); | 647 | oldColWidth3 = mListView->columnWidth(3); |
642 | mListView->setColumnWidth(1, 0); | 648 | mListView->setColumnWidth(1, 0); |
643 | mListView->setColumnWidth(3, 0); | 649 | mListView->setColumnWidth(3, 0); |
644 | } else { | 650 | } else { |
645 | mListView->setColumnWidth(1, oldColWidth1); | 651 | mListView->setColumnWidth(1, oldColWidth1); |
646 | mListView->setColumnWidth(3, oldColWidth3); | 652 | mListView->setColumnWidth(3, oldColWidth3); |
647 | } | 653 | } |
648 | mListView->repaint(); | 654 | mListView->repaint(); |
649 | } | 655 | } |
650 | 656 | ||
651 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 657 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
652 | const QDate &td) | 658 | const QDate &td) |
653 | { | 659 | { |
654 | #ifndef KORG_NOPRINTER | 660 | #ifndef KORG_NOPRINTER |
655 | calPrinter->preview(CalPrinter::Day, fd, td); | 661 | calPrinter->preview(CalPrinter::Day, fd, td); |
656 | #endif | 662 | #endif |
657 | } | 663 | } |
658 | 664 | ||
659 | void KOListView::showDates() | 665 | void KOListView::showDates() |
660 | { | 666 | { |
661 | showDates(true); | 667 | showDates(true); |
662 | } | 668 | } |
663 | 669 | ||
664 | void KOListView::hideDates() | 670 | void KOListView::hideDates() |
665 | { | 671 | { |
666 | showDates(false); | 672 | showDates(false); |
667 | } | 673 | } |
668 | 674 | ||
669 | void KOListView::updateView() | 675 | void KOListView::updateView() |
670 | { | 676 | { |
671 | mListView->setFocus(); | 677 | mListView->setFocus(); |
672 | if ( mListView->firstChild () ) | 678 | if ( mListView->firstChild () ) |
673 | mListView->setCurrentItem( mListView->firstChild () ); | 679 | mListView->setCurrentItem( mListView->firstChild () ); |
674 | } | 680 | } |
675 | void KOListView::updateConfig() | 681 | void KOListView::updateConfig() |
676 | { | 682 | { |
677 | 683 | ||
678 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 684 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
679 | updateView(); | 685 | updateView(); |
680 | 686 | ||
681 | } | 687 | } |
682 | void KOListView::setStartDate(const QDate &start) | 688 | void KOListView::setStartDate(const QDate &start) |
683 | { | 689 | { |
684 | mStartDate = start; | 690 | mStartDate = start; |
685 | } | 691 | } |
686 | 692 | ||
687 | void KOListView::showDates(const QDate &start, const QDate &end) | 693 | void KOListView::showDates(const QDate &start, const QDate &end) |
688 | { | 694 | { |
689 | clear(); | 695 | clear(); |
690 | mStartDate = start; | 696 | mStartDate = start; |
691 | QDate date = start; | 697 | QDate date = start; |
698 | QPtrList<Journal> j_list; | ||
692 | while( date <= end ) { | 699 | while( date <= end ) { |
693 | addEvents(calendar()->events(date)); | 700 | addEvents(calendar()->events(date)); |
694 | addTodos(calendar()->todos(date)); | 701 | addTodos(calendar()->todos(date)); |
702 | Journal* jo = calendar()->journal(date); | ||
703 | if ( jo ) | ||
704 | j_list.append( jo ); | ||
695 | date = date.addDays( 1 ); | 705 | date = date.addDays( 1 ); |
696 | } | 706 | } |
707 | addJournals(j_list); | ||
697 | emit incidenceSelected( 0 ); | 708 | emit incidenceSelected( 0 ); |
698 | updateView(); | 709 | updateView(); |
699 | 710 | ||
700 | } | 711 | } |
701 | 712 | ||
702 | void KOListView::addEvents(QPtrList<Event> eventList) | 713 | void KOListView::addEvents(QPtrList<Event> eventList) |
703 | { | 714 | { |
704 | Event *ev; | 715 | Event *ev; |
705 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 716 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
706 | addIncidence(ev); | 717 | addIncidence(ev); |
707 | } | 718 | } |
708 | if ( !mListView->currentItem() ){ | 719 | if ( !mListView->currentItem() ){ |
709 | updateView(); | 720 | updateView(); |
710 | } | 721 | } |
711 | } | 722 | } |
712 | 723 | ||
713 | void KOListView::addTodos(QPtrList<Todo> eventList) | 724 | void KOListView::addTodos(QPtrList<Todo> eventList) |
714 | { | 725 | { |
715 | Todo *ev; | 726 | Todo *ev; |
716 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 727 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
717 | addIncidence(ev); | 728 | addIncidence(ev); |
718 | } | 729 | } |
719 | if ( !mListView->currentItem() ){ | 730 | if ( !mListView->currentItem() ){ |
720 | updateView(); | 731 | updateView(); |
721 | } | 732 | } |
722 | } | 733 | } |
723 | void KOListView::addJournals(QPtrList<Journal> eventList) | 734 | void KOListView::addJournals(QPtrList<Journal> eventList) |
724 | { | 735 | { |
725 | Journal *ev; | 736 | Journal *ev; |
726 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 737 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
727 | addIncidence(ev); | 738 | addIncidence(ev); |
728 | } | 739 | } |
729 | if ( !mListView->currentItem() ){ | 740 | if ( !mListView->currentItem() ){ |
730 | updateView(); | 741 | updateView(); |
731 | } | 742 | } |
732 | } | 743 | } |
733 | 744 | ||
734 | void KOListView::addIncidence(Incidence *incidence) | 745 | void KOListView::addIncidence(Incidence *incidence) |
735 | { | 746 | { |
736 | if ( mUidDict.find( incidence->uid() ) ) return; | 747 | if ( mUidDict.find( incidence->uid() ) ) return; |
737 | 748 | ||
738 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 749 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
739 | mUidDict.insert( incidence->uid(), incidence ); | 750 | mUidDict.insert( incidence->uid(), incidence ); |
740 | 751 | ||
741 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); | 752 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); |
742 | ListItemVisitor v(item, mStartDate ); | 753 | ListItemVisitor v(item, mStartDate ); |
743 | if (incidence->accept(v)) return; | 754 | if (incidence->accept(v)) return; |
744 | else delete item; | 755 | else delete item; |
745 | //qDebug("delete item "); | 756 | //qDebug("delete item "); |
746 | } | 757 | } |
747 | 758 | ||
748 | void KOListView::showEvents(QPtrList<Event> eventList) | 759 | void KOListView::showEvents(QPtrList<Event> eventList) |
749 | { | 760 | { |
750 | clear(); | 761 | clear(); |
751 | 762 | ||
752 | addEvents(eventList); | 763 | addEvents(eventList); |
753 | 764 | ||
754 | // After new creation of list view no events are selected. | 765 | // After new creation of list view no events are selected. |
755 | emit incidenceSelected( 0 ); | 766 | emit incidenceSelected( 0 ); |
756 | } | 767 | } |
757 | int KOListView::count() | 768 | int KOListView::count() |
758 | { | 769 | { |
759 | return mListView->childCount(); | 770 | return mListView->childCount(); |
760 | } | 771 | } |
761 | 772 | ||
762 | void KOListView::changeEventDisplay(Event *event, int action) | 773 | void KOListView::changeEventDisplay(Event *event, int action) |
763 | { | 774 | { |
764 | KOListViewItem *item; | 775 | KOListViewItem *item; |
765 | 776 | ||
766 | switch(action) { | 777 | switch(action) { |
767 | case KOGlobals::EVENTADDED: | 778 | case KOGlobals::EVENTADDED: |
768 | addIncidence( event ); | 779 | addIncidence( event ); |
769 | break; | 780 | break; |
770 | case KOGlobals::EVENTEDITED: | 781 | case KOGlobals::EVENTEDITED: |
771 | item = getItemForEvent(event); | 782 | item = getItemForEvent(event); |
772 | if (item) { | 783 | if (item) { |
773 | mUidDict.remove( event->uid() ); | 784 | mUidDict.remove( event->uid() ); |
774 | delete item; | 785 | delete item; |
775 | addIncidence( event ); | 786 | addIncidence( event ); |
776 | } | 787 | } |
777 | break; | 788 | break; |
778 | case KOGlobals::EVENTDELETED: | 789 | case KOGlobals::EVENTDELETED: |
779 | item = getItemForEvent(event); | 790 | item = getItemForEvent(event); |
780 | if (item) { | 791 | if (item) { |
781 | mUidDict.remove( event->uid() ); | 792 | mUidDict.remove( event->uid() ); |
782 | delete item; | 793 | delete item; |
783 | } | 794 | } |
784 | break; | 795 | break; |
785 | default: | 796 | default: |
786 | ; | 797 | ; |
787 | } | 798 | } |
788 | } | 799 | } |
789 | 800 | ||
790 | KOListViewItem *KOListView::getItemForEvent(Event *event) | 801 | KOListViewItem *KOListView::getItemForEvent(Event *event) |
791 | { | 802 | { |
792 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); | 803 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); |
diff --git a/korganizer/main.cpp b/korganizer/main.cpp index c8a55d2..ca53828 100644 --- a/korganizer/main.cpp +++ b/korganizer/main.cpp | |||
@@ -1,104 +1,106 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #ifndef DESKTOP_VERSION | 3 | #ifndef DESKTOP_VERSION |
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | #include <qcopchannel_qws.h> | 5 | #include <qcopchannel_qws.h> |
6 | #include <qpe/global.h> | 6 | #include <qpe/global.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #else | 8 | #else |
9 | #include <qapplication.h> | 9 | #include <qapplication.h> |
10 | #include <qstring.h> | 10 | #include <qstring.h> |
11 | #include <qwindowsstyle.h> | 11 | #include <qwindowsstyle.h> |
12 | #include <qplatinumstyle.h> | 12 | #include <qplatinumstyle.h> |
13 | #include <qsgistyle.h> | 13 | #include <qsgistyle.h> |
14 | #endif | 14 | #endif |
15 | #include <qtextcodec.h> | ||
15 | 16 | ||
16 | #include <qdir.h> | 17 | #include <qdir.h> |
17 | #include <kstandarddirs.h> | 18 | #include <kstandarddirs.h> |
18 | #include <kglobal.h> | 19 | #include <kglobal.h> |
19 | #include <stdio.h> | 20 | #include <stdio.h> |
20 | #include "mainwindow.h" | 21 | #include "mainwindow.h" |
21 | 22 | ||
22 | int main( int argc, char **argv ) | 23 | int main( int argc, char **argv ) |
23 | { | 24 | { |
24 | #ifndef DESKTOP_VERSION | 25 | #ifndef DESKTOP_VERSION |
25 | QPEApplication a( argc, argv ); | 26 | QPEApplication a( argc, argv ); |
26 | a.setKeepRunning (); | 27 | a.setKeepRunning (); |
27 | #else | 28 | #else |
28 | QApplication a( argc, argv ); | 29 | QApplication a( argc, argv ); |
29 | QApplication::setStyle( new QPlatinumStyle ()); | 30 | QApplication::setStyle( new QPlatinumStyle ()); |
30 | QString hdir = QDir::homeDirPath(); | 31 | QString hdir = QDir::homeDirPath(); |
31 | // there is a bug when creating dirs for WIN 98 | 32 | // there is a bug when creating dirs for WIN 98 |
32 | // it is difficult to fix, because we have no WIN 98 runnung | 33 | // it is difficult to fix, because we have no WIN 98 runnung |
33 | // such that we try it to create the dirs at startup here | 34 | // such that we try it to create the dirs at startup here |
34 | if ( hdir == "C:\\" ) { // win 98 or ME | 35 | if ( hdir == "C:\\" ) { // win 98 or ME |
35 | QDir app_dir; | 36 | QDir app_dir; |
36 | if ( !app_dir.exists("C:\\kdepim") ) | 37 | if ( !app_dir.exists("C:\\kdepim") ) |
37 | app_dir.mkdir ("C:\\kdepim"); | 38 | app_dir.mkdir ("C:\\kdepim"); |
38 | if ( !app_dir.exists("C:\\kdepim\\apps") ) | 39 | if ( !app_dir.exists("C:\\kdepim\\apps") ) |
39 | app_dir.mkdir ("C:\\kdepim\\apps"); | 40 | app_dir.mkdir ("C:\\kdepim\\apps"); |
40 | if ( !app_dir.exists("C:\\kdepim\\config") ) | 41 | if ( !app_dir.exists("C:\\kdepim\\config") ) |
41 | app_dir.mkdir ("C:\\kdepim\\config"); | 42 | app_dir.mkdir ("C:\\kdepim\\config"); |
42 | if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") ) | 43 | if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") ) |
43 | app_dir.mkdir ("C:\\kdepim\\apps\\korganizer"); | 44 | app_dir.mkdir ("C:\\kdepim\\apps\\korganizer"); |
44 | } | 45 | } |
45 | #endif | 46 | #endif |
46 | bool exitHelp = false; | 47 | bool exitHelp = false; |
47 | if ( argc > 1 ) { | 48 | if ( argc > 1 ) { |
48 | QString command = argv[1]; | 49 | QString command = argv[1]; |
49 | if ( command == "-help" ){ | 50 | if ( command == "-help" ){ |
50 | printf("KO/Pi command line commands:\n"); | 51 | printf("KO/Pi command line commands:\n"); |
51 | printf(" no command: Start KO/Pi in usual way\n"); | 52 | printf(" no command: Start KO/Pi in usual way\n"); |
52 | printf(" -help: This output\n"); | 53 | printf(" -help: This output\n"); |
53 | printf("Next Option: Open or Show after start:\n"); | 54 | printf("Next Option: Open or Show after start:\n"); |
54 | printf(" -newTodo: New Todo dialog\n"); | 55 | printf(" -newTodo: New Todo dialog\n"); |
55 | printf(" -newEvent: New Event dialog\n"); | 56 | printf(" -newEvent: New Event dialog\n"); |
56 | printf(" -showList: List view\n"); | 57 | printf(" -showList: List view\n"); |
57 | printf(" -showDay: Day view\n"); | 58 | printf(" -showDay: Day view\n"); |
58 | printf(" -showWWeek: Work Week view\n"); | 59 | printf(" -showWWeek: Work Week view\n"); |
59 | printf(" -showWeek: Week view\n"); | 60 | printf(" -showWeek: Week view\n"); |
60 | printf(" -showTodo: Todo view\n"); | 61 | printf(" -showTodo: Todo view\n"); |
61 | printf(" -showJournal: Journal view\n"); | 62 | printf(" -showJournal: Journal view\n"); |
62 | printf(" -showKO: Next Days view\n"); | 63 | printf(" -showKO: Next Days view\n"); |
63 | printf(" -showWNext: What's Next view\n"); | 64 | printf(" -showWNext: What's Next view\n"); |
64 | printf(" -showNextXView: Next X View\n"); | 65 | printf(" -showNextXView: Next X View\n"); |
65 | printf(" -new[Y] and -show[X] may be used togehther\n"); | 66 | printf(" -new[Y] and -show[X] may be used togehther\n"); |
66 | printf(" KO/Pi is exiting now. Bye!\n"); | 67 | printf(" KO/Pi is exiting now. Bye!\n"); |
67 | exitHelp = true; | 68 | exitHelp = true; |
68 | } | 69 | } |
69 | } | 70 | } |
70 | if ( ! exitHelp ) { | 71 | if ( ! exitHelp ) { |
71 | KGlobal::setAppName( "korganizer" ); | 72 | KGlobal::setAppName( "korganizer" ); |
72 | QString fileName ; | 73 | QString fileName ; |
73 | #ifndef DESKTOP_VERSION | 74 | #ifndef DESKTOP_VERSION |
74 | fileName = getenv("QPEDIR"); | 75 | fileName = getenv("QPEDIR"); |
75 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); | 76 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); |
76 | #else | 77 | #else |
77 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; | 78 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; |
78 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 79 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
79 | #endif | 80 | #endif |
80 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); | 81 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); |
81 | MainWindow m; | 82 | MainWindow m; |
82 | #ifndef DESKTOP_VERSION | 83 | #ifndef DESKTOP_VERSION |
83 | 84 | ||
84 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); | 85 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); |
85 | a.showMainWidget(&m ); | 86 | a.showMainWidget(&m ); |
86 | #else | 87 | #else |
87 | a.setMainWidget(&m ); | 88 | a.setMainWidget(&m ); |
88 | m.show(); | 89 | m.show(); |
89 | //m.resize( 800, 600 ); | 90 | //m.resize( 800, 600 ); |
90 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); | 91 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); |
91 | #endif | 92 | #endif |
92 | if ( argc > 1 ) { | 93 | if ( argc > 1 ) { |
93 | QCString command = argv[1]; | 94 | QCString command = argv[1]; |
94 | if ( argc > 2 ) | 95 | if ( argc > 2 ) |
95 | command += argv[2]; | 96 | command += argv[2]; |
96 | qApp->processEvents(); | 97 | qApp->processEvents(); |
97 | m.recieve(command, QByteArray() ); | 98 | m.recieve(command, QByteArray() ); |
98 | 99 | ||
99 | } | 100 | } |
101 | |||
100 | a.exec(); | 102 | a.exec(); |
101 | 103 | ||
102 | } | 104 | } |
103 | qDebug("KO: Bye! "); | 105 | qDebug("KO: Bye! "); |
104 | } | 106 | } |
diff --git a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp index 8b6dfbc..8404c3e 100644 --- a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp +++ b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp | |||
@@ -1,165 +1,172 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of PwManager/Platform independent. | 2 | This file is part of PwManager/Platform independent. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program 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 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | 22 | ||
23 | $Id$ | 23 | $Id$ |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "getmasterpwwnd_emb.h" | 26 | #include "getmasterpwwnd_emb.h" |
27 | 27 | ||
28 | #include "klocale.h" | 28 | #include "klocale.h" |
29 | 29 | ||
30 | /* | 30 | /* |
31 | #include <qvariant.h> | 31 | #include <qvariant.h> |
32 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qlineedit.h> | 34 | #include <qlineedit.h> |
35 | #include <qlayout.h> | 35 | #include <qlayout.h> |
36 | #include <qtooltip.h> | 36 | #include <qtooltip.h> |
37 | #include <qwhatsthis.h> | 37 | #include <qwhatsthis.h> |
38 | */ | 38 | */ |
39 | 39 | ||
40 | #include <qwidget.h> | 40 | #include <qwidget.h> |
41 | #include <qlayout.h> | 41 | #include <qlayout.h> |
42 | #include <qlabel.h> | 42 | #include <qlabel.h> |
43 | #include <qlineedit.h> | 43 | #include <qlineedit.h> |
44 | #include <qpushbutton.h> | 44 | #include <qpushbutton.h> |
45 | #include <qapplication.h> | ||
45 | 46 | ||
46 | /* | 47 | /* |
47 | * Constructs a getMasterPwWnd as a child of 'parent', with the | 48 | * Constructs a getMasterPwWnd as a child of 'parent', with the |
48 | * name 'name' | 49 | * name 'name' |
49 | */ | 50 | */ |
50 | getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name) | 51 | getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name) |
51 | : KDialogBase( KDialogBase::Plain, i18n( "Master-password" ), | 52 | : KDialogBase( KDialogBase::Plain, i18n( "Master-password" ), |
52 | KDialogBase::Ok | KDialogBase::Cancel, | 53 | KDialogBase::Ok | KDialogBase::Cancel, |
53 | KDialogBase::Ok, parent, name, true ) | 54 | KDialogBase::Ok, parent, name, true ) |
54 | { | 55 | { |
55 | QWidget *page = plainPage(); | 56 | QWidget *page = plainPage(); |
56 | QVBoxLayout *pageLayout = new QVBoxLayout( page ); | 57 | QVBoxLayout *pageLayout = new QVBoxLayout( page ); |
57 | 58 | ||
58 | pwLineEdit = new QLineEdit( page, "pwLineEdit" ); | 59 | pwLineEdit = new QLineEdit( page, "pwLineEdit" ); |
59 | pwLineEdit->setEchoMode( QLineEdit::Password ); | 60 | pwLineEdit->setEchoMode( QLineEdit::Password ); |
60 | 61 | ||
61 | QLabel* textLabel1 = new QLabel( pwLineEdit, i18n("Please enter the master-password:"), page, "textLabel1" ); | 62 | QLabel* textLabel1 = new QLabel( pwLineEdit, i18n("Please enter the master-password:"), page, "textLabel1" ); |
62 | textLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) ); | 63 | textLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) ); |
63 | pageLayout->addWidget(textLabel1); | 64 | pageLayout->addWidget(textLabel1); |
64 | pageLayout->addWidget(pwLineEdit); | 65 | pageLayout->addWidget(pwLineEdit); |
65 | 66 | ||
66 | QWidget* numberBox = new QWidget( page ); | 67 | QWidget* numberBox = new QWidget( page ); |
67 | #ifndef DESKTOP_VERSION | 68 | #ifndef DESKTOP_VERSION |
68 | numberBox->setFixedHeight(150); | 69 | if ( QApplication::desktop()->width() > 320 ) { |
69 | numberBox->setFixedWidth(150); | 70 | numberBox->setFixedHeight(250); |
71 | numberBox->setFixedWidth(200); | ||
72 | } | ||
73 | else{ | ||
74 | numberBox->setFixedHeight(150); | ||
75 | numberBox->setFixedWidth(150); | ||
76 | } | ||
70 | #endif | 77 | #endif |
71 | 78 | ||
72 | QGridLayout* numberLayout = new QGridLayout( numberBox, 4, 3 ); | 79 | QGridLayout* numberLayout = new QGridLayout( numberBox, 4, 3 ); |
73 | numberLayout->setMargin( 0 ); | 80 | numberLayout->setMargin( 0 ); |
74 | numberLayout->setSpacing( 0 ); | 81 | numberLayout->setSpacing( 0 ); |
75 | 82 | ||
76 | QPushButton* p1 = new QPushButton( i18n("1"), numberBox ); | 83 | QPushButton* p1 = new QPushButton( i18n("1"), numberBox ); |
77 | numberLayout->addWidget( p1, 0, 0 ); | 84 | numberLayout->addWidget( p1, 0, 0 ); |
78 | QPushButton* p2 = new QPushButton( i18n("2"), numberBox ); | 85 | QPushButton* p2 = new QPushButton( i18n("2"), numberBox ); |
79 | numberLayout->addWidget( p2, 0, 1 ); | 86 | numberLayout->addWidget( p2, 0, 1 ); |
80 | QPushButton* p3 = new QPushButton( i18n("3"), numberBox ); | 87 | QPushButton* p3 = new QPushButton( i18n("3"), numberBox ); |
81 | numberLayout->addWidget( p3, 0, 2 ); | 88 | numberLayout->addWidget( p3, 0, 2 ); |
82 | QPushButton* p4 = new QPushButton( i18n("4"), numberBox ); | 89 | QPushButton* p4 = new QPushButton( i18n("4"), numberBox ); |
83 | numberLayout->addWidget( p4, 1, 0 ); | 90 | numberLayout->addWidget( p4, 1, 0 ); |
84 | QPushButton* p5 = new QPushButton( i18n("5"), numberBox ); | 91 | QPushButton* p5 = new QPushButton( i18n("5"), numberBox ); |
85 | numberLayout->addWidget( p5, 1, 1 ); | 92 | numberLayout->addWidget( p5, 1, 1 ); |
86 | QPushButton* p6 = new QPushButton( i18n("6"), numberBox ); | 93 | QPushButton* p6 = new QPushButton( i18n("6"), numberBox ); |
87 | numberLayout->addWidget( p6, 1, 2 ); | 94 | numberLayout->addWidget( p6, 1, 2 ); |
88 | QPushButton* p7 = new QPushButton( i18n("7"), numberBox ); | 95 | QPushButton* p7 = new QPushButton( i18n("7"), numberBox ); |
89 | numberLayout->addWidget( p7, 2, 0 ); | 96 | numberLayout->addWidget( p7, 2, 0 ); |
90 | QPushButton* p8 = new QPushButton( i18n("8"), numberBox ); | 97 | QPushButton* p8 = new QPushButton( i18n("8"), numberBox ); |
91 | numberLayout->addWidget( p8, 2, 1 ); | 98 | numberLayout->addWidget( p8, 2, 1 ); |
92 | QPushButton* p9 = new QPushButton( i18n("9"), numberBox ); | 99 | QPushButton* p9 = new QPushButton( i18n("9"), numberBox ); |
93 | numberLayout->addWidget( p9, 2, 2 ); | 100 | numberLayout->addWidget( p9, 2, 2 ); |
94 | QPushButton* clear = new QPushButton( i18n("x"), numberBox ); | 101 | QPushButton* clear = new QPushButton( i18n("x"), numberBox ); |
95 | numberLayout->addWidget( clear, 3, 0 ); | 102 | numberLayout->addWidget( clear, 3, 0 ); |
96 | QPushButton* p0 = new QPushButton( i18n("0"), numberBox ); | 103 | QPushButton* p0 = new QPushButton( i18n("0"), numberBox ); |
97 | numberLayout->addWidget( p0, 3, 1 ); | 104 | numberLayout->addWidget( p0, 3, 1 ); |
98 | QPushButton* backspace = new QPushButton( i18n("-"), numberBox ); | 105 | QPushButton* backspace = new QPushButton( i18n("-"), numberBox ); |
99 | numberLayout->addWidget( backspace, 3, 2 ); | 106 | numberLayout->addWidget( backspace, 3, 2 ); |
100 | 107 | ||
101 | 108 | ||
102 | pageLayout->addWidget(numberBox); | 109 | pageLayout->addWidget(numberBox); |
103 | #ifdef DESKTOP_VERSION | 110 | #ifdef DESKTOP_VERSION |
104 | resize( sizeHint() ); | 111 | resize( sizeHint() ); |
105 | #else | 112 | #else |
106 | resize( 200,sizeHint().height() ); | 113 | resize( 200,sizeHint().height() ); |
107 | #endif | 114 | #endif |
108 | 115 | ||
109 | connect( p0, SIGNAL( clicked() ), this, SLOT( add0() ) ); | 116 | connect( p0, SIGNAL( clicked() ), this, SLOT( add0() ) ); |
110 | connect( p1, SIGNAL( clicked() ), this, SLOT( add1() ) ); | 117 | connect( p1, SIGNAL( clicked() ), this, SLOT( add1() ) ); |
111 | connect( p2, SIGNAL( clicked() ), this, SLOT( add2() ) ); | 118 | connect( p2, SIGNAL( clicked() ), this, SLOT( add2() ) ); |
112 | connect( p3, SIGNAL( clicked() ), this, SLOT( add3() ) ); | 119 | connect( p3, SIGNAL( clicked() ), this, SLOT( add3() ) ); |
113 | connect( p4, SIGNAL( clicked() ), this, SLOT( add4() ) ); | 120 | connect( p4, SIGNAL( clicked() ), this, SLOT( add4() ) ); |
114 | connect( p5, SIGNAL( clicked() ), this, SLOT( add5() ) ); | 121 | connect( p5, SIGNAL( clicked() ), this, SLOT( add5() ) ); |
115 | connect( p6, SIGNAL( clicked() ), this, SLOT( add6() ) ); | 122 | connect( p6, SIGNAL( clicked() ), this, SLOT( add6() ) ); |
116 | connect( p7, SIGNAL( clicked() ), this, SLOT( add7() ) ); | 123 | connect( p7, SIGNAL( clicked() ), this, SLOT( add7() ) ); |
117 | connect( p8, SIGNAL( clicked() ), this, SLOT( add8() ) ); | 124 | connect( p8, SIGNAL( clicked() ), this, SLOT( add8() ) ); |
118 | connect( p9, SIGNAL( clicked() ), this, SLOT( add9() ) ); | 125 | connect( p9, SIGNAL( clicked() ), this, SLOT( add9() ) ); |
119 | connect( backspace, SIGNAL( clicked() ), this, SLOT( backspace() ) ); | 126 | connect( backspace, SIGNAL( clicked() ), this, SLOT( backspace() ) ); |
120 | connect( clear, SIGNAL( clicked() ), this, SLOT( clear() ) ); | 127 | connect( clear, SIGNAL( clicked() ), this, SLOT( clear() ) ); |
121 | 128 | ||
122 | 129 | ||
123 | 130 | ||
124 | } | 131 | } |
125 | 132 | ||
126 | /* | 133 | /* |
127 | * Destroys the object and frees any allocated resources | 134 | * Destroys the object and frees any allocated resources |
128 | */ | 135 | */ |
129 | getMasterPwWnd::~getMasterPwWnd() | 136 | getMasterPwWnd::~getMasterPwWnd() |
130 | { | 137 | { |
131 | // no need to delete child widgets, Qt does it all for us | 138 | // no need to delete child widgets, Qt does it all for us |
132 | } | 139 | } |
133 | 140 | ||
134 | void getMasterPwWnd::okButton_slot() | 141 | void getMasterPwWnd::okButton_slot() |
135 | { | 142 | { |
136 | qWarning( "getMasterPwWnd::okButton_slot(): Not implemented yet" ); | 143 | qWarning( "getMasterPwWnd::okButton_slot(): Not implemented yet" ); |
137 | } | 144 | } |
138 | 145 | ||
139 | void getMasterPwWnd::cancelButton_slot() | 146 | void getMasterPwWnd::cancelButton_slot() |
140 | { | 147 | { |
141 | qWarning( "getMasterPwWnd::cancelButton_slot(): Not implemented yet" ); | 148 | qWarning( "getMasterPwWnd::cancelButton_slot(): Not implemented yet" ); |
142 | } | 149 | } |
143 | 150 | ||
144 | void getMasterPwWnd::add0() | 151 | void getMasterPwWnd::add0() |
145 | { | 152 | { |
146 | addCharacter("0"); | 153 | addCharacter("0"); |
147 | } | 154 | } |
148 | void getMasterPwWnd::add1() | 155 | void getMasterPwWnd::add1() |
149 | { | 156 | { |
150 | addCharacter("1"); | 157 | addCharacter("1"); |
151 | } | 158 | } |
152 | void getMasterPwWnd::add2() | 159 | void getMasterPwWnd::add2() |
153 | { | 160 | { |
154 | addCharacter("2"); | 161 | addCharacter("2"); |
155 | } | 162 | } |
156 | void getMasterPwWnd::add3() | 163 | void getMasterPwWnd::add3() |
157 | { | 164 | { |
158 | addCharacter("3"); | 165 | addCharacter("3"); |
159 | } | 166 | } |
160 | void getMasterPwWnd::add4() | 167 | void getMasterPwWnd::add4() |
161 | { | 168 | { |
162 | addCharacter("4"); | 169 | addCharacter("4"); |
163 | } | 170 | } |
164 | void getMasterPwWnd::add5() | 171 | void getMasterPwWnd::add5() |
165 | { | 172 | { |