summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 7cba9aa..3ae23e8 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -389,799 +389,798 @@ void KABCore::createAboutData()
389 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" 389 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n"
390 "Mike Pilone GUI and framework redesign mpilone@slac.com\n" 390 "Mike Pilone GUI and framework redesign mpilone@slac.com\n"
391 "Greg Stern DCOP interface\n" 391 "Greg Stern DCOP interface\n"
392 "Mark Westcot Contact pinning\n" 392 "Mark Westcot Contact pinning\n"
393 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 393 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
394 "Steffen Hansen LDAP Lookup hansen@kde.org\n" ); 394 "Steffen Hansen LDAP Lookup hansen@kde.org\n" );
395} 395}
396 396
397void KABCore::setContactSelected( const QString &uid ) 397void KABCore::setContactSelected( const QString &uid )
398{ 398{
399 KABC::Addressee addr = mAddressBook->findByUid( uid ); 399 KABC::Addressee addr = mAddressBook->findByUid( uid );
400 if ( !mDetails->isHidden() ) 400 if ( !mDetails->isHidden() )
401 mDetails->setAddressee( addr ); 401 mDetails->setAddressee( addr );
402 402
403 if ( !addr.isEmpty() ) { 403 if ( !addr.isEmpty() ) {
404 emit contactSelected( addr.formattedName() ); 404 emit contactSelected( addr.formattedName() );
405 KABC::Picture pic = addr.photo(); 405 KABC::Picture pic = addr.photo();
406 if ( pic.isIntern() ) { 406 if ( pic.isIntern() ) {
407//US emit contactSelected( pic.data() ); 407//US emit contactSelected( pic.data() );
408//US instead use: 408//US instead use:
409 QPixmap px; 409 QPixmap px;
410 if (pic.data().isNull() != true) 410 if (pic.data().isNull() != true)
411 { 411 {
412 px.convertFromImage(pic.data()); 412 px.convertFromImage(pic.data());
413 } 413 }
414 414
415 emit contactSelected( px ); 415 emit contactSelected( px );
416 } 416 }
417 } 417 }
418 418
419 419
420 mExtensionManager->setSelectionChanged(); 420 mExtensionManager->setSelectionChanged();
421 421
422 // update the actions 422 // update the actions
423 bool selected = !uid.isEmpty(); 423 bool selected = !uid.isEmpty();
424 424
425 if ( mReadWrite ) { 425 if ( mReadWrite ) {
426 mActionCut->setEnabled( selected ); 426 mActionCut->setEnabled( selected );
427 mActionPaste->setEnabled( selected ); 427 mActionPaste->setEnabled( selected );
428 } 428 }
429 429
430 mActionCopy->setEnabled( selected ); 430 mActionCopy->setEnabled( selected );
431 mActionDelete->setEnabled( selected ); 431 mActionDelete->setEnabled( selected );
432 mActionEditAddressee->setEnabled( selected ); 432 mActionEditAddressee->setEnabled( selected );
433 mActionMail->setEnabled( selected ); 433 mActionMail->setEnabled( selected );
434 mActionMailVCard->setEnabled( selected ); 434 mActionMailVCard->setEnabled( selected );
435 mActionWhoAmI->setEnabled( selected ); 435 mActionWhoAmI->setEnabled( selected );
436 mActionCategories->setEnabled( selected ); 436 mActionCategories->setEnabled( selected );
437} 437}
438 438
439void KABCore::sendMail() 439void KABCore::sendMail()
440{ 440{
441#ifndef KAB_EMBEDDED 441#ifndef KAB_EMBEDDED
442 sendMail( mViewManager->selectedEmails().join( ", " ) ); 442 sendMail( mViewManager->selectedEmails().join( ", " ) );
443#else //KAB_EMBEDDED 443#else //KAB_EMBEDDED
444 qDebug("KABCore::sendMail() ust be fixed"); 444 qDebug("KABCore::sendMail() ust be fixed");
445#endif //KAB_EMBEDDED 445#endif //KAB_EMBEDDED
446} 446}
447 447
448void KABCore::sendMail( const QString& email ) 448void KABCore::sendMail( const QString& email )
449{ 449{
450#ifndef KAB_EMBEDDED 450#ifndef KAB_EMBEDDED
451 kapp->invokeMailer( email, "" ); 451 kapp->invokeMailer( email, "" );
452#else //KAB_EMBEDDED 452#else //KAB_EMBEDDED
453 qDebug("KABCore::sendMail(const QString& email) ust be fixed"); 453 qDebug("KABCore::sendMail(const QString& email) ust be fixed");
454#endif //KAB_EMBEDDED 454#endif //KAB_EMBEDDED
455} 455}
456 456
457void KABCore::mailVCard() 457void KABCore::mailVCard()
458{ 458{
459#ifndef KAB_EMBEDDED 459#ifndef KAB_EMBEDDED
460 QStringList uids = mViewManager->selectedUids(); 460 QStringList uids = mViewManager->selectedUids();
461 if ( !uids.isEmpty() ) 461 if ( !uids.isEmpty() )
462 mailVCard( uids ); 462 mailVCard( uids );
463#else //KAB_EMBEDDED 463#else //KAB_EMBEDDED
464 qDebug("KABCore::mailVCard() must be fixed"); 464 qDebug("KABCore::mailVCard() must be fixed");
465#endif //KAB_EMBEDDED 465#endif //KAB_EMBEDDED
466} 466}
467 467
468void KABCore::mailVCard( const QStringList& uids ) 468void KABCore::mailVCard( const QStringList& uids )
469{ 469{
470#ifndef KAB_EMBEDDED 470#ifndef KAB_EMBEDDED
471 QStringList urls; 471 QStringList urls;
472 472
473 // Create a temp dir, so that we can put the files in it with proper names 473 // Create a temp dir, so that we can put the files in it with proper names
474 KTempFile tempDir; 474 KTempFile tempDir;
475 if ( tempDir.status() != 0 ) { 475 if ( tempDir.status() != 0 ) {
476 kdWarning() << strerror( tempDir.status() ) << endl; 476 kdWarning() << strerror( tempDir.status() ) << endl;
477 return; 477 return;
478 } 478 }
479 479
480 QString dirName = tempDir.name(); 480 QString dirName = tempDir.name();
481 tempDir.unlink(); 481 tempDir.unlink();
482 QDir().mkdir( dirName, true ); 482 QDir().mkdir( dirName, true );
483 483
484 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 484 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
485 KABC::Addressee a = mAddressBook->findByUid( *it ); 485 KABC::Addressee a = mAddressBook->findByUid( *it );
486 486
487 if ( a.isEmpty() ) 487 if ( a.isEmpty() )
488 continue; 488 continue;
489 489
490 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 490 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
491 491
492 QString fileName = dirName + "/" + name; 492 QString fileName = dirName + "/" + name;
493 493
494 QFile outFile(fileName); 494 QFile outFile(fileName);
495 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 495 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
496 KABC::VCardConverter converter; 496 KABC::VCardConverter converter;
497 QString vcard; 497 QString vcard;
498 498
499 converter.addresseeToVCard( a, vcard ); 499 converter.addresseeToVCard( a, vcard );
500 500
501 QTextStream t( &outFile ); // use a text stream 501 QTextStream t( &outFile ); // use a text stream
502 t.setEncoding( QTextStream::UnicodeUTF8 ); 502 t.setEncoding( QTextStream::UnicodeUTF8 );
503 t << vcard; 503 t << vcard;
504 504
505 outFile.close(); 505 outFile.close();
506 506
507 urls.append( fileName ); 507 urls.append( fileName );
508 } 508 }
509 } 509 }
510 510
511 kapp->invokeMailer( QString::null, QString::null, QString::null, 511 kapp->invokeMailer( QString::null, QString::null, QString::null,
512 QString::null, // subject 512 QString::null, // subject
513 QString::null, // body 513 QString::null, // body
514 QString::null, 514 QString::null,
515 urls ); // attachments 515 urls ); // attachments
516#else //KAB_EMBEDDED 516#else //KAB_EMBEDDED
517 qDebug("KABCore::mailVCard( must be fixed"); 517 qDebug("KABCore::mailVCard( must be fixed");
518#endif //KAB_EMBEDDED 518#endif //KAB_EMBEDDED
519 519
520} 520}
521 521
522void KABCore::browse( const QString& url ) 522void KABCore::browse( const QString& url )
523{ 523{
524#ifndef KAB_EMBEDDED 524#ifndef KAB_EMBEDDED
525 kapp->invokeBrowser( url ); 525 kapp->invokeBrowser( url );
526#else //KAB_EMBEDDED 526#else //KAB_EMBEDDED
527 qDebug("KABCore::browse must be fixed"); 527 qDebug("KABCore::browse must be fixed");
528#endif //KAB_EMBEDDED 528#endif //KAB_EMBEDDED
529} 529}
530 530
531void KABCore::selectAllContacts() 531void KABCore::selectAllContacts()
532{ 532{
533 mViewManager->setSelected( QString::null, true ); 533 mViewManager->setSelected( QString::null, true );
534} 534}
535 535
536void KABCore::deleteContacts() 536void KABCore::deleteContacts()
537{ 537{
538 QStringList uidList = mViewManager->selectedUids(); 538 QStringList uidList = mViewManager->selectedUids();
539 deleteContacts( uidList ); 539 deleteContacts( uidList );
540} 540}
541 541
542void KABCore::deleteContacts( const QStringList &uids ) 542void KABCore::deleteContacts( const QStringList &uids )
543{ 543{
544 if ( uids.count() > 0 ) { 544 if ( uids.count() > 0 ) {
545 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 545 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
546 UndoStack::instance()->push( command ); 546 UndoStack::instance()->push( command );
547 RedoStack::instance()->clear(); 547 RedoStack::instance()->clear();
548 548
549 // now if we deleted anything, refresh 549 // now if we deleted anything, refresh
550 setContactSelected( QString::null ); 550 setContactSelected( QString::null );
551 setModified( true ); 551 setModified( true );
552 } 552 }
553} 553}
554 554
555void KABCore::copyContacts() 555void KABCore::copyContacts()
556{ 556{
557 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 557 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
558 558
559 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 559 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
560 560
561 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 561 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
562 562
563 QClipboard *cb = QApplication::clipboard(); 563 QClipboard *cb = QApplication::clipboard();
564 cb->setText( clipText ); 564 cb->setText( clipText );
565} 565}
566 566
567void KABCore::cutContacts() 567void KABCore::cutContacts()
568{ 568{
569 QStringList uidList = mViewManager->selectedUids(); 569 QStringList uidList = mViewManager->selectedUids();
570 570
571//US if ( uidList.size() > 0 ) { 571//US if ( uidList.size() > 0 ) {
572 if ( uidList.count() > 0 ) { 572 if ( uidList.count() > 0 ) {
573 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 573 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
574 UndoStack::instance()->push( command ); 574 UndoStack::instance()->push( command );
575 RedoStack::instance()->clear(); 575 RedoStack::instance()->clear();
576 576
577 setModified( true ); 577 setModified( true );
578 } 578 }
579} 579}
580 580
581void KABCore::pasteContacts() 581void KABCore::pasteContacts()
582{ 582{
583 QClipboard *cb = QApplication::clipboard(); 583 QClipboard *cb = QApplication::clipboard();
584 584
585 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 585 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
586 586
587 pasteContacts( list ); 587 pasteContacts( list );
588} 588}
589 589
590void KABCore::pasteContacts( KABC::Addressee::List &list ) 590void KABCore::pasteContacts( KABC::Addressee::List &list )
591{ 591{
592 KABC::Resource *resource = requestResource( this ); 592 KABC::Resource *resource = requestResource( this );
593 KABC::Addressee::List::Iterator it; 593 KABC::Addressee::List::Iterator it;
594 for ( it = list.begin(); it != list.end(); ++it ) 594 for ( it = list.begin(); it != list.end(); ++it )
595 (*it).setResource( resource ); 595 (*it).setResource( resource );
596 596
597 PwPasteCommand *command = new PwPasteCommand( this, list ); 597 PwPasteCommand *command = new PwPasteCommand( this, list );
598 UndoStack::instance()->push( command ); 598 UndoStack::instance()->push( command );
599 RedoStack::instance()->clear(); 599 RedoStack::instance()->clear();
600 600
601 setModified( true ); 601 setModified( true );
602} 602}
603 603
604void KABCore::setWhoAmI() 604void KABCore::setWhoAmI()
605{ 605{
606 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 606 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
607 607
608 if ( addrList.count() > 1 ) { 608 if ( addrList.count() > 1 ) {
609 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 609 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
610 return; 610 return;
611 } 611 }
612 612
613 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 613 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
614 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 614 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
615 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 615 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
616} 616}
617 617
618void KABCore::setCategories() 618void KABCore::setCategories()
619{ 619{
620 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 620 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
621 if ( !dlg.exec() ) 621 if ( !dlg.exec() )
622 return; 622 return;
623 623
624 bool merge = false; 624 bool merge = false;
625 QString msg = i18n( "Merge with existing categories?" ); 625 QString msg = i18n( "Merge with existing categories?" );
626 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 626 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
627 merge = true; 627 merge = true;
628 628
629 QStringList categories = dlg.selectedCategories(); 629 QStringList categories = dlg.selectedCategories();
630 630
631 QStringList uids = mViewManager->selectedUids(); 631 QStringList uids = mViewManager->selectedUids();
632 QStringList::Iterator it; 632 QStringList::Iterator it;
633 for ( it = uids.begin(); it != uids.end(); ++it ) { 633 for ( it = uids.begin(); it != uids.end(); ++it ) {
634 KABC::Addressee addr = mAddressBook->findByUid( *it ); 634 KABC::Addressee addr = mAddressBook->findByUid( *it );
635 if ( !addr.isEmpty() ) { 635 if ( !addr.isEmpty() ) {
636 if ( !merge ) 636 if ( !merge )
637 addr.setCategories( categories ); 637 addr.setCategories( categories );
638 else { 638 else {
639 QStringList addrCategories = addr.categories(); 639 QStringList addrCategories = addr.categories();
640 QStringList::Iterator catIt; 640 QStringList::Iterator catIt;
641 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 641 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
642 if ( !addrCategories.contains( *catIt ) ) 642 if ( !addrCategories.contains( *catIt ) )
643 addrCategories.append( *catIt ); 643 addrCategories.append( *catIt );
644 } 644 }
645 addr.setCategories( addrCategories ); 645 addr.setCategories( addrCategories );
646 } 646 }
647 647
648 mAddressBook->insertAddressee( addr ); 648 mAddressBook->insertAddressee( addr );
649 } 649 }
650 } 650 }
651 651
652 if ( uids.count() > 0 ) 652 if ( uids.count() > 0 )
653 setModified( true ); 653 setModified( true );
654} 654}
655 655
656void KABCore::setSearchFields( const KABC::Field::List &fields ) 656void KABCore::setSearchFields( const KABC::Field::List &fields )
657{ 657{
658 mIncSearchWidget->setFields( fields ); 658 mIncSearchWidget->setFields( fields );
659} 659}
660 660
661void KABCore::incrementalSearch( const QString& text ) 661void KABCore::incrementalSearch( const QString& text )
662{ 662{
663 mViewManager->setSelected( QString::null, false ); 663 mViewManager->setSelected( QString::null, false );
664 664
665 if ( !text.isEmpty() ) { 665 if ( !text.isEmpty() ) {
666 KABC::Field *field = mIncSearchWidget->currentField(); 666 KABC::Field *field = mIncSearchWidget->currentField();
667 667
668 QString pattern = text.lower(); 668 QString pattern = text.lower();
669 669
670#if 1 //KDE_VERSION >= 319 670#if 1 //KDE_VERSION >= 319
671 KABC::AddresseeList list( mAddressBook->allAddressees() ); 671 KABC::AddresseeList list( mAddressBook->allAddressees() );
672 if ( field ) { 672 if ( field ) {
673 list.sortByField( field ); 673 list.sortByField( field );
674 KABC::AddresseeList::Iterator it; 674 KABC::AddresseeList::Iterator it;
675 for ( it = list.begin(); it != list.end(); ++it ) { 675 for ( it = list.begin(); it != list.end(); ++it ) {
676 if ( field->value( *it ).lower().startsWith( pattern ) ) { 676 if ( field->value( *it ).lower().startsWith( pattern ) ) {
677 mViewManager->setSelected( (*it).uid(), true ); 677 mViewManager->setSelected( (*it).uid(), true );
678 return; 678 return;
679 } 679 }
680 } 680 }
681 } else { 681 } else {
682 KABC::AddresseeList::Iterator it; 682 KABC::AddresseeList::Iterator it;
683 for ( it = list.begin(); it != list.end(); ++it ) { 683 for ( it = list.begin(); it != list.end(); ++it ) {
684 KABC::Field::List fieldList = mIncSearchWidget->fields(); 684 KABC::Field::List fieldList = mIncSearchWidget->fields();
685 KABC::Field::List::ConstIterator fieldIt; 685 KABC::Field::List::ConstIterator fieldIt;
686 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 686 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
687 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { 687 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
688 mViewManager->setSelected( (*it).uid(), true ); 688 mViewManager->setSelected( (*it).uid(), true );
689 return; 689 return;
690 } 690 }
691 } 691 }
692 } 692 }
693 } 693 }
694#else 694#else
695 KABC::AddressBook::Iterator it; 695 KABC::AddressBook::Iterator it;
696 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 696 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
697 if ( field ) { 697 if ( field ) {
698 if ( field->value( *it ).lower().startsWith( pattern ) ) { 698 if ( field->value( *it ).lower().startsWith( pattern ) ) {
699 mViewManager->setSelected( (*it).uid(), true ); 699 mViewManager->setSelected( (*it).uid(), true );
700 return; 700 return;
701 } 701 }
702 } else { 702 } else {
703 KABC::Field::List fieldList = mIncSearchWidget->fields(); 703 KABC::Field::List fieldList = mIncSearchWidget->fields();
704 KABC::Field::List::ConstIterator fieldIt; 704 KABC::Field::List::ConstIterator fieldIt;
705 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 705 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
706 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { 706 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
707 mViewManager->setSelected( (*it).uid(), true ); 707 mViewManager->setSelected( (*it).uid(), true );
708 return; 708 return;
709 } 709 }
710 } 710 }
711 } 711 }
712 } 712 }
713#endif 713#endif
714 } 714 }
715} 715}
716 716
717void KABCore::setModified() 717void KABCore::setModified()
718{ 718{
719 setModified( true ); 719 setModified( true );
720} 720}
721 721
722void KABCore::setModifiedWOrefresh() 722void KABCore::setModifiedWOrefresh()
723{ 723{
724 // qDebug("KABCore::setModifiedWOrefresh() "); 724 // qDebug("KABCore::setModifiedWOrefresh() ");
725 mModified = true; 725 mModified = true;
726 mActionSave->setEnabled( mModified ); 726 mActionSave->setEnabled( mModified );
727#ifdef DESKTOP_VERSION 727#ifdef DESKTOP_VERSION
728 mDetails->refreshView(); 728 mDetails->refreshView();
729#endif 729#endif
730 730
731} 731}
732void KABCore::setModified( bool modified ) 732void KABCore::setModified( bool modified )
733{ 733{
734 mModified = modified; 734 mModified = modified;
735 mActionSave->setEnabled( mModified ); 735 mActionSave->setEnabled( mModified );
736 736
737 if ( modified ) 737 if ( modified )
738 mJumpButtonBar->recreateButtons(); 738 mJumpButtonBar->recreateButtons();
739 739
740 mViewManager->refreshView(); 740 mViewManager->refreshView();
741 mDetails->refreshView(); 741 mDetails->refreshView();
742 742
743} 743}
744 744
745bool KABCore::modified() const 745bool KABCore::modified() const
746{ 746{
747 return mModified; 747 return mModified;
748} 748}
749 749
750void KABCore::contactModified( const KABC::Addressee &addr ) 750void KABCore::contactModified( const KABC::Addressee &addr )
751{ 751{
752 752
753 Command *command = 0; 753 Command *command = 0;
754 QString uid; 754 QString uid;
755 755
756 // check if it exists already 756 // check if it exists already
757 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 757 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
758 if ( origAddr.isEmpty() ) 758 if ( origAddr.isEmpty() )
759 command = new PwNewCommand( mAddressBook, addr ); 759 command = new PwNewCommand( mAddressBook, addr );
760 else { 760 else {
761 command = new PwEditCommand( mAddressBook, origAddr, addr ); 761 command = new PwEditCommand( mAddressBook, origAddr, addr );
762 uid = addr.uid(); 762 uid = addr.uid();
763 } 763 }
764 764
765 UndoStack::instance()->push( command ); 765 UndoStack::instance()->push( command );
766 RedoStack::instance()->clear(); 766 RedoStack::instance()->clear();
767 767
768 setModified( true ); 768 setModified( true );
769} 769}
770 770
771void KABCore::newContact() 771void KABCore::newContact()
772{ 772{
773 AddresseeEditorDialog *dialog = 0; 773
774 774
775 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 775 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
776 776
777 QPtrList<KRES::Resource> kresResources; 777 QPtrList<KRES::Resource> kresResources;
778 QPtrListIterator<KABC::Resource> it( kabcResources ); 778 QPtrListIterator<KABC::Resource> it( kabcResources );
779 KABC::Resource *resource; 779 KABC::Resource *resource;
780 while ( ( resource = it.current() ) != 0 ) { 780 while ( ( resource = it.current() ) != 0 ) {
781 ++it; 781 ++it;
782 if ( !resource->readOnly() ) { 782 if ( !resource->readOnly() ) {
783 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 783 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
784 if ( res ) 784 if ( res )
785 kresResources.append( res ); 785 kresResources.append( res );
786 } 786 }
787 } 787 }
788 788
789 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 789 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
790 resource = static_cast<KABC::Resource*>( res ); 790 resource = static_cast<KABC::Resource*>( res );
791 791
792 if ( resource ) { 792 if ( resource ) {
793 KABC::Addressee addr; 793 KABC::Addressee addr;
794 addr.setResource( resource ); 794 addr.setResource( resource );
795 mEditorDialog->setAddressee( addr ); 795 mEditorDialog->setAddressee( addr );
796 KApplication::execDialog ( mEditorDialog ); 796 KApplication::execDialog ( mEditorDialog );
797 797
798 } else 798 } else
799 return; 799 return;
800 800
801 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 801 // mEditorDict.insert( dialog->addressee().uid(), dialog );
802 802
803 dialog->show();
804 803
805} 804}
806 805
807void KABCore::addEmail( QString aStr ) 806void KABCore::addEmail( QString aStr )
808{ 807{
809#ifndef KAB_EMBEDDED 808#ifndef KAB_EMBEDDED
810 QString fullName, email; 809 QString fullName, email;
811 810
812 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 811 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
813 812
814 // Try to lookup the addressee matching the email address 813 // Try to lookup the addressee matching the email address
815 bool found = false; 814 bool found = false;
816 QStringList emailList; 815 QStringList emailList;
817 KABC::AddressBook::Iterator it; 816 KABC::AddressBook::Iterator it;
818 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 817 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
819 emailList = (*it).emails(); 818 emailList = (*it).emails();
820 if ( emailList.contains( email ) > 0 ) { 819 if ( emailList.contains( email ) > 0 ) {
821 found = true; 820 found = true;
822 (*it).setNameFromString( fullName ); 821 (*it).setNameFromString( fullName );
823 editContact( (*it).uid() ); 822 editContact( (*it).uid() );
824 } 823 }
825 } 824 }
826 825
827 if ( !found ) { 826 if ( !found ) {
828 KABC::Addressee addr; 827 KABC::Addressee addr;
829 addr.setNameFromString( fullName ); 828 addr.setNameFromString( fullName );
830 addr.insertEmail( email, true ); 829 addr.insertEmail( email, true );
831 830
832 mAddressBook->insertAddressee( addr ); 831 mAddressBook->insertAddressee( addr );
833 mViewManager->refreshView( addr.uid() ); 832 mViewManager->refreshView( addr.uid() );
834 editContact( addr.uid() ); 833 editContact( addr.uid() );
835 } 834 }
836#else //KAB_EMBEDDED 835#else //KAB_EMBEDDED
837 qDebug("KABCore::addEmail finsih method"); 836 qDebug("KABCore::addEmail finsih method");
838#endif //KAB_EMBEDDED 837#endif //KAB_EMBEDDED
839} 838}
840 839
841void KABCore::importVCard( const KURL &url, bool showPreview ) 840void KABCore::importVCard( const KURL &url, bool showPreview )
842{ 841{
843 mXXPortManager->importVCard( url, showPreview ); 842 mXXPortManager->importVCard( url, showPreview );
844} 843}
845 844
846void KABCore::importVCard( const QString &vCard, bool showPreview ) 845void KABCore::importVCard( const QString &vCard, bool showPreview )
847{ 846{
848 mXXPortManager->importVCard( vCard, showPreview ); 847 mXXPortManager->importVCard( vCard, showPreview );
849} 848}
850 849
851//US added a second method without defaultparameter 850//US added a second method without defaultparameter
852void KABCore::editContact2() { 851void KABCore::editContact2() {
853 editContact( QString::null ); 852 editContact( QString::null );
854} 853}
855 854
856void KABCore::editContact( const QString &uid ) 855void KABCore::editContact( const QString &uid )
857{ 856{
858 857
859 if ( mExtensionManager->isQuickEditVisible() ) 858 if ( mExtensionManager->isQuickEditVisible() )
860 return; 859 return;
861 860
862 // First, locate the contact entry 861 // First, locate the contact entry
863 QString localUID = uid; 862 QString localUID = uid;
864 if ( localUID.isNull() ) { 863 if ( localUID.isNull() ) {
865 QStringList uidList = mViewManager->selectedUids(); 864 QStringList uidList = mViewManager->selectedUids();
866 if ( uidList.count() > 0 ) 865 if ( uidList.count() > 0 )
867 localUID = *( uidList.at( 0 ) ); 866 localUID = *( uidList.at( 0 ) );
868 } 867 }
869 868
870 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 869 KABC::Addressee addr = mAddressBook->findByUid( localUID );
871 if ( !addr.isEmpty() ) { 870 if ( !addr.isEmpty() ) {
872 mEditorDialog->setAddressee( addr ); 871 mEditorDialog->setAddressee( addr );
873 KApplication::execDialog ( mEditorDialog ); 872 KApplication::execDialog ( mEditorDialog );
874 } 873 }
875} 874}
876 875
877void KABCore::save() 876void KABCore::save()
878{ 877{
879 if ( !mModified ) 878 if ( !mModified )
880 return; 879 return;
881 QString text = i18n( "There was an error while attempting to save\n the " 880 QString text = i18n( "There was an error while attempting to save\n the "
882 "address book. Please check that some \nother application is " 881 "address book. Please check that some \nother application is "
883 "not using it. " ); 882 "not using it. " );
884 statusMessage(i18n("Saving addressbook ... ")); 883 statusMessage(i18n("Saving addressbook ... "));
885#ifndef KAB_EMBEDDED 884#ifndef KAB_EMBEDDED
886 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 885 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
887 if ( !b || !b->save() ) { 886 if ( !b || !b->save() ) {
888 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 887 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
889 } 888 }
890#else //KAB_EMBEDDED 889#else //KAB_EMBEDDED
891 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 890 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
892 if ( !b || !b->save() ) { 891 if ( !b || !b->save() ) {
893 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 892 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
894 } 893 }
895#endif //KAB_EMBEDDED 894#endif //KAB_EMBEDDED
896 895
897 statusMessage(i18n("Addressbook saved!")); 896 statusMessage(i18n("Addressbook saved!"));
898 setModified( false ); 897 setModified( false );
899} 898}
900 899
901void KABCore::statusMessage(QString mess , int time ) 900void KABCore::statusMessage(QString mess , int time )
902{ 901{
903 //topLevelWidget()->setCaption( mess ); 902 //topLevelWidget()->setCaption( mess );
904 // pending setting timer to revome message 903 // pending setting timer to revome message
905} 904}
906void KABCore::undo() 905void KABCore::undo()
907{ 906{
908 UndoStack::instance()->undo(); 907 UndoStack::instance()->undo();
909 908
910 // Refresh the view 909 // Refresh the view
911 mViewManager->refreshView(); 910 mViewManager->refreshView();
912} 911}
913 912
914void KABCore::redo() 913void KABCore::redo()
915{ 914{
916 RedoStack::instance()->redo(); 915 RedoStack::instance()->redo();
917 916
918 // Refresh the view 917 // Refresh the view
919 mViewManager->refreshView(); 918 mViewManager->refreshView();
920} 919}
921 920
922void KABCore::setJumpButtonBarVisible( bool visible ) 921void KABCore::setJumpButtonBarVisible( bool visible )
923{ 922{
924 if ( visible ) 923 if ( visible )
925 mJumpButtonBar->show(); 924 mJumpButtonBar->show();
926 else 925 else
927 mJumpButtonBar->hide(); 926 mJumpButtonBar->hide();
928} 927}
929void KABCore::setDetailsToState() 928void KABCore::setDetailsToState()
930{ 929{
931 setDetailsVisible( mActionDetails->isChecked() ); 930 setDetailsVisible( mActionDetails->isChecked() );
932} 931}
933 932
934void KABCore::setDetailsVisible( bool visible ) 933void KABCore::setDetailsVisible( bool visible )
935{ 934{
936 if ( visible ) 935 if ( visible )
937 mDetails->show(); 936 mDetails->show();
938 else 937 else
939 mDetails->hide(); 938 mDetails->hide();
940} 939}
941 940
942void KABCore::extensionModified( const KABC::Addressee::List &list ) 941void KABCore::extensionModified( const KABC::Addressee::List &list )
943{ 942{
944 943
945 if ( list.count() != 0 ) { 944 if ( list.count() != 0 ) {
946 KABC::Addressee::List::ConstIterator it; 945 KABC::Addressee::List::ConstIterator it;
947 for ( it = list.begin(); it != list.end(); ++it ) 946 for ( it = list.begin(); it != list.end(); ++it )
948 mAddressBook->insertAddressee( *it ); 947 mAddressBook->insertAddressee( *it );
949 if ( list.count() > 1 ) 948 if ( list.count() > 1 )
950 setModified(); 949 setModified();
951 else 950 else
952 setModifiedWOrefresh(); 951 setModifiedWOrefresh();
953 } 952 }
954 if ( list.count() == 0 ) 953 if ( list.count() == 0 )
955 mViewManager->refreshView(); 954 mViewManager->refreshView();
956 else 955 else
957 mViewManager->refreshView( list[ 0 ].uid() ); 956 mViewManager->refreshView( list[ 0 ].uid() );
958 957
959 958
960 959
961} 960}
962 961
963QString KABCore::getNameByPhone( const QString &phone ) 962QString KABCore::getNameByPhone( const QString &phone )
964{ 963{
965#ifndef KAB_EMBEDDED 964#ifndef KAB_EMBEDDED
966 QRegExp r( "[/*/-/ ]" ); 965 QRegExp r( "[/*/-/ ]" );
967 QString localPhone( phone ); 966 QString localPhone( phone );
968 967
969 bool found = false; 968 bool found = false;
970 QString ownerName = ""; 969 QString ownerName = "";
971 KABC::AddressBook::Iterator iter; 970 KABC::AddressBook::Iterator iter;
972 KABC::PhoneNumber::List::Iterator phoneIter; 971 KABC::PhoneNumber::List::Iterator phoneIter;
973 KABC::PhoneNumber::List phoneList; 972 KABC::PhoneNumber::List phoneList;
974 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 973 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
975 phoneList = (*iter).phoneNumbers(); 974 phoneList = (*iter).phoneNumbers();
976 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 975 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
977 ++phoneIter) { 976 ++phoneIter) {
978 // Get rid of separator chars so just the numbers are compared. 977 // Get rid of separator chars so just the numbers are compared.
979 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 978 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
980 ownerName = (*iter).formattedName(); 979 ownerName = (*iter).formattedName();
981 found = true; 980 found = true;
982 } 981 }
983 } 982 }
984 } 983 }
985 984
986 return ownerName; 985 return ownerName;
987#else //KAB_EMBEDDED 986#else //KAB_EMBEDDED
988 qDebug("KABCore::getNameByPhone finsih method"); 987 qDebug("KABCore::getNameByPhone finsih method");
989 return ""; 988 return "";
990#endif //KAB_EMBEDDED 989#endif //KAB_EMBEDDED
991 990
992} 991}
993 992
994void KABCore::openConfigDialog() 993void KABCore::openConfigDialog()
995{ 994{
996 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 995 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
997 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 996 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
998 ConfigureDialog->addModule(kabcfg ); 997 ConfigureDialog->addModule(kabcfg );
999 connect( ConfigureDialog, SIGNAL( applyClicked() ), 998 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1000 this, SLOT( configurationChanged() ) ); 999 this, SLOT( configurationChanged() ) );
1001 connect( ConfigureDialog, SIGNAL( okClicked() ), 1000 connect( ConfigureDialog, SIGNAL( okClicked() ),
1002 this, SLOT( configurationChanged() ) ); 1001 this, SLOT( configurationChanged() ) );
1003 saveSettings(); 1002 saveSettings();
1004 ConfigureDialog->showMaximized(); 1003 ConfigureDialog->showMaximized();
1005 if ( ConfigureDialog->exec() ) 1004 if ( ConfigureDialog->exec() )
1006 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); 1005 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") );
1007 delete ConfigureDialog; 1006 delete ConfigureDialog;
1008} 1007}
1009 1008
1010void KABCore::openLDAPDialog() 1009void KABCore::openLDAPDialog()
1011{ 1010{
1012#ifndef KAB_EMBEDDED 1011#ifndef KAB_EMBEDDED
1013 if ( !mLdapSearchDialog ) { 1012 if ( !mLdapSearchDialog ) {
1014 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1013 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1015 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1014 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1016 SLOT( refreshView() ) ); 1015 SLOT( refreshView() ) );
1017 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1016 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1018 SLOT( setModified() ) ); 1017 SLOT( setModified() ) );
1019 } else 1018 } else
1020 mLdapSearchDialog->restoreSettings(); 1019 mLdapSearchDialog->restoreSettings();
1021 1020
1022 if ( mLdapSearchDialog->isOK() ) 1021 if ( mLdapSearchDialog->isOK() )
1023 mLdapSearchDialog->exec(); 1022 mLdapSearchDialog->exec();
1024#else //KAB_EMBEDDED 1023#else //KAB_EMBEDDED
1025 qDebug("KABCore::openLDAPDialog() finsih method"); 1024 qDebug("KABCore::openLDAPDialog() finsih method");
1026#endif //KAB_EMBEDDED 1025#endif //KAB_EMBEDDED
1027} 1026}
1028 1027
1029void KABCore::print() 1028void KABCore::print()
1030{ 1029{
1031#ifndef KAB_EMBEDDED 1030#ifndef KAB_EMBEDDED
1032 KPrinter printer; 1031 KPrinter printer;
1033 if ( !printer.setup( this ) ) 1032 if ( !printer.setup( this ) )
1034 return; 1033 return;
1035 1034
1036 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1035 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1037 mViewManager->selectedUids(), this ); 1036 mViewManager->selectedUids(), this );
1038 1037
1039 wizard.exec(); 1038 wizard.exec();
1040#else //KAB_EMBEDDED 1039#else //KAB_EMBEDDED
1041 qDebug("KABCore::print() finsih method"); 1040 qDebug("KABCore::print() finsih method");
1042#endif //KAB_EMBEDDED 1041#endif //KAB_EMBEDDED
1043 1042
1044} 1043}
1045 1044
1046 1045
1047void KABCore::addGUIClient( KXMLGUIClient *client ) 1046void KABCore::addGUIClient( KXMLGUIClient *client )
1048{ 1047{
1049 if ( mGUIClient ) 1048 if ( mGUIClient )
1050 mGUIClient->insertChildClient( client ); 1049 mGUIClient->insertChildClient( client );
1051 else 1050 else
1052 KMessageBox::error( this, "no KXMLGUICLient"); 1051 KMessageBox::error( this, "no KXMLGUICLient");
1053} 1052}
1054 1053
1055 1054
1056void KABCore::configurationChanged() 1055void KABCore::configurationChanged()
1057{ 1056{
1058 mExtensionManager->reconfigure(); 1057 mExtensionManager->reconfigure();
1059} 1058}
1060 1059
1061void KABCore::addressBookChanged() 1060void KABCore::addressBookChanged()
1062{ 1061{
1063#ifndef KAB_EMBEDDED 1062#ifndef KAB_EMBEDDED
1064 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1063 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1065 while ( it.current() ) { 1064 while ( it.current() ) {
1066 if ( it.current()->dirty() ) { 1065 if ( it.current()->dirty() ) {
1067 QString text = i18n( "Data has been changed externally. Unsaved " 1066 QString text = i18n( "Data has been changed externally. Unsaved "
1068 "changes will be lost." ); 1067 "changes will be lost." );
1069 KMessageBox::information( this, text ); 1068 KMessageBox::information( this, text );
1070 } 1069 }
1071 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1070 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1072 ++it; 1071 ++it;
1073 } 1072 }
1074 1073
1075 mViewManager->refreshView(); 1074 mViewManager->refreshView();
1076#else //KAB_EMBEDDED 1075#else //KAB_EMBEDDED
1077 qDebug("KABCore::addressBookChanged() finsih method"); 1076 qDebug("KABCore::addressBookChanged() finsih method");
1078#endif //KAB_EMBEDDED 1077#endif //KAB_EMBEDDED
1079} 1078}
1080 1079
1081AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1080AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1082 const char *name ) 1081 const char *name )
1083{ 1082{
1084 1083
1085 if ( mEditorDialog == 0 ) { 1084 if ( mEditorDialog == 0 ) {
1086 mEditorDialog = new AddresseeEditorDialog( this, parent, 1085 mEditorDialog = new AddresseeEditorDialog( this, parent,
1087 name ? name : "editorDialog" ); 1086 name ? name : "editorDialog" );
1088 1087
1089 1088
1090 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1089 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1091 SLOT( contactModified( const KABC::Addressee& ) ) ); 1090 SLOT( contactModified( const KABC::Addressee& ) ) );
1092 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1091 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1093 // SLOT( slotEditorDestroyed( const QString& ) ) ); 1092 // SLOT( slotEditorDestroyed( const QString& ) ) );
1094 } 1093 }
1095 1094
1096 return mEditorDialog; 1095 return mEditorDialog;
1097} 1096}
1098 1097
1099void KABCore::slotEditorDestroyed( const QString &uid ) 1098void KABCore::slotEditorDestroyed( const QString &uid )
1100{ 1099{
1101 qDebug("KABCore::slotEditorDestroyed called. maybe a problem! "); 1100 qDebug("KABCore::slotEditorDestroyed called. maybe a problem! ");
1102 //mEditorDict.remove( uid ); 1101 //mEditorDict.remove( uid );
1103} 1102}
1104 1103
1105void KABCore::initGUI() 1104void KABCore::initGUI()
1106{ 1105{
1107#ifndef KAB_EMBEDDED 1106#ifndef KAB_EMBEDDED
1108 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1107 QHBoxLayout *topLayout = new QHBoxLayout( this );
1109 topLayout->setSpacing( KDialogBase::spacingHint() ); 1108 topLayout->setSpacing( KDialogBase::spacingHint() );
1110 1109
1111 mExtensionBarSplitter = new QSplitter( this ); 1110 mExtensionBarSplitter = new QSplitter( this );
1112 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1111 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1113 1112
1114 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1113 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1115 1114
1116 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1115 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1117 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1116 mIncSearchWidget = new IncSearchWidget( viewSpace );
1118 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1117 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1119 SLOT( incrementalSearch( const QString& ) ) ); 1118 SLOT( incrementalSearch( const QString& ) ) );
1120 1119
1121 mViewManager = new ViewManager( this, viewSpace ); 1120 mViewManager = new ViewManager( this, viewSpace );
1122 viewSpace->setStretchFactor( mViewManager, 1 ); 1121 viewSpace->setStretchFactor( mViewManager, 1 );
1123 1122
1124 mDetails = new ViewContainer( mDetailsSplitter ); 1123 mDetails = new ViewContainer( mDetailsSplitter );
1125 1124
1126 mJumpButtonBar = new JumpButtonBar( this, this ); 1125 mJumpButtonBar = new JumpButtonBar( this, this );
1127 1126
1128 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1127 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1129 1128
1130 topLayout->addWidget( mExtensionBarSplitter ); 1129 topLayout->addWidget( mExtensionBarSplitter );
1131 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1130 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1132 topLayout->addWidget( mJumpButtonBar ); 1131 topLayout->addWidget( mJumpButtonBar );
1133 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1132 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1134 1133
1135 mXXPortManager = new XXPortManager( this, this ); 1134 mXXPortManager = new XXPortManager( this, this );
1136 1135
1137#else //KAB_EMBEDDED 1136#else //KAB_EMBEDDED
1138 //US initialize viewMenu before settingup viewmanager. 1137 //US initialize viewMenu before settingup viewmanager.
1139 // Viewmanager needs this menu to plugin submenues. 1138 // Viewmanager needs this menu to plugin submenues.
1140 viewMenu = new QPopupMenu( this ); 1139 viewMenu = new QPopupMenu( this );
1141 settingsMenu = new QPopupMenu( this ); 1140 settingsMenu = new QPopupMenu( this );
1142 //filterMenu = new QPopupMenu( this ); 1141 //filterMenu = new QPopupMenu( this );
1143 ImportMenu = new QPopupMenu( this ); 1142 ImportMenu = new QPopupMenu( this );
1144 ExportMenu = new QPopupMenu( this ); 1143 ExportMenu = new QPopupMenu( this );
1145 1144
1146 1145
1147//US since we have no splitter for the embedded system, setup 1146//US since we have no splitter for the embedded system, setup
1148// a layout with two frames. One left and one right. 1147// a layout with two frames. One left and one right.
1149 1148
1150 QBoxLayout *topLayout; 1149 QBoxLayout *topLayout;
1151 1150
1152 // = new QHBoxLayout( this ); 1151 // = new QHBoxLayout( this );
1153// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1152// QBoxLayout *topLayout = (QBoxLayout*)layout();
1154 1153
1155// QWidget *mainBox = new QWidget( this ); 1154// QWidget *mainBox = new QWidget( this );
1156// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1155// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1157 1156
1158#ifdef DESKTOP_VERSION 1157#ifdef DESKTOP_VERSION
1159 topLayout = new QHBoxLayout( this ); 1158 topLayout = new QHBoxLayout( this );
1160 1159
1161 1160
1162 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1161 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1163 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1162 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1164 1163
1165 topLayout->addWidget(mMiniSplitter ); 1164 topLayout->addWidget(mMiniSplitter );
1166 1165
1167 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1166 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1168 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1167 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1169 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1168 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1170 mDetails = new ViewContainer( mMiniSplitter ); 1169 mDetails = new ViewContainer( mMiniSplitter );
1171 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1170 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1172#else 1171#else
1173 if ( QApplication::desktop()->width() > 480 ) { 1172 if ( QApplication::desktop()->width() > 480 ) {
1174 topLayout = new QHBoxLayout( this ); 1173 topLayout = new QHBoxLayout( this );
1175 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1174 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1176 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1175 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1177 } else { 1176 } else {
1178 1177
1179 topLayout = new QHBoxLayout( this ); 1178 topLayout = new QHBoxLayout( this );
1180 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1179 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1181 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1180 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1182 } 1181 }
1183 1182
1184 topLayout->addWidget(mMiniSplitter ); 1183 topLayout->addWidget(mMiniSplitter );
1185 mViewManager = new ViewManager( this, mMiniSplitter ); 1184 mViewManager = new ViewManager( this, mMiniSplitter );
1186 mDetails = new ViewContainer( mMiniSplitter ); 1185 mDetails = new ViewContainer( mMiniSplitter );
1187 1186