summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/TODO3
-rw-r--r--core/pim/addressbook/abtable.cpp2
-rw-r--r--core/pim/addressbook/contacteditor.cpp84
3 files changed, 63 insertions, 26 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO
index 83e3c6b..a4fc29a 100644
--- a/core/pim/addressbook/TODO
+++ b/core/pim/addressbook/TODO
@@ -1,16 +1,19 @@
1Stuff todo: 1Stuff todo:
2 2
3Urgent: 3Urgent:
4- "Nonenglish" translation bug has to be fixed. 4- "Nonenglish" translation bug has to be fixed.
5 5
6Important: 6Important:
7 7
8- Finishing of new View functions (List, Phonebook...) 8- Finishing of new View functions (List, Phonebook...)
9- Reload if contacts were changed externally 9- Reload if contacts were changed externally
10- "What's this" should be added
11- The names of the countries are sorted by there english names, only..
12 Even if they are translated.. :S
10 13
11Less important: 14Less important:
12 15
13- Find widget should be replaced by something like 16- Find widget should be replaced by something like
14 qpdf has. 17 qpdf has.
15- The picker (alphabetical sort widget) should be 18- The picker (alphabetical sort widget) should be
16 placed verticaly or horizontally (configurable) \ No newline at end of file 19 placed verticaly or horizontally (configurable) \ No newline at end of file
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index 08c6d0a..70c070f 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -37,193 +37,193 @@
37 37
38#include <errno.h> 38#include <errno.h>
39#include <fcntl.h> 39#include <fcntl.h>
40#include <unistd.h> 40#include <unistd.h>
41#include <stdlib.h> 41#include <stdlib.h>
42 42
43#include <ctype.h> //toupper() for key hack 43#include <ctype.h> //toupper() for key hack
44 44
45static bool contactCompare( const OContact &cnt, const QRegExp &r, int category ); 45static bool contactCompare( const OContact &cnt, const QRegExp &r, int category );
46 46
47 47
48/*! 48/*!
49 \class AbTableItem abtable.h 49 \class AbTableItem abtable.h
50 50
51 \brief QTableItem based class for showing a field of an entry 51 \brief QTableItem based class for showing a field of an entry
52*/ 52*/
53 53
54AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s, 54AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s,
55 const QString &secondSortKey) 55 const QString &secondSortKey)
56 : QTableItem( t, et, s ) 56 : QTableItem( t, et, s )
57{ 57{
58 // sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower(); 58 // sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower();
59 sortKey = Qtopia::buildSortKey( s, secondSortKey ); 59 sortKey = Qtopia::buildSortKey( s, secondSortKey );
60} 60}
61 61
62int AbTableItem::alignment() const 62int AbTableItem::alignment() const
63{ 63{
64 return AlignLeft|AlignVCenter; 64 return AlignLeft|AlignVCenter;
65} 65}
66 66
67QString AbTableItem::key() const 67QString AbTableItem::key() const
68{ 68{
69 return sortKey; 69 return sortKey;
70} 70}
71 71
72// A way to reset the item, without out doing a delete or a new... 72// A way to reset the item, without out doing a delete or a new...
73void AbTableItem::setItem( const QString &txt, const QString &secondKey ) 73void AbTableItem::setItem( const QString &txt, const QString &secondKey )
74{ 74{
75 setText( txt ); 75 setText( txt );
76 sortKey = Qtopia::buildSortKey( txt, secondKey ); 76 sortKey = Qtopia::buildSortKey( txt, secondKey );
77 77
78 // sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower(); 78 // sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower();
79} 79}
80 80
81/*! 81/*!
82 \class AbPickItem abtable.h 82 \class AbPickItem abtable.h
83 83
84 \brief QTableItem based class for showing slection of an entry 84 \brief QTableItem based class for showing slection of an entry
85*/ 85*/
86 86
87AbPickItem::AbPickItem( QTable *t ) : 87AbPickItem::AbPickItem( QTable *t ) :
88 QTableItem(t, WhenCurrent, "?") 88 QTableItem(t, WhenCurrent, "?")
89{ 89{
90} 90}
91 91
92QWidget *AbPickItem::createEditor() const 92QWidget *AbPickItem::createEditor() const
93{ 93{
94 QComboBox* combo = new QComboBox( table()->viewport() ); 94 QComboBox* combo = new QComboBox( table()->viewport() );
95 ( (AbPickItem*)this )->cb = combo; 95 ( (AbPickItem*)this )->cb = combo;
96 AbTable* t = static_cast<AbTable*>(table()); 96 AbTable* t = static_cast<AbTable*>(table());
97 QStringList c = t->choiceNames(); 97 QStringList c = t->choiceNames();
98 int cur = 0; 98 int cur = 0;
99 for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) { 99 for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) {
100 if ( *it == text() ) 100 if ( *it == text() )
101 cur = combo->count(); 101 cur = combo->count();
102 combo->insertItem(*it); 102 combo->insertItem(*it);
103 } 103 }
104 combo->setCurrentItem(cur); 104 combo->setCurrentItem(cur);
105 return combo; 105 return combo;
106} 106}
107 107
108void AbPickItem::setContentFromEditor( QWidget *w ) 108void AbPickItem::setContentFromEditor( QWidget *w )
109{ 109{
110 if ( w->inherits("QComboBox") ) 110 if ( w->inherits("QComboBox") )
111 setText( ( (QComboBox*)w )->currentText() ); 111 setText( ( (QComboBox*)w )->currentText() );
112 else 112 else
113 QTableItem::setContentFromEditor( w ); 113 QTableItem::setContentFromEditor( w );
114} 114}
115 115
116/*! 116/*!
117 \class AbTable abtable.h 117 \class AbTable abtable.h
118 118
119 \brief QTable based class for showing a list of entries 119 \brief QTable based class for showing a list of entries
120*/ 120*/
121 121
122AbTable::AbTable( const QValueList<int> *order, QWidget *parent, const char *name ) 122AbTable::AbTable( const QValueList<int> *order, QWidget *parent, const char *name )
123 // #ifdef QT_QTABLE_NOHEADER_CONSTRUCTOR 123 // #ifdef QT_QTABLE_NOHEADER_CONSTRUCTOR
124 // : QTable( 0, 0, parent, name, TRUE ), 124 // : QTable( 0, 0, parent, name, TRUE ),
125 // #else 125 // #else
126 : QTable( parent, name ), 126 : QTable( parent, name ),
127 // #endif 127 // #endif
128 lastSortCol( -1 ), 128 lastSortCol( -1 ),
129 asc( TRUE ), 129 asc( TRUE ),
130 intFields( order ), 130 intFields( order ),
131 currFindRow( -2 ), 131 currFindRow( -2 ),
132 mCat( 0 ), 132 mCat( 0 ),
133 m_contactdb ("addressbook") 133 m_contactdb ("addressbook", 0l, 0l, false) // Handle syncing myself.. !
134{ 134{
135 mCat.load( categoryFileName() ); 135 mCat.load( categoryFileName() );
136 setSelectionMode( NoSelection ); 136 setSelectionMode( NoSelection );
137 init(); 137 init();
138 setSorting( TRUE ); 138 setSorting( TRUE );
139 connect( this, SIGNAL(clicked(int,int,int,const QPoint &)), 139 connect( this, SIGNAL(clicked(int,int,int,const QPoint &)),
140 this, SLOT(itemClicked(int,int)) ); 140 this, SLOT(itemClicked(int,int)) );
141} 141}
142 142
143AbTable::~AbTable() 143AbTable::~AbTable()
144{ 144{
145} 145}
146 146
147void AbTable::init() 147void AbTable::init()
148{ 148{
149 showChar = '\0'; 149 showChar = '\0';
150 setNumRows( 0 ); 150 setNumRows( 0 );
151 setNumCols( 2 ); 151 setNumCols( 2 );
152 152
153 horizontalHeader()->setLabel( 0, tr( "Full Name" )); 153 horizontalHeader()->setLabel( 0, tr( "Full Name" ));
154 horizontalHeader()->setLabel( 1, tr( "Contact" )); 154 horizontalHeader()->setLabel( 1, tr( "Contact" ));
155 setLeftMargin( 0 ); 155 setLeftMargin( 0 );
156 verticalHeader()->hide(); 156 verticalHeader()->hide();
157 columnVisible = true; 157 columnVisible = true;
158} 158}
159 159
160void AbTable::columnClicked( int col ) 160void AbTable::columnClicked( int col )
161{ 161{
162 if ( !sorting() ) 162 if ( !sorting() )
163 return; 163 return;
164 164
165 if ( lastSortCol == -1 ) 165 if ( lastSortCol == -1 )
166 lastSortCol = col; 166 lastSortCol = col;
167 167
168 if ( col == lastSortCol ) { 168 if ( col == lastSortCol ) {
169 asc = !asc; 169 asc = !asc;
170 } else { 170 } else {
171 lastSortCol = col; 171 lastSortCol = col;
172 asc = TRUE; 172 asc = TRUE;
173 } 173 }
174 //QMessageBox::information( this, "resort", "columnClicked" ); 174 //QMessageBox::information( this, "resort", "columnClicked" );
175 resort(); 175 resort();
176} 176}
177 177
178void AbTable::resort() 178void AbTable::resort()
179{ 179{
180 if ( sorting() ) { 180 if ( sorting() ) {
181 if ( lastSortCol == -1 ) 181 if ( lastSortCol == -1 )
182 lastSortCol = 0; 182 lastSortCol = 0;
183 sortColumn( lastSortCol, asc, TRUE ); 183 sortColumn( lastSortCol, asc, TRUE );
184 //QMessageBox::information( this, "resort", "resort" ); 184 //QMessageBox::information( this, "resort", "resort" );
185 updateVisible(); 185 updateVisible();
186 } 186 }
187} 187}
188 188
189OContact AbTable::currentEntry() 189OContact AbTable::currentEntry()
190{ 190{
191 OContact cnt; 191 OContact cnt;
192 AbTableItem *abItem; 192 AbTableItem *abItem;
193 abItem = static_cast<AbTableItem*>(item( currentRow(), 0 )); 193 abItem = static_cast<AbTableItem*>(item( currentRow(), 0 ));
194 if ( abItem ) { 194 if ( abItem ) {
195 cnt = contactList[abItem]; 195 cnt = contactList[abItem];
196 //cnt = contactList[currentRow()]; 196 //cnt = contactList[currentRow()];
197 } 197 }
198 return cnt; 198 return cnt;
199} 199}
200 200
201void AbTable::replaceCurrentEntry( const OContact &newContact ) 201void AbTable::replaceCurrentEntry( const OContact &newContact )
202{ 202{
203 int row = currentRow(); 203 int row = currentRow();
204 updateVisible(); 204 updateVisible();
205 205
206 journalFreeReplace( newContact, row ); 206 journalFreeReplace( newContact, row );
207 207
208} 208}
209 209
210void AbTable::deleteCurrentEntry() 210void AbTable::deleteCurrentEntry()
211{ 211{
212 int row = currentRow(); 212 int row = currentRow();
213 213
214 // a little wasteful, but it ensure's there is only one place 214 // a little wasteful, but it ensure's there is only one place
215 // where we delete. 215 // where we delete.
216 journalFreeRemove( row ); 216 journalFreeRemove( row );
217 updateVisible(); 217 updateVisible();
218 218
219 if ( numRows() == 0 ) 219 if ( numRows() == 0 )
220 emit empty( TRUE ); 220 emit empty( TRUE );
221 221
222} 222}
223 223
224void AbTable::clear() 224void AbTable::clear()
225{ 225{
226 contactList.clear(); 226 contactList.clear();
227 for ( int r = 0; r < numRows(); ++r ) { 227 for ( int r = 0; r < numRows(); ++r ) {
228 for ( int c = 0; c < numCols(); ++c ) { 228 for ( int c = 0; c < numCols(); ++c ) {
229 if ( cellWidget( r, c ) ) 229 if ( cellWidget( r, c ) )
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index bae3a2b..e7f2ebd 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -247,193 +247,192 @@ void ContactEditor::init() {
247 247
248 if ( *it == "Job Title" ) { 248 if ( *it == "Job Title" ) {
249 hasTitle = TRUE; 249 hasTitle = TRUE;
250 //slDynamicEntries->remove( it ); 250 //slDynamicEntries->remove( it );
251 continue; 251 continue;
252 } 252 }
253 253
254 if ( ( *it == "Company") || (*it == "Organization" ) ) { 254 if ( ( *it == "Company") || (*it == "Organization" ) ) {
255 hasCompany = TRUE; 255 hasCompany = TRUE;
256 //slDynamicEntries->remove( it ); 256 //slDynamicEntries->remove( it );
257 continue; 257 continue;
258 } 258 }
259 259
260 if ( *it == "Notes" ) { 260 if ( *it == "Notes" ) {
261 hasNotes = TRUE; 261 hasNotes = TRUE;
262 //slDynamicEntries->remove( it ); 262 //slDynamicEntries->remove( it );
263 continue; 263 continue;
264 } 264 }
265 265
266 if ( *it == "Groups" ) { 266 if ( *it == "Groups" ) {
267 //slDynamicEntries->remove( it ); 267 //slDynamicEntries->remove( it );
268 continue; 268 continue;
269 } 269 }
270 270
271 if ( (*it) == "Business Street" ) { 271 if ( (*it) == "Business Street" ) {
272 hasStreet = TRUE; 272 hasStreet = TRUE;
273 //slDynamicEntries->remove( it ); 273 //slDynamicEntries->remove( it );
274 continue; 274 continue;
275 } 275 }
276 276
277 if ( (*it) == "Home Street" ) { 277 if ( (*it) == "Home Street" ) {
278 hasStreet = TRUE; 278 hasStreet = TRUE;
279 //slDynamicEntries->remove( it ); 279 //slDynamicEntries->remove( it );
280 continue; 280 continue;
281 } 281 }
282/* 282/*
283 if ( (*it).right( 8 ) == tr( "Street 2" ) ) { 283 if ( (*it).right( 8 ) == tr( "Street 2" ) ) {
284 hasStreet2 = TRUE; 284 hasStreet2 = TRUE;
285 //slDynamicEntries->remove( it ); 285 //slDynamicEntries->remove( it );
286 continue; 286 continue;
287 } 287 }
288 288
289 if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { 289 if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) {
290 hasPOBox = TRUE; 290 hasPOBox = TRUE;
291 //slDynamicEntries->remove( it ); 291 //slDynamicEntries->remove( it );
292 continue; 292 continue;
293 } */ 293 } */
294 294
295 if ( (*it) == "Business City" ) { 295 if ( (*it) == "Business City" ) {
296 hasCity = TRUE; 296 hasCity = TRUE;
297 //slDynamicEntries->remove( it ); 297 //slDynamicEntries->remove( it );
298 continue; 298 continue;
299 } 299 }
300 300
301 if ( (*it) == "Business State" ) { 301 if ( (*it) == "Business State" ) {
302 hasState = TRUE; 302 hasState = TRUE;
303 //slDynamicEntries->remove( it ); 303 //slDynamicEntries->remove( it );
304 continue; 304 continue;
305 } 305 }
306 306
307 if ( (*it) == "Business Zip" ) { 307 if ( (*it) == "Business Zip" ) {
308 hasZip = TRUE; 308 hasZip = TRUE;
309 //slDynamicEntries->remove( it ); 309 //slDynamicEntries->remove( it );
310 continue; 310 continue;
311 } 311 }
312 312
313 if ( (*it) == "Business Country" ) { 313 if ( (*it) == "Business Country" ) {
314 hasCountry = TRUE; 314 hasCountry = TRUE;
315 //slDynamicEntries->remove( it ); 315 //slDynamicEntries->remove( it );
316 continue; 316 continue;
317 } 317 }
318 318
319 if ( (*it) == "Home City" ) { 319 if ( (*it) == "Home City" ) {
320 hasCity = TRUE; 320 hasCity = TRUE;
321 //slDynamicEntries->remove( it ); 321 //slDynamicEntries->remove( it );
322 continue; 322 continue;
323 } 323 }
324 324
325 if ( (*it) == "Home State" ) { 325 if ( (*it) == "Home State" ) {
326 hasState = TRUE; 326 hasState = TRUE;
327 //slDynamicEntries->remove( it ); 327 //slDynamicEntries->remove( it );
328 continue; 328 continue;
329 } 329 }
330 330
331 if ( (*it) == "Home Zip" ) { 331 if ( (*it) == "Home Zip" ) {
332 hasZip = TRUE; 332 hasZip = TRUE;
333 //slDynamicEntries->remove( it ); 333 //slDynamicEntries->remove( it );
334 continue; 334 continue;
335 } 335 }
336 336
337 if ( (*it) == "Home Country" ) { 337 if ( (*it) == "Home Country" ) {
338 hasCountry = TRUE; 338 hasCountry = TRUE;
339 //slDynamicEntries->remove( it ); 339 //slDynamicEntries->remove( it );
340 continue; 340 continue;
341 } 341 }
342 342
343
344 slDynamicEntries.append( *it ); 343 slDynamicEntries.append( *it );
345 } 344 }
346 } 345 }
347 346
348 QVBoxLayout *vb = new QVBoxLayout( this ); 347 QVBoxLayout *vb = new QVBoxLayout( this );
349 348
350 tabMain = new QTabWidget( this ); 349 tabMain = new QTabWidget( this );
351 vb->addWidget( tabMain ); 350 vb->addWidget( tabMain );
352 351
353 QWidget *tabViewport = new QWidget ( tabMain ); 352 QWidget *tabViewport = new QWidget ( tabMain );
354 353
355 vb = new QVBoxLayout( tabViewport ); 354 vb = new QVBoxLayout( tabViewport );
356 355
357 svGeneral = new QScrollView( tabViewport ); 356 svGeneral = new QScrollView( tabViewport );
358 vb->addWidget( svGeneral, 0, 0 ); 357 vb->addWidget( svGeneral, 0, 0 );
359 svGeneral->setResizePolicy( QScrollView::AutoOneFit ); 358 svGeneral->setResizePolicy( QScrollView::AutoOneFit );
360 svGeneral->setFrameStyle( QFrame::NoFrame ); 359 svGeneral->setFrameStyle( QFrame::NoFrame );
361 360
362 QWidget *container = new QWidget( svGeneral->viewport() ); 361 QWidget *container = new QWidget( svGeneral->viewport() );
363 svGeneral->addChild( container ); 362 svGeneral->addChild( container );
364 363
365 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); 364 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 );
366 gl->setResizeMode( QLayout::FreeResize ); 365 gl->setResizeMode( QLayout::FreeResize );
367 366
368 btnFullName = new QPushButton( tr( "Full Name..." ), container ); 367 btnFullName = new QPushButton( tr( "Full Name..." ), container );
369 gl->addWidget( btnFullName, 0, 0 ); 368 gl->addWidget( btnFullName, 0, 0 );
370 txtFullName = new QLineEdit( container ); 369 txtFullName = new QLineEdit( container );
371 gl->addWidget( txtFullName, 0, 1 ); 370 gl->addWidget( txtFullName, 0, 1 );
372 371
373 QLabel *l = new QLabel( tr( "Job Title" ), container ); 372 QLabel *l = new QLabel( tr( "Job Title" ), container );
374 gl->addWidget( l, 1, 0 ); 373 gl->addWidget( l, 1, 0 );
375 txtJobTitle = new QLineEdit( container ); 374 txtJobTitle = new QLineEdit( container );
376 gl->addWidget( txtJobTitle, 1, 1 ); 375 gl->addWidget( txtJobTitle, 1, 1 );
377 376
378 l = new QLabel( tr( "Organization" ), container ); 377 l = new QLabel( tr( "Organization" ), container );
379 gl->addWidget( l, 2, 0 ); 378 gl->addWidget( l, 2, 0 );
380 txtOrganization = new QLineEdit( container ); 379 txtOrganization = new QLineEdit( container );
381 gl->addWidget( txtOrganization, 2, 1 ); 380 gl->addWidget( txtOrganization, 2, 1 );
382 381
383 cmbChooserField1 = new QComboBox( FALSE, container ); 382 cmbChooserField1 = new QComboBox( FALSE, container );
384 cmbChooserField1->setMaximumWidth( 90 ); 383 cmbChooserField1->setMaximumWidth( 90 );
385 gl->addWidget( cmbChooserField1, 3, 0 ); 384 gl->addWidget( cmbChooserField1, 3, 0 );
386 txtChooserField1 = new QLineEdit( container ); 385 txtChooserField1 = new QLineEdit( container );
387 gl->addWidget( txtChooserField1, 3, 1 ); 386 gl->addWidget( txtChooserField1, 3, 1 );
388 387
389 cmbChooserField2 = new QComboBox( FALSE, container ); 388 cmbChooserField2 = new QComboBox( FALSE, container );
390 cmbChooserField2->setMaximumWidth( 90 ); 389 cmbChooserField2->setMaximumWidth( 90 );
391 gl->addWidget( cmbChooserField2, 4, 0 ); 390 gl->addWidget( cmbChooserField2, 4, 0 );
392 txtChooserField2 = new QLineEdit( container ); 391 txtChooserField2 = new QLineEdit( container );
393 gl->addWidget( txtChooserField2, 4, 1 ); 392 gl->addWidget( txtChooserField2, 4, 1 );
394 393
395 cmbChooserField3 = new QComboBox( FALSE, container ); 394 cmbChooserField3 = new QComboBox( FALSE, container );
396 cmbChooserField3->setMaximumWidth( 90 ); 395 cmbChooserField3->setMaximumWidth( 90 );
397 gl->addWidget( cmbChooserField3, 5, 0 ); 396 gl->addWidget( cmbChooserField3, 5, 0 );
398 txtChooserField3 = new QLineEdit( container ); 397 txtChooserField3 = new QLineEdit( container );
399 gl->addWidget( txtChooserField3, 5, 1 ); 398 gl->addWidget( txtChooserField3, 5, 1 );
400 399
401 l = new QLabel( tr( "File As" ), container ); 400 l = new QLabel( tr( "File As" ), container );
402 gl->addWidget( l, 6, 0 ); 401 gl->addWidget( l, 6, 0 );
403 cmbFileAs = new QComboBox( TRUE, container ); 402 cmbFileAs = new QComboBox( TRUE, container );
404 gl->addWidget( cmbFileAs, 6, 1 ); 403 gl->addWidget( cmbFileAs, 6, 1 );
405 404
406 l = new QLabel( tr( "Category" ), container ); 405 l = new QLabel( tr( "Category" ), container );
407 gl->addWidget( l, 7, 0 ); 406 gl->addWidget( l, 7, 0 );
408 cmbCat = new CategorySelect( container ); 407 cmbCat = new CategorySelect( container );
409 gl->addWidget( cmbCat, 7, 1 ); 408 gl->addWidget( cmbCat, 7, 1 );
410 409
411 btnNote = new QPushButton( tr( "Notes..." ), container ); 410 btnNote = new QPushButton( tr( "Notes..." ), container );
412 gl->addWidget( btnNote, 8, 1 ); 411 gl->addWidget( btnNote, 8, 1 );
413 412
414 tabMain->insertTab( tabViewport, tr( "General" ) ); 413 tabMain->insertTab( tabViewport, tr( "General" ) );
415 414
416 tabViewport = new QWidget ( tabMain ); 415 tabViewport = new QWidget ( tabMain );
417 416
418 vb = new QVBoxLayout( tabViewport ); 417 vb = new QVBoxLayout( tabViewport );
419 418
420 svAddress = new QScrollView( tabViewport ); 419 svAddress = new QScrollView( tabViewport );
421 vb->addWidget( svAddress, 0, 0 ); 420 vb->addWidget( svAddress, 0, 0 );
422 svAddress->setResizePolicy( QScrollView::AutoOneFit ); 421 svAddress->setResizePolicy( QScrollView::AutoOneFit );
423 svAddress->setFrameStyle( QFrame::NoFrame ); 422 svAddress->setFrameStyle( QFrame::NoFrame );
424 423
425 container = new QWidget( svAddress->viewport() ); 424 container = new QWidget( svAddress->viewport() );
426 svAddress->addChild( container ); 425 svAddress->addChild( container );
427 426
428 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem 427 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem
429 428
430 cmbAddress = new QComboBox( FALSE, container ); 429 cmbAddress = new QComboBox( FALSE, container );
431 cmbAddress->insertItem( tr( "Business" ) ); 430 cmbAddress->insertItem( tr( "Business" ) );
432 cmbAddress->insertItem( tr( "Home" ) ); 431 cmbAddress->insertItem( tr( "Home" ) );
433 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); 432 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 );
434 433
435 l = new QLabel( tr( "Address" ), container ); 434 l = new QLabel( tr( "Address" ), container );
436 gl->addWidget( l, 1, 0 ); 435 gl->addWidget( l, 1, 0 );
437 txtAddress = new QLineEdit( container ); 436 txtAddress = new QLineEdit( container );
438 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); 437 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 );
439/* 438/*
@@ -615,201 +614,204 @@ void ContactEditor::init() {
615 cmbCountry->insertItem( tr ( "Norway" ) ); 614 cmbCountry->insertItem( tr ( "Norway" ) );
616 cmbCountry->insertItem( tr ( "Oman" ) ); 615 cmbCountry->insertItem( tr ( "Oman" ) );
617 cmbCountry->insertItem( tr ( "Pakistan" ) ); 616 cmbCountry->insertItem( tr ( "Pakistan" ) );
618 cmbCountry->insertItem( tr ( "Palau" ) ); 617 cmbCountry->insertItem( tr ( "Palau" ) );
619 cmbCountry->insertItem( tr ( "Palestinian Territory" ) ); 618 cmbCountry->insertItem( tr ( "Palestinian Territory" ) );
620 cmbCountry->insertItem( tr ( "Panama" ) ); 619 cmbCountry->insertItem( tr ( "Panama" ) );
621 cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); 620 cmbCountry->insertItem( tr ( "Papua New Guinea" ) );
622 cmbCountry->insertItem( tr ( "Paraguay" ) ); 621 cmbCountry->insertItem( tr ( "Paraguay" ) );
623 cmbCountry->insertItem( tr ( "Peru" ) ); 622 cmbCountry->insertItem( tr ( "Peru" ) );
624 cmbCountry->insertItem( tr ( "Philippines" ) ); 623 cmbCountry->insertItem( tr ( "Philippines" ) );
625 cmbCountry->insertItem( tr ( "Pitcairn" ) ); 624 cmbCountry->insertItem( tr ( "Pitcairn" ) );
626 cmbCountry->insertItem( tr ( "Poland" ) ); 625 cmbCountry->insertItem( tr ( "Poland" ) );
627 cmbCountry->insertItem( tr ( "Portugal" ) ); 626 cmbCountry->insertItem( tr ( "Portugal" ) );
628 cmbCountry->insertItem( tr ( "Puerto Rico" ) ); 627 cmbCountry->insertItem( tr ( "Puerto Rico" ) );
629 cmbCountry->insertItem( tr ( "Qatar" ) ); 628 cmbCountry->insertItem( tr ( "Qatar" ) );
630 cmbCountry->insertItem( tr ( "Reunion" ) ); 629 cmbCountry->insertItem( tr ( "Reunion" ) );
631 cmbCountry->insertItem( tr ( "Romania" ) ); 630 cmbCountry->insertItem( tr ( "Romania" ) );
632 cmbCountry->insertItem( tr ( "Russia" ) ); 631 cmbCountry->insertItem( tr ( "Russia" ) );
633 cmbCountry->insertItem( tr ( "Rwanda" ) ); 632 cmbCountry->insertItem( tr ( "Rwanda" ) );
634 cmbCountry->insertItem( tr ( "Saint Lucia" ) ); 633 cmbCountry->insertItem( tr ( "Saint Lucia" ) );
635 cmbCountry->insertItem( tr ( "Samoa" ) ); 634 cmbCountry->insertItem( tr ( "Samoa" ) );
636 cmbCountry->insertItem( tr ( "San Marino" ) ); 635 cmbCountry->insertItem( tr ( "San Marino" ) );
637 cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); 636 cmbCountry->insertItem( tr ( "Saudi Arabia" ) );
638 cmbCountry->insertItem( tr ( "Senegal" ) ); 637 cmbCountry->insertItem( tr ( "Senegal" ) );
639 cmbCountry->insertItem( tr ( "Seychelles" ) ); 638 cmbCountry->insertItem( tr ( "Seychelles" ) );
640 cmbCountry->insertItem( tr ( "Sierra Leone" ) ); 639 cmbCountry->insertItem( tr ( "Sierra Leone" ) );
641 cmbCountry->insertItem( tr ( "Singapore" ) ); 640 cmbCountry->insertItem( tr ( "Singapore" ) );
642 cmbCountry->insertItem( tr ( "Slovakia" ) ); 641 cmbCountry->insertItem( tr ( "Slovakia" ) );
643 cmbCountry->insertItem( tr ( "Slovenia" ) ); 642 cmbCountry->insertItem( tr ( "Slovenia" ) );
644 cmbCountry->insertItem( tr ( "Solomon Islands" ) ); 643 cmbCountry->insertItem( tr ( "Solomon Islands" ) );
645 cmbCountry->insertItem( tr ( "Somalia" ) ); 644 cmbCountry->insertItem( tr ( "Somalia" ) );
646 cmbCountry->insertItem( tr ( "South Africa" ) ); 645 cmbCountry->insertItem( tr ( "South Africa" ) );
647 cmbCountry->insertItem( tr ( "Spain" ) ); 646 cmbCountry->insertItem( tr ( "Spain" ) );
648 cmbCountry->insertItem( tr ( "Sri Lanka" ) ); 647 cmbCountry->insertItem( tr ( "Sri Lanka" ) );
649 cmbCountry->insertItem( tr ( "St. Helena" ) ); 648 cmbCountry->insertItem( tr ( "St. Helena" ) );
650 cmbCountry->insertItem( tr ( "Sudan" ) ); 649 cmbCountry->insertItem( tr ( "Sudan" ) );
651 cmbCountry->insertItem( tr ( "Suriname" ) ); 650 cmbCountry->insertItem( tr ( "Suriname" ) );
652 cmbCountry->insertItem( tr ( "Swaziland" ) ); 651 cmbCountry->insertItem( tr ( "Swaziland" ) );
653 cmbCountry->insertItem( tr ( "Sweden" ) ); 652 cmbCountry->insertItem( tr ( "Sweden" ) );
654 cmbCountry->insertItem( tr ( "Switzerland" ) ); 653 cmbCountry->insertItem( tr ( "Switzerland" ) );
655 cmbCountry->insertItem( tr ( "Taiwan" ) ); 654 cmbCountry->insertItem( tr ( "Taiwan" ) );
656 cmbCountry->insertItem( tr ( "Tajikistan" ) ); 655 cmbCountry->insertItem( tr ( "Tajikistan" ) );
657 cmbCountry->insertItem( tr ( "Tanzania" ) ); 656 cmbCountry->insertItem( tr ( "Tanzania" ) );
658 cmbCountry->insertItem( tr ( "Thailand" ) ); 657 cmbCountry->insertItem( tr ( "Thailand" ) );
659 cmbCountry->insertItem( tr ( "Togo" ) ); 658 cmbCountry->insertItem( tr ( "Togo" ) );
660 cmbCountry->insertItem( tr ( "Tokelau" ) ); 659 cmbCountry->insertItem( tr ( "Tokelau" ) );
661 cmbCountry->insertItem( tr ( "Tonga" ) ); 660 cmbCountry->insertItem( tr ( "Tonga" ) );
662 cmbCountry->insertItem( tr ( "Tunisia" ) ); 661 cmbCountry->insertItem( tr ( "Tunisia" ) );
663 cmbCountry->insertItem( tr ( "Turkey" ) ); 662 cmbCountry->insertItem( tr ( "Turkey" ) );
664 cmbCountry->insertItem( tr ( "Turkmenistan" ) ); 663 cmbCountry->insertItem( tr ( "Turkmenistan" ) );
665 cmbCountry->insertItem( tr ( "Tuvalu" ) ); 664 cmbCountry->insertItem( tr ( "Tuvalu" ) );
666 cmbCountry->insertItem( tr ( "Uganda" ) ); 665 cmbCountry->insertItem( tr ( "Uganda" ) );
667 cmbCountry->insertItem( tr ( "Ukraine" ) ); 666 cmbCountry->insertItem( tr ( "Ukraine" ) );
668 cmbCountry->insertItem( tr ( "Uruguay" ) ); 667 cmbCountry->insertItem( tr ( "Uruguay" ) );
669 cmbCountry->insertItem( tr ( "Uzbekistan" ) ); 668 cmbCountry->insertItem( tr ( "Uzbekistan" ) );
670 cmbCountry->insertItem( tr ( "Vanuatu" ) ); 669 cmbCountry->insertItem( tr ( "Vanuatu" ) );
671 cmbCountry->insertItem( tr ( "Venezuela" ) ); 670 cmbCountry->insertItem( tr ( "Venezuela" ) );
672 cmbCountry->insertItem( tr ( "Viet Nam" ) ); 671 cmbCountry->insertItem( tr ( "Viet Nam" ) );
673 cmbCountry->insertItem( tr ( "Virgin Islands" ) ); 672 cmbCountry->insertItem( tr ( "Virgin Islands" ) );
674 cmbCountry->insertItem( tr ( "Western Sahara" ) ); 673 cmbCountry->insertItem( tr ( "Western Sahara" ) );
675 cmbCountry->insertItem( tr ( "Yemen" ) ); 674 cmbCountry->insertItem( tr ( "Yemen" ) );
676 cmbCountry->insertItem( tr ( "Yugoslavia" ) ); 675 cmbCountry->insertItem( tr ( "Yugoslavia" ) );
677 cmbCountry->insertItem( tr ( "Zambia" ) ); 676 cmbCountry->insertItem( tr ( "Zambia" ) );
678 cmbCountry->insertItem( tr ( "Zimbabwe" ) ); 677 cmbCountry->insertItem( tr ( "Zimbabwe" ) );
679 678
680 cmbCountry->setMaximumWidth( 135 ); 679 cmbCountry->setMaximumWidth( 135 );
681 680
682 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); 681 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 );
683 682
684 cmbChooserField4 = new QComboBox( FALSE, container ); 683 cmbChooserField4 = new QComboBox( FALSE, container );
685 cmbChooserField4->setMaximumWidth( 90 ); 684 cmbChooserField4->setMaximumWidth( 90 );
686 gl->addWidget( cmbChooserField4, 6, 0 ); 685 gl->addWidget( cmbChooserField4, 6, 0 );
687 txtChooserField4 = new QLineEdit( container ); 686 txtChooserField4 = new QLineEdit( container );
688 gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 ); 687 gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 );
689 688
690 QSpacerItem *space = new QSpacerItem(1,1, 689 QSpacerItem *space = new QSpacerItem(1,1,
691 QSizePolicy::Maximum, 690 QSizePolicy::Maximum,
692 QSizePolicy::MinimumExpanding ); 691 QSizePolicy::MinimumExpanding );
693 gl->addItem( space, 7, 0 ); 692 gl->addItem( space, 7, 0 );
694 693
695 tabMain->insertTab( tabViewport, tr( "Address" ) ); 694 tabMain->insertTab( tabViewport, tr( "Address" ) );
696 695
697 tabViewport = new QWidget ( tabMain ); 696 tabViewport = new QWidget ( tabMain );
698 697
699 vb = new QVBoxLayout( tabViewport ); 698 vb = new QVBoxLayout( tabViewport );
700 699
701 svDetails = new QScrollView( tabViewport ); 700 svDetails = new QScrollView( tabViewport );
702 vb->addWidget( svDetails, 0, 0 ); 701 vb->addWidget( svDetails, 0, 0 );
703 svDetails->setResizePolicy( QScrollView::AutoOneFit ); 702 svDetails->setResizePolicy( QScrollView::AutoOneFit );
704 svDetails->setFrameStyle( QFrame::NoFrame ); 703 svDetails->setFrameStyle( QFrame::NoFrame );
705 704
706 container = new QWidget( svDetails->viewport() ); 705 container = new QWidget( svDetails->viewport() );
707 svDetails->addChild( container ); 706 svDetails->addChild( container );
708 707
709 gl = new QGridLayout( container, 1, 2, 2, 4 ); 708 gl = new QGridLayout( container, 1, 2, 2, 4 );
710 709
710 // Create Labels and lineedit fields for every dynamic entry
711 QStringList::ConstIterator it = slDynamicEntries.begin(); 711 QStringList::ConstIterator it = slDynamicEntries.begin();
712 for (i = 0; it != slDynamicEntries.end(); i++, ++it) { 712 for (i = 0; it != slDynamicEntries.end(); i++, ++it) {
713 l = new QLabel( *it, container ); 713 l = new QLabel( QString::null , container );
714 listName.append( l ); 714 listName.append( l );
715 gl->addWidget( l, i, 0 ); 715 gl->addWidget( l, i, 0 );
716 QLineEdit *e = new QLineEdit( container ); 716 QLineEdit *e = new QLineEdit( container );
717 listValue.append( e ); 717 listValue.append( e );
718 gl->addWidget( e, i, 1); 718 gl->addWidget( e, i, 1);
719 } 719 }
720 // Fill labels with names..
721 loadFields();
720 722
721 l = new QLabel( tr("Gender"), container ); 723 l = new QLabel( tr("Gender"), container );
722 gl->addWidget( l, slDynamicEntries.count(), 0 ); 724 gl->addWidget( l, slDynamicEntries.count(), 0 );
723 cmbGender = new QComboBox( container ); 725 cmbGender = new QComboBox( container );
724 cmbGender->insertItem( "", 0 ); 726 cmbGender->insertItem( "", 0 );
725 cmbGender->insertItem( tr("Male"), 1); 727 cmbGender->insertItem( tr("Male"), 1);
726 cmbGender->insertItem( tr("Female"), 2); 728 cmbGender->insertItem( tr("Female"), 2);
727 gl->addWidget( cmbGender, slDynamicEntries.count(), 1 ); 729 gl->addWidget( cmbGender, slDynamicEntries.count(), 1 );
728 730
729 tabMain->insertTab( tabViewport, tr( "Details" ) ); 731 tabMain->insertTab( tabViewport, tr( "Details" ) );
730 732
731 dlgNote = new QDialog( this, "Note Dialog", TRUE ); 733 dlgNote = new QDialog( this, "Note Dialog", TRUE );
732 dlgNote->setCaption( tr("Enter Note") ); 734 dlgNote->setCaption( tr("Enter Note") );
733 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); 735 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote );
734 txtNote = new QMultiLineEdit( dlgNote ); 736 txtNote = new QMultiLineEdit( dlgNote );
735 vbNote->addWidget( txtNote ); 737 vbNote->addWidget( txtNote );
736 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); 738 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) );
737 739
738 dlgName = new QDialog( this, "Name Dialog", TRUE ); 740 dlgName = new QDialog( this, "Name Dialog", TRUE );
739 dlgName->setCaption( tr("Edit Name") ); 741 dlgName->setCaption( tr("Edit Name") );
740 gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); 742 gl = new QGridLayout( dlgName, 5, 2, 2, 3 );
741 743
742 l = new QLabel( tr("First Name"), dlgName ); 744 l = new QLabel( tr("First Name"), dlgName );
743 gl->addWidget( l, 0, 0 ); 745 gl->addWidget( l, 0, 0 );
744 txtFirstName = new QLineEdit( dlgName ); 746 txtFirstName = new QLineEdit( dlgName );
745 gl->addWidget( txtFirstName, 0, 1 ); 747 gl->addWidget( txtFirstName, 0, 1 );
746 748
747 l = new QLabel( tr("Middle Name"), dlgName ); 749 l = new QLabel( tr("Middle Name"), dlgName );
748 gl->addWidget( l, 1, 0 ); 750 gl->addWidget( l, 1, 0 );
749 txtMiddleName = new QLineEdit( dlgName ); 751 txtMiddleName = new QLineEdit( dlgName );
750 gl->addWidget( txtMiddleName, 1, 1 ); 752 gl->addWidget( txtMiddleName, 1, 1 );
751 753
752 l = new QLabel( tr("Last Name"), dlgName ); 754 l = new QLabel( tr("Last Name"), dlgName );
753 gl->addWidget( l, 2, 0 ); 755 gl->addWidget( l, 2, 0 );
754 txtLastName = new QLineEdit( dlgName ); 756 txtLastName = new QLineEdit( dlgName );
755 gl->addWidget( txtLastName, 2, 1 ); 757 gl->addWidget( txtLastName, 2, 1 );
756 758
757 l = new QLabel( tr("Suffix"), dlgName ); 759 l = new QLabel( tr("Suffix"), dlgName );
758 gl->addWidget( l, 3, 0 ); 760 gl->addWidget( l, 3, 0 );
759 txtSuffix = new QLineEdit( dlgName ); 761 txtSuffix = new QLineEdit( dlgName );
760 gl->addWidget( txtSuffix, 3, 1 ); 762 gl->addWidget( txtSuffix, 3, 1 );
761 space = new QSpacerItem(1,1, 763 space = new QSpacerItem(1,1,
762 QSizePolicy::Maximum, 764 QSizePolicy::Maximum,
763 QSizePolicy::MinimumExpanding ); 765 QSizePolicy::MinimumExpanding );
764 gl->addItem( space, 4, 0 ); 766 gl->addItem( space, 4, 0 );
765 767
766 cmbChooserField1->insertStringList( trlChooserNames ); 768 cmbChooserField1->insertStringList( trlChooserNames );
767 cmbChooserField2->insertStringList( trlChooserNames ); 769 cmbChooserField2->insertStringList( trlChooserNames );
768 cmbChooserField3->insertStringList( trlChooserNames ); 770 cmbChooserField3->insertStringList( trlChooserNames );
769 cmbChooserField4->insertStringList( trlChooserNames ); 771 cmbChooserField4->insertStringList( trlChooserNames );
770 772
771 cmbChooserField1->setCurrentItem( 0 ); 773 cmbChooserField1->setCurrentItem( 0 );
772 cmbChooserField2->setCurrentItem( 1 ); 774 cmbChooserField2->setCurrentItem( 1 );
773 cmbChooserField3->setCurrentItem( 2 ); 775 cmbChooserField3->setCurrentItem( 2 );
774 776
775 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 777 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
776 778
777 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); 779 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) );
778 780
779 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), 781 connect( txtChooserField1, SIGNAL(textChanged(const QString &)),
780 this, SLOT(slotChooser1Change(const QString &)) ); 782 this, SLOT(slotChooser1Change(const QString &)) );
781 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), 783 connect( txtChooserField2, SIGNAL(textChanged(const QString &)),
782 this, SLOT(slotChooser2Change(const QString &)) ); 784 this, SLOT(slotChooser2Change(const QString &)) );
783 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), 785 connect( txtChooserField3, SIGNAL(textChanged(const QString &)),
784 this, SLOT(slotChooser3Change(const QString &)) ); 786 this, SLOT(slotChooser3Change(const QString &)) );
785 connect( txtChooserField4, SIGNAL(textChanged(const QString &)), 787 connect( txtChooserField4, SIGNAL(textChanged(const QString &)),
786 this, SLOT(slotChooser4Change(const QString &)) ); 788 this, SLOT(slotChooser4Change(const QString &)) );
787 connect( txtAddress, SIGNAL(textChanged(const QString &)), 789 connect( txtAddress, SIGNAL(textChanged(const QString &)),
788 this, SLOT(slotAddressChange(const QString &)) ); 790 this, SLOT(slotAddressChange(const QString &)) );
789 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); 791 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) );
790 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); 792 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) );
791 connect( txtCity, SIGNAL(textChanged(const QString &)), 793 connect( txtCity, SIGNAL(textChanged(const QString &)),
792 this, SLOT(slotCityChange(const QString &)) ); 794 this, SLOT(slotCityChange(const QString &)) );
793 connect( txtState, SIGNAL(textChanged(const QString &)), 795 connect( txtState, SIGNAL(textChanged(const QString &)),
794 this, SLOT(slotStateChange(const QString &)) ); 796 this, SLOT(slotStateChange(const QString &)) );
795 connect( txtZip, SIGNAL(textChanged(const QString &)), 797 connect( txtZip, SIGNAL(textChanged(const QString &)),
796 this, SLOT(slotZipChange(const QString &)) ); 798 this, SLOT(slotZipChange(const QString &)) );
797 connect( cmbCountry, SIGNAL(textChanged(const QString &)), 799 connect( cmbCountry, SIGNAL(textChanged(const QString &)),
798 this, SLOT(slotCountryChange(const QString &)) ); 800 this, SLOT(slotCountryChange(const QString &)) );
799 connect( cmbCountry, SIGNAL(activated(const QString &)), 801 connect( cmbCountry, SIGNAL(activated(const QString &)),
800 this, SLOT(slotCountryChange(const QString &)) ); 802 this, SLOT(slotCountryChange(const QString &)) );
801 connect( cmbChooserField1, SIGNAL(activated(int)), 803 connect( cmbChooserField1, SIGNAL(activated(int)),
802 this, SLOT(slotCmbChooser1Change(int)) ); 804 this, SLOT(slotCmbChooser1Change(int)) );
803 connect( cmbChooserField2, SIGNAL(activated(int)), 805 connect( cmbChooserField2, SIGNAL(activated(int)),
804 this, SLOT(slotCmbChooser2Change(int)) ); 806 this, SLOT(slotCmbChooser2Change(int)) );
805 connect( cmbChooserField3, SIGNAL(activated(int)), 807 connect( cmbChooserField3, SIGNAL(activated(int)),
806 this, SLOT(slotCmbChooser3Change(int)) ); 808 this, SLOT(slotCmbChooser3Change(int)) );
807 connect( cmbChooserField4, SIGNAL(activated(int)), 809 connect( cmbChooserField4, SIGNAL(activated(int)),
808 this, SLOT(slotCmbChooser4Change(int)) ); 810 this, SLOT(slotCmbChooser4Change(int)) );
809 connect( cmbAddress, SIGNAL(activated(int)), 811 connect( cmbAddress, SIGNAL(activated(int)),
810 this, SLOT(slotAddressTypeChange(int)) ); 812 this, SLOT(slotAddressTypeChange(int)) );
811 813
812 new QPEDialogListener(this); 814 new QPEDialogListener(this);
813} 815}
814 816
815void ContactEditor::initMap() 817void ContactEditor::initMap()
@@ -919,193 +921,225 @@ void ContactEditor::slotStateChange( const QString &textChanged ) {
919} 921}
920 922
921void ContactEditor::slotZipChange( const QString &textChanged ) { 923void ContactEditor::slotZipChange( const QString &textChanged ) {
922 924
923 if ( cmbAddress->currentItem() == 0 ) { 925 if ( cmbAddress->currentItem() == 0 ) {
924 slBusinessAddress[5] = textChanged; 926 slBusinessAddress[5] = textChanged;
925 } else { 927 } else {
926 slHomeAddress[5] = textChanged; 928 slHomeAddress[5] = textChanged;
927 } 929 }
928} 930}
929 931
930void ContactEditor::slotCountryChange( const QString &textChanged ) { 932void ContactEditor::slotCountryChange( const QString &textChanged ) {
931 933
932 if ( cmbAddress->currentItem() == 0 ) { 934 if ( cmbAddress->currentItem() == 0 ) {
933 slBusinessAddress[6] = textChanged; 935 slBusinessAddress[6] = textChanged;
934 } else { 936 } else {
935 slHomeAddress[6] = textChanged; 937 slHomeAddress[6] = textChanged;
936 } 938 }
937} 939}
938 940
939void ContactEditor::slotCmbChooser1Change( int index ) { 941void ContactEditor::slotCmbChooser1Change( int index ) {
940 942
941 txtChooserField1->setText( slChooserValues[index] ); 943 txtChooserField1->setText( slChooserValues[index] );
942 txtChooserField1->setFocus(); 944 txtChooserField1->setFocus();
943} 945}
944 946
945void ContactEditor::slotCmbChooser2Change( int index ) { 947void ContactEditor::slotCmbChooser2Change( int index ) {
946 948
947 txtChooserField2->setText( slChooserValues[index] ); 949 txtChooserField2->setText( slChooserValues[index] );
948 txtChooserField2->setFocus(); 950 txtChooserField2->setFocus();
949} 951}
950 952
951void ContactEditor::slotCmbChooser3Change( int index ) { 953void ContactEditor::slotCmbChooser3Change( int index ) {
952 954
953 txtChooserField3->setText( slChooserValues[index] ); 955 txtChooserField3->setText( slChooserValues[index] );
954 txtChooserField3->setFocus(); 956 txtChooserField3->setFocus();
955 957
956} 958}
957 959
958void ContactEditor::slotCmbChooser4Change( int index ) { 960void ContactEditor::slotCmbChooser4Change( int index ) {
959 961
960 txtChooserField4->setText( slChooserValues[index] ); 962 txtChooserField4->setText( slChooserValues[index] );
961 txtChooserField4->setFocus(); 963 txtChooserField4->setFocus();
962 964
963} 965}
964 966
965void ContactEditor::slotAddressTypeChange( int index ) { 967void ContactEditor::slotAddressTypeChange( int index ) {
966 968
967 if ( index == 0 ) { 969 if ( index == 0 ) {
968 970
969 txtAddress->setText( slBusinessAddress[0] ); 971 txtAddress->setText( slBusinessAddress[0] );
970 //txtAddress2->setText( (*slBusinessAddress)[1] ); 972 //txtAddress2->setText( (*slBusinessAddress)[1] );
971 //txtPOBox->setText( (*slBusinessAddress)[2] ); 973 //txtPOBox->setText( (*slBusinessAddress)[2] );
972 txtCity->setText( slBusinessAddress[3] ); 974 txtCity->setText( slBusinessAddress[3] );
973 txtState->setText( slBusinessAddress[4] ); 975 txtState->setText( slBusinessAddress[4] );
974 txtZip->setText( slBusinessAddress[5] ); 976 txtZip->setText( slBusinessAddress[5] );
975 QLineEdit *txtTmp = cmbCountry->lineEdit(); 977 QLineEdit *txtTmp = cmbCountry->lineEdit();
976 txtTmp->setText( slBusinessAddress[6] ); 978 txtTmp->setText( slBusinessAddress[6] );
977 979
978 } else { 980 } else {
979 981
980 txtAddress->setText( slHomeAddress[0] ); 982 txtAddress->setText( slHomeAddress[0] );
981 //txtAddress2->setText( (*slHomeAddress)[1] ); 983 //txtAddress2->setText( (*slHomeAddress)[1] );
982 //txtPOBox->setText( (*slHomeAddress)[2] ); 984 //txtPOBox->setText( (*slHomeAddress)[2] );
983 txtCity->setText( slHomeAddress[3] ); 985 txtCity->setText( slHomeAddress[3] );
984 txtState->setText( slHomeAddress[4] ); 986 txtState->setText( slHomeAddress[4] );
985 txtZip->setText( slHomeAddress[5] ); 987 txtZip->setText( slHomeAddress[5] );
986 QLineEdit *txtTmp = cmbCountry->lineEdit(); 988 QLineEdit *txtTmp = cmbCountry->lineEdit();
987 txtTmp->setText( slHomeAddress[6] ); 989 txtTmp->setText( slHomeAddress[6] );
988 990
989 } 991 }
990 992
991} 993}
992 994
993void ContactEditor::slotFullNameChange( const QString &textChanged ) { 995void ContactEditor::slotFullNameChange( const QString &textChanged ) {
994 996
995 int index = cmbFileAs->currentItem(); 997 int index = cmbFileAs->currentItem();
996 998
997 cmbFileAs->clear(); 999 cmbFileAs->clear();
998 1000
999 cmbFileAs->insertItem( parseName( textChanged, 0 ) ); 1001 cmbFileAs->insertItem( parseName( textChanged, 0 ) );
1000 cmbFileAs->insertItem( parseName( textChanged, 1 ) ); 1002 cmbFileAs->insertItem( parseName( textChanged, 1 ) );
1001 cmbFileAs->insertItem( parseName( textChanged, 2 ) ); 1003 cmbFileAs->insertItem( parseName( textChanged, 2 ) );
1002 cmbFileAs->insertItem( parseName( textChanged, 3 ) ); 1004 cmbFileAs->insertItem( parseName( textChanged, 3 ) );
1003 1005
1004 cmbFileAs->setCurrentItem( index ); 1006 cmbFileAs->setCurrentItem( index );
1005 1007
1006 useFullName = TRUE; 1008 useFullName = TRUE;
1007 1009
1008} 1010}
1009 1011
1010void ContactEditor::loadFields() { 1012void ContactEditor::loadFields() {
1011 1013
1012 QStringList::ConstIterator it; 1014 QStringList::ConstIterator it;
1013 QListIterator<QLabel> lit( listName ); 1015 QListIterator<QLabel> lit( listName );
1014 for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) { 1016 for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) {
1015 (*lit)->setText( *it ); 1017
1018 if ( *it == "Department" )
1019 (*lit)->setText( tr( "Department" ) );
1020
1021 if ( *it == "Company" )
1022 (*lit)->setText( tr( "Company" ) );
1023
1024 if ( *it == "Office" )
1025 (*lit)->setText( tr( "Office" ) );
1026
1027 if ( *it == "Profession" )
1028 (*lit)->setText( tr( "Profession" ) );
1029
1030 if ( *it == "Assistant" )
1031 (*lit)->setText( tr( "Assistant" ) );
1032
1033 if ( *it == "Manager" )
1034 (*lit)->setText( tr( "Manager" ) );
1035
1036 if ( *it == "Spouse" )
1037 (*lit)->setText( tr( "Spouse" ) );
1038
1039 if ( *it == "Birthday" )
1040 (*lit)->setText( tr( "Birthday" ) );
1041
1042 if ( *it == "Anniversary" )
1043 (*lit)->setText( tr( "Anniversary" ) );
1044
1045 if ( *it == "Nickname" )
1046 (*lit)->setText( tr( "Nickname" ) );
1047
1048 if ( *it == "Children" )
1049 (*lit)->setText( tr( "Children" ) );
1016 } 1050 }
1017} 1051}
1018 1052
1019void ContactEditor::accept() { 1053void ContactEditor::accept() {
1020 1054
1021 if ( isEmpty() ) { 1055 if ( isEmpty() ) {
1022 cleanupFields(); 1056 cleanupFields();
1023 reject(); 1057 reject();
1024 } else { 1058 } else {
1025 saveEntry(); 1059 saveEntry();
1026 cleanupFields(); 1060 cleanupFields();
1027 QDialog::accept(); 1061 QDialog::accept();
1028 } 1062 }
1029 1063
1030} 1064}
1031 1065
1032void ContactEditor::slotNote() { 1066void ContactEditor::slotNote() {
1033 1067
1034 dlgNote->showMaximized(); 1068 dlgNote->showMaximized();
1035 if ( !dlgNote->exec() ) { 1069 if ( !dlgNote->exec() ) {
1036 txtNote->setText( ent.notes() ); 1070 txtNote->setText( ent.notes() );
1037 } 1071 }
1038} 1072}
1039 1073
1040void ContactEditor::slotName() { 1074void ContactEditor::slotName() {
1041 1075
1042 QString tmpName; 1076 QString tmpName;
1043 if (useFullName == TRUE) { 1077 if (useFullName == TRUE) {
1044 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); 1078 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) );
1045 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); 1079 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) );
1046 txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); 1080 txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
1047 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); 1081 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
1048 } 1082 }
1049 dlgName->showMaximized(); 1083 dlgName->showMaximized();
1050 if ( dlgName->exec() ) { 1084 if ( dlgName->exec() ) {
1051 1085
1052 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); 1086 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text();
1053 txtFullName->setText( tmpName.simplifyWhiteSpace() ); 1087 txtFullName->setText( tmpName.simplifyWhiteSpace() );
1054 slotFullNameChange( txtFullName->text() ); 1088 slotFullNameChange( txtFullName->text() );
1055 useFullName = FALSE; 1089 useFullName = FALSE;
1056 } 1090 }
1057 1091
1058} 1092}
1059 1093
1060void ContactEditor::setNameFocus() { 1094void ContactEditor::setNameFocus() {
1061 1095
1062 txtFullName->setFocus(); 1096 txtFullName->setFocus();
1063 1097
1064} 1098}
1065 1099
1066bool ContactEditor::isEmpty() { 1100bool ContactEditor::isEmpty() {
1067 // Test and see if the record should be saved. 1101 // Test and see if the record should be saved.
1068 // More strict than the original qtopia, needs name or fileas to save 1102 // More strict than the original qtopia, needs name or fileas to save
1069 1103
1070 QString t = txtFullName->text(); 1104 QString t = txtFullName->text();
1071 if ( !t.isEmpty() && containsAlphaNum( t ) ) 1105 if ( !t.isEmpty() && containsAlphaNum( t ) )
1072 return false; 1106 return false;
1073 1107
1074 t = cmbFileAs->currentText(); 1108 t = cmbFileAs->currentText();
1075 if ( !t.isEmpty() && containsAlphaNum( t ) ) 1109 if ( !t.isEmpty() && containsAlphaNum( t ) )
1076 return false; 1110 return false;
1077 1111
1078 return true; 1112 return true;
1079 1113
1080} 1114}
1081 1115
1082QString ContactEditor::parseName( const QString fullName, int type ) { 1116QString ContactEditor::parseName( const QString fullName, int type ) {
1083 1117
1084 QString simplifiedName( fullName.simplifyWhiteSpace() ); 1118 QString simplifiedName( fullName.simplifyWhiteSpace() );
1085 QString strFirstName; 1119 QString strFirstName;
1086 QString strMiddleName; 1120 QString strMiddleName;
1087 QString strLastName; 1121 QString strLastName;
1088 QString strSuffix; 1122 QString strSuffix;
1089 QString strTitle; 1123 QString strTitle;
1090 int commapos; 1124 int commapos;
1091 int spCount; 1125 int spCount;
1092 int spPos; 1126 int spPos;
1093 int spPos2; 1127 int spPos2;
1094 1128
1095 1129
1096 commapos = simplifiedName.find( ',', 0, TRUE); 1130 commapos = simplifiedName.find( ',', 0, TRUE);
1097 spCount = simplifiedName.contains( ' ', TRUE ); 1131 spCount = simplifiedName.contains( ' ', TRUE );
1098 1132
1099 if ( commapos == -1 ) { 1133 if ( commapos == -1 ) {
1100 1134
1101 switch (spCount) { 1135 switch (spCount) {
1102 case 0: 1136 case 0:
1103 //return simplifiedName; 1137 //return simplifiedName;
1104 if (txtLastName->text() != "") { 1138 if (txtLastName->text() != "") {
1105 strLastName = simplifiedName; 1139 strLastName = simplifiedName;
1106 break; 1140 break;
1107 } 1141 }
1108 if (txtMiddleName->text() != "") { 1142 if (txtMiddleName->text() != "") {
1109 strMiddleName = simplifiedName; 1143 strMiddleName = simplifiedName;
1110 break; 1144 break;
1111 } 1145 }
@@ -1281,421 +1315,421 @@ void ContactEditor::cleanupFields() {
1281 for ( cit = slDynamicEntries.begin(); cit != slDynamicEntries.end(); ++cit, ++itLE) { 1315 for ( cit = slDynamicEntries.begin(); cit != slDynamicEntries.end(); ++cit, ++itLE) {
1282 (*itLE)->setText( "" ); 1316 (*itLE)->setText( "" );
1283 } 1317 }
1284 1318
1285 txtFirstName->setText(""); 1319 txtFirstName->setText("");
1286 txtMiddleName->setText(""); 1320 txtMiddleName->setText("");
1287 txtLastName->setText(""); 1321 txtLastName->setText("");
1288 txtSuffix->setText(""); 1322 txtSuffix->setText("");
1289 txtNote->setText(""); 1323 txtNote->setText("");
1290 txtFullName->setText(""); 1324 txtFullName->setText("");
1291 txtJobTitle->setText(""); 1325 txtJobTitle->setText("");
1292 txtOrganization->setText(""); 1326 txtOrganization->setText("");
1293 txtChooserField1->setText(""); 1327 txtChooserField1->setText("");
1294 txtChooserField2->setText(""); 1328 txtChooserField2->setText("");
1295 txtChooserField3->setText(""); 1329 txtChooserField3->setText("");
1296 txtAddress->setText(""); 1330 txtAddress->setText("");
1297 //txtAddress2->setText(""); 1331 //txtAddress2->setText("");
1298 txtCity->setText(""); 1332 txtCity->setText("");
1299 //txtPOBox->setText(""); 1333 //txtPOBox->setText("");
1300 txtState->setText(""); 1334 txtState->setText("");
1301 txtZip->setText(""); 1335 txtZip->setText("");
1302 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1336 QLineEdit *txtTmp = cmbCountry->lineEdit();
1303 txtTmp->setText(""); 1337 txtTmp->setText("");
1304 txtTmp = cmbFileAs->lineEdit(); 1338 txtTmp = cmbFileAs->lineEdit();
1305 txtTmp->setText(""); 1339 txtTmp->setText("");
1306 1340
1307} 1341}
1308 1342
1309void ContactEditor::setEntry( const OContact &entry ) { 1343void ContactEditor::setEntry( const OContact &entry ) {
1310 1344
1311 cleanupFields(); 1345 cleanupFields();
1312 1346
1313 1347
1314 ent = entry; 1348 ent = entry;
1315 1349
1316 useFullName = FALSE; 1350 useFullName = FALSE;
1317 txtFirstName->setText( ent.firstName() ); 1351 txtFirstName->setText( ent.firstName() );
1318 txtMiddleName->setText( ent.middleName() ); 1352 txtMiddleName->setText( ent.middleName() );
1319 txtLastName->setText( ent.lastName() ); 1353 txtLastName->setText( ent.lastName() );
1320 txtSuffix->setText( ent.suffix() ); 1354 txtSuffix->setText( ent.suffix() );
1321 1355
1322 QString *tmpString = new QString; 1356 QString *tmpString = new QString;
1323 *tmpString = ent.firstName() + " " + ent.middleName() + 1357 *tmpString = ent.firstName() + " " + ent.middleName() +
1324 + " " + ent.lastName() + " " + ent.suffix(); 1358 + " " + ent.lastName() + " " + ent.suffix();
1325 1359
1326 txtFullName->setText( tmpString->simplifyWhiteSpace() ); 1360 txtFullName->setText( tmpString->simplifyWhiteSpace() );
1327 1361
1328 cmbFileAs->setEditText( ent.fileAs() ); 1362 cmbFileAs->setEditText( ent.fileAs() );
1329 1363
1330 if (hasTitle) 1364 if (hasTitle)
1331 txtJobTitle->setText( ent.jobTitle() ); 1365 txtJobTitle->setText( ent.jobTitle() );
1332 1366
1333 if (hasCompany) 1367 if (hasCompany)
1334 txtOrganization->setText( ent.company() ); 1368 txtOrganization->setText( ent.company() );
1335 1369
1336 if (hasNotes) 1370 if (hasNotes)
1337 txtNote->setText( ent.notes() ); 1371 txtNote->setText( ent.notes() );
1338 1372
1339 if (hasStreet) { 1373 if (hasStreet) {
1340 slHomeAddress[0] = ent.homeStreet(); 1374 slHomeAddress[0] = ent.homeStreet();
1341 slBusinessAddress[0] = ent.businessStreet(); 1375 slBusinessAddress[0] = ent.businessStreet();
1342 } 1376 }
1343/* 1377/*
1344 if (hasStreet2) { 1378 if (hasStreet2) {
1345 (*slHomeAddress)[1] = ent.homeStreet2(); 1379 (*slHomeAddress)[1] = ent.homeStreet2();
1346 (*slBusinessAddress)[1] = ent.businessStreet2(); 1380 (*slBusinessAddress)[1] = ent.businessStreet2();
1347 } 1381 }
1348 1382
1349 if (hasPOBox) { 1383 if (hasPOBox) {
1350 (*slHomeAddress)[2] = ent.homePOBox(); 1384 (*slHomeAddress)[2] = ent.homePOBox();
1351 (*slBusinessAddress)[2] = ent.businessPOBox(); 1385 (*slBusinessAddress)[2] = ent.businessPOBox();
1352 } 1386 }
1353*/ 1387*/
1354 if (hasCity) { 1388 if (hasCity) {
1355 slHomeAddress[3] = ent.homeCity(); 1389 slHomeAddress[3] = ent.homeCity();
1356 slBusinessAddress[3] = ent.businessCity(); 1390 slBusinessAddress[3] = ent.businessCity();
1357 } 1391 }
1358 1392
1359 if (hasState) { 1393 if (hasState) {
1360 slHomeAddress[4] = ent.homeState(); 1394 slHomeAddress[4] = ent.homeState();
1361 slBusinessAddress[4] = ent.businessState(); 1395 slBusinessAddress[4] = ent.businessState();
1362 } 1396 }
1363 1397
1364 if (hasZip) { 1398 if (hasZip) {
1365 slHomeAddress[5] = ent.homeZip(); 1399 slHomeAddress[5] = ent.homeZip();
1366 slBusinessAddress[5] = ent.businessZip(); 1400 slBusinessAddress[5] = ent.businessZip();
1367 } 1401 }
1368 1402
1369 if (hasCountry) { 1403 if (hasCountry) {
1370 slHomeAddress[6] = ent.homeCountry(); 1404 slHomeAddress[6] = ent.homeCountry();
1371 slBusinessAddress[6] = ent.businessCountry(); 1405 slBusinessAddress[6] = ent.businessCountry();
1372 } 1406 }
1373 1407
1374 QStringList::ConstIterator it; 1408 QStringList::ConstIterator it;
1375 QListIterator<QLineEdit> itLE( listValue ); 1409 QListIterator<QLineEdit> itLE( listValue );
1376 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { 1410 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) {
1377 if ( *it == tr( "Department" ) ) 1411 if ( *it == "Department" )
1378 (*itLE)->setText( ent.department() ); 1412 (*itLE)->setText( ent.department() );
1379 1413
1380 if ( *it == tr( "Company" ) ) 1414 if ( *it == "Company" )
1381 (*itLE)->setText( ent.company() ); 1415 (*itLE)->setText( ent.company() );
1382 1416
1383 if ( *it == tr( "Office" ) ) 1417 if ( *it == "Office" )
1384 (*itLE)->setText( ent.office() ); 1418 (*itLE)->setText( ent.office() );
1385 1419
1386 if ( *it == tr( "Profession" ) ) 1420 if ( *it == "Profession" )
1387 (*itLE)->setText( ent.profession() ); 1421 (*itLE)->setText( ent.profession() );
1388 1422
1389 if ( *it == tr( "Assistant" ) ) 1423 if ( *it == "Assistant" )
1390 (*itLE)->setText( ent.assistant() ); 1424 (*itLE)->setText( ent.assistant() );
1391 1425
1392 if ( *it == tr( "Manager" ) ) 1426 if ( *it == "Manager" )
1393 (*itLE)->setText( ent.manager() ); 1427 (*itLE)->setText( ent.manager() );
1394 1428
1395 if ( *it == tr( "Spouse" ) ) 1429 if ( *it == "Spouse" )
1396 (*itLE)->setText( ent.spouse() ); 1430 (*itLE)->setText( ent.spouse() );
1397 1431
1398 if ( *it == tr( "Birthday" ) ) 1432 if ( *it == "Birthday" )
1399 (*itLE)->setText( ent.birthday() ); 1433 (*itLE)->setText( ent.birthday() );
1400 1434
1401 if ( *it == tr( "Anniversary" ) ) 1435 if ( *it == "Anniversary" )
1402 (*itLE)->setText( ent.anniversary() ); 1436 (*itLE)->setText( ent.anniversary() );
1403 1437
1404 if ( *it == tr( "Nickname" ) ) 1438 if ( *it == "Nickname" )
1405 (*itLE)->setText( ent.nickname() ); 1439 (*itLE)->setText( ent.nickname() );
1406 1440
1407 if ( *it == tr( "Children" ) ) 1441 if ( *it == "Children" )
1408 (*itLE)->setText( ent.children() ); 1442 (*itLE)->setText( ent.children() );
1409 1443
1410 } 1444 }
1411 1445
1412 QStringList::Iterator itV; 1446 QStringList::Iterator itV;
1413 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1447 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1414 1448
1415 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) 1449 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) )
1416 *itV = ent.businessPhone(); 1450 *itV = ent.businessPhone();
1417/* 1451/*
1418 if ( *it == "Business 2 Phone" ) 1452 if ( *it == "Business 2 Phone" )
1419 *itV = ent.business2Phone(); 1453 *itV = ent.business2Phone();
1420*/ 1454*/
1421 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) 1455 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) )
1422 *itV = ent.businessFax(); 1456 *itV = ent.businessFax();
1423 1457
1424 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) 1458 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) )
1425 *itV = ent.businessMobile(); 1459 *itV = ent.businessMobile();
1426/* 1460/*
1427 if ( *it == "Company Phone" ) 1461 if ( *it == "Company Phone" )
1428 *itV = ent.companyPhone(); 1462 *itV = ent.companyPhone();
1429*/ 1463*/
1430 if ( *it == "Default Email" ) 1464 if ( *it == "Default Email" )
1431 *itV = ent.defaultEmail(); 1465 *itV = ent.defaultEmail();
1432 1466
1433 if ( *it == "Emails" ) 1467 if ( *it == "Emails" )
1434 *itV = ent.emailList().join(", "); // :SX 1468 *itV = ent.emailList().join(", "); // :SX
1435 1469
1436 if ( *it == "Home Phone" ) 1470 if ( *it == "Home Phone" )
1437 *itV = ent.homePhone(); 1471 *itV = ent.homePhone();
1438/* 1472/*
1439 if ( *it == "Home 2 Phone" ) 1473 if ( *it == "Home 2 Phone" )
1440 *itV = ent.home2Phone(); 1474 *itV = ent.home2Phone();
1441*/ 1475*/
1442 if ( *it == "Home Fax" ) 1476 if ( *it == "Home Fax" )
1443 *itV = ent.homeFax(); 1477 *itV = ent.homeFax();
1444 1478
1445 if ( *it == "Home Mobile" ) 1479 if ( *it == "Home Mobile" )
1446 *itV = ent.homeMobile(); 1480 *itV = ent.homeMobile();
1447/* 1481/*
1448 if ( *it == "Car Phone" ) 1482 if ( *it == "Car Phone" )
1449 *itV = ent.carPhone(); 1483 *itV = ent.carPhone();
1450 1484
1451 if ( *it == "ISDN Phone" ) 1485 if ( *it == "ISDN Phone" )
1452 *itV = ent.ISDNPhone(); 1486 *itV = ent.ISDNPhone();
1453 1487
1454 if ( *it == "Other Phone" ) 1488 if ( *it == "Other Phone" )
1455 *itV = ent.otherPhone(); 1489 *itV = ent.otherPhone();
1456*/ 1490*/
1457 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) 1491 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
1458 *itV = ent.businessPager(); 1492 *itV = ent.businessPager();
1459/* 1493/*
1460 if ( *it == "Home Pager") 1494 if ( *it == "Home Pager")
1461 *itV = ent.homePager(); 1495 *itV = ent.homePager();
1462 1496
1463 if ( *it == "AIM IM" ) 1497 if ( *it == "AIM IM" )
1464 *itV = ent.AIMIM(); 1498 *itV = ent.AIMIM();
1465 1499
1466 if ( *it == "ICQ IM" ) 1500 if ( *it == "ICQ IM" )
1467 *itV = ent.ICQIM(); 1501 *itV = ent.ICQIM();
1468 1502
1469 if ( *it == "Jabber IM" ) 1503 if ( *it == "Jabber IM" )
1470 *itV = ent.jabberIM(); 1504 *itV = ent.jabberIM();
1471 1505
1472 if ( *it == "MSN IM" ) 1506 if ( *it == "MSN IM" )
1473 *itV = ent.MSNIM(); 1507 *itV = ent.MSNIM();
1474 1508
1475 if ( *it == "Yahoo IM" ) 1509 if ( *it == "Yahoo IM" )
1476 *itV = ent.yahooIM(); 1510 *itV = ent.yahooIM();
1477*/ 1511*/
1478 if ( *it == "Home Web Page" ) 1512 if ( *it == "Home Web Page" )
1479 *itV = ent.homeWebpage(); 1513 *itV = ent.homeWebpage();
1480 1514
1481 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) 1515 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1482 *itV = ent.businessWebpage(); 1516 *itV = ent.businessWebpage();
1483 1517
1484 1518
1485 } 1519 }
1486 1520
1487 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); 1521 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") );
1488 1522
1489 QString gender = ent.gender(); 1523 QString gender = ent.gender();
1490 cmbGender->setCurrentItem( gender.toInt() ); 1524 cmbGender->setCurrentItem( gender.toInt() );
1491 1525
1492 txtNote->setText( ent.notes() ); 1526 txtNote->setText( ent.notes() );
1493 1527
1494 slotCmbChooser1Change( cmbChooserField1->currentItem() ); 1528 slotCmbChooser1Change( cmbChooserField1->currentItem() );
1495 slotCmbChooser2Change( cmbChooserField2->currentItem() ); 1529 slotCmbChooser2Change( cmbChooserField2->currentItem() );
1496 slotCmbChooser3Change( cmbChooserField3->currentItem() ); 1530 slotCmbChooser3Change( cmbChooserField3->currentItem() );
1497 1531
1498 slotAddressTypeChange( cmbAddress->currentItem() ); 1532 slotAddressTypeChange( cmbAddress->currentItem() );
1499 1533
1500} 1534}
1501 1535
1502void ContactEditor::saveEntry() { 1536void ContactEditor::saveEntry() {
1503 1537
1504 if ( useFullName == TRUE ) { 1538 if ( useFullName == TRUE ) {
1505 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); 1539 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) );
1506 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); 1540 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) );
1507 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); 1541 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
1508 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); 1542 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
1509 1543
1510 useFullName = FALSE; 1544 useFullName = FALSE;
1511} 1545}
1512 1546
1513 /*if ( ent.firstName() != txtFirstName->text() || 1547 /*if ( ent.firstName() != txtFirstName->text() ||
1514 ent.lastName != txtLastName->text() || 1548 ent.lastName != txtLastName->text() ||
1515 ent.middleName != txtMiddleName->text() ) { 1549 ent.middleName != txtMiddleName->text() ) {
1516 */ 1550 */
1517 ent.setFirstName( txtFirstName->text() ); 1551 ent.setFirstName( txtFirstName->text() );
1518 ent.setLastName( txtLastName->text() ); 1552 ent.setLastName( txtLastName->text() );
1519 ent.setMiddleName( txtMiddleName->text() ); 1553 ent.setMiddleName( txtMiddleName->text() );
1520 ent.setSuffix( txtSuffix->text() ); 1554 ent.setSuffix( txtSuffix->text() );
1521 1555
1522 //} 1556 //}
1523 1557
1524 ent.setFileAs( cmbFileAs->currentText() ); 1558 ent.setFileAs( cmbFileAs->currentText() );
1525 1559
1526 ent.setCategories( cmbCat->currentCategories() ); 1560 ent.setCategories( cmbCat->currentCategories() );
1527 1561
1528 if (hasTitle) 1562 if (hasTitle)
1529 ent.setJobTitle( txtJobTitle->text() ); 1563 ent.setJobTitle( txtJobTitle->text() );
1530 1564
1531 if (hasCompany) 1565 if (hasCompany)
1532 ent.setCompany( txtOrganization->text() ); 1566 ent.setCompany( txtOrganization->text() );
1533 1567
1534 if (hasNotes) 1568 if (hasNotes)
1535 ent.setNotes( txtNote->text() ); 1569 ent.setNotes( txtNote->text() );
1536 1570
1537 if (hasStreet) { 1571 if (hasStreet) {
1538 ent.setHomeStreet( slHomeAddress[0] ); 1572 ent.setHomeStreet( slHomeAddress[0] );
1539 ent.setBusinessStreet( slBusinessAddress[0] ); 1573 ent.setBusinessStreet( slBusinessAddress[0] );
1540 } 1574 }
1541/* 1575/*
1542 if (hasStreet2) { 1576 if (hasStreet2) {
1543 ent.setHomeStreet2( (*slHomeAddress)[1] ); 1577 ent.setHomeStreet2( (*slHomeAddress)[1] );
1544 ent.setBusinessStreet2( (*slBusinessAddress)[1] ); 1578 ent.setBusinessStreet2( (*slBusinessAddress)[1] );
1545 } 1579 }
1546 1580
1547 if (hasPOBox) { 1581 if (hasPOBox) {
1548 ent.setHomePOBox( (*slHomeAddress)[2] ); 1582 ent.setHomePOBox( (*slHomeAddress)[2] );
1549 ent.setBusinessPOBox( (*slBusinessAddress)[2] ); 1583 ent.setBusinessPOBox( (*slBusinessAddress)[2] );
1550 } 1584 }
1551*/ 1585*/
1552 if (hasCity) { 1586 if (hasCity) {
1553 ent.setHomeCity( slHomeAddress[3] ); 1587 ent.setHomeCity( slHomeAddress[3] );
1554 ent.setBusinessCity( slBusinessAddress[3] ); 1588 ent.setBusinessCity( slBusinessAddress[3] );
1555 } 1589 }
1556 1590
1557 if (hasState) { 1591 if (hasState) {
1558 ent.setHomeState( slHomeAddress[4] ); 1592 ent.setHomeState( slHomeAddress[4] );
1559 ent.setBusinessState( slBusinessAddress[4] ); 1593 ent.setBusinessState( slBusinessAddress[4] );
1560 } 1594 }
1561 1595
1562 if (hasZip) { 1596 if (hasZip) {
1563 ent.setHomeZip( slHomeAddress[5] ); 1597 ent.setHomeZip( slHomeAddress[5] );
1564 ent.setBusinessZip( slBusinessAddress[5] ); 1598 ent.setBusinessZip( slBusinessAddress[5] );
1565 } 1599 }
1566 1600
1567 if (hasCountry) { 1601 if (hasCountry) {
1568 ent.setHomeCountry( slHomeAddress[6] ); 1602 ent.setHomeCountry( slHomeAddress[6] );
1569 ent.setBusinessCountry( slBusinessAddress[6] ); 1603 ent.setBusinessCountry( slBusinessAddress[6] );
1570 } 1604 }
1571 1605
1572 QStringList::ConstIterator it; 1606 QStringList::ConstIterator it;
1573 QListIterator<QLineEdit> itLE( listValue ); 1607 QListIterator<QLineEdit> itLE( listValue );
1574 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { 1608 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) {
1575 if ( *it == tr( "Department" ) ) 1609 if ( *it == "Department" )
1576 ent.setDepartment( (*itLE)->text() ); 1610 ent.setDepartment( (*itLE)->text() );
1577 1611
1578 if ( *it == tr( "Company" ) ) 1612 if ( *it == "Company" )
1579 ent.setCompany( (*itLE)->text() ); 1613 ent.setCompany( (*itLE)->text() );
1580 1614
1581 if ( *it == tr( "Office" ) ) 1615 if ( *it == "Office" )
1582 ent.setOffice( (*itLE)->text() ); 1616 ent.setOffice( (*itLE)->text() );
1583 1617
1584 if ( *it == tr( "Profession" ) ) 1618 if ( *it == "Profession" )
1585 ent.setProfession( (*itLE)->text() ); 1619 ent.setProfession( (*itLE)->text() );
1586 1620
1587 if ( *it == tr( "Assistant" ) ) 1621 if ( *it == "Assistant" )
1588 ent.setAssistant( (*itLE)->text() ); 1622 ent.setAssistant( (*itLE)->text() );
1589 1623
1590 if ( *it == tr( "Manager" ) ) 1624 if ( *it == "Manager" )
1591 ent.setManager( (*itLE)->text() ); 1625 ent.setManager( (*itLE)->text() );
1592 1626
1593 if ( *it == tr( "Spouse" ) ) 1627 if ( *it == "Spouse" )
1594 ent.setSpouse( (*itLE)->text() ); 1628 ent.setSpouse( (*itLE)->text() );
1595 1629
1596 if ( *it == tr( "Birthday" ) ) 1630 if ( *it == "Birthday" )
1597 ent.setBirthday( (*itLE)->text() ); 1631 ent.setBirthday( (*itLE)->text() );
1598 1632
1599 if ( *it == tr( "Anniversary" ) ) 1633 if ( *it == "Anniversary" )
1600 ent.setAnniversary( (*itLE)->text() ); 1634 ent.setAnniversary( (*itLE)->text() );
1601 1635
1602 if ( *it == tr( "Nickname" ) ) 1636 if ( *it == "Nickname" )
1603 ent.setNickname( (*itLE)->text() ); 1637 ent.setNickname( (*itLE)->text() );
1604 1638
1605 if ( *it == tr( "Children" ) ) 1639 if ( *it == "Children" )
1606 ent.setChildren( (*itLE)->text() ); 1640 ent.setChildren( (*itLE)->text() );
1607 1641
1608 } 1642 }
1609 1643
1610 QStringList::ConstIterator itV; 1644 QStringList::ConstIterator itV;
1611 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1645 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1612 1646
1613 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) 1647 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) )
1614 ent.setBusinessPhone( *itV ); 1648 ent.setBusinessPhone( *itV );
1615/* 1649/*
1616 if ( *it == tr("Business 2 Phone" ) 1650 if ( *it == tr("Business 2 Phone" )
1617 ent.setBusiness2Phone( *itV ); 1651 ent.setBusiness2Phone( *itV );
1618*/ 1652*/
1619 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) 1653 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) )
1620 ent.setBusinessFax( *itV ); 1654 ent.setBusinessFax( *itV );
1621 1655
1622 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) 1656 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) )
1623 ent.setBusinessMobile( *itV ); 1657 ent.setBusinessMobile( *itV );
1624/* 1658/*
1625 if ( *it == "Company Phone" ) 1659 if ( *it == "Company Phone" )
1626 ent.setCompanyPhone( *itV ); 1660 ent.setCompanyPhone( *itV );
1627*/ 1661*/
1628 //if ( *it == "Default Email" ) 1662 //if ( *it == "Default Email" )
1629 //ent.setDefaultEmail( *itV ); 1663 //ent.setDefaultEmail( *itV );
1630 1664
1631 if ( *it == "Emails" ){ 1665 if ( *it == "Emails" ){
1632 QString allemail; 1666 QString allemail;
1633 QString defaultmail; 1667 QString defaultmail;
1634 parseEmailFrom( *itV, defaultmail, allemail ); 1668 parseEmailFrom( *itV, defaultmail, allemail );
1635 // ent.clearEmails(); 1669 // ent.clearEmails();
1636 ent.setDefaultEmail( defaultmail ); 1670 ent.setDefaultEmail( defaultmail );
1637 ent.setEmails( allemail ); 1671 ent.setEmails( allemail );
1638 } 1672 }
1639 1673
1640 if ( *it == "Home Phone" ) 1674 if ( *it == "Home Phone" )
1641 ent.setHomePhone( *itV ); 1675 ent.setHomePhone( *itV );
1642/* 1676/*
1643 if ( *it == "Home 2 Phone" ) 1677 if ( *it == "Home 2 Phone" )
1644 ent.setHome2Phone( *itV ); 1678 ent.setHome2Phone( *itV );
1645*/ 1679*/
1646 if ( *it == "Home Fax" ) 1680 if ( *it == "Home Fax" )
1647 ent.setHomeFax( *itV ); 1681 ent.setHomeFax( *itV );
1648 1682
1649 if ( *it == "Home Mobile" ) 1683 if ( *it == "Home Mobile" )
1650 ent.setHomeMobile( *itV ); 1684 ent.setHomeMobile( *itV );
1651/* 1685/*
1652 if ( *it == "Car Phone" ) 1686 if ( *it == "Car Phone" )
1653 ent.setCarPhone( *itV ); 1687 ent.setCarPhone( *itV );
1654 1688
1655 if ( *it == "ISDN Phone" ) 1689 if ( *it == "ISDN Phone" )
1656 ent.setISDNPhone( *itV ); 1690 ent.setISDNPhone( *itV );
1657 1691
1658 if ( *it == "Other Phone" ) 1692 if ( *it == "Other Phone" )
1659 ent.setOtherPhone( *itV ); 1693 ent.setOtherPhone( *itV );
1660*/ 1694*/
1661 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) 1695 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
1662 ent.setBusinessPager( *itV ); 1696 ent.setBusinessPager( *itV );
1663/* 1697/*
1664 if ( *it == "Home Pager" ) 1698 if ( *it == "Home Pager" )
1665 ent.setHomePager( *itV ); 1699 ent.setHomePager( *itV );
1666 1700
1667 if ( *it == "AIM IM" ) 1701 if ( *it == "AIM IM" )
1668 ent.setAIMIM( *itV ); 1702 ent.setAIMIM( *itV );
1669 1703
1670 if ( *it == "ICQ IM" ) 1704 if ( *it == "ICQ IM" )
1671 ent.setICQIM( *itV ); 1705 ent.setICQIM( *itV );
1672 1706
1673 if ( *it == "Jabber IM" ) 1707 if ( *it == "Jabber IM" )
1674 ent.setJabberIM( *itV ); 1708 ent.setJabberIM( *itV );
1675 1709
1676 if ( *it == "MSN IM" ) 1710 if ( *it == "MSN IM" )
1677 ent.setMSNIM( *itV ); 1711 ent.setMSNIM( *itV );
1678 1712
1679 if ( *it == "Yahoo IM" ) 1713 if ( *it == "Yahoo IM" )
1680 ent.setYahooIM( *itV ); 1714 ent.setYahooIM( *itV );
1681*/ 1715*/
1682 if ( *it == "Home Web Page" ) 1716 if ( *it == "Home Web Page" )
1683 ent.setHomeWebpage( *itV ); 1717 ent.setHomeWebpage( *itV );
1684 1718
1685 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) 1719 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1686 ent.setBusinessWebpage( *itV ); 1720 ent.setBusinessWebpage( *itV );
1687 1721
1688 1722
1689 } 1723 }
1690 1724
1691 int gender = cmbGender->currentItem(); 1725 int gender = cmbGender->currentItem();
1692 ent.setGender( QString::number( gender ) ); 1726 ent.setGender( QString::number( gender ) );
1693 1727
1694 QString str = txtNote->text(); 1728 QString str = txtNote->text();
1695 if ( !str.isNull() ) 1729 if ( !str.isNull() )
1696 ent.setNotes( str ); 1730 ent.setNotes( str );
1697 1731
1698} 1732}
1699 1733
1700void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 1734void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
1701 QString &strAll ) 1735 QString &strAll )