-rw-r--r-- | core/pim/addressbook/abtable.cpp | 22 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 26 | ||||
-rw-r--r-- | core/pim/addressbook/configdlg.cpp | 13 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 9 |
4 files changed, 37 insertions, 33 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index 60f3177..539d6ba 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp | |||
@@ -1,90 +1,90 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) | 3 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) |
4 | ** | 4 | ** |
5 | ** This file is part of Qt Palmtop Environment. | 5 | ** This file is part of Qt Palmtop Environment. |
6 | ** | 6 | ** |
7 | ** This file may be distributed and/or modified under the terms of the | 7 | ** This file may be distributed and/or modified under the terms of the |
8 | ** GNU General Public License version 2 as published by the Free Software | 8 | ** GNU General Public License version 2 as published by the Free Software |
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging of this file. |
11 | ** | 11 | ** |
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | ** | 14 | ** |
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | #include <opie2/odebug.h> | 22 | #include <opie2/odebug.h> |
23 | #include <opie2/opimrecordlist.h> | 23 | #include <opie2/opimrecordlist.h> |
24 | #include <opie2/oresource.h> | ||
24 | 25 | ||
25 | #include <qpe/timestring.h> | 26 | #include <qpe/timestring.h> |
26 | #include <qpe/resource.h> | ||
27 | 27 | ||
28 | #include "abtable.h" | 28 | #include "abtable.h" |
29 | 29 | ||
30 | #include <errno.h> | 30 | #include <errno.h> |
31 | #include <fcntl.h> | 31 | #include <fcntl.h> |
32 | #include <unistd.h> | 32 | #include <unistd.h> |
33 | #include <stdlib.h> | 33 | #include <stdlib.h> |
34 | 34 | ||
35 | #include <ctype.h> //toupper() for key hack | 35 | #include <ctype.h> //toupper() for key hack |
36 | 36 | ||
37 | #if 0 | 37 | #if 0 |
38 | 38 | ||
39 | /*! | 39 | /*! |
40 | \class AbTableItem abtable.h | 40 | \class AbTableItem abtable.h |
41 | 41 | ||
42 | \brief QTableItem based class for showing a field of an entry | 42 | \brief QTableItem based class for showing a field of an entry |
43 | */ | 43 | */ |
44 | 44 | ||
45 | AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s, | 45 | AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s, |
46 | const QString &secondSortKey) | 46 | const QString &secondSortKey) |
47 | : QTableItem( t, et, s ) | 47 | : QTableItem( t, et, s ) |
48 | { | 48 | { |
49 | // sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower(); | 49 | // sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower(); |
50 | sortKey = Qtopia::buildSortKey( s, secondSortKey ); | 50 | sortKey = Qtopia::buildSortKey( s, secondSortKey ); |
51 | } | 51 | } |
52 | 52 | ||
53 | int AbTableItem::alignment() const | 53 | int AbTableItem::alignment() const |
54 | { | 54 | { |
55 | return AlignLeft|AlignVCenter; | 55 | return AlignLeft|AlignVCenter; |
56 | } | 56 | } |
57 | 57 | ||
58 | QString AbTableItem::key() const | 58 | QString AbTableItem::key() const |
59 | { | 59 | { |
60 | return sortKey; | 60 | return sortKey; |
61 | } | 61 | } |
62 | 62 | ||
63 | // A way to reset the item, without out doing a delete or a new... | 63 | // A way to reset the item, without out doing a delete or a new... |
64 | void AbTableItem::setItem( const QString &txt, const QString &secondKey ) | 64 | void AbTableItem::setItem( const QString &txt, const QString &secondKey ) |
65 | { | 65 | { |
66 | setText( txt ); | 66 | setText( txt ); |
67 | sortKey = Qtopia::buildSortKey( txt, secondKey ); | 67 | sortKey = Qtopia::buildSortKey( txt, secondKey ); |
68 | 68 | ||
69 | // sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower(); | 69 | // sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower(); |
70 | } | 70 | } |
71 | 71 | ||
72 | /*! | 72 | /*! |
73 | \class AbPickItem abtable.h | 73 | \class AbPickItem abtable.h |
74 | 74 | ||
75 | \brief QTableItem based class for showing slection of an entry | 75 | \brief QTableItem based class for showing slection of an entry |
76 | */ | 76 | */ |
77 | 77 | ||
78 | AbPickItem::AbPickItem( QTable *t ) : | 78 | AbPickItem::AbPickItem( QTable *t ) : |
79 | QTableItem(t, WhenCurrent, "?") | 79 | QTableItem(t, WhenCurrent, "?") |
80 | { | 80 | { |
81 | } | 81 | } |
82 | 82 | ||
83 | QWidget *AbPickItem::createEditor() const | 83 | QWidget *AbPickItem::createEditor() const |
84 | { | 84 | { |
85 | QComboBox* combo = new QComboBox( table()->viewport() ); | 85 | QComboBox* combo = new QComboBox( table()->viewport() ); |
86 | ( (AbPickItem*)this )->cb = combo; | 86 | ( (AbPickItem*)this )->cb = combo; |
87 | AbTable* t = static_cast<AbTable*>(table()); | 87 | AbTable* t = static_cast<AbTable*>(table()); |
88 | QStringList c = t->choiceNames(); | 88 | QStringList c = t->choiceNames(); |
89 | int cur = 0; | 89 | int cur = 0; |
90 | for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) { | 90 | for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) { |
@@ -568,193 +568,193 @@ void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) | |||
568 | QFontMetrics fm(f); | 568 | QFontMetrics fm(f); |
569 | 569 | ||
570 | int marg = 2; | 570 | int marg = 2; |
571 | int x = 0; | 571 | int x = 0; |
572 | int y = ( cr.height() - 14 ) / 2; | 572 | int y = ( cr.height() - 14 ) / 2; |
573 | 573 | ||
574 | QString nameText = act_contact.fileAs(); | 574 | QString nameText = act_contact.fileAs(); |
575 | 575 | ||
576 | switch( col ){ | 576 | switch( col ){ |
577 | case 0: | 577 | case 0: |
578 | p->drawText( x + marg,2 + fm.ascent(), nameText ); | 578 | p->drawText( x + marg,2 + fm.ascent(), nameText ); |
579 | break; | 579 | break; |
580 | case 1:{ | 580 | case 1:{ |
581 | 581 | ||
582 | ContactItem contactItem = findContactContact( act_contact, 0 ); | 582 | ContactItem contactItem = findContactContact( act_contact, 0 ); |
583 | QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */ | 583 | QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */ |
584 | QString contactText = contactItem.value; | 584 | QString contactText = contactItem.value; |
585 | 585 | ||
586 | if ( !contactPic.isNull() ) | 586 | if ( !contactPic.isNull() ) |
587 | { | 587 | { |
588 | p->drawPixmap( x + marg, y, contactPic ); | 588 | p->drawPixmap( x + marg, y, contactPic ); |
589 | p->drawText( x + marg + contactPic.width() | 589 | p->drawText( x + marg + contactPic.width() |
590 | + 4,2 + fm.ascent(), contactText ); | 590 | + 4,2 + fm.ascent(), contactText ); |
591 | } | 591 | } |
592 | else | 592 | else |
593 | { | 593 | { |
594 | p->drawText( x + marg,2 + fm.ascent(), contactText ); | 594 | p->drawText( x + marg,2 + fm.ascent(), contactText ); |
595 | } | 595 | } |
596 | } | 596 | } |
597 | break; | 597 | break; |
598 | 598 | ||
599 | } | 599 | } |
600 | p->restore(); | 600 | p->restore(); |
601 | } | 601 | } |
602 | 602 | ||
603 | void AbTable::rowHeightChanged( int row ) | 603 | void AbTable::rowHeightChanged( int row ) |
604 | { | 604 | { |
605 | if ( enablePainting ) | 605 | if ( enablePainting ) |
606 | QTable::rowHeightChanged( row ); | 606 | QTable::rowHeightChanged( row ); |
607 | } | 607 | } |
608 | ContactItem AbTable::findContactContact( const Opie::OPimContact &entry, int /* row */ ) | 608 | ContactItem AbTable::findContactContact( const Opie::OPimContact &entry, int /* row */ ) |
609 | { | 609 | { |
610 | 610 | ||
611 | ContactItem item; | 611 | ContactItem item; |
612 | 612 | ||
613 | item.value = ""; | 613 | item.value = ""; |
614 | 614 | ||
615 | for ( QValueList<int>::ConstIterator it = intFields.begin(); | 615 | for ( QValueList<int>::ConstIterator it = intFields.begin(); |
616 | it != intFields.end(); ++it ) { | 616 | it != intFields.end(); ++it ) { |
617 | switch ( *it ) { | 617 | switch ( *it ) { |
618 | default: | 618 | default: |
619 | break; | 619 | break; |
620 | case Qtopia::Title: | 620 | case Qtopia::Title: |
621 | item.value = entry.title(); | 621 | item.value = entry.title(); |
622 | break; | 622 | break; |
623 | case Qtopia::Suffix: | 623 | case Qtopia::Suffix: |
624 | item.value = entry.suffix(); | 624 | item.value = entry.suffix(); |
625 | break; | 625 | break; |
626 | case Qtopia::FileAs: | 626 | case Qtopia::FileAs: |
627 | item.value = entry.fileAs(); | 627 | item.value = entry.fileAs(); |
628 | break; | 628 | break; |
629 | case Qtopia::DefaultEmail: | 629 | case Qtopia::DefaultEmail: |
630 | item.value = entry.defaultEmail(); | 630 | item.value = entry.defaultEmail(); |
631 | if ( !item.value.isEmpty() ) | 631 | if ( !item.value.isEmpty() ) |
632 | item.icon = Resource::loadPixmap( "addressbook/email" ); | 632 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/email" ); |
633 | break; | 633 | break; |
634 | case Qtopia::Emails: | 634 | case Qtopia::Emails: |
635 | item.value = entry.emails(); | 635 | item.value = entry.emails(); |
636 | if ( !item.value.isEmpty() ) | 636 | if ( !item.value.isEmpty() ) |
637 | item.icon = Resource::loadPixmap( "addressbook/email" ); | 637 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/email" ); |
638 | break; | 638 | break; |
639 | case Qtopia::HomeStreet: | 639 | case Qtopia::HomeStreet: |
640 | item.value = entry.homeStreet(); | 640 | item.value = entry.homeStreet(); |
641 | break; | 641 | break; |
642 | case Qtopia::HomeCity: | 642 | case Qtopia::HomeCity: |
643 | item.value = entry.homeCity(); | 643 | item.value = entry.homeCity(); |
644 | break; | 644 | break; |
645 | case Qtopia::HomeState: | 645 | case Qtopia::HomeState: |
646 | item.value = entry.homeState(); | 646 | item.value = entry.homeState(); |
647 | break; | 647 | break; |
648 | case Qtopia::HomeZip: | 648 | case Qtopia::HomeZip: |
649 | item.value = entry.homeZip(); | 649 | item.value = entry.homeZip(); |
650 | break; | 650 | break; |
651 | case Qtopia::HomeCountry: | 651 | case Qtopia::HomeCountry: |
652 | item.value = entry.homeCountry(); | 652 | item.value = entry.homeCountry(); |
653 | break; | 653 | break; |
654 | case Qtopia::HomePhone: | 654 | case Qtopia::HomePhone: |
655 | item.value = entry.homePhone(); | 655 | item.value = entry.homePhone(); |
656 | if ( !item.value.isEmpty() ) | 656 | if ( !item.value.isEmpty() ) |
657 | item.icon = Resource::loadPixmap( "addressbook/phonehome" ); | 657 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/phonehome" ); |
658 | break; | 658 | break; |
659 | case Qtopia::HomeFax: | 659 | case Qtopia::HomeFax: |
660 | item.value = entry.homeFax(); | 660 | item.value = entry.homeFax(); |
661 | if ( !item.value.isEmpty() ) | 661 | if ( !item.value.isEmpty() ) |
662 | item.icon = Resource::loadPixmap( "addressbook/faxhome" ); | 662 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/faxhome" ); |
663 | break; | 663 | break; |
664 | case Qtopia::HomeMobile: | 664 | case Qtopia::HomeMobile: |
665 | item.value = entry.homeMobile(); | 665 | item.value = entry.homeMobile(); |
666 | if ( !item.value.isEmpty() ) | 666 | if ( !item.value.isEmpty() ) |
667 | item.icon = Resource::loadPixmap( "addressbook/mobilehome" ); | 667 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/mobilehome" ); |
668 | break; | 668 | break; |
669 | case Qtopia::HomeWebPage: | 669 | case Qtopia::HomeWebPage: |
670 | item.value = entry.homeWebpage(); | 670 | item.value = entry.homeWebpage(); |
671 | if ( !item.value.isEmpty() ) | 671 | if ( !item.value.isEmpty() ) |
672 | item.icon = Resource::loadPixmap( "addressbook/webpagehome" ); | 672 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/webpagehome" ); |
673 | break; | 673 | break; |
674 | case Qtopia::Company: | 674 | case Qtopia::Company: |
675 | item.value = entry.company(); | 675 | item.value = entry.company(); |
676 | break; | 676 | break; |
677 | case Qtopia::BusinessCity: | 677 | case Qtopia::BusinessCity: |
678 | item.value = entry.businessCity(); | 678 | item.value = entry.businessCity(); |
679 | break; | 679 | break; |
680 | case Qtopia::BusinessStreet: | 680 | case Qtopia::BusinessStreet: |
681 | item.value = entry.businessStreet(); | 681 | item.value = entry.businessStreet(); |
682 | break; | 682 | break; |
683 | case Qtopia::BusinessZip: | 683 | case Qtopia::BusinessZip: |
684 | item.value = entry.businessZip(); | 684 | item.value = entry.businessZip(); |
685 | break; | 685 | break; |
686 | case Qtopia::BusinessCountry: | 686 | case Qtopia::BusinessCountry: |
687 | item.value = entry.businessCountry(); | 687 | item.value = entry.businessCountry(); |
688 | break; | 688 | break; |
689 | case Qtopia::BusinessWebPage: | 689 | case Qtopia::BusinessWebPage: |
690 | item.value = entry.businessWebpage(); | 690 | item.value = entry.businessWebpage(); |
691 | if ( !item.value.isEmpty() ) | 691 | if ( !item.value.isEmpty() ) |
692 | item.icon = Resource::loadPixmap( "addressbook/webpagework" ); | 692 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/webpagework" ); |
693 | break; | 693 | break; |
694 | case Qtopia::JobTitle: | 694 | case Qtopia::JobTitle: |
695 | item.value = entry.jobTitle(); | 695 | item.value = entry.jobTitle(); |
696 | break; | 696 | break; |
697 | case Qtopia::Department: | 697 | case Qtopia::Department: |
698 | item.value = entry.department(); | 698 | item.value = entry.department(); |
699 | break; | 699 | break; |
700 | case Qtopia::Office: | 700 | case Qtopia::Office: |
701 | item.value = entry.office(); | 701 | item.value = entry.office(); |
702 | break; | 702 | break; |
703 | case Qtopia::BusinessPhone: | 703 | case Qtopia::BusinessPhone: |
704 | item.value = entry.businessPhone(); | 704 | item.value = entry.businessPhone(); |
705 | if ( !item.value.isEmpty() ) | 705 | if ( !item.value.isEmpty() ) |
706 | item.icon = Resource::loadPixmap( "addressbook/phonework" ); | 706 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/phonework" ); |
707 | break; | 707 | break; |
708 | case Qtopia::BusinessFax: | 708 | case Qtopia::BusinessFax: |
709 | item.value = entry.businessFax(); | 709 | item.value = entry.businessFax(); |
710 | if ( !item.value.isEmpty() ) | 710 | if ( !item.value.isEmpty() ) |
711 | item.icon = Resource::loadPixmap( "addressbook/faxwork" ); | 711 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/faxwork" ); |
712 | break; | 712 | break; |
713 | case Qtopia::BusinessMobile: | 713 | case Qtopia::BusinessMobile: |
714 | item.value = entry.businessMobile(); | 714 | item.value = entry.businessMobile(); |
715 | if ( !item.value.isEmpty() ) | 715 | if ( !item.value.isEmpty() ) |
716 | item.icon = Resource::loadPixmap( "addressbook/mobilework" ); | 716 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/mobilework" ); |
717 | break; | 717 | break; |
718 | case Qtopia::BusinessPager: | 718 | case Qtopia::BusinessPager: |
719 | item.value = entry.businessPager(); | 719 | item.value = entry.businessPager(); |
720 | break; | 720 | break; |
721 | case Qtopia::Profession: | 721 | case Qtopia::Profession: |
722 | item.value = entry.profession(); | 722 | item.value = entry.profession(); |
723 | break; | 723 | break; |
724 | case Qtopia::Assistant: | 724 | case Qtopia::Assistant: |
725 | item.value = entry.assistant(); | 725 | item.value = entry.assistant(); |
726 | break; | 726 | break; |
727 | case Qtopia::Manager: | 727 | case Qtopia::Manager: |
728 | item.value = entry.manager(); | 728 | item.value = entry.manager(); |
729 | break; | 729 | break; |
730 | case Qtopia::Spouse: | 730 | case Qtopia::Spouse: |
731 | item.value = entry.spouse(); | 731 | item.value = entry.spouse(); |
732 | break; | 732 | break; |
733 | case Qtopia::Gender: | 733 | case Qtopia::Gender: |
734 | item.value = entry.gender(); | 734 | item.value = entry.gender(); |
735 | break; | 735 | break; |
736 | case Qtopia::Birthday: | 736 | case Qtopia::Birthday: |
737 | if ( ! entry.birthday().isNull() ){ | 737 | if ( ! entry.birthday().isNull() ){ |
738 | item.value = TimeString::numberDateString( entry.birthday() ); | 738 | item.value = TimeString::numberDateString( entry.birthday() ); |
739 | } | 739 | } |
740 | break; | 740 | break; |
741 | case Qtopia::Anniversary: | 741 | case Qtopia::Anniversary: |
742 | if ( ! entry.anniversary().isNull() ){ | 742 | if ( ! entry.anniversary().isNull() ){ |
743 | item.value = TimeString::numberDateString( entry.anniversary() ); | 743 | item.value = TimeString::numberDateString( entry.anniversary() ); |
744 | } | 744 | } |
745 | break; | 745 | break; |
746 | case Qtopia::Nickname: | 746 | case Qtopia::Nickname: |
747 | item.value = entry.nickname(); | 747 | item.value = entry.nickname(); |
748 | break; | 748 | break; |
749 | case Qtopia::Children: | 749 | case Qtopia::Children: |
750 | item.value = entry.children(); | 750 | item.value = entry.children(); |
751 | break; | 751 | break; |
752 | case Qtopia::Notes: | 752 | case Qtopia::Notes: |
753 | item.value = entry.notes(); | 753 | item.value = entry.notes(); |
754 | break; | 754 | break; |
755 | } | 755 | } |
756 | if ( !item.value.isEmpty() ) | 756 | if ( !item.value.isEmpty() ) |
757 | break; | 757 | break; |
758 | } | 758 | } |
759 | return item; | 759 | return item; |
760 | } | 760 | } |
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index faae0a9..4fa9253 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -1,180 +1,184 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** Copyright (C) 2003 Stefan Eilers (eilers.stefan@epost.de) | 3 | ** Copyright (C) 2003 Stefan Eilers (eilers.stefan@epost.de) |
4 | ** | 4 | ** |
5 | ** This file is part of the Open Palmtop Environment (see www.opie.info). | 5 | ** This file is part of the Open Palmtop Environment (see www.opie.info). |
6 | ** | 6 | ** |
7 | ** This file may be distributed and/or modified under the terms of the | 7 | ** This file may be distributed and/or modified under the terms of the |
8 | ** GNU General Public License version 2 as published by the Free Software | 8 | ** GNU General Public License version 2 as published by the Free Software |
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging of this file. |
11 | ** | 11 | ** |
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | ** | 14 | ** |
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** | 17 | ** |
18 | **********************************************************************/ | 18 | **********************************************************************/ |
19 | 19 | ||
20 | #define QTOPIA_INTERNAL_FD | 20 | #define QTOPIA_INTERNAL_FD |
21 | 21 | ||
22 | // #include "addresssettings.h" | 22 | // #include "addresssettings.h" |
23 | #include "addressbook.h" | 23 | #include "addressbook.h" |
24 | 24 | ||
25 | #include <opie2/odebug.h> | 25 | #include <opie2/odebug.h> |
26 | #include <opie2/ofileselector.h> | 26 | #include <opie2/ofileselector.h> |
27 | #include <opie2/ofiledialog.h> | 27 | #include <opie2/ofiledialog.h> |
28 | #include <opie2/opimcontact.h> | 28 | #include <opie2/opimcontact.h> |
29 | #include <opie2/ocontactaccessbackend_vcard.h> | 29 | #include <opie2/ocontactaccessbackend_vcard.h> |
30 | #include <opie2/oresource.h> | ||
30 | 31 | ||
31 | #include <qpe/resource.h> | ||
32 | #include <qpe/ir.h> | 32 | #include <qpe/ir.h> |
33 | #include <qpe/qpemessagebox.h> | 33 | #include <qpe/qpemessagebox.h> |
34 | #include <qmenubar.h> | 34 | #include <qmenubar.h> |
35 | // #include <qtoolbar.h> | ||
36 | // #include <qmenubar.h> | ||
37 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
38 | 36 | ||
39 | #include <qaction.h> | 37 | #include <qaction.h> |
40 | #include <qlayout.h> | 38 | #include <qlayout.h> |
41 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
42 | #include <qtoolbutton.h> | 40 | #include <qtoolbutton.h> |
43 | 41 | ||
44 | #include <stdlib.h> | 42 | #include <stdlib.h> |
45 | #include <sys/stat.h> | 43 | #include <sys/stat.h> |
46 | #include <sys/types.h> | 44 | #include <sys/types.h> |
47 | #include <fcntl.h> | 45 | #include <fcntl.h> |
48 | #include <unistd.h> | 46 | #include <unistd.h> |
49 | 47 | ||
50 | 48 | ||
51 | #include "picker.h" | 49 | #include "picker.h" |
52 | #include "configdlg.h" | 50 | #include "configdlg.h" |
53 | 51 | ||
54 | extern QString addressbookPersonalVCardName(); | 52 | extern QString addressbookPersonalVCardName(); |
55 | 53 | ||
56 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | 54 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, |
57 | WFlags /*f*/ ) | 55 | WFlags /*f*/ ) |
58 | : Opie::OPimMainWindow( "Addressbook", "Contacts", tr( "Contact" ), "AddressBook", | 56 | : Opie::OPimMainWindow( "Addressbook", "Contacts", tr( "Contact" ), "AddressBook", |
59 | parent, name, WType_TopLevel | WStyle_ContextHelp ), | 57 | parent, name, WType_TopLevel | WStyle_ContextHelp ), |
60 | abEditor(0l), | 58 | abEditor(0l), |
61 | syncing(false) | 59 | syncing(false) |
62 | { | 60 | { |
63 | setCaption( tr( "Contacts" ) ); | 61 | setCaption( tr( "Contacts" ) ); |
64 | 62 | ||
65 | isLoading = true; | 63 | isLoading = true; |
66 | 64 | ||
67 | m_config.load(); | 65 | m_config.load(); |
68 | 66 | ||
69 | // Create Views | 67 | // Create Views |
70 | m_listContainer = new QWidget( this ); | 68 | m_listContainer = new QWidget( this ); |
71 | QVBoxLayout *vb = new QVBoxLayout( m_listContainer ); | 69 | QVBoxLayout *vb = new QVBoxLayout( m_listContainer ); |
72 | 70 | ||
73 | m_abView = new AbView( m_listContainer, m_config.orderList() ); | 71 | m_abView = new AbView( m_listContainer, m_config.orderList() ); |
74 | vb->addWidget( m_abView ); | 72 | vb->addWidget( m_abView ); |
75 | connect( m_abView, SIGNAL(signalViewSwitched(int)), | 73 | connect( m_abView, SIGNAL(signalViewSwitched(int)), |
76 | this, SLOT(slotViewSwitched(int)) ); | 74 | this, SLOT(slotViewSwitched(int)) ); |
77 | 75 | ||
78 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); | 76 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); |
79 | 77 | ||
80 | // Letter Picker | 78 | // Letter Picker |
81 | pLabel = new LetterPicker( m_listContainer ); | 79 | pLabel = new LetterPicker( m_listContainer ); |
82 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); | 80 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); |
83 | connect(m_abView, SIGNAL(signalClearLetterPicker()), pLabel, SLOT(clear()) ); | 81 | connect(m_abView, SIGNAL(signalClearLetterPicker()), pLabel, SLOT(clear()) ); |
84 | 82 | ||
85 | vb->addWidget( pLabel ); | 83 | vb->addWidget( pLabel ); |
86 | 84 | ||
87 | // Quick search bar | 85 | // Quick search bar |
88 | m_searchBar = new OFloatBar( "Search", this, QMainWindow::Top, true ); | 86 | m_searchBar = new OFloatBar( "Search", this, QMainWindow::Top, true ); |
89 | m_searchBar->setHorizontalStretchable( true ); | 87 | m_searchBar->setHorizontalStretchable( true ); |
90 | m_searchBar->hide(); | 88 | m_searchBar->hide(); |
91 | m_searchEdit = new QLineEdit( m_searchBar, "m_searchEdit" ); | 89 | m_searchEdit = new QLineEdit( m_searchBar, "m_searchEdit" ); |
92 | 90 | ||
93 | m_searchBar->setStretchableWidget( m_searchEdit ); | 91 | m_searchBar->setStretchableWidget( m_searchEdit ); |
94 | connect( m_searchEdit, SIGNAL(returnPressed()), this, SLOT(slotFind()) ); | 92 | connect( m_searchEdit, SIGNAL(returnPressed()), this, SLOT(slotFind()) ); |
95 | 93 | ||
96 | QAction *a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 94 | QAction *a = new QAction( tr( "Start Search" ), |
95 | Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ), | ||
96 | QString::null, 0, this, 0 ); | ||
97 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); | 97 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); |
98 | a->addTo( m_searchBar ); | 98 | a->addTo( m_searchBar ); |
99 | 99 | ||
100 | // Insert Contact menu items | 100 | // Insert Contact menu items |
101 | QActionGroup *items = new QActionGroup( this, QString::null, false ); | 101 | QActionGroup *items = new QActionGroup( this, QString::null, false ); |
102 | 102 | ||
103 | m_actionMail = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), | 103 | m_actionMail = new QAction( tr( "Write Mail To" ), |
104 | QString::null, 0, items, 0 ); | 104 | Opie::Core::OResource::loadPixmap( "addressbook/sendmail" ), |
105 | QString::null, 0, items, 0 ); | ||
105 | connect( m_actionMail, SIGNAL(activated()), this, SLOT(writeMail()) ); | 106 | connect( m_actionMail, SIGNAL(activated()), this, SLOT(writeMail()) ); |
106 | 107 | ||
107 | a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), | 108 | a = new QAction( tr("Import vCard"), |
108 | QString::null, 0, items, 0 ); | 109 | Opie::Core::OResource::loadPixmap( "addressbook/fileimport" ), |
110 | QString::null, 0, items, 0 ); | ||
109 | connect( a, SIGNAL(activated()), this, SLOT(importvCard()) ); | 111 | connect( a, SIGNAL(activated()), this, SLOT(importvCard()) ); |
110 | 112 | ||
111 | a = new QAction( tr("Export vCard"), Resource::loadPixmap( "addressbook/fileexport"), | 113 | a = new QAction( tr("Export vCard"), |
114 | Opie::Core::OResource::loadPixmap( "addressbook/fileexport" ), | ||
112 | QString::null, 0, items, 0 ); | 115 | QString::null, 0, items, 0 ); |
113 | connect( a, SIGNAL(activated()), this, SLOT(exportvCard()) ); | 116 | connect( a, SIGNAL(activated()), this, SLOT(exportvCard()) ); |
114 | 117 | ||
115 | m_actionPersonal = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), | 118 | m_actionPersonal = new QAction( tr("My Personal Details"), |
116 | QString::null, 0, items, 0 , true ); | 119 | Opie::Core::OResource::loadPixmap( "addressbook/identity" ), |
120 | QString::null, 0, items, 0 , true ); | ||
117 | connect( m_actionPersonal, SIGNAL(activated()), this, SLOT(slotPersonalView()) ); | 121 | connect( m_actionPersonal, SIGNAL(activated()), this, SLOT(slotPersonalView()) ); |
118 | 122 | ||
119 | insertItemMenuItems( items ); | 123 | insertItemMenuItems( items ); |
120 | 124 | ||
121 | // Insert View menu items | 125 | // Insert View menu items |
122 | items = new QActionGroup( this, QString::null, false ); | 126 | items = new QActionGroup( this, QString::null, false ); |
123 | 127 | ||
124 | a = new QAction( tr("Show quick search bar"),QString::null, 0, items, 0, true ); | 128 | a = new QAction( tr("Show quick search bar"),QString::null, 0, items, 0, true ); |
125 | connect( a, SIGNAL(toggled(bool)), this, SLOT(slotShowFind(bool)) ); | 129 | connect( a, SIGNAL(toggled(bool)), this, SLOT(slotShowFind(bool)) ); |
126 | 130 | ||
127 | insertViewMenuItems( items ); | 131 | insertViewMenuItems( items ); |
128 | 132 | ||
129 | // Fontsize | 133 | // Fontsize |
130 | defaultFont = new QFont( m_abView->font() ); | 134 | defaultFont = new QFont( m_abView->font() ); |
131 | slotSetFont(m_config.fontSize()); | 135 | slotSetFont(m_config.fontSize()); |
132 | m_curFontSize = m_config.fontSize(); | 136 | m_curFontSize = m_config.fontSize(); |
133 | 137 | ||
134 | setCentralWidget(m_listContainer); | 138 | setCentralWidget(m_listContainer); |
135 | 139 | ||
136 | //odebug << "adressbook contrsuction: t=" << t.elapsed() << oendl; | 140 | //odebug << "adressbook contrsuction: t=" << t.elapsed() << oendl; |
137 | connect( qApp, SIGNAL(flush()), this, SLOT(flush()) ); | 141 | connect( qApp, SIGNAL(flush()), this, SLOT(flush()) ); |
138 | connect( qApp, SIGNAL(reload()), this, SLOT(reload()) ); | 142 | connect( qApp, SIGNAL(reload()), this, SLOT(reload()) ); |
139 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), | 143 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), |
140 | this, SLOT(appMessage(const QCString&,const QByteArray&)) ); | 144 | this, SLOT(appMessage(const QCString&,const QByteArray&)) ); |
141 | 145 | ||
142 | isLoading = false; | 146 | isLoading = false; |
143 | 147 | ||
144 | // Handle category selection | 148 | // Handle category selection |
145 | setViewCategory( m_config.category() ); | 149 | setViewCategory( m_config.category() ); |
146 | m_abView->setShowByCategory( m_config.category() ); | 150 | m_abView->setShowByCategory( m_config.category() ); |
147 | connect( this, SIGNAL(categorySelected(const QString&)), | 151 | connect( this, SIGNAL(categorySelected(const QString&)), |
148 | this, SLOT(slotSetCategory(const QString&)) ); | 152 | this, SLOT(slotSetCategory(const QString&)) ); |
149 | } | 153 | } |
150 | 154 | ||
151 | void AddressbookWindow::slotSetFont( int size ) | 155 | void AddressbookWindow::slotSetFont( int size ) |
152 | { | 156 | { |
153 | odebug << "void AddressbookWindow::slotSetFont( " << size << " )" << oendl; | 157 | odebug << "void AddressbookWindow::slotSetFont( " << size << " )" << oendl; |
154 | 158 | ||
155 | if (size > 2 || size < 0) | 159 | if (size > 2 || size < 0) |
156 | size = 1; | 160 | size = 1; |
157 | 161 | ||
158 | m_config.setFontSize( size ); | 162 | m_config.setFontSize( size ); |
159 | 163 | ||
160 | QFont *currentFont; | 164 | QFont *currentFont; |
161 | 165 | ||
162 | switch (size) { | 166 | switch (size) { |
163 | case 0: | 167 | case 0: |
164 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); | 168 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); |
165 | currentFont = new QFont (m_abView->font()); | 169 | currentFont = new QFont (m_abView->font()); |
166 | // abList->resizeRows(currentFont->pixelSize() + 7); :SX | 170 | // abList->resizeRows(currentFont->pixelSize() + 7); :SX |
167 | // abList->resizeRows(); | 171 | // abList->resizeRows(); |
168 | break; | 172 | break; |
169 | case 1: | 173 | case 1: |
170 | m_abView->setFont( *defaultFont ); | 174 | m_abView->setFont( *defaultFont ); |
171 | currentFont = new QFont (m_abView->font()); | 175 | currentFont = new QFont (m_abView->font()); |
172 | // // abList->resizeRows(currentFont->pixelSize() + 7); | 176 | // // abList->resizeRows(currentFont->pixelSize() + 7); |
173 | // abList->resizeRows(); | 177 | // abList->resizeRows(); |
174 | break; | 178 | break; |
175 | case 2: | 179 | case 2: |
176 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); | 180 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); |
177 | currentFont = new QFont (m_abView->font()); | 181 | currentFont = new QFont (m_abView->font()); |
178 | // //abList->resizeRows(currentFont->pixelSize() + 7); | 182 | // //abList->resizeRows(currentFont->pixelSize() + 7); |
179 | // abList->resizeRows(); | 183 | // abList->resizeRows(); |
180 | break; | 184 | break; |
diff --git a/core/pim/addressbook/configdlg.cpp b/core/pim/addressbook/configdlg.cpp index 61e6c7e..a491fc7 100644 --- a/core/pim/addressbook/configdlg.cpp +++ b/core/pim/addressbook/configdlg.cpp | |||
@@ -1,95 +1,94 @@ | |||
1 | #include "configdlg.h" | 1 | #include "configdlg.h" |
2 | 2 | ||
3 | #include <opie2/odebug.h> | 3 | #include <opie2/odebug.h> |
4 | #include <opie2/opimcontact.h> | 4 | #include <opie2/opimcontact.h> |
5 | #include "opie2/opimcontactfields.h" | 5 | #include <opie2/opimcontactfields.h> |
6 | 6 | #include <opie2/oresource.h> | |
7 | #include <qpe/resource.h> | ||
8 | 7 | ||
9 | #include <qcheckbox.h> | 8 | #include <qcheckbox.h> |
10 | #include <qradiobutton.h> | 9 | #include <qradiobutton.h> |
11 | #include <qlistbox.h> | 10 | #include <qlistbox.h> |
12 | #include <qpushbutton.h> | 11 | #include <qpushbutton.h> |
13 | 12 | ||
14 | ConfigDlg::ConfigDlg( QWidget *parent, const char *name): | 13 | ConfigDlg::ConfigDlg( QWidget *parent, const char *name): |
15 | ConfigDlg_Base(parent, name, true ) | 14 | ConfigDlg_Base(parent, name, true ) |
16 | { | 15 | { |
17 | contFields = Opie::OPimContactFields::trfields(); | 16 | contFields = Opie::OPimContactFields::trfields(); |
18 | 17 | ||
19 | // We add all Fields into the Listbox | 18 | // We add all Fields into the Listbox |
20 | for (uint i=0; i < contFields.count(); i++) { | 19 | for (uint i=0; i < contFields.count(); i++) { |
21 | allFieldListBox->insertItem( contFields[i] ); | 20 | allFieldListBox->insertItem( contFields[i] ); |
22 | } | 21 | } |
23 | 22 | ||
24 | // Reset Widget Flags: This was not changeable by designer :( | 23 | // Reset Widget Flags: This was not changeable by designer :( |
25 | setWFlags ( WStyle_ContextHelp ); | 24 | setWFlags ( WStyle_ContextHelp ); |
26 | 25 | ||
27 | // Set Pics to Buttons and Tabs | 26 | // Set Pics to Buttons and Tabs |
28 | m_upButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/up" ) ) ); | 27 | m_upButton->setIconSet( QIconSet( Opie::Core::OResource::loadPixmap( "addressbook/up" ) ) ); |
29 | m_downButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/down" ) ) ); | 28 | m_downButton->setIconSet( QIconSet( Opie::Core::OResource::loadPixmap( "addressbook/down" ) ) ); |
30 | m_addButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/add" ) ) ); | 29 | m_addButton->setIconSet( QIconSet( Opie::Core::OResource::loadPixmap( "addressbook/add" ) ) ); |
31 | m_removeButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/sub" ) ) ); | 30 | m_removeButton->setIconSet( QIconSet( Opie::Core::OResource::loadPixmap( "addressbook/sub" ) ) ); |
32 | 31 | ||
33 | 32 | ||
34 | // Get the translation maps between Field ID and translated strings | 33 | // Get the translation maps between Field ID and translated strings |
35 | m_mapStrToID = Opie::OPimContactFields::trFieldsToId(); | 34 | m_mapStrToID = Opie::OPimContactFields::trFieldsToId(); |
36 | m_mapIDToStr = Opie::OPimContactFields::idToTrFields(); | 35 | m_mapIDToStr = Opie::OPimContactFields::idToTrFields(); |
37 | 36 | ||
38 | connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) ); | 37 | connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) ); |
39 | connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) ); | 38 | connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) ); |
40 | connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) ); | 39 | connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) ); |
41 | connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) ); | 40 | connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) ); |
42 | } | 41 | } |
43 | 42 | ||
44 | void ConfigDlg::slotItemUp() | 43 | void ConfigDlg::slotItemUp() |
45 | { | 44 | { |
46 | odebug << "void ConfigDlg::slotItemUp()" << oendl; | 45 | odebug << "void ConfigDlg::slotItemUp()" << oendl; |
47 | 46 | ||
48 | int i = fieldListBox->currentItem(); | 47 | int i = fieldListBox->currentItem(); |
49 | if ( i > 0 ) { | 48 | if ( i > 0 ) { |
50 | QString item = fieldListBox->currentText(); | 49 | QString item = fieldListBox->currentText(); |
51 | fieldListBox->removeItem( i ); | 50 | fieldListBox->removeItem( i ); |
52 | fieldListBox->insertItem( item, i-1 ); | 51 | fieldListBox->insertItem( item, i-1 ); |
53 | fieldListBox->setCurrentItem( i-1 ); | 52 | fieldListBox->setCurrentItem( i-1 ); |
54 | } | 53 | } |
55 | 54 | ||
56 | } | 55 | } |
57 | 56 | ||
58 | void ConfigDlg::slotItemDown() | 57 | void ConfigDlg::slotItemDown() |
59 | { | 58 | { |
60 | odebug << "void ConfigDlg::slotItemDown()" << oendl; | 59 | odebug << "void ConfigDlg::slotItemDown()" << oendl; |
61 | 60 | ||
62 | int i = fieldListBox->currentItem(); | 61 | int i = fieldListBox->currentItem(); |
63 | if ( i < (int)fieldListBox->count() - 1 ) { | 62 | if ( i < (int)fieldListBox->count() - 1 ) { |
64 | QString item = fieldListBox->currentText(); | 63 | QString item = fieldListBox->currentText(); |
65 | fieldListBox->removeItem( i ); | 64 | fieldListBox->removeItem( i ); |
66 | fieldListBox->insertItem( item, i+1 ); | 65 | fieldListBox->insertItem( item, i+1 ); |
67 | fieldListBox->setCurrentItem( i+1 ); | 66 | fieldListBox->setCurrentItem( i+1 ); |
68 | } | 67 | } |
69 | } | 68 | } |
70 | 69 | ||
71 | void ConfigDlg::slotItemAdd() | 70 | void ConfigDlg::slotItemAdd() |
72 | { | 71 | { |
73 | odebug << "void ConfigDlg::slotItemAdd()" << oendl; | 72 | odebug << "void ConfigDlg::slotItemAdd()" << oendl; |
74 | 73 | ||
75 | int i = allFieldListBox->currentItem(); | 74 | int i = allFieldListBox->currentItem(); |
76 | if ( i > 0 ) { | 75 | if ( i > 0 ) { |
77 | QString item = allFieldListBox->currentText(); | 76 | QString item = allFieldListBox->currentText(); |
78 | odebug << "Adding " << item << oendl; | 77 | odebug << "Adding " << item << oendl; |
79 | fieldListBox->insertItem( item ); | 78 | fieldListBox->insertItem( item ); |
80 | } | 79 | } |
81 | } | 80 | } |
82 | 81 | ||
83 | void ConfigDlg::slotItemRemove() | 82 | void ConfigDlg::slotItemRemove() |
84 | { | 83 | { |
85 | odebug << "void ConfigDlg::slotItemRemove()" << oendl; | 84 | odebug << "void ConfigDlg::slotItemRemove()" << oendl; |
86 | 85 | ||
87 | int i = fieldListBox->currentItem(); | 86 | int i = fieldListBox->currentItem(); |
88 | if ( i > 0 ) { | 87 | if ( i > 0 ) { |
89 | fieldListBox->removeItem( i ); | 88 | fieldListBox->removeItem( i ); |
90 | } | 89 | } |
91 | } | 90 | } |
92 | 91 | ||
93 | void ConfigDlg::setConfig( const AbConfig& cnf ) | 92 | void ConfigDlg::setConfig( const AbConfig& cnf ) |
94 | { | 93 | { |
95 | m_config = cnf; | 94 | m_config = cnf; |
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index dec4c7c..4a0059a 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -1,95 +1,95 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> | 2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> |
3 | * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) | 3 | * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) |
4 | * | 4 | * |
5 | * This file is an add-on for the OPIE Palmtop Environment | 5 | * This file is an add-on for the OPIE Palmtop Environment |
6 | * | 6 | * |
7 | * This file may be distributed and/or modified under the terms of the | 7 | * This file may be distributed and/or modified under the terms of the |
8 | * GNU General Public License version 2 as published by the Free Software | 8 | * GNU General Public License version 2 as published by the Free Software |
9 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging | 9 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging |
10 | * of this file. | 10 | * of this file. |
11 | * | 11 | * |
12 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | * | 14 | * |
15 | * | 15 | * |
16 | * This is a rewrite of the abeditor.h file, modified to provide a more | 16 | * This is a rewrite of the abeditor.h file, modified to provide a more |
17 | * intuitive interface to TrollTech's original Address Book editor. This | 17 | * intuitive interface to TrollTech's original Address Book editor. This |
18 | * is made to operate exactly in interface with the exception of name. | 18 | * is made to operate exactly in interface with the exception of name. |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include "contacteditor.h" | 22 | #include "contacteditor.h" |
23 | #include "namelineedit.h" | 23 | #include "namelineedit.h" |
24 | 24 | ||
25 | #include <opie2/odebug.h> | 25 | #include <opie2/odebug.h> |
26 | #include <opie2/opimcontact.h> | 26 | #include <opie2/opimcontact.h> |
27 | #include <opie2/oresource.h> | ||
27 | 28 | ||
28 | #include <qpe/categoryselect.h> | 29 | #include <qpe/categoryselect.h> |
29 | #include <qpe/qpeapplication.h> | 30 | #include <qpe/qpeapplication.h> |
30 | #include <qpe/qpedialog.h> | 31 | #include <qpe/qpedialog.h> |
31 | #include <qpe/resource.h> | ||
32 | 32 | ||
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
36 | #include <qmultilineedit.h> | 36 | #include <qmultilineedit.h> |
37 | #include <qtoolbutton.h> | 37 | #include <qtoolbutton.h> |
38 | #include <qlistbox.h> | 38 | #include <qlistbox.h> |
39 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
40 | #include <qwhatsthis.h> | 40 | #include <qwhatsthis.h> |
41 | 41 | ||
42 | #include <assert.h> | 42 | #include <assert.h> |
43 | 43 | ||
44 | static inline bool containsAlphaNum( const QString &str ); | 44 | static inline bool containsAlphaNum( const QString &str ); |
45 | static inline bool constainsWhiteSpace( const QString &str ); | 45 | static inline bool constainsWhiteSpace( const QString &str ); |
46 | 46 | ||
47 | // helper functions, convert our comma delimited list to proper | 47 | // helper functions, convert our comma delimited list to proper |
48 | // file format... | 48 | // file format... |
49 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 49 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
50 | QString &strAll ); | 50 | QString &strAll ); |
51 | 51 | ||
52 | // helper convert from file format to comma delimited... | 52 | // helper convert from file format to comma delimited... |
53 | void parseEmailTo( const QString &strDefaultEmail, | 53 | void parseEmailTo( const QString &strDefaultEmail, |
54 | const QString &strOtherEmail, QString &strBack ); | 54 | const QString &strOtherEmail, QString &strBack ); |
55 | 55 | ||
56 | ContactEditor::ContactEditor(const Opie::OPimContact &entry, | 56 | ContactEditor::ContactEditor(const Opie::OPimContact &entry, |
57 | QWidget *parent, | 57 | QWidget *parent, |
58 | const char *name, | 58 | const char *name, |
59 | WFlags ) | 59 | WFlags ) |
60 | : QDialog( parent, name, true, WStyle_ContextHelp ), | 60 | : QDialog( parent, name, true, WStyle_ContextHelp ), |
61 | defaultEmailChooserPosition( -1 ), | 61 | defaultEmailChooserPosition( -1 ), |
62 | m_personalView ( false ), | 62 | m_personalView ( false ), |
63 | cmbDefaultEmail( 0 ), | 63 | cmbDefaultEmail( 0 ), |
64 | initializing ( false ) | 64 | initializing ( false ) |
65 | { | 65 | { |
66 | 66 | ||
67 | initializing = true; | 67 | initializing = true; |
68 | 68 | ||
69 | init(); | 69 | init(); |
70 | setEntry( entry ); | 70 | setEntry( entry ); |
71 | // cmbDefaultEmail = 0; | 71 | // cmbDefaultEmail = 0; |
72 | // defaultEmailChooserPosition = -1; | 72 | // defaultEmailChooserPosition = -1; |
73 | 73 | ||
74 | initializing = false; | 74 | initializing = false; |
75 | } | 75 | } |
76 | 76 | ||
77 | ContactEditor::~ContactEditor() { | 77 | ContactEditor::~ContactEditor() { |
78 | } | 78 | } |
79 | 79 | ||
80 | void ContactEditor::init() { | 80 | void ContactEditor::init() { |
81 | odebug << "init() START" << oendl; | 81 | odebug << "init() START" << oendl; |
82 | 82 | ||
83 | uint i = 0; | 83 | uint i = 0; |
84 | 84 | ||
85 | QStringList trlChooserNames; | 85 | QStringList trlChooserNames; |
86 | 86 | ||
87 | for (i = 0; i <= 6; i++) { | 87 | for (i = 0; i <= 6; i++) { |
88 | slHomeAddress.append( "" ); | 88 | slHomeAddress.append( "" ); |
89 | slBusinessAddress.append( "" ); | 89 | slBusinessAddress.append( "" ); |
90 | } | 90 | } |
91 | 91 | ||
92 | trlChooserNames = Opie::OPimContactFields::trphonefields( false ); | 92 | trlChooserNames = Opie::OPimContactFields::trphonefields( false ); |
93 | slChooserNames = Opie::OPimContactFields::untrphonefields( false ); | 93 | slChooserNames = Opie::OPimContactFields::untrphonefields( false ); |
94 | slDynamicEntries = Opie::OPimContactFields::untrdetailsfields( false ); | 94 | slDynamicEntries = Opie::OPimContactFields::untrdetailsfields( false ); |
95 | trlDynamicEntries = Opie::OPimContactFields::trdetailsfields( false ); | 95 | trlDynamicEntries = Opie::OPimContactFields::trdetailsfields( false ); |
@@ -156,129 +156,130 @@ void ContactEditor::init() { | |||
156 | gl->addWidget( l, 2, 0 ); | 156 | gl->addWidget( l, 2, 0 ); |
157 | txtSuffix = new QLineEdit( container ); | 157 | txtSuffix = new QLineEdit( container ); |
158 | QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); | 158 | QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); |
159 | gl->addWidget( txtSuffix, 2, 1 ); | 159 | gl->addWidget( txtSuffix, 2, 1 ); |
160 | 160 | ||
161 | l = new QLabel( tr( "Organization" ), container ); | 161 | l = new QLabel( tr( "Organization" ), container ); |
162 | QWhatsThis::add( l, tr( "The working place of the contact" ) ); | 162 | QWhatsThis::add( l, tr( "The working place of the contact" ) ); |
163 | gl->addWidget( l, 3, 0 ); | 163 | gl->addWidget( l, 3, 0 ); |
164 | txtOrganization = new QLineEdit( container ); | 164 | txtOrganization = new QLineEdit( container ); |
165 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); | 165 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); |
166 | gl->addWidget( txtOrganization, 3, 1 ); | 166 | gl->addWidget( txtOrganization, 3, 1 ); |
167 | 167 | ||
168 | // Chooser 1 | 168 | // Chooser 1 |
169 | cmbChooserField1 = new QComboBox( false, container ); | 169 | cmbChooserField1 = new QComboBox( false, container ); |
170 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); | 170 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); |
171 | cmbChooserField1->setMaximumWidth( 90 ); | 171 | cmbChooserField1->setMaximumWidth( 90 ); |
172 | gl->addWidget( cmbChooserField1, 4, 0 ); | 172 | gl->addWidget( cmbChooserField1, 4, 0 ); |
173 | // Textfield for chooser 1. | 173 | // Textfield for chooser 1. |
174 | // Now use Widgetstack to contain the textfield and the default-email combo ! | 174 | // Now use Widgetstack to contain the textfield and the default-email combo ! |
175 | m_widgetStack1 = new QWidgetStack( container ); | 175 | m_widgetStack1 = new QWidgetStack( container ); |
176 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); | 176 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); |
177 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); | 177 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); |
178 | gl->addWidget( m_widgetStack1, 4, 1 ); | 178 | gl->addWidget( m_widgetStack1, 4, 1 ); |
179 | m_widgetStack1 -> raiseWidget( TextField ); | 179 | m_widgetStack1 -> raiseWidget( TextField ); |
180 | 180 | ||
181 | // Chooser 2 | 181 | // Chooser 2 |
182 | cmbChooserField2 = new QComboBox( false, container ); | 182 | cmbChooserField2 = new QComboBox( false, container ); |
183 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); | 183 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); |
184 | cmbChooserField2->setMaximumWidth( 90 ); | 184 | cmbChooserField2->setMaximumWidth( 90 ); |
185 | gl->addWidget( cmbChooserField2, 5, 0 ); | 185 | gl->addWidget( cmbChooserField2, 5, 0 ); |
186 | // Textfield for chooser 2 | 186 | // Textfield for chooser 2 |
187 | // Now use WidgetStack to contain the textfield and the default-email combo! | 187 | // Now use WidgetStack to contain the textfield and the default-email combo! |
188 | m_widgetStack2 = new QWidgetStack( container ); | 188 | m_widgetStack2 = new QWidgetStack( container ); |
189 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); | 189 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); |
190 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); | 190 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); |
191 | gl->addWidget( m_widgetStack2, 5, 1 ); | 191 | gl->addWidget( m_widgetStack2, 5, 1 ); |
192 | m_widgetStack2 -> raiseWidget( TextField ); | 192 | m_widgetStack2 -> raiseWidget( TextField ); |
193 | 193 | ||
194 | // Chooser 3 | 194 | // Chooser 3 |
195 | cmbChooserField3 = new QComboBox( false, container ); | 195 | cmbChooserField3 = new QComboBox( false, container ); |
196 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); | 196 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); |
197 | cmbChooserField3->setMaximumWidth( 90 ); | 197 | cmbChooserField3->setMaximumWidth( 90 ); |
198 | gl->addWidget( cmbChooserField3, 6, 0 ); | 198 | gl->addWidget( cmbChooserField3, 6, 0 ); |
199 | // Textfield for chooser 2 | 199 | // Textfield for chooser 2 |
200 | // Now use WidgetStack to contain the textfield and the default-email combo! | 200 | // Now use WidgetStack to contain the textfield and the default-email combo! |
201 | m_widgetStack3 = new QWidgetStack( container ); | 201 | m_widgetStack3 = new QWidgetStack( container ); |
202 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); | 202 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); |
203 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); | 203 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); |
204 | gl->addWidget( m_widgetStack3, 6, 1 ); | 204 | gl->addWidget( m_widgetStack3, 6, 1 ); |
205 | m_widgetStack3 -> raiseWidget( TextField ); | 205 | m_widgetStack3 -> raiseWidget( TextField ); |
206 | 206 | ||
207 | l = new QLabel( tr( "File As" ), container ); | 207 | l = new QLabel( tr( "File As" ), container ); |
208 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); | 208 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); |
209 | gl->addWidget( l, 7, 0 ); | 209 | gl->addWidget( l, 7, 0 ); |
210 | cmbFileAs = new QComboBox( true, container ); | 210 | cmbFileAs = new QComboBox( true, container ); |
211 | gl->addWidget( cmbFileAs, 7, 1 ); | 211 | gl->addWidget( cmbFileAs, 7, 1 ); |
212 | 212 | ||
213 | labCat = new QLabel( tr( "Category" ), container ); | 213 | labCat = new QLabel( tr( "Category" ), container ); |
214 | gl->addWidget( labCat, 8, 0 ); | 214 | gl->addWidget( labCat, 8, 0 ); |
215 | cmbCat = new CategorySelect( container ); | 215 | cmbCat = new CategorySelect( container ); |
216 | gl->addWidget( cmbCat, 8, 1 ); | 216 | gl->addWidget( cmbCat, 8, 1 ); |
217 | labCat->show(); | 217 | labCat->show(); |
218 | cmbCat->show(); | 218 | cmbCat->show(); |
219 | 219 | ||
220 | btnNote = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Notes..." ), container ); | 220 | btnNote = new QPushButton( Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ), |
221 | tr( "Notes..." ), container ); | ||
221 | gl->addWidget( btnNote, 9, 1 ); | 222 | gl->addWidget( btnNote, 9, 1 ); |
222 | 223 | ||
223 | tabMain->addTab( m_generalWidget, "addressbook/AddressBookSmall", tr( "General" ) ); | 224 | tabMain->addTab( m_generalWidget, "addressbook/AddressBookSmall", tr( "General" ) ); |
224 | 225 | ||
225 | QWidget *tabViewport = new QWidget ( tabMain ); | 226 | QWidget *tabViewport = new QWidget ( tabMain ); |
226 | 227 | ||
227 | vb = new QVBoxLayout( tabViewport ); | 228 | vb = new QVBoxLayout( tabViewport ); |
228 | 229 | ||
229 | svAddress = new QScrollView( tabViewport ); | 230 | svAddress = new QScrollView( tabViewport ); |
230 | vb->addWidget( svAddress, 0, 0 ); | 231 | vb->addWidget( svAddress, 0, 0 ); |
231 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); | 232 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); |
232 | svAddress->setFrameStyle( QFrame::NoFrame ); | 233 | svAddress->setFrameStyle( QFrame::NoFrame ); |
233 | 234 | ||
234 | container = new QWidget( svAddress->viewport() ); | 235 | container = new QWidget( svAddress->viewport() ); |
235 | svAddress->addChild( container ); | 236 | svAddress->addChild( container ); |
236 | 237 | ||
237 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem | 238 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem |
238 | 239 | ||
239 | cmbAddress = new QComboBox( false, container ); | 240 | cmbAddress = new QComboBox( false, container ); |
240 | cmbAddress->insertItem( tr( "Business" ) ); | 241 | cmbAddress->insertItem( tr( "Business" ) ); |
241 | cmbAddress->insertItem( tr( "Home" ) ); | 242 | cmbAddress->insertItem( tr( "Home" ) ); |
242 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 243 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
243 | 244 | ||
244 | l = new QLabel( tr( "Address" ), container ); | 245 | l = new QLabel( tr( "Address" ), container ); |
245 | gl->addWidget( l, 1, 0 ); | 246 | gl->addWidget( l, 1, 0 ); |
246 | txtAddress = new QLineEdit( container ); | 247 | txtAddress = new QLineEdit( container ); |
247 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); | 248 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); |
248 | 249 | ||
249 | l = new QLabel( tr( "City" ), container ); | 250 | l = new QLabel( tr( "City" ), container ); |
250 | gl->addWidget( l, 2, 0 ); | 251 | gl->addWidget( l, 2, 0 ); |
251 | txtCity = new QLineEdit( container ); | 252 | txtCity = new QLineEdit( container ); |
252 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); | 253 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); |
253 | 254 | ||
254 | l = new QLabel( tr( "State" ), container ); | 255 | l = new QLabel( tr( "State" ), container ); |
255 | gl->addWidget( l, 3, 0 ); | 256 | gl->addWidget( l, 3, 0 ); |
256 | txtState = new QLineEdit( container ); | 257 | txtState = new QLineEdit( container ); |
257 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); | 258 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); |
258 | 259 | ||
259 | l = new QLabel( tr( "Zip Code" ), container ); | 260 | l = new QLabel( tr( "Zip Code" ), container ); |
260 | gl->addWidget( l, 4, 0 ); | 261 | gl->addWidget( l, 4, 0 ); |
261 | txtZip = new QLineEdit( container ); | 262 | txtZip = new QLineEdit( container ); |
262 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); | 263 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); |
263 | 264 | ||
264 | l = new QLabel( tr( "Country" ), container ); | 265 | l = new QLabel( tr( "Country" ), container ); |
265 | gl->addWidget( l, 5, 0 ); | 266 | gl->addWidget( l, 5, 0 ); |
266 | cmbCountry = new QComboBox( true, container ); | 267 | cmbCountry = new QComboBox( true, container ); |
267 | cmbCountry->insertItem( "" ); | 268 | cmbCountry->insertItem( "" ); |
268 | cmbCountry->insertItem( tr ( "United States" ) ); | 269 | cmbCountry->insertItem( tr ( "United States" ) ); |
269 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); | 270 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); |
270 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); | 271 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); |
271 | cmbCountry->insertItem( tr ( "Albania" ) ); | 272 | cmbCountry->insertItem( tr ( "Albania" ) ); |
272 | cmbCountry->insertItem( tr ( "Algeria" ) ); | 273 | cmbCountry->insertItem( tr ( "Algeria" ) ); |
273 | cmbCountry->insertItem( tr ( "American Samoa" ) ); | 274 | cmbCountry->insertItem( tr ( "American Samoa" ) ); |
274 | cmbCountry->insertItem( tr ( "Andorra" ) ); | 275 | cmbCountry->insertItem( tr ( "Andorra" ) ); |
275 | cmbCountry->insertItem( tr ( "Angola" ) ); | 276 | cmbCountry->insertItem( tr ( "Angola" ) ); |
276 | cmbCountry->insertItem( tr ( "Anguilla" ) ); | 277 | cmbCountry->insertItem( tr ( "Anguilla" ) ); |
277 | cmbCountry->insertItem( tr ( "Antarctica" ) ); | 278 | cmbCountry->insertItem( tr ( "Antarctica" ) ); |
278 | cmbCountry->insertItem( tr ( "Argentina" ) ); | 279 | cmbCountry->insertItem( tr ( "Argentina" ) ); |
279 | cmbCountry->insertItem( tr ( "Armenia" ) ); | 280 | cmbCountry->insertItem( tr ( "Armenia" ) ); |
280 | cmbCountry->insertItem( tr ( "Aruba" ) ); | 281 | cmbCountry->insertItem( tr ( "Aruba" ) ); |
281 | cmbCountry->insertItem( tr ( "Australia" ) ); | 282 | cmbCountry->insertItem( tr ( "Australia" ) ); |
282 | cmbCountry->insertItem( tr ( "Austria" ) ); | 283 | cmbCountry->insertItem( tr ( "Austria" ) ); |
283 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); | 284 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); |
284 | cmbCountry->insertItem( tr ( "Bahamas" ) ); | 285 | cmbCountry->insertItem( tr ( "Bahamas" ) ); |
@@ -469,154 +470,154 @@ void ContactEditor::init() { | |||
469 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); | 470 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); |
470 | cmbCountry->insertItem( tr ( "Venezuela" ) ); | 471 | cmbCountry->insertItem( tr ( "Venezuela" ) ); |
471 | cmbCountry->insertItem( tr ( "Vietnam" ) ); | 472 | cmbCountry->insertItem( tr ( "Vietnam" ) ); |
472 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); | 473 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); |
473 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); | 474 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); |
474 | cmbCountry->insertItem( tr ( "Yemen" ) ); | 475 | cmbCountry->insertItem( tr ( "Yemen" ) ); |
475 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); | 476 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); |
476 | cmbCountry->insertItem( tr ( "Zambia" ) ); | 477 | cmbCountry->insertItem( tr ( "Zambia" ) ); |
477 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); | 478 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); |
478 | if (cmbCountry->listBox()!=0) | 479 | if (cmbCountry->listBox()!=0) |
479 | cmbCountry->listBox()->sort(); | 480 | cmbCountry->listBox()->sort(); |
480 | 481 | ||
481 | cmbCountry->setMaximumWidth( 135 ); | 482 | cmbCountry->setMaximumWidth( 135 ); |
482 | 483 | ||
483 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); | 484 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); |
484 | 485 | ||
485 | // Chooser 4 | 486 | // Chooser 4 |
486 | cmbChooserField4 = new QComboBox( false, container ); | 487 | cmbChooserField4 = new QComboBox( false, container ); |
487 | cmbChooserField4->setMaximumWidth( 90 ); | 488 | cmbChooserField4->setMaximumWidth( 90 ); |
488 | gl->addWidget( cmbChooserField4, 6, 0 ); | 489 | gl->addWidget( cmbChooserField4, 6, 0 ); |
489 | // Textfield for chooser 2 | 490 | // Textfield for chooser 2 |
490 | // Now use WidgetStack to contain the textfield and the default-email combo! | 491 | // Now use WidgetStack to contain the textfield and the default-email combo! |
491 | m_widgetStack4 = new QWidgetStack( container ); | 492 | m_widgetStack4 = new QWidgetStack( container ); |
492 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); | 493 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); |
493 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); | 494 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); |
494 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); | 495 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); |
495 | m_widgetStack4 -> raiseWidget( TextField ); | 496 | m_widgetStack4 -> raiseWidget( TextField ); |
496 | 497 | ||
497 | QSpacerItem *space = new QSpacerItem(1,1, | 498 | QSpacerItem *space = new QSpacerItem(1,1, |
498 | QSizePolicy::Maximum, | 499 | QSizePolicy::Maximum, |
499 | QSizePolicy::MinimumExpanding ); | 500 | QSizePolicy::MinimumExpanding ); |
500 | gl->addItem( space, 7, 0 ); | 501 | gl->addItem( space, 7, 0 ); |
501 | 502 | ||
502 | tabMain->addTab( tabViewport, "home", tr( "Address" ) ); | 503 | tabMain->addTab( tabViewport, "home", tr( "Address" ) ); |
503 | 504 | ||
504 | tabViewport = new QWidget ( tabMain ); | 505 | tabViewport = new QWidget ( tabMain ); |
505 | 506 | ||
506 | vb = new QVBoxLayout( tabViewport ); | 507 | vb = new QVBoxLayout( tabViewport ); |
507 | 508 | ||
508 | svDetails = new QScrollView( tabViewport ); | 509 | svDetails = new QScrollView( tabViewport ); |
509 | vb->addWidget( svDetails, 0, 0 ); | 510 | vb->addWidget( svDetails, 0, 0 ); |
510 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); | 511 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); |
511 | svDetails->setFrameStyle( QFrame::NoFrame ); | 512 | svDetails->setFrameStyle( QFrame::NoFrame ); |
512 | 513 | ||
513 | container = new QWidget( svDetails->viewport() ); | 514 | container = new QWidget( svDetails->viewport() ); |
514 | svDetails->addChild( container ); | 515 | svDetails->addChild( container ); |
515 | 516 | ||
516 | gl = new QGridLayout( container, 1, 2, 2, 4 ); | 517 | gl = new QGridLayout( container, 1, 2, 2, 4 ); |
517 | 518 | ||
518 | int counter = 0; | 519 | int counter = 0; |
519 | 520 | ||
520 | // Birthday | 521 | // Birthday |
521 | QHBox* hBox = new QHBox( container ); | 522 | QHBox* hBox = new QHBox( container ); |
522 | l = new QLabel( tr("Birthday"), container ); | 523 | l = new QLabel( tr("Birthday"), container ); |
523 | gl->addWidget( l, counter, 0 ); | 524 | gl->addWidget( l, counter, 0 ); |
524 | 525 | ||
525 | QPopupMenu* m1 = new QPopupMenu( container ); | 526 | QPopupMenu* m1 = new QPopupMenu( container ); |
526 | birthdayPicker = new DateBookMonth( m1, 0, true ); | 527 | birthdayPicker = new DateBookMonth( m1, 0, true ); |
527 | m1->insertItem( birthdayPicker ); | 528 | m1->insertItem( birthdayPicker ); |
528 | 529 | ||
529 | birthdayButton= new QToolButton( hBox, "buttonStart" ); | 530 | birthdayButton= new QToolButton( hBox, "buttonStart" ); |
530 | birthdayButton->setPopup( m1 ); | 531 | birthdayButton->setPopup( m1 ); |
531 | birthdayButton->setPopupDelay(0); | 532 | birthdayButton->setPopupDelay(0); |
532 | 533 | ||
533 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 534 | QPushButton* deleteButton = new QPushButton( Opie::Core::OResource::loadPixmap( "trash", Opie::Core::OResource::SmallIcon ), |
534 | tr( "Delete" ), | 535 | tr( "Delete" ), |
535 | hBox, 0 ); | 536 | hBox, 0 ); |
536 | 537 | ||
537 | gl->addWidget( hBox, counter , 1 ); | 538 | gl->addWidget( hBox, counter , 1 ); |
538 | 539 | ||
539 | connect( birthdayPicker, SIGNAL( dateClicked(int,int,int) ), | 540 | connect( birthdayPicker, SIGNAL( dateClicked(int,int,int) ), |
540 | this, SLOT( slotBirthdayDateChanged(int,int,int) ) ); | 541 | this, SLOT( slotBirthdayDateChanged(int,int,int) ) ); |
541 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); | 542 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); |
542 | 543 | ||
543 | ++counter; | 544 | ++counter; |
544 | 545 | ||
545 | // Anniversary | 546 | // Anniversary |
546 | hBox = new QHBox( container ); | 547 | hBox = new QHBox( container ); |
547 | l = new QLabel( tr("Anniversary"), container ); | 548 | l = new QLabel( tr("Anniversary"), container ); |
548 | gl->addWidget( l, counter, 0 ); | 549 | gl->addWidget( l, counter, 0 ); |
549 | 550 | ||
550 | m1 = new QPopupMenu( container ); | 551 | m1 = new QPopupMenu( container ); |
551 | anniversaryPicker = new DateBookMonth( m1, 0, true ); | 552 | anniversaryPicker = new DateBookMonth( m1, 0, true ); |
552 | m1->insertItem( anniversaryPicker ); | 553 | m1->insertItem( anniversaryPicker ); |
553 | 554 | ||
554 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); | 555 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); |
555 | anniversaryButton->setPopup( m1 ); | 556 | anniversaryButton->setPopup( m1 ); |
556 | anniversaryButton->setPopupDelay(0); | 557 | anniversaryButton->setPopupDelay(0); |
557 | 558 | ||
558 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 559 | deleteButton = new QPushButton( Opie::Core::OResource::loadPixmap( "trash", Opie::Core::OResource::SmallIcon ), |
559 | tr( "Delete" ), | 560 | tr( "Delete" ), |
560 | hBox, 0 ); | 561 | hBox, 0 ); |
561 | gl->addWidget( hBox, counter , 1 ); | 562 | gl->addWidget( hBox, counter , 1 ); |
562 | 563 | ||
563 | connect( anniversaryPicker, SIGNAL( dateClicked(int,int,int) ), | 564 | connect( anniversaryPicker, SIGNAL( dateClicked(int,int,int) ), |
564 | this, SLOT( slotAnniversaryDateChanged(int,int,int) ) ); | 565 | this, SLOT( slotAnniversaryDateChanged(int,int,int) ) ); |
565 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); | 566 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); |
566 | 567 | ||
567 | ++counter; | 568 | ++counter; |
568 | 569 | ||
569 | // Gender | 570 | // Gender |
570 | l = new QLabel( tr("Gender"), container ); | 571 | l = new QLabel( tr("Gender"), container ); |
571 | gl->addWidget( l, counter, 0 ); | 572 | gl->addWidget( l, counter, 0 ); |
572 | cmbGender = new QComboBox( container ); | 573 | cmbGender = new QComboBox( container ); |
573 | cmbGender->insertItem( "", 0 ); | 574 | cmbGender->insertItem( "", 0 ); |
574 | cmbGender->insertItem( tr("Male"), 1); | 575 | cmbGender->insertItem( tr("Male"), 1); |
575 | cmbGender->insertItem( tr("Female"), 2); | 576 | cmbGender->insertItem( tr("Female"), 2); |
576 | gl->addWidget( cmbGender, counter, 1 ); | 577 | gl->addWidget( cmbGender, counter, 1 ); |
577 | 578 | ||
578 | ++counter; | 579 | ++counter; |
579 | 580 | ||
580 | // Create Labels and lineedit fields for every dynamic entry | 581 | // Create Labels and lineedit fields for every dynamic entry |
581 | QStringList::ConstIterator it = slDynamicEntries.begin(); | 582 | QStringList::ConstIterator it = slDynamicEntries.begin(); |
582 | QMap<QString, int> mapStrToID = Opie::OPimContactFields::untrFieldsToId(); | 583 | QMap<QString, int> mapStrToID = Opie::OPimContactFields::untrFieldsToId(); |
583 | QMap<int, QString> mapIdToStr = Opie::OPimContactFields::idToTrFields(); | 584 | QMap<int, QString> mapIdToStr = Opie::OPimContactFields::idToTrFields(); |
584 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { | 585 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { |
585 | 586 | ||
586 | if (((*it) == "Anniversary") || | 587 | if (((*it) == "Anniversary") || |
587 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; | 588 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; |
588 | 589 | ||
589 | l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); | 590 | l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); |
590 | listName.append( l ); | 591 | listName.append( l ); |
591 | gl->addWidget( l, i, 0 ); | 592 | gl->addWidget( l, i, 0 ); |
592 | QLineEdit *e = new QLineEdit( container ); | 593 | QLineEdit *e = new QLineEdit( container ); |
593 | listValue.append( e ); | 594 | listValue.append( e ); |
594 | gl->addWidget( e, i, 1); | 595 | gl->addWidget( e, i, 1); |
595 | } | 596 | } |
596 | // Fill labels with names.. | 597 | // Fill labels with names.. |
597 | //loadFields(); | 598 | //loadFields(); |
598 | 599 | ||
599 | 600 | ||
600 | tabMain->addTab( tabViewport, "UtilsIcon", tr( "Details" ) ); | 601 | tabMain->addTab( tabViewport, "UtilsIcon", tr( "Details" ) ); |
601 | 602 | ||
602 | dlgNote = new QDialog( this, "Note Dialog", true ); | 603 | dlgNote = new QDialog( this, "Note Dialog", true ); |
603 | dlgNote->setCaption( tr("Enter Note") ); | 604 | dlgNote->setCaption( tr("Enter Note") ); |
604 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 605 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
605 | txtNote = new QMultiLineEdit( dlgNote ); | 606 | txtNote = new QMultiLineEdit( dlgNote ); |
606 | vbNote->addWidget( txtNote ); | 607 | vbNote->addWidget( txtNote ); |
607 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 608 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
608 | 609 | ||
609 | dlgName = new QDialog( this, "Name Dialog", true ); | 610 | dlgName = new QDialog( this, "Name Dialog", true ); |
610 | dlgName->setCaption( tr("Edit Name") ); | 611 | dlgName->setCaption( tr("Edit Name") ); |
611 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 612 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
612 | 613 | ||
613 | l = new QLabel( tr("First Name"), dlgName ); | 614 | l = new QLabel( tr("First Name"), dlgName ); |
614 | gl->addWidget( l, 0, 0 ); | 615 | gl->addWidget( l, 0, 0 ); |
615 | txtFirstName = new ABOOK::NameLineEdit( dlgName ); | 616 | txtFirstName = new ABOOK::NameLineEdit( dlgName ); |
616 | gl->addWidget( txtFirstName, 0, 1 ); | 617 | gl->addWidget( txtFirstName, 0, 1 ); |
617 | 618 | ||
618 | l = new QLabel( tr("Middle Name"), dlgName ); | 619 | l = new QLabel( tr("Middle Name"), dlgName ); |
619 | gl->addWidget( l, 1, 0 ); | 620 | gl->addWidget( l, 1, 0 ); |
620 | txtMiddleName = new ABOOK::NameLineEdit( dlgName ); | 621 | txtMiddleName = new ABOOK::NameLineEdit( dlgName ); |
621 | gl->addWidget( txtMiddleName, 1, 1 ); | 622 | gl->addWidget( txtMiddleName, 1, 1 ); |
622 | 623 | ||