summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp3
-rw-r--r--core/pim/addressbook/contacteditor.cpp88
2 files changed, 53 insertions, 38 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 472b13e..2eb9ddf 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -1,226 +1,226 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** OContact info@trolltech.com if any conditions of this licensing are 16** OContact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#define QTOPIA_INTERNAL_FD 21#define QTOPIA_INTERNAL_FD
22 22
23#include "contacteditor.h" 23#include "contacteditor.h"
24#include "ablabel.h" 24#include "ablabel.h"
25#include "abtable.h" 25#include "abtable.h"
26#include "addresssettings.h" 26#include "addresssettings.h"
27#include "addressbook.h" 27#include "addressbook.h"
28 28
29 29
30#include <opie/ofileselector.h> 30#include <opie/ofileselector.h>
31#include <opie/ofiledialog.h> 31#include <opie/ofiledialog.h>
32#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
33#include <qpe/config.h> 33#include <qpe/config.h>
34#include <qpe/contact.h> 34#include <opie/ocontact.h>
35 35
36#ifndef MAKE_FOR_SHARP_ROM 36#ifndef MAKE_FOR_SHARP_ROM
37#include <qpe/finddialog.h> 37#include <qpe/finddialog.h>
38#endif 38#endif
39 39
40#include <qpe/global.h> 40#include <qpe/global.h>
41#include <qpe/resource.h> 41#include <qpe/resource.h>
42#include <qpe/ir.h> 42#include <qpe/ir.h>
43#include <qpe/qpemessagebox.h> 43#include <qpe/qpemessagebox.h>
44#include <qpe/qcopenvelope_qws.h> 44#include <qpe/qcopenvelope_qws.h>
45 45
46#include <qaction.h> 46#include <qaction.h>
47#include <qdialog.h> 47#include <qdialog.h>
48#include <qdir.h> 48#include <qdir.h>
49#include <qfile.h> 49#include <qfile.h>
50#include <qimage.h> 50#include <qimage.h>
51#include <qlayout.h> 51#include <qlayout.h>
52#include <qpe/qpemenubar.h> 52#include <qpe/qpemenubar.h>
53#include <qmessagebox.h> 53#include <qmessagebox.h>
54#include <qpixmap.h> 54#include <qpixmap.h>
55#include <qpopupmenu.h> 55#include <qpopupmenu.h>
56#include <qpe/qpetoolbar.h> 56#include <qpe/qpetoolbar.h>
57#include <qstringlist.h> 57#include <qstringlist.h>
58#include <qtoolbutton.h> 58#include <qtoolbutton.h>
59#include <qwhatsthis.h> 59#include <qwhatsthis.h>
60 60
61#include <stdlib.h> 61#include <stdlib.h>
62#include <sys/stat.h> 62#include <sys/stat.h>
63#include <sys/types.h> 63#include <sys/types.h>
64#include <fcntl.h> 64#include <fcntl.h>
65#include <unistd.h> 65#include <unistd.h>
66 66
67#include <qdatetime.h> 67#include <qdatetime.h>
68 68
69#include "picker.h" 69#include "picker.h"
70static QString addressbookOldXMLFilename() 70static QString addressbookOldXMLFilename()
71{ 71{
72 QString filename = QPEApplication::documentDir() + "addressbook.xml"; 72 QString filename = QPEApplication::documentDir() + "addressbook.xml";
73 return filename; 73 return filename;
74} 74}
75 75
76static QString addressbookXMLFilename() 76static QString addressbookXMLFilename()
77{ 77{
78 QString filename = Global::applicationFileName("addressbook", 78 QString filename = Global::applicationFileName("addressbook",
79 "addressbook.xml"); 79 "addressbook.xml");
80 return filename; 80 return filename;
81} 81}
82 82
83static QString addressbookPersonalVCardName() 83static QString addressbookPersonalVCardName()
84{ 84{
85 QString filename = Global::applicationFileName("addressbook", 85 QString filename = Global::applicationFileName("addressbook",
86 "businesscard.vcf"); 86 "businesscard.vcf");
87 return filename; 87 return filename;
88} 88}
89 89
90 90
91AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, 91AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
92 WFlags f ) 92 WFlags f )
93 : QMainWindow( parent, name, f ), 93 : QMainWindow( parent, name, f ),
94 abEditor(0), 94 abEditor(0),
95 bAbEditFirstTime(TRUE), 95 bAbEditFirstTime(TRUE),
96 syncing(FALSE) 96 syncing(FALSE)
97{ 97{
98 isLoading = true; 98 isLoading = true;
99 99
100 initFields(); 100 initFields();
101 101
102 setCaption( tr("Contacts") ); 102 setCaption( tr("Contacts") );
103 setIcon( Resource::loadPixmap( "AddressBook" ) ); 103 setIcon( Resource::loadPixmap( "AddressBook" ) );
104 104
105 setToolBarsMovable( FALSE ); 105 setToolBarsMovable( FALSE );
106 106
107 // Create Toolbars 107 // Create Toolbars
108 108
109 QPEToolBar *bar = new QPEToolBar( this ); 109 QPEToolBar *bar = new QPEToolBar( this );
110 bar->setHorizontalStretchable( TRUE ); 110 bar->setHorizontalStretchable( TRUE );
111 111
112 QPEMenuBar *mbList = new QPEMenuBar( bar ); 112 QPEMenuBar *mbList = new QPEMenuBar( bar );
113 mbList->setMargin( 0 ); 113 mbList->setMargin( 0 );
114 114
115 QPopupMenu *edit = new QPopupMenu( this ); 115 QPopupMenu *edit = new QPopupMenu( this );
116 mbList->insertItem( tr( "Contact" ), edit ); 116 mbList->insertItem( tr( "Contact" ), edit );
117 117
118 listTools = new QPEToolBar( this, "list operations" ); 118 listTools = new QPEToolBar( this, "list operations" );
119 119
120 120
121 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 121 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null,
122 0, this, 0 ); 122 0, this, 0 );
123 actionNew = a; 123 actionNew = a;
124 connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); 124 connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) );
125 a->addTo( edit ); 125 a->addTo( edit );
126 a->addTo( listTools ); 126 a->addTo( listTools );
127 127
128 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, 128 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null,
129 0, this, 0 ); 129 0, this, 0 );
130 actionEdit = a; 130 actionEdit = a;
131 connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); 131 connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) );
132 a->addTo( edit ); 132 a->addTo( edit );
133 a->addTo( listTools ); 133 a->addTo( listTools );
134 134
135 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 135 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null,
136 0, this, 0 ); 136 0, this, 0 );
137 actionTrash = a; 137 actionTrash = a;
138 connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); 138 connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) );
139 a->addTo( edit ); 139 a->addTo( edit );
140 a->addTo( listTools ); 140 a->addTo( listTools );
141 141
142 142
143 // make it possible to go directly to businesscard via qcop call 143 // make it possible to go directly to businesscard via qcop call
144#if defined(Q_WS_QWS) 144#if defined(Q_WS_QWS)
145#if !defined(QT_NO_COP) 145#if !defined(QT_NO_COP)
146 QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); 146 QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this );
147 connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), 147 connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)),
148 this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); 148 this, SLOT ( appMessage(const QCString &, const QByteArray &) ) );
149#endif 149#endif
150#endif 150#endif
151 151
152 152
153 153
154 154
155 155
156#ifndef MAKE_FOR_SHARP_ROM 156#ifndef MAKE_FOR_SHARP_ROM
157 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), 157 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ),
158 QString::null, 0, this, 0 ); 158 QString::null, 0, this, 0 );
159 actionFind = a; 159 actionFind = a;
160 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); 160 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) );
161 a->addTo( edit ); 161 a->addTo( edit );
162 a->addTo( listTools ); 162 a->addTo( listTools );
163#endif 163#endif
164 164
165 165
166 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), 166 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ),
167 QString::null, 0, this, 0 ); 167 QString::null, 0, this, 0 );
168 //a->setEnabled( FALSE ); we got support for it now :) zecke 168 //a->setEnabled( FALSE ); we got support for it now :) zecke
169 actionMail = a; 169 actionMail = a;
170 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); 170 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) );
171 a->addTo( edit ); 171 a->addTo( edit );
172 a->addTo( listTools ); 172 a->addTo( listTools );
173 173
174 174
175 175
176 if ( Ir::supported() ) { 176 if ( Ir::supported() ) {
177 a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, 177 a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null,
178 0, this, 0 ); 178 0, this, 0 );
179 actionBeam = a; 179 actionBeam = a;
180 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); 180 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) );
181 a->addTo( edit ); 181 a->addTo( edit );
182 a->addTo( listTools ); 182 a->addTo( listTools );
183 } 183 }
184 184
185 edit->insertSeparator(); 185 edit->insertSeparator();
186 186
187 a = new QAction( tr("Import vCard"), QString::null, 0, 0, 0, TRUE ); 187 a = new QAction( tr("Import vCard"), QString::null, 0, 0, 0, TRUE );
188 actionPersonal = a; 188 actionPersonal = a;
189 connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); 189 connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) );
190 a->addTo( edit ); 190 a->addTo( edit );
191 191
192 edit->insertSeparator(); 192 edit->insertSeparator();
193 193
194 a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); 194 a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE );
195 actionPersonal = a; 195 actionPersonal = a;
196 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); 196 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) );
197 a->addTo( edit ); 197 a->addTo( edit );
198 198
199 199
200 a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); 200 a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 );
201 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); 201 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
202 a->addTo( edit ); 202 a->addTo( edit );
203 203
204 // Create Views 204 // Create Views
205 205
206 // This is safe to call without checking to see if it exists... 206 // This is safe to call without checking to see if it exists...
207 // not to mention it also does the necessary stuff for the 207 // not to mention it also does the necessary stuff for the
208 // journaling... 208 // journaling...
209 QString str = addressbookXMLFilename(); 209 QString str = addressbookXMLFilename();
210 if ( str.isNull() ) { 210 if ( str.isNull() ) {
211 QMessageBox::warning( 211 QMessageBox::warning(
212 this, 212 this,
213 tr("Out of Space"), 213 tr("Out of Space"),
214 tr("There is not enough space to create\n" 214 tr("There is not enough space to create\n"
215 "neccessary startup files.\n" 215 "neccessary startup files.\n"
216 "\nFree up some space before\nentering data!") 216 "\nFree up some space before\nentering data!")
217 ); 217 );
218 } 218 }
219 219
220 listContainer = new QWidget( this ); 220 listContainer = new QWidget( this );
221 221
222 QVBoxLayout *vb = new QVBoxLayout( listContainer ); 222 QVBoxLayout *vb = new QVBoxLayout( listContainer );
223 223
224 abList = new AbTable( &orderedFields, listContainer, "table" ); 224 abList = new AbTable( &orderedFields, listContainer, "table" );
225 vb->addWidget(abList); 225 vb->addWidget(abList);
226 // abList->setHScrollBarMode( QScrollView::AlwaysOff ); 226 // abList->setHScrollBarMode( QScrollView::AlwaysOff );
@@ -668,365 +668,366 @@ void AddressbookWindow::editEntry( EntryMode entryMode )
668 OContact entry; 668 OContact entry;
669 if ( bAbEditFirstTime ) { 669 if ( bAbEditFirstTime ) {
670 abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields, 670 abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields,
671 this, "editor" ); 671 this, "editor" );
672 bAbEditFirstTime = FALSE; 672 bAbEditFirstTime = FALSE;
673 if ( entryMode == EditEntry ) 673 if ( entryMode == EditEntry )
674 abEditor->setEntry( abList->currentEntry() ); 674 abEditor->setEntry( abList->currentEntry() );
675 } 675 }
676 // other things may chane the caption. 676 // other things may chane the caption.
677 abEditor->setCaption( tr("Edit Address") ); 677 abEditor->setCaption( tr("Edit Address") );
678 678
679#if defined(Q_WS_QWS) || defined(_WS_QWS_) 679#if defined(Q_WS_QWS) || defined(_WS_QWS_)
680 abEditor->showMaximized(); 680 abEditor->showMaximized();
681#endif 681#endif
682 // fix the foxus... 682 // fix the foxus...
683 abEditor->setNameFocus(); 683 abEditor->setNameFocus();
684 if ( abEditor->exec() ) { 684 if ( abEditor->exec() ) {
685 setFocus(); 685 setFocus();
686 if ( entryMode == NewEntry ) { 686 if ( entryMode == NewEntry ) {
687 OContact insertEntry = abEditor->entry(); 687 OContact insertEntry = abEditor->entry();
688 insertEntry.assignUid(); 688 insertEntry.assignUid();
689 abList->addEntry( insertEntry ); 689 abList->addEntry( insertEntry );
690 } else { 690 } else {
691 OContact replaceEntry = abEditor->entry(); 691 OContact replaceEntry = abEditor->entry();
692 if ( !replaceEntry.isValidUid() ) 692 if ( !replaceEntry.isValidUid() )
693 replaceEntry.assignUid(); 693 replaceEntry.assignUid();
694 abList->replaceCurrentEntry( replaceEntry ); 694 abList->replaceCurrentEntry( replaceEntry );
695 } 695 }
696 } 696 }
697 populateCategories(); 697 populateCategories();
698 showList(); 698 showList();
699} 699}
700 700
701void AddressbookWindow::listIsEmpty( bool empty ) 701void AddressbookWindow::listIsEmpty( bool empty )
702{ 702{
703 if ( !empty ) { 703 if ( !empty ) {
704 deleteButton->setEnabled( TRUE ); 704 deleteButton->setEnabled( TRUE );
705 } 705 }
706} 706}
707 707
708void AddressbookWindow::reload() 708void AddressbookWindow::reload()
709{ 709{
710 syncing = FALSE; 710 syncing = FALSE;
711 abList->clear(); 711 abList->clear();
712 abList->load( addressbookXMLFilename() ); 712 abList->load( addressbookXMLFilename() );
713} 713}
714 714
715void AddressbookWindow::flush() 715void AddressbookWindow::flush()
716{ 716{
717 syncing = TRUE; 717 syncing = TRUE;
718 abList->save( addressbookXMLFilename() ); 718 abList->save( addressbookXMLFilename() );
719} 719}
720 720
721 721
722void AddressbookWindow::closeEvent( QCloseEvent *e ) 722void AddressbookWindow::closeEvent( QCloseEvent *e )
723{ 723{
724 if ( centralWidget() == mView ) { 724 if ( centralWidget() == mView ) {
725 if (actionPersonal->isOn()) { 725 if (actionPersonal->isOn()) {
726 // pretend we clicked it off 726 // pretend we clicked it off
727 actionPersonal->setOn(FALSE); 727 actionPersonal->setOn(FALSE);
728 slotPersonalView(); 728 slotPersonalView();
729 } else { 729 } else {
730 showList(); 730 showList();
731 } 731 }
732 e->ignore(); 732 e->ignore();
733 return; 733 return;
734 } 734 }
735 735
736 if(syncing) { 736 if(syncing) {
737 /* shouldn't we save, I hear you say? well its already been set 737 /* shouldn't we save, I hear you say? well its already been set
738 so that an edit can not occur during a sync, and we flushed 738 so that an edit can not occur during a sync, and we flushed
739 at the start of the sync, so there is no need to save 739 at the start of the sync, so there is no need to save
740 Saving however itself would cause problems. */ 740 Saving however itself would cause problems. */
741 e->accept(); 741 e->accept();
742 return; 742 return;
743 } 743 }
744 //################## shouldn't always save 744 //################## shouldn't always save
745 // True, but the database handles this automatically ! (se) 745 // True, but the database handles this automatically ! (se)
746 if ( save() ) 746 if ( save() )
747 e->accept(); 747 e->accept();
748 else 748 else
749 e->ignore(); 749 e->ignore();
750} 750}
751 751
752/* 752/*
753 Returns TRUE if it is OK to exit 753 Returns TRUE if it is OK to exit
754*/ 754*/
755 755
756bool AddressbookWindow::save() 756bool AddressbookWindow::save()
757{ 757{
758 QString str = addressbookXMLFilename(); 758 QString str = addressbookXMLFilename();
759 if ( str.isNull() ) { 759 if ( str.isNull() ) {
760 if ( QMessageBox::critical( 0, tr("Out of space"), 760 if ( QMessageBox::critical( 0, tr("Out of space"),
761 tr("Unable to save information.\n" 761 tr("Unable to save information.\n"
762 "Free up some space\n" 762 "Free up some space\n"
763 "and try again.\n" 763 "and try again.\n"
764 "\nQuit anyway?"), 764 "\nQuit anyway?"),
765 QMessageBox::Yes|QMessageBox::Escape, 765 QMessageBox::Yes|QMessageBox::Escape,
766 QMessageBox::No|QMessageBox::Default ) 766 QMessageBox::No|QMessageBox::Default )
767 != QMessageBox::No ) 767 != QMessageBox::No )
768 return TRUE; 768 return TRUE;
769 else 769 else
770 return FALSE; 770 return FALSE;
771 } else { 771 } else {
772 if ( !abList->save( str ) ) { 772 if ( !abList->save( str ) ) {
773 if ( QMessageBox::critical( 0, tr( "Out of space" ), 773 if ( QMessageBox::critical( 0, tr( "Out of space" ),
774 tr("Unable to save information.\n" 774 tr("Unable to save information.\n"
775 "Free up some space\n" 775 "Free up some space\n"
776 "and try again.\n" 776 "and try again.\n"
777 "\nQuit anyway?"), 777 "\nQuit anyway?"),
778 QMessageBox::Yes|QMessageBox::Escape, 778 QMessageBox::Yes|QMessageBox::Escape,
779 QMessageBox::No|QMessageBox::Default ) 779 QMessageBox::No|QMessageBox::Default )
780 != QMessageBox::No ) 780 != QMessageBox::No )
781 return TRUE; 781 return TRUE;
782 else 782 else
783 return FALSE; 783 return FALSE;
784 } 784 }
785 } 785 }
786 return TRUE; 786 return TRUE;
787} 787}
788 788
789void AddressbookWindow::slotSettings() 789void AddressbookWindow::slotSettings()
790{ 790{
791 AddressSettings frmSettings( this ); 791 AddressSettings frmSettings( this );
792#if defined(Q_WS_QWS) || defined(_WS_QWS_) 792#if defined(Q_WS_QWS) || defined(_WS_QWS_)
793 frmSettings.showMaximized(); 793 frmSettings.showMaximized();
794#endif 794#endif
795 795
796 if ( frmSettings.exec() ) { 796 if ( frmSettings.exec() ) {
797 allFields.clear(); 797 allFields.clear();
798 orderedFields.clear(); 798 orderedFields.clear();
799 slOrderedFields.clear(); 799 slOrderedFields.clear();
800 initFields(); 800 initFields();
801 if ( abEditor ) 801 if ( abEditor )
802 abEditor->loadFields(); 802 abEditor->loadFields();
803 abList->refresh(); 803 abList->refresh();
804 } 804 }
805} 805}
806 806
807 807
808void AddressbookWindow::initFields() 808void AddressbookWindow::initFields()
809{ 809{
810 // we really don't need the things from the configuration, anymore 810 // we really don't need the things from the configuration, anymore
811 // only thing that is important are the important categories. So, 811 // only thing that is important are the important categories. So,
812 // Call the contact functions that correspond to these old functions... 812 // Call the contact functions that correspond to these old functions...
813 813
814 QStringList xmlFields = OContact::fields(); 814 QStringList xmlFields = OContact::fields();
815 QStringList visibleFields = OContact::untrfields(); 815 QStringList visibleFields = OContact::untrfields();
816 // QStringList trFields = OContact::trfields(); 816 // QStringList trFields = OContact::trfields();
817 817
818 xmlFields.remove( "Title" ); 818 xmlFields.remove( "Title" );
819 visibleFields.remove( "Name Title" ); 819 visibleFields.remove( "Name Title" );
820 visibleFields.remove( "Notes" ); 820 visibleFields.remove( "Notes" );
821 821
822 int i, version; 822 int i, version;
823 Config cfg( "AddressBook" ); 823 Config cfg( "AddressBook" );
824 QString zn; 824 QString zn;
825 825
826 // ### Write a function to keep this from happening again... 826 // ### Write a function to keep this from happening again...
827 QStringList::ConstIterator it; 827 QStringList::ConstIterator it;
828 for ( i = 0, it = xmlFields.begin(); it != xmlFields.end(); ++it, i++ ) { 828 for ( i = 0, it = xmlFields.begin(); it != xmlFields.end(); ++it, i++ ) {
829 allFields.append( i + 3 ); 829 allFields.append( i + 3 );
830 } 830 }
831 831
832 cfg.setGroup( "Version" ); 832 cfg.setGroup( "Version" );
833 version = cfg.readNumEntry( "version" ); 833 version = cfg.readNumEntry( "version" );
834 i = 0; 834 i = 0;
835 startFontSize = 1; 835 startFontSize = 1;
836 836
837 if ( version >= ADDRESSVERSION ) { 837 if ( version >= ADDRESSVERSION ) {
838 838
839 cfg.setGroup( "ImportantCategory" ); 839 cfg.setGroup( "ImportantCategory" );
840 840
841 zn = cfg.readEntry( "Category" + QString::number(i), QString::null ); 841 zn = cfg.readEntry( "Category" + QString::number(i), QString::null );
842 while ( !zn.isNull() ) { 842 while ( !zn.isNull() ) {
843 if ( zn.contains( "Work" ) || zn.contains( "Mb" ) ) { 843 if ( zn.contains( "Work" ) || zn.contains( "Mb" ) ) {
844 slOrderedFields.clear(); 844 slOrderedFields.clear();
845 break; 845 break;
846 } 846 }
847 slOrderedFields.append( zn ); 847 slOrderedFields.append( zn );
848 zn = cfg.readEntry( "Category" + QString::number(++i), QString::null ); 848 zn = cfg.readEntry( "Category" + QString::number(++i), QString::null );
849 } 849 }
850 cfg.setGroup( "Font" ); 850 cfg.setGroup( "Font" );
851 startFontSize = cfg.readNumEntry( "fontSize", 1 ); 851 startFontSize = cfg.readNumEntry( "fontSize", 1 );
852 852
853 853
854 } else { 854 } else {
855 QString str; 855 QString str;
856 str = getenv("HOME"); 856 str = getenv("HOME");
857 str += "/Settings/AddressBook.conf"; 857 str += "/Settings/AddressBook.conf";
858 QFile::remove( str ); 858 QFile::remove( str );
859 } 859 }
860
860 if ( slOrderedFields.count() > 0 ) { 861 if ( slOrderedFields.count() > 0 ) {
861 for( QStringList::ConstIterator it = slOrderedFields.begin(); 862 for( QStringList::ConstIterator it = slOrderedFields.begin();
862 it != slOrderedFields.end(); ++it ) { 863 it != slOrderedFields.end(); ++it ) {
863 QValueList<int>::ConstIterator itVl; 864 QValueList<int>::ConstIterator itVl;
864 QStringList::ConstIterator itVis; 865 QStringList::ConstIterator itVis;
865 itVl = allFields.begin(); 866 itVl = allFields.begin();
866 for ( itVis = visibleFields.begin(); 867 for ( itVis = visibleFields.begin();
867 itVis != visibleFields.end() && itVl != allFields.end(); 868 itVis != visibleFields.end() && itVl != allFields.end();
868 ++itVis, ++itVl ) { 869 ++itVis, ++itVl ) {
869 if ( *it == *itVis && itVl != allFields.end() ) { 870 if ( *it == *itVis && itVl != allFields.end() ) {
870 orderedFields.append( *itVl ); 871 orderedFields.append( *itVl );
871 } 872 }
872 } 873 }
873 } 874 }
874 } else { 875 } else {
875 QValueList<int>::ConstIterator it; 876 QValueList<int>::ConstIterator it;
876 for ( it = allFields.begin(); it != allFields.end(); ++it ) 877 for ( it = allFields.begin(); it != allFields.end(); ++it )
877 orderedFields.append( *it ); 878 orderedFields.append( *it );
878 879
879 slOrderedFields = visibleFields; 880 slOrderedFields = visibleFields;
880 orderedFields.remove( Qtopia::AddressUid ); 881 orderedFields.remove( Qtopia::AddressUid );
881 orderedFields.remove( Qtopia::Title ); 882 orderedFields.remove( Qtopia::Title );
882 orderedFields.remove( Qtopia::Groups ); 883 orderedFields.remove( Qtopia::Groups );
883 orderedFields.remove( Qtopia::AddressCategory ); 884 orderedFields.remove( Qtopia::AddressCategory );
884 orderedFields.remove( Qtopia::FirstName ); 885 orderedFields.remove( Qtopia::FirstName );
885 orderedFields.remove( Qtopia::LastName ); 886 orderedFields.remove( Qtopia::LastName );
886 orderedFields.remove( Qtopia::DefaultEmail ); 887 orderedFields.remove( Qtopia::DefaultEmail );
887 orderedFields.remove( Qtopia::FileAs ); 888 orderedFields.remove( Qtopia::FileAs );
888 orderedFields.remove( Qtopia::Notes ); 889 orderedFields.remove( Qtopia::Notes );
889 orderedFields.remove( Qtopia::Gender ); 890 orderedFields.remove( Qtopia::Gender );
890 slOrderedFields.remove( "Name Title" ); 891 slOrderedFields.remove( "Name Title" );
891 slOrderedFields.remove( "First Name" ); 892 slOrderedFields.remove( "First Name" );
892 slOrderedFields.remove( "Last Name" ); 893 slOrderedFields.remove( "Last Name" );
893 slOrderedFields.remove( "File As" ); 894 slOrderedFields.remove( "File As" );
894 slOrderedFields.remove( "Default Email" ); 895 slOrderedFields.remove( "Default Email" );
895 slOrderedFields.remove( "Notes" ); 896 slOrderedFields.remove( "Notes" );
896 slOrderedFields.remove( "Gender" ); 897 slOrderedFields.remove( "Gender" );
897 898
898 } 899 }
899} 900}
900 901
901 902
902AbLabel *AddressbookWindow::abView() 903AbLabel *AddressbookWindow::abView()
903{ 904{
904 if ( !mView ) { 905 if ( !mView ) {
905 mView = new AbLabel( this, "viewer" ); 906 mView = new AbLabel( this, "viewer" );
906 mView->init( OContact() ); 907 mView->init( OContact() );
907 connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); 908 connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) );
908 } 909 }
909 return mView; 910 return mView;
910} 911}
911 912
912void AddressbookWindow::slotFind() 913void AddressbookWindow::slotFind()
913{ 914{
914#ifndef MAKE_FOR_SHARP_ROM 915#ifndef MAKE_FOR_SHARP_ROM
915 if ( centralWidget() == abView() ) 916 if ( centralWidget() == abView() )
916 showList(); 917 showList();
917 918
918 FindDialog frmFind( "Contacts", this ); 919 FindDialog frmFind( "Contacts", this );
919 QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int))); 920 QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int)));
920 QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) ); 921 QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) );
921 QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) ); 922 QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) );
922 923
923 frmFind.exec(); 924 frmFind.exec();
924 925
925 if ( abList->numSelections() ) 926 if ( abList->numSelections() )
926 abList->clearSelection(); 927 abList->clearSelection();
927 928
928 abList->clearFindRow(); 929 abList->clearFindRow();
929#endif 930#endif
930} 931}
931 932
932void AddressbookWindow::slotSetCategory( int c ) 933void AddressbookWindow::slotSetCategory( int c )
933{ 934{
934 935
935 QString cat, book; 936 QString cat, book;
936 937
937 if ( c <= 0 ) 938 if ( c <= 0 )
938 return; 939 return;
939 940
940 // Checkmark Book Menu Item Selected 941 // Checkmark Book Menu Item Selected
941 if ( c < 6 ) 942 if ( c < 6 )
942 for ( unsigned int i = 1; i < 6; i++ ) 943 for ( unsigned int i = 1; i < 6; i++ )
943 catMenu->setItemChecked( i, c == (int)i ); 944 catMenu->setItemChecked( i, c == (int)i );
944 945
945 // Checkmark Category Menu Item Selected 946 // Checkmark Category Menu Item Selected
946 else 947 else
947 for ( unsigned int i = 6; i < catMenu->count(); i++ ) 948 for ( unsigned int i = 6; i < catMenu->count(); i++ )
948 catMenu->setItemChecked( i, c == (int)i ); 949 catMenu->setItemChecked( i, c == (int)i );
949 950
950 for ( unsigned int i = 1; i < catMenu->count(); i++ ) { 951 for ( unsigned int i = 1; i < catMenu->count(); i++ ) {
951 if (catMenu->isItemChecked( i )) { 952 if (catMenu->isItemChecked( i )) {
952 if ( i == 1 ) // default List view 953 if ( i == 1 ) // default List view
953 book = QString::null; 954 book = QString::null;
954 else if ( i == 2 ) 955 else if ( i == 2 )
955 book = "Phone"; 956 book = "Phone";
956 else if ( i == 3 ) 957 else if ( i == 3 )
957 book = "Company"; 958 book = "Company";
958 else if ( i == 4 ) 959 else if ( i == 4 )
959 book = "Email"; 960 book = "Email";
960 else if ( i == 5 ) 961 else if ( i == 5 )
961 book = "Cards"; 962 book = "Cards";
962 else if ( i == 6 ) // default All Categories 963 else if ( i == 6 ) // default All Categories
963 cat = QString::null; 964 cat = QString::null;
964 else if ( i == (unsigned int)catMenu->count() ) // last menu option will be Unfiled 965 else if ( i == (unsigned int)catMenu->count() ) // last menu option will be Unfiled
965 cat = "Unfiled"; 966 cat = "Unfiled";
966 else 967 else
967 cat = abList->categories()[i - 7]; 968 cat = abList->categories()[i - 7];
968 } 969 }
969 } 970 }
970 971
971 abList->setShowCategory( book, cat ); 972 abList->setShowCategory( book, cat );
972 973
973 if ( book.isEmpty() ) 974 if ( book.isEmpty() )
974 book = "List"; 975 book = "List";
975 if ( cat.isEmpty() ) 976 if ( cat.isEmpty() )
976 cat = "All"; 977 cat = "All";
977 978
978 setCaption( tr( "Contacts" ) + " - " + tr( book ) + " - " + tr( cat ) ); 979 setCaption( tr( "Contacts" ) + " - " + tr( book ) + " - " + tr( cat ) );
979} 980}
980 981
981void AddressbookWindow::slotSetLetter( char c ) { 982void AddressbookWindow::slotSetLetter( char c ) {
982 983
983 abList->setShowByLetter( c ); 984 abList->setShowByLetter( c );
984 985
985} 986}
986 987
987void AddressbookWindow::populateCategories() 988void AddressbookWindow::populateCategories()
988{ 989{
989 catMenu->clear(); 990 catMenu->clear();
990 991
991 int id, rememberId; 992 int id, rememberId;
992 id = 1; 993 id = 1;
993 rememberId = 0; 994 rememberId = 0;
994 995
995 catMenu->insertItem( tr( "List" ), id++ ); 996 catMenu->insertItem( tr( "List" ), id++ );
996 catMenu->insertItem( tr( "Phone Book" ), id++ ); 997 catMenu->insertItem( tr( "Phone Book" ), id++ );
997 catMenu->insertItem( tr( "Company Book" ), id++ ); 998 catMenu->insertItem( tr( "Company Book" ), id++ );
998 catMenu->insertItem( tr( "Email Book" ), id++ ); 999 catMenu->insertItem( tr( "Email Book" ), id++ );
999 catMenu->insertItem( tr( "Cards" ), id++ ); 1000 catMenu->insertItem( tr( "Cards" ), id++ );
1000 catMenu->insertSeparator(); 1001 catMenu->insertSeparator();
1001 1002
1002 catMenu->insertItem( tr( "All" ), id++ ); 1003 catMenu->insertItem( tr( "All" ), id++ );
1003 QStringList categories = abList->categories(); 1004 QStringList categories = abList->categories();
1004 categories.append( tr( "Unfiled" ) ); 1005 categories.append( tr( "Unfiled" ) );
1005 for ( QStringList::Iterator it = categories.begin(); 1006 for ( QStringList::Iterator it = categories.begin();
1006 it != categories.end(); ++it ) { 1007 it != categories.end(); ++it ) {
1007 catMenu->insertItem( *it, id ); 1008 catMenu->insertItem( *it, id );
1008 if ( *it == abList->showCategory() ) 1009 if ( *it == abList->showCategory() )
1009 rememberId = id; 1010 rememberId = id;
1010 ++id; 1011 ++id;
1011 } 1012 }
1012 1013
1013 if ( abList->showBook().isEmpty() ) { 1014 if ( abList->showBook().isEmpty() ) {
1014 catMenu->setItemChecked( 1, true ); 1015 catMenu->setItemChecked( 1, true );
1015 } else if ( abList->showBook() == "Phone" ) { 1016 } else if ( abList->showBook() == "Phone" ) {
1016 catMenu->setItemChecked( 2, true ); 1017 catMenu->setItemChecked( 2, true );
1017 } else if ( abList->showBook() == "Company" ) { 1018 } else if ( abList->showBook() == "Company" ) {
1018 catMenu->setItemChecked( 3, true ); 1019 catMenu->setItemChecked( 3, true );
1019 } else if ( abList->showBook() == "Email" ) { 1020 } else if ( abList->showBook() == "Email" ) {
1020 catMenu->setItemChecked( 4, true ); 1021 catMenu->setItemChecked( 4, true );
1021 } else if ( abList->showBook() == "Cards" ) { 1022 } else if ( abList->showBook() == "Cards" ) {
1022 catMenu->setItemChecked( 5, true ); 1023 catMenu->setItemChecked( 5, true );
1023 } 1024 }
1024 1025
1025 if ( abList->showCategory().isEmpty() ) { 1026 if ( abList->showCategory().isEmpty() ) {
1026 slotSetCategory( 6 ); 1027 slotSetCategory( 6 );
1027 } 1028 }
1028 else { 1029 else {
1029 slotSetCategory( rememberId ); 1030 slotSetCategory( rememberId );
1030 } 1031 }
1031} 1032}
1032 1033
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index b01583f..bae3a2b 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -1,381 +1,395 @@
1/* 1/*
2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> 2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org>
3 * 3 *
4 * This file is an add-on for the OPIE Palmtop Environment 4 * This file is an add-on for the OPIE Palmtop Environment
5 * 5 *
6 * This file may be distributed and/or modified under the terms of the 6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software 7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging 8 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging
9 * of this file. 9 * of this file.
10 * 10 *
11 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 * 13 *
14 * 14 *
15 * This is a rewrite of the abeditor.h file, modified to provide a more 15 * This is a rewrite of the abeditor.h file, modified to provide a more
16 * intuitive interface to TrollTech's original Address Book editor. This 16 * intuitive interface to TrollTech's original Address Book editor. This
17 * is made to operate exactly in interface with the exception of name. 17 * is made to operate exactly in interface with the exception of name.
18 * 18 *
19 */ 19 */
20 20
21#include "contacteditor.h" 21#include "contacteditor.h"
22#include "addresspicker.h" 22#include "addresspicker.h"
23 23
24#include <qpe/categoryselect.h> 24#include <qpe/categoryselect.h>
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#include <qpe/qpedialog.h> 26#include <qpe/qpedialog.h>
27 27
28#include <qcombobox.h> 28#include <qcombobox.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qtabwidget.h> 30#include <qtabwidget.h>
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qlineedit.h> 32#include <qlineedit.h>
33#include <qmultilineedit.h> 33#include <qmultilineedit.h>
34#include <qscrollview.h> 34#include <qscrollview.h>
35#include <qtoolbutton.h> 35#include <qtoolbutton.h>
36#include <qpushbutton.h> 36#include <qpushbutton.h>
37#include <qmainwindow.h> 37#include <qmainwindow.h>
38#include <qvaluelist.h> 38#include <qvaluelist.h>
39 39
40static inline bool containsAlphaNum( const QString &str ); 40static inline bool containsAlphaNum( const QString &str );
41static inline bool constainsWhiteSpace( const QString &str ); 41static inline bool constainsWhiteSpace( const QString &str );
42 42
43// helper functions, convert our comma delimited list to proper 43// helper functions, convert our comma delimited list to proper
44// file format... 44// file format...
45void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 45void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
46 QString &strAll ); 46 QString &strAll );
47 47
48// helper convert from file format to comma delimited... 48// helper convert from file format to comma delimited...
49void parseEmailTo( const QString &strDefaultEmail, 49void parseEmailTo( const QString &strDefaultEmail,
50 const QString &strOtherEmail, QString &strBack ); 50 const QString &strOtherEmail, QString &strBack );
51 51
52 ContactEditor::ContactEditor(const OContact &entry, 52 ContactEditor::ContactEditor(const OContact &entry,
53 const QValueList<int> *newOrderedValues, 53 const QValueList<int> *newOrderedValues,
54 QStringList *slNewOrdered, 54 QStringList *slNewOrdered,
55 QWidget *parent, 55 QWidget *parent,
56 const char *name, 56 const char *name,
57 WFlags fl ) 57 WFlags fl )
58 : QDialog( parent, name, TRUE, fl ), 58 : QDialog( parent, name, TRUE, fl ),
59 orderedValues( newOrderedValues ), 59 orderedValues( newOrderedValues ),
60 slOrdered( *slNewOrdered ) 60 slOrdered( *slNewOrdered )
61{ 61{
62 62
63 init(); 63 init();
64 initMap(); 64 initMap();
65 setEntry( entry ); 65 setEntry( entry );
66 qDebug("finish"); 66 qDebug("finish");
67} 67}
68 68
69ContactEditor::~ContactEditor() { 69ContactEditor::~ContactEditor() {
70} 70}
71 71
72void ContactEditor::init() { 72void ContactEditor::init() {
73 73
74 useFullName = TRUE; 74 useFullName = TRUE;
75 75
76 int i = 0; 76 int i = 0;
77/** SHut up and stop leaking 77/** SHut up and stop leaking
78 slHomeAddress = new QStringList; 78 slHomeAddress = new QStringList;
79 slBusinessAddress = new QStringList; 79 slBusinessAddress = new QStringList;
80 slChooserNames = new QStringList; 80 slChooserNames = new QStringList;
81 slChooserValues = new QStringList; 81 slChooserValues = new QStringList;
82 82
83 slDynamicEntries = new QStringList; 83 slDynamicEntries = new QStringList;
84*/ 84*/
85 //*slDynamicEntries = *slOrdered; 85 //*slDynamicEntries = *slOrdered;
86 86
87 QStringList trlChooserNames;
88
87 for (i = 0; i <= 6; i++) { 89 for (i = 0; i <= 6; i++) {
88 slHomeAddress.append( "" ); 90 slHomeAddress.append( "" );
89 slBusinessAddress.append( "" ); 91 slBusinessAddress.append( "" );
90 } 92 }
91 93
92 { 94 {
93 hasGender = FALSE; 95 hasGender = FALSE;
94 hasTitle = FALSE; 96 hasTitle = FALSE;
95 hasCompany = FALSE; 97 hasCompany = FALSE;
96 hasNotes = FALSE; 98 hasNotes = FALSE;
97 hasStreet = FALSE; 99 hasStreet = FALSE;
98 hasStreet2 = FALSE; 100 hasStreet2 = FALSE;
99 hasPOBox = FALSE; 101 hasPOBox = FALSE;
100 hasCity = FALSE; 102 hasCity = FALSE;
101 hasState = FALSE; 103 hasState = FALSE;
102 hasZip = FALSE; 104 hasZip = FALSE;
103 hasCountry = FALSE; 105 hasCountry = FALSE;
104 106
105 QStringList::ConstIterator it = slOrdered.begin(); 107 QStringList::ConstIterator it = slOrdered.begin();
108
106 for ( i = 0; it != slOrdered.end(); i++, ++it ) { 109 for ( i = 0; it != slOrdered.end(); i++, ++it ) {
107 110
108 if ( (*it) == "Business Fax" ) { 111 if ( (*it) == "Business Fax" ) {
109 slChooserNames.append( tr( "Business Fax" ) ); 112 trlChooserNames.append( tr( "Business Fax" ) );
113 slChooserNames.append( *it );
110 slChooserValues.append("" ); 114 slChooserValues.append("" );
111 //slDynamicEntries->remove( it ); 115 //slDynamicEntries->remove( it );
112 continue; 116 continue;
113 } 117 }
114 118
115 if ( (*it) == "Home Fax" ) { 119 if ( (*it) == "Home Fax" ) {
116 slChooserNames.append( tr( "Home Fax" ) ); 120 trlChooserNames.append( tr( "Home Fax" ) );
121 slChooserNames.append( *it );
117 slChooserValues.append("" ); 122 slChooserValues.append("" );
118 //slDynamicEntries->remove( it ); 123 //slDynamicEntries->remove( it );
119 continue; 124 continue;
120 } 125 }
121 126
122 127
123 if ( (*it) == "Business Phone" ) { 128 if ( (*it) == "Business Phone" ) {
124 slChooserNames.append( tr( "Business Phone" ) ); 129 trlChooserNames.append( tr( "Business Phone" ) );
130 slChooserNames.append( *it );
125 slChooserValues.append( "" ); 131 slChooserValues.append( "" );
126 //slDynamicEntries->remove( it ); 132 //slDynamicEntries->remove( it );
127 continue; 133 continue;
128 } 134 }
129 135
130 if ( (*it) == "Home Phone" ) { 136 if ( (*it) == "Home Phone" ) {
131 slChooserNames.append( tr( "Home Phone" ) ); 137 trlChooserNames.append( tr( "Home Phone" ) );
138 slChooserNames.append( *it );
132 slChooserValues.append( "" ); 139 slChooserValues.append( "" );
133 //slDynamicEntries->remove( it ); 140 //slDynamicEntries->remove( it );
134 continue; 141 continue;
135 } 142 }
136 143
137/* 144/*
138 if ( (*it).right( 2 ) == tr( "IM" ) ) { 145 if ( (*it).right( 2 ) == tr( "IM" ) ) {
139 slChooserNames.append( *it ); 146 slChooserNames.append( *it );
140 slChooserValues.append( "" ); 147 slChooserValues.append( "" );
141 //slDynamicEntries->remove( it ); 148 //slDynamicEntries->remove( it );
142 continue; 149 continue;
143 } */ 150 } */
144 151
145 if ( (*it) == "Business Mobile" ) { 152 if ( (*it) == "Business Mobile" ) {
146 slChooserNames.append( tr( "Business Mobile" ) ); 153 trlChooserNames.append( tr( "Business Mobile" ) );
154 slChooserNames.append( *it );
147 slChooserValues.append( "" ); 155 slChooserValues.append( "" );
148 //slDynamicEntries->remove( it ); 156 //slDynamicEntries->remove( it );
149 continue; 157 continue;
150 } 158 }
151 159
152 if ( (*it) == "Home Mobile" ) { 160 if ( (*it) == "Home Mobile" ) {
153 slChooserNames.append( tr( "Home Mobile" ) ); 161 trlChooserNames.append( tr( "Home Mobile" ) );
162 slChooserNames.append( *it );
154 slChooserValues.append( "" ); 163 slChooserValues.append( "" );
155 //slDynamicEntries->remove( it ); 164 //slDynamicEntries->remove( it );
156 continue; 165 continue;
157 } 166 }
158 167
159 168
160 if ( (*it) == "Business WebPage" ) { 169 if ( (*it) == "Business WebPage" ) {
161 slChooserNames.append( tr( "Business WebPage" ) ); 170 trlChooserNames.append( tr( "Business WebPage" ) );
171 slChooserNames.append( *it );
162 slChooserValues.append( "" ); 172 slChooserValues.append( "" );
163 //slDynamicEntries->remove( it ); 173 //slDynamicEntries->remove( it );
164 continue; 174 continue;
165 } 175 }
166 176
167 if ( (*it) == "Home Web Page" ) { 177 if ( (*it) == "Home Web Page" ) {
168 slChooserNames.append( tr( "Home Web Page" ) ); 178 trlChooserNames.append( tr( "Home Web Page" ) );
179 slChooserNames.append( *it );
169 slChooserValues.append( "" ); 180 slChooserValues.append( "" );
170 //slDynamicEntries->remove( it ); 181 //slDynamicEntries->remove( it );
171 continue; 182 continue;
172 } 183 }
173 184
174 if ( (*it) == "Business Pager" ) { 185 if ( (*it) == "Business Pager" ) {
175 slChooserNames.append( tr( "Business Pager" ) ); 186 trlChooserNames.append( tr( "Business Pager" ) );
187 slChooserNames.append( *it );
176 slChooserValues.append( "" ); 188 slChooserValues.append( "" );
177 //slDynamicEntries->remove( it ); 189 //slDynamicEntries->remove( it );
178 continue; 190 continue;
179 } 191 }
180 192
181 if ( *it == "Default Email" ) { 193 if ( *it == "Default Email" ) {
182 slChooserNames.append( tr( "Default Email" ) ); 194 trlChooserNames.append( tr( "Default Email" ) );
195 slChooserNames.append( *it );
183 slChooserValues.append( "" ); 196 slChooserValues.append( "" );
184 //slDynamicEntries->remove( it ); 197 //slDynamicEntries->remove( it );
185 continue; 198 continue;
186 } 199 }
187 200
188 if ( *it == "Emails" ) { 201 if ( *it == "Emails" ) {
189 slChooserNames.append( tr( "Emails" ) ); 202 trlChooserNames.append( tr( "Emails" ) );
203 slChooserNames.append( *it );
190 slChooserValues.append( "" ); 204 slChooserValues.append( "" );
191 //slDynamicEntries->remove( it ); 205 //slDynamicEntries->remove( it );
192 continue; 206 continue;
193 } 207 }
194 208
195 if ( *it == "Name Title" || *it == "First Name" || *it == "Middle Name" || *it == "Last Name" || *it == "File As" || *it == "Default Email" || *it == "Emails" || *it == "Groups" ) 209 if ( *it == "Name Title" || *it == "First Name" || *it == "Middle Name" || *it == "Last Name" || *it == "File As" || *it == "Default Email" || *it == "Emails" || *it == "Groups" )
196 continue; 210 continue;
197 211
198 if ( *it == "Name Title" ) { 212 if ( *it == "Name Title" ) {
199 //slDynamicEntries->remove( it ); 213 //slDynamicEntries->remove( it );
200 continue; 214 continue;
201 } 215 }
202 216
203 if ( *it == "First Name" ) { 217 if ( *it == "First Name" ) {
204 //slDynamicEntries->remove( it ); 218 //slDynamicEntries->remove( it );
205 continue; 219 continue;
206 } 220 }
207 221
208 if ( *it == "Middle Name" ) { 222 if ( *it == "Middle Name" ) {
209 //slDynamicEntries->remove( it ); 223 //slDynamicEntries->remove( it );
210 continue; 224 continue;
211 } 225 }
212 226
213 if ( *it == "Last Name" ) { 227 if ( *it == "Last Name" ) {
214 //slDynamicEntries->remove( it ); 228 //slDynamicEntries->remove( it );
215 continue; 229 continue;
216 } 230 }
217 231
218 if ( *it == "Suffix" ) { 232 if ( *it == "Suffix" ) {
219 //slDynamicEntries->remove( it ); 233 //slDynamicEntries->remove( it );
220 continue; 234 continue;
221 } 235 }
222 236
223 if ( *it == "File As" ) { 237 if ( *it == "File As" ) {
224 //slDynamicEntries->remove( it ); 238 //slDynamicEntries->remove( it );
225 continue; 239 continue;
226 } 240 }
227 241
228 if ( *it == "Gender" ) { 242 if ( *it == "Gender" ) {
229 hasGender = TRUE; 243 hasGender = TRUE;
230 //slDynamicEntries->remove( it ); 244 //slDynamicEntries->remove( it );
231 continue; 245 continue;
232 } 246 }
233 247
234 if ( *it == "Job Title" ) { 248 if ( *it == "Job Title" ) {
235 hasTitle = TRUE; 249 hasTitle = TRUE;
236 //slDynamicEntries->remove( it ); 250 //slDynamicEntries->remove( it );
237 continue; 251 continue;
238 } 252 }
239 253
240 if ( ( *it == "Company") || (*it == "Organization" ) ) { 254 if ( ( *it == "Company") || (*it == "Organization" ) ) {
241 hasCompany = TRUE; 255 hasCompany = TRUE;
242 //slDynamicEntries->remove( it ); 256 //slDynamicEntries->remove( it );
243 continue; 257 continue;
244 } 258 }
245 259
246 if ( *it == "Notes" ) { 260 if ( *it == "Notes" ) {
247 hasNotes = TRUE; 261 hasNotes = TRUE;
248 //slDynamicEntries->remove( it ); 262 //slDynamicEntries->remove( it );
249 continue; 263 continue;
250 } 264 }
251 265
252 if ( *it == "Groups" ) { 266 if ( *it == "Groups" ) {
253 //slDynamicEntries->remove( it ); 267 //slDynamicEntries->remove( it );
254 continue; 268 continue;
255 } 269 }
256 270
257 if ( (*it) == "Business Street" ) { 271 if ( (*it) == "Business Street" ) {
258 hasStreet = TRUE; 272 hasStreet = TRUE;
259 //slDynamicEntries->remove( it ); 273 //slDynamicEntries->remove( it );
260 continue; 274 continue;
261 } 275 }
262 276
263 if ( (*it) == "Home Street" ) { 277 if ( (*it) == "Home Street" ) {
264 hasStreet = TRUE; 278 hasStreet = TRUE;
265 //slDynamicEntries->remove( it ); 279 //slDynamicEntries->remove( it );
266 continue; 280 continue;
267 } 281 }
268/* 282/*
269 if ( (*it).right( 8 ) == tr( "Street 2" ) ) { 283 if ( (*it).right( 8 ) == tr( "Street 2" ) ) {
270 hasStreet2 = TRUE; 284 hasStreet2 = TRUE;
271 //slDynamicEntries->remove( it ); 285 //slDynamicEntries->remove( it );
272 continue; 286 continue;
273 } 287 }
274 288
275 if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { 289 if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) {
276 hasPOBox = TRUE; 290 hasPOBox = TRUE;
277 //slDynamicEntries->remove( it ); 291 //slDynamicEntries->remove( it );
278 continue; 292 continue;
279 } */ 293 } */
280 294
281 if ( (*it) == "Business City" ) { 295 if ( (*it) == "Business City" ) {
282 hasCity = TRUE; 296 hasCity = TRUE;
283 //slDynamicEntries->remove( it ); 297 //slDynamicEntries->remove( it );
284 continue; 298 continue;
285 } 299 }
286 300
287 if ( (*it) == "Business State" ) { 301 if ( (*it) == "Business State" ) {
288 hasState = TRUE; 302 hasState = TRUE;
289 //slDynamicEntries->remove( it ); 303 //slDynamicEntries->remove( it );
290 continue; 304 continue;
291 } 305 }
292 306
293 if ( (*it) == "Business Zip" ) { 307 if ( (*it) == "Business Zip" ) {
294 hasZip = TRUE; 308 hasZip = TRUE;
295 //slDynamicEntries->remove( it ); 309 //slDynamicEntries->remove( it );
296 continue; 310 continue;
297 } 311 }
298 312
299 if ( (*it) == "Business Country" ) { 313 if ( (*it) == "Business Country" ) {
300 hasCountry = TRUE; 314 hasCountry = TRUE;
301 //slDynamicEntries->remove( it ); 315 //slDynamicEntries->remove( it );
302 continue; 316 continue;
303 } 317 }
304 318
305 if ( (*it) == "Home City" ) { 319 if ( (*it) == "Home City" ) {
306 hasCity = TRUE; 320 hasCity = TRUE;
307 //slDynamicEntries->remove( it ); 321 //slDynamicEntries->remove( it );
308 continue; 322 continue;
309 } 323 }
310 324
311 if ( (*it) == "Home State" ) { 325 if ( (*it) == "Home State" ) {
312 hasState = TRUE; 326 hasState = TRUE;
313 //slDynamicEntries->remove( it ); 327 //slDynamicEntries->remove( it );
314 continue; 328 continue;
315 } 329 }
316 330
317 if ( (*it) == "Home Zip" ) { 331 if ( (*it) == "Home Zip" ) {
318 hasZip = TRUE; 332 hasZip = TRUE;
319 //slDynamicEntries->remove( it ); 333 //slDynamicEntries->remove( it );
320 continue; 334 continue;
321 } 335 }
322 336
323 if ( (*it) == "Home Country" ) { 337 if ( (*it) == "Home Country" ) {
324 hasCountry = TRUE; 338 hasCountry = TRUE;
325 //slDynamicEntries->remove( it ); 339 //slDynamicEntries->remove( it );
326 continue; 340 continue;
327 } 341 }
328 342
329 343
330 slDynamicEntries.append( *it ); 344 slDynamicEntries.append( *it );
331 } 345 }
332 } 346 }
333 347
334 QVBoxLayout *vb = new QVBoxLayout( this ); 348 QVBoxLayout *vb = new QVBoxLayout( this );
335 349
336 tabMain = new QTabWidget( this ); 350 tabMain = new QTabWidget( this );
337 vb->addWidget( tabMain ); 351 vb->addWidget( tabMain );
338 352
339 QWidget *tabViewport = new QWidget ( tabMain ); 353 QWidget *tabViewport = new QWidget ( tabMain );
340 354
341 vb = new QVBoxLayout( tabViewport ); 355 vb = new QVBoxLayout( tabViewport );
342 356
343 svGeneral = new QScrollView( tabViewport ); 357 svGeneral = new QScrollView( tabViewport );
344 vb->addWidget( svGeneral, 0, 0 ); 358 vb->addWidget( svGeneral, 0, 0 );
345 svGeneral->setResizePolicy( QScrollView::AutoOneFit ); 359 svGeneral->setResizePolicy( QScrollView::AutoOneFit );
346 svGeneral->setFrameStyle( QFrame::NoFrame ); 360 svGeneral->setFrameStyle( QFrame::NoFrame );
347 361
348 QWidget *container = new QWidget( svGeneral->viewport() ); 362 QWidget *container = new QWidget( svGeneral->viewport() );
349 svGeneral->addChild( container ); 363 svGeneral->addChild( container );
350 364
351 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); 365 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 );
352 gl->setResizeMode( QLayout::FreeResize ); 366 gl->setResizeMode( QLayout::FreeResize );
353 367
354 btnFullName = new QPushButton( tr( "Full Name..." ), container ); 368 btnFullName = new QPushButton( tr( "Full Name..." ), container );
355 gl->addWidget( btnFullName, 0, 0 ); 369 gl->addWidget( btnFullName, 0, 0 );
356 txtFullName = new QLineEdit( container ); 370 txtFullName = new QLineEdit( container );
357 gl->addWidget( txtFullName, 0, 1 ); 371 gl->addWidget( txtFullName, 0, 1 );
358 372
359 QLabel *l = new QLabel( tr( "Job Title" ), container ); 373 QLabel *l = new QLabel( tr( "Job Title" ), container );
360 gl->addWidget( l, 1, 0 ); 374 gl->addWidget( l, 1, 0 );
361 txtJobTitle = new QLineEdit( container ); 375 txtJobTitle = new QLineEdit( container );
362 gl->addWidget( txtJobTitle, 1, 1 ); 376 gl->addWidget( txtJobTitle, 1, 1 );
363 377
364 l = new QLabel( tr( "Organization" ), container ); 378 l = new QLabel( tr( "Organization" ), container );
365 gl->addWidget( l, 2, 0 ); 379 gl->addWidget( l, 2, 0 );
366 txtOrganization = new QLineEdit( container ); 380 txtOrganization = new QLineEdit( container );
367 gl->addWidget( txtOrganization, 2, 1 ); 381 gl->addWidget( txtOrganization, 2, 1 );
368 382
369 cmbChooserField1 = new QComboBox( FALSE, container ); 383 cmbChooserField1 = new QComboBox( FALSE, container );
370 cmbChooserField1->setMaximumWidth( 90 ); 384 cmbChooserField1->setMaximumWidth( 90 );
371 gl->addWidget( cmbChooserField1, 3, 0 ); 385 gl->addWidget( cmbChooserField1, 3, 0 );
372 txtChooserField1 = new QLineEdit( container ); 386 txtChooserField1 = new QLineEdit( container );
373 gl->addWidget( txtChooserField1, 3, 1 ); 387 gl->addWidget( txtChooserField1, 3, 1 );
374 388
375 cmbChooserField2 = new QComboBox( FALSE, container ); 389 cmbChooserField2 = new QComboBox( FALSE, container );
376 cmbChooserField2->setMaximumWidth( 90 ); 390 cmbChooserField2->setMaximumWidth( 90 );
377 gl->addWidget( cmbChooserField2, 4, 0 ); 391 gl->addWidget( cmbChooserField2, 4, 0 );
378 txtChooserField2 = new QLineEdit( container ); 392 txtChooserField2 = new QLineEdit( container );
379 gl->addWidget( txtChooserField2, 4, 1 ); 393 gl->addWidget( txtChooserField2, 4, 1 );
380 394
381 cmbChooserField3 = new QComboBox( FALSE, container ); 395 cmbChooserField3 = new QComboBox( FALSE, container );
@@ -560,388 +574,388 @@ void ContactEditor::init() {
560 cmbCountry->insertItem( tr ( "Kuwait" ) ); 574 cmbCountry->insertItem( tr ( "Kuwait" ) );
561 cmbCountry->insertItem( tr ( "Kyrgystan" ) ); 575 cmbCountry->insertItem( tr ( "Kyrgystan" ) );
562 cmbCountry->insertItem( tr ( "Laos" ) ); 576 cmbCountry->insertItem( tr ( "Laos" ) );
563 cmbCountry->insertItem( tr ( "Latvia" ) ); 577 cmbCountry->insertItem( tr ( "Latvia" ) );
564 cmbCountry->insertItem( tr ( "Lebanon" ) ); 578 cmbCountry->insertItem( tr ( "Lebanon" ) );
565 cmbCountry->insertItem( tr ( "Lesotho" ) ); 579 cmbCountry->insertItem( tr ( "Lesotho" ) );
566 cmbCountry->insertItem( tr ( "Liberia" ) ); 580 cmbCountry->insertItem( tr ( "Liberia" ) );
567 cmbCountry->insertItem( tr ( "Liechtenstein" ) ); 581 cmbCountry->insertItem( tr ( "Liechtenstein" ) );
568 cmbCountry->insertItem( tr ( "Lithuania" ) ); 582 cmbCountry->insertItem( tr ( "Lithuania" ) );
569 cmbCountry->insertItem( tr ( "Luxembourg" ) ); 583 cmbCountry->insertItem( tr ( "Luxembourg" ) );
570 cmbCountry->insertItem( tr ( "Macau" ) ); 584 cmbCountry->insertItem( tr ( "Macau" ) );
571 cmbCountry->insertItem( tr ( "Macedonia" ) ); 585 cmbCountry->insertItem( tr ( "Macedonia" ) );
572 cmbCountry->insertItem( tr ( "Madagascar" ) ); 586 cmbCountry->insertItem( tr ( "Madagascar" ) );
573 cmbCountry->insertItem( tr ( "Malawi" ) ); 587 cmbCountry->insertItem( tr ( "Malawi" ) );
574 cmbCountry->insertItem( tr ( "Malaysia" ) ); 588 cmbCountry->insertItem( tr ( "Malaysia" ) );
575 cmbCountry->insertItem( tr ( "Maldives" ) ); 589 cmbCountry->insertItem( tr ( "Maldives" ) );
576 cmbCountry->insertItem( tr ( "Mali" ) ); 590 cmbCountry->insertItem( tr ( "Mali" ) );
577 cmbCountry->insertItem( tr ( "Malta" ) ); 591 cmbCountry->insertItem( tr ( "Malta" ) );
578 cmbCountry->insertItem( tr ( "Martinique" ) ); 592 cmbCountry->insertItem( tr ( "Martinique" ) );
579 cmbCountry->insertItem( tr ( "Mauritania" ) ); 593 cmbCountry->insertItem( tr ( "Mauritania" ) );
580 cmbCountry->insertItem( tr ( "Mauritius" ) ); 594 cmbCountry->insertItem( tr ( "Mauritius" ) );
581 cmbCountry->insertItem( tr ( "Mayotte" ) ); 595 cmbCountry->insertItem( tr ( "Mayotte" ) );
582 cmbCountry->insertItem( tr ( "Mexico" ) ); 596 cmbCountry->insertItem( tr ( "Mexico" ) );
583 cmbCountry->insertItem( tr ( "Micronesia" ) ); 597 cmbCountry->insertItem( tr ( "Micronesia" ) );
584 cmbCountry->insertItem( tr ( "Moldova" ) ); 598 cmbCountry->insertItem( tr ( "Moldova" ) );
585 cmbCountry->insertItem( tr ( "Monaco" ) ); 599 cmbCountry->insertItem( tr ( "Monaco" ) );
586 cmbCountry->insertItem( tr ( "Mongolia" ) ); 600 cmbCountry->insertItem( tr ( "Mongolia" ) );
587 cmbCountry->insertItem( tr ( "Montserrat" ) ); 601 cmbCountry->insertItem( tr ( "Montserrat" ) );
588 cmbCountry->insertItem( tr ( "Morocco" ) ); 602 cmbCountry->insertItem( tr ( "Morocco" ) );
589 cmbCountry->insertItem( tr ( "Mozambique" ) ); 603 cmbCountry->insertItem( tr ( "Mozambique" ) );
590 cmbCountry->insertItem( tr ( "Myanmar" ) ); 604 cmbCountry->insertItem( tr ( "Myanmar" ) );
591 cmbCountry->insertItem( tr ( "Namibia" ) ); 605 cmbCountry->insertItem( tr ( "Namibia" ) );
592 cmbCountry->insertItem( tr ( "Nauru" ) ); 606 cmbCountry->insertItem( tr ( "Nauru" ) );
593 cmbCountry->insertItem( tr ( "Nepal" ) ); 607 cmbCountry->insertItem( tr ( "Nepal" ) );
594 cmbCountry->insertItem( tr ( "Netherlands" ) ); 608 cmbCountry->insertItem( tr ( "Netherlands" ) );
595 cmbCountry->insertItem( tr ( "New Caledonia" ) ); 609 cmbCountry->insertItem( tr ( "New Caledonia" ) );
596 cmbCountry->insertItem( tr ( "New Zealand" ) ); 610 cmbCountry->insertItem( tr ( "New Zealand" ) );
597 cmbCountry->insertItem( tr ( "Nicaragua" ) ); 611 cmbCountry->insertItem( tr ( "Nicaragua" ) );
598 cmbCountry->insertItem( tr ( "Niger" ) ); 612 cmbCountry->insertItem( tr ( "Niger" ) );
599 cmbCountry->insertItem( tr ( "Nigeria" ) ); 613 cmbCountry->insertItem( tr ( "Nigeria" ) );
600 cmbCountry->insertItem( tr ( "Niue" ) ); 614 cmbCountry->insertItem( tr ( "Niue" ) );
601 cmbCountry->insertItem( tr ( "Norway" ) ); 615 cmbCountry->insertItem( tr ( "Norway" ) );
602 cmbCountry->insertItem( tr ( "Oman" ) ); 616 cmbCountry->insertItem( tr ( "Oman" ) );
603 cmbCountry->insertItem( tr ( "Pakistan" ) ); 617 cmbCountry->insertItem( tr ( "Pakistan" ) );
604 cmbCountry->insertItem( tr ( "Palau" ) ); 618 cmbCountry->insertItem( tr ( "Palau" ) );
605 cmbCountry->insertItem( tr ( "Palestinian Territory" ) ); 619 cmbCountry->insertItem( tr ( "Palestinian Territory" ) );
606 cmbCountry->insertItem( tr ( "Panama" ) ); 620 cmbCountry->insertItem( tr ( "Panama" ) );
607 cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); 621 cmbCountry->insertItem( tr ( "Papua New Guinea" ) );
608 cmbCountry->insertItem( tr ( "Paraguay" ) ); 622 cmbCountry->insertItem( tr ( "Paraguay" ) );
609 cmbCountry->insertItem( tr ( "Peru" ) ); 623 cmbCountry->insertItem( tr ( "Peru" ) );
610 cmbCountry->insertItem( tr ( "Philippines" ) ); 624 cmbCountry->insertItem( tr ( "Philippines" ) );
611 cmbCountry->insertItem( tr ( "Pitcairn" ) ); 625 cmbCountry->insertItem( tr ( "Pitcairn" ) );
612 cmbCountry->insertItem( tr ( "Poland" ) ); 626 cmbCountry->insertItem( tr ( "Poland" ) );
613 cmbCountry->insertItem( tr ( "Portugal" ) ); 627 cmbCountry->insertItem( tr ( "Portugal" ) );
614 cmbCountry->insertItem( tr ( "Puerto Rico" ) ); 628 cmbCountry->insertItem( tr ( "Puerto Rico" ) );
615 cmbCountry->insertItem( tr ( "Qatar" ) ); 629 cmbCountry->insertItem( tr ( "Qatar" ) );
616 cmbCountry->insertItem( tr ( "Reunion" ) ); 630 cmbCountry->insertItem( tr ( "Reunion" ) );
617 cmbCountry->insertItem( tr ( "Romania" ) ); 631 cmbCountry->insertItem( tr ( "Romania" ) );
618 cmbCountry->insertItem( tr ( "Russia" ) ); 632 cmbCountry->insertItem( tr ( "Russia" ) );
619 cmbCountry->insertItem( tr ( "Rwanda" ) ); 633 cmbCountry->insertItem( tr ( "Rwanda" ) );
620 cmbCountry->insertItem( tr ( "Saint Lucia" ) ); 634 cmbCountry->insertItem( tr ( "Saint Lucia" ) );
621 cmbCountry->insertItem( tr ( "Samoa" ) ); 635 cmbCountry->insertItem( tr ( "Samoa" ) );
622 cmbCountry->insertItem( tr ( "San Marino" ) ); 636 cmbCountry->insertItem( tr ( "San Marino" ) );
623 cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); 637 cmbCountry->insertItem( tr ( "Saudi Arabia" ) );
624 cmbCountry->insertItem( tr ( "Senegal" ) ); 638 cmbCountry->insertItem( tr ( "Senegal" ) );
625 cmbCountry->insertItem( tr ( "Seychelles" ) ); 639 cmbCountry->insertItem( tr ( "Seychelles" ) );
626 cmbCountry->insertItem( tr ( "Sierra Leone" ) ); 640 cmbCountry->insertItem( tr ( "Sierra Leone" ) );
627 cmbCountry->insertItem( tr ( "Singapore" ) ); 641 cmbCountry->insertItem( tr ( "Singapore" ) );
628 cmbCountry->insertItem( tr ( "Slovakia" ) ); 642 cmbCountry->insertItem( tr ( "Slovakia" ) );
629 cmbCountry->insertItem( tr ( "Slovenia" ) ); 643 cmbCountry->insertItem( tr ( "Slovenia" ) );
630 cmbCountry->insertItem( tr ( "Solomon Islands" ) ); 644 cmbCountry->insertItem( tr ( "Solomon Islands" ) );
631 cmbCountry->insertItem( tr ( "Somalia" ) ); 645 cmbCountry->insertItem( tr ( "Somalia" ) );
632 cmbCountry->insertItem( tr ( "South Africa" ) ); 646 cmbCountry->insertItem( tr ( "South Africa" ) );
633 cmbCountry->insertItem( tr ( "Spain" ) ); 647 cmbCountry->insertItem( tr ( "Spain" ) );
634 cmbCountry->insertItem( tr ( "Sri Lanka" ) ); 648 cmbCountry->insertItem( tr ( "Sri Lanka" ) );
635 cmbCountry->insertItem( tr ( "St. Helena" ) ); 649 cmbCountry->insertItem( tr ( "St. Helena" ) );
636 cmbCountry->insertItem( tr ( "Sudan" ) ); 650 cmbCountry->insertItem( tr ( "Sudan" ) );
637 cmbCountry->insertItem( tr ( "Suriname" ) ); 651 cmbCountry->insertItem( tr ( "Suriname" ) );
638 cmbCountry->insertItem( tr ( "Swaziland" ) ); 652 cmbCountry->insertItem( tr ( "Swaziland" ) );
639 cmbCountry->insertItem( tr ( "Sweden" ) ); 653 cmbCountry->insertItem( tr ( "Sweden" ) );
640 cmbCountry->insertItem( tr ( "Switzerland" ) ); 654 cmbCountry->insertItem( tr ( "Switzerland" ) );
641 cmbCountry->insertItem( tr ( "Taiwan" ) ); 655 cmbCountry->insertItem( tr ( "Taiwan" ) );
642 cmbCountry->insertItem( tr ( "Tajikistan" ) ); 656 cmbCountry->insertItem( tr ( "Tajikistan" ) );
643 cmbCountry->insertItem( tr ( "Tanzania" ) ); 657 cmbCountry->insertItem( tr ( "Tanzania" ) );
644 cmbCountry->insertItem( tr ( "Thailand" ) ); 658 cmbCountry->insertItem( tr ( "Thailand" ) );
645 cmbCountry->insertItem( tr ( "Togo" ) ); 659 cmbCountry->insertItem( tr ( "Togo" ) );
646 cmbCountry->insertItem( tr ( "Tokelau" ) ); 660 cmbCountry->insertItem( tr ( "Tokelau" ) );
647 cmbCountry->insertItem( tr ( "Tonga" ) ); 661 cmbCountry->insertItem( tr ( "Tonga" ) );
648 cmbCountry->insertItem( tr ( "Tunisia" ) ); 662 cmbCountry->insertItem( tr ( "Tunisia" ) );
649 cmbCountry->insertItem( tr ( "Turkey" ) ); 663 cmbCountry->insertItem( tr ( "Turkey" ) );
650 cmbCountry->insertItem( tr ( "Turkmenistan" ) ); 664 cmbCountry->insertItem( tr ( "Turkmenistan" ) );
651 cmbCountry->insertItem( tr ( "Tuvalu" ) ); 665 cmbCountry->insertItem( tr ( "Tuvalu" ) );
652 cmbCountry->insertItem( tr ( "Uganda" ) ); 666 cmbCountry->insertItem( tr ( "Uganda" ) );
653 cmbCountry->insertItem( tr ( "Ukraine" ) ); 667 cmbCountry->insertItem( tr ( "Ukraine" ) );
654 cmbCountry->insertItem( tr ( "Uruguay" ) ); 668 cmbCountry->insertItem( tr ( "Uruguay" ) );
655 cmbCountry->insertItem( tr ( "Uzbekistan" ) ); 669 cmbCountry->insertItem( tr ( "Uzbekistan" ) );
656 cmbCountry->insertItem( tr ( "Vanuatu" ) ); 670 cmbCountry->insertItem( tr ( "Vanuatu" ) );
657 cmbCountry->insertItem( tr ( "Venezuela" ) ); 671 cmbCountry->insertItem( tr ( "Venezuela" ) );
658 cmbCountry->insertItem( tr ( "Viet Nam" ) ); 672 cmbCountry->insertItem( tr ( "Viet Nam" ) );
659 cmbCountry->insertItem( tr ( "Virgin Islands" ) ); 673 cmbCountry->insertItem( tr ( "Virgin Islands" ) );
660 cmbCountry->insertItem( tr ( "Western Sahara" ) ); 674 cmbCountry->insertItem( tr ( "Western Sahara" ) );
661 cmbCountry->insertItem( tr ( "Yemen" ) ); 675 cmbCountry->insertItem( tr ( "Yemen" ) );
662 cmbCountry->insertItem( tr ( "Yugoslavia" ) ); 676 cmbCountry->insertItem( tr ( "Yugoslavia" ) );
663 cmbCountry->insertItem( tr ( "Zambia" ) ); 677 cmbCountry->insertItem( tr ( "Zambia" ) );
664 cmbCountry->insertItem( tr ( "Zimbabwe" ) ); 678 cmbCountry->insertItem( tr ( "Zimbabwe" ) );
665 679
666 cmbCountry->setMaximumWidth( 135 ); 680 cmbCountry->setMaximumWidth( 135 );
667 681
668 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); 682 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 );
669 683
670 cmbChooserField4 = new QComboBox( FALSE, container ); 684 cmbChooserField4 = new QComboBox( FALSE, container );
671 cmbChooserField4->setMaximumWidth( 90 ); 685 cmbChooserField4->setMaximumWidth( 90 );
672 gl->addWidget( cmbChooserField4, 6, 0 ); 686 gl->addWidget( cmbChooserField4, 6, 0 );
673 txtChooserField4 = new QLineEdit( container ); 687 txtChooserField4 = new QLineEdit( container );
674 gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 ); 688 gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 );
675 689
676 QSpacerItem *space = new QSpacerItem(1,1, 690 QSpacerItem *space = new QSpacerItem(1,1,
677 QSizePolicy::Maximum, 691 QSizePolicy::Maximum,
678 QSizePolicy::MinimumExpanding ); 692 QSizePolicy::MinimumExpanding );
679 gl->addItem( space, 7, 0 ); 693 gl->addItem( space, 7, 0 );
680 694
681 tabMain->insertTab( tabViewport, tr( "Address" ) ); 695 tabMain->insertTab( tabViewport, tr( "Address" ) );
682 696
683 tabViewport = new QWidget ( tabMain ); 697 tabViewport = new QWidget ( tabMain );
684 698
685 vb = new QVBoxLayout( tabViewport ); 699 vb = new QVBoxLayout( tabViewport );
686 700
687 svDetails = new QScrollView( tabViewport ); 701 svDetails = new QScrollView( tabViewport );
688 vb->addWidget( svDetails, 0, 0 ); 702 vb->addWidget( svDetails, 0, 0 );
689 svDetails->setResizePolicy( QScrollView::AutoOneFit ); 703 svDetails->setResizePolicy( QScrollView::AutoOneFit );
690 svDetails->setFrameStyle( QFrame::NoFrame ); 704 svDetails->setFrameStyle( QFrame::NoFrame );
691 705
692 container = new QWidget( svDetails->viewport() ); 706 container = new QWidget( svDetails->viewport() );
693 svDetails->addChild( container ); 707 svDetails->addChild( container );
694 708
695 gl = new QGridLayout( container, 1, 2, 2, 4 ); 709 gl = new QGridLayout( container, 1, 2, 2, 4 );
696 710
697 QStringList::ConstIterator it = slDynamicEntries.begin(); 711 QStringList::ConstIterator it = slDynamicEntries.begin();
698 for (i = 0; it != slDynamicEntries.end(); i++, ++it) { 712 for (i = 0; it != slDynamicEntries.end(); i++, ++it) {
699 l = new QLabel( *it, container ); 713 l = new QLabel( *it, container );
700 listName.append( l ); 714 listName.append( l );
701 gl->addWidget( l, i, 0 ); 715 gl->addWidget( l, i, 0 );
702 QLineEdit *e = new QLineEdit( container ); 716 QLineEdit *e = new QLineEdit( container );
703 listValue.append( e ); 717 listValue.append( e );
704 gl->addWidget( e, i, 1); 718 gl->addWidget( e, i, 1);
705 } 719 }
706 720
707 l = new QLabel( tr("Gender"), container ); 721 l = new QLabel( tr("Gender"), container );
708 gl->addWidget( l, slDynamicEntries.count(), 0 ); 722 gl->addWidget( l, slDynamicEntries.count(), 0 );
709 cmbGender = new QComboBox( container ); 723 cmbGender = new QComboBox( container );
710 cmbGender->insertItem( "", 0 ); 724 cmbGender->insertItem( "", 0 );
711 cmbGender->insertItem( tr("Male"), 1); 725 cmbGender->insertItem( tr("Male"), 1);
712 cmbGender->insertItem( tr("Female"), 2); 726 cmbGender->insertItem( tr("Female"), 2);
713 gl->addWidget( cmbGender, slDynamicEntries.count(), 1 ); 727 gl->addWidget( cmbGender, slDynamicEntries.count(), 1 );
714 728
715 tabMain->insertTab( tabViewport, tr( "Details" ) ); 729 tabMain->insertTab( tabViewport, tr( "Details" ) );
716 730
717 dlgNote = new QDialog( this, "Note Dialog", TRUE ); 731 dlgNote = new QDialog( this, "Note Dialog", TRUE );
718 dlgNote->setCaption( tr("Enter Note") ); 732 dlgNote->setCaption( tr("Enter Note") );
719 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); 733 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote );
720 txtNote = new QMultiLineEdit( dlgNote ); 734 txtNote = new QMultiLineEdit( dlgNote );
721 vbNote->addWidget( txtNote ); 735 vbNote->addWidget( txtNote );
722 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); 736 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) );
723 737
724 dlgName = new QDialog( this, "Name Dialog", TRUE ); 738 dlgName = new QDialog( this, "Name Dialog", TRUE );
725 dlgName->setCaption( tr("Edit Name") ); 739 dlgName->setCaption( tr("Edit Name") );
726 gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); 740 gl = new QGridLayout( dlgName, 5, 2, 2, 3 );
727 741
728 l = new QLabel( tr("First Name"), dlgName ); 742 l = new QLabel( tr("First Name"), dlgName );
729 gl->addWidget( l, 0, 0 ); 743 gl->addWidget( l, 0, 0 );
730 txtFirstName = new QLineEdit( dlgName ); 744 txtFirstName = new QLineEdit( dlgName );
731 gl->addWidget( txtFirstName, 0, 1 ); 745 gl->addWidget( txtFirstName, 0, 1 );
732 746
733 l = new QLabel( tr("Middle Name"), dlgName ); 747 l = new QLabel( tr("Middle Name"), dlgName );
734 gl->addWidget( l, 1, 0 ); 748 gl->addWidget( l, 1, 0 );
735 txtMiddleName = new QLineEdit( dlgName ); 749 txtMiddleName = new QLineEdit( dlgName );
736 gl->addWidget( txtMiddleName, 1, 1 ); 750 gl->addWidget( txtMiddleName, 1, 1 );
737 751
738 l = new QLabel( tr("Last Name"), dlgName ); 752 l = new QLabel( tr("Last Name"), dlgName );
739 gl->addWidget( l, 2, 0 ); 753 gl->addWidget( l, 2, 0 );
740 txtLastName = new QLineEdit( dlgName ); 754 txtLastName = new QLineEdit( dlgName );
741 gl->addWidget( txtLastName, 2, 1 ); 755 gl->addWidget( txtLastName, 2, 1 );
742 756
743 l = new QLabel( tr("Suffix"), dlgName ); 757 l = new QLabel( tr("Suffix"), dlgName );
744 gl->addWidget( l, 3, 0 ); 758 gl->addWidget( l, 3, 0 );
745 txtSuffix = new QLineEdit( dlgName ); 759 txtSuffix = new QLineEdit( dlgName );
746 gl->addWidget( txtSuffix, 3, 1 ); 760 gl->addWidget( txtSuffix, 3, 1 );
747 space = new QSpacerItem(1,1, 761 space = new QSpacerItem(1,1,
748 QSizePolicy::Maximum, 762 QSizePolicy::Maximum,
749 QSizePolicy::MinimumExpanding ); 763 QSizePolicy::MinimumExpanding );
750 gl->addItem( space, 4, 0 ); 764 gl->addItem( space, 4, 0 );
751 765
752 cmbChooserField1->insertStringList( slChooserNames ); 766 cmbChooserField1->insertStringList( trlChooserNames );
753 cmbChooserField2->insertStringList( slChooserNames ); 767 cmbChooserField2->insertStringList( trlChooserNames );
754 cmbChooserField3->insertStringList( slChooserNames ); 768 cmbChooserField3->insertStringList( trlChooserNames );
755 cmbChooserField4->insertStringList( slChooserNames ); 769 cmbChooserField4->insertStringList( trlChooserNames );
756 770
757 cmbChooserField1->setCurrentItem( 0 ); 771 cmbChooserField1->setCurrentItem( 0 );
758 cmbChooserField2->setCurrentItem( 1 ); 772 cmbChooserField2->setCurrentItem( 1 );
759 cmbChooserField3->setCurrentItem( 2 ); 773 cmbChooserField3->setCurrentItem( 2 );
760 774
761 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 775 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
762 776
763 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); 777 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) );
764 778
765 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), 779 connect( txtChooserField1, SIGNAL(textChanged(const QString &)),
766 this, SLOT(slotChooser1Change(const QString &)) ); 780 this, SLOT(slotChooser1Change(const QString &)) );
767 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), 781 connect( txtChooserField2, SIGNAL(textChanged(const QString &)),
768 this, SLOT(slotChooser2Change(const QString &)) ); 782 this, SLOT(slotChooser2Change(const QString &)) );
769 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), 783 connect( txtChooserField3, SIGNAL(textChanged(const QString &)),
770 this, SLOT(slotChooser3Change(const QString &)) ); 784 this, SLOT(slotChooser3Change(const QString &)) );
771 connect( txtChooserField4, SIGNAL(textChanged(const QString &)), 785 connect( txtChooserField4, SIGNAL(textChanged(const QString &)),
772 this, SLOT(slotChooser4Change(const QString &)) ); 786 this, SLOT(slotChooser4Change(const QString &)) );
773 connect( txtAddress, SIGNAL(textChanged(const QString &)), 787 connect( txtAddress, SIGNAL(textChanged(const QString &)),
774 this, SLOT(slotAddressChange(const QString &)) ); 788 this, SLOT(slotAddressChange(const QString &)) );
775 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); 789 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) );
776 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); 790 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) );
777 connect( txtCity, SIGNAL(textChanged(const QString &)), 791 connect( txtCity, SIGNAL(textChanged(const QString &)),
778 this, SLOT(slotCityChange(const QString &)) ); 792 this, SLOT(slotCityChange(const QString &)) );
779 connect( txtState, SIGNAL(textChanged(const QString &)), 793 connect( txtState, SIGNAL(textChanged(const QString &)),
780 this, SLOT(slotStateChange(const QString &)) ); 794 this, SLOT(slotStateChange(const QString &)) );
781 connect( txtZip, SIGNAL(textChanged(const QString &)), 795 connect( txtZip, SIGNAL(textChanged(const QString &)),
782 this, SLOT(slotZipChange(const QString &)) ); 796 this, SLOT(slotZipChange(const QString &)) );
783 connect( cmbCountry, SIGNAL(textChanged(const QString &)), 797 connect( cmbCountry, SIGNAL(textChanged(const QString &)),
784 this, SLOT(slotCountryChange(const QString &)) ); 798 this, SLOT(slotCountryChange(const QString &)) );
785 connect( cmbCountry, SIGNAL(activated(const QString &)), 799 connect( cmbCountry, SIGNAL(activated(const QString &)),
786 this, SLOT(slotCountryChange(const QString &)) ); 800 this, SLOT(slotCountryChange(const QString &)) );
787 connect( cmbChooserField1, SIGNAL(activated(int)), 801 connect( cmbChooserField1, SIGNAL(activated(int)),
788 this, SLOT(slotCmbChooser1Change(int)) ); 802 this, SLOT(slotCmbChooser1Change(int)) );
789 connect( cmbChooserField2, SIGNAL(activated(int)), 803 connect( cmbChooserField2, SIGNAL(activated(int)),
790 this, SLOT(slotCmbChooser2Change(int)) ); 804 this, SLOT(slotCmbChooser2Change(int)) );
791 connect( cmbChooserField3, SIGNAL(activated(int)), 805 connect( cmbChooserField3, SIGNAL(activated(int)),
792 this, SLOT(slotCmbChooser3Change(int)) ); 806 this, SLOT(slotCmbChooser3Change(int)) );
793 connect( cmbChooserField4, SIGNAL(activated(int)), 807 connect( cmbChooserField4, SIGNAL(activated(int)),
794 this, SLOT(slotCmbChooser4Change(int)) ); 808 this, SLOT(slotCmbChooser4Change(int)) );
795 connect( cmbAddress, SIGNAL(activated(int)), 809 connect( cmbAddress, SIGNAL(activated(int)),
796 this, SLOT(slotAddressTypeChange(int)) ); 810 this, SLOT(slotAddressTypeChange(int)) );
797 811
798 new QPEDialogListener(this); 812 new QPEDialogListener(this);
799} 813}
800 814
801void ContactEditor::initMap() 815void ContactEditor::initMap()
802{ 816{
803 /* 817 /*
804 // since the fields and the XML fields exist, create a map 818 // since the fields and the XML fields exist, create a map
805 // between them... 819 // between them...
806 Config cfg1( "AddressBook" ); 820 Config cfg1( "AddressBook" );
807 Config cfg2( "AddressBook" ); 821 Config cfg2( "AddressBook" );
808 QString strCfg1, 822 QString strCfg1,
809 strCfg2; 823 strCfg2;
810 int i; 824 int i;
811 825
812 // This stuff better exist... 826 // This stuff better exist...
813 cfg1.setGroup( "AddressFields" ); 827 cfg1.setGroup( "AddressFields" );
814o cfg2.setGroup( "XMLFields" ); 828o cfg2.setGroup( "XMLFields" );
815 i = 0; 829 i = 0;
816 strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null ); 830 strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null );
817 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), 831 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++),
818 QString::null ); 832 QString::null );
819 while ( !strCfg1.isNull() && !strCfg2.isNull() ) { 833 while ( !strCfg1.isNull() && !strCfg2.isNull() ) {
820 mapField.insert( strCfg1, strCfg2 ); 834 mapField.insert( strCfg1, strCfg2 );
821 strCfg1 = cfg1.readEntry( "Field" + QString::number(i), 835 strCfg1 = cfg1.readEntry( "Field" + QString::number(i),
822 QString::null ); 836 QString::null );
823 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), 837 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++),
824 QString::null ); 838 QString::null );
825 } 839 }
826 */ 840 */
827} 841}
828 842
829void ContactEditor::slotChooser1Change( const QString &textChanged ) { 843void ContactEditor::slotChooser1Change( const QString &textChanged ) {
830 844
831 int index = cmbChooserField1->currentItem(); 845 int index = cmbChooserField1->currentItem();
832 846
833 slChooserValues[index] = textChanged; 847 slChooserValues[index] = textChanged;
834 848
835} 849}
836 850
837void ContactEditor::slotChooser2Change( const QString &textChanged ) { 851void ContactEditor::slotChooser2Change( const QString &textChanged ) {
838 852
839 int index = cmbChooserField2->currentItem(); 853 int index = cmbChooserField2->currentItem();
840 854
841 slChooserValues[index] = textChanged; 855 slChooserValues[index] = textChanged;
842 856
843} 857}
844 858
845void ContactEditor::slotChooser3Change( const QString &textChanged ) { 859void ContactEditor::slotChooser3Change( const QString &textChanged ) {
846 860
847 int index = cmbChooserField3->currentItem(); 861 int index = cmbChooserField3->currentItem();
848 862
849 slChooserValues[index] = textChanged; 863 slChooserValues[index] = textChanged;
850 864
851} 865}
852 866
853void ContactEditor::slotChooser4Change( const QString &textChanged ) { 867void ContactEditor::slotChooser4Change( const QString &textChanged ) {
854 868
855 int index = cmbChooserField4->currentItem(); 869 int index = cmbChooserField4->currentItem();
856 870
857 slChooserValues[index] = textChanged; 871 slChooserValues[index] = textChanged;
858 872
859} 873}
860 874
861void ContactEditor::slotAddressChange( const QString &textChanged ) { 875void ContactEditor::slotAddressChange( const QString &textChanged ) {
862 876
863 if ( cmbAddress->currentItem() == 0 ) { 877 if ( cmbAddress->currentItem() == 0 ) {
864 slBusinessAddress[0] = textChanged; 878 slBusinessAddress[0] = textChanged;
865 } else { 879 } else {
866 slHomeAddress[0] = textChanged; 880 slHomeAddress[0] = textChanged;
867 } 881 }
868} 882}
869 883
870void ContactEditor::slotAddress2Change( const QString &textChanged ) { 884void ContactEditor::slotAddress2Change( const QString &textChanged ) {
871 885
872 if ( cmbAddress->currentItem() == 0 ) { 886 if ( cmbAddress->currentItem() == 0 ) {
873 slBusinessAddress[1] = textChanged; 887 slBusinessAddress[1] = textChanged;
874 } else { 888 } else {
875 slHomeAddress[1] = textChanged; 889 slHomeAddress[1] = textChanged;
876 } 890 }
877} 891}
878 892
879void ContactEditor::slotPOBoxChange( const QString &textChanged ) { 893void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
880 894
881 if ( cmbAddress->currentItem() == 0 ) { 895 if ( cmbAddress->currentItem() == 0 ) {
882 slBusinessAddress[2] = textChanged; 896 slBusinessAddress[2] = textChanged;
883 } else { 897 } else {
884 slHomeAddress[2] = textChanged; 898 slHomeAddress[2] = textChanged;
885 } 899 }
886} 900}
887 901
888void ContactEditor::slotCityChange( const QString &textChanged ) { 902void ContactEditor::slotCityChange( const QString &textChanged ) {
889 903
890 if ( cmbAddress->currentItem() == 0 ) { 904 if ( cmbAddress->currentItem() == 0 ) {
891 slBusinessAddress[3] = textChanged; 905 slBusinessAddress[3] = textChanged;
892 } else { 906 } else {
893 slHomeAddress[3] = textChanged; 907 slHomeAddress[3] = textChanged;
894 } 908 }
895} 909}
896 910
897void ContactEditor::slotStateChange( const QString &textChanged ) { 911void ContactEditor::slotStateChange( const QString &textChanged ) {
898 912
899 913
900 if ( cmbAddress->currentItem() == 0 ) { 914 if ( cmbAddress->currentItem() == 0 ) {
901 slBusinessAddress[4] = textChanged; 915 slBusinessAddress[4] = textChanged;
902 } else { 916 } else {
903 slHomeAddress[4] = textChanged; 917 slHomeAddress[4] = textChanged;
904 } 918 }
905} 919}
906 920
907void ContactEditor::slotZipChange( const QString &textChanged ) { 921void ContactEditor::slotZipChange( const QString &textChanged ) {
908 922
909 if ( cmbAddress->currentItem() == 0 ) { 923 if ( cmbAddress->currentItem() == 0 ) {
910 slBusinessAddress[5] = textChanged; 924 slBusinessAddress[5] = textChanged;
911 } else { 925 } else {
912 slHomeAddress[5] = textChanged; 926 slHomeAddress[5] = textChanged;
913 } 927 }
914} 928}
915 929
916void ContactEditor::slotCountryChange( const QString &textChanged ) { 930void ContactEditor::slotCountryChange( const QString &textChanged ) {
917 931
918 if ( cmbAddress->currentItem() == 0 ) { 932 if ( cmbAddress->currentItem() == 0 ) {
919 slBusinessAddress[6] = textChanged; 933 slBusinessAddress[6] = textChanged;
920 } else { 934 } else {
921 slHomeAddress[6] = textChanged; 935 slHomeAddress[6] = textChanged;
922 } 936 }
923} 937}
924 938
925void ContactEditor::slotCmbChooser1Change( int index ) { 939void ContactEditor::slotCmbChooser1Change( int index ) {
926 940
927 txtChooserField1->setText( slChooserValues[index] ); 941 txtChooserField1->setText( slChooserValues[index] );
928 txtChooserField1->setFocus(); 942 txtChooserField1->setFocus();
929} 943}
930 944
931void ContactEditor::slotCmbChooser2Change( int index ) { 945void ContactEditor::slotCmbChooser2Change( int index ) {
932 946
933 txtChooserField2->setText( slChooserValues[index] ); 947 txtChooserField2->setText( slChooserValues[index] );
934 txtChooserField2->setFocus(); 948 txtChooserField2->setFocus();
935} 949}
936 950
937void ContactEditor::slotCmbChooser3Change( int index ) { 951void ContactEditor::slotCmbChooser3Change( int index ) {
938 952
939 txtChooserField3->setText( slChooserValues[index] ); 953 txtChooserField3->setText( slChooserValues[index] );
940 txtChooserField3->setFocus(); 954 txtChooserField3->setFocus();
941 955
942} 956}
943 957
944void ContactEditor::slotCmbChooser4Change( int index ) { 958void ContactEditor::slotCmbChooser4Change( int index ) {
945 959
946 txtChooserField4->setText( slChooserValues[index] ); 960 txtChooserField4->setText( slChooserValues[index] );
947 txtChooserField4->setFocus(); 961 txtChooserField4->setFocus();
@@ -1171,590 +1185,590 @@ QString ContactEditor::parseName( const QString fullName, int type ) {
1171 } 1185 }
1172 strFirstName = simplifiedName; 1186 strFirstName = simplifiedName;
1173 break; 1187 break;
1174 1188
1175 case 1: 1189 case 1:
1176 spPos = simplifiedName.find( ' ', 0, TRUE ); 1190 spPos = simplifiedName.find( ' ', 0, TRUE );
1177 strLastName = simplifiedName.left( spPos ); 1191 strLastName = simplifiedName.left( spPos );
1178 strFirstName = simplifiedName.mid( spPos + 1 ); 1192 strFirstName = simplifiedName.mid( spPos + 1 );
1179 break; 1193 break;
1180 1194
1181 case 2: 1195 case 2:
1182 spPos = simplifiedName.find( ' ', 0, TRUE ); 1196 spPos = simplifiedName.find( ' ', 0, TRUE );
1183 strLastName = simplifiedName.left( spPos ); 1197 strLastName = simplifiedName.left( spPos );
1184 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1198 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1185 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1199 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1186 strMiddleName = simplifiedName.mid( spPos2 + 1 ); 1200 strMiddleName = simplifiedName.mid( spPos2 + 1 );
1187 break; 1201 break;
1188 1202
1189 case 3: 1203 case 3:
1190 spPos = simplifiedName.find( ' ', 0, TRUE ); 1204 spPos = simplifiedName.find( ' ', 0, TRUE );
1191 strLastName = simplifiedName.left( spPos ); 1205 strLastName = simplifiedName.left( spPos );
1192 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1206 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1193 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1207 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1194 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1208 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1195 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1209 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1196 strSuffix = simplifiedName.mid( spPos + 1 ); 1210 strSuffix = simplifiedName.mid( spPos + 1 );
1197 break; 1211 break;
1198 1212
1199 case 4: 1213 case 4:
1200 spPos = simplifiedName.find( ' ', 0, TRUE ); 1214 spPos = simplifiedName.find( ' ', 0, TRUE );
1201 strLastName = simplifiedName.left( spPos ); 1215 strLastName = simplifiedName.left( spPos );
1202 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1216 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1203 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1217 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1204 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1218 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1205 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1219 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1206 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1220 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1207 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1221 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1208 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1222 strSuffix = simplifiedName.mid( spPos2 + 1 );
1209 break; 1223 break;
1210 1224
1211 default: 1225 default:
1212 spPos = simplifiedName.find( ' ', 0, TRUE ); 1226 spPos = simplifiedName.find( ' ', 0, TRUE );
1213 strLastName = simplifiedName.left( spPos ); 1227 strLastName = simplifiedName.left( spPos );
1214 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1228 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1215 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1229 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1216 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1230 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1217 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); 1231 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos );
1218 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1232 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1219 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1233 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1220 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1234 strSuffix = simplifiedName.mid( spPos2 + 1 );
1221 break; 1235 break;
1222 } 1236 }
1223 } 1237 }
1224 switch (type) { 1238 switch (type) {
1225 case NAME_FL: 1239 case NAME_FL:
1226 return strFirstName + " " + strLastName; 1240 return strFirstName + " " + strLastName;
1227 1241
1228 case NAME_LF: 1242 case NAME_LF:
1229 return strLastName + ", " + strFirstName; 1243 return strLastName + ", " + strFirstName;
1230 1244
1231 case NAME_LFM: 1245 case NAME_LFM:
1232 return strLastName + ", " + strFirstName + " " + strMiddleName; 1246 return strLastName + ", " + strFirstName + " " + strMiddleName;
1233 1247
1234 case NAME_FMLS: 1248 case NAME_FMLS:
1235 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; 1249 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix;
1236 1250
1237 case NAME_F: 1251 case NAME_F:
1238 return strFirstName; 1252 return strFirstName;
1239 1253
1240 case NAME_M: 1254 case NAME_M:
1241 return strMiddleName; 1255 return strMiddleName;
1242 1256
1243 case NAME_L: 1257 case NAME_L:
1244 return strLastName; 1258 return strLastName;
1245 1259
1246 case NAME_S: 1260 case NAME_S:
1247 return strSuffix; 1261 return strSuffix;
1248 1262
1249 } 1263 }
1250 return QString::null; 1264 return QString::null;
1251} 1265}
1252 1266
1253void ContactEditor::cleanupFields() { 1267void ContactEditor::cleanupFields() {
1254 1268
1255 QStringList::Iterator it = slChooserValues.begin(); 1269 QStringList::Iterator it = slChooserValues.begin();
1256 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { 1270 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) {
1257 (*it) = ""; 1271 (*it) = "";
1258 } 1272 }
1259 1273
1260 for ( int i = 0; i < 7; i++ ) { 1274 for ( int i = 0; i < 7; i++ ) {
1261 slHomeAddress[i] = ""; 1275 slHomeAddress[i] = "";
1262 slBusinessAddress[i] = ""; 1276 slBusinessAddress[i] = "";
1263 } 1277 }
1264 1278
1265 QStringList::ConstIterator cit; 1279 QStringList::ConstIterator cit;
1266 QListIterator<QLineEdit> itLE( listValue ); 1280 QListIterator<QLineEdit> itLE( listValue );
1267 for ( cit = slDynamicEntries.begin(); cit != slDynamicEntries.end(); ++cit, ++itLE) { 1281 for ( cit = slDynamicEntries.begin(); cit != slDynamicEntries.end(); ++cit, ++itLE) {
1268 (*itLE)->setText( "" ); 1282 (*itLE)->setText( "" );
1269 } 1283 }
1270 1284
1271 txtFirstName->setText(""); 1285 txtFirstName->setText("");
1272 txtMiddleName->setText(""); 1286 txtMiddleName->setText("");
1273 txtLastName->setText(""); 1287 txtLastName->setText("");
1274 txtSuffix->setText(""); 1288 txtSuffix->setText("");
1275 txtNote->setText(""); 1289 txtNote->setText("");
1276 txtFullName->setText(""); 1290 txtFullName->setText("");
1277 txtJobTitle->setText(""); 1291 txtJobTitle->setText("");
1278 txtOrganization->setText(""); 1292 txtOrganization->setText("");
1279 txtChooserField1->setText(""); 1293 txtChooserField1->setText("");
1280 txtChooserField2->setText(""); 1294 txtChooserField2->setText("");
1281 txtChooserField3->setText(""); 1295 txtChooserField3->setText("");
1282 txtAddress->setText(""); 1296 txtAddress->setText("");
1283 //txtAddress2->setText(""); 1297 //txtAddress2->setText("");
1284 txtCity->setText(""); 1298 txtCity->setText("");
1285 //txtPOBox->setText(""); 1299 //txtPOBox->setText("");
1286 txtState->setText(""); 1300 txtState->setText("");
1287 txtZip->setText(""); 1301 txtZip->setText("");
1288 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1302 QLineEdit *txtTmp = cmbCountry->lineEdit();
1289 txtTmp->setText(""); 1303 txtTmp->setText("");
1290 txtTmp = cmbFileAs->lineEdit(); 1304 txtTmp = cmbFileAs->lineEdit();
1291 txtTmp->setText(""); 1305 txtTmp->setText("");
1292 1306
1293} 1307}
1294 1308
1295void ContactEditor::setEntry( const OContact &entry ) { 1309void ContactEditor::setEntry( const OContact &entry ) {
1296 1310
1297 cleanupFields(); 1311 cleanupFields();
1298 1312
1299 1313
1300 ent = entry; 1314 ent = entry;
1301 1315
1302 useFullName = FALSE; 1316 useFullName = FALSE;
1303 txtFirstName->setText( ent.firstName() ); 1317 txtFirstName->setText( ent.firstName() );
1304 txtMiddleName->setText( ent.middleName() ); 1318 txtMiddleName->setText( ent.middleName() );
1305 txtLastName->setText( ent.lastName() ); 1319 txtLastName->setText( ent.lastName() );
1306 txtSuffix->setText( ent.suffix() ); 1320 txtSuffix->setText( ent.suffix() );
1307 1321
1308 QString *tmpString = new QString; 1322 QString *tmpString = new QString;
1309 *tmpString = ent.firstName() + " " + ent.middleName() + 1323 *tmpString = ent.firstName() + " " + ent.middleName() +
1310 + " " + ent.lastName() + " " + ent.suffix(); 1324 + " " + ent.lastName() + " " + ent.suffix();
1311 1325
1312 txtFullName->setText( tmpString->simplifyWhiteSpace() ); 1326 txtFullName->setText( tmpString->simplifyWhiteSpace() );
1313 1327
1314 cmbFileAs->setEditText( ent.fileAs() ); 1328 cmbFileAs->setEditText( ent.fileAs() );
1315 1329
1316 if (hasTitle) 1330 if (hasTitle)
1317 txtJobTitle->setText( ent.jobTitle() ); 1331 txtJobTitle->setText( ent.jobTitle() );
1318 1332
1319 if (hasCompany) 1333 if (hasCompany)
1320 txtOrganization->setText( ent.company() ); 1334 txtOrganization->setText( ent.company() );
1321 1335
1322 if (hasNotes) 1336 if (hasNotes)
1323 txtNote->setText( ent.notes() ); 1337 txtNote->setText( ent.notes() );
1324 1338
1325 if (hasStreet) { 1339 if (hasStreet) {
1326 slHomeAddress[0] = ent.homeStreet(); 1340 slHomeAddress[0] = ent.homeStreet();
1327 slBusinessAddress[0] = ent.businessStreet(); 1341 slBusinessAddress[0] = ent.businessStreet();
1328 } 1342 }
1329/* 1343/*
1330 if (hasStreet2) { 1344 if (hasStreet2) {
1331 (*slHomeAddress)[1] = ent.homeStreet2(); 1345 (*slHomeAddress)[1] = ent.homeStreet2();
1332 (*slBusinessAddress)[1] = ent.businessStreet2(); 1346 (*slBusinessAddress)[1] = ent.businessStreet2();
1333 } 1347 }
1334 1348
1335 if (hasPOBox) { 1349 if (hasPOBox) {
1336 (*slHomeAddress)[2] = ent.homePOBox(); 1350 (*slHomeAddress)[2] = ent.homePOBox();
1337 (*slBusinessAddress)[2] = ent.businessPOBox(); 1351 (*slBusinessAddress)[2] = ent.businessPOBox();
1338 } 1352 }
1339*/ 1353*/
1340 if (hasCity) { 1354 if (hasCity) {
1341 slHomeAddress[3] = ent.homeCity(); 1355 slHomeAddress[3] = ent.homeCity();
1342 slBusinessAddress[3] = ent.businessCity(); 1356 slBusinessAddress[3] = ent.businessCity();
1343 } 1357 }
1344 1358
1345 if (hasState) { 1359 if (hasState) {
1346 slHomeAddress[4] = ent.homeState(); 1360 slHomeAddress[4] = ent.homeState();
1347 slBusinessAddress[4] = ent.businessState(); 1361 slBusinessAddress[4] = ent.businessState();
1348 } 1362 }
1349 1363
1350 if (hasZip) { 1364 if (hasZip) {
1351 slHomeAddress[5] = ent.homeZip(); 1365 slHomeAddress[5] = ent.homeZip();
1352 slBusinessAddress[5] = ent.businessZip(); 1366 slBusinessAddress[5] = ent.businessZip();
1353 } 1367 }
1354 1368
1355 if (hasCountry) { 1369 if (hasCountry) {
1356 slHomeAddress[6] = ent.homeCountry(); 1370 slHomeAddress[6] = ent.homeCountry();
1357 slBusinessAddress[6] = ent.businessCountry(); 1371 slBusinessAddress[6] = ent.businessCountry();
1358 } 1372 }
1359 1373
1360 QStringList::ConstIterator it; 1374 QStringList::ConstIterator it;
1361 QListIterator<QLineEdit> itLE( listValue ); 1375 QListIterator<QLineEdit> itLE( listValue );
1362 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { 1376 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) {
1363 if ( *it =="Department" ) 1377 if ( *it == tr( "Department" ) )
1364 (*itLE)->setText( ent.department() ); 1378 (*itLE)->setText( ent.department() );
1365 1379
1366 if ( *it == "Company" ) 1380 if ( *it == tr( "Company" ) )
1367 (*itLE)->setText( ent.company() ); 1381 (*itLE)->setText( ent.company() );
1368 1382
1369 if ( *it == "Office" ) 1383 if ( *it == tr( "Office" ) )
1370 (*itLE)->setText( ent.office() ); 1384 (*itLE)->setText( ent.office() );
1371 1385
1372 if ( *it == "Profession" ) 1386 if ( *it == tr( "Profession" ) )
1373 (*itLE)->setText( ent.profession() ); 1387 (*itLE)->setText( ent.profession() );
1374 1388
1375 if ( *it == "Assistant" ) 1389 if ( *it == tr( "Assistant" ) )
1376 (*itLE)->setText( ent.assistant() ); 1390 (*itLE)->setText( ent.assistant() );
1377 1391
1378 if ( *it == "Manager" ) 1392 if ( *it == tr( "Manager" ) )
1379 (*itLE)->setText( ent.manager() ); 1393 (*itLE)->setText( ent.manager() );
1380 1394
1381 if ( *it == "Spouse" ) 1395 if ( *it == tr( "Spouse" ) )
1382 (*itLE)->setText( ent.spouse() ); 1396 (*itLE)->setText( ent.spouse() );
1383 1397
1384 if ( *it == "Birthday" ) 1398 if ( *it == tr( "Birthday" ) )
1385 (*itLE)->setText( ent.birthday() ); 1399 (*itLE)->setText( ent.birthday() );
1386 1400
1387 if ( *it == "Anniversary" ) 1401 if ( *it == tr( "Anniversary" ) )
1388 (*itLE)->setText( ent.anniversary() ); 1402 (*itLE)->setText( ent.anniversary() );
1389 1403
1390 if ( *it == "Nickname" ) 1404 if ( *it == tr( "Nickname" ) )
1391 (*itLE)->setText( ent.nickname() ); 1405 (*itLE)->setText( ent.nickname() );
1392 1406
1393 if ( *it == "Children" ) 1407 if ( *it == tr( "Children" ) )
1394 (*itLE)->setText( ent.children() ); 1408 (*itLE)->setText( ent.children() );
1395 1409
1396 } 1410 }
1397 1411
1398 QStringList::Iterator itV; 1412 QStringList::Iterator itV;
1399 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1413 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1400 1414
1401 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) 1415 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) )
1402 *itV = ent.businessPhone(); 1416 *itV = ent.businessPhone();
1403/* 1417/*
1404 if ( *it == "Business 2 Phone" ) 1418 if ( *it == "Business 2 Phone" )
1405 *itV = ent.business2Phone(); 1419 *itV = ent.business2Phone();
1406*/ 1420*/
1407 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) 1421 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) )
1408 *itV = ent.businessFax(); 1422 *itV = ent.businessFax();
1409 1423
1410 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) 1424 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) )
1411 *itV = ent.businessMobile(); 1425 *itV = ent.businessMobile();
1412/* 1426/*
1413 if ( *it == "Company Phone" ) 1427 if ( *it == "Company Phone" )
1414 *itV = ent.companyPhone(); 1428 *itV = ent.companyPhone();
1415*/ 1429*/
1416 if ( *it == "Default Email" ) 1430 if ( *it == "Default Email" )
1417 *itV = ent.defaultEmail(); 1431 *itV = ent.defaultEmail();
1418 1432
1419 if ( *it == "Emails" ) 1433 if ( *it == "Emails" )
1420 *itV = ent.emailList().join(", "); // :SX 1434 *itV = ent.emailList().join(", "); // :SX
1421 1435
1422 if ( *it == "Home Phone" ) 1436 if ( *it == "Home Phone" )
1423 *itV = ent.homePhone(); 1437 *itV = ent.homePhone();
1424/* 1438/*
1425 if ( *it == "Home 2 Phone" ) 1439 if ( *it == "Home 2 Phone" )
1426 *itV = ent.home2Phone(); 1440 *itV = ent.home2Phone();
1427*/ 1441*/
1428 if ( *it == "Home Fax" ) 1442 if ( *it == "Home Fax" )
1429 *itV = ent.homeFax(); 1443 *itV = ent.homeFax();
1430 1444
1431 if ( *it == "Home Mobile" ) 1445 if ( *it == "Home Mobile" )
1432 *itV = ent.homeMobile(); 1446 *itV = ent.homeMobile();
1433/* 1447/*
1434 if ( *it == "Car Phone" ) 1448 if ( *it == "Car Phone" )
1435 *itV = ent.carPhone(); 1449 *itV = ent.carPhone();
1436 1450
1437 if ( *it == "ISDN Phone" ) 1451 if ( *it == "ISDN Phone" )
1438 *itV = ent.ISDNPhone(); 1452 *itV = ent.ISDNPhone();
1439 1453
1440 if ( *it == "Other Phone" ) 1454 if ( *it == "Other Phone" )
1441 *itV = ent.otherPhone(); 1455 *itV = ent.otherPhone();
1442*/ 1456*/
1443 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) 1457 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
1444 *itV = ent.businessPager(); 1458 *itV = ent.businessPager();
1445/* 1459/*
1446 if ( *it == "Home Pager") 1460 if ( *it == "Home Pager")
1447 *itV = ent.homePager(); 1461 *itV = ent.homePager();
1448 1462
1449 if ( *it == "AIM IM" ) 1463 if ( *it == "AIM IM" )
1450 *itV = ent.AIMIM(); 1464 *itV = ent.AIMIM();
1451 1465
1452 if ( *it == "ICQ IM" ) 1466 if ( *it == "ICQ IM" )
1453 *itV = ent.ICQIM(); 1467 *itV = ent.ICQIM();
1454 1468
1455 if ( *it == "Jabber IM" ) 1469 if ( *it == "Jabber IM" )
1456 *itV = ent.jabberIM(); 1470 *itV = ent.jabberIM();
1457 1471
1458 if ( *it == "MSN IM" ) 1472 if ( *it == "MSN IM" )
1459 *itV = ent.MSNIM(); 1473 *itV = ent.MSNIM();
1460 1474
1461 if ( *it == "Yahoo IM" ) 1475 if ( *it == "Yahoo IM" )
1462 *itV = ent.yahooIM(); 1476 *itV = ent.yahooIM();
1463*/ 1477*/
1464 if ( *it == "Home Web Page" ) 1478 if ( *it == "Home Web Page" )
1465 *itV = ent.homeWebpage(); 1479 *itV = ent.homeWebpage();
1466 1480
1467 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) 1481 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1468 *itV = ent.businessWebpage(); 1482 *itV = ent.businessWebpage();
1469 1483
1470 1484
1471 } 1485 }
1472 1486
1473 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); 1487 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") );
1474 1488
1475 QString gender = ent.gender(); 1489 QString gender = ent.gender();
1476 cmbGender->setCurrentItem( gender.toInt() ); 1490 cmbGender->setCurrentItem( gender.toInt() );
1477 1491
1478 txtNote->setText( ent.notes() ); 1492 txtNote->setText( ent.notes() );
1479 1493
1480 slotCmbChooser1Change( cmbChooserField1->currentItem() ); 1494 slotCmbChooser1Change( cmbChooserField1->currentItem() );
1481 slotCmbChooser2Change( cmbChooserField2->currentItem() ); 1495 slotCmbChooser2Change( cmbChooserField2->currentItem() );
1482 slotCmbChooser3Change( cmbChooserField3->currentItem() ); 1496 slotCmbChooser3Change( cmbChooserField3->currentItem() );
1483 1497
1484 slotAddressTypeChange( cmbAddress->currentItem() ); 1498 slotAddressTypeChange( cmbAddress->currentItem() );
1485 1499
1486} 1500}
1487 1501
1488void ContactEditor::saveEntry() { 1502void ContactEditor::saveEntry() {
1489 1503
1490 if ( useFullName == TRUE ) { 1504 if ( useFullName == TRUE ) {
1491 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); 1505 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) );
1492 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); 1506 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) );
1493 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); 1507 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
1494 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); 1508 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
1495 1509
1496 useFullName = FALSE; 1510 useFullName = FALSE;
1497} 1511}
1498 1512
1499 /*if ( ent.firstName() != txtFirstName->text() || 1513 /*if ( ent.firstName() != txtFirstName->text() ||
1500 ent.lastName != txtLastName->text() || 1514 ent.lastName != txtLastName->text() ||
1501 ent.middleName != txtMiddleName->text() ) { 1515 ent.middleName != txtMiddleName->text() ) {
1502 */ 1516 */
1503 ent.setFirstName( txtFirstName->text() ); 1517 ent.setFirstName( txtFirstName->text() );
1504 ent.setLastName( txtLastName->text() ); 1518 ent.setLastName( txtLastName->text() );
1505 ent.setMiddleName( txtMiddleName->text() ); 1519 ent.setMiddleName( txtMiddleName->text() );
1506 ent.setSuffix( txtSuffix->text() ); 1520 ent.setSuffix( txtSuffix->text() );
1507 1521
1508 //} 1522 //}
1509 1523
1510 ent.setFileAs( cmbFileAs->currentText() ); 1524 ent.setFileAs( cmbFileAs->currentText() );
1511 1525
1512 ent.setCategories( cmbCat->currentCategories() ); 1526 ent.setCategories( cmbCat->currentCategories() );
1513 1527
1514 if (hasTitle) 1528 if (hasTitle)
1515 ent.setJobTitle( txtJobTitle->text() ); 1529 ent.setJobTitle( txtJobTitle->text() );
1516 1530
1517 if (hasCompany) 1531 if (hasCompany)
1518 ent.setCompany( txtOrganization->text() ); 1532 ent.setCompany( txtOrganization->text() );
1519 1533
1520 if (hasNotes) 1534 if (hasNotes)
1521 ent.setNotes( txtNote->text() ); 1535 ent.setNotes( txtNote->text() );
1522 1536
1523 if (hasStreet) { 1537 if (hasStreet) {
1524 ent.setHomeStreet( slHomeAddress[0] ); 1538 ent.setHomeStreet( slHomeAddress[0] );
1525 ent.setBusinessStreet( slBusinessAddress[0] ); 1539 ent.setBusinessStreet( slBusinessAddress[0] );
1526 } 1540 }
1527/* 1541/*
1528 if (hasStreet2) { 1542 if (hasStreet2) {
1529 ent.setHomeStreet2( (*slHomeAddress)[1] ); 1543 ent.setHomeStreet2( (*slHomeAddress)[1] );
1530 ent.setBusinessStreet2( (*slBusinessAddress)[1] ); 1544 ent.setBusinessStreet2( (*slBusinessAddress)[1] );
1531 } 1545 }
1532 1546
1533 if (hasPOBox) { 1547 if (hasPOBox) {
1534 ent.setHomePOBox( (*slHomeAddress)[2] ); 1548 ent.setHomePOBox( (*slHomeAddress)[2] );
1535 ent.setBusinessPOBox( (*slBusinessAddress)[2] ); 1549 ent.setBusinessPOBox( (*slBusinessAddress)[2] );
1536 } 1550 }
1537*/ 1551*/
1538 if (hasCity) { 1552 if (hasCity) {
1539 ent.setHomeCity( slHomeAddress[3] ); 1553 ent.setHomeCity( slHomeAddress[3] );
1540 ent.setBusinessCity( slBusinessAddress[3] ); 1554 ent.setBusinessCity( slBusinessAddress[3] );
1541 } 1555 }
1542 1556
1543 if (hasState) { 1557 if (hasState) {
1544 ent.setHomeState( slHomeAddress[4] ); 1558 ent.setHomeState( slHomeAddress[4] );
1545 ent.setBusinessState( slBusinessAddress[4] ); 1559 ent.setBusinessState( slBusinessAddress[4] );
1546 } 1560 }
1547 1561
1548 if (hasZip) { 1562 if (hasZip) {
1549 ent.setHomeZip( slHomeAddress[5] ); 1563 ent.setHomeZip( slHomeAddress[5] );
1550 ent.setBusinessZip( slBusinessAddress[5] ); 1564 ent.setBusinessZip( slBusinessAddress[5] );
1551 } 1565 }
1552 1566
1553 if (hasCountry) { 1567 if (hasCountry) {
1554 ent.setHomeCountry( slHomeAddress[6] ); 1568 ent.setHomeCountry( slHomeAddress[6] );
1555 ent.setBusinessCountry( slBusinessAddress[6] ); 1569 ent.setBusinessCountry( slBusinessAddress[6] );
1556 } 1570 }
1557 1571
1558 QStringList::ConstIterator it; 1572 QStringList::ConstIterator it;
1559 QListIterator<QLineEdit> itLE( listValue ); 1573 QListIterator<QLineEdit> itLE( listValue );
1560 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { 1574 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) {
1561 if ( *it == "Department" ) 1575 if ( *it == tr( "Department" ) )
1562 ent.setDepartment( (*itLE)->text() ); 1576 ent.setDepartment( (*itLE)->text() );
1563 1577
1564 if ( *it == "Company" ) 1578 if ( *it == tr( "Company" ) )
1565 ent.setCompany( (*itLE)->text() ); 1579 ent.setCompany( (*itLE)->text() );
1566 1580
1567 if ( *it == "Office" ) 1581 if ( *it == tr( "Office" ) )
1568 ent.setOffice( (*itLE)->text() ); 1582 ent.setOffice( (*itLE)->text() );
1569 1583
1570 if ( *it == "Profession" ) 1584 if ( *it == tr( "Profession" ) )
1571 ent.setProfession( (*itLE)->text() ); 1585 ent.setProfession( (*itLE)->text() );
1572 1586
1573 if ( *it == "Assistant" ) 1587 if ( *it == tr( "Assistant" ) )
1574 ent.setAssistant( (*itLE)->text() ); 1588 ent.setAssistant( (*itLE)->text() );
1575 1589
1576 if ( *it == "Manager" ) 1590 if ( *it == tr( "Manager" ) )
1577 ent.setManager( (*itLE)->text() ); 1591 ent.setManager( (*itLE)->text() );
1578 1592
1579 if ( *it == "Spouse" ) 1593 if ( *it == tr( "Spouse" ) )
1580 ent.setSpouse( (*itLE)->text() ); 1594 ent.setSpouse( (*itLE)->text() );
1581 1595
1582 if ( *it == "Birthday" ) 1596 if ( *it == tr( "Birthday" ) )
1583 ent.setBirthday( (*itLE)->text() ); 1597 ent.setBirthday( (*itLE)->text() );
1584 1598
1585 if ( *it == "Anniversary" ) 1599 if ( *it == tr( "Anniversary" ) )
1586 ent.setAnniversary( (*itLE)->text() ); 1600 ent.setAnniversary( (*itLE)->text() );
1587 1601
1588 if ( *it == "Nickname" ) 1602 if ( *it == tr( "Nickname" ) )
1589 ent.setNickname( (*itLE)->text() ); 1603 ent.setNickname( (*itLE)->text() );
1590 1604
1591 if ( *it == "Children" ) 1605 if ( *it == tr( "Children" ) )
1592 ent.setChildren( (*itLE)->text() ); 1606 ent.setChildren( (*itLE)->text() );
1593 1607
1594 } 1608 }
1595 1609
1596 QStringList::ConstIterator itV; 1610 QStringList::ConstIterator itV;
1597 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1611 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1598 1612
1599 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) 1613 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) )
1600 ent.setBusinessPhone( *itV ); 1614 ent.setBusinessPhone( *itV );
1601/* 1615/*
1602 if ( *it == tr("Business 2 Phone" ) 1616 if ( *it == tr("Business 2 Phone" )
1603 ent.setBusiness2Phone( *itV ); 1617 ent.setBusiness2Phone( *itV );
1604*/ 1618*/
1605 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) 1619 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) )
1606 ent.setBusinessFax( *itV ); 1620 ent.setBusinessFax( *itV );
1607 1621
1608 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) 1622 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) )
1609 ent.setBusinessMobile( *itV ); 1623 ent.setBusinessMobile( *itV );
1610/* 1624/*
1611 if ( *it == "Company Phone" ) 1625 if ( *it == "Company Phone" )
1612 ent.setCompanyPhone( *itV ); 1626 ent.setCompanyPhone( *itV );
1613*/ 1627*/
1614 //if ( *it == "Default Email" ) 1628 //if ( *it == "Default Email" )
1615 //ent.setDefaultEmail( *itV ); 1629 //ent.setDefaultEmail( *itV );
1616 1630
1617 if ( *it == "Emails" ){ 1631 if ( *it == "Emails" ){
1618 QString allemail; 1632 QString allemail;
1619 QString defaultmail; 1633 QString defaultmail;
1620 parseEmailFrom( *itV, defaultmail, allemail ); 1634 parseEmailFrom( *itV, defaultmail, allemail );
1621 // ent.clearEmails(); 1635 // ent.clearEmails();
1622 ent.setDefaultEmail( defaultmail ); 1636 ent.setDefaultEmail( defaultmail );
1623 ent.setEmails( allemail ); 1637 ent.setEmails( allemail );
1624 } 1638 }
1625 1639
1626 if ( *it == "Home Phone" ) 1640 if ( *it == "Home Phone" )
1627 ent.setHomePhone( *itV ); 1641 ent.setHomePhone( *itV );
1628/* 1642/*
1629 if ( *it == "Home 2 Phone" ) 1643 if ( *it == "Home 2 Phone" )
1630 ent.setHome2Phone( *itV ); 1644 ent.setHome2Phone( *itV );
1631*/ 1645*/
1632 if ( *it == "Home Fax" ) 1646 if ( *it == "Home Fax" )
1633 ent.setHomeFax( *itV ); 1647 ent.setHomeFax( *itV );
1634 1648
1635 if ( *it == "Home Mobile" ) 1649 if ( *it == "Home Mobile" )
1636 ent.setHomeMobile( *itV ); 1650 ent.setHomeMobile( *itV );
1637/* 1651/*
1638 if ( *it == "Car Phone" ) 1652 if ( *it == "Car Phone" )
1639 ent.setCarPhone( *itV ); 1653 ent.setCarPhone( *itV );
1640 1654
1641 if ( *it == "ISDN Phone" ) 1655 if ( *it == "ISDN Phone" )
1642 ent.setISDNPhone( *itV ); 1656 ent.setISDNPhone( *itV );
1643 1657
1644 if ( *it == "Other Phone" ) 1658 if ( *it == "Other Phone" )
1645 ent.setOtherPhone( *itV ); 1659 ent.setOtherPhone( *itV );
1646*/ 1660*/
1647 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) 1661 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
1648 ent.setBusinessPager( *itV ); 1662 ent.setBusinessPager( *itV );
1649/* 1663/*
1650 if ( *it == "Home Pager" ) 1664 if ( *it == "Home Pager" )
1651 ent.setHomePager( *itV ); 1665 ent.setHomePager( *itV );
1652 1666
1653 if ( *it == "AIM IM" ) 1667 if ( *it == "AIM IM" )
1654 ent.setAIMIM( *itV ); 1668 ent.setAIMIM( *itV );
1655 1669
1656 if ( *it == "ICQ IM" ) 1670 if ( *it == "ICQ IM" )
1657 ent.setICQIM( *itV ); 1671 ent.setICQIM( *itV );
1658 1672
1659 if ( *it == "Jabber IM" ) 1673 if ( *it == "Jabber IM" )
1660 ent.setJabberIM( *itV ); 1674 ent.setJabberIM( *itV );
1661 1675
1662 if ( *it == "MSN IM" ) 1676 if ( *it == "MSN IM" )
1663 ent.setMSNIM( *itV ); 1677 ent.setMSNIM( *itV );
1664 1678
1665 if ( *it == "Yahoo IM" ) 1679 if ( *it == "Yahoo IM" )
1666 ent.setYahooIM( *itV ); 1680 ent.setYahooIM( *itV );
1667*/ 1681*/
1668 if ( *it == "Home Web Page" ) 1682 if ( *it == "Home Web Page" )
1669 ent.setHomeWebpage( *itV ); 1683 ent.setHomeWebpage( *itV );
1670 1684
1671 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) 1685 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1672 ent.setBusinessWebpage( *itV ); 1686 ent.setBusinessWebpage( *itV );
1673 1687
1674 1688
1675 } 1689 }
1676 1690
1677 int gender = cmbGender->currentItem(); 1691 int gender = cmbGender->currentItem();
1678 ent.setGender( QString::number( gender ) ); 1692 ent.setGender( QString::number( gender ) );
1679 1693
1680 QString str = txtNote->text(); 1694 QString str = txtNote->text();
1681 if ( !str.isNull() ) 1695 if ( !str.isNull() )
1682 ent.setNotes( str ); 1696 ent.setNotes( str );
1683 1697
1684} 1698}
1685 1699
1686void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 1700void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
1687 QString &strAll ) 1701 QString &strAll )
1688{ 1702{
1689 int where, 1703 int where,
1690 start; 1704 start;
1691 if ( txt.isEmpty() ) 1705 if ( txt.isEmpty() )
1692 return; 1706 return;
1693 // find the first 1707 // find the first
1694 where = txt.find( ',' ); 1708 where = txt.find( ',' );
1695 if ( where < 0 ) { 1709 if ( where < 0 ) {
1696 strDefaultEmail = txt; 1710 strDefaultEmail = txt;
1697 strAll = txt; 1711 strAll = txt;
1698 } else { 1712 } else {
1699 strDefaultEmail = txt.left( where ).stripWhiteSpace(); 1713 strDefaultEmail = txt.left( where ).stripWhiteSpace();
1700 strAll = strDefaultEmail; 1714 strAll = strDefaultEmail;
1701 while ( where > -1 ) { 1715 while ( where > -1 ) {
1702 strAll.append(" "); 1716 strAll.append(" ");
1703 start = where; 1717 start = where;
1704 where = txt.find( ',', where + 1 ); 1718 where = txt.find( ',', where + 1 );
1705 if ( where > - 1 ) 1719 if ( where > - 1 )
1706 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); 1720 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() );
1707 else // grab until the end... 1721 else // grab until the end...
1708 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); 1722 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() );
1709 } 1723 }
1710 } 1724 }
1711} 1725}
1712 1726
1713void parseEmailTo( const QString &strDefaultEmail, 1727void parseEmailTo( const QString &strDefaultEmail,
1714 const QString &strOtherEmail, QString &strBack ) 1728 const QString &strOtherEmail, QString &strBack )
1715{ 1729{
1716 // create a comma dilimeted set of emails... 1730 // create a comma dilimeted set of emails...
1717 // use the power of short circuiting... 1731 // use the power of short circuiting...
1718 bool foundDefault = false; 1732 bool foundDefault = false;
1719 QString strTmp; 1733 QString strTmp;
1720 int start = 0; 1734 int start = 0;
1721 int where; 1735 int where;
1722 // start at the beginng. 1736 // start at the beginng.
1723 strBack = strDefaultEmail; 1737 strBack = strDefaultEmail;
1724 where = 0; 1738 where = 0;
1725 while ( where > -1 ) { 1739 while ( where > -1 ) {
1726 start = where; 1740 start = where;
1727 where = strOtherEmail.find( ' ', where + 1 ); 1741 where = strOtherEmail.find( ' ', where + 1 );
1728 if ( where > 0 ) { 1742 if ( where > 0 ) {
1729 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); 1743 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace();
1730 } else 1744 } else
1731 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); 1745 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace();
1732 if ( foundDefault || strTmp != strDefaultEmail ) { 1746 if ( foundDefault || strTmp != strDefaultEmail ) {
1733 strBack.append( ", " ); 1747 strBack.append( ", " );
1734 strBack.append( strTmp ); 1748 strBack.append( strTmp );
1735 } else 1749 } else
1736 foundDefault = true; 1750 foundDefault = true;
1737 } 1751 }
1738} 1752}
1739 1753
1740 1754
1741static inline bool containsAlphaNum( const QString &str ) 1755static inline bool containsAlphaNum( const QString &str )
1742{ 1756{
1743 int i, 1757 int i,
1744 count = str.length(); 1758 count = str.length();
1745 for ( i = 0; i < count; i++ ) 1759 for ( i = 0; i < count; i++ )
1746 if ( !str[i].isSpace() ) 1760 if ( !str[i].isSpace() )
1747 return TRUE; 1761 return TRUE;
1748 return FALSE; 1762 return FALSE;
1749} 1763}
1750 1764
1751static inline bool constainsWhiteSpace( const QString &str ) 1765static inline bool constainsWhiteSpace( const QString &str )
1752{ 1766{
1753 int i, 1767 int i,
1754 count = str.length(); 1768 count = str.length();
1755 for (i = 0; i < count; i++ ) 1769 for (i = 0; i < count; i++ )
1756 if ( str[i].isSpace() ) 1770 if ( str[i].isSpace() )
1757 return TRUE; 1771 return TRUE;
1758 return FALSE; 1772 return FALSE;
1759} 1773}
1760 1774