author | eilers <eilers> | 2003-05-09 13:41:06 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-05-09 13:41:06 (UTC) |
commit | ddadf9f70cbcd7c6b8addcc8c1f6ede0283f765d (patch) (unidiff) | |
tree | 3471c2ecec1ec034fb2855da230f05fef5e7b3b1 | |
parent | 98196030da571da62ecb2fdd67e77a1e941d175a (diff) | |
download | opie-ddadf9f70cbcd7c6b8addcc8c1f6ede0283f765d.zip opie-ddadf9f70cbcd7c6b8addcc8c1f6ede0283f765d.tar.gz opie-ddadf9f70cbcd7c6b8addcc8c1f6ede0283f765d.tar.bz2 |
No it jumps into the front if show(int) is used.. Thanks tille !
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 975911e..25c6f3a 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -517,384 +517,385 @@ void AddressbookWindow::slotFind() | |||
517 | } | 517 | } |
518 | 518 | ||
519 | void AddressbookWindow::slotViewBack() | 519 | void AddressbookWindow::slotViewBack() |
520 | { | 520 | { |
521 | // :SX showList(); | 521 | // :SX showList(); |
522 | } | 522 | } |
523 | 523 | ||
524 | void AddressbookWindow::slotViewEdit() | 524 | void AddressbookWindow::slotViewEdit() |
525 | { | 525 | { |
526 | if(!syncing) { | 526 | if(!syncing) { |
527 | if (actionPersonal->isOn()) { | 527 | if (actionPersonal->isOn()) { |
528 | editPersonal(); | 528 | editPersonal(); |
529 | } else { | 529 | } else { |
530 | editEntry( EditEntry ); | 530 | editEntry( EditEntry ); |
531 | } | 531 | } |
532 | } else { | 532 | } else { |
533 | QMessageBox::warning( this, tr("Contacts"), | 533 | QMessageBox::warning( this, tr("Contacts"), |
534 | tr("Can not edit data, currently syncing") ); | 534 | tr("Can not edit data, currently syncing") ); |
535 | } | 535 | } |
536 | } | 536 | } |
537 | 537 | ||
538 | 538 | ||
539 | 539 | ||
540 | void AddressbookWindow::writeMail() | 540 | void AddressbookWindow::writeMail() |
541 | { | 541 | { |
542 | OContact c = m_abView -> currentEntry(); | 542 | OContact c = m_abView -> currentEntry(); |
543 | QString name = c.fileAs(); | 543 | QString name = c.fileAs(); |
544 | QString email = c.defaultEmail(); | 544 | QString email = c.defaultEmail(); |
545 | 545 | ||
546 | // I prefer the OPIE-Environment variable before the | 546 | // I prefer the OPIE-Environment variable before the |
547 | // QPE-one.. | 547 | // QPE-one.. |
548 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); | 548 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); |
549 | if ( basepath.isEmpty() ) | 549 | if ( basepath.isEmpty() ) |
550 | basepath = QString::fromLatin1( getenv("QPEDIR") ); | 550 | basepath = QString::fromLatin1( getenv("QPEDIR") ); |
551 | 551 | ||
552 | // Try to access the preferred. If not possible, try to | 552 | // Try to access the preferred. If not possible, try to |
553 | // switch to the other one.. | 553 | // switch to the other one.. |
554 | if ( m_config.useQtMail() ){ | 554 | if ( m_config.useQtMail() ){ |
555 | qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); | 555 | qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); |
556 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ | 556 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ |
557 | qWarning ("QCop"); | 557 | qWarning ("QCop"); |
558 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); | 558 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); |
559 | e << name << email; | 559 | e << name << email; |
560 | return; | 560 | return; |
561 | } else | 561 | } else |
562 | m_config.setUseOpieMail( true ); | 562 | m_config.setUseOpieMail( true ); |
563 | } | 563 | } |
564 | if ( m_config.useOpieMail() ){ | 564 | if ( m_config.useOpieMail() ){ |
565 | qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); | 565 | qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); |
566 | if ( QFile::exists( basepath + "/bin/mail" ) ){ | 566 | if ( QFile::exists( basepath + "/bin/mail" ) ){ |
567 | qWarning ("QCop"); | 567 | qWarning ("QCop"); |
568 | QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); | 568 | QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); |
569 | e << name << email; | 569 | e << name << email; |
570 | return; | 570 | return; |
571 | } else | 571 | } else |
572 | m_config.setUseQtMail( true ); | 572 | m_config.setUseQtMail( true ); |
573 | } | 573 | } |
574 | 574 | ||
575 | } | 575 | } |
576 | 576 | ||
577 | static const char * beamfile = "/tmp/obex/contact.vcf"; | 577 | static const char * beamfile = "/tmp/obex/contact.vcf"; |
578 | 578 | ||
579 | void AddressbookWindow::slotBeam() | 579 | void AddressbookWindow::slotBeam() |
580 | { | 580 | { |
581 | QString beamFilename; | 581 | QString beamFilename; |
582 | OContact c; | 582 | OContact c; |
583 | if ( actionPersonal->isOn() ) { | 583 | if ( actionPersonal->isOn() ) { |
584 | beamFilename = addressbookPersonalVCardName(); | 584 | beamFilename = addressbookPersonalVCardName(); |
585 | if ( !QFile::exists( beamFilename ) ) | 585 | if ( !QFile::exists( beamFilename ) ) |
586 | return; // can't beam a non-existent file | 586 | return; // can't beam a non-existent file |
587 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 587 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
588 | beamFilename ); | 588 | beamFilename ); |
589 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 589 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
590 | OContactAccess::List allList = access->allRecords(); | 590 | OContactAccess::List allList = access->allRecords(); |
591 | OContactAccess::List::Iterator it = allList.begin(); // Just take first | 591 | OContactAccess::List::Iterator it = allList.begin(); // Just take first |
592 | c = *it; | 592 | c = *it; |
593 | 593 | ||
594 | delete access; | 594 | delete access; |
595 | } else { | 595 | } else { |
596 | unlink( beamfile ); // delete if exists | 596 | unlink( beamfile ); // delete if exists |
597 | mkdir("/tmp/obex/", 0755); | 597 | mkdir("/tmp/obex/", 0755); |
598 | c = m_abView -> currentEntry(); | 598 | c = m_abView -> currentEntry(); |
599 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 599 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
600 | beamfile ); | 600 | beamfile ); |
601 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 601 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
602 | access->add( c ); | 602 | access->add( c ); |
603 | access->save(); | 603 | access->save(); |
604 | delete access; | 604 | delete access; |
605 | 605 | ||
606 | beamFilename = beamfile; | 606 | beamFilename = beamfile; |
607 | } | 607 | } |
608 | 608 | ||
609 | qWarning("Beaming: %s", beamFilename.latin1() ); | 609 | qWarning("Beaming: %s", beamFilename.latin1() ); |
610 | 610 | ||
611 | Ir *ir = new Ir( this ); | 611 | Ir *ir = new Ir( this ); |
612 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 612 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
613 | QString description = c.fullName(); | 613 | QString description = c.fullName(); |
614 | ir->send( beamFilename, description, "text/x-vCard" ); | 614 | ir->send( beamFilename, description, "text/x-vCard" ); |
615 | } | 615 | } |
616 | 616 | ||
617 | void AddressbookWindow::beamDone( Ir *ir ) | 617 | void AddressbookWindow::beamDone( Ir *ir ) |
618 | { | 618 | { |
619 | 619 | ||
620 | delete ir; | 620 | delete ir; |
621 | unlink( beamfile ); | 621 | unlink( beamfile ); |
622 | } | 622 | } |
623 | 623 | ||
624 | 624 | ||
625 | static void parseName( const QString& name, QString *first, QString *middle, | 625 | static void parseName( const QString& name, QString *first, QString *middle, |
626 | QString * last ) | 626 | QString * last ) |
627 | { | 627 | { |
628 | 628 | ||
629 | int comma = name.find ( "," ); | 629 | int comma = name.find ( "," ); |
630 | QString rest; | 630 | QString rest; |
631 | if ( comma > 0 ) { | 631 | if ( comma > 0 ) { |
632 | *last = name.left( comma ); | 632 | *last = name.left( comma ); |
633 | comma++; | 633 | comma++; |
634 | while ( comma < int(name.length()) && name[comma] == ' ' ) | 634 | while ( comma < int(name.length()) && name[comma] == ' ' ) |
635 | comma++; | 635 | comma++; |
636 | rest = name.mid( comma ); | 636 | rest = name.mid( comma ); |
637 | } else { | 637 | } else { |
638 | int space = name.findRev( ' ' ); | 638 | int space = name.findRev( ' ' ); |
639 | *last = name.mid( space+1 ); | 639 | *last = name.mid( space+1 ); |
640 | rest = name.left( space ); | 640 | rest = name.left( space ); |
641 | } | 641 | } |
642 | int space = rest.find( ' ' ); | 642 | int space = rest.find( ' ' ); |
643 | if ( space <= 0 ) { | 643 | if ( space <= 0 ) { |
644 | *first = rest; | 644 | *first = rest; |
645 | } else { | 645 | } else { |
646 | *first = rest.left( space ); | 646 | *first = rest.left( space ); |
647 | *middle = rest.mid( space+1 ); | 647 | *middle = rest.mid( space+1 ); |
648 | } | 648 | } |
649 | 649 | ||
650 | } | 650 | } |
651 | 651 | ||
652 | 652 | ||
653 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | 653 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) |
654 | { | 654 | { |
655 | qWarning("Receiving QCop-Call with message %s", QString( msg ).latin1() ); | 655 | qWarning("Receiving QCop-Call with message %s", QString( msg ).latin1() ); |
656 | 656 | ||
657 | if (msg == "editPersonal()") { | 657 | if (msg == "editPersonal()") { |
658 | editPersonal(); | 658 | editPersonal(); |
659 | } else if (msg == "editPersonalAndClose()") { | 659 | } else if (msg == "editPersonalAndClose()") { |
660 | editPersonal(); | 660 | editPersonal(); |
661 | close(); | 661 | close(); |
662 | } else if ( msg == "addContact(QString,QString)" ) { | 662 | } else if ( msg == "addContact(QString,QString)" ) { |
663 | QDataStream stream(data,IO_ReadOnly); | 663 | QDataStream stream(data,IO_ReadOnly); |
664 | QString name, email; | 664 | QString name, email; |
665 | stream >> name >> email; | 665 | stream >> name >> email; |
666 | 666 | ||
667 | OContact cnt; | 667 | OContact cnt; |
668 | QString fn, mn, ln; | 668 | QString fn, mn, ln; |
669 | parseName( name, &fn, &mn, &ln ); | 669 | parseName( name, &fn, &mn, &ln ); |
670 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); | 670 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); |
671 | cnt.setFirstName( fn ); | 671 | cnt.setFirstName( fn ); |
672 | cnt.setMiddleName( mn ); | 672 | cnt.setMiddleName( mn ); |
673 | cnt.setLastName( ln ); | 673 | cnt.setLastName( ln ); |
674 | cnt.insertEmails( email ); | 674 | cnt.insertEmails( email ); |
675 | cnt.setDefaultEmail( email ); | 675 | cnt.setDefaultEmail( email ); |
676 | cnt.setFileAs(); | 676 | cnt.setFileAs(); |
677 | 677 | ||
678 | m_abView -> addEntry( cnt ); | 678 | m_abView -> addEntry( cnt ); |
679 | 679 | ||
680 | // :SXm_abView()->init( cnt ); | 680 | // :SXm_abView()->init( cnt ); |
681 | editEntry( EditEntry ); | 681 | editEntry( EditEntry ); |
682 | } else if ( msg == "beamBusinessCard()" ) { | 682 | } else if ( msg == "beamBusinessCard()" ) { |
683 | QString beamFilename = addressbookPersonalVCardName(); | 683 | QString beamFilename = addressbookPersonalVCardName(); |
684 | if ( !QFile::exists( beamFilename ) ) | 684 | if ( !QFile::exists( beamFilename ) ) |
685 | return; // can't beam a non-existent file | 685 | return; // can't beam a non-existent file |
686 | 686 | ||
687 | Ir *ir = new Ir( this ); | 687 | Ir *ir = new Ir( this ); |
688 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 688 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
689 | QString description = "mycard.vcf"; | 689 | QString description = "mycard.vcf"; |
690 | ir->send( beamFilename, description, "text/x-vCard" ); | 690 | ir->send( beamFilename, description, "text/x-vCard" ); |
691 | } else if ( msg == "show(int)" ) { | 691 | } else if ( msg == "show(int)" ) { |
692 | QDataStream stream(data,IO_ReadOnly); | 692 | QDataStream stream(data,IO_ReadOnly); |
693 | int uid; | 693 | int uid; |
694 | stream >> uid; | 694 | stream >> uid; |
695 | 695 | ||
696 | qWarning( "Showing uid: %d" , uid ); | 696 | qWarning( "Showing uid: %d" , uid ); |
697 | 697 | ||
698 | // Deactivate Personal View.. | 698 | // Deactivate Personal View.. |
699 | if ( actionPersonal->isOn() ){ | 699 | if ( actionPersonal->isOn() ){ |
700 | actionPersonal->setOn( false ); | 700 | actionPersonal->setOn( false ); |
701 | slotPersonalView(); | 701 | slotPersonalView(); |
702 | } | 702 | } |
703 | 703 | ||
704 | // Reset category and show as card.. | 704 | // Reset category and show as card.. |
705 | m_abView -> setShowByCategory( QString::null ); | 705 | m_abView -> setShowByCategory( QString::null ); |
706 | m_abView -> setCurrentUid( uid ); | 706 | m_abView -> setCurrentUid( uid ); |
707 | slotViewSwitched ( AbView::CardView ); | 707 | slotViewSwitched ( AbView::CardView ); |
708 | 708 | ||
709 | showMaximized(); | ||
709 | qApp->exec(); | 710 | qApp->exec(); |
710 | 711 | ||
711 | } else if ( msg == "edit(int)" ) { | 712 | } else if ( msg == "edit(int)" ) { |
712 | QDataStream stream(data,IO_ReadOnly); | 713 | QDataStream stream(data,IO_ReadOnly); |
713 | int uid; | 714 | int uid; |
714 | stream >> uid; | 715 | stream >> uid; |
715 | 716 | ||
716 | // Deactivate Personal View.. | 717 | // Deactivate Personal View.. |
717 | if ( actionPersonal->isOn() ){ | 718 | if ( actionPersonal->isOn() ){ |
718 | actionPersonal->setOn( false ); | 719 | actionPersonal->setOn( false ); |
719 | slotPersonalView(); | 720 | slotPersonalView(); |
720 | } | 721 | } |
721 | 722 | ||
722 | // Reset category and edit.. | 723 | // Reset category and edit.. |
723 | m_abView -> setShowByCategory( QString::null ); | 724 | m_abView -> setShowByCategory( QString::null ); |
724 | m_abView -> setCurrentUid( uid ); | 725 | m_abView -> setCurrentUid( uid ); |
725 | slotViewEdit(); | 726 | slotViewEdit(); |
726 | } | 727 | } |
727 | 728 | ||
728 | } | 729 | } |
729 | 730 | ||
730 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 731 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
731 | { | 732 | { |
732 | OContact entry; | 733 | OContact entry; |
733 | if ( !abEditor ) { | 734 | if ( !abEditor ) { |
734 | abEditor = new ContactEditor( entry, this, "editor" ); | 735 | abEditor = new ContactEditor( entry, this, "editor" ); |
735 | } | 736 | } |
736 | if ( entryMode == EditEntry ) | 737 | if ( entryMode == EditEntry ) |
737 | abEditor->setEntry( m_abView -> currentEntry() ); | 738 | abEditor->setEntry( m_abView -> currentEntry() ); |
738 | else if ( entryMode == NewEntry ) | 739 | else if ( entryMode == NewEntry ) |
739 | abEditor->setEntry( entry ); | 740 | abEditor->setEntry( entry ); |
740 | // other things may change the caption. | 741 | // other things may change the caption. |
741 | abEditor->setCaption( tr("Edit Address") ); | 742 | abEditor->setCaption( tr("Edit Address") ); |
742 | 743 | ||
743 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 744 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
744 | abEditor->showMaximized(); | 745 | abEditor->showMaximized(); |
745 | #endif | 746 | #endif |
746 | // fix the foxus... | 747 | // fix the foxus... |
747 | abEditor->setNameFocus(); | 748 | abEditor->setNameFocus(); |
748 | if ( abEditor->exec() ) { | 749 | if ( abEditor->exec() ) { |
749 | setFocus(); | 750 | setFocus(); |
750 | if ( entryMode == NewEntry ) { | 751 | if ( entryMode == NewEntry ) { |
751 | OContact insertEntry = abEditor->entry(); | 752 | OContact insertEntry = abEditor->entry(); |
752 | insertEntry.assignUid(); | 753 | insertEntry.assignUid(); |
753 | m_abView -> addEntry( insertEntry ); | 754 | m_abView -> addEntry( insertEntry ); |
754 | } else { | 755 | } else { |
755 | OContact replEntry = abEditor->entry(); | 756 | OContact replEntry = abEditor->entry(); |
756 | 757 | ||
757 | if ( !replEntry.isValidUid() ) | 758 | if ( !replEntry.isValidUid() ) |
758 | replEntry.assignUid(); | 759 | replEntry.assignUid(); |
759 | 760 | ||
760 | m_abView -> replaceEntry( replEntry ); | 761 | m_abView -> replaceEntry( replEntry ); |
761 | } | 762 | } |
762 | } | 763 | } |
763 | // populateCategories(); | 764 | // populateCategories(); |
764 | 765 | ||
765 | } | 766 | } |
766 | 767 | ||
767 | void AddressbookWindow::editPersonal() | 768 | void AddressbookWindow::editPersonal() |
768 | { | 769 | { |
769 | OContact entry; | 770 | OContact entry; |
770 | 771 | ||
771 | // Switch to personal view if not selected | 772 | // Switch to personal view if not selected |
772 | // but take care of the menu, too | 773 | // but take care of the menu, too |
773 | if ( ! actionPersonal->isOn() ){ | 774 | if ( ! actionPersonal->isOn() ){ |
774 | qWarning("*** ++++"); | 775 | qWarning("*** ++++"); |
775 | actionPersonal->setOn( true ); | 776 | actionPersonal->setOn( true ); |
776 | slotPersonalView(); | 777 | slotPersonalView(); |
777 | } | 778 | } |
778 | 779 | ||
779 | if ( !abEditor ) { | 780 | if ( !abEditor ) { |
780 | abEditor = new ContactEditor( entry, this, "editor" ); | 781 | abEditor = new ContactEditor( entry, this, "editor" ); |
781 | } | 782 | } |
782 | 783 | ||
783 | abEditor->setCaption(tr("Edit My Personal Details")); | 784 | abEditor->setCaption(tr("Edit My Personal Details")); |
784 | abEditor->setPersonalView( true ); | 785 | abEditor->setPersonalView( true ); |
785 | editEntry( EditEntry ); | 786 | editEntry( EditEntry ); |
786 | abEditor->setPersonalView( false ); | 787 | abEditor->setPersonalView( false ); |
787 | 788 | ||
788 | } | 789 | } |
789 | 790 | ||
790 | 791 | ||
791 | void AddressbookWindow::slotPersonalView() | 792 | void AddressbookWindow::slotPersonalView() |
792 | { | 793 | { |
793 | qWarning("slotPersonalView()"); | 794 | qWarning("slotPersonalView()"); |
794 | if (!actionPersonal->isOn()) { | 795 | if (!actionPersonal->isOn()) { |
795 | // we just turned it off | 796 | // we just turned it off |
796 | qWarning("slotPersonalView()-> OFF"); | 797 | qWarning("slotPersonalView()-> OFF"); |
797 | setCaption( tr("Contacts") ); | 798 | setCaption( tr("Contacts") ); |
798 | actionNew->setEnabled(TRUE); | 799 | actionNew->setEnabled(TRUE); |
799 | actionTrash->setEnabled(TRUE); | 800 | actionTrash->setEnabled(TRUE); |
800 | actionFind->setEnabled(TRUE); | 801 | actionFind->setEnabled(TRUE); |
801 | actionMail->setEnabled(TRUE); | 802 | actionMail->setEnabled(TRUE); |
802 | // slotUpdateToolbar(); | 803 | // slotUpdateToolbar(); |
803 | 804 | ||
804 | m_abView->showPersonal( false ); | 805 | m_abView->showPersonal( false ); |
805 | 806 | ||
806 | return; | 807 | return; |
807 | } | 808 | } |
808 | 809 | ||
809 | qWarning("slotPersonalView()-> ON"); | 810 | qWarning("slotPersonalView()-> ON"); |
810 | // XXX need to disable some QActions. | 811 | // XXX need to disable some QActions. |
811 | actionNew->setEnabled(FALSE); | 812 | actionNew->setEnabled(FALSE); |
812 | actionTrash->setEnabled(FALSE); | 813 | actionTrash->setEnabled(FALSE); |
813 | actionFind->setEnabled(FALSE); | 814 | actionFind->setEnabled(FALSE); |
814 | actionMail->setEnabled(FALSE); | 815 | actionMail->setEnabled(FALSE); |
815 | 816 | ||
816 | setCaption( tr("Contacts - My Personal Details") ); | 817 | setCaption( tr("Contacts - My Personal Details") ); |
817 | 818 | ||
818 | m_abView->showPersonal( true ); | 819 | m_abView->showPersonal( true ); |
819 | 820 | ||
820 | } | 821 | } |
821 | 822 | ||
822 | 823 | ||
823 | void AddressbookWindow::listIsEmpty( bool empty ) | 824 | void AddressbookWindow::listIsEmpty( bool empty ) |
824 | { | 825 | { |
825 | if ( !empty ) { | 826 | if ( !empty ) { |
826 | deleteButton->setEnabled( TRUE ); | 827 | deleteButton->setEnabled( TRUE ); |
827 | } | 828 | } |
828 | } | 829 | } |
829 | 830 | ||
830 | void AddressbookWindow::reload() | 831 | void AddressbookWindow::reload() |
831 | { | 832 | { |
832 | syncing = FALSE; | 833 | syncing = FALSE; |
833 | m_abView->clear(); | 834 | m_abView->clear(); |
834 | m_abView->reload(); | 835 | m_abView->reload(); |
835 | } | 836 | } |
836 | 837 | ||
837 | void AddressbookWindow::flush() | 838 | void AddressbookWindow::flush() |
838 | { | 839 | { |
839 | syncing = TRUE; | 840 | syncing = TRUE; |
840 | m_abView->save(); | 841 | m_abView->save(); |
841 | } | 842 | } |
842 | 843 | ||
843 | 844 | ||
844 | void AddressbookWindow::closeEvent( QCloseEvent *e ) | 845 | void AddressbookWindow::closeEvent( QCloseEvent *e ) |
845 | { | 846 | { |
846 | if(active_view == AbView::CardView){ | 847 | if(active_view == AbView::CardView){ |
847 | slotViewSwitched( AbView::TableView ); | 848 | slotViewSwitched( AbView::TableView ); |
848 | e->ignore(); | 849 | e->ignore(); |
849 | return; | 850 | return; |
850 | } | 851 | } |
851 | if(syncing) { | 852 | if(syncing) { |
852 | /* shouldn't we save, I hear you say? well its already been set | 853 | /* shouldn't we save, I hear you say? well its already been set |
853 | so that an edit can not occur during a sync, and we flushed | 854 | so that an edit can not occur during a sync, and we flushed |
854 | at the start of the sync, so there is no need to save | 855 | at the start of the sync, so there is no need to save |
855 | Saving however itself would cause problems. */ | 856 | Saving however itself would cause problems. */ |
856 | e->accept(); | 857 | e->accept(); |
857 | return; | 858 | return; |
858 | } | 859 | } |
859 | //################## shouldn't always save | 860 | //################## shouldn't always save |
860 | // True, but the database handles this automatically ! (se) | 861 | // True, but the database handles this automatically ! (se) |
861 | if ( save() ) | 862 | if ( save() ) |
862 | e->accept(); | 863 | e->accept(); |
863 | else | 864 | else |
864 | e->ignore(); | 865 | e->ignore(); |
865 | } | 866 | } |
866 | 867 | ||
867 | /* | 868 | /* |
868 | Returns TRUE if it is OK to exit | 869 | Returns TRUE if it is OK to exit |
869 | */ | 870 | */ |
870 | 871 | ||
871 | bool AddressbookWindow::save() | 872 | bool AddressbookWindow::save() |
872 | { | 873 | { |
873 | if ( !m_abView->save() ) { | 874 | if ( !m_abView->save() ) { |
874 | if ( QMessageBox::critical( 0, tr( "Out of space" ), | 875 | if ( QMessageBox::critical( 0, tr( "Out of space" ), |
875 | tr("Unable to save information.\n" | 876 | tr("Unable to save information.\n" |
876 | "Free up some space\n" | 877 | "Free up some space\n" |
877 | "and try again.\n" | 878 | "and try again.\n" |
878 | "\nQuit anyway?"), | 879 | "\nQuit anyway?"), |
879 | QMessageBox::Yes|QMessageBox::Escape, | 880 | QMessageBox::Yes|QMessageBox::Escape, |
880 | QMessageBox::No|QMessageBox::Default ) | 881 | QMessageBox::No|QMessageBox::Default ) |
881 | != QMessageBox::No ) | 882 | != QMessageBox::No ) |
882 | return TRUE; | 883 | return TRUE; |
883 | else | 884 | else |
884 | return FALSE; | 885 | return FALSE; |
885 | } | 886 | } |
886 | return TRUE; | 887 | return TRUE; |
887 | } | 888 | } |
888 | 889 | ||
889 | #ifdef __DEBUG_RELEASE | 890 | #ifdef __DEBUG_RELEASE |
890 | void AddressbookWindow::slotSave() | 891 | void AddressbookWindow::slotSave() |
891 | { | 892 | { |
892 | save(); | 893 | save(); |
893 | } | 894 | } |
894 | #endif | 895 | #endif |
895 | 896 | ||
896 | 897 | ||
897 | void AddressbookWindow::slotNotFound() | 898 | void AddressbookWindow::slotNotFound() |
898 | { | 899 | { |
899 | qWarning("Got notfound signal!"); | 900 | qWarning("Got notfound signal!"); |
900 | QMessageBox::information( this, tr( "Not Found" ), | 901 | QMessageBox::information( this, tr( "Not Found" ), |