summaryrefslogtreecommitdiff
authorzecke <zecke>2002-05-21 14:21:25 (UTC)
committer zecke <zecke>2002-05-21 14:21:25 (UTC)
commit3eb1e88e5915c9dbd521a150cc5dd7eb7dbb3663 (patch) (unidiff)
tree59f3648e8a0848457f879058b1064017b9feca66
parent54955c2fd698b2a1cf3ba8a79f2612013c8eb2f0 (diff)
downloadopie-3eb1e88e5915c9dbd521a150cc5dd7eb7dbb3663.zip
opie-3eb1e88e5915c9dbd521a150cc5dd7eb7dbb3663.tar.gz
opie-3eb1e88e5915c9dbd521a150cc5dd7eb7dbb3663.tar.bz2
usbaility updates
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp21
-rw-r--r--core/pim/addressbook/contacteditor.cpp348
-rw-r--r--core/pim/addressbook/contacteditor.h18
3 files changed, 208 insertions, 179 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index beb953a..8229212 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -1,923 +1,924 @@
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 32
33#ifndef MAKE_FOR_SHARP_ROM 33#ifndef MAKE_FOR_SHARP_ROM
34#include <qpe/finddialog.h> 34#include <qpe/finddialog.h>
35#endif 35#endif
36 36
37#include <qpe/global.h> 37#include <qpe/global.h>
38#include <qpe/resource.h> 38#include <qpe/resource.h>
39#include <qpe/ir.h> 39#include <qpe/ir.h>
40#include <qpe/qpemessagebox.h> 40#include <qpe/qpemessagebox.h>
41#include <qpe/qcopenvelope_qws.h> 41#include <qpe/qcopenvelope_qws.h>
42 42
43#include <qaction.h> 43#include <qaction.h>
44#include <qdialog.h> 44#include <qdialog.h>
45#include <qdir.h> 45#include <qdir.h>
46#include <qfile.h> 46#include <qfile.h>
47#include <qimage.h> 47#include <qimage.h>
48#include <qlayout.h> 48#include <qlayout.h>
49#include <qpe/qpemenubar.h> 49#include <qpe/qpemenubar.h>
50#include <qmessagebox.h> 50#include <qmessagebox.h>
51#include <qpixmap.h> 51#include <qpixmap.h>
52#include <qpopupmenu.h> 52#include <qpopupmenu.h>
53#include <qpe/qpetoolbar.h> 53#include <qpe/qpetoolbar.h>
54#include <qstringlist.h> 54#include <qstringlist.h>
55#include <qtoolbutton.h> 55#include <qtoolbutton.h>
56#include <qwhatsthis.h> 56#include <qwhatsthis.h>
57 57
58#include <stdlib.h> 58#include <stdlib.h>
59#include <sys/stat.h> 59#include <sys/stat.h>
60#include <sys/types.h> 60#include <sys/types.h>
61#include <fcntl.h> 61#include <fcntl.h>
62#include <unistd.h> 62#include <unistd.h>
63 63
64#include <qdatetime.h> 64#include <qdatetime.h>
65 65
66#include "picker.h" 66#include "picker.h"
67static QString addressbookOldXMLFilename() 67static QString addressbookOldXMLFilename()
68{ 68{
69 QString filename = QPEApplication::documentDir() + "addressbook.xml"; 69 QString filename = QPEApplication::documentDir() + "addressbook.xml";
70 return filename; 70 return filename;
71} 71}
72 72
73static QString addressbookXMLFilename() 73static QString addressbookXMLFilename()
74{ 74{
75 QString filename = Global::applicationFileName("addressbook", 75 QString filename = Global::applicationFileName("addressbook",
76 "addressbook.xml"); 76 "addressbook.xml");
77 return filename; 77 return filename;
78} 78}
79 79
80static QString addressbookPersonalVCardName() 80static QString addressbookPersonalVCardName()
81{ 81{
82 QString filename = Global::applicationFileName("addressbook", 82 QString filename = Global::applicationFileName("addressbook",
83 "businesscard.vcf"); 83 "businesscard.vcf");
84 return filename; 84 return filename;
85} 85}
86 86
87 87
88AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, 88AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
89 WFlags f ) 89 WFlags f )
90 : QMainWindow( parent, name, f ), 90 : QMainWindow( parent, name, f ),
91 abEditor(0), 91 abEditor(0),
92 bAbEditFirstTime(TRUE), 92 bAbEditFirstTime(TRUE),
93 syncing(FALSE) 93 syncing(FALSE)
94{ 94{
95 initFields(); 95 initFields();
96 96
97 setCaption( tr("Contacts") ); 97 setCaption( tr("Contacts") );
98 setIcon( Resource::loadPixmap( "AddressBook" ) ); 98 setIcon( Resource::loadPixmap( "AddressBook" ) );
99 99
100 setToolBarsMovable( FALSE ); 100 setToolBarsMovable( FALSE );
101 101
102 // Create Toolbars 102 // Create Toolbars
103 103
104 QPEToolBar *bar = new QPEToolBar( this ); 104 QPEToolBar *bar = new QPEToolBar( this );
105 bar->setHorizontalStretchable( TRUE ); 105 bar->setHorizontalStretchable( TRUE );
106 106
107 QPEMenuBar *mbList = new QPEMenuBar( bar ); 107 QPEMenuBar *mbList = new QPEMenuBar( bar );
108 mbList->setMargin( 0 ); 108 mbList->setMargin( 0 );
109 109
110 QPopupMenu *edit = new QPopupMenu( this ); 110 QPopupMenu *edit = new QPopupMenu( this );
111 mbList->insertItem( tr( "Contact" ), edit ); 111 mbList->insertItem( tr( "Contact" ), edit );
112 112
113 listTools = new QPEToolBar( this, "list operations" ); 113 listTools = new QPEToolBar( this, "list operations" );
114 114
115 115
116 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 116 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null,
117 0, this, 0 ); 117 0, this, 0 );
118 actionNew = a; 118 actionNew = a;
119 connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); 119 connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) );
120 a->addTo( edit ); 120 a->addTo( edit );
121 a->addTo( listTools ); 121 a->addTo( listTools );
122 122
123 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, 123 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null,
124 0, this, 0 ); 124 0, this, 0 );
125 actionEdit = a; 125 actionEdit = a;
126 connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); 126 connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) );
127 a->addTo( edit ); 127 a->addTo( edit );
128 a->addTo( listTools ); 128 a->addTo( listTools );
129 129
130 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 130 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null,
131 0, this, 0 ); 131 0, this, 0 );
132 actionTrash = a; 132 actionTrash = a;
133 connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); 133 connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) );
134 a->addTo( edit ); 134 a->addTo( edit );
135 a->addTo( listTools ); 135 a->addTo( listTools );
136 136
137#ifndef MAKE_FOR_SHARP_ROM 137#ifndef MAKE_FOR_SHARP_ROM
138 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), 138 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ),
139 QString::null, 0, this, 0 ); 139 QString::null, 0, this, 0 );
140 actionFind = a; 140 actionFind = a;
141 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); 141 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) );
142 a->addTo( edit ); 142 a->addTo( edit );
143 a->addTo( listTools ); 143 a->addTo( listTools );
144#endif 144#endif
145 145
146 146
147 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), 147 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ),
148 QString::null, 0, this, 0 ); 148 QString::null, 0, this, 0 );
149 //a->setEnabled( FALSE ); we got support for it now :) zecke 149 //a->setEnabled( FALSE ); we got support for it now :) zecke
150 actionMail = a; 150 actionMail = a;
151 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); 151 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) );
152 a->addTo( edit ); 152 a->addTo( edit );
153 a->addTo( listTools ); 153 a->addTo( listTools );
154 154
155 155
156 156
157 if ( Ir::supported() ) { 157 if ( Ir::supported() ) {
158 a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, 158 a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null,
159 0, this, 0 ); 159 0, this, 0 );
160 actionBeam = a; 160 actionBeam = a;
161 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); 161 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) );
162 a->addTo( edit ); 162 a->addTo( edit );
163 a->addTo( listTools ); 163 a->addTo( listTools );
164 } 164 }
165 165
166 edit->insertSeparator(); 166 edit->insertSeparator();
167 167
168 a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); 168 a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE );
169 actionPersonal = a; 169 actionPersonal = a;
170 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); 170 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) );
171 a->addTo( edit ); 171 a->addTo( edit );
172 172
173 173
174 a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); 174 a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 );
175 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); 175 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
176 a->addTo( edit ); 176 a->addTo( edit );
177 177
178 // Create Views 178 // Create Views
179 179
180 // This is safe to call without checking to see if it exists... 180 // This is safe to call without checking to see if it exists...
181 // not to mention it also does the necessary stuff for the 181 // not to mention it also does the necessary stuff for the
182 // journaling... 182 // journaling...
183 QString str = addressbookXMLFilename(); 183 QString str = addressbookXMLFilename();
184 if ( str.isNull() ) { 184 if ( str.isNull() ) {
185 QMessageBox::warning( this, tr("Out of Space"), 185 QMessageBox::warning( this, tr("Out of Space"),
186 tr("There is not enough space to create\n" 186 tr("There is not enough space to create\n"
187 "neccessary startup files.\n" 187 "neccessary startup files.\n"
188 "\nFree up some space before\nentering data!") 188 "\nFree up some space before\nentering data!")
189 ); 189 );
190 } 190 }
191 191
192 listContainer = new QWidget( this ); 192 listContainer = new QWidget( this );
193 193
194 QVBoxLayout *vb = new QVBoxLayout( listContainer ); 194 QVBoxLayout *vb = new QVBoxLayout( listContainer );
195 195
196 abList = new AbTable( &orderedFields, listContainer, "table" ); 196 abList = new AbTable( &orderedFields, listContainer, "table" );
197 vb->addWidget(abList); 197 vb->addWidget(abList);
198 abList->setHScrollBarMode( QScrollView::AlwaysOff ); 198 abList->setHScrollBarMode( QScrollView::AlwaysOff );
199 connect( abList, SIGNAL( empty( bool ) ), 199 connect( abList, SIGNAL( empty( bool ) ),
200 this, SLOT( listIsEmpty( bool ) ) ); 200 this, SLOT( listIsEmpty( bool ) ) );
201 connect( abList, SIGNAL( details() ), 201 connect( abList, SIGNAL( details() ),
202 this, SLOT( slotListView() ) ); 202 this, SLOT( slotListView() ) );
203 connect( abList, SIGNAL(currentChanged(int,int)), 203 connect( abList, SIGNAL(currentChanged(int,int)),
204 this, SLOT(slotUpdateToolbar()) ); 204 this, SLOT(slotUpdateToolbar()) );
205 205
206 mView = 0; 206 mView = 0;
207 207
208 abList->load( addressbookXMLFilename() ); 208 abList->load( addressbookXMLFilename() );
209 if ( QFile::exists(addressbookOldXMLFilename()) ) { 209 if ( QFile::exists(addressbookOldXMLFilename()) ) {
210 abList->load( addressbookOldXMLFilename() ); 210 abList->load( addressbookOldXMLFilename() );
211 QFile::remove(addressbookOldXMLFilename()); 211 QFile::remove(addressbookOldXMLFilename());
212 } 212 }
213 213
214 pLabel = new LetterPicker( listContainer ); 214 pLabel = new LetterPicker( listContainer );
215 connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); 215 connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char)));
216 vb->addWidget(pLabel); 216 vb->addWidget(pLabel);
217 catMenu = new QPopupMenu( this ); 217 catMenu = new QPopupMenu( this );
218 catMenu->setCheckable( TRUE ); 218 catMenu->setCheckable( TRUE );
219 connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); 219 connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) );
220 populateCategories(); 220 populateCategories();
221 221
222 mbList->insertItem( tr("View"), catMenu ); 222 mbList->insertItem( tr("View"), catMenu );
223 setCentralWidget( listContainer ); 223 setCentralWidget( listContainer );
224 224
225 fontMenu = new QPopupMenu(this); 225 fontMenu = new QPopupMenu(this);
226 fontMenu->setCheckable( true ); 226 fontMenu->setCheckable( true );
227 connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int))); 227 connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int)));
228 228
229 fontMenu->insertItem(tr( "Small" ), 0); 229 fontMenu->insertItem(tr( "Small" ), 0);
230 fontMenu->insertItem(tr( "Normal" ), 1); 230 fontMenu->insertItem(tr( "Normal" ), 1);
231 fontMenu->insertItem(tr( "Large" ), 2); 231 fontMenu->insertItem(tr( "Large" ), 2);
232 232
233 defaultFont = new QFont( abList->font() ); 233 defaultFont = new QFont( abList->font() );
234 234
235 slotSetFont(startFontSize); 235 slotSetFont(startFontSize);
236 236
237 mbList->insertItem( tr("Font"), fontMenu); 237 mbList->insertItem( tr("Font"), fontMenu);
238 setCentralWidget(listContainer); 238 setCentralWidget(listContainer);
239 239
240 // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); 240 // qDebug("adressbook contrsuction: t=%d", t.elapsed() );
241} 241}
242void AddressbookWindow::slotSetFont( int size ) { 242void AddressbookWindow::slotSetFont( int size ) {
243 243
244 if (size > 2 || size < 0) 244 if (size > 2 || size < 0)
245 size = 1; 245 size = 1;
246 246
247 startFontSize = size; 247 startFontSize = size;
248 248
249 QFont *currentFont; 249 QFont *currentFont;
250 250
251 switch (size) { 251 switch (size) {
252 case 0: 252 case 0:
253 fontMenu->setItemChecked(0, true); 253 fontMenu->setItemChecked(0, true);
254 fontMenu->setItemChecked(1, false); 254 fontMenu->setItemChecked(1, false);
255 fontMenu->setItemChecked(2, false); 255 fontMenu->setItemChecked(2, false);
256 abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); 256 abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) );
257 currentFont = new QFont (abList->font()); 257 currentFont = new QFont (abList->font());
258 abList->resizeRows(currentFont->pixelSize() + 7); 258 abList->resizeRows(currentFont->pixelSize() + 7);
259 break; 259 break;
260 case 1: 260 case 1:
261 fontMenu->setItemChecked(0, false); 261 fontMenu->setItemChecked(0, false);
262 fontMenu->setItemChecked(1, true); 262 fontMenu->setItemChecked(1, true);
263 fontMenu->setItemChecked(2, false); 263 fontMenu->setItemChecked(2, false);
264 abList->setFont( *defaultFont ); 264 abList->setFont( *defaultFont );
265 currentFont = new QFont (abList->font()); 265 currentFont = new QFont (abList->font());
266 abList->resizeRows(currentFont->pixelSize() + 7); 266 abList->resizeRows(currentFont->pixelSize() + 7);
267 break; 267 break;
268 case 2: 268 case 2:
269 fontMenu->setItemChecked(0, false); 269 fontMenu->setItemChecked(0, false);
270 fontMenu->setItemChecked(1, false); 270 fontMenu->setItemChecked(1, false);
271 fontMenu->setItemChecked(2, true); 271 fontMenu->setItemChecked(2, true);
272 abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); 272 abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) );
273 currentFont = new QFont (abList->font()); 273 currentFont = new QFont (abList->font());
274 abList->resizeRows(currentFont->pixelSize() + 7); 274 abList->resizeRows(currentFont->pixelSize() + 7);
275 break; 275 break;
276 } 276 }
277} 277}
278 278
279 279
280void AddressbookWindow::setDocument( const QString &filename ) 280void AddressbookWindow::setDocument( const QString &filename )
281{ 281{
282 if ( filename.find(".vcf") != int(filename.length()) - 4 ) return; 282 if ( filename.find(".vcf") != int(filename.length()) - 4 ) return;
283 283
284 QValueList<Contact> cl = Contact::readVCard( filename ); 284 QValueList<Contact> cl = Contact::readVCard( filename );
285 for( QValueList<Contact>::Iterator it = cl.begin(); it != cl.end(); ++it ) { 285 for( QValueList<Contact>::Iterator it = cl.begin(); it != cl.end(); ++it ) {
286 // QString msg = tr("You received a vCard for\n%1.\nDo You want to add it to your\naddressbook?") 286 // QString msg = tr("You received a vCard for\n%1.\nDo You want to add it to your\naddressbook?")
287 // .arg( (*it).fullName() ); 287 // .arg( (*it).fullName() );
288 // if ( QMessageBox::information( this, tr("received contact"), msg, QMessageBox::Ok, QMessageBox::Cancel ) == 288 // if ( QMessageBox::information( this, tr("received contact"), msg, QMessageBox::Ok, QMessageBox::Cancel ) ==
289 // QMessageBox::Ok ) { 289 // QMessageBox::Ok ) {
290 abList->addEntry( *it ); 290 abList->addEntry( *it );
291 // } 291 // }
292 } 292 }
293 293
294} 294}
295 295
296void AddressbookWindow::resizeEvent( QResizeEvent *e ) 296void AddressbookWindow::resizeEvent( QResizeEvent *e )
297{ 297{
298 QMainWindow::resizeEvent( e ); 298 QMainWindow::resizeEvent( e );
299 299
300 if ( centralWidget() == listContainer ) 300 if ( centralWidget() == listContainer )
301 showList(); 301 showList();
302 else if ( centralWidget() == mView ) 302 else if ( centralWidget() == mView )
303 showView(); 303 showView();
304} 304}
305 305
306AddressbookWindow::~AddressbookWindow() 306AddressbookWindow::~AddressbookWindow()
307{ 307{
308 Config cfg("AddressBook"); 308 Config cfg("AddressBook");
309 cfg.setGroup("Font"); 309 cfg.setGroup("Font");
310 cfg.writeEntry("fontSize", startFontSize); 310 cfg.writeEntry("fontSize", startFontSize);
311} 311}
312 312
313void AddressbookWindow::slotUpdateToolbar() 313void AddressbookWindow::slotUpdateToolbar()
314{ 314{
315 Contact ce = abList->currentEntry(); 315 Contact ce = abList->currentEntry();
316 actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); 316 actionMail->setEnabled( !ce.defaultEmail().isEmpty() );
317} 317}
318 318
319void AddressbookWindow::showList() 319void AddressbookWindow::showList()
320{ 320{
321 if ( mView ) mView->hide(); 321 if ( mView ) mView->hide();
322 setCentralWidget( listContainer ); 322 setCentralWidget( listContainer );
323 listContainer->show(); 323 listContainer->show();
324 // update our focues... (or use a stack widget!); 324 // update our focues... (or use a stack widget!);
325 abList->setFocus(); 325 abList->setFocus();
326} 326}
327 327
328void AddressbookWindow::showView() 328void AddressbookWindow::showView()
329{ 329{
330 if ( abList->numRows() > 0 ) { 330 if ( abList->numRows() > 0 ) {
331 listContainer->hide(); 331 listContainer->hide();
332 setCentralWidget( abView() ); 332 setCentralWidget( abView() );
333 mView->show(); 333 mView->show();
334 mView->setFocus(); 334 mView->setFocus();
335 } 335 }
336} 336}
337 337
338void AddressbookWindow::slotListNew() 338void AddressbookWindow::slotListNew()
339{ 339{
340 Contact cnt; 340 Contact cnt;
341 if( !syncing ) { 341 if( !syncing ) {
342 if ( abEditor ) 342 if ( abEditor )
343 abEditor->setEntry( cnt ); 343 abEditor->setEntry( cnt );
344 abView()->init( cnt ); 344 abView()->init( cnt );
345 editEntry( NewEntry ); 345 editEntry( NewEntry );
346 } else { 346 } else {
347 QMessageBox::warning(this, tr("Contacts"), 347 QMessageBox::warning(this, tr("Contacts"),
348 tr("Can not edit data, currently syncing")); 348 tr("Can not edit data, currently syncing"));
349 } 349 }
350} 350}
351 351
352void AddressbookWindow::slotListView() 352void AddressbookWindow::slotListView()
353{ 353{
354 abView()->init( abList->currentEntry() ); 354 abView()->init( abList->currentEntry() );
355 mView->sync(); 355 mView->sync();
356 showView(); 356 showView();
357} 357}
358 358
359void AddressbookWindow::slotListDelete() 359void AddressbookWindow::slotListDelete()
360{ 360{
361 if(!syncing) { 361 if(!syncing) {
362 Contact tmpEntry = abList->currentEntry(); 362 Contact tmpEntry = abList->currentEntry();
363 363
364 // get a name, do the best we can... 364 // get a name, do the best we can...
365 QString strName = tmpEntry.fullName(); 365 QString strName = tmpEntry.fullName();
366 if ( strName.isEmpty() ) { 366 if ( strName.isEmpty() ) {
367 strName = tmpEntry.company(); 367 strName = tmpEntry.company();
368 if ( strName.isEmpty() ) 368 if ( strName.isEmpty() )
369 strName = "No Name"; 369 strName = "No Name";
370 } 370 }
371 371
372 372
373 if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), 373 if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ),
374 strName ) ) { 374 strName ) ) {
375 abList->deleteCurrentEntry(); 375 abList->deleteCurrentEntry();
376 showList(); 376 showList();
377 } 377 }
378 } else { 378 } else {
379 QMessageBox::warning( this, tr("Contacts"), 379 QMessageBox::warning( this, tr("Contacts"),
380 tr("Can not edit data, currently syncing") ); 380 tr("Can not edit data, currently syncing") );
381 } 381 }
382} 382}
383 383
384void AddressbookWindow::slotViewBack() 384void AddressbookWindow::slotViewBack()
385{ 385{
386 showList(); 386 showList();
387} 387}
388 388
389void AddressbookWindow::slotViewEdit() 389void AddressbookWindow::slotViewEdit()
390{ 390{
391 if(!syncing) { 391 if(!syncing) {
392 if (actionPersonal->isOn()) { 392 if (actionPersonal->isOn()) {
393 editPersonal(); 393 editPersonal();
394 } else { 394 } else {
395 if ( !bAbEditFirstTime ) 395 if ( !bAbEditFirstTime )
396 abEditor->setEntry( abList->currentEntry() ); 396 abEditor->setEntry( abList->currentEntry() );
397 editEntry( EditEntry ); 397 editEntry( EditEntry );
398 } 398 }
399 } else { 399 } else {
400 QMessageBox::warning( this, tr("Contacts"), 400 QMessageBox::warning( this, tr("Contacts"),
401 tr("Can not edit data, currently syncing") ); 401 tr("Can not edit data, currently syncing") );
402 } 402 }
403} 403}
404 404
405 405
406 406
407void AddressbookWindow::writeMail() 407void AddressbookWindow::writeMail()
408{ 408{
409 Contact c = abList->currentEntry(); 409 Contact c = abList->currentEntry();
410 QString name = c.fileAs(); 410 QString name = c.fileAs();
411 QString email = c.defaultEmail(); 411 QString email = c.defaultEmail();
412 QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); 412 QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)");
413 e << name << email; 413 e << name << email;
414} 414}
415 415
416 416
417 417
418 418
419static const char * beamfile = "/tmp/obex/contact.vcf"; 419static const char * beamfile = "/tmp/obex/contact.vcf";
420 420
421void AddressbookWindow::slotBeam() 421void AddressbookWindow::slotBeam()
422{ 422{
423 QString filename; 423 QString filename;
424 Contact c; 424 Contact c;
425 if ( actionPersonal->isOn() ) { 425 if ( actionPersonal->isOn() ) {
426 filename = addressbookPersonalVCardName(); 426 filename = addressbookPersonalVCardName();
427 if (!QFile::exists(filename)) 427 if (!QFile::exists(filename))
428 return; // can't beam a non-existent file 428 return; // can't beam a non-existent file
429 c = Contact::readVCard( filename )[0]; 429 c = Contact::readVCard( filename )[0];
430 } else { 430 } else {
431 unlink( beamfile ); // delete if exists 431 unlink( beamfile ); // delete if exists
432 c = abList->currentEntry(); 432 c = abList->currentEntry();
433 mkdir("/tmp/obex/", 0755); 433 mkdir("/tmp/obex/", 0755);
434 Contact::writeVCard( beamfile, c ); 434 Contact::writeVCard( beamfile, c );
435 filename = beamfile; 435 filename = beamfile;
436 } 436 }
437 Ir *ir = new Ir( this ); 437 Ir *ir = new Ir( this );
438 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 438 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
439 QString description = c.fullName(); 439 QString description = c.fullName();
440 ir->send( filename, description, "text/x-vCard" ); 440 ir->send( filename, description, "text/x-vCard" );
441} 441}
442 442
443void AddressbookWindow::beamDone( Ir *ir ) 443void AddressbookWindow::beamDone( Ir *ir )
444{ 444{
445 delete ir; 445 delete ir;
446 unlink( beamfile ); 446 unlink( beamfile );
447} 447}
448 448
449 449
450static void parseName( const QString& name, QString *first, QString *middle, 450static void parseName( const QString& name, QString *first, QString *middle,
451 QString * last ) 451 QString * last )
452{ 452{
453 453
454 int comma = name.find ( "," ); 454 int comma = name.find ( "," );
455 QString rest; 455 QString rest;
456 if ( comma > 0 ) { 456 if ( comma > 0 ) {
457 *last = name.left( comma ); 457 *last = name.left( comma );
458 comma++; 458 comma++;
459 while ( comma < int(name.length()) && name[comma] == ' ' ) 459 while ( comma < int(name.length()) && name[comma] == ' ' )
460 comma++; 460 comma++;
461 rest = name.mid( comma ); 461 rest = name.mid( comma );
462 } else { 462 } else {
463 int space = name.findRev( ' ' ); 463 int space = name.findRev( ' ' );
464 *last = name.mid( space+1 ); 464 *last = name.mid( space+1 );
465 rest = name.left( space ); 465 rest = name.left( space );
466 } 466 }
467 int space = rest.find( ' ' ); 467 int space = rest.find( ' ' );
468 if ( space <= 0 ) { 468 if ( space <= 0 ) {
469 *first = rest; 469 *first = rest;
470 } else { 470 } else {
471 *first = rest.left( space ); 471 *first = rest.left( space );
472 *middle = rest.mid( space+1 ); 472 *middle = rest.mid( space+1 );
473 } 473 }
474 474
475} 475}
476 476
477 477
478void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) 478void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
479{ 479{
480 if (msg == "editPersonal()") { 480 if (msg == "editPersonal()") {
481 editPersonal(); 481 editPersonal();
482 } else if (msg == "editPersonalAndClose()") { 482 } else if (msg == "editPersonalAndClose()") {
483 editPersonal(); 483 editPersonal();
484 close(); 484 close();
485 } else if ( msg == "addContact(QString,QString)" ) { 485 } else if ( msg == "addContact(QString,QString)" ) {
486 QDataStream stream(data,IO_ReadOnly); 486 QDataStream stream(data,IO_ReadOnly);
487 QString name, email; 487 QString name, email;
488 stream >> name >> email; 488 stream >> name >> email;
489 489
490 Contact cnt; 490 Contact cnt;
491 QString fn, mn, ln; 491 QString fn, mn, ln;
492 parseName( name, &fn, &mn, &ln ); 492 parseName( name, &fn, &mn, &ln );
493 //qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); 493 //qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() );
494 cnt.setFirstName( fn ); 494 cnt.setFirstName( fn );
495 cnt.setMiddleName( mn ); 495 cnt.setMiddleName( mn );
496 cnt.setLastName( ln ); 496 cnt.setLastName( ln );
497 cnt.setEmails( email ); 497 cnt.setEmails( email );
498 cnt.setDefaultEmail( email ); 498 cnt.setDefaultEmail( email );
499 cnt.setFileAs(); 499 cnt.setFileAs();
500 500
501 if ( bAbEditFirstTime ) { 501 if ( bAbEditFirstTime ) {
502 abEditor = new ContactEditor( cnt, &orderedFields, &slOrderedFields, 502 abEditor = new ContactEditor( cnt, &orderedFields, &slOrderedFields,
503 this, "editor" ); 503 this, "editor" );
504 bAbEditFirstTime = FALSE; 504 bAbEditFirstTime = FALSE;
505 } else { 505 } else {
506 abEditor->setEntry( cnt ); 506 abEditor->setEntry( cnt );
507 } 507 }
508 abView()->init( cnt ); 508 abView()->init( cnt );
509 editEntry( NewEntry ); 509 editEntry( NewEntry );
510 510
511 511
512 512
513 } 513 }
514#if 0 514#if 0
515 else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { 515 else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) {
516 QDataStream stream(data,IO_ReadOnly); 516 QDataStream stream(data,IO_ReadOnly);
517 QCString ch,m; 517 QCString ch,m;
518 QStringList types; 518 QStringList types;
519 stream >> ch >> m >> types; 519 stream >> ch >> m >> types;
520 AddressPicker picker(abList,this,0,TRUE); 520 AddressPicker picker(abList,this,0,TRUE);
521 picker.showMaximized(); 521 picker.showMaximized();
522 picker.setChoiceNames(types); 522 picker.setChoiceNames(types);
523 int i=0; 523 int i=0;
524 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { 524 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) {
525 QStringList sel; 525 QStringList sel;
526 stream >> sel; 526 stream >> sel;
527 picker.setSelection(i++,sel); 527 picker.setSelection(i++,sel);
528 } 528 }
529 picker.showMaximized(); 529 picker.showMaximized();
530 picker.exec(); 530 picker.exec();
531 531
532 // ###### note: contacts may have been added - save here! 532 // ###### note: contacts may have been added - save here!
533 533
534 setCentralWidget(abList); 534 setCentralWidget(abList);
535 QCopEnvelope e(ch,m); 535 QCopEnvelope e(ch,m);
536 i=0; 536 i=0;
537 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { 537 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) {
538 QStringList sel = picker.selection(i++); 538 QStringList sel = picker.selection(i++);
539 e << sel; 539 e << sel;
540 } 540 }
541 } 541 }
542#endif 542#endif
543 543
544} 544}
545 545
546void AddressbookWindow::editPersonal() 546void AddressbookWindow::editPersonal()
547{ 547{
548 QString filename = addressbookPersonalVCardName(); 548 QString filename = addressbookPersonalVCardName();
549 Contact me; 549 Contact me;
550 if (QFile::exists(filename)) 550 if (QFile::exists(filename))
551 me = Contact::readVCard( filename )[0]; 551 me = Contact::readVCard( filename )[0];
552 if (bAbEditFirstTime) { 552 if (bAbEditFirstTime) {
553 abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields, 553 abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields,
554 this, "editor" ); 554 this, "editor" );
555 // don't create a new editor every time 555 // don't create a new editor every time
556 bAbEditFirstTime = FALSE; 556 bAbEditFirstTime = FALSE;
557 } else 557 } else
558 abEditor->setEntry( me ); 558 abEditor->setEntry( me );
559 559
560 abEditor->setCaption(tr("Edit My Personal Details")); 560 abEditor->setCaption(tr("Edit My Personal Details"));
561 abEditor->showMaximized(); 561 abEditor->showMaximized();
562 562
563 // fix the foxus... 563 // fix the foxus...
564 abEditor->setNameFocus(); 564 abEditor->setNameFocus();
565 if ( abEditor->exec() ) { 565 if ( abEditor->exec() ) {
566 setFocus(); 566 setFocus();
567 Contact new_personal = abEditor->entry(); 567 Contact new_personal = abEditor->entry();
568 QString fname = addressbookPersonalVCardName(); 568 QString fname = addressbookPersonalVCardName();
569 Contact::writeVCard( fname, new_personal ); 569 Contact::writeVCard( fname, new_personal );
570 abView()->init(new_personal); 570 abView()->init(new_personal);
571 abView()->sync(); 571 abView()->sync();
572 } 572 }
573 abEditor->setCaption( tr("Edit Address") ); 573 abEditor->setCaption( tr("Edit Address") );
574} 574}
575 575
576void AddressbookWindow::slotPersonalView() 576void AddressbookWindow::slotPersonalView()
577{ 577{
578 if (!actionPersonal->isOn()) { 578 if (!actionPersonal->isOn()) {
579 // we just turned it off 579 // we just turned it off
580 setCaption( tr("Contacts") ); 580 setCaption( tr("Contacts") );
581 actionNew->setEnabled(TRUE); 581 actionNew->setEnabled(TRUE);
582 actionTrash->setEnabled(TRUE); 582 actionTrash->setEnabled(TRUE);
583#ifndef MAKE_FOR_SHARP_ROM 583#ifndef MAKE_FOR_SHARP_ROM
584 actionFind->setEnabled(TRUE); 584 actionFind->setEnabled(TRUE);
585#endif 585#endif
586 slotUpdateToolbar(); // maybe some of the above could be moved there 586 slotUpdateToolbar(); // maybe some of the above could be moved there
587 showList(); 587 showList();
588 return; 588 return;
589 } 589 }
590 590
591 // XXX need to disable some QActions. 591 // XXX need to disable some QActions.
592 actionNew->setEnabled(FALSE); 592 actionNew->setEnabled(FALSE);
593 actionTrash->setEnabled(FALSE); 593 actionTrash->setEnabled(FALSE);
594#ifndef MAKE_FOR_SHARP_ROM 594#ifndef MAKE_FOR_SHARP_ROM
595 actionFind->setEnabled(FALSE); 595 actionFind->setEnabled(FALSE);
596#endif 596#endif
597 actionMail->setEnabled(FALSE); 597 actionMail->setEnabled(FALSE);
598 598
599 setCaption( tr("Contacts - My Personal Details") ); 599 setCaption( tr("Contacts - My Personal Details") );
600 QString filename = addressbookPersonalVCardName(); 600 QString filename = addressbookPersonalVCardName();
601 Contact me; 601 Contact me;
602 if (QFile::exists(filename)) 602 if (QFile::exists(filename))
603 me = Contact::readVCard( filename )[0]; 603 me = Contact::readVCard( filename )[0];
604 604
605 abView()->init( me ); 605 abView()->init( me );
606 abView()->sync(); 606 abView()->sync();
607 listContainer->hide(); 607 listContainer->hide();
608 setCentralWidget( abView() ); 608 setCentralWidget( abView() );
609 mView->show(); 609 mView->show();
610 mView->setFocus(); 610 mView->setFocus();
611} 611}
612 612
613void AddressbookWindow::editEntry( EntryMode entryMode ) 613void AddressbookWindow::editEntry( EntryMode entryMode )
614{ 614{
615 Contact entry; 615 Contact entry;
616 if ( bAbEditFirstTime ) { 616 if ( bAbEditFirstTime ) {
617 abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields, 617 abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields,
618 this, "editor" ); 618 this, "editor" );
619 bAbEditFirstTime = FALSE; 619 bAbEditFirstTime = FALSE;
620 if ( entryMode == EditEntry ) 620 if ( entryMode == EditEntry )
621 abEditor->setEntry( abList->currentEntry() ); 621 abEditor->setEntry( abList->currentEntry() );
622 } 622 }
623 // other things may chane the caption. 623 // other things may chane the caption.
624 abEditor->setCaption( tr("Edit Address") ); 624 abEditor->setCaption( tr("Edit Address") );
625 625
626#if defined(Q_WS_QWS) || defined(_WS_QWS_) 626#if defined(Q_WS_QWS) || defined(_WS_QWS_)
627 abEditor->showMaximized(); 627 abEditor->showMaximized();
628#endif 628#endif
629 // fix the foxus... 629 // fix the foxus...
630 abEditor->setNameFocus(); 630 abEditor->setNameFocus();
631 if ( abEditor->exec() ) { 631 if ( abEditor->exec() ) {
632 setFocus(); 632 setFocus();
633 if ( entryMode == NewEntry ) { 633 if ( entryMode == NewEntry ) {
634 Contact insertEntry = abEditor->entry(); 634 Contact insertEntry = abEditor->entry();
635 insertEntry.assignUid(); 635 insertEntry.assignUid();
636 abList->addEntry( insertEntry ); 636 abList->addEntry( insertEntry );
637 } else { 637 } else {
638 Contact replaceEntry = abEditor->entry(); 638 Contact replaceEntry = abEditor->entry();
639 if ( !replaceEntry.isValidUid() ) 639 if ( !replaceEntry.isValidUid() )
640 replaceEntry.assignUid(); 640 replaceEntry.assignUid();
641 abList->replaceCurrentEntry( replaceEntry ); 641 abList->replaceCurrentEntry( replaceEntry );
642 } 642 }
643 } 643 }
644 populateCategories(); 644 populateCategories();
645 showList(); 645 showList();
646} 646}
647 647
648void AddressbookWindow::listIsEmpty( bool empty ) 648void AddressbookWindow::listIsEmpty( bool empty )
649{ 649{
650 if ( !empty ) { 650 if ( !empty ) {
651 deleteButton->setEnabled( TRUE ); 651 deleteButton->setEnabled( TRUE );
652 } 652 }
653} 653}
654 654
655void AddressbookWindow::reload() 655void AddressbookWindow::reload()
656{ 656{
657 syncing = FALSE; 657 syncing = FALSE;
658 abList->clear(); 658 abList->clear();
659 abList->load( addressbookXMLFilename() ); 659 abList->load( addressbookXMLFilename() );
660} 660}
661 661
662void AddressbookWindow::flush() 662void AddressbookWindow::flush()
663{ 663{
664 syncing = TRUE; 664 syncing = TRUE;
665 abList->save( addressbookXMLFilename() ); 665 abList->save( addressbookXMLFilename() );
666} 666}
667 667
668 668
669void AddressbookWindow::closeEvent( QCloseEvent *e ) 669void AddressbookWindow::closeEvent( QCloseEvent *e )
670{ 670{
671 if ( centralWidget() == mView ) { 671 if ( centralWidget() == mView ) {
672 if (actionPersonal->isOn()) { 672 if (actionPersonal->isOn()) {
673 // pretend we clicked it off 673 // pretend we clicked it off
674 actionPersonal->setOn(FALSE); 674 actionPersonal->setOn(FALSE);
675 slotPersonalView(); 675 slotPersonalView();
676 } else { 676 } else {
677 showList(); 677 showList();
678 } 678 }
679 e->ignore(); 679 e->ignore();
680 return; 680 return;
681 } 681 }
682 682
683 if(syncing) { 683 if(syncing) {
684 /* shouldn't we save, I hear you say? well its already been set 684 /* shouldn't we save, I hear you say? well its already been set
685 so that an edit can not occur during a sync, and we flushed 685 so that an edit can not occur during a sync, and we flushed
686 at the start of the sync, so there is no need to save 686 at the start of the sync, so there is no need to save
687 Saving however itself would cause problems. */ 687 Saving however itself would cause problems. */
688 e->accept(); 688 e->accept();
689 return; 689 return;
690 } 690 }
691//################## shouldn't always save 691//################## shouldn't always save
692 if ( save() ) 692 if ( save() )
693 e->accept(); 693 e->accept();
694 else 694 else
695 e->ignore(); 695 e->ignore();
696} 696}
697 697
698/* 698/*
699 Returns TRUE if it is OK to exit 699 Returns TRUE if it is OK to exit
700 */ 700 */
701 701
702bool AddressbookWindow::save() 702bool AddressbookWindow::save()
703{ 703{
704 QString str = addressbookXMLFilename(); 704 QString str = addressbookXMLFilename();
705 if ( str.isNull() ) { 705 if ( str.isNull() ) {
706 if ( QMessageBox::critical( 0, tr("Out of space"), 706 if ( QMessageBox::critical( 0, tr("Out of space"),
707 tr("Unable to save information.\n" 707 tr("Unable to save information.\n"
708 "Free up some space\n" 708 "Free up some space\n"
709 "and try again.\n" 709 "and try again.\n"
710 "\nQuit anyway?"), 710 "\nQuit anyway?"),
711 QMessageBox::Yes|QMessageBox::Escape, 711 QMessageBox::Yes|QMessageBox::Escape,
712 QMessageBox::No|QMessageBox::Default ) 712 QMessageBox::No|QMessageBox::Default )
713 != QMessageBox::No ) 713 != QMessageBox::No )
714 return TRUE; 714 return TRUE;
715 else 715 else
716 return FALSE; 716 return FALSE;
717 } else { 717 } else {
718 if ( !abList->save( str ) ) { 718 if ( !abList->save( str ) ) {
719 if ( QMessageBox::critical( 0, tr( "Out of space" ), 719 if ( QMessageBox::critical( 0, tr( "Out of space" ),
720 tr("Unable to save information.\n" 720 tr("Unable to save information.\n"
721 "Free up some space\n" 721 "Free up some space\n"
722 "and try again.\n" 722 "and try again.\n"
723 "\nQuit anyway?"), 723 "\nQuit anyway?"),
724 QMessageBox::Yes|QMessageBox::Escape, 724 QMessageBox::Yes|QMessageBox::Escape,
725 QMessageBox::No|QMessageBox::Default ) 725 QMessageBox::No|QMessageBox::Default )
726 != QMessageBox::No ) 726 != QMessageBox::No )
727 return TRUE; 727 return TRUE;
728 else 728 else
729 return FALSE; 729 return FALSE;
730 } 730 }
731 } 731 }
732 return TRUE; 732 return TRUE;
733} 733}
734 734
735void AddressbookWindow::slotSettings() 735void AddressbookWindow::slotSettings()
736{ 736{
737 AddressSettings frmSettings( this ); 737 AddressSettings frmSettings( this );
738#if defined(Q_WS_QWS) || defined(_WS_QWS_) 738#if defined(Q_WS_QWS) || defined(_WS_QWS_)
739 frmSettings.showMaximized(); 739 frmSettings.showMaximized();
740#endif 740#endif
741 741
742 if ( frmSettings.exec() ) { 742 if ( frmSettings.exec() ) {
743 allFields.clear(); 743 allFields.clear();
744 orderedFields.clear(); 744 orderedFields.clear();
745 slOrderedFields.clear(); 745 slOrderedFields.clear();
746 initFields(); 746 initFields();
747 if ( abEditor ) 747 if ( abEditor )
748 abEditor->loadFields(); 748 abEditor->loadFields();
749 abList->refresh(); 749 abList->refresh();
750 } 750 }
751} 751}
752 752
753 753
754void AddressbookWindow::initFields() 754void AddressbookWindow::initFields()
755{ 755{
756 // we really don't need the things from the configuration, anymore 756 // we really don't need the things from the configuration, anymore
757 // only thing that is important are the important categories. So, 757 // only thing that is important are the important categories. So,
758 // Call the contact functions that correspond to these old functions... 758 // Call the contact functions that correspond to these old functions...
759 759
760 QStringList xmlFields = Contact::fields(); 760 QStringList xmlFields = Contact::fields();
761 QStringList visibleFields = Contact::trfields(); 761 QStringList visibleFields = Contact::trfields();
762 xmlFields.remove( "Title" ); 762 xmlFields.remove( "Title" );
763 visibleFields.remove( tr("Name Title") ); 763 visibleFields.remove( tr("Name Title") );
764 visibleFields.remove( tr("Notes") ); 764 visibleFields.remove( tr("Notes") );
765 765
766 int i, 766 int i,
767 version; 767 version;
768 Config cfg( "AddressBook" ); 768 Config cfg( "AddressBook" );
769 QString zn; 769 QString zn;
770 770
771 // ### Write a function to keep this from happening again... 771 // ### Write a function to keep this from happening again...
772 QStringList::ConstIterator it; 772 QStringList::ConstIterator it;
773 for ( i = 0, it = xmlFields.begin(); it != xmlFields.end(); ++it, i++ ) { 773 for ( i = 0, it = xmlFields.begin(); it != xmlFields.end(); ++it, i++ ) {
774 allFields.append( i + 3 ); 774 allFields.append( i + 3 );
775 } 775 }
776 776
777 cfg.setGroup( "Version" ); 777 cfg.setGroup( "Version" );
778 version = cfg.readNumEntry( "version" ); 778 version = cfg.readNumEntry( "version" );
779 i = 0; 779 i = 0;
780 startFontSize = 1; 780 startFontSize = 1;
781 781
782 if ( version >= ADDRESSVERSION ) { 782 if ( version >= ADDRESSVERSION ) {
783 783
784 cfg.setGroup( "ImportantCategory" ); 784 cfg.setGroup( "ImportantCategory" );
785 785
786 zn = cfg.readEntry( "Category" + QString::number(i), QString::null ); 786 zn = cfg.readEntry( "Category" + QString::number(i), QString::null );
787 while ( !zn.isNull() ) { 787 while ( !zn.isNull() ) {
788 if ( zn.contains( tr("Work") ) || zn.contains( tr("Mb") ) ) { 788 if ( zn.contains( tr("Work") ) || zn.contains( tr("Mb") ) ) {
789 slOrderedFields.clear(); 789 slOrderedFields.clear();
790 break; 790 break;
791 } 791 }
792 slOrderedFields.append( zn ); 792 slOrderedFields.append( zn );
793 zn = cfg.readEntry( "Category" + QString::number(++i), QString::null ); 793 zn = cfg.readEntry( "Category" + QString::number(++i), QString::null );
794 } 794 }
795 cfg.setGroup( "Font" ); 795 cfg.setGroup( "Font" );
796 startFontSize = cfg.readNumEntry( "fontSize", 1 ); 796 startFontSize = cfg.readNumEntry( "fontSize", 1 );
797 797
798 798
799 } else { 799 } else {
800 QString str; 800 QString str;
801 str = getenv("HOME"); 801 str = getenv("HOME");
802 str += "/Settings/AddressBook.conf"; 802 str += "/Settings/AddressBook.conf";
803 QFile::remove( str ); 803 QFile::remove( str );
804 } 804 }
805 if ( slOrderedFields.count() > 0 ) { 805 if ( slOrderedFields.count() > 0 ) {
806 for( QStringList::ConstIterator it = slOrderedFields.begin(); 806 for( QStringList::ConstIterator it = slOrderedFields.begin();
807 it != slOrderedFields.end(); ++it ) { 807 it != slOrderedFields.end(); ++it ) {
808 QValueList<int>::ConstIterator itVl; 808 QValueList<int>::ConstIterator itVl;
809 QStringList::ConstIterator itVis; 809 QStringList::ConstIterator itVis;
810 itVl = allFields.begin(); 810 itVl = allFields.begin();
811 for ( itVis = visibleFields.begin(); 811 for ( itVis = visibleFields.begin();
812 itVis != visibleFields.end() && itVl != allFields.end(); 812 itVis != visibleFields.end() && itVl != allFields.end();
813 ++itVis, ++itVl ) { 813 ++itVis, ++itVl ) {
814 if ( *it == *itVis && itVl != allFields.end() ) { 814 if ( *it == *itVis && itVl != allFields.end() ) {
815 orderedFields.append( *itVl ); 815 orderedFields.append( *itVl );
816 } 816 }
817 } 817 }
818 } 818 }
819 } else { 819 } else {
820 QValueList<int>::ConstIterator it; 820 QValueList<int>::ConstIterator it;
821 for ( it = allFields.begin(); it != allFields.end(); ++it ) 821 for ( it = allFields.begin(); it != allFields.end(); ++it )
822 orderedFields.append( *it ); 822 orderedFields.append( *it );
823 823
824 slOrderedFields = visibleFields; 824 slOrderedFields = visibleFields;
825 orderedFields.remove( Qtopia::AddressUid ); 825 orderedFields.remove( Qtopia::AddressUid );
826 orderedFields.remove( Qtopia::Title ); 826 orderedFields.remove( Qtopia::Title );
827 orderedFields.remove( Qtopia::Groups ); 827 orderedFields.remove( Qtopia::Groups );
828 orderedFields.remove( Qtopia::AddressCategory ); 828 orderedFields.remove( Qtopia::AddressCategory );
829 orderedFields.remove( Qtopia::FirstName ); 829 orderedFields.remove( Qtopia::FirstName );
830 orderedFields.remove( Qtopia::LastName ); 830 orderedFields.remove( Qtopia::LastName );
831 orderedFields.remove( Qtopia::DefaultEmail ); 831 orderedFields.remove( Qtopia::DefaultEmail );
832 orderedFields.remove( Qtopia::FileAs ); 832 orderedFields.remove( Qtopia::FileAs );
833 orderedFields.remove( Qtopia::Notes ); 833 orderedFields.remove( Qtopia::Notes );
834 orderedFields.remove( Qtopia::Gender ); 834 orderedFields.remove( Qtopia::Gender );
835 slOrderedFields.remove( tr("Name Title") ); 835 slOrderedFields.remove( tr("Name Title") );
836 slOrderedFields.remove( tr("First Name") ); 836 slOrderedFields.remove( tr("First Name") );
837 slOrderedFields.remove( tr("Last Name") ); 837 slOrderedFields.remove( tr("Last Name") );
838 slOrderedFields.remove( tr("File As") ); 838 slOrderedFields.remove( tr("File As") );
839 slOrderedFields.remove( tr("Default Email") ); 839 slOrderedFields.remove( tr("Default Email") );
840 slOrderedFields.remove( tr("Notes") ); 840 slOrderedFields.remove( tr("Notes") );
841 slOrderedFields.remove( tr("Gender") ); 841 slOrderedFields.remove( tr("Gender") );
842 842
843 } 843 }
844} 844}
845 845
846 846
847AbLabel *AddressbookWindow::abView() 847AbLabel *AddressbookWindow::abView()
848{ 848{
849 if ( !mView ) { 849 if ( !mView ) {
850 mView = new AbLabel( this, "viewer" ); 850 mView = new AbLabel( this, "viewer" );
851 mView->init( Contact() ); 851 mView->init( Contact() );
852 connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); 852 connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) );
853 } 853 }
854 return mView; 854 return mView;
855} 855}
856 856
857void AddressbookWindow::slotFind() 857void AddressbookWindow::slotFind()
858{ 858{
859#ifndef MAKE_FOR_SHARP_ROM 859#ifndef MAKE_FOR_SHARP_ROM
860 if ( centralWidget() == abView() ) 860 if ( centralWidget() == abView() )
861 showList(); 861 showList();
862 862
863 FindDialog frmFind( "Contacts", this ); 863 FindDialog frmFind( "Contacts", this );
864 QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int))); 864 QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int)));
865 QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) ); 865 QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) );
866 QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) ); 866 QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) );
867 867
868 frmFind.exec(); 868 frmFind.exec();
869 869
870 if ( abList->numSelections() ) 870 if ( abList->numSelections() )
871 abList->clearSelection(); 871 abList->clearSelection();
872 872
873 abList->clearFindRow(); 873 abList->clearFindRow();
874#endif 874#endif
875} 875}
876 876
877void AddressbookWindow::slotSetCategory( int c ) 877void AddressbookWindow::slotSetCategory( int c )
878{ 878{
879 if ( c <= 0 ) 879 if ( c <= 0 )
880 return; 880 return;
881 for ( unsigned int i = 1; i < catMenu->count(); i++ ) 881 for ( unsigned int i = 1; i < catMenu->count(); i++ )
882 catMenu->setItemChecked( i, c == (int)i ); 882 catMenu->setItemChecked( i, c == (int)i );
883 if ( c == 1 ) { 883 if ( c == 1 ) {
884 abList->setShowCategory( QString::null ); 884 abList->setShowCategory( QString::null );
885 setCaption( tr("Contacts") + " - " + tr ( "All" ) ); 885 setCaption( tr("Contacts") + " - " + tr ( "All" ) );
886 } else if ( c == (int)catMenu->count() ) { 886 } else if ( c == (int)catMenu->count() ) {
887 abList->setShowCategory( tr( "Unfiled" ) ); 887 abList->setShowCategory( tr( "Unfiled" ) );
888 setCaption( tr("Contacts") + " - " + tr( "Unfiled" ) ); 888 setCaption( tr("Contacts") + " - " + tr( "Unfiled" ) );
889 } else { 889 } else {
890 QString cat = abList->categories()[c - 2]; 890 QString cat = abList->categories()[c - 2];
891 abList->setShowCategory( cat ); 891 abList->setShowCategory( cat );
892 setCaption( tr("Contacts") + " - " + cat ); 892 setCaption( tr("Contacts") + " - " + cat );
893 } 893 }
894} 894}
895 895
896void AddressbookWindow::slotSetLetter( char c ) { 896void AddressbookWindow::slotSetLetter( char c ) {
897 897
898 abList->setShowByLetter( c ); 898 abList->setShowByLetter( c );
899 899
900} 900}
901 901
902void AddressbookWindow::populateCategories() 902void AddressbookWindow::populateCategories()
903{ 903{
904 catMenu->clear(); 904 catMenu->clear();
905 905
906 int id, 906 int id,
907 rememberId; 907 rememberId;
908 id = 1; 908 id = 1;
909 rememberId = 0;
909 catMenu->insertItem( tr( "All" ), id++ ); 910 catMenu->insertItem( tr( "All" ), id++ );
910 QStringList categories = abList->categories(); 911 QStringList categories = abList->categories();
911 categories.append( tr( "Unfiled" ) ); 912 categories.append( tr( "Unfiled" ) );
912 for ( QStringList::Iterator it = categories.begin(); 913 for ( QStringList::Iterator it = categories.begin();
913 it != categories.end(); ++it ) { 914 it != categories.end(); ++it ) {
914 catMenu->insertItem( *it, id ); 915 catMenu->insertItem( *it, id );
915 if ( *it == abList->showCategory() ) 916 if ( *it == abList->showCategory() )
916 rememberId = id; 917 rememberId = id;
917 ++id; 918 ++id;
918 } 919 }
919 if ( abList->showCategory().isEmpty() ) 920 if ( abList->showCategory().isEmpty() )
920 slotSetCategory( 1 ); 921 slotSetCategory( 1 );
921 else 922 else
922 slotSetCategory( rememberId ); 923 slotSetCategory( rememberId );
923} 924}
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index e74da87..fa60f98 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -1,1635 +1,1663 @@
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 Contact &entry, 52 ContactEditor::ContactEditor(const Contact &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 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 for (i = 0; i <= 6; i++) { 87 for (i = 0; i <= 6; i++) {
88 slHomeAddress->append( "" ); 88 slHomeAddress.append( "" );
89 slBusinessAddress->append( "" ); 89 slBusinessAddress.append( "" );
90 } 90 }
91 91
92 { 92 {
93 hasGender = FALSE; 93 hasGender = FALSE;
94 hasTitle = FALSE; 94 hasTitle = FALSE;
95 hasCompany = FALSE; 95 hasCompany = FALSE;
96 hasNotes = FALSE; 96 hasNotes = FALSE;
97 hasStreet = FALSE; 97 hasStreet = FALSE;
98 hasStreet2 = FALSE; 98 hasStreet2 = FALSE;
99 hasPOBox = FALSE; 99 hasPOBox = FALSE;
100 hasCity = FALSE; 100 hasCity = FALSE;
101 hasState = FALSE; 101 hasState = FALSE;
102 hasZip = FALSE; 102 hasZip = FALSE;
103 hasCountry = FALSE; 103 hasCountry = FALSE;
104 104
105 QStringList::ConstIterator it = slOrdered->begin(); 105 QStringList::ConstIterator it = slOrdered.begin();
106 for ( i = 0; it != slOrdered->end(); i++, ++it ) { 106 for ( i = 0; it != slOrdered.end(); i++, ++it ) {
107 107
108 if ( (*it).right( 3 ) == tr( "Fax" ) ) { 108 if ( (*it).right( 3 ) == tr( "Fax" ) ) {
109 slChooserNames->append( *it ); 109 slChooserNames.append( *it );
110 slChooserValues->append( tr( "" ) ); 110 slChooserValues.append("" );
111 //slDynamicEntries->remove( it ); 111 //slDynamicEntries->remove( it );
112 continue; 112 continue;
113 } 113 }
114 114
115 if ( (*it).right( 5 ) == tr( "Phone" ) ) { 115 if ( (*it).right( 5 ) == tr( "Phone" ) ) {
116 slChooserNames->append( *it ); 116 slChooserNames.append( *it );
117 slChooserValues->append( "" ); 117 slChooserValues.append( "" );
118 //slDynamicEntries->remove( it ); 118 //slDynamicEntries->remove( it );
119 continue; 119 continue;
120 } 120 }
121 121
122 if ( (*it).right( 2 ) == tr( "IM" ) ) { 122 if ( (*it).right( 2 ) == tr( "IM" ) ) {
123 slChooserNames->append( *it ); 123 slChooserNames.append( *it );
124 slChooserValues->append( "" ); 124 slChooserValues.append( "" );
125 //slDynamicEntries->remove( it ); 125 //slDynamicEntries->remove( it );
126 continue; 126 continue;
127 } 127 }
128 128
129 if ( (*it).right( 6 ) == tr( "Mobile" ) ) { 129 if ( (*it).right( 6 ) == tr( "Mobile" ) ) {
130 slChooserNames->append( *it ); 130 slChooserNames.append( *it );
131 slChooserValues->append( "" ); 131 slChooserValues.append( "" );
132 //slDynamicEntries->remove( it ); 132 //slDynamicEntries->remove( it );
133 continue; 133 continue;
134 } 134 }
135 135
136 if ( (*it).right( 4 ) == tr( "Page" ) ) { 136 if ( (*it).right( 4 ) == tr( "Page" ) ) {
137 slChooserNames->append( *it ); 137 slChooserNames.append( *it );
138 slChooserValues->append( "" ); 138 slChooserValues.append( "" );
139 //slDynamicEntries->remove( it ); 139 //slDynamicEntries->remove( it );
140 continue; 140 continue;
141 } 141 }
142 142
143 if ( (*it).right( 5 ) == tr( "Pager" ) ) { 143 if ( (*it).right( 5 ) == tr( "Pager" ) ) {
144 slChooserNames->append( *it ); 144 slChooserNames.append( *it );
145 slChooserValues->append( "" ); 145 slChooserValues.append( "" );
146 //slDynamicEntries->remove( it ); 146 //slDynamicEntries->remove( it );
147 continue; 147 continue;
148 } 148 }
149 149
150 if ( *it == tr( "Default Email" ) ) { 150 if ( *it == tr( "Default Email" ) ) {
151 slChooserNames->append( *it ); 151 slChooserNames.append( *it );
152 slChooserValues->append( "" ); 152 slChooserValues.append( "" );
153 //slDynamicEntries->remove( it ); 153 //slDynamicEntries->remove( it );
154 continue; 154 continue;
155 } 155 }
156 156
157 if ( *it == tr( "Emails" ) ) { 157 if ( *it == tr( "Emails" ) ) {
158 slChooserNames->append( *it ); 158 slChooserNames.append( *it );
159 slChooserValues->append( "" ); 159 slChooserValues.append( "" );
160 //slDynamicEntries->remove( it ); 160 //slDynamicEntries->remove( it );
161 continue; 161 continue;
162 } 162 }
163 163
164 if ( *it == tr( "Name Title" ) ) { 164 if ( *it == tr( "Name Title" ) ) {
165 //slDynamicEntries->remove( it ); 165 //slDynamicEntries->remove( it );
166 continue; 166 continue;
167 } 167 }
168 168
169 if ( *it == tr( "First Name" ) ) { 169 if ( *it == tr( "First Name" ) ) {
170 //slDynamicEntries->remove( it ); 170 //slDynamicEntries->remove( it );
171 continue; 171 continue;
172 } 172 }
173 173
174 if ( *it == tr( "Middle Name" ) ) { 174 if ( *it == tr( "Middle Name" ) ) {
175 //slDynamicEntries->remove( it ); 175 //slDynamicEntries->remove( it );
176 continue; 176 continue;
177 } 177 }
178 178
179 if ( *it == tr( "Last Name" ) ) { 179 if ( *it == tr( "Last Name" ) ) {
180 //slDynamicEntries->remove( it ); 180 //slDynamicEntries->remove( it );
181 continue; 181 continue;
182 } 182 }
183 183
184 if ( *it == tr( "Suffix" ) ) { 184 if ( *it == tr( "Suffix" ) ) {
185 //slDynamicEntries->remove( it ); 185 //slDynamicEntries->remove( it );
186 continue; 186 continue;
187 } 187 }
188 188
189 if ( *it == tr( "File As" ) ) { 189 if ( *it == tr( "File As" ) ) {
190 //slDynamicEntries->remove( it ); 190 //slDynamicEntries->remove( it );
191 continue; 191 continue;
192 } 192 }
193 193
194 if ( *it == tr( "Gender" ) ) { 194 if ( *it == tr( "Gender" ) ) {
195 hasGender = TRUE; 195 hasGender = TRUE;
196 //slDynamicEntries->remove( it ); 196 //slDynamicEntries->remove( it );
197 continue; 197 continue;
198 } 198 }
199 199
200 if ( *it == tr( "Job Title" ) ) { 200 if ( *it == tr( "Job Title" ) ) {
201 hasTitle = TRUE; 201 hasTitle = TRUE;
202 //slDynamicEntries->remove( it ); 202 //slDynamicEntries->remove( it );
203 continue; 203 continue;
204 } 204 }
205 205
206 if ( *it == tr( "Company" ) ) { 206 if ( *it == tr( "Company" ) ) {
207 hasCompany = TRUE; 207 hasCompany = TRUE;
208 //slDynamicEntries->remove( it ); 208 //slDynamicEntries->remove( it );
209 continue; 209 continue;
210 } 210 }
211 211
212 if ( *it == tr( "Notes" ) ) { 212 if ( *it == tr( "Notes" ) ) {
213 hasNotes = TRUE; 213 hasNotes = TRUE;
214 //slDynamicEntries->remove( it ); 214 //slDynamicEntries->remove( it );
215 continue; 215 continue;
216 } 216 }
217 217
218 if ( *it == tr( "Groups" ) ) { 218 if ( *it == tr( "Groups" ) ) {
219 //slDynamicEntries->remove( it ); 219 //slDynamicEntries->remove( it );
220 continue; 220 continue;
221 } 221 }
222 222
223 if ( (*it).right( 6 ) == tr( "Street" ) ) { 223 if ( (*it).right( 6 ) == tr( "Street" ) ) {
224 hasStreet = TRUE; 224 hasStreet = TRUE;
225 //slDynamicEntries->remove( it ); 225 //slDynamicEntries->remove( it );
226 continue; 226 continue;
227 } 227 }
228 228
229 if ( (*it).right( 8 ) == tr( "Street 2" ) ) { 229 if ( (*it).right( 8 ) == tr( "Street 2" ) ) {
230 hasStreet2 = TRUE; 230 hasStreet2 = TRUE;
231 //slDynamicEntries->remove( it ); 231 //slDynamicEntries->remove( it );
232 continue; 232 continue;
233 } 233 }
234 234
235 if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { 235 if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) {
236 hasPOBox = TRUE; 236 hasPOBox = TRUE;
237 //slDynamicEntries->remove( it ); 237 //slDynamicEntries->remove( it );
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, 4 ); 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( 90 ); 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( 90 ); 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( 90 ); 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, 6, 3, 2, 4 ); 349 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem
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 ( "Afganistan" ) ); 392 cmbCountry->insertItem( tr ( "Afganistan" ) );
393 cmbCountry->insertItem( tr ( "Albania" ) ); 393 cmbCountry->insertItem( tr ( "Albania" ) );
394 cmbCountry->insertItem( tr ( "Algeria" ) ); 394 cmbCountry->insertItem( tr ( "Algeria" ) );
395 cmbCountry->insertItem( tr ( "American Samoa" ) ); 395 cmbCountry->insertItem( tr ( "American Samoa" ) );
396 cmbCountry->insertItem( tr ( "Andorra" ) ); 396 cmbCountry->insertItem( tr ( "Andorra" ) );
397 cmbCountry->insertItem( tr ( "Angola" ) ); 397 cmbCountry->insertItem( tr ( "Angola" ) );
398 cmbCountry->insertItem( tr ( "Anguilla" ) ); 398 cmbCountry->insertItem( tr ( "Anguilla" ) );
399 cmbCountry->insertItem( tr ( "Antartica" ) ); 399 cmbCountry->insertItem( tr ( "Antartica" ) );
400 cmbCountry->insertItem( tr ( "Argentina" ) ); 400 cmbCountry->insertItem( tr ( "Argentina" ) );
401 cmbCountry->insertItem( tr ( "Armania" ) ); 401 cmbCountry->insertItem( tr ( "Armania" ) );
402 cmbCountry->insertItem( tr ( "Aruba" ) ); 402 cmbCountry->insertItem( tr ( "Aruba" ) );
403 cmbCountry->insertItem( tr ( "Australia" ) ); 403 cmbCountry->insertItem( tr ( "Australia" ) );
404 cmbCountry->insertItem( tr ( "Austria" ) ); 404 cmbCountry->insertItem( tr ( "Austria" ) );
405 cmbCountry->insertItem( tr ( "Azerbaijan" ) ); 405 cmbCountry->insertItem( tr ( "Azerbaijan" ) );
406 cmbCountry->insertItem( tr ( "Bahamas" ) ); 406 cmbCountry->insertItem( tr ( "Bahamas" ) );
407 cmbCountry->insertItem( tr ( "Bahrain" ) ); 407 cmbCountry->insertItem( tr ( "Bahrain" ) );
408 cmbCountry->insertItem( tr ( "Bangladesh" ) ); 408 cmbCountry->insertItem( tr ( "Bangladesh" ) );
409 cmbCountry->insertItem( tr ( "Barbados" ) ); 409 cmbCountry->insertItem( tr ( "Barbados" ) );
410 cmbCountry->insertItem( tr ( "Belarus" ) ); 410 cmbCountry->insertItem( tr ( "Belarus" ) );
411 cmbCountry->insertItem( tr ( "Belgium" ) ); 411 cmbCountry->insertItem( tr ( "Belgium" ) );
412 cmbCountry->insertItem( tr ( "Belize" ) ); 412 cmbCountry->insertItem( tr ( "Belize" ) );
413 cmbCountry->insertItem( tr ( "Benin" ) ); 413 cmbCountry->insertItem( tr ( "Benin" ) );
414 cmbCountry->insertItem( tr ( "Bermuda" ) ); 414 cmbCountry->insertItem( tr ( "Bermuda" ) );
415 cmbCountry->insertItem( tr ( "Bhutan" ) ); 415 cmbCountry->insertItem( tr ( "Bhutan" ) );
416 cmbCountry->insertItem( tr ( "Boliva" ) ); 416 cmbCountry->insertItem( tr ( "Boliva" ) );
417 cmbCountry->insertItem( tr ( "Botswana" ) ); 417 cmbCountry->insertItem( tr ( "Botswana" ) );
418 cmbCountry->insertItem( tr ( "Bouvet Island" ) ); 418 cmbCountry->insertItem( tr ( "Bouvet Island" ) );
419 cmbCountry->insertItem( tr ( "Brazil" ) ); 419 cmbCountry->insertItem( tr ( "Brazil" ) );
420 cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); 420 cmbCountry->insertItem( tr ( "Brunei Darussalam" ) );
421 cmbCountry->insertItem( tr ( "Bulgaria" ) ); 421 cmbCountry->insertItem( tr ( "Bulgaria" ) );
422 cmbCountry->insertItem( tr ( "Burkina Faso" ) ); 422 cmbCountry->insertItem( tr ( "Burkina Faso" ) );
423 cmbCountry->insertItem( tr ( "Burundi" ) ); 423 cmbCountry->insertItem( tr ( "Burundi" ) );
424 cmbCountry->insertItem( tr ( "Cambodia" ) ); 424 cmbCountry->insertItem( tr ( "Cambodia" ) );
425 cmbCountry->insertItem( tr ( "Camaroon" ) ); 425 cmbCountry->insertItem( tr ( "Camaroon" ) );
426 cmbCountry->insertItem( tr ( "Canada" ) ); 426 cmbCountry->insertItem( tr ( "Canada" ) );
427 cmbCountry->insertItem( tr ( "Cape Verde" ) ); 427 cmbCountry->insertItem( tr ( "Cape Verde" ) );
428 cmbCountry->insertItem( tr ( "Cayman Islands" ) ); 428 cmbCountry->insertItem( tr ( "Cayman Islands" ) );
429 cmbCountry->insertItem( tr ( "Chad" ) ); 429 cmbCountry->insertItem( tr ( "Chad" ) );
430 cmbCountry->insertItem( tr ( "Chile" ) ); 430 cmbCountry->insertItem( tr ( "Chile" ) );
431 cmbCountry->insertItem( tr ( "China" ) ); 431 cmbCountry->insertItem( tr ( "China" ) );
432 cmbCountry->insertItem( tr ( "Christmas Island" ) ); 432 cmbCountry->insertItem( tr ( "Christmas Island" ) );
433 cmbCountry->insertItem( tr ( "Colombia" ) ); 433 cmbCountry->insertItem( tr ( "Colombia" ) );
434 cmbCountry->insertItem( tr ( "Comoros" ) ); 434 cmbCountry->insertItem( tr ( "Comoros" ) );
435 cmbCountry->insertItem( tr ( "Congo" ) ); 435 cmbCountry->insertItem( tr ( "Congo" ) );
436 cmbCountry->insertItem( tr ( "Cook Island" ) ); 436 cmbCountry->insertItem( tr ( "Cook Island" ) );
437 cmbCountry->insertItem( tr ( "Costa Rica" ) ); 437 cmbCountry->insertItem( tr ( "Costa Rica" ) );
438 cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); 438 cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) );
439 cmbCountry->insertItem( tr ( "Croatia" ) ); 439 cmbCountry->insertItem( tr ( "Croatia" ) );
440 cmbCountry->insertItem( tr ( "Cuba" ) ); 440 cmbCountry->insertItem( tr ( "Cuba" ) );
441 cmbCountry->insertItem( tr ( "Cyprus" ) ); 441 cmbCountry->insertItem( tr ( "Cyprus" ) );
442 cmbCountry->insertItem( tr ( "Czech Republic" ) ); 442 cmbCountry->insertItem( tr ( "Czech Republic" ) );
443 cmbCountry->insertItem( tr ( "Denmark" ) ); 443 cmbCountry->insertItem( tr ( "Denmark" ) );
444 cmbCountry->insertItem( tr ( "Djibouti" ) ); 444 cmbCountry->insertItem( tr ( "Djibouti" ) );
445 cmbCountry->insertItem( tr ( "Dominica" ) ); 445 cmbCountry->insertItem( tr ( "Dominica" ) );
446 cmbCountry->insertItem( tr ( "Dominican Republic" ) ); 446 cmbCountry->insertItem( tr ( "Dominican Republic" ) );
447 cmbCountry->insertItem( tr ( "East Timor" ) ); 447 cmbCountry->insertItem( tr ( "East Timor" ) );
448 cmbCountry->insertItem( tr ( "Ecuador" ) ); 448 cmbCountry->insertItem( tr ( "Ecuador" ) );
449 cmbCountry->insertItem( tr ( "Egypt" ) ); 449 cmbCountry->insertItem( tr ( "Egypt" ) );
450 cmbCountry->insertItem( tr ( "El Salvador" ) ); 450 cmbCountry->insertItem( tr ( "El Salvador" ) );
451 cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); 451 cmbCountry->insertItem( tr ( "Equatorial Guinea" ) );
452 cmbCountry->insertItem( tr ( "Eritrea" ) ); 452 cmbCountry->insertItem( tr ( "Eritrea" ) );
453 cmbCountry->insertItem( tr ( "Estonia" ) ); 453 cmbCountry->insertItem( tr ( "Estonia" ) );
454 cmbCountry->insertItem( tr ( "Ethiopia" ) ); 454 cmbCountry->insertItem( tr ( "Ethiopia" ) );
455 cmbCountry->insertItem( tr ( "Falkland Islands" ) ); 455 cmbCountry->insertItem( tr ( "Falkland Islands" ) );
456 cmbCountry->insertItem( tr ( "Faroe Islands" ) ); 456 cmbCountry->insertItem( tr ( "Faroe Islands" ) );
457 cmbCountry->insertItem( tr ( "Fiji" ) ); 457 cmbCountry->insertItem( tr ( "Fiji" ) );
458 cmbCountry->insertItem( tr ( "Finland" ) ); 458 cmbCountry->insertItem( tr ( "Finland" ) );
459 cmbCountry->insertItem( tr ( "France" ) ); 459 cmbCountry->insertItem( tr ( "France" ) );
460 cmbCountry->insertItem( tr ( "French Guiana" ) ); 460 cmbCountry->insertItem( tr ( "French Guiana" ) );
461 cmbCountry->insertItem( tr ( "French Polynesia" ) ); 461 cmbCountry->insertItem( tr ( "French Polynesia" ) );
462 cmbCountry->insertItem( tr ( "Gabon" ) ); 462 cmbCountry->insertItem( tr ( "Gabon" ) );
463 cmbCountry->insertItem( tr ( "Gambia" ) ); 463 cmbCountry->insertItem( tr ( "Gambia" ) );
464 cmbCountry->insertItem( tr ( "Georgia" ) ); 464 cmbCountry->insertItem( tr ( "Georgia" ) );
465 cmbCountry->insertItem( tr ( "Germany" ) ); 465 cmbCountry->insertItem( tr ( "Germany" ) );
466 cmbCountry->insertItem( tr ( "Gahna" ) ); 466 cmbCountry->insertItem( tr ( "Gahna" ) );
467 cmbCountry->insertItem( tr ( "Gibraltar" ) ); 467 cmbCountry->insertItem( tr ( "Gibraltar" ) );
468 cmbCountry->insertItem( tr ( "Greece" ) ); 468 cmbCountry->insertItem( tr ( "Greece" ) );
469 cmbCountry->insertItem( tr ( "Greenland" ) ); 469 cmbCountry->insertItem( tr ( "Greenland" ) );
470 cmbCountry->insertItem( tr ( "Grenada" ) ); 470 cmbCountry->insertItem( tr ( "Grenada" ) );
471 cmbCountry->insertItem( tr ( "Guadelupe" ) ); 471 cmbCountry->insertItem( tr ( "Guadelupe" ) );
472 cmbCountry->insertItem( tr ( "Guam" ) ); 472 cmbCountry->insertItem( tr ( "Guam" ) );
473 cmbCountry->insertItem( tr ( "Guatemala" ) ); 473 cmbCountry->insertItem( tr ( "Guatemala" ) );
474 cmbCountry->insertItem( tr ( "Guinea" ) ); 474 cmbCountry->insertItem( tr ( "Guinea" ) );
475 cmbCountry->insertItem( tr ( "Guinea-bissau" ) ); 475 cmbCountry->insertItem( tr ( "Guinea-bissau" ) );
476 cmbCountry->insertItem( tr ( "Guyana" ) ); 476 cmbCountry->insertItem( tr ( "Guyana" ) );
477 cmbCountry->insertItem( tr ( "Haiti" ) ); 477 cmbCountry->insertItem( tr ( "Haiti" ) );
478 cmbCountry->insertItem( tr ( "Holy See" ) ); 478 cmbCountry->insertItem( tr ( "Holy See" ) );
479 cmbCountry->insertItem( tr ( "Honduras" ) ); 479 cmbCountry->insertItem( tr ( "Honduras" ) );
480 cmbCountry->insertItem( tr ( "Hong Kong" ) ); 480 cmbCountry->insertItem( tr ( "Hong Kong" ) );
481 cmbCountry->insertItem( tr ( "Hungary" ) ); 481 cmbCountry->insertItem( tr ( "Hungary" ) );
482 cmbCountry->insertItem( tr ( "Iceland" ) ); 482 cmbCountry->insertItem( tr ( "Iceland" ) );
483 cmbCountry->insertItem( tr ( "India" ) ); 483 cmbCountry->insertItem( tr ( "India" ) );
484 cmbCountry->insertItem( tr ( "Indonesia" ) ); 484 cmbCountry->insertItem( tr ( "Indonesia" ) );
485 cmbCountry->insertItem( tr ( "Ireland" ) ); 485 cmbCountry->insertItem( tr ( "Ireland" ) );
486 cmbCountry->insertItem( tr ( "Israel" ) ); 486 cmbCountry->insertItem( tr ( "Israel" ) );
487 cmbCountry->insertItem( tr ( "Italy" ) ); 487 cmbCountry->insertItem( tr ( "Italy" ) );
488 cmbCountry->insertItem( tr ( "Jamacia" ) ); 488 cmbCountry->insertItem( tr ( "Jamacia" ) );
489 cmbCountry->insertItem( tr ( "Japan" ) ); 489 cmbCountry->insertItem( tr ( "Japan" ) );
490 cmbCountry->insertItem( tr ( "Jordan" ) ); 490 cmbCountry->insertItem( tr ( "Jordan" ) );
491 cmbCountry->insertItem( tr ( "Kazakhstan" ) ); 491 cmbCountry->insertItem( tr ( "Kazakhstan" ) );
492 cmbCountry->insertItem( tr ( "Kenya" ) ); 492 cmbCountry->insertItem( tr ( "Kenya" ) );
493 cmbCountry->insertItem( tr ( "Kribati" ) ); 493 cmbCountry->insertItem( tr ( "Kribati" ) );
494 cmbCountry->insertItem( tr ( "Korea" ) ); 494 cmbCountry->insertItem( tr ( "Korea" ) );
495 cmbCountry->insertItem( tr ( "Kuait" ) ); 495 cmbCountry->insertItem( tr ( "Kuait" ) );
496 cmbCountry->insertItem( tr ( "Kyrgyztan" ) ); 496 cmbCountry->insertItem( tr ( "Kyrgyztan" ) );
497 cmbCountry->insertItem( tr ( "Laos" ) ); 497 cmbCountry->insertItem( tr ( "Laos" ) );
498 cmbCountry->insertItem( tr ( "Latvia" ) ); 498 cmbCountry->insertItem( tr ( "Latvia" ) );
499 cmbCountry->insertItem( tr ( "Lebanon" ) ); 499 cmbCountry->insertItem( tr ( "Lebanon" ) );
500 cmbCountry->insertItem( tr ( "Lesotho" ) ); 500 cmbCountry->insertItem( tr ( "Lesotho" ) );
501 cmbCountry->insertItem( tr ( "Liberia" ) ); 501 cmbCountry->insertItem( tr ( "Liberia" ) );
502 cmbCountry->insertItem( tr ( "Liechtenstein" ) ); 502 cmbCountry->insertItem( tr ( "Liechtenstein" ) );
503 cmbCountry->insertItem( tr ( "Lithuania" ) ); 503 cmbCountry->insertItem( tr ( "Lithuania" ) );
504 cmbCountry->insertItem( tr ( "Luxembourg" ) ); 504 cmbCountry->insertItem( tr ( "Luxembourg" ) );
505 cmbCountry->insertItem( tr ( "Macau" ) ); 505 cmbCountry->insertItem( tr ( "Macau" ) );
506 cmbCountry->insertItem( tr ( "Macedonia" ) ); 506 cmbCountry->insertItem( tr ( "Macedonia" ) );
507 cmbCountry->insertItem( tr ( "Madagascar" ) ); 507 cmbCountry->insertItem( tr ( "Madagascar" ) );
508 cmbCountry->insertItem( tr ( "Malawi" ) ); 508 cmbCountry->insertItem( tr ( "Malawi" ) );
509 cmbCountry->insertItem( tr ( "Malaysia" ) ); 509 cmbCountry->insertItem( tr ( "Malaysia" ) );
510 cmbCountry->insertItem( tr ( "Maldives" ) ); 510 cmbCountry->insertItem( tr ( "Maldives" ) );
511 cmbCountry->insertItem( tr ( "Mali" ) ); 511 cmbCountry->insertItem( tr ( "Mali" ) );
512 cmbCountry->insertItem( tr ( "Malta" ) ); 512 cmbCountry->insertItem( tr ( "Malta" ) );
513 cmbCountry->insertItem( tr ( "Martinique" ) ); 513 cmbCountry->insertItem( tr ( "Martinique" ) );
514 cmbCountry->insertItem( tr ( "Mauritania" ) ); 514 cmbCountry->insertItem( tr ( "Mauritania" ) );
515 cmbCountry->insertItem( tr ( "Mauritius" ) ); 515 cmbCountry->insertItem( tr ( "Mauritius" ) );
516 cmbCountry->insertItem( tr ( "Mayotte" ) ); 516 cmbCountry->insertItem( tr ( "Mayotte" ) );
517 cmbCountry->insertItem( tr ( "Mexico" ) ); 517 cmbCountry->insertItem( tr ( "Mexico" ) );
518 cmbCountry->insertItem( tr ( "Micronesia" ) ); 518 cmbCountry->insertItem( tr ( "Micronesia" ) );
519 cmbCountry->insertItem( tr ( "Moldova" ) ); 519 cmbCountry->insertItem( tr ( "Moldova" ) );
520 cmbCountry->insertItem( tr ( "Monaco" ) ); 520 cmbCountry->insertItem( tr ( "Monaco" ) );
521 cmbCountry->insertItem( tr ( "Mongolia" ) ); 521 cmbCountry->insertItem( tr ( "Mongolia" ) );
522 cmbCountry->insertItem( tr ( "Montserrat" ) ); 522 cmbCountry->insertItem( tr ( "Montserrat" ) );
523 cmbCountry->insertItem( tr ( "Morocco" ) ); 523 cmbCountry->insertItem( tr ( "Morocco" ) );
524 cmbCountry->insertItem( tr ( "Mozambique" ) ); 524 cmbCountry->insertItem( tr ( "Mozambique" ) );
525 cmbCountry->insertItem( tr ( "Myanmar" ) ); 525 cmbCountry->insertItem( tr ( "Myanmar" ) );
526 cmbCountry->insertItem( tr ( "Namibia" ) ); 526 cmbCountry->insertItem( tr ( "Namibia" ) );
527 cmbCountry->insertItem( tr ( "Nauru" ) ); 527 cmbCountry->insertItem( tr ( "Nauru" ) );
528 cmbCountry->insertItem( tr ( "Nepal" ) ); 528 cmbCountry->insertItem( tr ( "Nepal" ) );
529 cmbCountry->insertItem( tr ( "Netherlands" ) ); 529 cmbCountry->insertItem( tr ( "Netherlands" ) );
530 cmbCountry->insertItem( tr ( "New Caledonia" ) ); 530 cmbCountry->insertItem( tr ( "New Caledonia" ) );
531 cmbCountry->insertItem( tr ( "New Zealand" ) ); 531 cmbCountry->insertItem( tr ( "New Zealand" ) );
532 cmbCountry->insertItem( tr ( "Nicaragua" ) ); 532 cmbCountry->insertItem( tr ( "Nicaragua" ) );
533 cmbCountry->insertItem( tr ( "Niger" ) ); 533 cmbCountry->insertItem( tr ( "Niger" ) );
534 cmbCountry->insertItem( tr ( "Nigeria" ) ); 534 cmbCountry->insertItem( tr ( "Nigeria" ) );
535 cmbCountry->insertItem( tr ( "Niue" ) ); 535 cmbCountry->insertItem( tr ( "Niue" ) );
536 cmbCountry->insertItem( tr ( "Norway" ) ); 536 cmbCountry->insertItem( tr ( "Norway" ) );
537 cmbCountry->insertItem( tr ( "Oman" ) ); 537 cmbCountry->insertItem( tr ( "Oman" ) );
538 cmbCountry->insertItem( tr ( "Pakistan" ) ); 538 cmbCountry->insertItem( tr ( "Pakistan" ) );
539 cmbCountry->insertItem( tr ( "Palau" ) ); 539 cmbCountry->insertItem( tr ( "Palau" ) );
540 cmbCountry->insertItem( tr ( "Palestinian Territory" ) ); 540 cmbCountry->insertItem( tr ( "Palestinian Territory" ) );
541 cmbCountry->insertItem( tr ( "Panama" ) ); 541 cmbCountry->insertItem( tr ( "Panama" ) );
542 cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); 542 cmbCountry->insertItem( tr ( "Papua New Guinea" ) );
543 cmbCountry->insertItem( tr ( "Paraguay" ) ); 543 cmbCountry->insertItem( tr ( "Paraguay" ) );
544 cmbCountry->insertItem( tr ( "Peru" ) ); 544 cmbCountry->insertItem( tr ( "Peru" ) );
545 cmbCountry->insertItem( tr ( "Philippines" ) ); 545 cmbCountry->insertItem( tr ( "Philippines" ) );
546 cmbCountry->insertItem( tr ( "Pitcairn" ) ); 546 cmbCountry->insertItem( tr ( "Pitcairn" ) );
547 cmbCountry->insertItem( tr ( "Poland" ) ); 547 cmbCountry->insertItem( tr ( "Poland" ) );
548 cmbCountry->insertItem( tr ( "Portugal" ) ); 548 cmbCountry->insertItem( tr ( "Portugal" ) );
549 cmbCountry->insertItem( tr ( "Puerto Rico" ) ); 549 cmbCountry->insertItem( tr ( "Puerto Rico" ) );
550 cmbCountry->insertItem( tr ( "Qatar" ) ); 550 cmbCountry->insertItem( tr ( "Qatar" ) );
551 cmbCountry->insertItem( tr ( "Reunion" ) ); 551 cmbCountry->insertItem( tr ( "Reunion" ) );
552 cmbCountry->insertItem( tr ( "Romania" ) ); 552 cmbCountry->insertItem( tr ( "Romania" ) );
553 cmbCountry->insertItem( tr ( "Russia" ) ); 553 cmbCountry->insertItem( tr ( "Russia" ) );
554 cmbCountry->insertItem( tr ( "Rwanda" ) ); 554 cmbCountry->insertItem( tr ( "Rwanda" ) );
555 cmbCountry->insertItem( tr ( "Saint Lucia" ) ); 555 cmbCountry->insertItem( tr ( "Saint Lucia" ) );
556 cmbCountry->insertItem( tr ( "Samoa" ) ); 556 cmbCountry->insertItem( tr ( "Samoa" ) );
557 cmbCountry->insertItem( tr ( "San Marino" ) ); 557 cmbCountry->insertItem( tr ( "San Marino" ) );
558 cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); 558 cmbCountry->insertItem( tr ( "Saudi Arabia" ) );
559 cmbCountry->insertItem( tr ( "Senegal" ) ); 559 cmbCountry->insertItem( tr ( "Senegal" ) );
560 cmbCountry->insertItem( tr ( "Seychelles" ) ); 560 cmbCountry->insertItem( tr ( "Seychelles" ) );
561 cmbCountry->insertItem( tr ( "Sierra Leone" ) ); 561 cmbCountry->insertItem( tr ( "Sierra Leone" ) );
562 cmbCountry->insertItem( tr ( "Singapore" ) ); 562 cmbCountry->insertItem( tr ( "Singapore" ) );
563 cmbCountry->insertItem( tr ( "Slovakia" ) ); 563 cmbCountry->insertItem( tr ( "Slovakia" ) );
564 cmbCountry->insertItem( tr ( "Slovenia" ) ); 564 cmbCountry->insertItem( tr ( "Slovenia" ) );
565 cmbCountry->insertItem( tr ( "Solomon Islands" ) ); 565 cmbCountry->insertItem( tr ( "Solomon Islands" ) );
566 cmbCountry->insertItem( tr ( "Somalia" ) ); 566 cmbCountry->insertItem( tr ( "Somalia" ) );
567 cmbCountry->insertItem( tr ( "South Africa" ) ); 567 cmbCountry->insertItem( tr ( "South Africa" ) );
568 cmbCountry->insertItem( tr ( "Spain" ) ); 568 cmbCountry->insertItem( tr ( "Spain" ) );
569 cmbCountry->insertItem( tr ( "Sri Lanka" ) ); 569 cmbCountry->insertItem( tr ( "Sri Lanka" ) );
570 cmbCountry->insertItem( tr ( "St. Helena" ) ); 570 cmbCountry->insertItem( tr ( "St. Helena" ) );
571 cmbCountry->insertItem( tr ( "Sudan" ) ); 571 cmbCountry->insertItem( tr ( "Sudan" ) );
572 cmbCountry->insertItem( tr ( "Suriname" ) ); 572 cmbCountry->insertItem( tr ( "Suriname" ) );
573 cmbCountry->insertItem( tr ( "Swaziland" ) ); 573 cmbCountry->insertItem( tr ( "Swaziland" ) );
574 cmbCountry->insertItem( tr ( "Sweden" ) ); 574 cmbCountry->insertItem( tr ( "Sweden" ) );
575 cmbCountry->insertItem( tr ( "Switzerland" ) ); 575 cmbCountry->insertItem( tr ( "Switzerland" ) );
576 cmbCountry->insertItem( tr ( "Taiwan" ) ); 576 cmbCountry->insertItem( tr ( "Taiwan" ) );
577 cmbCountry->insertItem( tr ( "Tajikistan" ) ); 577 cmbCountry->insertItem( tr ( "Tajikistan" ) );
578 cmbCountry->insertItem( tr ( "Tanzania" ) ); 578 cmbCountry->insertItem( tr ( "Tanzania" ) );
579 cmbCountry->insertItem( tr ( "Thailand" ) ); 579 cmbCountry->insertItem( tr ( "Thailand" ) );
580 cmbCountry->insertItem( tr ( "Togo" ) ); 580 cmbCountry->insertItem( tr ( "Togo" ) );
581 cmbCountry->insertItem( tr ( "Tokelau" ) ); 581 cmbCountry->insertItem( tr ( "Tokelau" ) );
582 cmbCountry->insertItem( tr ( "Tonga" ) ); 582 cmbCountry->insertItem( tr ( "Tonga" ) );
583 cmbCountry->insertItem( tr ( "Tunisia" ) ); 583 cmbCountry->insertItem( tr ( "Tunisia" ) );
584 cmbCountry->insertItem( tr ( "Turkey" ) ); 584 cmbCountry->insertItem( tr ( "Turkey" ) );
585 cmbCountry->insertItem( tr ( "Turkmenistan" ) ); 585 cmbCountry->insertItem( tr ( "Turkmenistan" ) );
586 cmbCountry->insertItem( tr ( "Tuvalu" ) ); 586 cmbCountry->insertItem( tr ( "Tuvalu" ) );
587 cmbCountry->insertItem( tr ( "Uganda" ) ); 587 cmbCountry->insertItem( tr ( "Uganda" ) );
588 cmbCountry->insertItem( tr ( "Ukraine" ) ); 588 cmbCountry->insertItem( tr ( "Ukraine" ) );
589 cmbCountry->insertItem( tr ( "Uruguay" ) ); 589 cmbCountry->insertItem( tr ( "Uruguay" ) );
590 cmbCountry->insertItem( tr ( "Uzbekistan" ) ); 590 cmbCountry->insertItem( tr ( "Uzbekistan" ) );
591 cmbCountry->insertItem( tr ( "Vanuatu" ) ); 591 cmbCountry->insertItem( tr ( "Vanuatu" ) );
592 cmbCountry->insertItem( tr ( "Venezuela" ) ); 592 cmbCountry->insertItem( tr ( "Venezuela" ) );
593 cmbCountry->insertItem( tr ( "Viet Nam" ) ); 593 cmbCountry->insertItem( tr ( "Viet Nam" ) );
594 cmbCountry->insertItem( tr ( "Virgin Islands" ) ); 594 cmbCountry->insertItem( tr ( "Virgin Islands" ) );
595 cmbCountry->insertItem( tr ( "Western Sahara" ) ); 595 cmbCountry->insertItem( tr ( "Western Sahara" ) );
596 cmbCountry->insertItem( tr ( "Yemen" ) ); 596 cmbCountry->insertItem( tr ( "Yemen" ) );
597 cmbCountry->insertItem( tr ( "Yugoslavia" ) ); 597 cmbCountry->insertItem( tr ( "Yugoslavia" ) );
598 cmbCountry->insertItem( tr ( "Zambia" ) ); 598 cmbCountry->insertItem( tr ( "Zambia" ) );
599 cmbCountry->insertItem( tr ( "Zimbabwe" ) ); 599 cmbCountry->insertItem( tr ( "Zimbabwe" ) );
600 600
601 cmbCountry->setMaximumWidth( 135 ); 601 cmbCountry->setMaximumWidth( 135 );
602 602
603 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); 603 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 );
604 604
605 cmbChooserField4 = new QComboBox( FALSE, container ); 605 cmbChooserField4 = new QComboBox( FALSE, container );
606 cmbChooserField4->setMaximumWidth( 90 ); 606 cmbChooserField4->setMaximumWidth( 90 );
607 gl->addWidget( cmbChooserField4, 6, 0 ); 607 gl->addWidget( cmbChooserField4, 6, 0 );
608 txtChooserField4 = new QLineEdit( container ); 608 txtChooserField4 = new QLineEdit( container );
609 gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 ); 609 gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 );
610
611 QSpacerItem *space = new QSpacerItem(1,1,
612 QSizePolicy::Maximum,
613 QSizePolicy::MinimumExpanding );
614 gl->addItem( space, 7, 0 );
615
610 tabMain->insertTab( tabViewport, tr( "Address" ) ); 616 tabMain->insertTab( tabViewport, tr( "Address" ) );
611 617
612 tabViewport = new QWidget ( tabMain ); 618 tabViewport = new QWidget ( tabMain );
613 619
614 vb = new QVBoxLayout( tabViewport ); 620 vb = new QVBoxLayout( tabViewport );
615 621
616 svDetails = new QScrollView( tabViewport ); 622 svDetails = new QScrollView( tabViewport );
617 vb->addWidget( svDetails, 0, 0 ); 623 vb->addWidget( svDetails, 0, 0 );
618 svDetails->setResizePolicy( QScrollView::AutoOneFit ); 624 svDetails->setResizePolicy( QScrollView::AutoOneFit );
619 svDetails->setFrameStyle( QFrame::NoFrame ); 625 svDetails->setFrameStyle( QFrame::NoFrame );
620 626
621 container = new QWidget( svDetails->viewport() ); 627 container = new QWidget( svDetails->viewport() );
622 svDetails->addChild( container ); 628 svDetails->addChild( container );
623 629
624 gl = new QGridLayout( container, 1, 2, 2, 4 ); 630 gl = new QGridLayout( container, 1, 2, 2, 4 );
625 631
626 QStringList::ConstIterator it = slDynamicEntries->begin(); 632 QStringList::ConstIterator it = slDynamicEntries.begin();
627 for (i = 0; it != slDynamicEntries->end(); i++, ++it) { 633 for (i = 0; it != slDynamicEntries.end(); i++, ++it) {
628 l = new QLabel( *it, container ); 634 l = new QLabel( *it, container );
629 listName.append( l ); 635 listName.append( l );
630 gl->addWidget( l, i, 0 ); 636 gl->addWidget( l, i, 0 );
631 QLineEdit *e = new QLineEdit( container ); 637 QLineEdit *e = new QLineEdit( container );
632 listValue.append( e ); 638 listValue.append( e );
633 gl->addWidget( e, i, 1); 639 gl->addWidget( e, i, 1);
634 } 640 }
635 641
636 l = new QLabel( tr("Gender"), container ); 642 l = new QLabel( tr("Gender"), container );
637 gl->addWidget( l, slDynamicEntries->count(), 0 ); 643 gl->addWidget( l, slDynamicEntries.count(), 0 );
638 cmbGender = new QComboBox( container ); 644 cmbGender = new QComboBox( container );
639 cmbGender->insertItem( "", 0 ); 645 cmbGender->insertItem( "", 0 );
640 cmbGender->insertItem( tr("Male"), 1); 646 cmbGender->insertItem( tr("Male"), 1);
641 cmbGender->insertItem( tr("Female"), 2); 647 cmbGender->insertItem( tr("Female"), 2);
642 gl->addWidget( cmbGender, slDynamicEntries->count(), 1 ); 648 gl->addWidget( cmbGender, slDynamicEntries.count(), 1 );
643 649
644 tabMain->insertTab( tabViewport, tr( "Details" ) ); 650 tabMain->insertTab( tabViewport, tr( "Details" ) );
645 651
646 dlgNote = new QDialog( this, "Note Dialog", TRUE ); 652 dlgNote = new QDialog( this, "Note Dialog", TRUE );
647 dlgNote->setCaption( tr("Enter Note") ); 653 dlgNote->setCaption( tr("Enter Note") );
648 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); 654 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote );
649 txtNote = new QMultiLineEdit( dlgNote ); 655 txtNote = new QMultiLineEdit( dlgNote );
650 vbNote->addWidget( txtNote ); 656 vbNote->addWidget( txtNote );
651 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); 657 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) );
652 658
653 dlgName = new QDialog( this, "Name Dialog", TRUE ); 659 dlgName = new QDialog( this, "Name Dialog", TRUE );
654 dlgName->setCaption( tr("Edit Name") ); 660 dlgName->setCaption( tr("Edit Name") );
655 gl = new QGridLayout( dlgName, 4, 2, 2, 3 ); 661 gl = new QGridLayout( dlgName, 5, 2, 2, 3 );
656 662
657 l = new QLabel( tr("First Name"), dlgName ); 663 l = new QLabel( tr("First Name"), dlgName );
658 gl->addWidget( l, 0, 0 ); 664 gl->addWidget( l, 0, 0 );
659 txtFirstName = new QLineEdit( dlgName ); 665 txtFirstName = new QLineEdit( dlgName );
660 gl->addWidget( txtFirstName, 0, 1 ); 666 gl->addWidget( txtFirstName, 0, 1 );
661 667
662 l = new QLabel( tr("Middle Name"), dlgName ); 668 l = new QLabel( tr("Middle Name"), dlgName );
663 gl->addWidget( l, 1, 0 ); 669 gl->addWidget( l, 1, 0 );
664 txtMiddleName = new QLineEdit( dlgName ); 670 txtMiddleName = new QLineEdit( dlgName );
665 gl->addWidget( txtMiddleName, 1, 1 ); 671 gl->addWidget( txtMiddleName, 1, 1 );
666 672
667 l = new QLabel( tr("Last Name"), dlgName ); 673 l = new QLabel( tr("Last Name"), dlgName );
668 gl->addWidget( l, 2, 0 ); 674 gl->addWidget( l, 2, 0 );
669 txtLastName = new QLineEdit( dlgName ); 675 txtLastName = new QLineEdit( dlgName );
670 gl->addWidget( txtLastName, 2, 1 ); 676 gl->addWidget( txtLastName, 2, 1 );
671 677
672 l = new QLabel( tr("Suffix"), dlgName ); 678 l = new QLabel( tr("Suffix"), dlgName );
673 gl->addWidget( l, 3, 0 ); 679 gl->addWidget( l, 3, 0 );
674 txtSuffix = new QLineEdit( dlgName ); 680 txtSuffix = new QLineEdit( dlgName );
675 gl->addWidget( txtSuffix, 3, 1 ); 681 gl->addWidget( txtSuffix, 3, 1 );
682 space = new QSpacerItem(1,1,
683 QSizePolicy::Maximum,
684 QSizePolicy::MinimumExpanding );
685 gl->addItem( space, 4, 0 );
676 686
677 cmbChooserField1->insertStringList( *slChooserNames ); 687 cmbChooserField1->insertStringList( slChooserNames );
678 cmbChooserField2->insertStringList( *slChooserNames ); 688 cmbChooserField2->insertStringList( slChooserNames );
679 cmbChooserField3->insertStringList( *slChooserNames ); 689 cmbChooserField3->insertStringList( slChooserNames );
680 cmbChooserField4->insertStringList( *slChooserNames ); 690 cmbChooserField4->insertStringList( slChooserNames );
681 691
682 cmbChooserField1->setCurrentItem( 0 ); 692 cmbChooserField1->setCurrentItem( 0 );
683 cmbChooserField2->setCurrentItem( 1 ); 693 cmbChooserField2->setCurrentItem( 1 );
684 cmbChooserField3->setCurrentItem( 2 ); 694 cmbChooserField3->setCurrentItem( 2 );
685 695
686 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 696 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
687 697
688 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); 698 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) );
689 699
690 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser1Change(const QString &)) ); 700 connect( txtChooserField1, SIGNAL(textChanged(const QString &)),
691 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser2Change(const QString &)) ); 701 this, SLOT(slotChooser1Change(const QString &)) );
692 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser3Change(const QString &)) ); 702 connect( txtChooserField2, SIGNAL(textChanged(const QString &)),
693 connect( txtChooserField4, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser4Change(const QString &)) ); 703 this, SLOT(slotChooser2Change(const QString &)) );
694 connect( txtAddress, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddressChange(const QString &)) ); 704 connect( txtChooserField3, SIGNAL(textChanged(const QString &)),
695 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); 705 this, SLOT(slotChooser3Change(const QString &)) );
696 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); 706 connect( txtChooserField4, SIGNAL(textChanged(const QString &)),
697 connect( txtCity, SIGNAL(textChanged(const QString &)), this, SLOT(slotCityChange(const QString &)) ); 707 this, SLOT(slotChooser4Change(const QString &)) );
698 connect( txtState, SIGNAL(textChanged(const QString &)), this, SLOT(slotStateChange(const QString &)) ); 708 connect( txtAddress, SIGNAL(textChanged(const QString &)),
699 connect( txtZip, SIGNAL(textChanged(const QString &)), this, SLOT(slotZipChange(const QString &)) ); 709 this, SLOT(slotAddressChange(const QString &)) );
700 connect( cmbCountry, SIGNAL(textChanged(const QString &)), this, SLOT(slotCountryChange(const QString &)) ); 710 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) );
701 connect( cmbCountry, SIGNAL(activated(const QString &)), this, SLOT(slotCountryChange(const QString &)) ); 711 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) );
702 connect( cmbChooserField1, SIGNAL(activated(int)), this, SLOT(slotCmbChooser1Change(int)) ); 712 connect( txtCity, SIGNAL(textChanged(const QString &)),
703 connect( cmbChooserField2, SIGNAL(activated(int)), this, SLOT(slotCmbChooser2Change(int)) ); 713 this, SLOT(slotCityChange(const QString &)) );
704 connect( cmbChooserField3, SIGNAL(activated(int)), this, SLOT(slotCmbChooser3Change(int)) ); 714 connect( txtState, SIGNAL(textChanged(const QString &)),
705 connect( cmbChooserField4, SIGNAL(activated(int)), this, SLOT(slotCmbChooser4Change(int)) ); 715 this, SLOT(slotStateChange(const QString &)) );
706 connect( cmbAddress, SIGNAL(activated(int)), this, SLOT(slotAddressTypeChange(int)) ); 716 connect( txtZip, SIGNAL(textChanged(const QString &)),
717 this, SLOT(slotZipChange(const QString &)) );
718 connect( cmbCountry, SIGNAL(textChanged(const QString &)),
719 this, SLOT(slotCountryChange(const QString &)) );
720 connect( cmbCountry, SIGNAL(activated(const QString &)),
721 this, SLOT(slotCountryChange(const QString &)) );
722 connect( cmbChooserField1, SIGNAL(activated(int)),
723 this, SLOT(slotCmbChooser1Change(int)) );
724 connect( cmbChooserField2, SIGNAL(activated(int)),
725 this, SLOT(slotCmbChooser2Change(int)) );
726 connect( cmbChooserField3, SIGNAL(activated(int)),
727 this, SLOT(slotCmbChooser3Change(int)) );
728 connect( cmbChooserField4, SIGNAL(activated(int)),
729 this, SLOT(slotCmbChooser4Change(int)) );
730 connect( cmbAddress, SIGNAL(activated(int)),
731 this, SLOT(slotAddressTypeChange(int)) );
732
707 new QPEDialogListener(this); 733 new QPEDialogListener(this);
708} 734}
709 735
710void ContactEditor::initMap() 736void ContactEditor::initMap()
711{ 737{
712 /* 738 /*
713 // since the fields and the XML fields exist, create a map 739 // since the fields and the XML fields exist, create a map
714 // between them... 740 // between them...
715 Config cfg1( "AddressBook" ); 741 Config cfg1( "AddressBook" );
716 Config cfg2( "AddressBook" ); 742 Config cfg2( "AddressBook" );
717 QString strCfg1, 743 QString strCfg1,
718 strCfg2; 744 strCfg2;
719 int i; 745 int i;
720 746
721 // This stuff better exist... 747 // This stuff better exist...
722 cfg1.setGroup( "AddressFields" ); 748 cfg1.setGroup( "AddressFields" );
723o cfg2.setGroup( "XMLFields" ); 749o cfg2.setGroup( "XMLFields" );
724 i = 0; 750 i = 0;
725 strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null ); 751 strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null );
726 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), 752 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++),
727 QString::null ); 753 QString::null );
728 while ( !strCfg1.isNull() && !strCfg2.isNull() ) { 754 while ( !strCfg1.isNull() && !strCfg2.isNull() ) {
729 mapField.insert( strCfg1, strCfg2 ); 755 mapField.insert( strCfg1, strCfg2 );
730 strCfg1 = cfg1.readEntry( "Field" + QString::number(i), 756 strCfg1 = cfg1.readEntry( "Field" + QString::number(i),
731 QString::null ); 757 QString::null );
732 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), 758 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++),
733 QString::null ); 759 QString::null );
734 } 760 }
735 */ 761 */
736} 762}
737 763
738void ContactEditor::slotChooser1Change( const QString &textChanged ) { 764void ContactEditor::slotChooser1Change( const QString &textChanged ) {
739 765
740 int index = cmbChooserField1->currentItem(); 766 int index = cmbChooserField1->currentItem();
741 767
742 (*slChooserValues)[index] = textChanged; 768 slChooserValues[index] = textChanged;
743 769
744} 770}
745 771
746void ContactEditor::slotChooser2Change( const QString &textChanged ) { 772void ContactEditor::slotChooser2Change( const QString &textChanged ) {
747 773
748 int index = cmbChooserField2->currentItem(); 774 int index = cmbChooserField2->currentItem();
749 775
750 (*slChooserValues)[index] = textChanged; 776 slChooserValues[index] = textChanged;
751 777
752} 778}
753 779
754void ContactEditor::slotChooser3Change( const QString &textChanged ) { 780void ContactEditor::slotChooser3Change( const QString &textChanged ) {
755 781
756 int index = cmbChooserField3->currentItem(); 782 int index = cmbChooserField3->currentItem();
757 783
758 (*slChooserValues)[index] = textChanged; 784 slChooserValues[index] = textChanged;
759 785
760} 786}
761 787
762void ContactEditor::slotChooser4Change( const QString &textChanged ) { 788void ContactEditor::slotChooser4Change( const QString &textChanged ) {
763 789
764 int index = cmbChooserField4->currentItem(); 790 int index = cmbChooserField4->currentItem();
765 791
766 (*slChooserValues)[index] = textChanged; 792 slChooserValues[index] = textChanged;
767 793
768} 794}
769 795
770void ContactEditor::slotAddressChange( const QString &textChanged ) { 796void ContactEditor::slotAddressChange( const QString &textChanged ) {
771 797
772 if ( cmbAddress->currentItem() == 0 ) { 798 if ( cmbAddress->currentItem() == 0 ) {
773 (*slBusinessAddress)[0] = textChanged; 799 slBusinessAddress[0] = textChanged;
774 } else { 800 } else {
775 (*slHomeAddress)[0] = textChanged; 801 slHomeAddress[0] = textChanged;
776 } 802 }
777} 803}
778 804
779void ContactEditor::slotAddress2Change( const QString &textChanged ) { 805void ContactEditor::slotAddress2Change( const QString &textChanged ) {
780 806
781 if ( cmbAddress->currentItem() == 0 ) { 807 if ( cmbAddress->currentItem() == 0 ) {
782 (*slBusinessAddress)[1] = textChanged; 808 slBusinessAddress[1] = textChanged;
783 } else { 809 } else {
784 (*slHomeAddress)[1] = textChanged; 810 slHomeAddress[1] = textChanged;
785 } 811 }
786} 812}
787 813
788void ContactEditor::slotPOBoxChange( const QString &textChanged ) { 814void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
789 815
790 if ( cmbAddress->currentItem() == 0 ) { 816 if ( cmbAddress->currentItem() == 0 ) {
791 (*slBusinessAddress)[2] = textChanged; 817 slBusinessAddress[2] = textChanged;
792 } else { 818 } else {
793 (*slHomeAddress)[2] = textChanged; 819 slHomeAddress[2] = textChanged;
794 } 820 }
795} 821}
796 822
797void ContactEditor::slotCityChange( const QString &textChanged ) { 823void ContactEditor::slotCityChange( const QString &textChanged ) {
798 824
799 if ( cmbAddress->currentItem() == 0 ) { 825 if ( cmbAddress->currentItem() == 0 ) {
800 (*slBusinessAddress)[3] = textChanged; 826 slBusinessAddress[3] = textChanged;
801 } else { 827 } else {
802 (*slHomeAddress)[3] = textChanged; 828 slHomeAddress[3] = textChanged;
803 } 829 }
804} 830}
805 831
806void ContactEditor::slotStateChange( const QString &textChanged ) { 832void ContactEditor::slotStateChange( const QString &textChanged ) {
807 833
808 834
809 if ( cmbAddress->currentItem() == 0 ) { 835 if ( cmbAddress->currentItem() == 0 ) {
810 (*slBusinessAddress)[4] = textChanged; 836 slBusinessAddress[4] = textChanged;
811 } else { 837 } else {
812 (*slHomeAddress)[4] = textChanged; 838 slHomeAddress[4] = textChanged;
813 } 839 }
814} 840}
815 841
816void ContactEditor::slotZipChange( const QString &textChanged ) { 842void ContactEditor::slotZipChange( const QString &textChanged ) {
817 843
818 if ( cmbAddress->currentItem() == 0 ) { 844 if ( cmbAddress->currentItem() == 0 ) {
819 (*slBusinessAddress)[5] = textChanged; 845 slBusinessAddress[5] = textChanged;
820 } else { 846 } else {
821 (*slHomeAddress)[5] = textChanged; 847 slHomeAddress[5] = textChanged;
822 } 848 }
823} 849}
824 850
825void ContactEditor::slotCountryChange( const QString &textChanged ) { 851void ContactEditor::slotCountryChange( const QString &textChanged ) {
826 852
827 if ( cmbAddress->currentItem() == 0 ) { 853 if ( cmbAddress->currentItem() == 0 ) {
828 (*slBusinessAddress)[6] = textChanged; 854 slBusinessAddress[6] = textChanged;
829 } else { 855 } else {
830 (*slHomeAddress)[6] = textChanged; 856 slHomeAddress[6] = textChanged;
831 } 857 }
832} 858}
833 859
834void ContactEditor::slotCmbChooser1Change( int index ) { 860void ContactEditor::slotCmbChooser1Change( int index ) {
835 861
836 txtChooserField1->setText( (*slChooserValues)[index] ); 862 txtChooserField1->setText( slChooserValues[index] );
837 863 txtChooserField1->setFocus();
838} 864}
839 865
840void ContactEditor::slotCmbChooser2Change( int index ) { 866void ContactEditor::slotCmbChooser2Change( int index ) {
841 867
842 txtChooserField2->setText( (*slChooserValues)[index] ); 868 txtChooserField2->setText( slChooserValues[index] );
843 869 txtChooserField2->setFocus();
844} 870}
845 871
846void ContactEditor::slotCmbChooser3Change( int index ) { 872void ContactEditor::slotCmbChooser3Change( int index ) {
847 873
848 txtChooserField3->setText( (*slChooserValues)[index] ); 874 txtChooserField3->setText( slChooserValues[index] );
875 txtChooserField3->setFocus();
849 876
850} 877}
851 878
852void ContactEditor::slotCmbChooser4Change( int index ) { 879void ContactEditor::slotCmbChooser4Change( int index ) {
853 880
854 txtChooserField4->setText( (*slChooserValues)[index] ); 881 txtChooserField4->setText( slChooserValues[index] );
882 txtChooserField4->setFocus();
855 883
856} 884}
857 885
858void ContactEditor::slotAddressTypeChange( int index ) { 886void ContactEditor::slotAddressTypeChange( int index ) {
859 887
860 if ( index == 0 ) { 888 if ( index == 0 ) {
861 889
862 txtAddress->setText( (*slBusinessAddress)[0] ); 890 txtAddress->setText( slBusinessAddress[0] );
863 //txtAddress2->setText( (*slBusinessAddress)[1] ); 891 //txtAddress2->setText( (*slBusinessAddress)[1] );
864 //txtPOBox->setText( (*slBusinessAddress)[2] ); 892 //txtPOBox->setText( (*slBusinessAddress)[2] );
865 txtCity->setText( (*slBusinessAddress)[3] ); 893 txtCity->setText( slBusinessAddress[3] );
866 txtState->setText( (*slBusinessAddress)[4] ); 894 txtState->setText( slBusinessAddress[4] );
867 txtZip->setText( (*slBusinessAddress)[5] ); 895 txtZip->setText( slBusinessAddress[5] );
868 QLineEdit *txtTmp = cmbCountry->lineEdit(); 896 QLineEdit *txtTmp = cmbCountry->lineEdit();
869 txtTmp->setText( (*slBusinessAddress)[6] ); 897 txtTmp->setText( slBusinessAddress[6] );
870 898
871 } else { 899 } else {
872 900
873 txtAddress->setText( (*slHomeAddress)[0] ); 901 txtAddress->setText( slHomeAddress[0] );
874 //txtAddress2->setText( (*slHomeAddress)[1] ); 902 //txtAddress2->setText( (*slHomeAddress)[1] );
875 //txtPOBox->setText( (*slHomeAddress)[2] ); 903 //txtPOBox->setText( (*slHomeAddress)[2] );
876 txtCity->setText( (*slHomeAddress)[3] ); 904 txtCity->setText( slHomeAddress[3] );
877 txtState->setText( (*slHomeAddress)[4] ); 905 txtState->setText( slHomeAddress[4] );
878 txtZip->setText( (*slHomeAddress)[5] ); 906 txtZip->setText( slHomeAddress[5] );
879 QLineEdit *txtTmp = cmbCountry->lineEdit(); 907 QLineEdit *txtTmp = cmbCountry->lineEdit();
880 txtTmp->setText( (*slHomeAddress)[6] ); 908 txtTmp->setText( slHomeAddress[6] );
881 909
882 } 910 }
883 911
884} 912}
885 913
886void ContactEditor::slotFullNameChange( const QString &textChanged ) { 914void ContactEditor::slotFullNameChange( const QString &textChanged ) {
887 915
888 int index = cmbFileAs->currentItem(); 916 int index = cmbFileAs->currentItem();
889 917
890 cmbFileAs->clear(); 918 cmbFileAs->clear();
891 919
892 cmbFileAs->insertItem( parseName( textChanged, 0 ) ); 920 cmbFileAs->insertItem( parseName( textChanged, 0 ) );
893 cmbFileAs->insertItem( parseName( textChanged, 1 ) ); 921 cmbFileAs->insertItem( parseName( textChanged, 1 ) );
894 cmbFileAs->insertItem( parseName( textChanged, 2 ) ); 922 cmbFileAs->insertItem( parseName( textChanged, 2 ) );
895 cmbFileAs->insertItem( parseName( textChanged, 3 ) ); 923 cmbFileAs->insertItem( parseName( textChanged, 3 ) );
896 924
897 cmbFileAs->setCurrentItem( index ); 925 cmbFileAs->setCurrentItem( index );
898 926
899 useFullName = TRUE; 927 useFullName = TRUE;
900 928
901 } 929}
902 930
903void ContactEditor::loadFields() { 931void ContactEditor::loadFields() {
904 932
905 QStringList::ConstIterator it; 933 QStringList::ConstIterator it;
906 QListIterator<QLabel> lit( listName ); 934 QListIterator<QLabel> lit( listName );
907 for ( it = slDynamicEntries->begin(); *lit; ++lit, ++it) { 935 for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) {
908 (*lit)->setText( *it ); 936 (*lit)->setText( *it );
909 } 937 }
910} 938}
911 939
912void ContactEditor::accept() { 940void ContactEditor::accept() {
913 941
914 if ( isEmpty() ) { 942 if ( isEmpty() ) {
915 cleanupFields(); 943 cleanupFields();
916 reject(); 944 reject();
917 } else { 945 } else {
918 saveEntry(); 946 saveEntry();
919 cleanupFields(); 947 cleanupFields();
920 QDialog::accept(); 948 QDialog::accept();
921 } 949 }
922 950
923} 951}
924 952
925void ContactEditor::slotNote() { 953void ContactEditor::slotNote() {
926 954
927 dlgNote->showMaximized(); 955 dlgNote->showMaximized();
928 if ( !dlgNote->exec() ) { 956 if ( !dlgNote->exec() ) {
929 txtNote->setText( ent.notes() ); 957 txtNote->setText( ent.notes() );
930 } 958 }
931} 959}
932 960
933void ContactEditor::slotName() { 961void ContactEditor::slotName() {
934 962
935 if (useFullName = TRUE) { 963 if (useFullName = TRUE) {
936 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); 964 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) );
937 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); 965 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) );
938 txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); 966 txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
939 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); 967 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
940 } 968 }
941 969
942 dlgName->showMaximized(); 970 dlgName->showMaximized();
943 if ( dlgName->exec() ) { 971 if ( dlgName->exec() ) {
944 txtFullName->setText( txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text() ); 972 txtFullName->setText( txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text() );
945 slotFullNameChange( txtFullName->text() ); 973 slotFullNameChange( txtFullName->text() );
946 useFullName = FALSE; 974 useFullName = FALSE;
947 } 975 }
948 976
949} 977}
950 978
951void ContactEditor::setNameFocus() { 979void ContactEditor::setNameFocus() {
952 980
953 txtFullName->setFocus(); 981 txtFullName->setFocus();
954 982
955} 983}
956 984
957bool ContactEditor::isEmpty() { 985bool ContactEditor::isEmpty() {
958 // Test and see if the record should be saved. 986 // Test and see if the record should be saved.
959 // More strict than the original qtopia, needs name or fileas to save 987 // More strict than the original qtopia, needs name or fileas to save
960 988
961 QString t = txtFullName->text(); 989 QString t = txtFullName->text();
962 if ( !t.isEmpty() && containsAlphaNum( t ) ) 990 if ( !t.isEmpty() && containsAlphaNum( t ) )
963 return false; 991 return false;
964 992
965 t = cmbFileAs->currentText(); 993 t = cmbFileAs->currentText();
966 if ( !t.isEmpty() && containsAlphaNum( t ) ) 994 if ( !t.isEmpty() && containsAlphaNum( t ) )
967 return false; 995 return false;
968 996
969 return true; 997 return true;
970 998
971} 999}
972 1000
973QString ContactEditor::parseName( const QString fullName, int type ) { 1001QString ContactEditor::parseName( const QString fullName, int type ) {
974 1002
975 QString simplifiedName( fullName.simplifyWhiteSpace() ); 1003 QString simplifiedName( fullName.simplifyWhiteSpace() );
976 QString strFirstName; 1004 QString strFirstName;
977 QString strMiddleName; 1005 QString strMiddleName;
978 QString strLastName; 1006 QString strLastName;
979 QString strSuffix; 1007 QString strSuffix;
980 QString strTitle; 1008 QString strTitle;
981 int commapos; 1009 int commapos;
982 int spCount; 1010 int spCount;
983 int spPos; 1011 int spPos;
984 int spPos2; 1012 int spPos2;
985 1013
986 1014
987 commapos = simplifiedName.find( ',', 0, TRUE); 1015 commapos = simplifiedName.find( ',', 0, TRUE);
988 spCount = simplifiedName.contains( ' ', TRUE ); 1016 spCount = simplifiedName.contains( ' ', TRUE );
989 1017
990 if ( commapos == -1 ) { 1018 if ( commapos == -1 ) {
991 1019
992 switch (spCount) { 1020 switch (spCount) {
993 case 0: 1021 case 0:
994 return simplifiedName; 1022 return simplifiedName;
995 1023
996 case 1: 1024 case 1:
997 spPos = simplifiedName.find( ' ', 0, TRUE ); 1025 spPos = simplifiedName.find( ' ', 0, TRUE );
998 strFirstName = simplifiedName.left( spPos ); 1026 strFirstName = simplifiedName.left( spPos );
999 strLastName = simplifiedName.mid( spPos + 1 ); 1027 strLastName = simplifiedName.mid( spPos + 1 );
1000 break; 1028 break;
1001 1029
1002 case 2: 1030 case 2:
1003 spPos = simplifiedName.find( ' ', 0, TRUE ); 1031 spPos = simplifiedName.find( ' ', 0, TRUE );
1004 strFirstName = simplifiedName.left( spPos ); 1032 strFirstName = simplifiedName.left( spPos );
1005 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1033 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1006 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1034 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1007 strLastName = simplifiedName.mid( spPos2 + 1 ); 1035 strLastName = simplifiedName.mid( spPos2 + 1 );
1008 break; 1036 break;
1009 1037
1010 case 3: 1038 case 3:
1011 spPos = simplifiedName.find( ' ', 0, TRUE ); 1039 spPos = simplifiedName.find( ' ', 0, TRUE );
1012 strFirstName = simplifiedName.left( spPos ); 1040 strFirstName = simplifiedName.left( spPos );
1013 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1041 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1014 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1042 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1015 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1043 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1016 strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1044 strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1017 strSuffix = simplifiedName.mid( spPos + 1 ); 1045 strSuffix = simplifiedName.mid( spPos + 1 );
1018 break; 1046 break;
1019 1047
1020 case 4: 1048 case 4:
1021 spPos = simplifiedName.find( ' ', 0, TRUE ); 1049 spPos = simplifiedName.find( ' ', 0, TRUE );
1022 strTitle = simplifiedName.left( spPos ); 1050 strTitle = simplifiedName.left( spPos );
1023 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1051 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1024 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1052 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1025 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1053 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1026 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1054 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1027 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1055 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1028 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1056 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1029 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1057 strSuffix = simplifiedName.mid( spPos2 + 1 );
1030 break; 1058 break;
1031 1059
1032 default: 1060 default:
1033 spPos = simplifiedName.find( ' ', 0, TRUE ); 1061 spPos = simplifiedName.find( ' ', 0, TRUE );
1034 strTitle = simplifiedName.left( spPos ); 1062 strTitle = simplifiedName.left( spPos );
1035 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1063 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1036 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1064 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1037 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1065 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1038 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1066 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1039 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1067 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1040 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1068 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1041 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1069 strSuffix = simplifiedName.mid( spPos2 + 1 );
1042 break; 1070 break;
1043 } 1071 }
1044 } else { 1072 } else {
1045 simplifiedName.replace( commapos, 1, " " ); 1073 simplifiedName.replace( commapos, 1, " " );
1046 simplifiedName = simplifiedName.simplifyWhiteSpace(); 1074 simplifiedName = simplifiedName.simplifyWhiteSpace();
1047 1075
1048 switch (spCount) { 1076 switch (spCount) {
1049 case 0: 1077 case 0:
1050 return simplifiedName; 1078 return simplifiedName;
1051 1079
1052 case 1: 1080 case 1:
1053 spPos = simplifiedName.find( ' ', 0, TRUE ); 1081 spPos = simplifiedName.find( ' ', 0, TRUE );
1054 strLastName = simplifiedName.left( spPos ); 1082 strLastName = simplifiedName.left( spPos );
1055 strFirstName = simplifiedName.mid( spPos + 1 ); 1083 strFirstName = simplifiedName.mid( spPos + 1 );
1056 break; 1084 break;
1057 1085
1058 case 2: 1086 case 2:
1059 spPos = simplifiedName.find( ' ', 0, TRUE ); 1087 spPos = simplifiedName.find( ' ', 0, TRUE );
1060 strLastName = simplifiedName.left( spPos ); 1088 strLastName = simplifiedName.left( spPos );
1061 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1089 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1062 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1090 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1063 strMiddleName = simplifiedName.mid( spPos2 + 1 ); 1091 strMiddleName = simplifiedName.mid( spPos2 + 1 );
1064 break; 1092 break;
1065 1093
1066 case 3: 1094 case 3:
1067 spPos = simplifiedName.find( ' ', 0, TRUE ); 1095 spPos = simplifiedName.find( ' ', 0, TRUE );
1068 strLastName = simplifiedName.left( spPos ); 1096 strLastName = simplifiedName.left( spPos );
1069 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1097 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1070 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1098 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1071 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1099 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1072 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1100 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1073 strSuffix = simplifiedName.mid( spPos + 1 ); 1101 strSuffix = simplifiedName.mid( spPos + 1 );
1074 break; 1102 break;
1075 1103
1076 case 4: 1104 case 4:
1077 spPos = simplifiedName.find( ' ', 0, TRUE ); 1105 spPos = simplifiedName.find( ' ', 0, TRUE );
1078 strLastName = simplifiedName.left( spPos ); 1106 strLastName = simplifiedName.left( spPos );
1079 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1107 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1080 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1108 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1081 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1109 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1082 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1110 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1083 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1111 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1084 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1112 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1085 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1113 strSuffix = simplifiedName.mid( spPos2 + 1 );
1086 break; 1114 break;
1087 1115
1088 default: 1116 default:
1089 spPos = simplifiedName.find( ' ', 0, TRUE ); 1117 spPos = simplifiedName.find( ' ', 0, TRUE );
1090 strLastName = simplifiedName.left( spPos ); 1118 strLastName = simplifiedName.left( spPos );
1091 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1119 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1092 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1120 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1093 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1121 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1094 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); 1122 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos );
1095 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1123 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1096 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1124 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1097 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1125 strSuffix = simplifiedName.mid( spPos2 + 1 );
1098 break; 1126 break;
1099 } 1127 }
1100 } 1128 }
1101 1129
1102 switch (type) { 1130 switch (type) {
1103 case NAME_FL: 1131 case NAME_FL:
1104 return strFirstName + " " + strLastName; 1132 return strFirstName + " " + strLastName;
1105 1133
1106 case NAME_LF: 1134 case NAME_LF:
1107 return strLastName + ", " + strFirstName; 1135 return strLastName + ", " + strFirstName;
1108 1136
1109 case NAME_LFM: 1137 case NAME_LFM:
1110 return strLastName + ", " + strFirstName + " " + strMiddleName; 1138 return strLastName + ", " + strFirstName + " " + strMiddleName;
1111 1139
1112 case NAME_FMLS: 1140 case NAME_FMLS:
1113 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; 1141 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix;
1114 1142
1115 case NAME_F: 1143 case NAME_F:
1116 return strFirstName; 1144 return strFirstName;
1117 1145
1118 case NAME_M: 1146 case NAME_M:
1119 return strMiddleName; 1147 return strMiddleName;
1120 1148
1121 case NAME_L: 1149 case NAME_L:
1122 return strLastName; 1150 return strLastName;
1123 1151
1124 case NAME_S: 1152 case NAME_S:
1125 return strSuffix; 1153 return strSuffix;
1126 1154
1127 } 1155 }
1128 return QString::null; 1156 return QString::null;
1129} 1157}
1130 1158
1131void ContactEditor::cleanupFields() { 1159void ContactEditor::cleanupFields() {
1132 1160
1133 QStringList::Iterator it = slChooserValues->begin(); 1161 QStringList::Iterator it = slChooserValues.begin();
1134 for ( int i = 0; it != slChooserValues->end(); i++, ++it ) { 1162 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) {
1135 (*it) = ""; 1163 (*it) = "";
1136 } 1164 }
1137 1165
1138 for ( int i = 0; i < 7; i++ ) { 1166 for ( int i = 0; i < 7; i++ ) {
1139 (*slHomeAddress)[i] = ""; 1167 slHomeAddress[i] = "";
1140 (*slBusinessAddress)[i] = ""; 1168 slBusinessAddress[i] = "";
1141 } 1169 }
1142 1170
1143 QStringList::ConstIterator cit; 1171 QStringList::ConstIterator cit;
1144 QListIterator<QLineEdit> itLE( listValue ); 1172 QListIterator<QLineEdit> itLE( listValue );
1145 for ( cit = slDynamicEntries->begin(); cit != slDynamicEntries->end(); ++cit, ++itLE) { 1173 for ( cit = slDynamicEntries.begin(); cit != slDynamicEntries.end(); ++cit, ++itLE) {
1146 (*itLE)->setText( "" ); 1174 (*itLE)->setText( "" );
1147 } 1175 }
1148 1176
1149 txtFirstName->setText(""); 1177 txtFirstName->setText("");
1150 txtMiddleName->setText(""); 1178 txtMiddleName->setText("");
1151 txtLastName->setText(""); 1179 txtLastName->setText("");
1152 txtSuffix->setText(""); 1180 txtSuffix->setText("");
1153 txtNote->setText(""); 1181 txtNote->setText("");
1154 txtFullName->setText(""); 1182 txtFullName->setText("");
1155 txtJobTitle->setText(""); 1183 txtJobTitle->setText("");
1156 txtOrganization->setText(""); 1184 txtOrganization->setText("");
1157 txtChooserField1->setText(""); 1185 txtChooserField1->setText("");
1158 txtChooserField2->setText(""); 1186 txtChooserField2->setText("");
1159 txtChooserField3->setText(""); 1187 txtChooserField3->setText("");
1160 txtAddress->setText(""); 1188 txtAddress->setText("");
1161 //txtAddress2->setText(""); 1189 //txtAddress2->setText("");
1162 txtCity->setText(""); 1190 txtCity->setText("");
1163 //txtPOBox->setText(""); 1191 //txtPOBox->setText("");
1164 txtState->setText(""); 1192 txtState->setText("");
1165 txtZip->setText(""); 1193 txtZip->setText("");
1166 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1194 QLineEdit *txtTmp = cmbCountry->lineEdit();
1167 txtTmp->setText(""); 1195 txtTmp->setText("");
1168 txtTmp = cmbFileAs->lineEdit(); 1196 txtTmp = cmbFileAs->lineEdit();
1169 txtTmp->setText(""); 1197 txtTmp->setText("");
1170 1198
1171} 1199}
1172 1200
1173void ContactEditor::setEntry( const Contact &entry ) { 1201void ContactEditor::setEntry( const Contact &entry ) {
1174 1202
1175 cleanupFields(); 1203 cleanupFields();
1176 1204
1177 1205
1178 ent = entry; 1206 ent = entry;
1179 1207
1180 useFullName = FALSE; 1208 useFullName = FALSE;
1181 txtFirstName->setText( ent.firstName() ); 1209 txtFirstName->setText( ent.firstName() );
1182 txtMiddleName->setText( ent.middleName() ); 1210 txtMiddleName->setText( ent.middleName() );
1183 txtLastName->setText( ent.lastName() ); 1211 txtLastName->setText( ent.lastName() );
1184 txtSuffix->setText( ent.suffix() ); 1212 txtSuffix->setText( ent.suffix() );
1185 1213
1186 QString *tmpString = new QString; 1214 QString *tmpString = new QString;
1187 *tmpString = ent.firstName() + " " + ent.middleName() + 1215 *tmpString = ent.firstName() + " " + ent.middleName() +
1188 + " " + ent.lastName() + " " + ent.suffix(); 1216 + " " + ent.lastName() + " " + ent.suffix();
1189 1217
1190 txtFullName->setText( tmpString->simplifyWhiteSpace() ); 1218 txtFullName->setText( tmpString->simplifyWhiteSpace() );
1191 1219
1192 cmbFileAs->setEditText( ent.fileAs() ); 1220 cmbFileAs->setEditText( ent.fileAs() );
1193 1221
1194 if (hasTitle) 1222 if (hasTitle)
1195 txtJobTitle->setText( ent.jobTitle() ); 1223 txtJobTitle->setText( ent.jobTitle() );
1196 1224
1197 if (hasCompany) 1225 if (hasCompany)
1198 txtOrganization->setText( ent.company() ); 1226 txtOrganization->setText( ent.company() );
1199 1227
1200 if (hasNotes) 1228 if (hasNotes)
1201 txtNote->setText( ent.notes() ); 1229 txtNote->setText( ent.notes() );
1202 1230
1203 if (hasStreet) { 1231 if (hasStreet) {
1204 (*slHomeAddress)[0] = ent.homeStreet(); 1232 slHomeAddress[0] = ent.homeStreet();
1205 (*slBusinessAddress)[0] = ent.businessStreet(); 1233 slBusinessAddress[0] = ent.businessStreet();
1206 } 1234 }
1207/* 1235/*
1208 if (hasStreet2) { 1236 if (hasStreet2) {
1209 (*slHomeAddress)[1] = ent.homeStreet2(); 1237 (*slHomeAddress)[1] = ent.homeStreet2();
1210 (*slBusinessAddress)[1] = ent.businessStreet2(); 1238 (*slBusinessAddress)[1] = ent.businessStreet2();
1211 } 1239 }
1212 1240
1213 if (hasPOBox) { 1241 if (hasPOBox) {
1214 (*slHomeAddress)[2] = ent.homePOBox(); 1242 (*slHomeAddress)[2] = ent.homePOBox();
1215 (*slBusinessAddress)[2] = ent.businessPOBox(); 1243 (*slBusinessAddress)[2] = ent.businessPOBox();
1216 } 1244 }
1217*/ 1245*/
1218 if (hasCity) { 1246 if (hasCity) {
1219 (*slHomeAddress)[3] = ent.homeCity(); 1247 slHomeAddress[3] = ent.homeCity();
1220 (*slBusinessAddress)[3] = ent.businessCity(); 1248 slBusinessAddress[3] = ent.businessCity();
1221 } 1249 }
1222 1250
1223 if (hasState) { 1251 if (hasState) {
1224 (*slHomeAddress)[4] = ent.homeState(); 1252 slHomeAddress[4] = ent.homeState();
1225 (*slBusinessAddress)[4] = ent.businessState(); 1253 slBusinessAddress[4] = ent.businessState();
1226 } 1254 }
1227 1255
1228 if (hasZip) { 1256 if (hasZip) {
1229 (*slHomeAddress)[5] = ent.homeZip(); 1257 slHomeAddress[5] = ent.homeZip();
1230 (*slBusinessAddress)[5] = ent.businessZip(); 1258 slBusinessAddress[5] = ent.businessZip();
1231 } 1259 }
1232 1260
1233 if (hasCountry) { 1261 if (hasCountry) {
1234 (*slHomeAddress)[6] = ent.homeCountry(); 1262 slHomeAddress[6] = ent.homeCountry();
1235 (*slBusinessAddress)[6] = ent.businessCountry(); 1263 slBusinessAddress[6] = ent.businessCountry();
1236 } 1264 }
1237 1265
1238 QStringList::ConstIterator it; 1266 QStringList::ConstIterator it;
1239 QListIterator<QLineEdit> itLE( listValue ); 1267 QListIterator<QLineEdit> itLE( listValue );
1240 for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) { 1268 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) {
1241 if ( *it == "Department" ) 1269 if ( *it == "Department" )
1242 (*itLE)->setText( ent.department() ); 1270 (*itLE)->setText( ent.department() );
1243 1271
1244 if ( *it == "Company" ) 1272 if ( *it == "Company" )
1245 (*itLE)->setText( ent.company() ); 1273 (*itLE)->setText( ent.company() );
1246 1274
1247 if ( *it == "Office" ) 1275 if ( *it == "Office" )
1248 (*itLE)->setText( ent.office() ); 1276 (*itLE)->setText( ent.office() );
1249 1277
1250 if ( *it == "Profession" ) 1278 if ( *it == "Profession" )
1251 (*itLE)->setText( ent.profession() ); 1279 (*itLE)->setText( ent.profession() );
1252 1280
1253 if ( *it == "Assistant" ) 1281 if ( *it == "Assistant" )
1254 (*itLE)->setText( ent.assistant() ); 1282 (*itLE)->setText( ent.assistant() );
1255 1283
1256 if ( *it == "Manager" ) 1284 if ( *it == "Manager" )
1257 (*itLE)->setText( ent.manager() ); 1285 (*itLE)->setText( ent.manager() );
1258 1286
1259 if ( *it == "Spouse" ) 1287 if ( *it == "Spouse" )
1260 (*itLE)->setText( ent.spouse() ); 1288 (*itLE)->setText( ent.spouse() );
1261 1289
1262 if ( *it == "Birthday" ) 1290 if ( *it == "Birthday" )
1263 (*itLE)->setText( ent.birthday() ); 1291 (*itLE)->setText( ent.birthday() );
1264 1292
1265 if ( *it == "Anniversary" ) 1293 if ( *it == "Anniversary" )
1266 (*itLE)->setText( ent.anniversary() ); 1294 (*itLE)->setText( ent.anniversary() );
1267 1295
1268 if ( *it == "Nickname" ) 1296 if ( *it == "Nickname" )
1269 (*itLE)->setText( ent.nickname() ); 1297 (*itLE)->setText( ent.nickname() );
1270 1298
1271 if ( *it == "Children" ) 1299 if ( *it == "Children" )
1272 (*itLE)->setText( ent.children() ); 1300 (*itLE)->setText( ent.children() );
1273 1301
1274 } 1302 }
1275 1303
1276 QStringList::Iterator itV; 1304 QStringList::Iterator itV;
1277 for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) { 1305 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1278 1306
1279 if ( *it == "Business Phone" || *it == "Work Phone" ) 1307 if ( *it == "Business Phone" || *it == "Work Phone" )
1280 *itV = ent.businessPhone(); 1308 *itV = ent.businessPhone();
1281/* 1309/*
1282 if ( *it == "Business 2 Phone" ) 1310 if ( *it == "Business 2 Phone" )
1283 *itV = ent.business2Phone(); 1311 *itV = ent.business2Phone();
1284*/ 1312*/
1285 if ( *it == "Business Fax" || *it == "Work Fax" ) 1313 if ( *it == "Business Fax" || *it == "Work Fax" )
1286 *itV = ent.businessFax(); 1314 *itV = ent.businessFax();
1287 1315
1288 if ( *it == "Business Mobile" || *it == "work Mobile" ) 1316 if ( *it == "Business Mobile" || *it == "work Mobile" )
1289 *itV = ent.businessMobile(); 1317 *itV = ent.businessMobile();
1290/* 1318/*
1291 if ( *it == "Company Phone" ) 1319 if ( *it == "Company Phone" )
1292 *itV = ent.companyPhone(); 1320 *itV = ent.companyPhone();
1293*/ 1321*/
1294 if ( *it == "Default Email" ) 1322 if ( *it == "Default Email" )
1295 *itV = ent.defaultEmail(); 1323 *itV = ent.defaultEmail();
1296 1324
1297 if ( *it == "Emails" ) 1325 if ( *it == "Emails" )
1298 *itV = ent.emails(); 1326 *itV = ent.emails();
1299 1327
1300 if ( *it == "Home Phone" ) 1328 if ( *it == "Home Phone" )
1301 *itV = ent.homePhone(); 1329 *itV = ent.homePhone();
1302/* 1330/*
1303 if ( *it == "Home 2 Phone" ) 1331 if ( *it == "Home 2 Phone" )
1304 *itV = ent.home2Phone(); 1332 *itV = ent.home2Phone();
1305*/ 1333*/
1306 if ( *it == "Home Fax" ) 1334 if ( *it == "Home Fax" )
1307 *itV = ent.homeFax(); 1335 *itV = ent.homeFax();
1308 1336
1309 if ( *it == "Home Mobile" ) 1337 if ( *it == "Home Mobile" )
1310 *itV = ent.homeMobile(); 1338 *itV = ent.homeMobile();
1311/* 1339/*
1312 if ( *it == "Car Phone" ) 1340 if ( *it == "Car Phone" )
1313 *itV = ent.carPhone(); 1341 *itV = ent.carPhone();
1314 1342
1315 if ( *it == "ISDN Phone" ) 1343 if ( *it == "ISDN Phone" )
1316 *itV = ent.ISDNPhone(); 1344 *itV = ent.ISDNPhone();
1317 1345
1318 if ( *it == "Other Phone" ) 1346 if ( *it == "Other Phone" )
1319 *itV = ent.otherPhone(); 1347 *itV = ent.otherPhone();
1320*/ 1348*/
1321 if ( *it == "Business Pager" || *it == "Work Pager" ) 1349 if ( *it == "Business Pager" || *it == "Work Pager" )
1322 *itV = ent.businessPager(); 1350 *itV = ent.businessPager();
1323/* 1351/*
1324 if ( *it == "Home Pager") 1352 if ( *it == "Home Pager")
1325 *itV = ent.homePager(); 1353 *itV = ent.homePager();
1326 1354
1327 if ( *it == "AIM IM" ) 1355 if ( *it == "AIM IM" )
1328 *itV = ent.AIMIM(); 1356 *itV = ent.AIMIM();
1329 1357
1330 if ( *it == "ICQ IM" ) 1358 if ( *it == "ICQ IM" )
1331 *itV = ent.ICQIM(); 1359 *itV = ent.ICQIM();
1332 1360
1333 if ( *it == "Jabber IM" ) 1361 if ( *it == "Jabber IM" )
1334 *itV = ent.jabberIM(); 1362 *itV = ent.jabberIM();
1335 1363
1336 if ( *it == "MSN IM" ) 1364 if ( *it == "MSN IM" )
1337 *itV = ent.MSNIM(); 1365 *itV = ent.MSNIM();
1338 1366
1339 if ( *it == "Yahoo IM" ) 1367 if ( *it == "Yahoo IM" )
1340 *itV = ent.yahooIM(); 1368 *itV = ent.yahooIM();
1341*/ 1369*/
1342 if ( *it == "Home Web Page" ) 1370 if ( *it == "Home Web Page" )
1343 *itV = ent.homeWebpage(); 1371 *itV = ent.homeWebpage();
1344 if ( *it == "Business Web Page" || *it == "Work Web Page" ) 1372 if ( *it == "Business Web Page" || *it == "Work Web Page" )
1345 *itV = ent.businessWebpage(); 1373 *itV = ent.businessWebpage();
1346 1374
1347 1375
1348 } 1376 }
1349 1377
1350 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); 1378 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") );
1351 1379
1352 QString gender = ent.gender(); 1380 QString gender = ent.gender();
1353 cmbGender->setCurrentItem( gender.toInt() ); 1381 cmbGender->setCurrentItem( gender.toInt() );
1354 1382
1355 txtNote->setText( ent.notes() ); 1383 txtNote->setText( ent.notes() );
1356 1384
1357 slotCmbChooser1Change( cmbChooserField1->currentItem() ); 1385 slotCmbChooser1Change( cmbChooserField1->currentItem() );
1358 slotCmbChooser2Change( cmbChooserField2->currentItem() ); 1386 slotCmbChooser2Change( cmbChooserField2->currentItem() );
1359 slotCmbChooser3Change( cmbChooserField3->currentItem() ); 1387 slotCmbChooser3Change( cmbChooserField3->currentItem() );
1360 1388
1361 slotAddressTypeChange( cmbAddress->currentItem() ); 1389 slotAddressTypeChange( cmbAddress->currentItem() );
1362 1390
1363} 1391}
1364 1392
1365void ContactEditor::saveEntry() { 1393void ContactEditor::saveEntry() {
1366 1394
1367 if ( useFullName == TRUE ) { 1395 if ( useFullName == TRUE ) {
1368 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); 1396 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) );
1369 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); 1397 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) );
1370 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); 1398 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
1371 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); 1399 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
1372 1400
1373 useFullName = FALSE; 1401 useFullName = FALSE;
1374 } 1402 }
1375 1403
1376 /*if ( ent.firstName() != txtFirstName->text() || 1404 /*if ( ent.firstName() != txtFirstName->text() ||
1377 ent.lastName != txtLastName->text() || 1405 ent.lastName != txtLastName->text() ||
1378 ent.middleName != txtMiddleName->text() ) { 1406 ent.middleName != txtMiddleName->text() ) {
1379 */ 1407 */
1380 ent.setFirstName( txtFirstName->text() ); 1408 ent.setFirstName( txtFirstName->text() );
1381 ent.setLastName( txtLastName->text() ); 1409 ent.setLastName( txtLastName->text() );
1382 ent.setMiddleName( txtMiddleName->text() ); 1410 ent.setMiddleName( txtMiddleName->text() );
1383 ent.setSuffix( txtSuffix->text() ); 1411 ent.setSuffix( txtSuffix->text() );
1384 1412
1385 //} 1413 //}
1386 1414
1387 ent.setFileAs( cmbFileAs->currentText() ); 1415 ent.setFileAs( cmbFileAs->currentText() );
1388 1416
1389 ent.setCategories( cmbCat->currentCategories() ); 1417 ent.setCategories( cmbCat->currentCategories() );
1390 1418
1391 if (hasTitle) 1419 if (hasTitle)
1392 ent.setJobTitle( txtJobTitle->text() ); 1420 ent.setJobTitle( txtJobTitle->text() );
1393 1421
1394 if (hasCompany) 1422 if (hasCompany)
1395 ent.setCompany( txtOrganization->text() ); 1423 ent.setCompany( txtOrganization->text() );
1396 1424
1397 if (hasNotes) 1425 if (hasNotes)
1398 ent.setNotes( txtNote->text() ); 1426 ent.setNotes( txtNote->text() );
1399 1427
1400 if (hasStreet) { 1428 if (hasStreet) {
1401 ent.setHomeStreet( (*slHomeAddress)[0] ); 1429 ent.setHomeStreet( slHomeAddress[0] );
1402 ent.setBusinessStreet( (*slBusinessAddress)[0] ); 1430 ent.setBusinessStreet( slBusinessAddress[0] );
1403 } 1431 }
1404/* 1432/*
1405 if (hasStreet2) { 1433 if (hasStreet2) {
1406 ent.setHomeStreet2( (*slHomeAddress)[1] ); 1434 ent.setHomeStreet2( (*slHomeAddress)[1] );
1407 ent.setBusinessStreet2( (*slBusinessAddress)[1] ); 1435 ent.setBusinessStreet2( (*slBusinessAddress)[1] );
1408 } 1436 }
1409 1437
1410 if (hasPOBox) { 1438 if (hasPOBox) {
1411 ent.setHomePOBox( (*slHomeAddress)[2] ); 1439 ent.setHomePOBox( (*slHomeAddress)[2] );
1412 ent.setBusinessPOBox( (*slBusinessAddress)[2] ); 1440 ent.setBusinessPOBox( (*slBusinessAddress)[2] );
1413 } 1441 }
1414*/ 1442*/
1415 if (hasCity) { 1443 if (hasCity) {
1416 ent.setHomeCity( (*slHomeAddress)[3] ); 1444 ent.setHomeCity( slHomeAddress[3] );
1417 ent.setBusinessCity( (*slBusinessAddress)[3] ); 1445 ent.setBusinessCity( slBusinessAddress[3] );
1418 } 1446 }
1419 1447
1420 if (hasState) { 1448 if (hasState) {
1421 ent.setHomeState( (*slHomeAddress)[4] ); 1449 ent.setHomeState( slHomeAddress[4] );
1422 ent.setBusinessState( (*slBusinessAddress)[4] ); 1450 ent.setBusinessState( slBusinessAddress[4] );
1423 } 1451 }
1424 1452
1425 if (hasZip) { 1453 if (hasZip) {
1426 ent.setHomeZip( (*slHomeAddress)[5] ); 1454 ent.setHomeZip( slHomeAddress[5] );
1427 ent.setBusinessZip( (*slBusinessAddress)[5] ); 1455 ent.setBusinessZip( slBusinessAddress[5] );
1428 } 1456 }
1429 1457
1430 if (hasCountry) { 1458 if (hasCountry) {
1431 ent.setHomeCountry( (*slHomeAddress)[6] ); 1459 ent.setHomeCountry( slHomeAddress[6] );
1432 ent.setBusinessCountry( (*slBusinessAddress)[6] ); 1460 ent.setBusinessCountry( slBusinessAddress[6] );
1433 } 1461 }
1434 1462
1435 QStringList::ConstIterator it; 1463 QStringList::ConstIterator it;
1436 QListIterator<QLineEdit> itLE( listValue ); 1464 QListIterator<QLineEdit> itLE( listValue );
1437 for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) { 1465 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) {
1438 if ( *it == "Department" ) 1466 if ( *it == "Department" )
1439 ent.setDepartment( (*itLE)->text() ); 1467 ent.setDepartment( (*itLE)->text() );
1440 1468
1441 if ( *it == "Company" ) 1469 if ( *it == "Company" )
1442 ent.setCompany( (*itLE)->text() ); 1470 ent.setCompany( (*itLE)->text() );
1443 1471
1444 if ( *it == "Office" ) 1472 if ( *it == "Office" )
1445 ent.setOffice( (*itLE)->text() ); 1473 ent.setOffice( (*itLE)->text() );
1446 1474
1447 if ( *it == "Profession" ) 1475 if ( *it == "Profession" )
1448 ent.setProfession( (*itLE)->text() ); 1476 ent.setProfession( (*itLE)->text() );
1449 1477
1450 if ( *it == "Assistant" ) 1478 if ( *it == "Assistant" )
1451 ent.setAssistant( (*itLE)->text() ); 1479 ent.setAssistant( (*itLE)->text() );
1452 1480
1453 if ( *it == "Manager" ) 1481 if ( *it == "Manager" )
1454 ent.setManager( (*itLE)->text() ); 1482 ent.setManager( (*itLE)->text() );
1455 1483
1456 if ( *it == "Spouse" ) 1484 if ( *it == "Spouse" )
1457 ent.setSpouse( (*itLE)->text() ); 1485 ent.setSpouse( (*itLE)->text() );
1458 1486
1459 if ( *it == "Birthday" ) 1487 if ( *it == "Birthday" )
1460 ent.setBirthday( (*itLE)->text() ); 1488 ent.setBirthday( (*itLE)->text() );
1461 1489
1462 if ( *it == "Anniversary" ) 1490 if ( *it == "Anniversary" )
1463 ent.setAnniversary( (*itLE)->text() ); 1491 ent.setAnniversary( (*itLE)->text() );
1464 1492
1465 if ( *it == "Nickname" ) 1493 if ( *it == "Nickname" )
1466 ent.setNickname( (*itLE)->text() ); 1494 ent.setNickname( (*itLE)->text() );
1467 1495
1468 if ( *it == "Children" ) 1496 if ( *it == "Children" )
1469 ent.setChildren( (*itLE)->text() ); 1497 ent.setChildren( (*itLE)->text() );
1470 1498
1471 } 1499 }
1472 1500
1473 QStringList::ConstIterator itV; 1501 QStringList::ConstIterator itV;
1474 for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) { 1502 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1475 1503
1476 if ( *it == "Business Phone" || *it == "Work Phone" ) 1504 if ( *it == "Business Phone" || *it == "Work Phone" )
1477 ent.setBusinessPhone( *itV ); 1505 ent.setBusinessPhone( *itV );
1478/* 1506/*
1479 if ( *it == "Business 2 Phone" ) 1507 if ( *it == "Business 2 Phone" )
1480 ent.setBusiness2Phone( *itV ); 1508 ent.setBusiness2Phone( *itV );
1481*/ 1509*/
1482 if ( *it == "Business Fax" || *it == "Work Fax" ) 1510 if ( *it == "Business Fax" || *it == "Work Fax" )
1483 ent.setBusinessFax( *itV ); 1511 ent.setBusinessFax( *itV );
1484 1512
1485 if ( *it == "Business Mobile" || *it == "Work Mobile" ) 1513 if ( *it == "Business Mobile" || *it == "Work Mobile" )
1486 ent.setBusinessMobile( *itV ); 1514 ent.setBusinessMobile( *itV );
1487/* 1515/*
1488 if ( *it == "Company Phone" ) 1516 if ( *it == "Company Phone" )
1489 ent.setCompanyPhone( *itV ); 1517 ent.setCompanyPhone( *itV );
1490*/ 1518*/
1491 //if ( *it == "Default Email" ) 1519 //if ( *it == "Default Email" )
1492 //ent.setDefaultEmail( *itV ); 1520 //ent.setDefaultEmail( *itV );
1493 1521
1494 if ( *it == "Emails" ) { 1522 if ( *it == "Emails" ) {
1495 QString allemail; 1523 QString allemail;
1496 QString defaultmail; 1524 QString defaultmail;
1497 parseEmailFrom( *itV, defaultmail, allemail ); 1525 parseEmailFrom( *itV, defaultmail, allemail );
1498 ent.setDefaultEmail( defaultmail ); 1526 ent.setDefaultEmail( defaultmail );
1499 ent.setEmails( *itV ); 1527 ent.setEmails( *itV );
1500 } 1528 }
1501 1529
1502 if ( *it == "Home Phone" ) 1530 if ( *it == "Home Phone" )
1503 ent.setHomePhone( *itV ); 1531 ent.setHomePhone( *itV );
1504/* 1532/*
1505 if ( *it == "Home 2 Phone" ) 1533 if ( *it == "Home 2 Phone" )
1506 ent.setHome2Phone( *itV ); 1534 ent.setHome2Phone( *itV );
1507*/ 1535*/
1508 if ( *it == "Home Fax" ) 1536 if ( *it == "Home Fax" )
1509 ent.setHomeFax( *itV ); 1537 ent.setHomeFax( *itV );
1510 1538
1511 if ( *it == "Home Mobile" ) 1539 if ( *it == "Home Mobile" )
1512 ent.setHomeMobile( *itV ); 1540 ent.setHomeMobile( *itV );
1513/* 1541/*
1514 if ( *it == "Car Phone" ) 1542 if ( *it == "Car Phone" )
1515 ent.setCarPhone( *itV ); 1543 ent.setCarPhone( *itV );
1516 1544
1517 if ( *it == "ISDN Phone" ) 1545 if ( *it == "ISDN Phone" )
1518 ent.setISDNPhone( *itV ); 1546 ent.setISDNPhone( *itV );
1519 1547
1520 if ( *it == "Other Phone" ) 1548 if ( *it == "Other Phone" )
1521 ent.setOtherPhone( *itV ); 1549 ent.setOtherPhone( *itV );
1522*/ 1550*/
1523 if ( *it == "Business Pager" || *it == "Work Pager" ) 1551 if ( *it == "Business Pager" || *it == "Work Pager" )
1524 ent.setBusinessPager( *itV ); 1552 ent.setBusinessPager( *itV );
1525/* 1553/*
1526 if ( *it == "Home Pager" ) 1554 if ( *it == "Home Pager" )
1527 ent.setHomePager( *itV ); 1555 ent.setHomePager( *itV );
1528 1556
1529 if ( *it == "AIM IM" ) 1557 if ( *it == "AIM IM" )
1530 ent.setAIMIM( *itV ); 1558 ent.setAIMIM( *itV );
1531 1559
1532 if ( *it == "ICQ IM" ) 1560 if ( *it == "ICQ IM" )
1533 ent.setICQIM( *itV ); 1561 ent.setICQIM( *itV );
1534 1562
1535 if ( *it == "Jabber IM" ) 1563 if ( *it == "Jabber IM" )
1536 ent.setJabberIM( *itV ); 1564 ent.setJabberIM( *itV );
1537 1565
1538 if ( *it == "MSN IM" ) 1566 if ( *it == "MSN IM" )
1539 ent.setMSNIM( *itV ); 1567 ent.setMSNIM( *itV );
1540 1568
1541 if ( *it == "Yahoo IM" ) 1569 if ( *it == "Yahoo IM" )
1542 ent.setYahooIM( *itV ); 1570 ent.setYahooIM( *itV );
1543*/ 1571*/
1544 if ( *it == "Home Web Page" ) 1572 if ( *it == "Home Web Page" )
1545 ent.setHomeWebpage( *itV ); 1573 ent.setHomeWebpage( *itV );
1546 if ( *it == "Business Web Page" || *it == "Work Web Page" ) 1574 if ( *it == "Business Web Page" || *it == "Work Web Page" )
1547 ent.setBusinessWebpage( *itV ); 1575 ent.setBusinessWebpage( *itV );
1548 1576
1549 1577
1550 } 1578 }
1551 1579
1552 int gender = cmbGender->currentItem(); 1580 int gender = cmbGender->currentItem();
1553 ent.setGender( QString::number( gender ) ); 1581 ent.setGender( QString::number( gender ) );
1554 1582
1555 QString str = txtNote->text(); 1583 QString str = txtNote->text();
1556 if ( !str.isNull() ) 1584 if ( !str.isNull() )
1557 ent.setNotes( str ); 1585 ent.setNotes( str );
1558 1586
1559} 1587}
1560 1588
1561void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 1589void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
1562 QString &strAll ) 1590 QString &strAll )
1563{ 1591{
1564 int where, 1592 int where,
1565 start; 1593 start;
1566 if ( txt.isEmpty() ) 1594 if ( txt.isEmpty() )
1567 return; 1595 return;
1568 // find the first 1596 // find the first
1569 where = txt.find( ',' ); 1597 where = txt.find( ',' );
1570 if ( where < 0 ) { 1598 if ( where < 0 ) {
1571 strDefaultEmail = txt; 1599 strDefaultEmail = txt;
1572 strAll = txt; 1600 strAll = txt;
1573 } else { 1601 } else {
1574 strDefaultEmail = txt.left( where ).stripWhiteSpace(); 1602 strDefaultEmail = txt.left( where ).stripWhiteSpace();
1575 strAll = strDefaultEmail; 1603 strAll = strDefaultEmail;
1576 while ( where > -1 ) { 1604 while ( where > -1 ) {
1577 strAll.append(" "); 1605 strAll.append(" ");
1578 start = where; 1606 start = where;
1579 where = txt.find( ',', where + 1 ); 1607 where = txt.find( ',', where + 1 );
1580 if ( where > - 1 ) 1608 if ( where > - 1 )
1581 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); 1609 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() );
1582 else // grab until the end... 1610 else // grab until the end...
1583 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); 1611 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() );
1584 } 1612 }
1585 } 1613 }
1586} 1614}
1587 1615
1588void parseEmailTo( const QString &strDefaultEmail, 1616void parseEmailTo( const QString &strDefaultEmail,
1589 const QString &strOtherEmail, QString &strBack ) 1617 const QString &strOtherEmail, QString &strBack )
1590{ 1618{
1591 // create a comma dilimeted set of emails... 1619 // create a comma dilimeted set of emails...
1592 // use the power of short circuiting... 1620 // use the power of short circuiting...
1593 bool foundDefault = false; 1621 bool foundDefault = false;
1594 QString strTmp; 1622 QString strTmp;
1595 int start = 0; 1623 int start = 0;
1596 int where; 1624 int where;
1597 // start at the beginng. 1625 // start at the beginng.
1598 strBack = strDefaultEmail; 1626 strBack = strDefaultEmail;
1599 where = 0; 1627 where = 0;
1600 while ( where > -1 ) { 1628 while ( where > -1 ) {
1601 start = where; 1629 start = where;
1602 where = strOtherEmail.find( ' ', where + 1 ); 1630 where = strOtherEmail.find( ' ', where + 1 );
1603 if ( where > 0 ) { 1631 if ( where > 0 ) {
1604 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); 1632 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace();
1605 } else 1633 } else
1606 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); 1634 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace();
1607 if ( foundDefault || strTmp != strDefaultEmail ) { 1635 if ( foundDefault || strTmp != strDefaultEmail ) {
1608 strBack.append( ", " ); 1636 strBack.append( ", " );
1609 strBack.append( strTmp ); 1637 strBack.append( strTmp );
1610 } else 1638 } else
1611 foundDefault = true; 1639 foundDefault = true;
1612 } 1640 }
1613} 1641}
1614 1642
1615 1643
1616static inline bool containsAlphaNum( const QString &str ) 1644static inline bool containsAlphaNum( const QString &str )
1617{ 1645{
1618 int i, 1646 int i,
1619 count = str.length(); 1647 count = str.length();
1620 for ( i = 0; i < count; i++ ) 1648 for ( i = 0; i < count; i++ )
1621 if ( !str[i].isSpace() ) 1649 if ( !str[i].isSpace() )
1622 return TRUE; 1650 return TRUE;
1623 return FALSE; 1651 return FALSE;
1624} 1652}
1625 1653
1626static inline bool constainsWhiteSpace( const QString &str ) 1654static inline bool constainsWhiteSpace( const QString &str )
1627{ 1655{
1628 int i, 1656 int i,
1629 count = str.length(); 1657 count = str.length();
1630 for (i = 0; i < count; i++ ) 1658 for (i = 0; i < count; i++ )
1631 if ( str[i].isSpace() ) 1659 if ( str[i].isSpace() )
1632 return TRUE; 1660 return TRUE;
1633 return FALSE; 1661 return FALSE;
1634} 1662}
1635 1663
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h
index a58a860..4f3b56e 100644
--- a/core/pim/addressbook/contacteditor.h
+++ b/core/pim/addressbook/contacteditor.h
@@ -1,162 +1,162 @@
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#ifndef CONTACTEDITOR_H 21#ifndef CONTACTEDITOR_H
22#define CONTACTEDITOR_H 22#define CONTACTEDITOR_H
23 23
24#include <qpe/contact.h> 24#include <qpe/contact.h>
25 25
26#include <qdialog.h> 26#include <qdialog.h>
27#include <qlist.h> 27#include <qlist.h>
28#include <qmap.h> 28#include <qmap.h>
29#include <qstringlist.h> 29#include <qstringlist.h>
30 30
31const int NAME_LF = 0; 31const int NAME_LF = 0;
32const int NAME_LFM = 1; 32const int NAME_LFM = 1;
33const int NAME_FL = 2; 33const int NAME_FL = 2;
34const int NAME_FMLS = 3; 34const int NAME_FMLS = 3;
35 35
36const int NAME_F = 4; 36const int NAME_F = 4;
37const int NAME_M = 5; 37const 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 slotChooser4Change( const QString &textChanged );
87 void slotCmbChooser1Change( int index ); 87 void slotCmbChooser1Change( int index );
88 void slotCmbChooser2Change( int index ); 88 void slotCmbChooser2Change( int index );
89 void slotCmbChooser3Change( int index ); 89 void slotCmbChooser3Change( int index );
90 void slotCmbChooser4Change( int index ); 90 void slotCmbChooser4Change( int index );
91 void slotAddressTypeChange( int index ); 91 void slotAddressTypeChange( int index );
92 void slotAddressChange( const QString &textChanged ); 92 void slotAddressChange( const QString &textChanged );
93 void slotAddress2Change( const QString &textChanged ); 93 void slotAddress2Change( const QString &textChanged );
94 void slotPOBoxChange( const QString &textChanged ); 94 void slotPOBoxChange( const QString &textChanged );
95 void slotCityChange( const QString &textChanged ); 95 void slotCityChange( const QString &textChanged );
96 void slotStateChange( const QString &textChanged ); 96 void slotStateChange( const QString &textChanged );
97 void slotZipChange( const QString &textChanged ); 97 void slotZipChange( const QString &textChanged );
98 void slotCountryChange( const QString &textChanged ); 98 void slotCountryChange( const QString &textChanged );
99 void slotFullNameChange( const QString &textChanged ); 99 void slotFullNameChange( const QString &textChanged );
100 100
101 private: 101 private:
102 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;
103 103
104 Contact ent; 104 Contact ent;
105 105
106 QDialog *dlgNote; 106 QDialog *dlgNote;
107 QDialog *dlgName; 107 QDialog *dlgName;
108 108
109 QList<QLineEdit> listValue; 109 QList<QLineEdit> listValue;
110 QList<QLabel> listName; 110 QList<QLabel> listName;
111 const QValueList<int> *orderedValues; 111 const QValueList<int> *orderedValues;
112 QStringList *slOrdered; 112 QStringList slOrdered;
113 QStringList *slDynamicEntries; 113 QStringList slDynamicEntries;
114 114
115 QStringList *slHomeAddress; 115 QStringList slHomeAddress;
116 QStringList *slBusinessAddress; 116 QStringList slBusinessAddress;
117 QStringList *slChooserNames; 117 QStringList slChooserNames;
118 QStringList *slChooserValues; 118 QStringList slChooserValues;
119 119
120 QMultiLineEdit *txtNote; 120 QMultiLineEdit *txtNote;
121 QLabel *lblNote; 121 QLabel *lblNote;
122 122
123 //QLineEdit *txtTitle; 123 //QLineEdit *txtTitle;
124 QLineEdit *txtFirstName; 124 QLineEdit *txtFirstName;
125 QLineEdit *txtMiddleName; 125 QLineEdit *txtMiddleName;
126 QLineEdit *txtLastName; 126 QLineEdit *txtLastName;
127 QLineEdit *txtSuffix; 127 QLineEdit *txtSuffix;
128 128
129 QTabWidget *tabMain; 129 QTabWidget *tabMain;
130 QScrollView *svGeneral; 130 QScrollView *svGeneral;
131 QPushButton *btnFullName; 131 QPushButton *btnFullName;
132 QPushButton *btnNote; 132 QPushButton *btnNote;
133 QLineEdit *txtFullName; 133 QLineEdit *txtFullName;
134 QLineEdit *txtJobTitle; 134 QLineEdit *txtJobTitle;
135 QLineEdit *txtOrganization; 135 QLineEdit *txtOrganization;
136 QLineEdit *txtChooserField1; 136 QLineEdit *txtChooserField1;
137 QLineEdit *txtChooserField2; 137 QLineEdit *txtChooserField2;
138 QLineEdit *txtChooserField3; 138 QLineEdit *txtChooserField3;
139 QLineEdit *txtChooserField4; 139 QLineEdit *txtChooserField4;
140 QComboBox *cmbChooserField1; 140 QComboBox *cmbChooserField1;
141 QComboBox *cmbChooserField2; 141 QComboBox *cmbChooserField2;
142 QComboBox *cmbChooserField3; 142 QComboBox *cmbChooserField3;
143 QComboBox *cmbChooserField4; 143 QComboBox *cmbChooserField4;
144 QComboBox *cmbFileAs; 144 QComboBox *cmbFileAs;
145 CategorySelect *cmbCat; 145 CategorySelect *cmbCat;
146 146
147 QScrollView *svAddress; 147 QScrollView *svAddress;
148 QLineEdit *txtAddress; 148 QLineEdit *txtAddress;
149 //QLineEdit *txtAddress2; 149 //QLineEdit *txtAddress2;
150 //QLineEdit *txtPOBox; 150 //QLineEdit *txtPOBox;
151 QLineEdit *txtCity; 151 QLineEdit *txtCity;
152 QLineEdit *txtState; 152 QLineEdit *txtState;
153 QLineEdit *txtZip; 153 QLineEdit *txtZip;
154 QComboBox *cmbAddress; 154 QComboBox *cmbAddress;
155 QComboBox *cmbCountry; 155 QComboBox *cmbCountry;
156 156
157 QScrollView *svDetails; 157 QScrollView *svDetails;
158 QComboBox *cmbGender; 158 QComboBox *cmbGender;
159 159
160}; 160};
161 161
162#endif 162#endif