summaryrefslogtreecommitdiff
authortux_mike <tux_mike>2002-04-08 21:07:14 (UTC)
committer tux_mike <tux_mike>2002-04-08 21:07:14 (UTC)
commit3c37907fd38287a8402cca1063ce6ba69c75e954 (patch) (unidiff)
tree41bc02fc351a0db0667ddbd7f6d12cfb19a6ffee
parent9dd42008cd6dea68520c58a569874a7cc8230eb0 (diff)
downloadopie-3c37907fd38287a8402cca1063ce6ba69c75e954.zip
opie-3c37907fd38287a8402cca1063ce6ba69c75e954.tar.gz
opie-3c37907fd38287a8402cca1063ce6ba69c75e954.tar.bz2
Fixed little bugs, added macro to disable find on sharp rom, other small feature additons.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp16
-rw-r--r--core/pim/addressbook/contacteditor.cpp255
-rw-r--r--core/pim/addressbook/contacteditor.h4
3 files changed, 261 insertions, 14 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index e8fa37c..5a8038b 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -1,80 +1,84 @@
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** Contact info@trolltech.com if any conditions of this licensing are 16** Contact 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#include <qpe/qpeapplication.h> 29#include <qpe/qpeapplication.h>
30#include <qpe/config.h> 30#include <qpe/config.h>
31#include <qpe/contact.h> 31#include <qpe/contact.h>
32
33#ifndef MAKE_FOR_SHARP_ROM
32#include <qpe/finddialog.h> 34#include <qpe/finddialog.h>
35#endif
36
33#include <qpe/global.h> 37#include <qpe/global.h>
34#include <qpe/resource.h> 38#include <qpe/resource.h>
35#include <qpe/ir.h> 39#include <qpe/ir.h>
36#include <qpe/qpemessagebox.h> 40#include <qpe/qpemessagebox.h>
37#include <qpe/qcopenvelope_qws.h> 41#include <qpe/qcopenvelope_qws.h>
38 42
39#include <qaction.h> 43#include <qaction.h>
40#include <qdialog.h> 44#include <qdialog.h>
41#include <qdir.h> 45#include <qdir.h>
42#include <qfile.h> 46#include <qfile.h>
43#include <qimage.h> 47#include <qimage.h>
44#include <qlayout.h> 48#include <qlayout.h>
45#include <qpe/qpemenubar.h> 49#include <qpe/qpemenubar.h>
46#include <qmessagebox.h> 50#include <qmessagebox.h>
47#include <qpixmap.h> 51#include <qpixmap.h>
48#include <qpopupmenu.h> 52#include <qpopupmenu.h>
49#include <qpe/qpetoolbar.h> 53#include <qpe/qpetoolbar.h>
50#include <qstringlist.h> 54#include <qstringlist.h>
51#include <qtoolbutton.h> 55#include <qtoolbutton.h>
52#include <qwhatsthis.h> 56#include <qwhatsthis.h>
53 57
54#include <stdlib.h> 58#include <stdlib.h>
55#include <sys/stat.h> 59#include <sys/stat.h>
56#include <sys/types.h> 60#include <sys/types.h>
57#include <fcntl.h> 61#include <fcntl.h>
58#include <unistd.h> 62#include <unistd.h>
59 63
60#include <qdatetime.h> 64#include <qdatetime.h>
61 65
62static QString addressbookOldXMLFilename() 66static QString addressbookOldXMLFilename()
63{ 67{
64 QString filename = QPEApplication::documentDir() + "addressbook.xml"; 68 QString filename = QPEApplication::documentDir() + "addressbook.xml";
65 return filename; 69 return filename;
66} 70}
67 71
68static QString addressbookXMLFilename() 72static QString addressbookXMLFilename()
69{ 73{
70 QString filename = Global::applicationFileName("addressbook", 74 QString filename = Global::applicationFileName("addressbook",
71 "addressbook.xml"); 75 "addressbook.xml");
72 return filename; 76 return filename;
73} 77}
74 78
75static QString addressbookPersonalVCardName() 79static QString addressbookPersonalVCardName()
76{ 80{
77 QString filename = Global::applicationFileName("addressbook", 81 QString filename = Global::applicationFileName("addressbook",
78 "businesscard.vcf"); 82 "businesscard.vcf");
79 return filename; 83 return filename;
80} 84}
@@ -84,102 +88,104 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
84 WFlags f ) 88 WFlags f )
85 : QMainWindow( parent, name, f ), 89 : QMainWindow( parent, name, f ),
86 abEditor(0), 90 abEditor(0),
87 bAbEditFirstTime(TRUE), 91 bAbEditFirstTime(TRUE),
88 syncing(FALSE) 92 syncing(FALSE)
89{ 93{
90 initFields(); 94 initFields();
91 95
92 setCaption( tr("Contacts") ); 96 setCaption( tr("Contacts") );
93 setIcon( Resource::loadPixmap( "AddressBook" ) ); 97 setIcon( Resource::loadPixmap( "AddressBook" ) );
94 98
95 setToolBarsMovable( FALSE ); 99 setToolBarsMovable( FALSE );
96 100
97 // Create Toolbars 101 // Create Toolbars
98 102
99 QPEToolBar *bar = new QPEToolBar( this ); 103 QPEToolBar *bar = new QPEToolBar( this );
100 bar->setHorizontalStretchable( TRUE ); 104 bar->setHorizontalStretchable( TRUE );
101 105
102 QPEMenuBar *mbList = new QPEMenuBar( bar ); 106 QPEMenuBar *mbList = new QPEMenuBar( bar );
103 mbList->setMargin( 0 ); 107 mbList->setMargin( 0 );
104 108
105 QPopupMenu *edit = new QPopupMenu( this ); 109 QPopupMenu *edit = new QPopupMenu( this );
106 mbList->insertItem( tr( "Contact" ), edit ); 110 mbList->insertItem( tr( "Contact" ), edit );
107 111
108 listTools = new QPEToolBar( this, "list operations" ); 112 listTools = new QPEToolBar( this, "list operations" );
109 113
110 114
111 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 115 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null,
112 0, this, 0 ); 116 0, this, 0 );
113 actionNew = a; 117 actionNew = a;
114 connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); 118 connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) );
115 a->addTo( edit ); 119 a->addTo( edit );
116 a->addTo( listTools ); 120 a->addTo( listTools );
117 121
118 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, 122 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null,
119 0, this, 0 ); 123 0, this, 0 );
120 actionEdit = a; 124 actionEdit = a;
121 connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); 125 connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) );
122 a->addTo( edit ); 126 a->addTo( edit );
123 a->addTo( listTools ); 127 a->addTo( listTools );
124 128
125 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 129 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null,
126 0, this, 0 ); 130 0, this, 0 );
127 actionTrash = a; 131 actionTrash = a;
128 connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); 132 connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) );
129 a->addTo( edit ); 133 a->addTo( edit );
130 a->addTo( listTools ); 134 a->addTo( listTools );
131 135
136#ifndef MAKE_FOR_SHARP_ROM
132 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), 137 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ),
133 QString::null, 0, this, 0 ); 138 QString::null, 0, this, 0 );
134 actionFind = a; 139 actionFind = a;
135 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); 140 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) );
136 a->addTo( edit ); 141 a->addTo( edit );
137 a->addTo( listTools ); 142 a->addTo( listTools );
143#endif
138 144
139 145
140 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), 146 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ),
141 QString::null, 0, this, 0 ); 147 QString::null, 0, this, 0 );
142 //a->setEnabled( FALSE ); we got support for it now :) zecke 148 //a->setEnabled( FALSE ); we got support for it now :) zecke
143 actionMail = a; 149 actionMail = a;
144 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); 150 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) );
145 a->addTo( edit ); 151 a->addTo( edit );
146 a->addTo( listTools ); 152 a->addTo( listTools );
147 153
148 154
149 155
150 if ( Ir::supported() ) { 156 if ( Ir::supported() ) {
151 a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, 157 a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null,
152 0, this, 0 ); 158 0, this, 0 );
153 actionBeam = a; 159 actionBeam = a;
154 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); 160 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) );
155 a->addTo( edit ); 161 a->addTo( edit );
156 a->addTo( listTools ); 162 a->addTo( listTools );
157 } 163 }
158 164
159 edit->insertSeparator(); 165 edit->insertSeparator();
160 166
161 a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); 167 a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE );
162 actionPersonal = a; 168 actionPersonal = a;
163 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); 169 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) );
164 a->addTo( edit ); 170 a->addTo( edit );
165 171
166 172
167 a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); 173 a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 );
168 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); 174 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
169 a->addTo( edit ); 175 a->addTo( edit );
170 176
171 // Create Views 177 // Create Views
172 178
173 // This is safe to call without checking to see if it exists... 179 // This is safe to call without checking to see if it exists...
174 // not to mention it also does the necessary stuff for the 180 // not to mention it also does the necessary stuff for the
175 // journaling... 181 // journaling...
176 QString str = addressbookXMLFilename(); 182 QString str = addressbookXMLFilename();
177 if ( str.isNull() ) { 183 if ( str.isNull() ) {
178 QMessageBox::warning( this, tr("Out of Space"), 184 QMessageBox::warning( this, tr("Out of Space"),
179 tr("There is not enough space to create\n" 185 tr("There is not enough space to create\n"
180 "neccessary startup files.\n" 186 "neccessary startup files.\n"
181 "\nFree up some space before\nentering data!") 187 "\nFree up some space before\nentering data!")
182 ); 188 );
183 } 189 }
184 190
185 abList = new AbTable( &orderedFields, this, "table" ); 191 abList = new AbTable( &orderedFields, this, "table" );
@@ -465,106 +471,110 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
465 QCopEnvelope e(ch,m); 471 QCopEnvelope e(ch,m);
466 i=0; 472 i=0;
467 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { 473 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) {
468 QStringList sel = picker.selection(i++); 474 QStringList sel = picker.selection(i++);
469 e << sel; 475 e << sel;
470 } 476 }
471 } 477 }
472#endif 478#endif
473 479
474} 480}
475 481
476void AddressbookWindow::editPersonal() 482void AddressbookWindow::editPersonal()
477{ 483{
478 QString filename = addressbookPersonalVCardName(); 484 QString filename = addressbookPersonalVCardName();
479 Contact me; 485 Contact me;
480 if (QFile::exists(filename)) 486 if (QFile::exists(filename))
481 me = Contact::readVCard( filename )[0]; 487 me = Contact::readVCard( filename )[0];
482 if (bAbEditFirstTime) { 488 if (bAbEditFirstTime) {
483 abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields, 489 abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields,
484 this, "editor" ); 490 this, "editor" );
485 // don't create a new editor every time 491 // don't create a new editor every time
486 bAbEditFirstTime = FALSE; 492 bAbEditFirstTime = FALSE;
487 } else 493 } else
488 abEditor->setEntry( me ); 494 abEditor->setEntry( me );
489 495
490 abEditor->setCaption(tr("Edit My Personal Details")); 496 abEditor->setCaption(tr("Edit My Personal Details"));
491 abEditor->showMaximized(); 497 abEditor->showMaximized();
492 498
493 // fix the foxus... 499 // fix the foxus...
494 abEditor->setNameFocus(); 500 abEditor->setNameFocus();
495 if ( abEditor->exec() ) { 501 if ( abEditor->exec() ) {
496 setFocus(); 502 setFocus();
497 Contact new_personal = abEditor->entry(); 503 Contact new_personal = abEditor->entry();
498 QString fname = addressbookPersonalVCardName(); 504 QString fname = addressbookPersonalVCardName();
499 Contact::writeVCard( fname, new_personal ); 505 Contact::writeVCard( fname, new_personal );
500 abView()->init(new_personal); 506 abView()->init(new_personal);
501 abView()->sync(); 507 abView()->sync();
502 } 508 }
503 abEditor->setCaption( tr("Edit Address") ); 509 abEditor->setCaption( tr("Edit Address") );
504} 510}
505 511
506void AddressbookWindow::slotPersonalView() 512void AddressbookWindow::slotPersonalView()
507{ 513{
508 if (!actionPersonal->isOn()) { 514 if (!actionPersonal->isOn()) {
509 // we just turned it off 515 // we just turned it off
510 setCaption( tr("Contacts") ); 516 setCaption( tr("Contacts") );
511 actionNew->setEnabled(TRUE); 517 actionNew->setEnabled(TRUE);
512 actionTrash->setEnabled(TRUE); 518 actionTrash->setEnabled(TRUE);
519#ifndef MAKE_FOR_SHARP_ROM
513 actionFind->setEnabled(TRUE); 520 actionFind->setEnabled(TRUE);
521#endif
514 slotUpdateToolbar(); // maybe some of the above could be moved there 522 slotUpdateToolbar(); // maybe some of the above could be moved there
515 showList(); 523 showList();
516 return; 524 return;
517 } 525 }
518 526
519 // XXX need to disable some QActions. 527 // XXX need to disable some QActions.
520 actionNew->setEnabled(FALSE); 528 actionNew->setEnabled(FALSE);
521 actionTrash->setEnabled(FALSE); 529 actionTrash->setEnabled(FALSE);
530#ifndef MAKE_FOR_SHARP_ROM
522 actionFind->setEnabled(FALSE); 531 actionFind->setEnabled(FALSE);
532#endif
523 actionMail->setEnabled(FALSE); 533 actionMail->setEnabled(FALSE);
524 534
525 setCaption( tr("Contacts - My Personal Details") ); 535 setCaption( tr("Contacts - My Personal Details") );
526 QString filename = addressbookPersonalVCardName(); 536 QString filename = addressbookPersonalVCardName();
527 Contact me; 537 Contact me;
528 if (QFile::exists(filename)) 538 if (QFile::exists(filename))
529 me = Contact::readVCard( filename )[0]; 539 me = Contact::readVCard( filename )[0];
530 540
531 abView()->init( me ); 541 abView()->init( me );
532 abView()->sync(); 542 abView()->sync();
533 abList->hide(); 543 abList->hide();
534 setCentralWidget( abView() ); 544 setCentralWidget( abView() );
535 mView->show(); 545 mView->show();
536 mView->setFocus(); 546 mView->setFocus();
537} 547}
538 548
539void AddressbookWindow::editEntry( EntryMode entryMode ) 549void AddressbookWindow::editEntry( EntryMode entryMode )
540{ 550{
541 Contact entry; 551 Contact entry;
542 if ( bAbEditFirstTime ) { 552 if ( bAbEditFirstTime ) {
543 abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields, 553 abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields,
544 this, "editor" ); 554 this, "editor" );
545 bAbEditFirstTime = FALSE; 555 bAbEditFirstTime = FALSE;
546 if ( entryMode == EditEntry ) 556 if ( entryMode == EditEntry )
547 abEditor->setEntry( abList->currentEntry() ); 557 abEditor->setEntry( abList->currentEntry() );
548 } 558 }
549 // other things may chane the caption. 559 // other things may chane the caption.
550 abEditor->setCaption( tr("Edit Address") ); 560 abEditor->setCaption( tr("Edit Address") );
551 561
552#if defined(Q_WS_QWS) || defined(_WS_QWS_) 562#if defined(Q_WS_QWS) || defined(_WS_QWS_)
553 abEditor->showMaximized(); 563 abEditor->showMaximized();
554#endif 564#endif
555 // fix the foxus... 565 // fix the foxus...
556 abEditor->setNameFocus(); 566 abEditor->setNameFocus();
557 if ( abEditor->exec() ) { 567 if ( abEditor->exec() ) {
558 setFocus(); 568 setFocus();
559 if ( entryMode == NewEntry ) { 569 if ( entryMode == NewEntry ) {
560 Contact insertEntry = abEditor->entry(); 570 Contact insertEntry = abEditor->entry();
561 insertEntry.assignUid(); 571 insertEntry.assignUid();
562 abList->addEntry( insertEntry ); 572 abList->addEntry( insertEntry );
563 } else { 573 } else {
564 Contact replaceEntry = abEditor->entry(); 574 Contact replaceEntry = abEditor->entry();
565 if ( !replaceEntry.isValidUid() ) 575 if ( !replaceEntry.isValidUid() )
566 replaceEntry.assignUid(); 576 replaceEntry.assignUid();
567 abList->replaceCurrentEntry( replaceEntry ); 577 abList->replaceCurrentEntry( replaceEntry );
568 } 578 }
569 } 579 }
570 populateCategories(); 580 populateCategories();
@@ -731,101 +741,107 @@ void AddressbookWindow::initFields()
731 for ( itVis = visibleFields.begin(); 741 for ( itVis = visibleFields.begin();
732 itVis != visibleFields.end() && itVl != allFields.end(); 742 itVis != visibleFields.end() && itVl != allFields.end();
733 ++itVis, ++itVl ) { 743 ++itVis, ++itVl ) {
734 if ( *it == *itVis && itVl != allFields.end() ) { 744 if ( *it == *itVis && itVl != allFields.end() ) {
735 orderedFields.append( *itVl ); 745 orderedFields.append( *itVl );
736 } 746 }
737 } 747 }
738 } 748 }
739 } else { 749 } else {
740 QValueList<int>::ConstIterator it; 750 QValueList<int>::ConstIterator it;
741 for ( it = allFields.begin(); it != allFields.end(); ++it ) 751 for ( it = allFields.begin(); it != allFields.end(); ++it )
742 orderedFields.append( *it ); 752 orderedFields.append( *it );
743 753
744 slOrderedFields = visibleFields; 754 slOrderedFields = visibleFields;
745 orderedFields.remove( Qtopia::AddressUid ); 755 orderedFields.remove( Qtopia::AddressUid );
746 orderedFields.remove( Qtopia::Title ); 756 orderedFields.remove( Qtopia::Title );
747 orderedFields.remove( Qtopia::Groups ); 757 orderedFields.remove( Qtopia::Groups );
748 orderedFields.remove( Qtopia::AddressCategory ); 758 orderedFields.remove( Qtopia::AddressCategory );
749 orderedFields.remove( Qtopia::FirstName ); 759 orderedFields.remove( Qtopia::FirstName );
750 orderedFields.remove( Qtopia::LastName ); 760 orderedFields.remove( Qtopia::LastName );
751 orderedFields.remove( Qtopia::DefaultEmail ); 761 orderedFields.remove( Qtopia::DefaultEmail );
752 orderedFields.remove( Qtopia::FileAs ); 762 orderedFields.remove( Qtopia::FileAs );
753 orderedFields.remove( Qtopia::Notes ); 763 orderedFields.remove( Qtopia::Notes );
754 orderedFields.remove( Qtopia::Gender ); 764 orderedFields.remove( Qtopia::Gender );
755 slOrderedFields.remove( tr("Name Title") ); 765 slOrderedFields.remove( tr("Name Title") );
756 slOrderedFields.remove( tr("First Name") ); 766 slOrderedFields.remove( tr("First Name") );
757 slOrderedFields.remove( tr("Last Name") ); 767 slOrderedFields.remove( tr("Last Name") );
758 slOrderedFields.remove( tr("File As") ); 768 slOrderedFields.remove( tr("File As") );
759 slOrderedFields.remove( tr("Default Email") ); 769 slOrderedFields.remove( tr("Default Email") );
760 slOrderedFields.remove( tr("Notes") ); 770 slOrderedFields.remove( tr("Notes") );
761 slOrderedFields.remove( tr("Gender") ); 771 slOrderedFields.remove( tr("Gender") );
762 772
763 } 773 }
764} 774}
765 775
766 776
767AbLabel *AddressbookWindow::abView() 777AbLabel *AddressbookWindow::abView()
768{ 778{
769 if ( !mView ) { 779 if ( !mView ) {
770 mView = new AbLabel( this, "viewer" ); 780 mView = new AbLabel( this, "viewer" );
771 mView->init( Contact() ); 781 mView->init( Contact() );
772 connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); 782 connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) );
773 } 783 }
774 return mView; 784 return mView;
775} 785}
776 786
777void AddressbookWindow::slotFind() 787void AddressbookWindow::slotFind()
778{ 788{
789#ifndef MAKE_FOR_SHARP_ROM
779 if ( centralWidget() == abView() ) 790 if ( centralWidget() == abView() )
780 showList(); 791 showList();
792
781 FindDialog frmFind( "Contacts", this ); 793 FindDialog frmFind( "Contacts", this );
782 QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int))); 794 QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int)));
783 QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) ); 795 QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) );
784 QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) ); 796 QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) );
797
785 frmFind.exec(); 798 frmFind.exec();
799
786 if ( abList->numSelections() ) 800 if ( abList->numSelections() )
787 abList->clearSelection(); 801 abList->clearSelection();
802
788 abList->clearFindRow(); 803 abList->clearFindRow();
804#endif
789} 805}
790 806
791void AddressbookWindow::slotSetCategory( int c ) 807void AddressbookWindow::slotSetCategory( int c )
792{ 808{
793 if ( c <= 0 ) 809 if ( c <= 0 )
794 return; 810 return;
795 for ( unsigned int i = 1; i < catMenu->count(); i++ ) 811 for ( unsigned int i = 1; i < catMenu->count(); i++ )
796 catMenu->setItemChecked( i, c == (int)i ); 812 catMenu->setItemChecked( i, c == (int)i );
797 if ( c == 1 ) { 813 if ( c == 1 ) {
798 abList->setShowCategory( QString::null ); 814 abList->setShowCategory( QString::null );
799 setCaption( tr("Contacts") + " - " + tr ( "All" ) ); 815 setCaption( tr("Contacts") + " - " + tr ( "All" ) );
800 } else if ( c == (int)catMenu->count() ) { 816 } else if ( c == (int)catMenu->count() ) {
801 abList->setShowCategory( tr( "Unfiled" ) ); 817 abList->setShowCategory( tr( "Unfiled" ) );
802 setCaption( tr("Contacts") + " - " + tr( "Unfiled" ) ); 818 setCaption( tr("Contacts") + " - " + tr( "Unfiled" ) );
803 } else { 819 } else {
804 QString cat = abList->categories()[c - 2]; 820 QString cat = abList->categories()[c - 2];
805 abList->setShowCategory( cat ); 821 abList->setShowCategory( cat );
806 setCaption( tr("Contacts") + " - " + cat ); 822 setCaption( tr("Contacts") + " - " + cat );
807 } 823 }
808} 824}
809 825
810void AddressbookWindow::populateCategories() 826void AddressbookWindow::populateCategories()
811{ 827{
812 catMenu->clear(); 828 catMenu->clear();
813 829
814 int id, 830 int id,
815 rememberId; 831 rememberId;
816 id = 1; 832 id = 1;
817 catMenu->insertItem( tr( "All" ), id++ ); 833 catMenu->insertItem( tr( "All" ), id++ );
818 QStringList categories = abList->categories(); 834 QStringList categories = abList->categories();
819 categories.append( tr( "Unfiled" ) ); 835 categories.append( tr( "Unfiled" ) );
820 for ( QStringList::Iterator it = categories.begin(); 836 for ( QStringList::Iterator it = categories.begin();
821 it != categories.end(); ++it ) { 837 it != categories.end(); ++it ) {
822 catMenu->insertItem( *it, id ); 838 catMenu->insertItem( *it, id );
823 if ( *it == abList->showCategory() ) 839 if ( *it == abList->showCategory() )
824 rememberId = id; 840 rememberId = id;
825 ++id; 841 ++id;
826 } 842 }
827 if ( abList->showCategory().isEmpty() ) 843 if ( abList->showCategory().isEmpty() )
828 slotSetCategory( 1 ); 844 slotSetCategory( 1 );
829 else 845 else
830 slotSetCategory( rememberId ); 846 slotSetCategory( rememberId );
831} 847}
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 6edab2c..cbcd11f 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -238,441 +238,668 @@ void ContactEditor::init() {
238 continue; 238 continue;
239 } 239 }
240 240
241 if ( (*it).right( 4 ) == tr( "City" ) ) { 241 if ( (*it).right( 4 ) == tr( "City" ) ) {
242 hasCity = TRUE; 242 hasCity = TRUE;
243 //slDynamicEntries->remove( it ); 243 //slDynamicEntries->remove( it );
244 continue; 244 continue;
245 } 245 }
246 246
247 if ( (*it).right( 5 ) == tr( "State" ) ) { 247 if ( (*it).right( 5 ) == tr( "State" ) ) {
248 hasState = TRUE; 248 hasState = TRUE;
249 //slDynamicEntries->remove( it ); 249 //slDynamicEntries->remove( it );
250 continue; 250 continue;
251 } 251 }
252 252
253 if ( (*it).right( 3 ) == tr( "Zip" ) ) { 253 if ( (*it).right( 3 ) == tr( "Zip" ) ) {
254 hasZip = TRUE; 254 hasZip = TRUE;
255 //slDynamicEntries->remove( it ); 255 //slDynamicEntries->remove( it );
256 continue; 256 continue;
257 } 257 }
258 258
259 if ( (*it).right( 7 ) == tr( "Country" ) ) { 259 if ( (*it).right( 7 ) == tr( "Country" ) ) {
260 hasCountry = TRUE; 260 hasCountry = TRUE;
261 //slDynamicEntries->remove( it ); 261 //slDynamicEntries->remove( it );
262 continue; 262 continue;
263 } 263 }
264 264
265 slDynamicEntries->append( *it ); 265 slDynamicEntries->append( *it );
266 } 266 }
267 } 267 }
268 268
269 QVBoxLayout *vb = new QVBoxLayout( this ); 269 QVBoxLayout *vb = new QVBoxLayout( this );
270 270
271 tabMain = new QTabWidget( this ); 271 tabMain = new QTabWidget( this );
272 vb->addWidget( tabMain ); 272 vb->addWidget( tabMain );
273 273
274 QWidget *tabViewport = new QWidget ( tabMain ); 274 QWidget *tabViewport = new QWidget ( tabMain );
275 275
276 vb = new QVBoxLayout( tabViewport ); 276 vb = new QVBoxLayout( tabViewport );
277 277
278 svGeneral = new QScrollView( tabViewport ); 278 svGeneral = new QScrollView( tabViewport );
279 vb->addWidget( svGeneral, 0, 0 ); 279 vb->addWidget( svGeneral, 0, 0 );
280 svGeneral->setResizePolicy( QScrollView::AutoOneFit ); 280 svGeneral->setResizePolicy( QScrollView::AutoOneFit );
281 svGeneral->setFrameStyle( QFrame::NoFrame ); 281 svGeneral->setFrameStyle( QFrame::NoFrame );
282 282
283 QWidget *container = new QWidget( svGeneral->viewport() ); 283 QWidget *container = new QWidget( svGeneral->viewport() );
284 svGeneral->addChild( container ); 284 svGeneral->addChild( container );
285 285
286 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 3 ); 286 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 );
287 gl->setResizeMode( QLayout::FreeResize ); 287 gl->setResizeMode( QLayout::FreeResize );
288 288
289 btnFullName = new QPushButton( tr( "Full Name..." ), container ); 289 btnFullName = new QPushButton( tr( "Full Name..." ), container );
290 gl->addWidget( btnFullName, 0, 0 ); 290 gl->addWidget( btnFullName, 0, 0 );
291 txtFullName = new QLineEdit( container ); 291 txtFullName = new QLineEdit( container );
292 gl->addWidget( txtFullName, 0, 1 ); 292 gl->addWidget( txtFullName, 0, 1 );
293 293
294 QLabel *l = new QLabel( tr( "Job Title" ), container ); 294 QLabel *l = new QLabel( tr( "Job Title" ), container );
295 gl->addWidget( l, 1, 0 ); 295 gl->addWidget( l, 1, 0 );
296 txtJobTitle = new QLineEdit( container ); 296 txtJobTitle = new QLineEdit( container );
297 gl->addWidget( txtJobTitle, 1, 1 ); 297 gl->addWidget( txtJobTitle, 1, 1 );
298 298
299 l = new QLabel( tr( "Organization" ), container ); 299 l = new QLabel( tr( "Organization" ), container );
300 gl->addWidget( l, 2, 0 ); 300 gl->addWidget( l, 2, 0 );
301 txtOrganization = new QLineEdit( container ); 301 txtOrganization = new QLineEdit( container );
302 gl->addWidget( txtOrganization, 2, 1 ); 302 gl->addWidget( txtOrganization, 2, 1 );
303 303
304 cmbChooserField1 = new QComboBox( FALSE, container ); 304 cmbChooserField1 = new QComboBox( FALSE, container );
305 cmbChooserField1->setMaximumWidth( 100 ); 305 cmbChooserField1->setMaximumWidth( 90 );
306 gl->addWidget( cmbChooserField1, 3, 0 ); 306 gl->addWidget( cmbChooserField1, 3, 0 );
307 txtChooserField1 = new QLineEdit( container ); 307 txtChooserField1 = new QLineEdit( container );
308 gl->addWidget( txtChooserField1, 3, 1 ); 308 gl->addWidget( txtChooserField1, 3, 1 );
309 309
310 cmbChooserField2 = new QComboBox( FALSE, container ); 310 cmbChooserField2 = new QComboBox( FALSE, container );
311 cmbChooserField2->setMaximumWidth( 100 ); 311 cmbChooserField2->setMaximumWidth( 90 );
312 gl->addWidget( cmbChooserField2, 4, 0 ); 312 gl->addWidget( cmbChooserField2, 4, 0 );
313 txtChooserField2 = new QLineEdit( container ); 313 txtChooserField2 = new QLineEdit( container );
314 gl->addWidget( txtChooserField2, 4, 1 ); 314 gl->addWidget( txtChooserField2, 4, 1 );
315 315
316 cmbChooserField3 = new QComboBox( FALSE, container ); 316 cmbChooserField3 = new QComboBox( FALSE, container );
317 cmbChooserField3->setMaximumWidth( 100 ); 317 cmbChooserField3->setMaximumWidth( 90 );
318 gl->addWidget( cmbChooserField3, 5, 0 ); 318 gl->addWidget( cmbChooserField3, 5, 0 );
319 txtChooserField3 = new QLineEdit( container ); 319 txtChooserField3 = new QLineEdit( container );
320 gl->addWidget( txtChooserField3, 5, 1 ); 320 gl->addWidget( txtChooserField3, 5, 1 );
321 321
322 l = new QLabel( tr( "File As" ), container ); 322 l = new QLabel( tr( "File As" ), container );
323 gl->addWidget( l, 6, 0 ); 323 gl->addWidget( l, 6, 0 );
324 cmbFileAs = new QComboBox( TRUE, container ); 324 cmbFileAs = new QComboBox( TRUE, container );
325 gl->addWidget( cmbFileAs, 6, 1 ); 325 gl->addWidget( cmbFileAs, 6, 1 );
326 326
327 l = new QLabel( tr( "Category" ), container ); 327 l = new QLabel( tr( "Category" ), container );
328 gl->addWidget( l, 7, 0 ); 328 gl->addWidget( l, 7, 0 );
329 cmbCat = new CategorySelect( container ); 329 cmbCat = new CategorySelect( container );
330 gl->addWidget( cmbCat, 7, 1 ); 330 gl->addWidget( cmbCat, 7, 1 );
331 331
332 btnNote = new QPushButton( tr( "Notes..." ), container ); 332 btnNote = new QPushButton( tr( "Notes..." ), container );
333 gl->addWidget( btnNote, 8, 1 ); 333 gl->addWidget( btnNote, 8, 1 );
334 334
335 tabMain->insertTab( tabViewport, tr( "General" ) ); 335 tabMain->insertTab( tabViewport, tr( "General" ) );
336 336
337 tabViewport = new QWidget ( tabMain ); 337 tabViewport = new QWidget ( tabMain );
338 338
339 vb = new QVBoxLayout( tabViewport ); 339 vb = new QVBoxLayout( tabViewport );
340 340
341 svAddress = new QScrollView( tabViewport ); 341 svAddress = new QScrollView( tabViewport );
342 vb->addWidget( svAddress, 0, 0 ); 342 vb->addWidget( svAddress, 0, 0 );
343 svAddress->setResizePolicy( QScrollView::AutoOneFit ); 343 svAddress->setResizePolicy( QScrollView::AutoOneFit );
344 svAddress->setFrameStyle( QFrame::NoFrame ); 344 svAddress->setFrameStyle( QFrame::NoFrame );
345 345
346 container = new QWidget( svAddress->viewport() ); 346 container = new QWidget( svAddress->viewport() );
347 svAddress->addChild( container ); 347 svAddress->addChild( container );
348 348
349 gl = new QGridLayout( container, 5, 3, 2, 3 ); 349 gl = new QGridLayout( container, 6, 3, 2, 4 );
350 350
351 cmbAddress = new QComboBox( FALSE, container ); 351 cmbAddress = new QComboBox( FALSE, container );
352 cmbAddress->insertItem( tr( "Business" ) ); 352 cmbAddress->insertItem( tr( "Business" ) );
353 cmbAddress->insertItem( tr( "Home" ) ); 353 cmbAddress->insertItem( tr( "Home" ) );
354 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); 354 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 );
355 355
356 l = new QLabel( tr( "Address" ), container ); 356 l = new QLabel( tr( "Address" ), container );
357 gl->addWidget( l, 1, 0 ); 357 gl->addWidget( l, 1, 0 );
358 txtAddress = new QLineEdit( container ); 358 txtAddress = new QLineEdit( container );
359 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); 359 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 );
360/* 360/*
361 l = new QLabel( tr( "Address 2" ), container ); 361 l = new QLabel( tr( "Address 2" ), container );
362 gl->addWidget( l, 2, 0 ); 362 gl->addWidget( l, 2, 0 );
363 txtAddress2 = new QLineEdit( container ); 363 txtAddress2 = new QLineEdit( container );
364 gl->addMultiCellWidget( txtAddress2, 2, 2, 1, 2 ); 364 gl->addMultiCellWidget( txtAddress2, 2, 2, 1, 2 );
365 365
366 l = new QLabel( tr( "P.O. Box" ), container ); 366 l = new QLabel( tr( "P.O. Box" ), container );
367 gl->addWidget( l, 3, 0 ); 367 gl->addWidget( l, 3, 0 );
368 txtPOBox = new QLineEdit( container ); 368 txtPOBox = new QLineEdit( container );
369 gl->addMultiCellWidget( txtPOBox, 3, 3, 1, 2 ); 369 gl->addMultiCellWidget( txtPOBox, 3, 3, 1, 2 );
370*/ 370*/
371 l = new QLabel( tr( "City" ), container ); 371 l = new QLabel( tr( "City" ), container );
372 gl->addWidget( l, 2, 0 ); 372 gl->addWidget( l, 2, 0 );
373 txtCity = new QLineEdit( container ); 373 txtCity = new QLineEdit( container );
374 gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); 374 gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 );
375 375
376 l = new QLabel( tr( "State" ), container ); 376 l = new QLabel( tr( "State" ), container );
377 gl->addWidget( l, 3, 0 ); 377 gl->addWidget( l, 3, 0 );
378 txtState = new QLineEdit( container ); 378 txtState = new QLineEdit( container );
379 gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); 379 gl->addMultiCellWidget( txtState, 3, 3, 1, 2 );
380 380
381 l = new QLabel( tr( "Zip Code" ), container ); 381 l = new QLabel( tr( "Zip Code" ), container );
382 gl->addWidget( l, 4, 0 ); 382 gl->addWidget( l, 4, 0 );
383 txtZip = new QLineEdit( container ); 383 txtZip = new QLineEdit( container );
384 gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); 384 gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 );
385 385
386 l = new QLabel( tr( "Country" ), container ); 386 l = new QLabel( tr( "Country" ), container );
387 gl->addWidget( l, 5, 0 ); 387 gl->addWidget( l, 5, 0 );
388 cmbCountry = new QComboBox( TRUE, container ); 388 cmbCountry = new QComboBox( TRUE, container );
389 cmbCountry->insertItem( tr( "" ) ); 389 cmbCountry->insertItem( tr( "" ) );
390 cmbCountry->insertItem( tr( "United States" ) ); 390 cmbCountry->insertItem( tr ( "United States" ) );
391 cmbCountry->insertItem( tr( "United Kingdom" ) ); 391 cmbCountry->insertItem( tr ( "United Kingdom" ) );
392 cmbCountry->insertItem( tr( "Japan" ) ); 392 cmbCountry->insertItem( tr ( "Afganistan" ) );
393 cmbCountry->insertItem( tr( "France" ) ); 393 cmbCountry->insertItem( tr ( "Albania" ) );
394 cmbCountry->insertItem( tr( "Germany" ) ); 394 cmbCountry->insertItem( tr ( "Algeria" ) );
395 cmbCountry->insertItem( tr( "Norway" ) ); 395 cmbCountry->insertItem( tr ( "American Samoa" ) );
396 cmbCountry->insertItem( tr( "Canada" ) ); 396 cmbCountry->insertItem( tr ( "Andorra" ) );
397 397 cmbCountry->insertItem( tr ( "Angola" ) );
398 cmbCountry->insertItem( tr ( "Anguilla" ) );
399 cmbCountry->insertItem( tr ( "Antartica" ) );
400 cmbCountry->insertItem( tr ( "Argentina" ) );
401 cmbCountry->insertItem( tr ( "Armania" ) );
402 cmbCountry->insertItem( tr ( "Aruba" ) );
403 cmbCountry->insertItem( tr ( "Australia" ) );
404 cmbCountry->insertItem( tr ( "Austria" ) );
405 cmbCountry->insertItem( tr ( "Azerbaijan" ) );
406 cmbCountry->insertItem( tr ( "Bahamas" ) );
407 cmbCountry->insertItem( tr ( "Bahrain" ) );
408 cmbCountry->insertItem( tr ( "Bangladesh" ) );
409 cmbCountry->insertItem( tr ( "Barbados" ) );
410 cmbCountry->insertItem( tr ( "Belarus" ) );
411 cmbCountry->insertItem( tr ( "Belgium" ) );
412 cmbCountry->insertItem( tr ( "Belize" ) );
413 cmbCountry->insertItem( tr ( "Benin" ) );
414 cmbCountry->insertItem( tr ( "Bermuda" ) );
415 cmbCountry->insertItem( tr ( "Bhutan" ) );
416 cmbCountry->insertItem( tr ( "Boliva" ) );
417 cmbCountry->insertItem( tr ( "Botswana" ) );
418 cmbCountry->insertItem( tr ( "Bouvet Island" ) );
419 cmbCountry->insertItem( tr ( "Brazil" ) );
420 cmbCountry->insertItem( tr ( "Brunei Darussalam" ) );
421 cmbCountry->insertItem( tr ( "Bulgaria" ) );
422 cmbCountry->insertItem( tr ( "Burkina Faso" ) );
423 cmbCountry->insertItem( tr ( "Burundi" ) );
424 cmbCountry->insertItem( tr ( "Cambodia" ) );
425 cmbCountry->insertItem( tr ( "Camaroon" ) );
426 cmbCountry->insertItem( tr ( "Canada" ) );
427 cmbCountry->insertItem( tr ( "Cape Verde" ) );
428 cmbCountry->insertItem( tr ( "Cayman Islands" ) );
429 cmbCountry->insertItem( tr ( "Chad" ) );
430 cmbCountry->insertItem( tr ( "Chile" ) );
431 cmbCountry->insertItem( tr ( "China" ) );
432 cmbCountry->insertItem( tr ( "Christmas Island" ) );
433 cmbCountry->insertItem( tr ( "Colombia" ) );
434 cmbCountry->insertItem( tr ( "Comoros" ) );
435 cmbCountry->insertItem( tr ( "Congo" ) );
436 cmbCountry->insertItem( tr ( "Cook Island" ) );
437 cmbCountry->insertItem( tr ( "Costa Rica" ) );
438 cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) );
439 cmbCountry->insertItem( tr ( "Croatia" ) );
440 cmbCountry->insertItem( tr ( "Cuba" ) );
441 cmbCountry->insertItem( tr ( "Cyprus" ) );
442 cmbCountry->insertItem( tr ( "Czech Republic" ) );
443 cmbCountry->insertItem( tr ( "Denmark" ) );
444 cmbCountry->insertItem( tr ( "Djibouti" ) );
445 cmbCountry->insertItem( tr ( "Dominica" ) );
446 cmbCountry->insertItem( tr ( "Dominican Republic" ) );
447 cmbCountry->insertItem( tr ( "East Timor" ) );
448 cmbCountry->insertItem( tr ( "Ecuador" ) );
449 cmbCountry->insertItem( tr ( "Egypt" ) );
450 cmbCountry->insertItem( tr ( "El Salvador" ) );
451 cmbCountry->insertItem( tr ( "Equatorial Guinea" ) );
452 cmbCountry->insertItem( tr ( "Eritrea" ) );
453 cmbCountry->insertItem( tr ( "Estonia" ) );
454 cmbCountry->insertItem( tr ( "Ethiopia" ) );
455 cmbCountry->insertItem( tr ( "Falkland Islands" ) );
456 cmbCountry->insertItem( tr ( "Faroe Islands" ) );
457 cmbCountry->insertItem( tr ( "Fiji" ) );
458 cmbCountry->insertItem( tr ( "Finland" ) );
459 cmbCountry->insertItem( tr ( "France" ) );
460 cmbCountry->insertItem( tr ( "French Guiana" ) );
461 cmbCountry->insertItem( tr ( "French Polynesia" ) );
462 cmbCountry->insertItem( tr ( "Gabon" ) );
463 cmbCountry->insertItem( tr ( "Gambia" ) );
464 cmbCountry->insertItem( tr ( "Georgia" ) );
465 cmbCountry->insertItem( tr ( "Germany" ) );
466 cmbCountry->insertItem( tr ( "Gahna" ) );
467 cmbCountry->insertItem( tr ( "Gibraltar" ) );
468 cmbCountry->insertItem( tr ( "Greece" ) );
469 cmbCountry->insertItem( tr ( "Greenland" ) );
470 cmbCountry->insertItem( tr ( "Grenada" ) );
471 cmbCountry->insertItem( tr ( "Guadelupe" ) );
472 cmbCountry->insertItem( tr ( "Guam" ) );
473 cmbCountry->insertItem( tr ( "Guatemala" ) );
474 cmbCountry->insertItem( tr ( "Guinea" ) );
475 cmbCountry->insertItem( tr ( "Guinea-bissau" ) );
476 cmbCountry->insertItem( tr ( "Guyana" ) );
477 cmbCountry->insertItem( tr ( "Haiti" ) );
478 cmbCountry->insertItem( tr ( "Holy See" ) );
479 cmbCountry->insertItem( tr ( "Honduras" ) );
480 cmbCountry->insertItem( tr ( "Hong Kong" ) );
481 cmbCountry->insertItem( tr ( "Hungary" ) );
482 cmbCountry->insertItem( tr ( "Iceland" ) );
483 cmbCountry->insertItem( tr ( "India" ) );
484 cmbCountry->insertItem( tr ( "Indonesia" ) );
485 cmbCountry->insertItem( tr ( "Ireland" ) );
486 cmbCountry->insertItem( tr ( "Israel" ) );
487 cmbCountry->insertItem( tr ( "Italy" ) );
488 cmbCountry->insertItem( tr ( "Jamacia" ) );
489 cmbCountry->insertItem( tr ( "Japan" ) );
490 cmbCountry->insertItem( tr ( "Jordan" ) );
491 cmbCountry->insertItem( tr ( "Kazakhstan" ) );
492 cmbCountry->insertItem( tr ( "Kenya" ) );
493 cmbCountry->insertItem( tr ( "Kribati" ) );
494 cmbCountry->insertItem( tr ( "Korea" ) );
495 cmbCountry->insertItem( tr ( "Kuait" ) );
496 cmbCountry->insertItem( tr ( "Kyrgyztan" ) );
497 cmbCountry->insertItem( tr ( "Laos" ) );
498 cmbCountry->insertItem( tr ( "Latvia" ) );
499 cmbCountry->insertItem( tr ( "Lebanon" ) );
500 cmbCountry->insertItem( tr ( "Lesotho" ) );
501 cmbCountry->insertItem( tr ( "Liberia" ) );
502 cmbCountry->insertItem( tr ( "Liechtenstein" ) );
503 cmbCountry->insertItem( tr ( "Lithuania" ) );
504 cmbCountry->insertItem( tr ( "Luxembourg" ) );
505 cmbCountry->insertItem( tr ( "Macau" ) );
506 cmbCountry->insertItem( tr ( "Macedonia" ) );
507 cmbCountry->insertItem( tr ( "Madagascar" ) );
508 cmbCountry->insertItem( tr ( "Malawi" ) );
509 cmbCountry->insertItem( tr ( "Malaysia" ) );
510 cmbCountry->insertItem( tr ( "Maldives" ) );
511 cmbCountry->insertItem( tr ( "Mali" ) );
512 cmbCountry->insertItem( tr ( "Malta" ) );
513 cmbCountry->insertItem( tr ( "Martinique" ) );
514 cmbCountry->insertItem( tr ( "Mauritania" ) );
515 cmbCountry->insertItem( tr ( "Mauritius" ) );
516 cmbCountry->insertItem( tr ( "Mayotte" ) );
517 cmbCountry->insertItem( tr ( "Mexico" ) );
518 cmbCountry->insertItem( tr ( "Micronesia" ) );
519 cmbCountry->insertItem( tr ( "Moldova" ) );
520 cmbCountry->insertItem( tr ( "Monaco" ) );
521 cmbCountry->insertItem( tr ( "Mongolia" ) );
522 cmbCountry->insertItem( tr ( "Montserrat" ) );
523 cmbCountry->insertItem( tr ( "Morocco" ) );
524 cmbCountry->insertItem( tr ( "Mozambique" ) );
525 cmbCountry->insertItem( tr ( "Myanmar" ) );
526 cmbCountry->insertItem( tr ( "Namibia" ) );
527 cmbCountry->insertItem( tr ( "Nauru" ) );
528 cmbCountry->insertItem( tr ( "Nepal" ) );
529 cmbCountry->insertItem( tr ( "Netherlands" ) );
530 cmbCountry->insertItem( tr ( "New Caledonia" ) );
531 cmbCountry->insertItem( tr ( "New Zealand" ) );
532 cmbCountry->insertItem( tr ( "Nicaragua" ) );
533 cmbCountry->insertItem( tr ( "Niger" ) );
534 cmbCountry->insertItem( tr ( "Nigeria" ) );
535 cmbCountry->insertItem( tr ( "Niue" ) );
536 cmbCountry->insertItem( tr ( "Norway" ) );
537 cmbCountry->insertItem( tr ( "Oman" ) );
538 cmbCountry->insertItem( tr ( "Pakistan" ) );
539 cmbCountry->insertItem( tr ( "Palau" ) );
540 cmbCountry->insertItem( tr ( "Palestinian Territory" ) );
541 cmbCountry->insertItem( tr ( "Panama" ) );
542 cmbCountry->insertItem( tr ( "Papua New Guinea" ) );
543 cmbCountry->insertItem( tr ( "Paraguay" ) );
544 cmbCountry->insertItem( tr ( "Peru" ) );
545 cmbCountry->insertItem( tr ( "Philippines" ) );
546 cmbCountry->insertItem( tr ( "Pitcairn" ) );
547 cmbCountry->insertItem( tr ( "Poland" ) );
548 cmbCountry->insertItem( tr ( "Portugal" ) );
549 cmbCountry->insertItem( tr ( "Puerto Rico" ) );
550 cmbCountry->insertItem( tr ( "Qatar" ) );
551 cmbCountry->insertItem( tr ( "Reunion" ) );
552 cmbCountry->insertItem( tr ( "Romania" ) );
553 cmbCountry->insertItem( tr ( "Russia" ) );
554 cmbCountry->insertItem( tr ( "Rwanda" ) );
555 cmbCountry->insertItem( tr ( "Saint Lucia" ) );
556 cmbCountry->insertItem( tr ( "Samoa" ) );
557 cmbCountry->insertItem( tr ( "San Marino" ) );
558 cmbCountry->insertItem( tr ( "Saudi Arabia" ) );
559 cmbCountry->insertItem( tr ( "Senegal" ) );
560 cmbCountry->insertItem( tr ( "Seychelles" ) );
561 cmbCountry->insertItem( tr ( "Sierra Leone" ) );
562 cmbCountry->insertItem( tr ( "Singapore" ) );
563 cmbCountry->insertItem( tr ( "Slovakia" ) );
564 cmbCountry->insertItem( tr ( "Slovenia" ) );
565 cmbCountry->insertItem( tr ( "Solomon Islands" ) );
566 cmbCountry->insertItem( tr ( "Somalia" ) );
567 cmbCountry->insertItem( tr ( "South Africa" ) );
568 cmbCountry->insertItem( tr ( "Spain" ) );
569 cmbCountry->insertItem( tr ( "Sri Lanka" ) );
570 cmbCountry->insertItem( tr ( "St. Helena" ) );
571 cmbCountry->insertItem( tr ( "Sudan" ) );
572 cmbCountry->insertItem( tr ( "Suriname" ) );
573 cmbCountry->insertItem( tr ( "Swaziland" ) );
574 cmbCountry->insertItem( tr ( "Sweden" ) );
575 cmbCountry->insertItem( tr ( "Switzerland" ) );
576 cmbCountry->insertItem( tr ( "Taiwan" ) );
577 cmbCountry->insertItem( tr ( "Tajikistan" ) );
578 cmbCountry->insertItem( tr ( "Tanzania" ) );
579 cmbCountry->insertItem( tr ( "Thailand" ) );
580 cmbCountry->insertItem( tr ( "Togo" ) );
581 cmbCountry->insertItem( tr ( "Tokelau" ) );
582 cmbCountry->insertItem( tr ( "Tonga" ) );
583 cmbCountry->insertItem( tr ( "Tunisia" ) );
584 cmbCountry->insertItem( tr ( "Turkey" ) );
585 cmbCountry->insertItem( tr ( "Turkmenistan" ) );
586 cmbCountry->insertItem( tr ( "Tuvalu" ) );
587 cmbCountry->insertItem( tr ( "Uganda" ) );
588 cmbCountry->insertItem( tr ( "Ukraine" ) );
589 cmbCountry->insertItem( tr ( "Uruguay" ) );
590 cmbCountry->insertItem( tr ( "Uzbekistan" ) );
591 cmbCountry->insertItem( tr ( "Vanuatu" ) );
592 cmbCountry->insertItem( tr ( "Venezuela" ) );
593 cmbCountry->insertItem( tr ( "Viet Nam" ) );
594 cmbCountry->insertItem( tr ( "Virgin Islands" ) );
595 cmbCountry->insertItem( tr ( "Western Sahara" ) );
596 cmbCountry->insertItem( tr ( "Yemen" ) );
597 cmbCountry->insertItem( tr ( "Yugoslavia" ) );
598 cmbCountry->insertItem( tr ( "Zambia" ) );
599 cmbCountry->insertItem( tr ( "Zimbabwe" ) );
600
601 cmbCountry->setMaximumWidth( 135 );
602
398 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); 603 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 );
399 604
605 cmbChooserField4 = new QComboBox( FALSE, container );
606 cmbChooserField4->setMaximumWidth( 90 );
607 gl->addWidget( cmbChooserField4, 6, 0 );
608 txtChooserField4 = new QLineEdit( container );
609 gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 );
400 tabMain->insertTab( tabViewport, tr( "Address" ) ); 610 tabMain->insertTab( tabViewport, tr( "Address" ) );
401 611
402 tabViewport = new QWidget ( tabMain ); 612 tabViewport = new QWidget ( tabMain );
403 613
404 vb = new QVBoxLayout( tabViewport ); 614 vb = new QVBoxLayout( tabViewport );
405 615
406 svDetails = new QScrollView( tabViewport ); 616 svDetails = new QScrollView( tabViewport );
407 vb->addWidget( svDetails, 0, 0 ); 617 vb->addWidget( svDetails, 0, 0 );
408 svDetails->setResizePolicy( QScrollView::AutoOneFit ); 618 svDetails->setResizePolicy( QScrollView::AutoOneFit );
409 svDetails->setFrameStyle( QFrame::NoFrame ); 619 svDetails->setFrameStyle( QFrame::NoFrame );
410 620
411 container = new QWidget( svDetails->viewport() ); 621 container = new QWidget( svDetails->viewport() );
412 svDetails->addChild( container ); 622 svDetails->addChild( container );
413 623
414 gl = new QGridLayout( container, 1, 2, 2, 3 ); 624 gl = new QGridLayout( container, 1, 2, 2, 4 );
415 625
416 QStringList::ConstIterator it = slDynamicEntries->begin(); 626 QStringList::ConstIterator it = slDynamicEntries->begin();
417 for (i = 0; it != slDynamicEntries->end(); i++, ++it) { 627 for (i = 0; it != slDynamicEntries->end(); i++, ++it) {
418 l = new QLabel( *it, container ); 628 l = new QLabel( *it, container );
419 listName.append( l ); 629 listName.append( l );
420 gl->addWidget( l, i, 0 ); 630 gl->addWidget( l, i, 0 );
421 QLineEdit *e = new QLineEdit( container ); 631 QLineEdit *e = new QLineEdit( container );
422 listValue.append( e ); 632 listValue.append( e );
423 gl->addWidget( e, i, 1); 633 gl->addWidget( e, i, 1);
424 } 634 }
425 635
426 l = new QLabel( tr("Gender"), container ); 636 l = new QLabel( tr("Gender"), container );
427 gl->addWidget( l, slDynamicEntries->count(), 0 ); 637 gl->addWidget( l, slDynamicEntries->count(), 0 );
428 cmbGender = new QComboBox( container ); 638 cmbGender = new QComboBox( container );
429 cmbGender->insertItem( "", 0 ); 639 cmbGender->insertItem( "", 0 );
430 cmbGender->insertItem( tr("Male"), 1); 640 cmbGender->insertItem( tr("Male"), 1);
431 cmbGender->insertItem( tr("Female"), 2); 641 cmbGender->insertItem( tr("Female"), 2);
432 gl->addWidget( cmbGender, slDynamicEntries->count(), 1 ); 642 gl->addWidget( cmbGender, slDynamicEntries->count(), 1 );
433 643
434 tabMain->insertTab( tabViewport, tr( "Details" ) ); 644 tabMain->insertTab( tabViewport, tr( "Details" ) );
435 645
436 dlgNote = new QDialog( this, "Note Dialog", TRUE ); 646 dlgNote = new QDialog( this, "Note Dialog", TRUE );
437 dlgNote->setCaption( tr("Enter Note") ); 647 dlgNote->setCaption( tr("Enter Note") );
438 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); 648 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote );
439 txtNote = new QMultiLineEdit( dlgNote ); 649 txtNote = new QMultiLineEdit( dlgNote );
440 vbNote->addWidget( txtNote ); 650 vbNote->addWidget( txtNote );
441 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); 651 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) );
442 652
443 dlgName = new QDialog( this, "Name Dialog", TRUE ); 653 dlgName = new QDialog( this, "Name Dialog", TRUE );
444 dlgName->setCaption( tr("Edit Name") ); 654 dlgName->setCaption( tr("Edit Name") );
445 gl = new QGridLayout( dlgName, 4, 2, 2, 3 ); 655 gl = new QGridLayout( dlgName, 4, 2, 2, 3 );
446 656
447 l = new QLabel( tr("First Name"), dlgName ); 657 l = new QLabel( tr("First Name"), dlgName );
448 gl->addWidget( l, 0, 0 ); 658 gl->addWidget( l, 0, 0 );
449 txtFirstName = new QLineEdit( dlgName ); 659 txtFirstName = new QLineEdit( dlgName );
450 gl->addWidget( txtFirstName, 0, 1 ); 660 gl->addWidget( txtFirstName, 0, 1 );
451 661
452 l = new QLabel( tr("Middle Name"), dlgName ); 662 l = new QLabel( tr("Middle Name"), dlgName );
453 gl->addWidget( l, 1, 0 ); 663 gl->addWidget( l, 1, 0 );
454 txtMiddleName = new QLineEdit( dlgName ); 664 txtMiddleName = new QLineEdit( dlgName );
455 gl->addWidget( txtMiddleName, 1, 1 ); 665 gl->addWidget( txtMiddleName, 1, 1 );
456 666
457 l = new QLabel( tr("Last Name"), dlgName ); 667 l = new QLabel( tr("Last Name"), dlgName );
458 gl->addWidget( l, 2, 0 ); 668 gl->addWidget( l, 2, 0 );
459 txtLastName = new QLineEdit( dlgName ); 669 txtLastName = new QLineEdit( dlgName );
460 gl->addWidget( txtLastName, 2, 1 ); 670 gl->addWidget( txtLastName, 2, 1 );
461 671
462 l = new QLabel( tr("Suffix"), dlgName ); 672 l = new QLabel( tr("Suffix"), dlgName );
463 gl->addWidget( l, 3, 0 ); 673 gl->addWidget( l, 3, 0 );
464 txtSuffix = new QLineEdit( dlgName ); 674 txtSuffix = new QLineEdit( dlgName );
465 gl->addWidget( txtSuffix, 3, 1 ); 675 gl->addWidget( txtSuffix, 3, 1 );
466 676
467 cmbChooserField1->insertStringList( *slChooserNames ); 677 cmbChooserField1->insertStringList( *slChooserNames );
468 cmbChooserField2->insertStringList( *slChooserNames ); 678 cmbChooserField2->insertStringList( *slChooserNames );
469 cmbChooserField3->insertStringList( *slChooserNames ); 679 cmbChooserField3->insertStringList( *slChooserNames );
680 cmbChooserField4->insertStringList( *slChooserNames );
470 681
471 cmbChooserField1->setCurrentItem( 0 ); 682 cmbChooserField1->setCurrentItem( 0 );
472 cmbChooserField2->setCurrentItem( 1 ); 683 cmbChooserField2->setCurrentItem( 1 );
473 cmbChooserField3->setCurrentItem( 2 ); 684 cmbChooserField3->setCurrentItem( 2 );
474 685
475 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 686 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
476 687
477 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); 688 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) );
478 689
479 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser1Change(const QString &)) ); 690 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser1Change(const QString &)) );
480 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser2Change(const QString &)) ); 691 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser2Change(const QString &)) );
481 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser3Change(const QString &)) ); 692 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser3Change(const QString &)) );
693 connect( txtChooserField4, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser4Change(const QString &)) );
482 connect( txtAddress, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddressChange(const QString &)) ); 694 connect( txtAddress, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddressChange(const QString &)) );
483 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); 695 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) );
484 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); 696 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) );
485 connect( txtCity, SIGNAL(textChanged(const QString &)), this, SLOT(slotCityChange(const QString &)) ); 697 connect( txtCity, SIGNAL(textChanged(const QString &)), this, SLOT(slotCityChange(const QString &)) );
486 connect( txtState, SIGNAL(textChanged(const QString &)), this, SLOT(slotStateChange(const QString &)) ); 698 connect( txtState, SIGNAL(textChanged(const QString &)), this, SLOT(slotStateChange(const QString &)) );
487 connect( txtZip, SIGNAL(textChanged(const QString &)), this, SLOT(slotZipChange(const QString &)) ); 699 connect( txtZip, SIGNAL(textChanged(const QString &)), this, SLOT(slotZipChange(const QString &)) );
488 connect( cmbCountry, SIGNAL(textChanged(const QString &)), this, SLOT(slotCountryChange(const QString &)) ); 700 connect( cmbCountry, SIGNAL(textChanged(const QString &)), this, SLOT(slotCountryChange(const QString &)) );
489 connect( cmbCountry, SIGNAL(activated(const QString &)), this, SLOT(slotCountryChange(const QString &)) ); 701 connect( cmbCountry, SIGNAL(activated(const QString &)), this, SLOT(slotCountryChange(const QString &)) );
490 connect( cmbChooserField1, SIGNAL(activated(int)), this, SLOT(slotCmbChooser1Change(int)) ); 702 connect( cmbChooserField1, SIGNAL(activated(int)), this, SLOT(slotCmbChooser1Change(int)) );
491 connect( cmbChooserField2, SIGNAL(activated(int)), this, SLOT(slotCmbChooser2Change(int)) ); 703 connect( cmbChooserField2, SIGNAL(activated(int)), this, SLOT(slotCmbChooser2Change(int)) );
492 connect( cmbChooserField3, SIGNAL(activated(int)), this, SLOT(slotCmbChooser3Change(int)) ); 704 connect( cmbChooserField3, SIGNAL(activated(int)), this, SLOT(slotCmbChooser3Change(int)) );
705 connect( cmbChooserField4, SIGNAL(activated(int)), this, SLOT(slotCmbChooser4Change(int)) );
493 connect( cmbAddress, SIGNAL(activated(int)), this, SLOT(slotAddressTypeChange(int)) ); 706 connect( cmbAddress, SIGNAL(activated(int)), this, SLOT(slotAddressTypeChange(int)) );
494 new QPEDialogListener(this); 707 new QPEDialogListener(this);
495} 708}
496 709
497void ContactEditor::initMap() 710void ContactEditor::initMap()
498{ 711{
499 /* 712 /*
500 // since the fields and the XML fields exist, create a map 713 // since the fields and the XML fields exist, create a map
501 // between them... 714 // between them...
502 Config cfg1( "AddressBook" ); 715 Config cfg1( "AddressBook" );
503 Config cfg2( "AddressBook" ); 716 Config cfg2( "AddressBook" );
504 QString strCfg1, 717 QString strCfg1,
505 strCfg2; 718 strCfg2;
506 int i; 719 int i;
507 720
508 // This stuff better exist... 721 // This stuff better exist...
509 cfg1.setGroup( "AddressFields" ); 722 cfg1.setGroup( "AddressFields" );
510o cfg2.setGroup( "XMLFields" ); 723o cfg2.setGroup( "XMLFields" );
511 i = 0; 724 i = 0;
512 strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null ); 725 strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null );
513 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), 726 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++),
514 QString::null ); 727 QString::null );
515 while ( !strCfg1.isNull() && !strCfg2.isNull() ) { 728 while ( !strCfg1.isNull() && !strCfg2.isNull() ) {
516 mapField.insert( strCfg1, strCfg2 ); 729 mapField.insert( strCfg1, strCfg2 );
517 strCfg1 = cfg1.readEntry( "Field" + QString::number(i), 730 strCfg1 = cfg1.readEntry( "Field" + QString::number(i),
518 QString::null ); 731 QString::null );
519 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), 732 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++),
520 QString::null ); 733 QString::null );
521 } 734 }
522 */ 735 */
523} 736}
524 737
525void ContactEditor::slotChooser1Change( const QString &textChanged ) { 738void ContactEditor::slotChooser1Change( const QString &textChanged ) {
526 739
527 int index = cmbChooserField1->currentItem(); 740 int index = cmbChooserField1->currentItem();
528 741
529 (*slChooserValues)[index] = textChanged; 742 (*slChooserValues)[index] = textChanged;
530 743
531} 744}
532 745
533void ContactEditor::slotChooser2Change( const QString &textChanged ) { 746void ContactEditor::slotChooser2Change( const QString &textChanged ) {
534 747
535 int index = cmbChooserField2->currentItem(); 748 int index = cmbChooserField2->currentItem();
536 749
537 (*slChooserValues)[index] = textChanged; 750 (*slChooserValues)[index] = textChanged;
538 751
539} 752}
540 753
541void ContactEditor::slotChooser3Change( const QString &textChanged ) { 754void ContactEditor::slotChooser3Change( const QString &textChanged ) {
542 755
543 int index = cmbChooserField3->currentItem(); 756 int index = cmbChooserField3->currentItem();
544 757
545 (*slChooserValues)[index] = textChanged; 758 (*slChooserValues)[index] = textChanged;
546 759
547} 760}
548 761
762void ContactEditor::slotChooser4Change( const QString &textChanged ) {
763
764 int index = cmbChooserField4->currentItem();
765
766 (*slChooserValues)[index] = textChanged;
767
768}
769
549void ContactEditor::slotAddressChange( const QString &textChanged ) { 770void ContactEditor::slotAddressChange( const QString &textChanged ) {
550 771
551 if ( cmbAddress->currentItem() == 0 ) { 772 if ( cmbAddress->currentItem() == 0 ) {
552 (*slBusinessAddress)[0] = textChanged; 773 (*slBusinessAddress)[0] = textChanged;
553 } else { 774 } else {
554 (*slHomeAddress)[0] = textChanged; 775 (*slHomeAddress)[0] = textChanged;
555 } 776 }
556} 777}
557 778
558void ContactEditor::slotAddress2Change( const QString &textChanged ) { 779void ContactEditor::slotAddress2Change( const QString &textChanged ) {
559 780
560 if ( cmbAddress->currentItem() == 0 ) { 781 if ( cmbAddress->currentItem() == 0 ) {
561 (*slBusinessAddress)[1] = textChanged; 782 (*slBusinessAddress)[1] = textChanged;
562 } else { 783 } else {
563 (*slHomeAddress)[1] = textChanged; 784 (*slHomeAddress)[1] = textChanged;
564 } 785 }
565} 786}
566 787
567void ContactEditor::slotPOBoxChange( const QString &textChanged ) { 788void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
568 789
569 if ( cmbAddress->currentItem() == 0 ) { 790 if ( cmbAddress->currentItem() == 0 ) {
570 (*slBusinessAddress)[2] = textChanged; 791 (*slBusinessAddress)[2] = textChanged;
571 } else { 792 } else {
572 (*slHomeAddress)[2] = textChanged; 793 (*slHomeAddress)[2] = textChanged;
573 } 794 }
574} 795}
575 796
576void ContactEditor::slotCityChange( const QString &textChanged ) { 797void ContactEditor::slotCityChange( const QString &textChanged ) {
577 798
578 if ( cmbAddress->currentItem() == 0 ) { 799 if ( cmbAddress->currentItem() == 0 ) {
579 (*slBusinessAddress)[3] = textChanged; 800 (*slBusinessAddress)[3] = textChanged;
580 } else { 801 } else {
581 (*slHomeAddress)[3] = textChanged; 802 (*slHomeAddress)[3] = textChanged;
582 } 803 }
583} 804}
584 805
585void ContactEditor::slotStateChange( const QString &textChanged ) { 806void ContactEditor::slotStateChange( const QString &textChanged ) {
586 807
587 808
588 if ( cmbAddress->currentItem() == 0 ) { 809 if ( cmbAddress->currentItem() == 0 ) {
589 (*slBusinessAddress)[4] = textChanged; 810 (*slBusinessAddress)[4] = textChanged;
590 } else { 811 } else {
591 (*slHomeAddress)[4] = textChanged; 812 (*slHomeAddress)[4] = textChanged;
592 } 813 }
593} 814}
594 815
595void ContactEditor::slotZipChange( const QString &textChanged ) { 816void ContactEditor::slotZipChange( const QString &textChanged ) {
596 817
597 if ( cmbAddress->currentItem() == 0 ) { 818 if ( cmbAddress->currentItem() == 0 ) {
598 (*slBusinessAddress)[5] = textChanged; 819 (*slBusinessAddress)[5] = textChanged;
599 } else { 820 } else {
600 (*slHomeAddress)[5] = textChanged; 821 (*slHomeAddress)[5] = textChanged;
601 } 822 }
602} 823}
603 824
604void ContactEditor::slotCountryChange( const QString &textChanged ) { 825void ContactEditor::slotCountryChange( const QString &textChanged ) {
605 826
606 if ( cmbAddress->currentItem() == 0 ) { 827 if ( cmbAddress->currentItem() == 0 ) {
607 (*slBusinessAddress)[6] = textChanged; 828 (*slBusinessAddress)[6] = textChanged;
608 } else { 829 } else {
609 (*slHomeAddress)[6] = textChanged; 830 (*slHomeAddress)[6] = textChanged;
610 } 831 }
611} 832}
612 833
613void ContactEditor::slotCmbChooser1Change( int index ) { 834void ContactEditor::slotCmbChooser1Change( int index ) {
614 835
615 txtChooserField1->setText( (*slChooserValues)[index] ); 836 txtChooserField1->setText( (*slChooserValues)[index] );
616 837
617} 838}
618 839
619void ContactEditor::slotCmbChooser2Change( int index ) { 840void ContactEditor::slotCmbChooser2Change( int index ) {
620 841
621 txtChooserField2->setText( (*slChooserValues)[index] ); 842 txtChooserField2->setText( (*slChooserValues)[index] );
622 843
623} 844}
624 845
625void ContactEditor::slotCmbChooser3Change( int index ) { 846void ContactEditor::slotCmbChooser3Change( int index ) {
626 847
627 txtChooserField3->setText( (*slChooserValues)[index] ); 848 txtChooserField3->setText( (*slChooserValues)[index] );
628 849
629} 850}
630 851
852void ContactEditor::slotCmbChooser4Change( int index ) {
853
854 txtChooserField4->setText( (*slChooserValues)[index] );
855
856}
857
631void ContactEditor::slotAddressTypeChange( int index ) { 858void ContactEditor::slotAddressTypeChange( int index ) {
632 859
633 if ( index == 0 ) { 860 if ( index == 0 ) {
634 861
635 txtAddress->setText( (*slBusinessAddress)[0] ); 862 txtAddress->setText( (*slBusinessAddress)[0] );
636 //txtAddress2->setText( (*slBusinessAddress)[1] ); 863 //txtAddress2->setText( (*slBusinessAddress)[1] );
637 //txtPOBox->setText( (*slBusinessAddress)[2] ); 864 //txtPOBox->setText( (*slBusinessAddress)[2] );
638 txtCity->setText( (*slBusinessAddress)[3] ); 865 txtCity->setText( (*slBusinessAddress)[3] );
639 txtState->setText( (*slBusinessAddress)[4] ); 866 txtState->setText( (*slBusinessAddress)[4] );
640 txtZip->setText( (*slBusinessAddress)[5] ); 867 txtZip->setText( (*slBusinessAddress)[5] );
641 QLineEdit *txtTmp = cmbCountry->lineEdit(); 868 QLineEdit *txtTmp = cmbCountry->lineEdit();
642 txtTmp->setText( (*slBusinessAddress)[6] ); 869 txtTmp->setText( (*slBusinessAddress)[6] );
643 870
644 } else { 871 } else {
645 872
646 txtAddress->setText( (*slHomeAddress)[0] ); 873 txtAddress->setText( (*slHomeAddress)[0] );
647 //txtAddress2->setText( (*slHomeAddress)[1] ); 874 //txtAddress2->setText( (*slHomeAddress)[1] );
648 //txtPOBox->setText( (*slHomeAddress)[2] ); 875 //txtPOBox->setText( (*slHomeAddress)[2] );
649 txtCity->setText( (*slHomeAddress)[3] ); 876 txtCity->setText( (*slHomeAddress)[3] );
650 txtState->setText( (*slHomeAddress)[4] ); 877 txtState->setText( (*slHomeAddress)[4] );
651 txtZip->setText( (*slHomeAddress)[5] ); 878 txtZip->setText( (*slHomeAddress)[5] );
652 QLineEdit *txtTmp = cmbCountry->lineEdit(); 879 QLineEdit *txtTmp = cmbCountry->lineEdit();
653 txtTmp->setText( (*slHomeAddress)[6] ); 880 txtTmp->setText( (*slHomeAddress)[6] );
654 881
655 } 882 }
656 883
657} 884}
658 885
659void ContactEditor::slotFullNameChange( const QString &textChanged ) { 886void ContactEditor::slotFullNameChange( const QString &textChanged ) {
660 887
661 int index = cmbFileAs->currentItem(); 888 int index = cmbFileAs->currentItem();
662 889
663 cmbFileAs->clear(); 890 cmbFileAs->clear();
664 891
665 cmbFileAs->insertItem( parseName( textChanged, 0 ) ); 892 cmbFileAs->insertItem( parseName( textChanged, 0 ) );
666 cmbFileAs->insertItem( parseName( textChanged, 1 ) ); 893 cmbFileAs->insertItem( parseName( textChanged, 1 ) );
667 cmbFileAs->insertItem( parseName( textChanged, 2 ) ); 894 cmbFileAs->insertItem( parseName( textChanged, 2 ) );
668 cmbFileAs->insertItem( parseName( textChanged, 3 ) ); 895 cmbFileAs->insertItem( parseName( textChanged, 3 ) );
669 896
670 cmbFileAs->setCurrentItem( index ); 897 cmbFileAs->setCurrentItem( index );
671 898
672 useFullName = TRUE; 899 useFullName = TRUE;
673 900
674 } 901 }
675 902
676void ContactEditor::loadFields() { 903void ContactEditor::loadFields() {
677 904
678 QStringList::ConstIterator it; 905 QStringList::ConstIterator it;
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h
index a799672..a58a860 100644
--- a/core/pim/addressbook/contacteditor.h
+++ b/core/pim/addressbook/contacteditor.h
@@ -38,121 +38,125 @@ const int NAME_M = 5;
38const int NAME_L = 6; 38const int NAME_L = 6;
39const int NAME_S = 7; 39const int NAME_S = 7;
40 40
41 41
42class QScrollView; 42class QScrollView;
43class QTabWidget; 43class QTabWidget;
44class QMultiLineEdit; 44class QMultiLineEdit;
45class QLineEdit; 45class QLineEdit;
46class QComboBox; 46class QComboBox;
47class QPushButton; 47class QPushButton;
48class CategorySelect; 48class CategorySelect;
49class QLabel; 49class QLabel;
50 50
51class ContactEditor : public QDialog { 51class ContactEditor : public QDialog {
52 Q_OBJECT 52 Q_OBJECT
53 53
54 public: 54 public:
55 ContactEditor(const Contact &entry, 55 ContactEditor(const Contact &entry,
56 const QValueList<int> *newOrderedValues, 56 const QValueList<int> *newOrderedValues,
57 QStringList *slNewOrdered, 57 QStringList *slNewOrdered,
58 QWidget *parent = 0, 58 QWidget *parent = 0,
59 const char *name = 0, 59 const char *name = 0,
60 WFlags fl = 0 ); 60 WFlags fl = 0 );
61 ~ContactEditor(); 61 ~ContactEditor();
62 void loadFields(); 62 void loadFields();
63 void setNameFocus(); 63 void setNameFocus();
64 Contact entry() const { return ent; } 64 Contact entry() const { return ent; }
65 65
66 public slots: 66 public slots:
67 void slotNote(); 67 void slotNote();
68 void slotName(); 68 void slotName();
69 void setEntry(const Contact &entry); 69 void setEntry(const Contact &entry);
70 70
71 protected slots: 71 protected slots:
72 void accept(); 72 void accept();
73 73
74 private: 74 private:
75 void init(); 75 void init();
76 void initMap(); 76 void initMap();
77 void saveEntry(); 77 void saveEntry();
78 bool isEmpty(); 78 bool isEmpty();
79 void cleanupFields(); 79 void cleanupFields();
80 QString parseName( QString fullName, int type ); 80 QString parseName( QString fullName, int type );
81 81
82 private slots: 82 private slots:
83 void slotChooser1Change( const QString &textChanged ); 83 void slotChooser1Change( const QString &textChanged );
84 void slotChooser2Change( const QString &textChanged ); 84 void slotChooser2Change( const QString &textChanged );
85 void slotChooser3Change( const QString &textChanged ); 85 void slotChooser3Change( const QString &textChanged );
86 void slotChooser4Change( const QString &textChanged );
86 void slotCmbChooser1Change( int index ); 87 void slotCmbChooser1Change( int index );
87 void slotCmbChooser2Change( int index ); 88 void slotCmbChooser2Change( int index );
88 void slotCmbChooser3Change( int index ); 89 void slotCmbChooser3Change( int index );
90 void slotCmbChooser4Change( int index );
89 void slotAddressTypeChange( int index ); 91 void slotAddressTypeChange( int index );
90 void slotAddressChange( const QString &textChanged ); 92 void slotAddressChange( const QString &textChanged );
91 void slotAddress2Change( const QString &textChanged ); 93 void slotAddress2Change( const QString &textChanged );
92 void slotPOBoxChange( const QString &textChanged ); 94 void slotPOBoxChange( const QString &textChanged );
93 void slotCityChange( const QString &textChanged ); 95 void slotCityChange( const QString &textChanged );
94 void slotStateChange( const QString &textChanged ); 96 void slotStateChange( const QString &textChanged );
95 void slotZipChange( const QString &textChanged ); 97 void slotZipChange( const QString &textChanged );
96 void slotCountryChange( const QString &textChanged ); 98 void slotCountryChange( const QString &textChanged );
97 void slotFullNameChange( const QString &textChanged ); 99 void slotFullNameChange( const QString &textChanged );
98 100
99 private: 101 private:
100 bool useFullName, hasGender, hasTitle, hasCompany, hasNotes, hasStreet, hasStreet2, hasPOBox, hasCity, hasState, hasZip, hasCountry; 102 bool useFullName, hasGender, hasTitle, hasCompany, hasNotes, hasStreet, hasStreet2, hasPOBox, hasCity, hasState, hasZip, hasCountry;
101 103
102 Contact ent; 104 Contact ent;
103 105
104 QDialog *dlgNote; 106 QDialog *dlgNote;
105 QDialog *dlgName; 107 QDialog *dlgName;
106 108
107 QList<QLineEdit> listValue; 109 QList<QLineEdit> listValue;
108 QList<QLabel> listName; 110 QList<QLabel> listName;
109 const QValueList<int> *orderedValues; 111 const QValueList<int> *orderedValues;
110 QStringList *slOrdered; 112 QStringList *slOrdered;
111 QStringList *slDynamicEntries; 113 QStringList *slDynamicEntries;
112 114
113 QStringList *slHomeAddress; 115 QStringList *slHomeAddress;
114 QStringList *slBusinessAddress; 116 QStringList *slBusinessAddress;
115 QStringList *slChooserNames; 117 QStringList *slChooserNames;
116 QStringList *slChooserValues; 118 QStringList *slChooserValues;
117 119
118 QMultiLineEdit *txtNote; 120 QMultiLineEdit *txtNote;
119 QLabel *lblNote; 121 QLabel *lblNote;
120 122
121 //QLineEdit *txtTitle; 123 //QLineEdit *txtTitle;
122 QLineEdit *txtFirstName; 124 QLineEdit *txtFirstName;
123 QLineEdit *txtMiddleName; 125 QLineEdit *txtMiddleName;
124 QLineEdit *txtLastName; 126 QLineEdit *txtLastName;
125 QLineEdit *txtSuffix; 127 QLineEdit *txtSuffix;
126 128
127 QTabWidget *tabMain; 129 QTabWidget *tabMain;
128 QScrollView *svGeneral; 130 QScrollView *svGeneral;
129 QPushButton *btnFullName; 131 QPushButton *btnFullName;
130 QPushButton *btnNote; 132 QPushButton *btnNote;
131 QLineEdit *txtFullName; 133 QLineEdit *txtFullName;
132 QLineEdit *txtJobTitle; 134 QLineEdit *txtJobTitle;
133 QLineEdit *txtOrganization; 135 QLineEdit *txtOrganization;
134 QLineEdit *txtChooserField1; 136 QLineEdit *txtChooserField1;
135 QLineEdit *txtChooserField2; 137 QLineEdit *txtChooserField2;
136 QLineEdit *txtChooserField3; 138 QLineEdit *txtChooserField3;
139 QLineEdit *txtChooserField4;
137 QComboBox *cmbChooserField1; 140 QComboBox *cmbChooserField1;
138 QComboBox *cmbChooserField2; 141 QComboBox *cmbChooserField2;
139 QComboBox *cmbChooserField3; 142 QComboBox *cmbChooserField3;
143 QComboBox *cmbChooserField4;
140 QComboBox *cmbFileAs; 144 QComboBox *cmbFileAs;
141 CategorySelect *cmbCat; 145 CategorySelect *cmbCat;
142 146
143 QScrollView *svAddress; 147 QScrollView *svAddress;
144 QLineEdit *txtAddress; 148 QLineEdit *txtAddress;
145 //QLineEdit *txtAddress2; 149 //QLineEdit *txtAddress2;
146 //QLineEdit *txtPOBox; 150 //QLineEdit *txtPOBox;
147 QLineEdit *txtCity; 151 QLineEdit *txtCity;
148 QLineEdit *txtState; 152 QLineEdit *txtState;
149 QLineEdit *txtZip; 153 QLineEdit *txtZip;
150 QComboBox *cmbAddress; 154 QComboBox *cmbAddress;
151 QComboBox *cmbCountry; 155 QComboBox *cmbCountry;
152 156
153 QScrollView *svDetails; 157 QScrollView *svDetails;
154 QComboBox *cmbGender; 158 QComboBox *cmbGender;
155 159
156}; 160};
157 161
158#endif 162#endif