summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.cpp4
-rw-r--r--core/pim/addressbook/abview.cpp3
-rw-r--r--core/pim/addressbook/addressbook.pro2
-rw-r--r--core/pim/addressbook/configdlg.cpp2
-rw-r--r--core/pim/addressbook/contacteditor.cpp1
-rw-r--r--core/pim/addressbook/contacteditor.h3
6 files changed, 6 insertions, 9 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index 4705c78..70330c7 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -1,848 +1,848 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) 3** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de)
4** 4**
5** This file is part of Qt Palmtop Environment. 5** This file is part of Qt Palmtop Environment.
6** 6**
7** This file may be distributed and/or modified under the terms of the 7** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software 8** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file. 10** packaging of this file.
11** 11**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14** 14**
15** See http://www.trolltech.com/gpl/ for GPL licensing information. 15** See http://www.trolltech.com/gpl/ for GPL licensing information.
16** 16**
17** Contact info@trolltech.com if any conditions of this licensing are 17** Contact info@trolltech.com if any conditions of this licensing are
18** not clear to you. 18** not clear to you.
19** 19**
20**********************************************************************/ 20**********************************************************************/
21 21
22 22
23#include <qpe/categoryselect.h> 23#include <qpe/categoryselect.h>
24#include <qpe/config.h> 24#include <qpe/config.h>
25#include <qpe/stringutil.h> 25#include <qpe/stringutil.h>
26#include <qpe/qcopenvelope_qws.h> 26#include <qpe/qcopenvelope_qws.h>
27#include <qpe/timestring.h> 27#include <qpe/timestring.h>
28#include <qpe/resource.h> 28#include <qpe/resource.h>
29 29
30#include <opie/orecordlist.h> 30#include <opie/orecordlist.h>
31 31
32#include <qasciidict.h> 32#include <qasciidict.h>
33#include <qdatetime.h> 33#include <qdatetime.h>
34#include <qfile.h> 34#include <qfile.h>
35#include <qregexp.h> 35#include <qregexp.h>
36#include <qmessagebox.h> 36#include <qmessagebox.h>
37 37
38#include "abtable.h" 38#include "abtable.h"
39 39
40#include <errno.h> 40#include <errno.h>
41#include <fcntl.h> 41#include <fcntl.h>
42#include <unistd.h> 42#include <unistd.h>
43#include <stdlib.h> 43#include <stdlib.h>
44 44
45#include <ctype.h> //toupper() for key hack 45#include <ctype.h> //toupper() for key hack
46 46
47#if 0 47#if 0
48 48
49/*! 49/*!
50 \class AbTableItem abtable.h 50 \class AbTableItem abtable.h
51 51
52 \brief QTableItem based class for showing a field of an entry 52 \brief QTableItem based class for showing a field of an entry
53*/ 53*/
54 54
55AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s, 55AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s,
56 const QString &secondSortKey) 56 const QString &secondSortKey)
57 : QTableItem( t, et, s ) 57 : QTableItem( t, et, s )
58{ 58{
59 // sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower(); 59 // sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower();
60 sortKey = Qtopia::buildSortKey( s, secondSortKey ); 60 sortKey = Qtopia::buildSortKey( s, secondSortKey );
61} 61}
62 62
63int AbTableItem::alignment() const 63int AbTableItem::alignment() const
64{ 64{
65 return AlignLeft|AlignVCenter; 65 return AlignLeft|AlignVCenter;
66} 66}
67 67
68QString AbTableItem::key() const 68QString AbTableItem::key() const
69{ 69{
70 return sortKey; 70 return sortKey;
71} 71}
72 72
73// A way to reset the item, without out doing a delete or a new... 73// A way to reset the item, without out doing a delete or a new...
74void AbTableItem::setItem( const QString &txt, const QString &secondKey ) 74void AbTableItem::setItem( const QString &txt, const QString &secondKey )
75{ 75{
76 setText( txt ); 76 setText( txt );
77 sortKey = Qtopia::buildSortKey( txt, secondKey ); 77 sortKey = Qtopia::buildSortKey( txt, secondKey );
78 78
79 // sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower(); 79 // sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower();
80} 80}
81 81
82/*! 82/*!
83 \class AbPickItem abtable.h 83 \class AbPickItem abtable.h
84 84
85 \brief QTableItem based class for showing slection of an entry 85 \brief QTableItem based class for showing slection of an entry
86*/ 86*/
87 87
88AbPickItem::AbPickItem( QTable *t ) : 88AbPickItem::AbPickItem( QTable *t ) :
89 QTableItem(t, WhenCurrent, "?") 89 QTableItem(t, WhenCurrent, "?")
90{ 90{
91} 91}
92 92
93QWidget *AbPickItem::createEditor() const 93QWidget *AbPickItem::createEditor() const
94{ 94{
95 QComboBox* combo = new QComboBox( table()->viewport() ); 95 QComboBox* combo = new QComboBox( table()->viewport() );
96 ( (AbPickItem*)this )->cb = combo; 96 ( (AbPickItem*)this )->cb = combo;
97 AbTable* t = static_cast<AbTable*>(table()); 97 AbTable* t = static_cast<AbTable*>(table());
98 QStringList c = t->choiceNames(); 98 QStringList c = t->choiceNames();
99 int cur = 0; 99 int cur = 0;
100 for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) { 100 for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) {
101 if ( *it == text() ) 101 if ( *it == text() )
102 cur = combo->count(); 102 cur = combo->count();
103 combo->insertItem(*it); 103 combo->insertItem(*it);
104 } 104 }
105 combo->setCurrentItem(cur); 105 combo->setCurrentItem(cur);
106 return combo; 106 return combo;
107} 107}
108 108
109void AbPickItem::setContentFromEditor( QWidget *w ) 109void AbPickItem::setContentFromEditor( QWidget *w )
110{ 110{
111 if ( w->inherits("QComboBox") ) 111 if ( w->inherits("QComboBox") )
112 setText( ( (QComboBox*)w )->currentText() ); 112 setText( ( (QComboBox*)w )->currentText() );
113 else 113 else
114 QTableItem::setContentFromEditor( w ); 114 QTableItem::setContentFromEditor( w );
115} 115}
116 116
117#endif 117#endif
118 118
119/*! 119/*!
120 \class AbTable abtable.h 120 \class AbTable abtable.h
121 121
122 \brief QTable based class for showing a list of entries 122 \brief QTable based class for showing a list of entries
123*/ 123*/
124 124
125AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name ) 125AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name )
126 : QTable( parent, name ), 126 : QTable( parent, name ),
127 lastSortCol( -1 ), 127 lastSortCol( -1 ),
128 asc( TRUE ), 128 asc( TRUE ),
129 intFields( order ), 129 intFields( order ),
130 enablePainting( true ), 130 enablePainting( true ),
131 columnVisible( true ), 131 columnVisible( true ),
132 countNested( 0 ) 132 countNested( 0 )
133{ 133{
134 //qWarning("C'tor start"); 134 //qWarning("C'tor start");
135 135
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 // contactList.clear(); 142 // contactList.clear();
143 //qWarning("C'tor end"); 143 //qWarning("C'tor end");
144} 144}
145 145
146AbTable::~AbTable() 146AbTable::~AbTable()
147{ 147{
148} 148}
149 149
150void AbTable::init() 150void AbTable::init()
151{ 151{
152 // :SX showChar = '\0'; 152 // :SX showChar = '\0';
153 setNumRows( 0 ); 153 setNumRows( 0 );
154 setNumCols( 2 ); 154 setNumCols( 2 );
155 155
156 horizontalHeader()->setLabel( 0, tr( "Full Name" )); 156 horizontalHeader()->setLabel( 0, tr( "Full Name" ));
157 horizontalHeader()->setLabel( 1, tr( "Contact" )); 157 horizontalHeader()->setLabel( 1, tr( "Contact" ));
158 setLeftMargin( 0 ); 158 setLeftMargin( 0 );
159 verticalHeader()->hide(); 159 verticalHeader()->hide();
160 columnVisible = true; 160 columnVisible = true;
161} 161}
162 162
163void AbTable::setContacts( const OContactAccess::List& viewList ) 163void AbTable::setContacts( const OContactAccess::List& viewList )
164{ 164{
165 qWarning("AbTable::setContacts()"); 165 qWarning("AbTable::setContacts()");
166 166
167 clear(); 167 clear();
168 m_viewList = viewList; 168 m_viewList = viewList;
169 169
170 setSorting( false ); 170 setSorting( false );
171 setPaintingEnabled( FALSE ); 171 setPaintingEnabled( FALSE );
172 172
173 OContactAccess::List::Iterator it; 173 OContactAccess::List::Iterator it;
174 setNumRows( m_viewList.count() ); 174 setNumRows( m_viewList.count() );
175 //int row = 0; 175 //int row = 0;
176 // for ( it = m_viewList.begin(); it != m_viewList.end(); ++it ) 176 // for ( it = m_viewList.begin(); it != m_viewList.end(); ++it )
177 // insertIntoTable( *it, row++ ); 177 // insertIntoTable( *it, row++ );
178 178
179 // setSorting( true ); 179 // setSorting( true );
180 180
181 // resort(); 181 // resort();
182 182
183 updateVisible(); 183 updateVisible();
184 184
185 setPaintingEnabled( TRUE ); 185 setPaintingEnabled( TRUE );
186 186
187} 187}
188 188
189void AbTable::setOrderedList( const QValueList<int> ordered ) 189void AbTable::setOrderedList( const QValueList<int> ordered )
190{ 190{
191 intFields = ordered; 191 intFields = ordered;
192} 192}
193 193
194 194
195bool AbTable::selectContact( int UID ) 195bool AbTable::selectContact( int UID )
196{ 196{
197 qWarning( "AbTable::selectContact( %d )", UID ); 197 qWarning( "AbTable::selectContact( %d )", UID );
198 int rows = numRows(); 198 int rows = numRows();
199 OContact* foundContact = 0l; 199 OContact* foundContact = 0l;
200 bool found = false; 200 bool found = false;
201 201
202 setPaintingEnabled( FALSE ); 202 setPaintingEnabled( FALSE );
203 qWarning( "search start" ); 203 qWarning( "search start" );
204 for ( int r = 0; r < rows; ++r ) { 204 for ( int r = 0; r < rows; ++r ) {
205 if ( m_viewList.uidAt( r ) == UID ){ 205 if ( m_viewList.uidAt( r ) == UID ){
206 ensureCellVisible( r, 0 ); 206 ensureCellVisible( r, 0 );
207 setCurrentCell( r, 0 ); 207 setCurrentCell( r, 0 );
208 found = true; 208 found = true;
209 break; 209 break;
210 } 210 }
211 } 211 }
212 qWarning( "search end" ); 212 qWarning( "search end" );
213 213
214 if ( !found ){ 214 if ( !found ){
215 ensureCellVisible( 0,0 ); 215 ensureCellVisible( 0,0 );
216 setCurrentCell( 0, 0 ); 216 setCurrentCell( 0, 0 );
217 } 217 }
218 218
219 setPaintingEnabled( TRUE ); 219 setPaintingEnabled( TRUE );
220 220
221 return true; 221 return true;
222} 222}
223 223
224#if 0 224#if 0
225void AbTable::insertIntoTable( const OContact& cnt, int row ) 225void AbTable::insertIntoTable( const OContact& cnt, int row )
226{ 226{
227 qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row ); 227 qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row );
228 QString strName; 228 QString strName;
229 ContactItem contactItem; 229 ContactItem contactItem;
230 230
231 strName = findContactName( cnt ); 231 strName = findContactName( cnt );
232 contactItem = findContactContact( cnt, row ); 232 contactItem = findContactContact( cnt, row );
233 233
234 AbTableItem *ati; 234 AbTableItem *ati;
235 ati = new AbTableItem( this, QTableItem::Never, strName, contactItem.value ); 235 ati = new AbTableItem( this, QTableItem::Never, strName, contactItem.value );
236 contactList.insert( ati, cnt ); 236 contactList.insert( ati, cnt );
237 setItem( row, 0, ati ); 237 setItem( row, 0, ati );
238 ati = new AbTableItem( this, QTableItem::Never, contactItem.value, strName); 238 ati = new AbTableItem( this, QTableItem::Never, contactItem.value, strName);
239 if ( !contactItem.icon.isNull() ) 239 if ( !contactItem.icon.isNull() )
240 ati->setPixmap( contactItem.icon ); 240 ati->setPixmap( contactItem.icon );
241 setItem( row, 1, ati ); 241 setItem( row, 1, ati );
242 242
243 //### cannot do this; table only has two columns at this point 243 //### cannot do this; table only has two columns at this point
244 // setItem( row, 2, new AbPickItem( this ) ); 244 // setItem( row, 2, new AbPickItem( this ) );
245 245
246} 246}
247#endif 247#endif
248 248
249 249
250void AbTable::columnClicked( int col ) 250void AbTable::columnClicked( int col )
251{ 251{
252 if ( !sorting() ) 252 if ( !sorting() )
253 return; 253 return;
254 254
255 if ( lastSortCol == -1 ) 255 if ( lastSortCol == -1 )
256 lastSortCol = col; 256 lastSortCol = col;
257 257
258 if ( col == lastSortCol ) { 258 if ( col == lastSortCol ) {
259 asc = !asc; 259 asc = !asc;
260 } else { 260 } else {
261 lastSortCol = col; 261 lastSortCol = col;
262 asc = TRUE; 262 asc = TRUE;
263 } 263 }
264 //QMessageBox::information( this, "resort", "columnClicked" ); 264 //QMessageBox::information( this, "resort", "columnClicked" );
265 resort(); 265 resort();
266} 266}
267 267
268void AbTable::resort() 268void AbTable::resort()
269{ 269{
270 qWarning( "void AbTable::resort() NOT POSSIBLE !!" ); 270 qWarning( "void AbTable::resort() NOT POSSIBLE !!" );
271#if 0 271#if 0
272 setPaintingEnabled( FALSE ); 272 setPaintingEnabled( FALSE );
273 if ( sorting() ) { 273 if ( sorting() ) {
274 if ( lastSortCol == -1 ) 274 if ( lastSortCol == -1 )
275 lastSortCol = 0; 275 lastSortCol = 0;
276 sortColumn( lastSortCol, asc, TRUE ); 276 sortColumn( lastSortCol, asc, TRUE );
277 //QMessageBox::information( this, "resort", "resort" ); 277 //QMessageBox::information( this, "resort", "resort" );
278 updateVisible(); 278 updateVisible();
279 } 279 }
280 setPaintingEnabled( TRUE ); 280 setPaintingEnabled( TRUE );
281#endif 281#endif
282} 282}
283 283
284OContact AbTable::currentEntry() 284OContact AbTable::currentEntry()
285 { 285 {
286 return m_viewList[currentRow()]; 286 return m_viewList[currentRow()];
287} 287}
288 288
289int AbTable::currentEntry_UID() 289int AbTable::currentEntry_UID()
290{ 290{
291 return ( currentEntry().uid() ); 291 return ( currentEntry().uid() );
292} 292}
293 293
294void AbTable::clear() 294void AbTable::clear()
295{ 295{
296 qWarning( "void AbTable::clear()" ); 296 qWarning( "void AbTable::clear()" );
297 // contactList.clear(); 297 // contactList.clear();
298 298
299 setPaintingEnabled( FALSE ); 299 setPaintingEnabled( FALSE );
300 for ( int r = 0; r < numRows(); ++r ) { 300 for ( int r = 0; r < numRows(); ++r ) {
301 for ( int c = 0; c < numCols(); ++c ) { 301 for ( int c = 0; c < numCols(); ++c ) {
302 if ( cellWidget( r, c ) ) 302 if ( cellWidget( r, c ) )
303 clearCellWidget( r, c ); 303 clearCellWidget( r, c );
304 clearCell( r, c ); 304 clearCell( r, c );
305 } 305 }
306 } 306 }
307 setNumRows( 0 ); 307 setNumRows( 0 );
308 setPaintingEnabled( TRUE ); 308 setPaintingEnabled( TRUE );
309} 309}
310 310
311// Refresh updates column 2 if the contactsettings changed 311// Refresh updates column 2 if the contactsettings changed
312void AbTable::refresh() 312void AbTable::refresh()
313{ 313{
314 qWarning( "void AbTable::refresh() NOT IMPLEMENTED !!" ); 314 qWarning( "void AbTable::refresh() NOT IMPLEMENTED !!" );
315 315
316#if 0 316#if 0
317 int rows = numRows(); 317 int rows = numRows();
318 AbTableItem *abi; 318 AbTableItem *abi;
319 ContactItem contactItem; 319 ContactItem contactItem;
320 320
321 setPaintingEnabled( FALSE ); 321 setPaintingEnabled( FALSE );
322 for ( int r = 0; r < rows; ++r ) { 322 for ( int r = 0; r < rows; ++r ) {
323 abi = static_cast<AbTableItem*>( item(r, 0) ); 323 abi = static_cast<AbTableItem*>( item(r, 0) );
324 contactItem = findContactContact( contactList[abi], r ); 324 contactItem = findContactContact( contactList[abi], r );
325 static_cast<AbTableItem*>( item(r, 1) )->setItem( contactItem.value, abi->text() ); 325 static_cast<AbTableItem*>( item(r, 1) )->setItem( contactItem.value, abi->text() );
326 if ( !contactItem.icon.isNull() ){ 326 if ( !contactItem.icon.isNull() ){
327 static_cast<AbTableItem*>( item(r, 1) )-> 327 static_cast<AbTableItem*>( item(r, 1) )->
328 setPixmap( contactItem.icon ); 328 setPixmap( contactItem.icon );
329 }else{ 329 }else{
330 static_cast<AbTableItem*>( item(r, 1) )-> 330 static_cast<AbTableItem*>( item(r, 1) )->
331 setPixmap( QPixmap() ); 331 setPixmap( QPixmap() );
332 } 332 }
333 } 333 }
334 resort(); 334 resort();
335 setPaintingEnabled( TRUE ); 335 setPaintingEnabled( TRUE );
336 336
337#endif 337#endif
338} 338}
339 339
340void AbTable::keyPressEvent( QKeyEvent *e ) 340void AbTable::keyPressEvent( QKeyEvent *e )
341{ 341{
342 char key = toupper( e->ascii() ); 342 char key = toupper( e->ascii() );
343 343
344 if ( key >= 'A' && key <= 'Z' ) 344 if ( key >= 'A' && key <= 'Z' )
345 moveTo( key ); 345 moveTo( key );
346 346
347 //qWarning("Received key .."); 347 //qWarning("Received key ..");
348 switch( e->key() ) { 348 switch( e->key() ) {
349 case Qt::Key_Space: 349 case Qt::Key_Space:
350 case Qt::Key_Return: 350 case Qt::Key_Return:
351 case Qt::Key_Enter: 351 case Qt::Key_Enter:
352 emit signalSwitch(); 352 emit signalSwitch();
353 break; 353 break;
354 // case Qt::Key_Up: 354 // case Qt::Key_Up:
355 // qWarning("a"); 355 // qWarning("a");
356 // emit signalKeyUp(); 356 // emit signalKeyUp();
357 // break; 357 // break;
358 // case Qt::Key_Down: 358 // case Qt::Key_Down:
359 // qWarning("b"); 359 // qWarning("b");
360 // emit signalKeyDown(); 360 // emit signalKeyDown();
361 // break; 361 // break;
362 default: 362 default:
363 QTable::keyPressEvent( e ); 363 QTable::keyPressEvent( e );
364 } 364 }
365 365
366} 366}
367 367
368void AbTable::moveTo( char c ) 368void AbTable::moveTo( char c )
369{ 369{
370 qWarning( "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" ); 370 qWarning( "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" );
371 371
372#if 0 372#if 0
373 int rows = numRows(); 373 int rows = numRows();
374 QString value; 374 QString value;
375 AbTableItem *abi; 375 AbTableItem *abi;
376 int r; 376 int r;
377 if ( asc ) { 377 if ( asc ) {
378 r = 0; 378 r = 0;
379 while ( r < rows-1) { 379 while ( r < rows-1) {
380 abi = static_cast<AbTableItem*>( item(r, 0) ); 380 abi = static_cast<AbTableItem*>( item(r, 0) );
381 QChar first = abi->key()[0]; 381 QChar first = abi->key()[0];
382 //### is there a bug in QChar to char comparison??? 382 //### is there a bug in QChar to char comparison???
383 if ( first.row() || first.cell() >= c ) 383 if ( first.row() || first.cell() >= c )
384 break; 384 break;
385 r++; 385 r++;
386 } 386 }
387 } else { 387 } else {
388 //### should probably disable reverse sorting instead 388 //### should probably disable reverse sorting instead
389 r = rows - 1; 389 r = rows - 1;
390 while ( r > 0 ) { 390 while ( r > 0 ) {
391 abi = static_cast<AbTableItem*>( item(r, 0) ); 391 abi = static_cast<AbTableItem*>( item(r, 0) );
392 QChar first = abi->key()[0]; 392 QChar first = abi->key()[0];
393 //### is there a bug in QChar to char comparison??? 393 //### is there a bug in QChar to char comparison???
394 if ( first.row() || first.cell() >= c ) 394 if ( first.row() || first.cell() >= c )
395 break; 395 break;
396 r--; 396 r--;
397 } 397 }
398 } 398 }
399 setCurrentCell( r, currentColumn() ); 399 setCurrentCell( r, currentColumn() );
400 400
401#endif 401#endif
402} 402}
403 403
404#if 0 404#if 0
405// Useless.. Nobody uses it .. (se) 405// Useless.. Nobody uses it .. (se)
406QString AbTable::findContactName( const OContact &entry ) 406QString AbTable::findContactName( const OContact &entry )
407{ 407{
408 // We use the fileAs, then company, defaultEmail 408 // We use the fileAs, then company, defaultEmail
409 QString str; 409 QString str;
410 str = entry.fileAs(); 410 str = entry.fileAs();
411 if ( str.isEmpty() ) { 411 if ( str.isEmpty() ) {
412 str = entry.company(); 412 str = entry.company();
413 if ( str.isEmpty() ) { 413 if ( str.isEmpty() ) {
414 str = entry.defaultEmail(); 414 str = entry.defaultEmail();
415 } 415 }
416 } 416 }
417 return str; 417 return str;
418} 418}
419#endif 419#endif
420 420
421 421
422void AbTable::resizeRows() { 422void AbTable::resizeRows() {
423 /* 423 /*
424 if (numRows()) { 424 if (numRows()) {
425 for (int i = 0; i < numRows(); i++) { 425 for (int i = 0; i < numRows(); i++) {
426 setRowHeight( i, size ); 426 setRowHeight( i, size );
427 } 427 }
428 } 428 }
429 updateVisible(); 429 updateVisible();
430 */ 430 */
431} 431}
432 432
433 433
434void AbTable::realignTable() 434void AbTable::realignTable()
435{ 435{
436 //qWarning( "void AbTable::realignTable()" ); 436 //qWarning( "void AbTable::realignTable()" );
437 437
438 setPaintingEnabled( FALSE ); 438 setPaintingEnabled( FALSE );
439 439
440 resizeRows(); 440 resizeRows();
441 fitColumns(); 441 fitColumns();
442 442
443 setPaintingEnabled( TRUE ); 443 setPaintingEnabled( TRUE );
444 444
445} 445}
446 446
447 447
448 448
449 449
450#if QT_VERSION <= 230 450#if QT_VERSION <= 230
451#ifndef SINGLE_APP 451#ifndef SINGLE_APP
452void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) 452void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch )
453{ 453{
454 // Region of the rect we should draw 454 // Region of the rect we should draw
455 QRegion reg( QRect( cx, cy, cw, ch ) ); 455 QRegion reg( QRect( cx, cy, cw, ch ) );
456 // Subtract the table from it 456 // Subtract the table from it
457 reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) ); 457 reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) );
458 // And draw the rectangles (transformed as needed) 458 // And draw the rectangles (transformed as needed)
459 QArray<QRect> r = reg.rects(); 459 QArray<QRect> r = reg.rects();
460 for (unsigned int i=0; i<r.count(); i++) 460 for (unsigned int i=0; i<r.count(); i++)
461 p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) ); 461 p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) );
462} 462}
463#endif 463#endif
464#endif 464#endif
465 465
466 466
467// int AbTable::rowHeight( int ) const 467// int AbTable::rowHeight( int ) const
468// { 468// {
469// return 18; 469// return 18;
470// } 470// }
471 471
472// int AbTable::rowPos( int row ) const 472// int AbTable::rowPos( int row ) const
473// { 473// {
474// return 18*row; 474// return 18*row;
475// } 475// }
476 476
477// int AbTable::rowAt( int pos ) const 477// int AbTable::rowAt( int pos ) const
478// { 478// {
479// return QMIN( pos/18, numRows()-1 ); 479// return QMIN( pos/18, numRows()-1 );
480// } 480// }
481 481
482 482
483 483
484void AbTable::fitColumns() 484void AbTable::fitColumns()
485{ 485{
486 //qWarning( "void AbTable::fitColumns()" ); 486 qWarning( "void AbTable::fitColumns()" );
487 int contentsWidth = visibleWidth() / 2; // :SX Why too low 487 int contentsWidth = visibleWidth() / 2;
488 // Fix to better value 488 // Fix to better value
489 // contentsWidth = 130; 489 // contentsWidth = 130;
490 490
491 setPaintingEnabled( FALSE ); 491 setPaintingEnabled( FALSE );
492 492
493 if ( columnVisible == false ){ 493 if ( columnVisible == false ){
494 showColumn(0); 494 showColumn(0);
495 columnVisible = true; 495 columnVisible = true;
496 } 496 }
497 497
498 //qWarning("Width: %d", contentsWidth); 498 //qWarning("Width: %d", contentsWidth);
499 499
500 setColumnWidth( 0, contentsWidth ); 500 setColumnWidth( 0, contentsWidth );
501 adjustColumn(1); 501 adjustColumn(1);
502 if ( columnWidth(1) < contentsWidth ) 502 if ( columnWidth(1) < contentsWidth )
503 setColumnWidth( 1, contentsWidth ); 503 setColumnWidth( 1, contentsWidth );
504 504
505 setPaintingEnabled( TRUE ); 505 setPaintingEnabled( TRUE );
506} 506}
507 507
508void AbTable::show() 508void AbTable::show()
509{ 509{
510 //qWarning( "void AbTable::show()" ); 510 //qWarning( "void AbTable::show()" );
511 realignTable(); 511 realignTable();
512 QTable::show(); 512 QTable::show();
513} 513}
514 514
515#if 0 515#if 0
516void AbTable::setChoiceNames( const QStringList& list) 516void AbTable::setChoiceNames( const QStringList& list)
517{ 517{
518 choicenames = list; 518 choicenames = list;
519 if ( choicenames.isEmpty() ) { 519 if ( choicenames.isEmpty() ) {
520 // hide pick column 520 // hide pick column
521 setNumCols( 2 ); 521 setNumCols( 2 );
522 } else { 522 } else {
523 // show pick column 523 // show pick column
524 setNumCols( 3 ); 524 setNumCols( 3 );
525 setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 ); 525 setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 );
526 horizontalHeader()->setLabel( 2, tr( "Pick" )); 526 horizontalHeader()->setLabel( 2, tr( "Pick" ));
527 } 527 }
528 fitColumns(); 528 fitColumns();
529} 529}
530#endif 530#endif
531 531
532void AbTable::itemClicked(int,int col) 532void AbTable::itemClicked(int,int col)
533{ 533{
534 //qWarning( "AbTable::itemClicked(int, col:%d)", col); 534 //qWarning( "AbTable::itemClicked(int, col:%d)", col);
535 if ( col == 2 ) { 535 if ( col == 2 ) {
536 return; 536 return;
537 } else { 537 } else {
538 // qWarning ("Emitting signalSwitch()"); 538 // qWarning ("Emitting signalSwitch()");
539 emit signalSwitch(); 539 emit signalSwitch();
540 } 540 }
541} 541}
542 542
543#if 0 543#if 0
544QStringList AbTable::choiceNames() const 544QStringList AbTable::choiceNames() const
545{ 545{
546 return choicenames; 546 return choicenames;
547} 547}
548 548
549#endif 549#endif
550void AbTable::setChoiceSelection( const QValueList<int>& list ) 550void AbTable::setChoiceSelection( const QValueList<int>& list )
551{ 551{
552 intFields = list; 552 intFields = list;
553} 553}
554 554
555QStringList AbTable::choiceSelection(int /*index*/) const 555QStringList AbTable::choiceSelection(int /*index*/) const
556{ 556{
557 QStringList r; 557 QStringList r;
558 /* ###### 558 /* ######
559 559
560 QString selname = choicenames.at(index); 560 QString selname = choicenames.at(index);
561 for (each row) { 561 for (each row) {
562 OContact *c = contactForRow(row); 562 OContact *c = contactForRow(row);
563 if ( text(row,2) == selname ) { 563 if ( text(row,2) == selname ) {
564 r.append(c->email); 564 r.append(c->email);
565 } 565 }
566 } 566 }
567 567
568 */ 568 */
569 return r; 569 return r;
570} 570}
571 571
572 572
573void AbTable::updateVisible() 573void AbTable::updateVisible()
574{ 574{
575 //qWarning("void AbTable::updateVisible()"); 575 //qWarning("void AbTable::updateVisible()");
576 576
577 int visible, 577 int visible,
578 totalRows, 578 totalRows,
579 row, 579 row,
580 selectedRow = 0; 580 selectedRow = 0;
581 581
582 visible = 0; 582 visible = 0;
583 583
584 setPaintingEnabled( FALSE ); 584 setPaintingEnabled( FALSE );
585 585
586 realignTable(); 586 realignTable();
587 587
588 totalRows = numRows(); 588 totalRows = numRows();
589 for ( row = 0; row < totalRows; row++ ) { 589 for ( row = 0; row < totalRows; row++ ) {
590 if ( rowHeight(row) == 0 ) { 590 if ( rowHeight(row) == 0 ) {
591 showRow( row ); 591 showRow( row );
592 adjustRow( row ); 592 adjustRow( row );
593 if ( isSelected( row,0 ) || isSelected( row,1 ) ) 593 if ( isSelected( row,0 ) || isSelected( row,1 ) )
594 selectedRow = row; 594 selectedRow = row;
595 } 595 }
596 visible++; 596 visible++;
597 } 597 }
598 598
599 if ( selectedRow ) 599 if ( selectedRow )
600 setCurrentCell( selectedRow, 0 ); 600 setCurrentCell( selectedRow, 0 );
601 601
602 if ( !visible ) 602 if ( !visible )
603 setCurrentCell( -1, 0 ); 603 setCurrentCell( -1, 0 );
604 604
605 setPaintingEnabled( TRUE ); 605 setPaintingEnabled( TRUE );
606} 606}
607 607
608 608
609void AbTable::setPaintingEnabled( bool e ) 609void AbTable::setPaintingEnabled( bool e )
610{ 610{
611 //qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); 611 //qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested );
612 612
613 if ( e ) { 613 if ( e ) {
614 if ( countNested > 0 ) 614 if ( countNested > 0 )
615 --countNested; 615 --countNested;
616 if ( ! countNested ){ 616 if ( ! countNested ){
617 setUpdatesEnabled( true ); 617 setUpdatesEnabled( true );
618 enablePainting = true; 618 enablePainting = true;
619 rowHeightChanged( 0 ); 619 rowHeightChanged( 0 );
620 viewport()->update(); 620 viewport()->update();
621 } 621 }
622 } else { 622 } else {
623 ++countNested; 623 ++countNested;
624 enablePainting = false; 624 enablePainting = false;
625 setUpdatesEnabled( false ); 625 setUpdatesEnabled( false );
626 } 626 }
627 //qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); 627 //qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested );
628} 628}
629 629
630void AbTable::viewportPaintEvent( QPaintEvent* e ) { 630void AbTable::viewportPaintEvent( QPaintEvent* e ) {
631 //qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); 631 //qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting);
632 if ( enablePainting ) 632 if ( enablePainting )
633 QTable::viewportPaintEvent( e ); 633 QTable::viewportPaintEvent( e );
634} 634}
635 635
636void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { 636void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) {
637 const QColorGroup &cg = colorGroup(); 637 const QColorGroup &cg = colorGroup();
638 638
639 p->save(); 639 p->save();
640 640
641 //qWarning( "Paint row: %d", row ); 641 //qWarning( "Paint row: %d", row );
642 642
643 OContact act_contact = m_viewList[row]; 643 OContact act_contact = m_viewList[row];
644 644
645 // Paint alternating background bars 645 // Paint alternating background bars
646 if ( (row % 2 ) == 0 ) { 646 if ( (row % 2 ) == 0 ) {
647 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); 647 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) );
648 p->setPen( QPen( cg.text() ) ); 648 p->setPen( QPen( cg.text() ) );
649 } 649 }
650 else { 650 else {
651 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); 651 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) );
652 p->setPen( QPen( cg.buttonText() ) ); 652 p->setPen( QPen( cg.buttonText() ) );
653 } 653 }
654 654
655 QFont f = p->font(); 655 QFont f = p->font();
656 QFontMetrics fm(f); 656 QFontMetrics fm(f);
657 657
658 int marg = 2; 658 int marg = 2;
659 int x = 0; 659 int x = 0;
660 int y = ( cr.height() - 14 ) / 2; 660 int y = ( cr.height() - 14 ) / 2;
661 661
662 QString nameText = act_contact.fileAs(); 662 QString nameText = act_contact.fileAs();
663 663
664 switch( col ){ 664 switch( col ){
665 case 0: 665 case 0:
666 p->drawText( x + marg,2 + fm.ascent(), nameText ); 666 p->drawText( x + marg,2 + fm.ascent(), nameText );
667 break; 667 break;
668 case 1:{ 668 case 1:{
669 669
670 ContactItem contactItem = findContactContact( act_contact, 0 ); 670 ContactItem contactItem = findContactContact( act_contact, 0 );
671 QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */ 671 QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */
672 QString contactText = contactItem.value; 672 QString contactText = contactItem.value;
673 673
674 if ( !contactPic.isNull() ) 674 if ( !contactPic.isNull() )
675 { 675 {
676 p->drawPixmap( x + marg, y, contactPic ); 676 p->drawPixmap( x + marg, y, contactPic );
677 p->drawText( x + marg + contactPic.width() 677 p->drawText( x + marg + contactPic.width()
678 + 4,2 + fm.ascent(), contactText ); 678 + 4,2 + fm.ascent(), contactText );
679 } 679 }
680 else 680 else
681 { 681 {
682 p->drawText( x + marg,2 + fm.ascent(), contactText ); 682 p->drawText( x + marg,2 + fm.ascent(), contactText );
683 } 683 }
684 } 684 }
685 break; 685 break;
686 686
687 } 687 }
688 p->restore(); 688 p->restore();
689} 689}
690 690
691void AbTable::rowHeightChanged( int row ) 691void AbTable::rowHeightChanged( int row )
692{ 692{
693 if ( enablePainting ) 693 if ( enablePainting )
694 QTable::rowHeightChanged( row ); 694 QTable::rowHeightChanged( row );
695} 695}
696ContactItem AbTable::findContactContact( const OContact &entry, int /* row */ ) 696ContactItem AbTable::findContactContact( const OContact &entry, int /* row */ )
697{ 697{
698 698
699 ContactItem item; 699 ContactItem item;
700 700
701 item.value = ""; 701 item.value = "";
702 702
703 for ( QValueList<int>::ConstIterator it = intFields.begin(); 703 for ( QValueList<int>::ConstIterator it = intFields.begin();
704 it != intFields.end(); ++it ) { 704 it != intFields.end(); ++it ) {
705 switch ( *it ) { 705 switch ( *it ) {
706 default: 706 default:
707 break; 707 break;
708 case Qtopia::Title: 708 case Qtopia::Title:
709 item.value = entry.title(); 709 item.value = entry.title();
710 break; 710 break;
711 case Qtopia::Suffix: 711 case Qtopia::Suffix:
712 item.value = entry.suffix(); 712 item.value = entry.suffix();
713 break; 713 break;
714 case Qtopia::FileAs: 714 case Qtopia::FileAs:
715 item.value = entry.fileAs(); 715 item.value = entry.fileAs();
716 break; 716 break;
717 case Qtopia::DefaultEmail: 717 case Qtopia::DefaultEmail:
718 item.value = entry.defaultEmail(); 718 item.value = entry.defaultEmail();
719 if ( !item.value.isEmpty() ) 719 if ( !item.value.isEmpty() )
720 item.icon = Resource::loadPixmap( "addressbook/email" ); 720 item.icon = Resource::loadPixmap( "addressbook/email" );
721 break; 721 break;
722 case Qtopia::Emails: 722 case Qtopia::Emails:
723 item.value = entry.emails(); 723 item.value = entry.emails();
724 if ( !item.value.isEmpty() ) 724 if ( !item.value.isEmpty() )
725 item.icon = Resource::loadPixmap( "addressbook/email" ); 725 item.icon = Resource::loadPixmap( "addressbook/email" );
726 break; 726 break;
727 case Qtopia::HomeStreet: 727 case Qtopia::HomeStreet:
728 item.value = entry.homeStreet(); 728 item.value = entry.homeStreet();
729 break; 729 break;
730 case Qtopia::HomeCity: 730 case Qtopia::HomeCity:
731 item.value = entry.homeCity(); 731 item.value = entry.homeCity();
732 break; 732 break;
733 case Qtopia::HomeState: 733 case Qtopia::HomeState:
734 item.value = entry.homeState(); 734 item.value = entry.homeState();
735 break; 735 break;
736 case Qtopia::HomeZip: 736 case Qtopia::HomeZip:
737 item.value = entry.homeZip(); 737 item.value = entry.homeZip();
738 break; 738 break;
739 case Qtopia::HomeCountry: 739 case Qtopia::HomeCountry:
740 item.value = entry.homeCountry(); 740 item.value = entry.homeCountry();
741 break; 741 break;
742 case Qtopia::HomePhone: 742 case Qtopia::HomePhone:
743 item.value = entry.homePhone(); 743 item.value = entry.homePhone();
744 if ( !item.value.isEmpty() ) 744 if ( !item.value.isEmpty() )
745 item.icon = Resource::loadPixmap( "addressbook/phonehome" ); 745 item.icon = Resource::loadPixmap( "addressbook/phonehome" );
746 break; 746 break;
747 case Qtopia::HomeFax: 747 case Qtopia::HomeFax:
748 item.value = entry.homeFax(); 748 item.value = entry.homeFax();
749 if ( !item.value.isEmpty() ) 749 if ( !item.value.isEmpty() )
750 item.icon = Resource::loadPixmap( "addressbook/faxhome" ); 750 item.icon = Resource::loadPixmap( "addressbook/faxhome" );
751 break; 751 break;
752 case Qtopia::HomeMobile: 752 case Qtopia::HomeMobile:
753 item.value = entry.homeMobile(); 753 item.value = entry.homeMobile();
754 if ( !item.value.isEmpty() ) 754 if ( !item.value.isEmpty() )
755 item.icon = Resource::loadPixmap( "addressbook/mobilehome" ); 755 item.icon = Resource::loadPixmap( "addressbook/mobilehome" );
756 break; 756 break;
757 case Qtopia::HomeWebPage: 757 case Qtopia::HomeWebPage:
758 item.value = entry.homeWebpage(); 758 item.value = entry.homeWebpage();
759 if ( !item.value.isEmpty() ) 759 if ( !item.value.isEmpty() )
760 item.icon = Resource::loadPixmap( "addressbook/webpagehome" ); 760 item.icon = Resource::loadPixmap( "addressbook/webpagehome" );
761 break; 761 break;
762 case Qtopia::Company: 762 case Qtopia::Company:
763 item.value = entry.company(); 763 item.value = entry.company();
764 break; 764 break;
765 case Qtopia::BusinessCity: 765 case Qtopia::BusinessCity:
766 item.value = entry.businessCity(); 766 item.value = entry.businessCity();
767 break; 767 break;
768 case Qtopia::BusinessStreet: 768 case Qtopia::BusinessStreet:
769 item.value = entry.businessStreet(); 769 item.value = entry.businessStreet();
770 break; 770 break;
771 case Qtopia::BusinessZip: 771 case Qtopia::BusinessZip:
772 item.value = entry.businessZip(); 772 item.value = entry.businessZip();
773 break; 773 break;
774 case Qtopia::BusinessCountry: 774 case Qtopia::BusinessCountry:
775 item.value = entry.businessCountry(); 775 item.value = entry.businessCountry();
776 break; 776 break;
777 case Qtopia::BusinessWebPage: 777 case Qtopia::BusinessWebPage:
778 item.value = entry.businessWebpage(); 778 item.value = entry.businessWebpage();
779 if ( !item.value.isEmpty() ) 779 if ( !item.value.isEmpty() )
780 item.icon = Resource::loadPixmap( "addressbook/webpagework" ); 780 item.icon = Resource::loadPixmap( "addressbook/webpagework" );
781 break; 781 break;
782 case Qtopia::JobTitle: 782 case Qtopia::JobTitle:
783 item.value = entry.jobTitle(); 783 item.value = entry.jobTitle();
784 break; 784 break;
785 case Qtopia::Department: 785 case Qtopia::Department:
786 item.value = entry.department(); 786 item.value = entry.department();
787 break; 787 break;
788 case Qtopia::Office: 788 case Qtopia::Office:
789 item.value = entry.office(); 789 item.value = entry.office();
790 break; 790 break;
791 case Qtopia::BusinessPhone: 791 case Qtopia::BusinessPhone:
792 item.value = entry.businessPhone(); 792 item.value = entry.businessPhone();
793 if ( !item.value.isEmpty() ) 793 if ( !item.value.isEmpty() )
794 item.icon = Resource::loadPixmap( "addressbook/phonework" ); 794 item.icon = Resource::loadPixmap( "addressbook/phonework" );
795 break; 795 break;
796 case Qtopia::BusinessFax: 796 case Qtopia::BusinessFax:
797 item.value = entry.businessFax(); 797 item.value = entry.businessFax();
798 if ( !item.value.isEmpty() ) 798 if ( !item.value.isEmpty() )
799 item.icon = Resource::loadPixmap( "addressbook/faxwork" ); 799 item.icon = Resource::loadPixmap( "addressbook/faxwork" );
800 break; 800 break;
801 case Qtopia::BusinessMobile: 801 case Qtopia::BusinessMobile:
802 item.value = entry.businessMobile(); 802 item.value = entry.businessMobile();
803 if ( !item.value.isEmpty() ) 803 if ( !item.value.isEmpty() )
804 item.icon = Resource::loadPixmap( "addressbook/mobilework" ); 804 item.icon = Resource::loadPixmap( "addressbook/mobilework" );
805 break; 805 break;
806 case Qtopia::BusinessPager: 806 case Qtopia::BusinessPager:
807 item.value = entry.businessPager(); 807 item.value = entry.businessPager();
808 break; 808 break;
809 case Qtopia::Profession: 809 case Qtopia::Profession:
810 item.value = entry.profession(); 810 item.value = entry.profession();
811 break; 811 break;
812 case Qtopia::Assistant: 812 case Qtopia::Assistant:
813 item.value = entry.assistant(); 813 item.value = entry.assistant();
814 break; 814 break;
815 case Qtopia::Manager: 815 case Qtopia::Manager:
816 item.value = entry.manager(); 816 item.value = entry.manager();
817 break; 817 break;
818 case Qtopia::Spouse: 818 case Qtopia::Spouse:
819 item.value = entry.spouse(); 819 item.value = entry.spouse();
820 break; 820 break;
821 case Qtopia::Gender: 821 case Qtopia::Gender:
822 item.value = entry.gender(); 822 item.value = entry.gender();
823 break; 823 break;
824 case Qtopia::Birthday: 824 case Qtopia::Birthday:
825 if ( ! entry.birthday().isNull() ){ 825 if ( ! entry.birthday().isNull() ){
826 item.value = TimeString::numberDateString( entry.birthday() ); 826 item.value = TimeString::numberDateString( entry.birthday() );
827 } 827 }
828 break; 828 break;
829 case Qtopia::Anniversary: 829 case Qtopia::Anniversary:
830 if ( ! entry.anniversary().isNull() ){ 830 if ( ! entry.anniversary().isNull() ){
831 item.value = TimeString::numberDateString( entry.anniversary() ); 831 item.value = TimeString::numberDateString( entry.anniversary() );
832 } 832 }
833 break; 833 break;
834 case Qtopia::Nickname: 834 case Qtopia::Nickname:
835 item.value = entry.nickname(); 835 item.value = entry.nickname();
836 break; 836 break;
837 case Qtopia::Children: 837 case Qtopia::Children:
838 item.value = entry.children(); 838 item.value = entry.children();
839 break; 839 break;
840 case Qtopia::Notes: 840 case Qtopia::Notes:
841 item.value = entry.notes(); 841 item.value = entry.notes();
842 break; 842 break;
843 } 843 }
844 if ( !item.value.isEmpty() ) 844 if ( !item.value.isEmpty() )
845 break; 845 break;
846 } 846 }
847 return item; 847 return item;
848} 848}
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp
index 6cbd556..670cdb0 100644
--- a/core/pim/addressbook/abview.cpp
+++ b/core/pim/addressbook/abview.cpp
@@ -1,505 +1,506 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) 2** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de)
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** 14**
15**********************************************************************/ 15**********************************************************************/
16 16
17#include "abview.h" 17#include "abview.h"
18 18
19#include <qlayout.h> 19#include <qlayout.h>
20 20
21#include <qpe/global.h> 21#include <qpe/global.h>
22 22
23#include <opie/ocontactaccessbackend_vcard.h> 23#include <opie/ocontactaccessbackend_vcard.h>
24 24
25#include <assert.h> 25#include <assert.h>
26 26
27 27
28// Is defined in LibQPE 28// Is defined in LibQPE
29extern QString categoryFileName(); 29extern QString categoryFileName();
30 30
31QString addressbookPersonalVCardName() 31QString addressbookPersonalVCardName()
32{ 32{
33 QString filename = Global::applicationFileName("addressbook", 33 QString filename = Global::applicationFileName("addressbook",
34 "businesscard.vcf"); 34 "businesscard.vcf");
35 return filename; 35 return filename;
36} 36}
37 37
38 38
39AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): 39AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ):
40 QWidget(parent), 40 QWidget(parent),
41 mCat(0), 41 mCat(0),
42 m_inSearch( false ), 42 m_inSearch( false ),
43 m_inPersonal( false ), 43 m_inPersonal( false ),
44 m_curr_category( -1 ), 44 m_curr_category( -1 ),
45 m_curr_View( TableView ), 45 m_curr_View( TableView ),
46 m_prev_View( TableView ), 46 m_prev_View( TableView ),
47 m_curr_Contact ( 0 ), 47 m_curr_Contact ( 0 ),
48 m_contactdb ( 0l ), 48 m_contactdb ( 0l ),
49 m_storedDB ( 0l ), 49 m_storedDB ( 0l ),
50 m_viewStack( 0l ), 50 m_viewStack( 0l ),
51 m_abTable( 0l ), 51 m_abTable( 0l ),
52 m_orderedFields( ordered ) 52 m_orderedFields( ordered )
53{ 53{
54 qWarning("AbView::c'tor"); 54 qWarning("AbView::c'tor");
55 // Load default database and handle syncing myself.. ! 55 // Load default database and handle syncing myself.. !
56 m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ), 56 m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false );
57 m_contactdb -> setReadAhead( 16 ); // Use ReadAhead-Cache if available
57 mCat.load( categoryFileName() ); 58 mCat.load( categoryFileName() );
58 59
59 // Create Layout and put WidgetStack into it. 60 // Create Layout and put WidgetStack into it.
60 QVBoxLayout *vb = new QVBoxLayout( this ); 61 QVBoxLayout *vb = new QVBoxLayout( this );
61 m_viewStack = new QWidgetStack( this ); 62 m_viewStack = new QWidgetStack( this );
62 vb->addWidget( m_viewStack ); 63 vb->addWidget( m_viewStack );
63 64
64 // Creat TableView 65 // Creat TableView
65 QVBox* tableBox = new QVBox( m_viewStack ); 66 QVBox* tableBox = new QVBox( m_viewStack );
66 m_abTable = new AbTable( m_orderedFields, tableBox, "table" ); 67 m_abTable = new AbTable( m_orderedFields, tableBox, "table" );
67 m_abTable->setCurrentCell( 0, 0 ); 68 m_abTable->setCurrentCell( 0, 0 );
68 m_abTable->setFocus(); 69 m_abTable->setFocus();
69 70
70 // Add TableView to WidgetStack and raise it 71 // Add TableView to WidgetStack and raise it
71 m_viewStack -> addWidget( tableBox , TableView ); 72 m_viewStack -> addWidget( tableBox , TableView );
72 73
73 // Create CardView and add it to WidgetStack 74 // Create CardView and add it to WidgetStack
74 QVBox* cardBox = new QVBox( m_viewStack ); 75 QVBox* cardBox = new QVBox( m_viewStack );
75 m_ablabel = new AbLabel( cardBox, "CardView"); 76 m_ablabel = new AbLabel( cardBox, "CardView");
76 m_viewStack -> addWidget( cardBox , CardView ); 77 m_viewStack -> addWidget( cardBox , CardView );
77 78
78 // Connect views to me 79 // Connect views to me
79 connect ( m_abTable, SIGNAL( signalSwitch( void ) ), 80 connect ( m_abTable, SIGNAL( signalSwitch( void ) ),
80 this, SLOT( slotSwitch( void ) ) ); 81 this, SLOT( slotSwitch( void ) ) );
81 connect ( m_ablabel, SIGNAL( signalOkPressed( void ) ), 82 connect ( m_ablabel, SIGNAL( signalOkPressed( void ) ),
82 this, SLOT( slotSwitch( void ) ) ); 83 this, SLOT( slotSwitch( void ) ) );
83 84
84 load(); 85 load();
85} 86}
86 87
87AbView::~AbView() 88AbView::~AbView()
88{ 89{
89 m_contactdb -> save(); 90 m_contactdb -> save();
90 delete m_contactdb; 91 delete m_contactdb;
91 92
92 if ( m_storedDB ){ 93 if ( m_storedDB ){
93 m_storedDB -> save(); 94 m_storedDB -> save();
94 delete m_storedDB; 95 delete m_storedDB;
95 } 96 }
96} 97}
97 98
98 99
99void AbView::setView( Views view ) 100void AbView::setView( Views view )
100{ 101{
101 qWarning("AbView::setView( Views view )"); 102 qWarning("AbView::setView( Views view )");
102 m_curr_View = view; 103 m_curr_View = view;
103 load(); 104 load();
104} 105}
105 106
106void AbView::addEntry( const OContact &newContact ) 107void AbView::addEntry( const OContact &newContact )
107{ 108{
108 qWarning("abview:AddContact"); 109 qWarning("abview:AddContact");
109 m_contactdb->add ( newContact ); 110 m_contactdb->add ( newContact );
110 load(); 111 load();
111 112
112} 113}
113void AbView::removeEntry( const int UID ) 114void AbView::removeEntry( const int UID )
114{ 115{
115 qWarning("abview:RemoveContact"); 116 qWarning("abview:RemoveContact");
116 m_contactdb->remove( UID ); 117 m_contactdb->remove( UID );
117 load(); 118 load();
118} 119}
119 120
120void AbView::replaceEntry( const OContact &contact ) 121void AbView::replaceEntry( const OContact &contact )
121{ 122{
122 qWarning("abview:ReplaceContact"); 123 qWarning("abview:ReplaceContact");
123 m_contactdb->replace( contact ); 124 m_contactdb->replace( contact );
124 load(); 125 load();
125 126
126} 127}
127 128
128OContact AbView::currentEntry() 129OContact AbView::currentEntry()
129{ 130{
130 OContact currentContact; 131 OContact currentContact;
131 132
132 switch ( (int) m_curr_View ) { 133 switch ( (int) m_curr_View ) {
133 case TableView: 134 case TableView:
134 currentContact = m_abTable -> currentEntry(); 135 currentContact = m_abTable -> currentEntry();
135 break; 136 break;
136 case CardView: 137 case CardView:
137 currentContact = m_ablabel -> currentEntry(); 138 currentContact = m_ablabel -> currentEntry();
138 break; 139 break;
139 } 140 }
140 m_curr_Contact = currentContact.uid(); 141 m_curr_Contact = currentContact.uid();
141 return currentContact; 142 return currentContact;
142} 143}
143 144
144bool AbView::save() 145bool AbView::save()
145{ 146{
146 //qWarning("abView:Save data"); 147 //qWarning("abView:Save data");
147 148
148 return m_contactdb->save(); 149 return m_contactdb->save();
149} 150}
150 151
151void AbView::load() 152void AbView::load()
152{ 153{
153 qWarning("abView:Load data"); 154 qWarning("abView:Load data");
154 155
155 // Letter Search is stopped at this place 156 // Letter Search is stopped at this place
156 emit signalClearLetterPicker(); 157 emit signalClearLetterPicker();
157 158
158 if ( m_inPersonal ) 159 if ( m_inPersonal )
159 // VCard Backend does not sort.. 160 // VCard Backend does not sort..
160 m_list = m_contactdb->allRecords(); 161 m_list = m_contactdb->allRecords();
161 else{ 162 else{
162 m_list = m_contactdb->sorted( true, 0, 0, 0 ); 163 m_list = m_contactdb->sorted( true, 0, 0, 0 );
163 if ( m_curr_category != -1 ) 164 if ( m_curr_category != -1 )
164 clearForCategory(); 165 clearForCategory();
165 } 166 }
166 167
167 qWarning ("Number of contacts: %d", m_list.count()); 168 qWarning ("Number of contacts: %d", m_list.count());
168 169
169 updateView( true ); 170 updateView( true );
170 171
171} 172}
172 173
173void AbView::reload() 174void AbView::reload()
174{ 175{
175 qWarning( "void AbView::reload()" ); 176 qWarning( "void AbView::reload()" );
176 177
177 m_contactdb->reload(); 178 m_contactdb->reload();
178 load(); 179 load();
179} 180}
180 181
181void AbView::clear() 182void AbView::clear()
182{ 183{
183 // :SX 184 // :SX
184} 185}
185 186
186void AbView::setShowByCategory( const QString& cat ) 187void AbView::setShowByCategory( const QString& cat )
187{ 188{
188 qWarning("AbView::setShowCategory( const QString& cat )"); 189 qWarning("AbView::setShowCategory( const QString& cat )");
189 190
190 int intCat = 0; 191 int intCat = 0;
191 192
192 // All (cat == NULL) will be stored as -1 193 // All (cat == NULL) will be stored as -1
193 if ( cat.isNull() ) 194 if ( cat.isNull() )
194 intCat = -1; 195 intCat = -1;
195 else 196 else
196 intCat = mCat.id("Contacts", cat ); 197 intCat = mCat.id("Contacts", cat );
197 198
198 // Just do anything if we really change the category 199 // Just do anything if we really change the category
199 if ( intCat != m_curr_category ){ 200 if ( intCat != m_curr_category ){
200 // qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); 201 // qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category);
201 202
202 m_curr_category = intCat; 203 m_curr_category = intCat;
203 emit signalClearLetterPicker(); 204 emit signalClearLetterPicker();
204 205
205 load(); 206 load();
206 } 207 }
207 208
208} 209}
209 210
210void AbView::setShowToView( Views view ) 211void AbView::setShowToView( Views view )
211{ 212{
212 qWarning("void AbView::setShowToView( View %d )", view); 213 qWarning("void AbView::setShowToView( View %d )", view);
213 214
214 if ( m_curr_View != view ){ 215 if ( m_curr_View != view ){
215 qWarning ("Change the View (Category is: %d)", m_curr_category); 216 qWarning ("Change the View (Category is: %d)", m_curr_category);
216 m_prev_View = m_curr_View; 217 m_prev_View = m_curr_View;
217 m_curr_View = view; 218 m_curr_View = view;
218 219
219 updateView(); 220 updateView();
220 } 221 }
221 222
222} 223}
223 224
224void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) 225void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode )
225{ 226{
226 qWarning("void AbView::setShowByLetter( %c, %d )", c, mode ); 227 qWarning("void AbView::setShowByLetter( %c, %d )", c, mode );
227 228
228 assert( mode < AbConfig::LASTELEMENT ); 229 assert( mode < AbConfig::LASTELEMENT );
229 230
230 OContact query; 231 OContact query;
231 if ( c == 0 ){ 232 if ( c == 0 ){
232 load(); 233 load();
233 return; 234 return;
234 }else{ 235 }else{
235 // If the current Backend is unable to solve the query, we will 236 // If the current Backend is unable to solve the query, we will
236 // ignore the request .. 237 // ignore the request ..
237 if ( ! m_contactdb->hasQuerySettings( OContactAccess::WildCards | OContactAccess::IgnoreCase ) ){ 238 if ( ! m_contactdb->hasQuerySettings( OContactAccess::WildCards | OContactAccess::IgnoreCase ) ){
238 return; 239 return;
239 } 240 }
240 241
241 switch( mode ){ 242 switch( mode ){
242 case AbConfig::LastName: 243 case AbConfig::LastName:
243 query.setLastName( QString("%1*").arg(c) ); 244 query.setLastName( QString("%1*").arg(c) );
244 break; 245 break;
245 case AbConfig::FileAs: 246 case AbConfig::FileAs:
246 query.setFileAs( QString("%1*").arg(c) ); 247 query.setFileAs( QString("%1*").arg(c) );
247 break; 248 break;
248 default: 249 default:
249 qWarning( "Unknown Searchmode for AbView::setShowByLetter ! -> %d", mode ); 250 qWarning( "Unknown Searchmode for AbView::setShowByLetter ! -> %d", mode );
250 qWarning( "I will ignore it.." ); 251 qWarning( "I will ignore it.." );
251 return; 252 return;
252 } 253 }
253 m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase ); 254 m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase );
254 if ( m_curr_category != -1 ) 255 if ( m_curr_category != -1 )
255 clearForCategory(); 256 clearForCategory();
256 m_curr_Contact = 0; 257 m_curr_Contact = 0;
257 } 258 }
258 updateView( true ); 259 updateView( true );
259} 260}
260 261
261void AbView::setListOrder( const QValueList<int>& ordered ) 262void AbView::setListOrder( const QValueList<int>& ordered )
262{ 263{
263 m_orderedFields = ordered; 264 m_orderedFields = ordered;
264 if ( m_abTable ){ 265 if ( m_abTable ){
265 m_abTable->setOrderedList( ordered ); 266 m_abTable->setOrderedList( ordered );
266 m_abTable->refresh(); 267 m_abTable->refresh();
267 } 268 }
268 updateView(); 269 updateView();
269} 270}
270 271
271 272
272QString AbView::showCategory() const 273QString AbView::showCategory() const
273{ 274{
274 return mCat.label( "Contacts", m_curr_category ); 275 return mCat.label( "Contacts", m_curr_category );
275} 276}
276 277
277void AbView::showPersonal( bool personal ) 278void AbView::showPersonal( bool personal )
278{ 279{
279 qWarning ("void AbView::showPersonal( %d )", personal); 280 qWarning ("void AbView::showPersonal( %d )", personal);
280 281
281 if ( personal ){ 282 if ( personal ){
282 283
283 if ( m_inPersonal ) 284 if ( m_inPersonal )
284 return; 285 return;
285 286
286 // Now switch to vCard Backend and load data. 287 // Now switch to vCard Backend and load data.
287 // The current default backend will be stored 288 // The current default backend will be stored
288 // to avoid unneeded load/stores. 289 // to avoid unneeded load/stores.
289 m_storedDB = m_contactdb; 290 m_storedDB = m_contactdb;
290 291
291 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 292 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
292 addressbookPersonalVCardName() ); 293 addressbookPersonalVCardName() );
293 m_contactdb = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 294 m_contactdb = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
294 295
295 m_inPersonal = true; 296 m_inPersonal = true;
296 m_curr_View = CardView; 297 m_curr_View = CardView;
297 298
298 }else{ 299 }else{
299 300
300 if ( !m_inPersonal ) 301 if ( !m_inPersonal )
301 return; 302 return;
302 303
303 // Remove vCard Backend and restore default 304 // Remove vCard Backend and restore default
304 m_contactdb->save(); 305 m_contactdb->save();
305 delete m_contactdb; 306 delete m_contactdb;
306 307
307 m_contactdb = m_storedDB; 308 m_contactdb = m_storedDB;
308 m_storedDB = 0l; 309 m_storedDB = 0l;
309 310
310 m_curr_View = TableView; 311 m_curr_View = TableView;
311 m_inPersonal = false; 312 m_inPersonal = false;
312 313
313 } 314 }
314 load(); 315 load();
315} 316}
316 317
317void AbView::setCurrentUid( int uid ){ 318void AbView::setCurrentUid( int uid ){
318 319
319 m_curr_Contact = uid; 320 m_curr_Contact = uid;
320 updateView( true ); //true: Don't modificate the UID ! 321 updateView( true ); //true: Don't modificate the UID !
321} 322}
322 323
323 324
324QStringList AbView::categories() 325QStringList AbView::categories()
325{ 326{
326 mCat.load( categoryFileName() ); 327 mCat.load( categoryFileName() );
327 QStringList categoryList = mCat.labels( "Contacts" ); 328 QStringList categoryList = mCat.labels( "Contacts" );
328 return categoryList; 329 return categoryList;
329} 330}
330 331
331// BEGIN: Slots 332// BEGIN: Slots
332void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, 333void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp,
333 bool , QString cat ) 334 bool , QString cat )
334{ 335{
335 //qWarning( "void AbView::slotDoFind" ); 336 //qWarning( "void AbView::slotDoFind" );
336 337
337 // We reloading the data: Deselect Letterpicker 338 // We reloading the data: Deselect Letterpicker
338 emit signalClearLetterPicker(); 339 emit signalClearLetterPicker();
339 340
340 // Use the current Category if nothing else selected 341 // Use the current Category if nothing else selected
341 int category = 0; 342 int category = 0;
342 343
343 if ( cat.isEmpty() ) 344 if ( cat.isEmpty() )
344 category = m_curr_category; 345 category = m_curr_category;
345 else{ 346 else{
346 category = mCat.id("Contacts", cat ); 347 category = mCat.id("Contacts", cat );
347 } 348 }
348 349
349 //qWarning ("Find in Category %d", category); 350 //qWarning ("Find in Category %d", category);
350 351
351 QRegExp r( str ); 352 QRegExp r( str );
352 r.setCaseSensitive( caseSensitive ); 353 r.setCaseSensitive( caseSensitive );
353 r.setWildcard( !useRegExp ); 354 r.setWildcard( !useRegExp );
354 355
355 // Get all matching entries out of the database 356 // Get all matching entries out of the database
356 m_list = m_contactdb->matchRegexp( r ); 357 m_list = m_contactdb->matchRegexp( r );
357 358
358 //qWarning( "found: %d", m_list.count() ); 359 //qWarning( "found: %d", m_list.count() );
359 if ( m_list.count() == 0 ){ 360 if ( m_list.count() == 0 ){
360 emit signalNotFound(); 361 emit signalNotFound();
361 return; 362 return;
362 } 363 }
363 364
364 // Now remove all contacts with wrong category (if any selected) 365 // Now remove all contacts with wrong category (if any selected)
365 // This algorithm is a litte bit ineffective, but 366 // This algorithm is a litte bit ineffective, but
366 // we will not have a lot of matching entries.. 367 // we will not have a lot of matching entries..
367 if ( m_curr_category != -1 ) 368 if ( m_curr_category != -1 )
368 clearForCategory(); 369 clearForCategory();
369 370
370 // Now show all found entries 371 // Now show all found entries
371 updateView( true ); 372 updateView( true );
372} 373}
373 374
374void AbView::offSearch() 375void AbView::offSearch()
375{ 376{
376 m_inSearch = false; 377 m_inSearch = false;
377 378
378 load(); 379 load();
379} 380}
380 381
381void AbView::slotSwitch(){ 382void AbView::slotSwitch(){
382 //qWarning("AbView::slotSwitch()"); 383 //qWarning("AbView::slotSwitch()");
383 384
384 m_prev_View = m_curr_View; 385 m_prev_View = m_curr_View;
385 switch ( (int) m_curr_View ){ 386 switch ( (int) m_curr_View ){
386 case TableView: 387 case TableView:
387 qWarning("Switching to CardView"); 388 qWarning("Switching to CardView");
388 m_curr_View = CardView; 389 m_curr_View = CardView;
389 break; 390 break;
390 case CardView: 391 case CardView:
391 qWarning("Switching to TableView"); 392 qWarning("Switching to TableView");
392 m_curr_View = TableView; 393 m_curr_View = TableView;
393 break; 394 break;
394 } 395 }
395 updateView(); 396 updateView();
396 397
397} 398}
398 399
399// END: Slots 400// END: Slots
400 401
401void AbView::clearForCategory() 402void AbView::clearForCategory()
402{ 403{
403 OContactAccess::List::Iterator it; 404 OContactAccess::List::Iterator it;
404 // Now remove all contacts with wrong category if any category selected 405 // Now remove all contacts with wrong category if any category selected
405 406
406 OContactAccess::List allList = m_list; 407 OContactAccess::List allList = m_list;
407 if ( m_curr_category != -1 ){ 408 if ( m_curr_category != -1 ){
408 for ( it = allList.begin(); it != allList.end(); ++it ){ 409 for ( it = allList.begin(); it != allList.end(); ++it ){
409 if ( !contactCompare( *it, m_curr_category ) ){ 410 if ( !contactCompare( *it, m_curr_category ) ){
410 // qWarning("Removing %d", (*it).uid()); 411 // qWarning("Removing %d", (*it).uid());
411 m_list.remove( (*it).uid() ); 412 m_list.remove( (*it).uid() );
412 } 413 }
413 } 414 }
414 } 415 }
415 416
416} 417}
417 418
418bool AbView::contactCompare( const OContact &cnt, int category ) 419bool AbView::contactCompare( const OContact &cnt, int category )
419{ 420{
420 //qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category); 421 //qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category);
421 422
422 bool returnMe; 423 bool returnMe;
423 QArray<int> cats; 424 QArray<int> cats;
424 cats = cnt.categories(); 425 cats = cnt.categories();
425 426
426 //qWarning ("Number of categories: %d", cats.count() ); 427 //qWarning ("Number of categories: %d", cats.count() );
427 428
428 returnMe = false; 429 returnMe = false;
429 if ( cats.count() == 0 && category == 0 ) 430 if ( cats.count() == 0 && category == 0 )
430 // Contacts with no category will just shown on "All" and "Unfiled" 431 // Contacts with no category will just shown on "All" and "Unfiled"
431 returnMe = true; 432 returnMe = true;
432 else { 433 else {
433 int i; 434 int i;
434 for ( i = 0; i < int(cats.count()); i++ ) { 435 for ( i = 0; i < int(cats.count()); i++ ) {
435 // qWarning("Comparing %d with %d",cats[i],category ); 436 // qWarning("Comparing %d with %d",cats[i],category );
436 if ( cats[i] == category ) { 437 if ( cats[i] == category ) {
437 returnMe = true; 438 returnMe = true;
438 break; 439 break;
439 } 440 }
440 } 441 }
441 } 442 }
442 //qWarning ("Return: %d", returnMe); 443 //qWarning ("Return: %d", returnMe);
443 return returnMe; 444 return returnMe;
444} 445}
445 446
446// In Some rare cases we have to update all lists.. 447// In Some rare cases we have to update all lists..
447void AbView::updateListinViews() 448void AbView::updateListinViews()
448{ 449{
449 m_abTable -> setContacts( m_list ); 450 m_abTable -> setContacts( m_list );
450 m_ablabel -> setContacts( m_list ); 451 m_ablabel -> setContacts( m_list );
451} 452}
452 453
453void AbView::updateView( bool newdata ) 454void AbView::updateView( bool newdata )
454{ 455{
455 //qWarning("AbView::updateView()"); 456 //qWarning("AbView::updateView()");
456 457
457 if ( m_viewStack -> visibleWidget() ){ 458 if ( m_viewStack -> visibleWidget() ){
458 m_viewStack -> visibleWidget() -> clearFocus(); 459 m_viewStack -> visibleWidget() -> clearFocus();
459 } 460 }
460 461
461 // If we switching the view, we have to store some information 462 // If we switching the view, we have to store some information
462 if ( !newdata ){ 463 if ( !newdata ){
463 if ( m_list.count() ){ 464 if ( m_list.count() ){
464 switch ( (int) m_prev_View ) { 465 switch ( (int) m_prev_View ) {
465 case TableView: 466 case TableView:
466 m_curr_Contact = m_abTable -> currentEntry_UID(); 467 m_curr_Contact = m_abTable -> currentEntry_UID();
467 break; 468 break;
468 case CardView: 469 case CardView:
469 m_curr_Contact = m_ablabel -> currentEntry_UID(); 470 m_curr_Contact = m_ablabel -> currentEntry_UID();
470 break; 471 break;
471 } 472 }
472 }else 473 }else
473 m_curr_Contact = 0; 474 m_curr_Contact = 0;
474 } 475 }
475 476
476 // Feed all views with new lists 477 // Feed all views with new lists
477 if ( newdata ) 478 if ( newdata )
478 updateListinViews(); 479 updateListinViews();
479 480
480 // Tell the world that the view is changed 481 // Tell the world that the view is changed
481 if ( m_curr_View != m_prev_View ) 482 if ( m_curr_View != m_prev_View )
482 emit signalViewSwitched ( (int) m_curr_View ); 483 emit signalViewSwitched ( (int) m_curr_View );
483 484
484 m_prev_View = m_curr_View; 485 m_prev_View = m_curr_View;
485 486
486 // Switch to new View 487 // Switch to new View
487 switch ( (int) m_curr_View ) { 488 switch ( (int) m_curr_View ) {
488 case TableView: 489 case TableView:
489 m_abTable -> setChoiceSelection( m_orderedFields ); 490 m_abTable -> setChoiceSelection( m_orderedFields );
490 if ( m_curr_Contact != 0 ) 491 if ( m_curr_Contact != 0 )
491 m_abTable -> selectContact ( m_curr_Contact ); 492 m_abTable -> selectContact ( m_curr_Contact );
492 m_abTable -> setFocus(); 493 m_abTable -> setFocus();
493 break; 494 break;
494 case CardView: 495 case CardView:
495 if ( m_curr_Contact != 0 ) 496 if ( m_curr_Contact != 0 )
496 m_ablabel -> selectContact( m_curr_Contact ); 497 m_ablabel -> selectContact( m_curr_Contact );
497 m_ablabel -> setFocus(); 498 m_ablabel -> setFocus();
498 break; 499 break;
499 } 500 }
500 501
501 // Raise the current View 502 // Raise the current View
502 m_viewStack -> raiseWidget( m_curr_View ); 503 m_viewStack -> raiseWidget( m_curr_View );
503} 504}
504 505
505 506
diff --git a/core/pim/addressbook/addressbook.pro b/core/pim/addressbook/addressbook.pro
index 1637cac..c90568a 100644
--- a/core/pim/addressbook/addressbook.pro
+++ b/core/pim/addressbook/addressbook.pro
@@ -1,53 +1,51 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 #CONFIG = qt warn_on release 2 #CONFIG = qt warn_on release
3 CONFIG = qt warn_on debug 3 CONFIG = qt warn_on debug
4 DESTDIR = $(OPIEDIR)/bin 4 DESTDIR = $(OPIEDIR)/bin
5 HEADERS= addressbook.h \ 5 HEADERS= addressbook.h \
6 contacteditor.h \ 6 contacteditor.h \
7 ocontactfields.h \
8 ablabel.h \ 7 ablabel.h \
9 abtable.h \ 8 abtable.h \
10 picker.h \ 9 picker.h \
11 ofloatbar.h \ 10 ofloatbar.h \
12 configdlg.h \ 11 configdlg.h \
13 abconfig.h \ 12 abconfig.h \
14 abview.h 13 abview.h
15 SOURCES= main.cpp \ 14 SOURCES= main.cpp \
16 addressbook.cpp \ 15 addressbook.cpp \
17 contacteditor.cpp \ 16 contacteditor.cpp \
18 ocontactfields.cpp \
19 ablabel.cpp \ 17 ablabel.cpp \
20 abtable.cpp \ 18 abtable.cpp \
21 picker.cpp \ 19 picker.cpp \
22 configdlg.cpp \ 20 configdlg.cpp \
23 abconfig.cpp \ 21 abconfig.cpp \
24 abview.cpp 22 abview.cpp
25 23
26 INTERFACES= configdlg_base.ui 24 INTERFACES= configdlg_base.ui
27 TARGET = addressbook 25 TARGET = addressbook
28INCLUDEPATH += $(OPIEDIR)/include 26INCLUDEPATH += $(OPIEDIR)/include
29 DEPENDPATH+= $(OPIEDIR)/include 27 DEPENDPATH+= $(OPIEDIR)/include
30LIBS += -lqpe -lopie 28LIBS += -lqpe -lopie
31 29
32TRANSLATIONS = ../../../i18n/de/addressbook.ts \ 30TRANSLATIONS = ../../../i18n/de/addressbook.ts \
33 ../../../i18n/nl/addressbook.ts \ 31 ../../../i18n/nl/addressbook.ts \
34 ../../../i18n/da/addressbook.ts \ 32 ../../../i18n/da/addressbook.ts \
35 ../../../i18n/xx/addressbook.ts \ 33 ../../../i18n/xx/addressbook.ts \
36 ../../../i18n/en/addressbook.ts \ 34 ../../../i18n/en/addressbook.ts \
37 ../../../i18n/es/addressbook.ts \ 35 ../../../i18n/es/addressbook.ts \
38 ../../../i18n/fr/addressbook.ts \ 36 ../../../i18n/fr/addressbook.ts \
39 ../../../i18n/hu/addressbook.ts \ 37 ../../../i18n/hu/addressbook.ts \
40 ../../../i18n/ja/addressbook.ts \ 38 ../../../i18n/ja/addressbook.ts \
41 ../../../i18n/ko/addressbook.ts \ 39 ../../../i18n/ko/addressbook.ts \
42 ../../../i18n/no/addressbook.ts \ 40 ../../../i18n/no/addressbook.ts \
43 ../../../i18n/pl/addressbook.ts \ 41 ../../../i18n/pl/addressbook.ts \
44 ../../../i18n/pt/addressbook.ts \ 42 ../../../i18n/pt/addressbook.ts \
45 ../../../i18n/pt_BR/addressbook.ts \ 43 ../../../i18n/pt_BR/addressbook.ts \
46 ../../../i18n/sl/addressbook.ts \ 44 ../../../i18n/sl/addressbook.ts \
47 ../../../i18n/zh_CN/addressbook.ts \ 45 ../../../i18n/zh_CN/addressbook.ts \
48 ../../../i18n/it/addressbook.ts \ 46 ../../../i18n/it/addressbook.ts \
49 ../../../i18n/zh_TW/addressbook.ts 47 ../../../i18n/zh_TW/addressbook.ts
50 48
51 49
52 50
53include ( $(OPIEDIR)/include.pro ) 51include ( $(OPIEDIR)/include.pro )
diff --git a/core/pim/addressbook/configdlg.cpp b/core/pim/addressbook/configdlg.cpp
index 629feef..981f5e0 100644
--- a/core/pim/addressbook/configdlg.cpp
+++ b/core/pim/addressbook/configdlg.cpp
@@ -1,154 +1,154 @@
1#include "configdlg.h" 1#include "configdlg.h"
2#include "ocontactfields.h"
3 2
4#include <qcheckbox.h> 3#include <qcheckbox.h>
5#include <qradiobutton.h> 4#include <qradiobutton.h>
6#include <qlistbox.h> 5#include <qlistbox.h>
7#include <qpushbutton.h> 6#include <qpushbutton.h>
8#include <qiconset.h> 7#include <qiconset.h>
9 8
10#include <qpe/resource.h> 9#include <qpe/resource.h>
11 10
12#include <opie/ocontact.h> 11#include <opie/ocontact.h>
12#include "opie/ocontactfields.h"
13 13
14ConfigDlg::ConfigDlg( QWidget *parent, const char *name): 14ConfigDlg::ConfigDlg( QWidget *parent, const char *name):
15 ConfigDlg_Base(parent, name, true ) 15 ConfigDlg_Base(parent, name, true )
16{ 16{
17 contFields = OContactFields::trfields(); 17 contFields = OContactFields::trfields();
18 18
19 // We add all Fields into the Listbox 19 // We add all Fields into the Listbox
20 for (uint i=0; i < contFields.count(); i++) { 20 for (uint i=0; i < contFields.count(); i++) {
21 allFieldListBox->insertItem( contFields[i] ); 21 allFieldListBox->insertItem( contFields[i] );
22 } 22 }
23 23
24 // Reset Widget Flags: This was not changeable by designer :( 24 // Reset Widget Flags: This was not changeable by designer :(
25 setWFlags ( WStyle_ContextHelp ); 25 setWFlags ( WStyle_ContextHelp );
26 26
27 // Set Pics to Buttons and Tabs 27 // Set Pics to Buttons and Tabs
28 m_upButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/up" ) ) ); 28 m_upButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/up" ) ) );
29 m_downButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/down" ) ) ); 29 m_downButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/down" ) ) );
30 m_addButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/add" ) ) ); 30 m_addButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/add" ) ) );
31 m_removeButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/sub" ) ) ); 31 m_removeButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/sub" ) ) );
32 32
33 33
34 // Get the translation maps between Field ID and translated strings 34 // Get the translation maps between Field ID and translated strings
35 m_mapStrToID = OContactFields::trFieldsToId(); 35 m_mapStrToID = OContactFields::trFieldsToId();
36 m_mapIDToStr = OContactFields::idToTrFields(); 36 m_mapIDToStr = OContactFields::idToTrFields();
37 37
38 connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) ); 38 connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) );
39 connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) ); 39 connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) );
40 connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) ); 40 connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) );
41 connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) ); 41 connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) );
42} 42}
43 43
44void ConfigDlg::slotItemUp() 44void ConfigDlg::slotItemUp()
45{ 45{
46 qWarning( "void ConfigDlg::slotItemUp()" ); 46 qWarning( "void ConfigDlg::slotItemUp()" );
47 47
48 int i = fieldListBox->currentItem(); 48 int i = fieldListBox->currentItem();
49 if ( i > 0 ) { 49 if ( i > 0 ) {
50 QString item = fieldListBox->currentText(); 50 QString item = fieldListBox->currentText();
51 fieldListBox->removeItem( i ); 51 fieldListBox->removeItem( i );
52 fieldListBox->insertItem( item, i-1 ); 52 fieldListBox->insertItem( item, i-1 );
53 fieldListBox->setCurrentItem( i-1 ); 53 fieldListBox->setCurrentItem( i-1 );
54 } 54 }
55 55
56} 56}
57 57
58void ConfigDlg::slotItemDown() 58void ConfigDlg::slotItemDown()
59{ 59{
60 qWarning( "void ConfigDlg::slotItemDown()" ); 60 qWarning( "void ConfigDlg::slotItemDown()" );
61 61
62 int i = fieldListBox->currentItem(); 62 int i = fieldListBox->currentItem();
63 if ( i < (int)fieldListBox->count() - 1 ) { 63 if ( i < (int)fieldListBox->count() - 1 ) {
64 QString item = fieldListBox->currentText(); 64 QString item = fieldListBox->currentText();
65 fieldListBox->removeItem( i ); 65 fieldListBox->removeItem( i );
66 fieldListBox->insertItem( item, i+1 ); 66 fieldListBox->insertItem( item, i+1 );
67 fieldListBox->setCurrentItem( i+1 ); 67 fieldListBox->setCurrentItem( i+1 );
68 } 68 }
69} 69}
70 70
71void ConfigDlg::slotItemAdd() 71void ConfigDlg::slotItemAdd()
72{ 72{
73 qWarning( "void ConfigDlg::slotItemAdd()" ); 73 qWarning( "void ConfigDlg::slotItemAdd()" );
74 74
75 int i = allFieldListBox->currentItem(); 75 int i = allFieldListBox->currentItem();
76 if ( i > 0 ) { 76 if ( i > 0 ) {
77 QString item = allFieldListBox->currentText(); 77 QString item = allFieldListBox->currentText();
78 qWarning("ADding %s", item.latin1()); 78 qWarning("ADding %s", item.latin1());
79 fieldListBox->insertItem( item ); 79 fieldListBox->insertItem( item );
80 } 80 }
81} 81}
82 82
83void ConfigDlg::slotItemRemove() 83void ConfigDlg::slotItemRemove()
84{ 84{
85 qWarning( "void ConfigDlg::slotItemRemove()" ); 85 qWarning( "void ConfigDlg::slotItemRemove()" );
86 86
87 int i = fieldListBox->currentItem(); 87 int i = fieldListBox->currentItem();
88 if ( i > 0 ) { 88 if ( i > 0 ) {
89 fieldListBox->removeItem( i ); 89 fieldListBox->removeItem( i );
90 } 90 }
91} 91}
92 92
93void ConfigDlg::setConfig( const AbConfig& cnf ) 93void ConfigDlg::setConfig( const AbConfig& cnf )
94{ 94{
95 m_config = cnf; 95 m_config = cnf;
96 96
97 m_useRegExp->setChecked( m_config.useRegExp() ); 97 m_useRegExp->setChecked( m_config.useRegExp() );
98 m_useWildCard->setChecked( m_config.useWildCards() ); 98 m_useWildCard->setChecked( m_config.useWildCards() );
99 m_useQtMail->setChecked( m_config.useQtMail() ); 99 m_useQtMail->setChecked( m_config.useQtMail() );
100 m_useOpieMail->setChecked( m_config.useOpieMail() ); 100 m_useOpieMail->setChecked( m_config.useOpieMail() );
101 m_useCaseSensitive->setChecked( m_config.beCaseSensitive() ); 101 m_useCaseSensitive->setChecked( m_config.beCaseSensitive() );
102 102
103 switch( m_config.fontSize() ){ 103 switch( m_config.fontSize() ){
104 case 0: 104 case 0:
105 m_smallFont->setChecked( true ); 105 m_smallFont->setChecked( true );
106 m_normalFont->setChecked( false ); 106 m_normalFont->setChecked( false );
107 m_largeFont->setChecked( false ); 107 m_largeFont->setChecked( false );
108 break; 108 break;
109 case 1: 109 case 1:
110 m_smallFont->setChecked( false ); 110 m_smallFont->setChecked( false );
111 m_normalFont->setChecked( true ); 111 m_normalFont->setChecked( true );
112 m_largeFont->setChecked( false ); 112 m_largeFont->setChecked( false );
113 break; 113 break;
114 case 2: 114 case 2:
115 m_smallFont->setChecked( false ); 115 m_smallFont->setChecked( false );
116 m_normalFont->setChecked( false ); 116 m_normalFont->setChecked( false );
117 m_largeFont->setChecked( true ); 117 m_largeFont->setChecked( true );
118 break; 118 break;
119 } 119 }
120 120
121 for( uint i = 0; i < m_config.orderList().count(); i++ ) { 121 for( uint i = 0; i < m_config.orderList().count(); i++ ) {
122 fieldListBox -> insertItem ( m_mapIDToStr[ m_config.orderList()[i] ] ); 122 fieldListBox -> insertItem ( m_mapIDToStr[ m_config.orderList()[i] ] );
123 } 123 }
124 124
125 m_fixedBars->setChecked( m_config.fixedBars() ); 125 m_fixedBars->setChecked( m_config.fixedBars() );
126 m_moveBars->setChecked( !m_config.fixedBars() ); 126 m_moveBars->setChecked( !m_config.fixedBars() );
127} 127}
128 128
129AbConfig ConfigDlg::getConfig() 129AbConfig ConfigDlg::getConfig()
130{ 130{
131 m_config.setUseRegExp( m_useRegExp->isOn() ); 131 m_config.setUseRegExp( m_useRegExp->isOn() );
132 m_config.setUseWildCards( m_useWildCard->isOn() ); 132 m_config.setUseWildCards( m_useWildCard->isOn() );
133 m_config.setUseQtMail( m_useQtMail->isOn() ); 133 m_config.setUseQtMail( m_useQtMail->isOn() );
134 m_config.setUseOpieMail( m_useOpieMail->isOn() ); 134 m_config.setUseOpieMail( m_useOpieMail->isOn() );
135 m_config.setBeCaseSensitive( m_useCaseSensitive->isChecked() ); 135 m_config.setBeCaseSensitive( m_useCaseSensitive->isChecked() );
136 136
137 if ( m_smallFont->isChecked() ) 137 if ( m_smallFont->isChecked() )
138 m_config.setFontSize( 0 ); 138 m_config.setFontSize( 0 );
139 if ( m_normalFont->isChecked() ) 139 if ( m_normalFont->isChecked() )
140 m_config.setFontSize( 1 ); 140 m_config.setFontSize( 1 );
141 if ( m_largeFont->isChecked() ) 141 if ( m_largeFont->isChecked() )
142 m_config.setFontSize( 2 ); 142 m_config.setFontSize( 2 );
143 143
144 QValueList<int> orderlist; 144 QValueList<int> orderlist;
145 for( int i = 0; i < (int)fieldListBox->count(); i++ ) { 145 for( int i = 0; i < (int)fieldListBox->count(); i++ ) {
146 orderlist.append( m_mapStrToID[ fieldListBox->text(i) ] ); 146 orderlist.append( m_mapStrToID[ fieldListBox->text(i) ] );
147 } 147 }
148 m_config.setOrderList( orderlist ); 148 m_config.setOrderList( orderlist );
149 149
150 m_config.setFixedBars( m_fixedBars->isChecked() ); 150 m_config.setFixedBars( m_fixedBars->isChecked() );
151 151
152 return m_config; 152 return m_config;
153} 153}
154 154
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 9d1a1c7..8fbd065 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -1,1560 +1,1559 @@
1/* 1/*
2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> 2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org>
3 * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) 3 * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de)
4 * 4 *
5 * This file is an add-on for the OPIE Palmtop Environment 5 * This file is an add-on for the OPIE Palmtop Environment
6 * 6 *
7 * This file may be distributed and/or modified under the terms of the 7 * This file may be distributed and/or modified under the terms of the
8 * GNU General Public License version 2 as published by the Free Software 8 * GNU General Public License version 2 as published by the Free Software
9 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging 9 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging
10 * of this file. 10 * of this file.
11 * 11 *
12 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 * 14 *
15 * 15 *
16 * This is a rewrite of the abeditor.h file, modified to provide a more 16 * This is a rewrite of the abeditor.h file, modified to provide a more
17 * intuitive interface to TrollTech's original Address Book editor. This 17 * intuitive interface to TrollTech's original Address Book editor. This
18 * is made to operate exactly in interface with the exception of name. 18 * is made to operate exactly in interface with the exception of name.
19 * 19 *
20 */ 20 */
21 21
22#include "contacteditor.h" 22#include "contacteditor.h"
23#include "addresspicker.h" 23#include "addresspicker.h"
24#include "ocontactfields.h"
25 24
26#include <qpe/categoryselect.h> 25#include <qpe/categoryselect.h>
27#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
28#include <qpe/qpedialog.h> 27#include <qpe/qpedialog.h>
29#include <qpe/timeconversion.h> 28#include <qpe/timeconversion.h>
30#include <opie/ocontact.h> 29#include <opie/ocontact.h>
31#include <qpe/resource.h> 30#include <qpe/resource.h>
32 31
33#include <qcombobox.h> 32#include <qcombobox.h>
34#include <qlabel.h> 33#include <qlabel.h>
35#include <qtabwidget.h> 34#include <qtabwidget.h>
36#include <qlayout.h> 35#include <qlayout.h>
37#include <qlineedit.h> 36#include <qlineedit.h>
38#include <qmultilineedit.h> 37#include <qmultilineedit.h>
39#include <qscrollview.h> 38#include <qscrollview.h>
40#include <qtoolbutton.h> 39#include <qtoolbutton.h>
41#include <qpushbutton.h> 40#include <qpushbutton.h>
42#include <qmainwindow.h> 41#include <qmainwindow.h>
43#include <qvaluelist.h> 42#include <qvaluelist.h>
44#include <qpopupmenu.h> 43#include <qpopupmenu.h>
45#include <qlistbox.h> 44#include <qlistbox.h>
46#include <qhbox.h> 45#include <qhbox.h>
47#include <qaction.h> 46#include <qaction.h>
48#include <qiconset.h> 47#include <qiconset.h>
49#include <qmessagebox.h> 48#include <qmessagebox.h>
50#include <qwhatsthis.h> 49#include <qwhatsthis.h>
51 50
52#include <assert.h> 51#include <assert.h>
53 52
54static inline bool containsAlphaNum( const QString &str ); 53static inline bool containsAlphaNum( const QString &str );
55static inline bool constainsWhiteSpace( const QString &str ); 54static inline bool constainsWhiteSpace( const QString &str );
56 55
57// helper functions, convert our comma delimited list to proper 56// helper functions, convert our comma delimited list to proper
58// file format... 57// file format...
59void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 58void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
60 QString &strAll ); 59 QString &strAll );
61 60
62// helper convert from file format to comma delimited... 61// helper convert from file format to comma delimited...
63void parseEmailTo( const QString &strDefaultEmail, 62void parseEmailTo( const QString &strDefaultEmail,
64 const QString &strOtherEmail, QString &strBack ); 63 const QString &strOtherEmail, QString &strBack );
65 64
66 ContactEditor::ContactEditor(const OContact &entry, 65 ContactEditor::ContactEditor(const OContact &entry,
67 QWidget *parent, 66 QWidget *parent,
68 const char *name, 67 const char *name,
69 WFlags ) 68 WFlags )
70 : QDialog( parent, name, TRUE, WStyle_ContextHelp ), 69 : QDialog( parent, name, TRUE, WStyle_ContextHelp ),
71 defaultEmailChooserPosition( -1 ), 70 defaultEmailChooserPosition( -1 ),
72 m_personalView ( false ), 71 m_personalView ( false ),
73 cmbDefaultEmail( 0 ), 72 cmbDefaultEmail( 0 ),
74 initializing ( false ) 73 initializing ( false )
75{ 74{
76 75
77 initializing = true; 76 initializing = true;
78 77
79 init(); 78 init();
80 setEntry( entry ); 79 setEntry( entry );
81 // cmbDefaultEmail = 0; 80 // cmbDefaultEmail = 0;
82 // defaultEmailChooserPosition = -1; 81 // defaultEmailChooserPosition = -1;
83 82
84 initializing = false; 83 initializing = false;
85} 84}
86 85
87ContactEditor::~ContactEditor() { 86ContactEditor::~ContactEditor() {
88} 87}
89 88
90void ContactEditor::init() { 89void ContactEditor::init() {
91 qWarning("init() START"); 90 qWarning("init() START");
92 91
93 uint i = 0; 92 uint i = 0;
94 93
95 QStringList trlChooserNames; 94 QStringList trlChooserNames;
96 95
97 for (i = 0; i <= 6; i++) { 96 for (i = 0; i <= 6; i++) {
98 slHomeAddress.append( "" ); 97 slHomeAddress.append( "" );
99 slBusinessAddress.append( "" ); 98 slBusinessAddress.append( "" );
100 } 99 }
101 100
102 trlChooserNames = OContactFields::trphonefields( false ); 101 trlChooserNames = OContactFields::trphonefields( false );
103 slChooserNames = OContactFields::untrphonefields( false ); 102 slChooserNames = OContactFields::untrphonefields( false );
104 slDynamicEntries = OContactFields::untrdetailsfields( false ); 103 slDynamicEntries = OContactFields::untrdetailsfields( false );
105 trlDynamicEntries = OContactFields::trdetailsfields( false ); 104 trlDynamicEntries = OContactFields::trdetailsfields( false );
106 105
107 // Ok, we have to remove elements from the list of dynamic entries 106 // Ok, we have to remove elements from the list of dynamic entries
108 // which are now stored in special (not dynamic) widgets.. 107 // which are now stored in special (not dynamic) widgets..
109 // Otherwise we will get problems with field assignments! (se) 108 // Otherwise we will get problems with field assignments! (se)
110 slDynamicEntries.remove("Anniversary"); 109 slDynamicEntries.remove("Anniversary");
111 slDynamicEntries.remove("Birthday"); 110 slDynamicEntries.remove("Birthday");
112 slDynamicEntries.remove("Gender"); 111 slDynamicEntries.remove("Gender");
113 112
114 // The same with translated fields.. But I will 113 // The same with translated fields.. But I will
115 // use the translation map to avoid mismatches.. 114 // use the translation map to avoid mismatches..
116 QMap<int, QString> translMap = OContactFields::idToTrFields(); 115 QMap<int, QString> translMap = OContactFields::idToTrFields();
117 trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); 116 trlDynamicEntries.remove( translMap[Qtopia::Anniversary] );
118 trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); 117 trlDynamicEntries.remove( translMap[Qtopia::Birthday] );
119 trlDynamicEntries.remove( translMap[Qtopia::Gender] ); 118 trlDynamicEntries.remove( translMap[Qtopia::Gender] );
120 119
121 // Last Check to be sure.. 120 // Last Check to be sure..
122 assert( slDynamicEntries.count() == trlDynamicEntries.count() ); 121 assert( slDynamicEntries.count() == trlDynamicEntries.count() );
123 assert( slChooserNames.count() == trlChooserNames.count() ); 122 assert( slChooserNames.count() == trlChooserNames.count() );
124 123
125 for (i = 0; i < slChooserNames.count(); i++) 124 for (i = 0; i < slChooserNames.count(); i++)
126 slChooserValues.append(""); 125 slChooserValues.append("");
127 126
128 127
129 QVBoxLayout *vb = new QVBoxLayout( this ); 128 QVBoxLayout *vb = new QVBoxLayout( this );
130 129
131 tabMain = new QTabWidget( this ); 130 tabMain = new QTabWidget( this );
132 vb->addWidget( tabMain ); 131 vb->addWidget( tabMain );
133 132
134 QWidget *tabViewport = new QWidget ( tabMain ); 133 QWidget *tabViewport = new QWidget ( tabMain );
135 134
136 vb = new QVBoxLayout( tabViewport ); 135 vb = new QVBoxLayout( tabViewport );
137 136
138 svGeneral = new QScrollView( tabViewport ); 137 svGeneral = new QScrollView( tabViewport );
139 vb->addWidget( svGeneral, 0, 0 ); 138 vb->addWidget( svGeneral, 0, 0 );
140 svGeneral->setResizePolicy( QScrollView::AutoOneFit ); 139 svGeneral->setResizePolicy( QScrollView::AutoOneFit );
141 // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); 140 // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff );
142 // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); 141 // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff );
143 svGeneral->setFrameStyle( QFrame::NoFrame ); 142 svGeneral->setFrameStyle( QFrame::NoFrame );
144 143
145 QWidget *container = new QWidget( svGeneral->viewport() ); 144 QWidget *container = new QWidget( svGeneral->viewport() );
146 svGeneral->addChild( container ); 145 svGeneral->addChild( container );
147 146
148 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); 147 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 );
149 gl->setResizeMode( QLayout::FreeResize ); 148 gl->setResizeMode( QLayout::FreeResize );
150 149
151 btnFullName = new QPushButton( tr( "Full Name..." ), container ); 150 btnFullName = new QPushButton( tr( "Full Name..." ), container );
152 QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); 151 QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) );
153 gl->addWidget( btnFullName, 0, 0 ); 152 gl->addWidget( btnFullName, 0, 0 );
154 txtFullName = new QLineEdit( container ); 153 txtFullName = new QLineEdit( container );
155 QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) ); 154 QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) );
156 gl->addWidget( txtFullName, 0, 1 ); 155 gl->addWidget( txtFullName, 0, 1 );
157 156
158 QLabel *l = new QLabel( tr( "Job Title" ), container ); 157 QLabel *l = new QLabel( tr( "Job Title" ), container );
159 QWhatsThis::add( l, tr( "The jobtitle.." ) ); 158 QWhatsThis::add( l, tr( "The jobtitle.." ) );
160 gl->addWidget( l, 1, 0 ); 159 gl->addWidget( l, 1, 0 );
161 txtJobTitle = new QLineEdit( container ); 160 txtJobTitle = new QLineEdit( container );
162 QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) ); 161 QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) );
163 gl->addWidget( txtJobTitle, 1, 1 ); 162 gl->addWidget( txtJobTitle, 1, 1 );
164 163
165 l = new QLabel( tr("Suffix"), container ); 164 l = new QLabel( tr("Suffix"), container );
166 QWhatsThis::add( l, tr( "Something like \"jr.\".." ) ); 165 QWhatsThis::add( l, tr( "Something like \"jr.\".." ) );
167 gl->addWidget( l, 2, 0 ); 166 gl->addWidget( l, 2, 0 );
168 txtSuffix = new QLineEdit( container ); 167 txtSuffix = new QLineEdit( container );
169 QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); 168 QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) );
170 gl->addWidget( txtSuffix, 2, 1 ); 169 gl->addWidget( txtSuffix, 2, 1 );
171 170
172 l = new QLabel( tr( "Organization" ), container ); 171 l = new QLabel( tr( "Organization" ), container );
173 QWhatsThis::add( l, tr( "The working place of the contact" ) ); 172 QWhatsThis::add( l, tr( "The working place of the contact" ) );
174 gl->addWidget( l, 3, 0 ); 173 gl->addWidget( l, 3, 0 );
175 txtOrganization = new QLineEdit( container ); 174 txtOrganization = new QLineEdit( container );
176 QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); 175 QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) );
177 gl->addWidget( txtOrganization, 3, 1 ); 176 gl->addWidget( txtOrganization, 3, 1 );
178 177
179 // Chooser 1 178 // Chooser 1
180 cmbChooserField1 = new QComboBox( FALSE, container ); 179 cmbChooserField1 = new QComboBox( FALSE, container );
181 QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); 180 QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) );
182 cmbChooserField1->setMaximumWidth( 90 ); 181 cmbChooserField1->setMaximumWidth( 90 );
183 gl->addWidget( cmbChooserField1, 4, 0 ); 182 gl->addWidget( cmbChooserField1, 4, 0 );
184 // Textfield for chooser 1. 183 // Textfield for chooser 1.
185 // Now use Widgetstack to contain the textfield and the default-email combo ! 184 // Now use Widgetstack to contain the textfield and the default-email combo !
186 m_widgetStack1 = new QWidgetStack( container ); 185 m_widgetStack1 = new QWidgetStack( container );
187 txtChooserField1 = new QLineEdit( m_widgetStack1 ); 186 txtChooserField1 = new QLineEdit( m_widgetStack1 );
188 m_widgetStack1 -> addWidget( txtChooserField1, TextField ); 187 m_widgetStack1 -> addWidget( txtChooserField1, TextField );
189 gl->addWidget( m_widgetStack1, 4, 1 ); 188 gl->addWidget( m_widgetStack1, 4, 1 );
190 m_widgetStack1 -> raiseWidget( TextField ); 189 m_widgetStack1 -> raiseWidget( TextField );
191 190
192 // Chooser 2 191 // Chooser 2
193 cmbChooserField2 = new QComboBox( FALSE, container ); 192 cmbChooserField2 = new QComboBox( FALSE, container );
194 QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); 193 QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) );
195 cmbChooserField2->setMaximumWidth( 90 ); 194 cmbChooserField2->setMaximumWidth( 90 );
196 gl->addWidget( cmbChooserField2, 5, 0 ); 195 gl->addWidget( cmbChooserField2, 5, 0 );
197 // Textfield for chooser 2 196 // Textfield for chooser 2
198 // Now use WidgetStack to contain the textfield and the default-email combo! 197 // Now use WidgetStack to contain the textfield and the default-email combo!
199 m_widgetStack2 = new QWidgetStack( container ); 198 m_widgetStack2 = new QWidgetStack( container );
200 txtChooserField2 = new QLineEdit( m_widgetStack2 ); 199 txtChooserField2 = new QLineEdit( m_widgetStack2 );
201 m_widgetStack2 -> addWidget( txtChooserField2, TextField ); 200 m_widgetStack2 -> addWidget( txtChooserField2, TextField );
202 gl->addWidget( m_widgetStack2, 5, 1 ); 201 gl->addWidget( m_widgetStack2, 5, 1 );
203 m_widgetStack2 -> raiseWidget( TextField ); 202 m_widgetStack2 -> raiseWidget( TextField );
204 203
205 // Chooser 3 204 // Chooser 3
206 cmbChooserField3 = new QComboBox( FALSE, container ); 205 cmbChooserField3 = new QComboBox( FALSE, container );
207 QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); 206 QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) );
208 cmbChooserField3->setMaximumWidth( 90 ); 207 cmbChooserField3->setMaximumWidth( 90 );
209 gl->addWidget( cmbChooserField3, 6, 0 ); 208 gl->addWidget( cmbChooserField3, 6, 0 );
210 // Textfield for chooser 2 209 // Textfield for chooser 2
211 // Now use WidgetStack to contain the textfield and the default-email combo! 210 // Now use WidgetStack to contain the textfield and the default-email combo!
212 m_widgetStack3 = new QWidgetStack( container ); 211 m_widgetStack3 = new QWidgetStack( container );
213 txtChooserField3 = new QLineEdit( m_widgetStack3 ); 212 txtChooserField3 = new QLineEdit( m_widgetStack3 );
214 m_widgetStack3 -> addWidget( txtChooserField3, TextField ); 213 m_widgetStack3 -> addWidget( txtChooserField3, TextField );
215 gl->addWidget( m_widgetStack3, 6, 1 ); 214 gl->addWidget( m_widgetStack3, 6, 1 );
216 m_widgetStack3 -> raiseWidget( TextField ); 215 m_widgetStack3 -> raiseWidget( TextField );
217 216
218 l = new QLabel( tr( "File As" ), container ); 217 l = new QLabel( tr( "File As" ), container );
219 QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); 218 QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) );
220 gl->addWidget( l, 7, 0 ); 219 gl->addWidget( l, 7, 0 );
221 cmbFileAs = new QComboBox( TRUE, container ); 220 cmbFileAs = new QComboBox( TRUE, container );
222 gl->addWidget( cmbFileAs, 7, 1 ); 221 gl->addWidget( cmbFileAs, 7, 1 );
223 222
224 labCat = new QLabel( tr( "Category" ), container ); 223 labCat = new QLabel( tr( "Category" ), container );
225 gl->addWidget( labCat, 8, 0 ); 224 gl->addWidget( labCat, 8, 0 );
226 cmbCat = new CategorySelect( container ); 225 cmbCat = new CategorySelect( container );
227 gl->addWidget( cmbCat, 8, 1 ); 226 gl->addWidget( cmbCat, 8, 1 );
228 labCat->show(); 227 labCat->show();
229 cmbCat->show(); 228 cmbCat->show();
230 229
231 btnNote = new QPushButton( tr( "Notes..." ), container ); 230 btnNote = new QPushButton( tr( "Notes..." ), container );
232 gl->addWidget( btnNote, 9, 1 ); 231 gl->addWidget( btnNote, 9, 1 );
233 232
234 tabMain->insertTab( tabViewport, tr( "General" ) ); 233 tabMain->insertTab( tabViewport, tr( "General" ) );
235 234
236 tabViewport = new QWidget ( tabMain ); 235 tabViewport = new QWidget ( tabMain );
237 236
238 vb = new QVBoxLayout( tabViewport ); 237 vb = new QVBoxLayout( tabViewport );
239 238
240 svAddress = new QScrollView( tabViewport ); 239 svAddress = new QScrollView( tabViewport );
241 vb->addWidget( svAddress, 0, 0 ); 240 vb->addWidget( svAddress, 0, 0 );
242 svAddress->setResizePolicy( QScrollView::AutoOneFit ); 241 svAddress->setResizePolicy( QScrollView::AutoOneFit );
243 svAddress->setFrameStyle( QFrame::NoFrame ); 242 svAddress->setFrameStyle( QFrame::NoFrame );
244 243
245 container = new QWidget( svAddress->viewport() ); 244 container = new QWidget( svAddress->viewport() );
246 svAddress->addChild( container ); 245 svAddress->addChild( container );
247 246
248 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem 247 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem
249 248
250 cmbAddress = new QComboBox( FALSE, container ); 249 cmbAddress = new QComboBox( FALSE, container );
251 cmbAddress->insertItem( tr( "Business" ) ); 250 cmbAddress->insertItem( tr( "Business" ) );
252 cmbAddress->insertItem( tr( "Home" ) ); 251 cmbAddress->insertItem( tr( "Home" ) );
253 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); 252 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 );
254 253
255 l = new QLabel( tr( "Address" ), container ); 254 l = new QLabel( tr( "Address" ), container );
256 gl->addWidget( l, 1, 0 ); 255 gl->addWidget( l, 1, 0 );
257 txtAddress = new QLineEdit( container ); 256 txtAddress = new QLineEdit( container );
258 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); 257 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 );
259 258
260 l = new QLabel( tr( "City" ), container ); 259 l = new QLabel( tr( "City" ), container );
261 gl->addWidget( l, 2, 0 ); 260 gl->addWidget( l, 2, 0 );
262 txtCity = new QLineEdit( container ); 261 txtCity = new QLineEdit( container );
263 gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); 262 gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 );
264 263
265 l = new QLabel( tr( "State" ), container ); 264 l = new QLabel( tr( "State" ), container );
266 gl->addWidget( l, 3, 0 ); 265 gl->addWidget( l, 3, 0 );
267 txtState = new QLineEdit( container ); 266 txtState = new QLineEdit( container );
268 gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); 267 gl->addMultiCellWidget( txtState, 3, 3, 1, 2 );
269 268
270 l = new QLabel( tr( "Zip Code" ), container ); 269 l = new QLabel( tr( "Zip Code" ), container );
271 gl->addWidget( l, 4, 0 ); 270 gl->addWidget( l, 4, 0 );
272 txtZip = new QLineEdit( container ); 271 txtZip = new QLineEdit( container );
273 gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); 272 gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 );
274 273
275 l = new QLabel( tr( "Country" ), container ); 274 l = new QLabel( tr( "Country" ), container );
276 gl->addWidget( l, 5, 0 ); 275 gl->addWidget( l, 5, 0 );
277 cmbCountry = new QComboBox( TRUE, container ); 276 cmbCountry = new QComboBox( TRUE, container );
278 cmbCountry->insertItem( tr( "" ) ); 277 cmbCountry->insertItem( tr( "" ) );
279 cmbCountry->insertItem( tr ( "United States" ) ); 278 cmbCountry->insertItem( tr ( "United States" ) );
280 cmbCountry->insertItem( tr ( "United Kingdom" ) ); 279 cmbCountry->insertItem( tr ( "United Kingdom" ) );
281 cmbCountry->insertItem( tr ( "Afghanistan" ) ); 280 cmbCountry->insertItem( tr ( "Afghanistan" ) );
282 cmbCountry->insertItem( tr ( "Albania" ) ); 281 cmbCountry->insertItem( tr ( "Albania" ) );
283 cmbCountry->insertItem( tr ( "Algeria" ) ); 282 cmbCountry->insertItem( tr ( "Algeria" ) );
284 cmbCountry->insertItem( tr ( "American Samoa" ) ); 283 cmbCountry->insertItem( tr ( "American Samoa" ) );
285 cmbCountry->insertItem( tr ( "Andorra" ) ); 284 cmbCountry->insertItem( tr ( "Andorra" ) );
286 cmbCountry->insertItem( tr ( "Angola" ) ); 285 cmbCountry->insertItem( tr ( "Angola" ) );
287 cmbCountry->insertItem( tr ( "Anguilla" ) ); 286 cmbCountry->insertItem( tr ( "Anguilla" ) );
288 cmbCountry->insertItem( tr ( "Antarctica" ) ); 287 cmbCountry->insertItem( tr ( "Antarctica" ) );
289 cmbCountry->insertItem( tr ( "Argentina" ) ); 288 cmbCountry->insertItem( tr ( "Argentina" ) );
290 cmbCountry->insertItem( tr ( "Armenia" ) ); 289 cmbCountry->insertItem( tr ( "Armenia" ) );
291 cmbCountry->insertItem( tr ( "Aruba" ) ); 290 cmbCountry->insertItem( tr ( "Aruba" ) );
292 cmbCountry->insertItem( tr ( "Australia" ) ); 291 cmbCountry->insertItem( tr ( "Australia" ) );
293 cmbCountry->insertItem( tr ( "Austria" ) ); 292 cmbCountry->insertItem( tr ( "Austria" ) );
294 cmbCountry->insertItem( tr ( "Azerbaijan" ) ); 293 cmbCountry->insertItem( tr ( "Azerbaijan" ) );
295 cmbCountry->insertItem( tr ( "Bahamas" ) ); 294 cmbCountry->insertItem( tr ( "Bahamas" ) );
296 cmbCountry->insertItem( tr ( "Bahrain" ) ); 295 cmbCountry->insertItem( tr ( "Bahrain" ) );
297 cmbCountry->insertItem( tr ( "Bangladesh" ) ); 296 cmbCountry->insertItem( tr ( "Bangladesh" ) );
298 cmbCountry->insertItem( tr ( "Barbados" ) ); 297 cmbCountry->insertItem( tr ( "Barbados" ) );
299 cmbCountry->insertItem( tr ( "Belarus" ) ); 298 cmbCountry->insertItem( tr ( "Belarus" ) );
300 cmbCountry->insertItem( tr ( "Belgium" ) ); 299 cmbCountry->insertItem( tr ( "Belgium" ) );
301 cmbCountry->insertItem( tr ( "Belize" ) ); 300 cmbCountry->insertItem( tr ( "Belize" ) );
302 cmbCountry->insertItem( tr ( "Benin" ) ); 301 cmbCountry->insertItem( tr ( "Benin" ) );
303 cmbCountry->insertItem( tr ( "Bermuda" ) ); 302 cmbCountry->insertItem( tr ( "Bermuda" ) );
304 cmbCountry->insertItem( tr ( "Bhutan" ) ); 303 cmbCountry->insertItem( tr ( "Bhutan" ) );
305 cmbCountry->insertItem( tr ( "Bolivia" ) ); 304 cmbCountry->insertItem( tr ( "Bolivia" ) );
306 cmbCountry->insertItem( tr ( "Botswana" ) ); 305 cmbCountry->insertItem( tr ( "Botswana" ) );
307 cmbCountry->insertItem( tr ( "Bouvet Island" ) ); 306 cmbCountry->insertItem( tr ( "Bouvet Island" ) );
308 cmbCountry->insertItem( tr ( "Brazil" ) ); 307 cmbCountry->insertItem( tr ( "Brazil" ) );
309 cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); 308 cmbCountry->insertItem( tr ( "Brunei Darussalam" ) );
310 cmbCountry->insertItem( tr ( "Bulgaria" ) ); 309 cmbCountry->insertItem( tr ( "Bulgaria" ) );
311 cmbCountry->insertItem( tr ( "Burkina Faso" ) ); 310 cmbCountry->insertItem( tr ( "Burkina Faso" ) );
312 cmbCountry->insertItem( tr ( "Burundi" ) ); 311 cmbCountry->insertItem( tr ( "Burundi" ) );
313 cmbCountry->insertItem( tr ( "Cambodia" ) ); 312 cmbCountry->insertItem( tr ( "Cambodia" ) );
314 cmbCountry->insertItem( tr ( "Cameroon" ) ); 313 cmbCountry->insertItem( tr ( "Cameroon" ) );
315 cmbCountry->insertItem( tr ( "Canada" ) ); 314 cmbCountry->insertItem( tr ( "Canada" ) );
316 cmbCountry->insertItem( tr ( "Cape Verde" ) ); 315 cmbCountry->insertItem( tr ( "Cape Verde" ) );
317 cmbCountry->insertItem( tr ( "Cayman Islands" ) ); 316 cmbCountry->insertItem( tr ( "Cayman Islands" ) );
318 cmbCountry->insertItem( tr ( "Chad" ) ); 317 cmbCountry->insertItem( tr ( "Chad" ) );
319 cmbCountry->insertItem( tr ( "Chile" ) ); 318 cmbCountry->insertItem( tr ( "Chile" ) );
320 cmbCountry->insertItem( tr ( "China" ) ); 319 cmbCountry->insertItem( tr ( "China" ) );
321 cmbCountry->insertItem( tr ( "Christmas Island" ) ); 320 cmbCountry->insertItem( tr ( "Christmas Island" ) );
322 cmbCountry->insertItem( tr ( "Colombia" ) ); 321 cmbCountry->insertItem( tr ( "Colombia" ) );
323 cmbCountry->insertItem( tr ( "Comoros" ) ); 322 cmbCountry->insertItem( tr ( "Comoros" ) );
324 cmbCountry->insertItem( tr ( "Congo" ) ); 323 cmbCountry->insertItem( tr ( "Congo" ) );
325 cmbCountry->insertItem( tr ( "Cook Island" ) ); 324 cmbCountry->insertItem( tr ( "Cook Island" ) );
326 cmbCountry->insertItem( tr ( "Costa Rica" ) ); 325 cmbCountry->insertItem( tr ( "Costa Rica" ) );
327 cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); 326 cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) );
328 cmbCountry->insertItem( tr ( "Croatia" ) ); 327 cmbCountry->insertItem( tr ( "Croatia" ) );
329 cmbCountry->insertItem( tr ( "Cuba" ) ); 328 cmbCountry->insertItem( tr ( "Cuba" ) );
330 cmbCountry->insertItem( tr ( "Cyprus" ) ); 329 cmbCountry->insertItem( tr ( "Cyprus" ) );
331 cmbCountry->insertItem( tr ( "Czech Republic" ) ); 330 cmbCountry->insertItem( tr ( "Czech Republic" ) );
332 cmbCountry->insertItem( tr ( "Denmark" ) ); 331 cmbCountry->insertItem( tr ( "Denmark" ) );
333 cmbCountry->insertItem( tr ( "Djibouti" ) ); 332 cmbCountry->insertItem( tr ( "Djibouti" ) );
334 cmbCountry->insertItem( tr ( "Dominica" ) ); 333 cmbCountry->insertItem( tr ( "Dominica" ) );
335 cmbCountry->insertItem( tr ( "Dominican Republic" ) ); 334 cmbCountry->insertItem( tr ( "Dominican Republic" ) );
336 cmbCountry->insertItem( tr ( "East Timor" ) ); 335 cmbCountry->insertItem( tr ( "East Timor" ) );
337 cmbCountry->insertItem( tr ( "Ecuador" ) ); 336 cmbCountry->insertItem( tr ( "Ecuador" ) );
338 cmbCountry->insertItem( tr ( "Egypt" ) ); 337 cmbCountry->insertItem( tr ( "Egypt" ) );
339 cmbCountry->insertItem( tr ( "El Salvador" ) ); 338 cmbCountry->insertItem( tr ( "El Salvador" ) );
340 cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); 339 cmbCountry->insertItem( tr ( "Equatorial Guinea" ) );
341 cmbCountry->insertItem( tr ( "Eritrea" ) ); 340 cmbCountry->insertItem( tr ( "Eritrea" ) );
342 cmbCountry->insertItem( tr ( "Estonia" ) ); 341 cmbCountry->insertItem( tr ( "Estonia" ) );
343 cmbCountry->insertItem( tr ( "Ethiopia" ) ); 342 cmbCountry->insertItem( tr ( "Ethiopia" ) );
344 cmbCountry->insertItem( tr ( "Falkland Islands" ) ); 343 cmbCountry->insertItem( tr ( "Falkland Islands" ) );
345 cmbCountry->insertItem( tr ( "Faroe Islands" ) ); 344 cmbCountry->insertItem( tr ( "Faroe Islands" ) );
346 cmbCountry->insertItem( tr ( "Fiji" ) ); 345 cmbCountry->insertItem( tr ( "Fiji" ) );
347 cmbCountry->insertItem( tr ( "Finland" ) ); 346 cmbCountry->insertItem( tr ( "Finland" ) );
348 cmbCountry->insertItem( tr ( "France" ) ); 347 cmbCountry->insertItem( tr ( "France" ) );
349 cmbCountry->insertItem( tr ( "French Guiana" ) ); 348 cmbCountry->insertItem( tr ( "French Guiana" ) );
350 cmbCountry->insertItem( tr ( "French Polynesia" ) ); 349 cmbCountry->insertItem( tr ( "French Polynesia" ) );
351 cmbCountry->insertItem( tr ( "Gabon" ) ); 350 cmbCountry->insertItem( tr ( "Gabon" ) );
352 cmbCountry->insertItem( tr ( "Gambia" ) ); 351 cmbCountry->insertItem( tr ( "Gambia" ) );
353 cmbCountry->insertItem( tr ( "Georgia" ) ); 352 cmbCountry->insertItem( tr ( "Georgia" ) );
354 cmbCountry->insertItem( tr ( "Germany" ) ); 353 cmbCountry->insertItem( tr ( "Germany" ) );
355 cmbCountry->insertItem( tr ( "Ghana" ) ); 354 cmbCountry->insertItem( tr ( "Ghana" ) );
356 cmbCountry->insertItem( tr ( "Gibraltar" ) ); 355 cmbCountry->insertItem( tr ( "Gibraltar" ) );
357 cmbCountry->insertItem( tr ( "Greece" ) ); 356 cmbCountry->insertItem( tr ( "Greece" ) );
358 cmbCountry->insertItem( tr ( "Greenland" ) ); 357 cmbCountry->insertItem( tr ( "Greenland" ) );
359 cmbCountry->insertItem( tr ( "Grenada" ) ); 358 cmbCountry->insertItem( tr ( "Grenada" ) );
360 cmbCountry->insertItem( tr ( "Guadeloupe" ) ); 359 cmbCountry->insertItem( tr ( "Guadeloupe" ) );
361 cmbCountry->insertItem( tr ( "Guam" ) ); 360 cmbCountry->insertItem( tr ( "Guam" ) );
362 cmbCountry->insertItem( tr ( "Guatemala" ) ); 361 cmbCountry->insertItem( tr ( "Guatemala" ) );
363 cmbCountry->insertItem( tr ( "Guinea" ) ); 362 cmbCountry->insertItem( tr ( "Guinea" ) );
364 cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); 363 cmbCountry->insertItem( tr ( "Guinea-Bissau" ) );
365 cmbCountry->insertItem( tr ( "Guyana" ) ); 364 cmbCountry->insertItem( tr ( "Guyana" ) );
366 cmbCountry->insertItem( tr ( "Haiti" ) ); 365 cmbCountry->insertItem( tr ( "Haiti" ) );
367 cmbCountry->insertItem( tr ( "Holy See" ) ); 366 cmbCountry->insertItem( tr ( "Holy See" ) );
368 cmbCountry->insertItem( tr ( "Honduras" ) ); 367 cmbCountry->insertItem( tr ( "Honduras" ) );
369 cmbCountry->insertItem( tr ( "Hong Kong" ) ); 368 cmbCountry->insertItem( tr ( "Hong Kong" ) );
370 cmbCountry->insertItem( tr ( "Hungary" ) ); 369 cmbCountry->insertItem( tr ( "Hungary" ) );
371 cmbCountry->insertItem( tr ( "Iceland" ) ); 370 cmbCountry->insertItem( tr ( "Iceland" ) );
372 cmbCountry->insertItem( tr ( "India" ) ); 371 cmbCountry->insertItem( tr ( "India" ) );
373 cmbCountry->insertItem( tr ( "Indonesia" ) ); 372 cmbCountry->insertItem( tr ( "Indonesia" ) );
374 cmbCountry->insertItem( tr ( "Ireland" ) ); 373 cmbCountry->insertItem( tr ( "Ireland" ) );
375 cmbCountry->insertItem( tr ( "Israel" ) ); 374 cmbCountry->insertItem( tr ( "Israel" ) );
376 cmbCountry->insertItem( tr ( "Italy" ) ); 375 cmbCountry->insertItem( tr ( "Italy" ) );
377 cmbCountry->insertItem( tr ( "Jamaica" ) ); 376 cmbCountry->insertItem( tr ( "Jamaica" ) );
378 cmbCountry->insertItem( tr ( "Japan" ) ); 377 cmbCountry->insertItem( tr ( "Japan" ) );
379 cmbCountry->insertItem( tr ( "Jordan" ) ); 378 cmbCountry->insertItem( tr ( "Jordan" ) );
380 cmbCountry->insertItem( tr ( "Kazakhstan" ) ); 379 cmbCountry->insertItem( tr ( "Kazakhstan" ) );
381 cmbCountry->insertItem( tr ( "Kenya" ) ); 380 cmbCountry->insertItem( tr ( "Kenya" ) );
382 cmbCountry->insertItem( tr ( "Kiribati" ) ); 381 cmbCountry->insertItem( tr ( "Kiribati" ) );
383 cmbCountry->insertItem( tr ( "Korea" ) ); 382 cmbCountry->insertItem( tr ( "Korea" ) );
384 cmbCountry->insertItem( tr ( "Kuwait" ) ); 383 cmbCountry->insertItem( tr ( "Kuwait" ) );
385 cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); 384 cmbCountry->insertItem( tr ( "Kyrgyzstan" ) );
386 cmbCountry->insertItem( tr ( "Laos" ) ); 385 cmbCountry->insertItem( tr ( "Laos" ) );
387 cmbCountry->insertItem( tr ( "Latvia" ) ); 386 cmbCountry->insertItem( tr ( "Latvia" ) );
388 cmbCountry->insertItem( tr ( "Lebanon" ) ); 387 cmbCountry->insertItem( tr ( "Lebanon" ) );
389 cmbCountry->insertItem( tr ( "Lesotho" ) ); 388 cmbCountry->insertItem( tr ( "Lesotho" ) );
390 cmbCountry->insertItem( tr ( "Liberia" ) ); 389 cmbCountry->insertItem( tr ( "Liberia" ) );
391 cmbCountry->insertItem( tr ( "Liechtenstein" ) ); 390 cmbCountry->insertItem( tr ( "Liechtenstein" ) );
392 cmbCountry->insertItem( tr ( "Lithuania" ) ); 391 cmbCountry->insertItem( tr ( "Lithuania" ) );
393 cmbCountry->insertItem( tr ( "Luxembourg" ) ); 392 cmbCountry->insertItem( tr ( "Luxembourg" ) );
394 cmbCountry->insertItem( tr ( "Macau" ) ); 393 cmbCountry->insertItem( tr ( "Macau" ) );
395 cmbCountry->insertItem( tr ( "Macedonia" ) ); 394 cmbCountry->insertItem( tr ( "Macedonia" ) );
396 cmbCountry->insertItem( tr ( "Madagascar" ) ); 395 cmbCountry->insertItem( tr ( "Madagascar" ) );
397 cmbCountry->insertItem( tr ( "Malawi" ) ); 396 cmbCountry->insertItem( tr ( "Malawi" ) );
398 cmbCountry->insertItem( tr ( "Malaysia" ) ); 397 cmbCountry->insertItem( tr ( "Malaysia" ) );
399 cmbCountry->insertItem( tr ( "Maldives" ) ); 398 cmbCountry->insertItem( tr ( "Maldives" ) );
400 cmbCountry->insertItem( tr ( "Mali" ) ); 399 cmbCountry->insertItem( tr ( "Mali" ) );
401 cmbCountry->insertItem( tr ( "Malta" ) ); 400 cmbCountry->insertItem( tr ( "Malta" ) );
402 cmbCountry->insertItem( tr ( "Martinique" ) ); 401 cmbCountry->insertItem( tr ( "Martinique" ) );
403 cmbCountry->insertItem( tr ( "Mauritania" ) ); 402 cmbCountry->insertItem( tr ( "Mauritania" ) );
404 cmbCountry->insertItem( tr ( "Mauritius" ) ); 403 cmbCountry->insertItem( tr ( "Mauritius" ) );
405 cmbCountry->insertItem( tr ( "Mayotte" ) ); 404 cmbCountry->insertItem( tr ( "Mayotte" ) );
406 cmbCountry->insertItem( tr ( "Mexico" ) ); 405 cmbCountry->insertItem( tr ( "Mexico" ) );
407 cmbCountry->insertItem( tr ( "Micronesia" ) ); 406 cmbCountry->insertItem( tr ( "Micronesia" ) );
408 cmbCountry->insertItem( tr ( "Moldova" ) ); 407 cmbCountry->insertItem( tr ( "Moldova" ) );
409 cmbCountry->insertItem( tr ( "Monaco" ) ); 408 cmbCountry->insertItem( tr ( "Monaco" ) );
410 cmbCountry->insertItem( tr ( "Mongolia" ) ); 409 cmbCountry->insertItem( tr ( "Mongolia" ) );
411 cmbCountry->insertItem( tr ( "Montserrat" ) ); 410 cmbCountry->insertItem( tr ( "Montserrat" ) );
412 cmbCountry->insertItem( tr ( "Morocco" ) ); 411 cmbCountry->insertItem( tr ( "Morocco" ) );
413 cmbCountry->insertItem( tr ( "Mozambique" ) ); 412 cmbCountry->insertItem( tr ( "Mozambique" ) );
414 cmbCountry->insertItem( tr ( "Myanmar" ) ); 413 cmbCountry->insertItem( tr ( "Myanmar" ) );
415 cmbCountry->insertItem( tr ( "Namibia" ) ); 414 cmbCountry->insertItem( tr ( "Namibia" ) );
416 cmbCountry->insertItem( tr ( "Nauru" ) ); 415 cmbCountry->insertItem( tr ( "Nauru" ) );
417 cmbCountry->insertItem( tr ( "Nepal" ) ); 416 cmbCountry->insertItem( tr ( "Nepal" ) );
418 cmbCountry->insertItem( tr ( "Netherlands" ) ); 417 cmbCountry->insertItem( tr ( "Netherlands" ) );
419 cmbCountry->insertItem( tr ( "New Caledonia" ) ); 418 cmbCountry->insertItem( tr ( "New Caledonia" ) );
420 cmbCountry->insertItem( tr ( "New Zealand" ) ); 419 cmbCountry->insertItem( tr ( "New Zealand" ) );
421 cmbCountry->insertItem( tr ( "Nicaragua" ) ); 420 cmbCountry->insertItem( tr ( "Nicaragua" ) );
422 cmbCountry->insertItem( tr ( "Niger" ) ); 421 cmbCountry->insertItem( tr ( "Niger" ) );
423 cmbCountry->insertItem( tr ( "Nigeria" ) ); 422 cmbCountry->insertItem( tr ( "Nigeria" ) );
424 cmbCountry->insertItem( tr ( "Niue" ) ); 423 cmbCountry->insertItem( tr ( "Niue" ) );
425 cmbCountry->insertItem( tr ( "Norway" ) ); 424 cmbCountry->insertItem( tr ( "Norway" ) );
426 cmbCountry->insertItem( tr ( "Oman" ) ); 425 cmbCountry->insertItem( tr ( "Oman" ) );
427 cmbCountry->insertItem( tr ( "Pakistan" ) ); 426 cmbCountry->insertItem( tr ( "Pakistan" ) );
428 cmbCountry->insertItem( tr ( "Palau" ) ); 427 cmbCountry->insertItem( tr ( "Palau" ) );
429 cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); 428 cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) );
430 cmbCountry->insertItem( tr ( "Panama" ) ); 429 cmbCountry->insertItem( tr ( "Panama" ) );
431 cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); 430 cmbCountry->insertItem( tr ( "Papua New Guinea" ) );
432 cmbCountry->insertItem( tr ( "Paraguay" ) ); 431 cmbCountry->insertItem( tr ( "Paraguay" ) );
433 cmbCountry->insertItem( tr ( "Peru" ) ); 432 cmbCountry->insertItem( tr ( "Peru" ) );
434 cmbCountry->insertItem( tr ( "Philippines" ) ); 433 cmbCountry->insertItem( tr ( "Philippines" ) );
435 cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); 434 cmbCountry->insertItem( tr ( "Pitcairn Islands" ) );
436 cmbCountry->insertItem( tr ( "Poland" ) ); 435 cmbCountry->insertItem( tr ( "Poland" ) );
437 cmbCountry->insertItem( tr ( "Portugal" ) ); 436 cmbCountry->insertItem( tr ( "Portugal" ) );
438 cmbCountry->insertItem( tr ( "Puerto Rico" ) ); 437 cmbCountry->insertItem( tr ( "Puerto Rico" ) );
439 cmbCountry->insertItem( tr ( "Qatar" ) ); 438 cmbCountry->insertItem( tr ( "Qatar" ) );
440 cmbCountry->insertItem( tr ( "Reunion" ) ); 439 cmbCountry->insertItem( tr ( "Reunion" ) );
441 cmbCountry->insertItem( tr ( "Romania" ) ); 440 cmbCountry->insertItem( tr ( "Romania" ) );
442 cmbCountry->insertItem( tr ( "Russia" ) ); 441 cmbCountry->insertItem( tr ( "Russia" ) );
443 cmbCountry->insertItem( tr ( "Rwanda" ) ); 442 cmbCountry->insertItem( tr ( "Rwanda" ) );
444 cmbCountry->insertItem( tr ( "Saint Lucia" ) ); 443 cmbCountry->insertItem( tr ( "Saint Lucia" ) );
445 cmbCountry->insertItem( tr ( "Samoa" ) ); 444 cmbCountry->insertItem( tr ( "Samoa" ) );
446 cmbCountry->insertItem( tr ( "San Marino" ) ); 445 cmbCountry->insertItem( tr ( "San Marino" ) );
447 cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); 446 cmbCountry->insertItem( tr ( "Saudi Arabia" ) );
448 cmbCountry->insertItem( tr ( "Senegal" ) ); 447 cmbCountry->insertItem( tr ( "Senegal" ) );
449 cmbCountry->insertItem( tr ( "Seychelles" ) ); 448 cmbCountry->insertItem( tr ( "Seychelles" ) );
450 cmbCountry->insertItem( tr ( "Sierra Leone" ) ); 449 cmbCountry->insertItem( tr ( "Sierra Leone" ) );
451 cmbCountry->insertItem( tr ( "Singapore" ) ); 450 cmbCountry->insertItem( tr ( "Singapore" ) );
452 cmbCountry->insertItem( tr ( "Slovakia" ) ); 451 cmbCountry->insertItem( tr ( "Slovakia" ) );
453 cmbCountry->insertItem( tr ( "Slovenia" ) ); 452 cmbCountry->insertItem( tr ( "Slovenia" ) );
454 cmbCountry->insertItem( tr ( "Solomon Islands" ) ); 453 cmbCountry->insertItem( tr ( "Solomon Islands" ) );
455 cmbCountry->insertItem( tr ( "Somalia" ) ); 454 cmbCountry->insertItem( tr ( "Somalia" ) );
456 cmbCountry->insertItem( tr ( "South Africa" ) ); 455 cmbCountry->insertItem( tr ( "South Africa" ) );
457 cmbCountry->insertItem( tr ( "Spain" ) ); 456 cmbCountry->insertItem( tr ( "Spain" ) );
458 cmbCountry->insertItem( tr ( "Sri Lanka" ) ); 457 cmbCountry->insertItem( tr ( "Sri Lanka" ) );
459 cmbCountry->insertItem( tr ( "St. Helena" ) ); 458 cmbCountry->insertItem( tr ( "St. Helena" ) );
460 cmbCountry->insertItem( tr ( "Sudan" ) ); 459 cmbCountry->insertItem( tr ( "Sudan" ) );
461 cmbCountry->insertItem( tr ( "Suriname" ) ); 460 cmbCountry->insertItem( tr ( "Suriname" ) );
462 cmbCountry->insertItem( tr ( "Swaziland" ) ); 461 cmbCountry->insertItem( tr ( "Swaziland" ) );
463 cmbCountry->insertItem( tr ( "Sweden" ) ); 462 cmbCountry->insertItem( tr ( "Sweden" ) );
464 cmbCountry->insertItem( tr ( "Switzerland" ) ); 463 cmbCountry->insertItem( tr ( "Switzerland" ) );
465 cmbCountry->insertItem( tr ( "Taiwan" ) ); 464 cmbCountry->insertItem( tr ( "Taiwan" ) );
466 cmbCountry->insertItem( tr ( "Tajikistan" ) ); 465 cmbCountry->insertItem( tr ( "Tajikistan" ) );
467 cmbCountry->insertItem( tr ( "Tanzania" ) ); 466 cmbCountry->insertItem( tr ( "Tanzania" ) );
468 cmbCountry->insertItem( tr ( "Thailand" ) ); 467 cmbCountry->insertItem( tr ( "Thailand" ) );
469 cmbCountry->insertItem( tr ( "Togo" ) ); 468 cmbCountry->insertItem( tr ( "Togo" ) );
470 cmbCountry->insertItem( tr ( "Tokelau" ) ); 469 cmbCountry->insertItem( tr ( "Tokelau" ) );
471 cmbCountry->insertItem( tr ( "Tonga" ) ); 470 cmbCountry->insertItem( tr ( "Tonga" ) );
472 cmbCountry->insertItem( tr ( "Tunisia" ) ); 471 cmbCountry->insertItem( tr ( "Tunisia" ) );
473 cmbCountry->insertItem( tr ( "Turkey" ) ); 472 cmbCountry->insertItem( tr ( "Turkey" ) );
474 cmbCountry->insertItem( tr ( "Turkmenistan" ) ); 473 cmbCountry->insertItem( tr ( "Turkmenistan" ) );
475 cmbCountry->insertItem( tr ( "Tuvalu" ) ); 474 cmbCountry->insertItem( tr ( "Tuvalu" ) );
476 cmbCountry->insertItem( tr ( "Uganda" ) ); 475 cmbCountry->insertItem( tr ( "Uganda" ) );
477 cmbCountry->insertItem( tr ( "Ukraine" ) ); 476 cmbCountry->insertItem( tr ( "Ukraine" ) );
478 cmbCountry->insertItem( tr ( "Uruguay" ) ); 477 cmbCountry->insertItem( tr ( "Uruguay" ) );
479 cmbCountry->insertItem( tr ( "Uzbekistan" ) ); 478 cmbCountry->insertItem( tr ( "Uzbekistan" ) );
480 cmbCountry->insertItem( tr ( "Vanuatu" ) ); 479 cmbCountry->insertItem( tr ( "Vanuatu" ) );
481 cmbCountry->insertItem( tr ( "Venezuela" ) ); 480 cmbCountry->insertItem( tr ( "Venezuela" ) );
482 cmbCountry->insertItem( tr ( "Vietnam" ) ); 481 cmbCountry->insertItem( tr ( "Vietnam" ) );
483 cmbCountry->insertItem( tr ( "Virgin Islands" ) ); 482 cmbCountry->insertItem( tr ( "Virgin Islands" ) );
484 cmbCountry->insertItem( tr ( "Western Sahara" ) ); 483 cmbCountry->insertItem( tr ( "Western Sahara" ) );
485 cmbCountry->insertItem( tr ( "Yemen" ) ); 484 cmbCountry->insertItem( tr ( "Yemen" ) );
486 cmbCountry->insertItem( tr ( "Yugoslavia" ) ); 485 cmbCountry->insertItem( tr ( "Yugoslavia" ) );
487 cmbCountry->insertItem( tr ( "Zambia" ) ); 486 cmbCountry->insertItem( tr ( "Zambia" ) );
488 cmbCountry->insertItem( tr ( "Zimbabwe" ) ); 487 cmbCountry->insertItem( tr ( "Zimbabwe" ) );
489 if (cmbCountry->listBox()!=0) 488 if (cmbCountry->listBox()!=0)
490 cmbCountry->listBox()->sort(); 489 cmbCountry->listBox()->sort();
491 490
492 cmbCountry->setMaximumWidth( 135 ); 491 cmbCountry->setMaximumWidth( 135 );
493 492
494 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); 493 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 );
495 494
496 // Chooser 4 495 // Chooser 4
497 cmbChooserField4 = new QComboBox( FALSE, container ); 496 cmbChooserField4 = new QComboBox( FALSE, container );
498 cmbChooserField4->setMaximumWidth( 90 ); 497 cmbChooserField4->setMaximumWidth( 90 );
499 gl->addWidget( cmbChooserField4, 6, 0 ); 498 gl->addWidget( cmbChooserField4, 6, 0 );
500 // Textfield for chooser 2 499 // Textfield for chooser 2
501 // Now use WidgetStack to contain the textfield and the default-email combo! 500 // Now use WidgetStack to contain the textfield and the default-email combo!
502 m_widgetStack4 = new QWidgetStack( container ); 501 m_widgetStack4 = new QWidgetStack( container );
503 txtChooserField4 = new QLineEdit( m_widgetStack4 ); 502 txtChooserField4 = new QLineEdit( m_widgetStack4 );
504 m_widgetStack4 -> addWidget( txtChooserField4, TextField ); 503 m_widgetStack4 -> addWidget( txtChooserField4, TextField );
505 gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); 504 gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 );
506 m_widgetStack4 -> raiseWidget( TextField ); 505 m_widgetStack4 -> raiseWidget( TextField );
507 506
508 QSpacerItem *space = new QSpacerItem(1,1, 507 QSpacerItem *space = new QSpacerItem(1,1,
509 QSizePolicy::Maximum, 508 QSizePolicy::Maximum,
510 QSizePolicy::MinimumExpanding ); 509 QSizePolicy::MinimumExpanding );
511 gl->addItem( space, 7, 0 ); 510 gl->addItem( space, 7, 0 );
512 511
513 tabMain->insertTab( tabViewport, tr( "Address" ) ); 512 tabMain->insertTab( tabViewport, tr( "Address" ) );
514 513
515 tabViewport = new QWidget ( tabMain ); 514 tabViewport = new QWidget ( tabMain );
516 515
517 vb = new QVBoxLayout( tabViewport ); 516 vb = new QVBoxLayout( tabViewport );
518 517
519 svDetails = new QScrollView( tabViewport ); 518 svDetails = new QScrollView( tabViewport );
520 vb->addWidget( svDetails, 0, 0 ); 519 vb->addWidget( svDetails, 0, 0 );
521 svDetails->setResizePolicy( QScrollView::AutoOneFit ); 520 svDetails->setResizePolicy( QScrollView::AutoOneFit );
522 svDetails->setFrameStyle( QFrame::NoFrame ); 521 svDetails->setFrameStyle( QFrame::NoFrame );
523 522
524 container = new QWidget( svDetails->viewport() ); 523 container = new QWidget( svDetails->viewport() );
525 svDetails->addChild( container ); 524 svDetails->addChild( container );
526 525
527 gl = new QGridLayout( container, 1, 2, 2, 4 ); 526 gl = new QGridLayout( container, 1, 2, 2, 4 );
528 527
529 int counter = 0; 528 int counter = 0;
530 529
531 // Birthday 530 // Birthday
532 QHBox* hBox = new QHBox( container ); 531 QHBox* hBox = new QHBox( container );
533 l = new QLabel( tr("Birthday"), container ); 532 l = new QLabel( tr("Birthday"), container );
534 gl->addWidget( l, counter, 0 ); 533 gl->addWidget( l, counter, 0 );
535 534
536 QPopupMenu* m1 = new QPopupMenu( container ); 535 QPopupMenu* m1 = new QPopupMenu( container );
537 birthdayPicker = new DateBookMonth( m1, 0, TRUE ); 536 birthdayPicker = new DateBookMonth( m1, 0, TRUE );
538 m1->insertItem( birthdayPicker ); 537 m1->insertItem( birthdayPicker );
539 538
540 birthdayButton= new QToolButton( hBox, "buttonStart" ); 539 birthdayButton= new QToolButton( hBox, "buttonStart" );
541 birthdayButton->setPopup( m1 ); 540 birthdayButton->setPopup( m1 );
542 birthdayButton->setPopupDelay(0); 541 birthdayButton->setPopupDelay(0);
543 542
544 QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), 543 QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
545 tr( "Delete" ), 544 tr( "Delete" ),
546 hBox, 0 ); 545 hBox, 0 );
547 546
548 gl->addWidget( hBox, counter , 1 ); 547 gl->addWidget( hBox, counter , 1 );
549 548
550 connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), 549 connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ),
551 this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); 550 this, SLOT( slotBirthdayDateChanged( int, int, int ) ) );
552 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); 551 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) );
553 552
554 ++counter; 553 ++counter;
555 554
556 // Anniversary 555 // Anniversary
557 hBox = new QHBox( container ); 556 hBox = new QHBox( container );
558 l = new QLabel( tr("Anniversary"), container ); 557 l = new QLabel( tr("Anniversary"), container );
559 gl->addWidget( l, counter, 0 ); 558 gl->addWidget( l, counter, 0 );
560 559
561 m1 = new QPopupMenu( container ); 560 m1 = new QPopupMenu( container );
562 anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); 561 anniversaryPicker = new DateBookMonth( m1, 0, TRUE );
563 m1->insertItem( anniversaryPicker ); 562 m1->insertItem( anniversaryPicker );
564 563
565 anniversaryButton= new QToolButton( hBox, "buttonStart" ); 564 anniversaryButton= new QToolButton( hBox, "buttonStart" );
566 anniversaryButton->setPopup( m1 ); 565 anniversaryButton->setPopup( m1 );
567 anniversaryButton->setPopupDelay(0); 566 anniversaryButton->setPopupDelay(0);
568 567
569 deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), 568 deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
570 tr( "Delete" ), 569 tr( "Delete" ),
571 hBox, 0 ); 570 hBox, 0 );
572 gl->addWidget( hBox, counter , 1 ); 571 gl->addWidget( hBox, counter , 1 );
573 572
574 connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), 573 connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ),
575 this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); 574 this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) );
576 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); 575 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) );
577 576
578 ++counter; 577 ++counter;
579 578
580 // Gender 579 // Gender
581 l = new QLabel( tr("Gender"), container ); 580 l = new QLabel( tr("Gender"), container );
582 gl->addWidget( l, counter, 0 ); 581 gl->addWidget( l, counter, 0 );
583 cmbGender = new QComboBox( container ); 582 cmbGender = new QComboBox( container );
584 cmbGender->insertItem( "", 0 ); 583 cmbGender->insertItem( "", 0 );
585 cmbGender->insertItem( tr("Male"), 1); 584 cmbGender->insertItem( tr("Male"), 1);
586 cmbGender->insertItem( tr("Female"), 2); 585 cmbGender->insertItem( tr("Female"), 2);
587 gl->addWidget( cmbGender, counter, 1 ); 586 gl->addWidget( cmbGender, counter, 1 );
588 587
589 ++counter; 588 ++counter;
590 589
591 // Create Labels and lineedit fields for every dynamic entry 590 // Create Labels and lineedit fields for every dynamic entry
592 QStringList::ConstIterator it = slDynamicEntries.begin(); 591 QStringList::ConstIterator it = slDynamicEntries.begin();
593 QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId(); 592 QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId();
594 QMap<int, QString> mapIdToStr = OContactFields::idToTrFields(); 593 QMap<int, QString> mapIdToStr = OContactFields::idToTrFields();
595 for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { 594 for (i = counter; it != slDynamicEntries.end(); i++, ++it ) {
596 595
597 if (((*it) == "Anniversary") || 596 if (((*it) == "Anniversary") ||
598 ((*it) == "Birthday")|| ((*it) == "Gender")) continue; 597 ((*it) == "Birthday")|| ((*it) == "Gender")) continue;
599 598
600 l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); 599 l = new QLabel( mapIdToStr[mapStrToID[*it]], container );
601 listName.append( l ); 600 listName.append( l );
602 gl->addWidget( l, i, 0 ); 601 gl->addWidget( l, i, 0 );
603 QLineEdit *e = new QLineEdit( container ); 602 QLineEdit *e = new QLineEdit( container );
604 listValue.append( e ); 603 listValue.append( e );
605 gl->addWidget( e, i, 1); 604 gl->addWidget( e, i, 1);
606 } 605 }
607 // Fill labels with names.. 606 // Fill labels with names..
608 //loadFields(); 607 //loadFields();
609 608
610 609
611 tabMain->insertTab( tabViewport, tr( "Details" ) ); 610 tabMain->insertTab( tabViewport, tr( "Details" ) );
612 611
613 dlgNote = new QDialog( this, "Note Dialog", TRUE ); 612 dlgNote = new QDialog( this, "Note Dialog", TRUE );
614 dlgNote->setCaption( tr("Enter Note") ); 613 dlgNote->setCaption( tr("Enter Note") );
615 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); 614 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote );
616 txtNote = new QMultiLineEdit( dlgNote ); 615 txtNote = new QMultiLineEdit( dlgNote );
617 vbNote->addWidget( txtNote ); 616 vbNote->addWidget( txtNote );
618 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); 617 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) );
619 618
620 dlgName = new QDialog( this, "Name Dialog", TRUE ); 619 dlgName = new QDialog( this, "Name Dialog", TRUE );
621 dlgName->setCaption( tr("Edit Name") ); 620 dlgName->setCaption( tr("Edit Name") );
622 gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); 621 gl = new QGridLayout( dlgName, 5, 2, 2, 3 );
623 622
624 l = new QLabel( tr("First Name"), dlgName ); 623 l = new QLabel( tr("First Name"), dlgName );
625 gl->addWidget( l, 0, 0 ); 624 gl->addWidget( l, 0, 0 );
626 txtFirstName = new QLineEdit( dlgName ); 625 txtFirstName = new QLineEdit( dlgName );
627 gl->addWidget( txtFirstName, 0, 1 ); 626 gl->addWidget( txtFirstName, 0, 1 );
628 627
629 l = new QLabel( tr("Middle Name"), dlgName ); 628 l = new QLabel( tr("Middle Name"), dlgName );
630 gl->addWidget( l, 1, 0 ); 629 gl->addWidget( l, 1, 0 );
631 txtMiddleName = new QLineEdit( dlgName ); 630 txtMiddleName = new QLineEdit( dlgName );
632 gl->addWidget( txtMiddleName, 1, 1 ); 631 gl->addWidget( txtMiddleName, 1, 1 );
633 632
634 l = new QLabel( tr("Last Name"), dlgName ); 633 l = new QLabel( tr("Last Name"), dlgName );
635 gl->addWidget( l, 2, 0 ); 634 gl->addWidget( l, 2, 0 );
636 txtLastName = new QLineEdit( dlgName ); 635 txtLastName = new QLineEdit( dlgName );
637 gl->addWidget( txtLastName, 2, 1 ); 636 gl->addWidget( txtLastName, 2, 1 );
638 637
639 // l = new QLabel( tr("Suffix"), dlgName ); 638 // l = new QLabel( tr("Suffix"), dlgName );
640 // gl->addWidget( l, 3, 0 ); 639 // gl->addWidget( l, 3, 0 );
641 // txtSuffix = new QLineEdit( dlgName ); 640 // txtSuffix = new QLineEdit( dlgName );
642 // gl->addWidget( txtSuffix, 3, 1 ); 641 // gl->addWidget( txtSuffix, 3, 1 );
643 space = new QSpacerItem(1,1, 642 space = new QSpacerItem(1,1,
644 QSizePolicy::Maximum, 643 QSizePolicy::Maximum,
645 QSizePolicy::MinimumExpanding ); 644 QSizePolicy::MinimumExpanding );
646 gl->addItem( space, 4, 0 ); 645 gl->addItem( space, 4, 0 );
647 646
648 cmbChooserField1->insertStringList( trlChooserNames ); 647 cmbChooserField1->insertStringList( trlChooserNames );
649 cmbChooserField2->insertStringList( trlChooserNames ); 648 cmbChooserField2->insertStringList( trlChooserNames );
650 cmbChooserField3->insertStringList( trlChooserNames ); 649 cmbChooserField3->insertStringList( trlChooserNames );
651 cmbChooserField4->insertStringList( trlChooserNames ); 650 cmbChooserField4->insertStringList( trlChooserNames );
652 651
653 cmbChooserField1->setCurrentItem( 0 ); 652 cmbChooserField1->setCurrentItem( 0 );
654 cmbChooserField2->setCurrentItem( 1 ); 653 cmbChooserField2->setCurrentItem( 1 );
655 cmbChooserField3->setCurrentItem( 2 ); 654 cmbChooserField3->setCurrentItem( 2 );
656 655
657 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 656 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
658 657
659 connect( txtFullName, SIGNAL(textChanged(const QString &)), 658 connect( txtFullName, SIGNAL(textChanged(const QString &)),
660 this, SLOT(slotFullNameChange(const QString &)) ); 659 this, SLOT(slotFullNameChange(const QString &)) );
661 connect( txtSuffix, SIGNAL(textChanged(const QString &)), 660 connect( txtSuffix, SIGNAL(textChanged(const QString &)),
662 this, SLOT(slotSuffixChange(const QString &)) ); 661 this, SLOT(slotSuffixChange(const QString &)) );
663 connect( txtOrganization, SIGNAL(textChanged(const QString &)), 662 connect( txtOrganization, SIGNAL(textChanged(const QString &)),
664 this, SLOT(slotOrganizationChange(const QString &)) ); 663 this, SLOT(slotOrganizationChange(const QString &)) );
665 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), 664 connect( txtChooserField1, SIGNAL(textChanged(const QString &)),
666 this, SLOT(slotChooser1Change(const QString &)) ); 665 this, SLOT(slotChooser1Change(const QString &)) );
667 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), 666 connect( txtChooserField2, SIGNAL(textChanged(const QString &)),
668 this, SLOT(slotChooser2Change(const QString &)) ); 667 this, SLOT(slotChooser2Change(const QString &)) );
669 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), 668 connect( txtChooserField3, SIGNAL(textChanged(const QString &)),
670 this, SLOT(slotChooser3Change(const QString &)) ); 669 this, SLOT(slotChooser3Change(const QString &)) );
671 connect( txtChooserField4, SIGNAL(textChanged(const QString &)), 670 connect( txtChooserField4, SIGNAL(textChanged(const QString &)),
672 this, SLOT(slotChooser4Change(const QString &)) ); 671 this, SLOT(slotChooser4Change(const QString &)) );
673 connect( txtAddress, SIGNAL(textChanged(const QString &)), 672 connect( txtAddress, SIGNAL(textChanged(const QString &)),
674 this, SLOT(slotAddressChange(const QString &)) ); 673 this, SLOT(slotAddressChange(const QString &)) );
675 connect( txtCity, SIGNAL(textChanged(const QString &)), 674 connect( txtCity, SIGNAL(textChanged(const QString &)),
676 this, SLOT(slotCityChange(const QString &)) ); 675 this, SLOT(slotCityChange(const QString &)) );
677 connect( txtState, SIGNAL(textChanged(const QString &)), 676 connect( txtState, SIGNAL(textChanged(const QString &)),
678 this, SLOT(slotStateChange(const QString &)) ); 677 this, SLOT(slotStateChange(const QString &)) );
679 connect( txtZip, SIGNAL(textChanged(const QString &)), 678 connect( txtZip, SIGNAL(textChanged(const QString &)),
680 this, SLOT(slotZipChange(const QString &)) ); 679 this, SLOT(slotZipChange(const QString &)) );
681 connect( cmbCountry, SIGNAL(textChanged(const QString &)), 680 connect( cmbCountry, SIGNAL(textChanged(const QString &)),
682 this, SLOT(slotCountryChange(const QString &)) ); 681 this, SLOT(slotCountryChange(const QString &)) );
683 connect( cmbCountry, SIGNAL(activated(const QString &)), 682 connect( cmbCountry, SIGNAL(activated(const QString &)),
684 this, SLOT(slotCountryChange(const QString &)) ); 683 this, SLOT(slotCountryChange(const QString &)) );
685 connect( cmbChooserField1, SIGNAL(activated(int)), 684 connect( cmbChooserField1, SIGNAL(activated(int)),
686 this, SLOT(slotCmbChooser1Change(int)) ); 685 this, SLOT(slotCmbChooser1Change(int)) );
687 connect( cmbChooserField2, SIGNAL(activated(int)), 686 connect( cmbChooserField2, SIGNAL(activated(int)),
688 this, SLOT(slotCmbChooser2Change(int)) ); 687 this, SLOT(slotCmbChooser2Change(int)) );
689 connect( cmbChooserField3, SIGNAL(activated(int)), 688 connect( cmbChooserField3, SIGNAL(activated(int)),
690 this, SLOT(slotCmbChooser3Change(int)) ); 689 this, SLOT(slotCmbChooser3Change(int)) );
691 connect( cmbChooserField4, SIGNAL(activated(int)), 690 connect( cmbChooserField4, SIGNAL(activated(int)),
692 this, SLOT(slotCmbChooser4Change(int)) ); 691 this, SLOT(slotCmbChooser4Change(int)) );
693 connect( cmbAddress, SIGNAL(activated(int)), 692 connect( cmbAddress, SIGNAL(activated(int)),
694 this, SLOT(slotAddressTypeChange(int)) ); 693 this, SLOT(slotAddressTypeChange(int)) );
695 694
696 new QPEDialogListener(this); 695 new QPEDialogListener(this);
697 696
698 setPersonalView ( m_personalView ); 697 setPersonalView ( m_personalView );
699 698
700 qWarning("init() END"); 699 qWarning("init() END");
701} 700}
702 701
703void ContactEditor::defaultEmailChanged(int i){ 702void ContactEditor::defaultEmailChanged(int i){
704 qDebug("defaultEmailChanged"); 703 qDebug("defaultEmailChanged");
705 704
706 // was sollte das ? (se) 705 // was sollte das ? (se)
707 // int index = cmbChooserField1->currentItem(); 706 // int index = cmbChooserField1->currentItem();
708 // slChooserValues[index] = cmbDefaultEmail->text(i); 707 // slChooserValues[index] = cmbDefaultEmail->text(i);
709 708
710 defaultEmail = cmbDefaultEmail->text(i); 709 defaultEmail = cmbDefaultEmail->text(i);
711 qDebug ("Changed to: %s", defaultEmail.latin1()); 710 qDebug ("Changed to: %s", defaultEmail.latin1());
712 711
713} 712}
714 713
715void ContactEditor::populateDefaultEmailCmb(){ 714void ContactEditor::populateDefaultEmailCmb(){
716 715
717 // if the default-email combo was not selected and therfore not created 716 // if the default-email combo was not selected and therfore not created
718 // we get a lot of trouble.. Therfore create an invisible one.. 717 // we get a lot of trouble.. Therfore create an invisible one..
719 if ( !cmbDefaultEmail ){ 718 if ( !cmbDefaultEmail ){
720 cmbDefaultEmail = new QComboBox(this); 719 cmbDefaultEmail = new QComboBox(this);
721 cmbDefaultEmail -> hide(); 720 cmbDefaultEmail -> hide();
722 } 721 }
723 cmbDefaultEmail->clear(); 722 cmbDefaultEmail->clear();
724 cmbDefaultEmail->insertStringList( emails ); 723 cmbDefaultEmail->insertStringList( emails );
725 // cmbDefaultEmail->show(); 724 // cmbDefaultEmail->show();
726 725
727 // Select default email in combo.. 726 // Select default email in combo..
728 bool found = false; 727 bool found = false;
729 for ( int i = 0; i < cmbDefaultEmail->count(); i++){ 728 for ( int i = 0; i < cmbDefaultEmail->count(); i++){
730 qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", 729 qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<",
731 cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); 730 cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1());
732 731
733 if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ 732 if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){
734 cmbDefaultEmail->setCurrentItem( i ); 733 cmbDefaultEmail->setCurrentItem( i );
735 qDebug("set"); 734 qDebug("set");
736 found = true; 735 found = true;
737 } 736 }
738 } 737 }
739 738
740 // If the current default email is not found in the list, we choose the 739 // If the current default email is not found in the list, we choose the
741 // first one.. 740 // first one..
742 if ( !found ) 741 if ( !found )
743 defaultEmail = cmbDefaultEmail->text(0); 742 defaultEmail = cmbDefaultEmail->text(0);
744} 743}
745 744
746// Called when any combobox was changed. 745// Called when any combobox was changed.
747// "true" returned if the change was chandled by this function, else it should 746// "true" returned if the change was chandled by this function, else it should
748// be handled by something else.. 747// be handled by something else..
749bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { 748bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) {
750 QString type = slChooserNames[index]; 749 QString type = slChooserNames[index];
751 qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); 750 qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos );
752 751
753 if ( !initializing ) 752 if ( !initializing )
754 contactfields.setFieldOrder( widgetPos-1, index ); 753 contactfields.setFieldOrder( widgetPos-1, index );
755 754
756 // Create and connect combobox for selecting the default email 755 // Create and connect combobox for selecting the default email
757 if ( type == "Default Email"){ 756 if ( type == "Default Email"){
758 qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); 757 qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition);
759 758
760 // More than one default-email chooser is not allowed ! 759 // More than one default-email chooser is not allowed !
761 if ( ( defaultEmailChooserPosition != -1 ) && 760 if ( ( defaultEmailChooserPosition != -1 ) &&
762 defaultEmailChooserPosition != widgetPos && !initializing){ 761 defaultEmailChooserPosition != widgetPos && !initializing){
763 chooserError( widgetPos ); 762 chooserError( widgetPos );
764 return true; 763 return true;
765 } 764 }
766 765
767 QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); 766 QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo );
768 if ( cmbo ){ 767 if ( cmbo ){
769 inputStack->raiseWidget( TextField ); 768 inputStack->raiseWidget( TextField );
770 inputStack -> removeWidget( cmbo ); 769 inputStack -> removeWidget( cmbo );
771 delete cmbo; 770 delete cmbo;
772 } 771 }
773 cmbo = new QComboBox( inputStack ); 772 cmbo = new QComboBox( inputStack );
774 cmbo -> insertStringList( emails ); 773 cmbo -> insertStringList( emails );
775 774
776 inputStack -> addWidget( cmbo, Combo ); 775 inputStack -> addWidget( cmbo, Combo );
777 inputStack -> raiseWidget( Combo ); 776 inputStack -> raiseWidget( Combo );
778 777
779 defaultEmailChooserPosition = widgetPos; 778 defaultEmailChooserPosition = widgetPos;
780 cmbDefaultEmail = cmbo; 779 cmbDefaultEmail = cmbo;
781 780
782 connect( cmbo,SIGNAL( activated(int) ), 781 connect( cmbo,SIGNAL( activated(int) ),
783 SLOT( defaultEmailChanged(int) ) ); 782 SLOT( defaultEmailChanged(int) ) );
784 783
785 // Set current default email 784 // Set current default email
786 populateDefaultEmailCmb(); 785 populateDefaultEmailCmb();
787 786
788 787
789 } else { 788 } else {
790 // Something else was selected: Hide combo.. 789 // Something else was selected: Hide combo..
791 qWarning(" Hiding default-email combo" ); 790 qWarning(" Hiding default-email combo" );
792 if ( defaultEmailChooserPosition == widgetPos ){ 791 if ( defaultEmailChooserPosition == widgetPos ){
793 defaultEmailChooserPosition = -1; 792 defaultEmailChooserPosition = -1;
794 } 793 }
795 QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); 794 QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo );
796 if ( cmbo ){ 795 if ( cmbo ){
797 inputStack->raiseWidget( TextField ); 796 inputStack->raiseWidget( TextField );
798 inputStack -> removeWidget( cmbo ); 797 inputStack -> removeWidget( cmbo );
799 cmbDefaultEmail = 0l; 798 cmbDefaultEmail = 0l;
800 delete cmbo; 799 delete cmbo;
801 } 800 }
802 801
803 // Caller should initialize the responsible textfield, therefore 802 // Caller should initialize the responsible textfield, therefore
804 // "false" is returned 803 // "false" is returned
805 return false; 804 return false;
806 } 805 }
807 806
808 // Everything is worked off .. 807 // Everything is worked off ..
809 return true; 808 return true;
810 809
811} 810}
812 811
813// Currently accessed when we select default-email more than once ! 812// Currently accessed when we select default-email more than once !
814void ContactEditor::chooserError( int index ) 813void ContactEditor::chooserError( int index )
815{ 814{
816 qWarning("ContactEditor::chooserError( %d )", index); 815 qWarning("ContactEditor::chooserError( %d )", index);
817 QMessageBox::warning( this, "Chooser Error", 816 QMessageBox::warning( this, "Chooser Error",
818 "Multiple selection of this\n" 817 "Multiple selection of this\n"
819 "Item is not allowed !\n\n" 818 "Item is not allowed !\n\n"
820 "First deselect the previous one !", 819 "First deselect the previous one !",
821 "&OK", 0, 0, 820 "&OK", 0, 0,
822 0, 0 ); 821 0, 0 );
823 822
824 // Reset the selected Chooser. Unfortunately the chooser 823 // Reset the selected Chooser. Unfortunately the chooser
825 // generates no signal, therfore we have to 824 // generates no signal, therfore we have to
826 // call the cmbChooserChange function manually.. 825 // call the cmbChooserChange function manually..
827 switch( index ){ 826 switch( index ){
828 case 1: 827 case 1:
829 cmbChooserField1 -> setCurrentItem( 0 ); 828 cmbChooserField1 -> setCurrentItem( 0 );
830 slotCmbChooser1Change( 0 ); 829 slotCmbChooser1Change( 0 );
831 break; 830 break;
832 case 2: 831 case 2:
833 cmbChooserField2 -> setCurrentItem( 0 ); 832 cmbChooserField2 -> setCurrentItem( 0 );
834 slotCmbChooser2Change( 0 ); 833 slotCmbChooser2Change( 0 );
835 break; 834 break;
836 case 3: 835 case 3:
837 cmbChooserField3 -> setCurrentItem( 0 ); 836 cmbChooserField3 -> setCurrentItem( 0 );
838 slotCmbChooser3Change( 0 ); 837 slotCmbChooser3Change( 0 );
839 break; 838 break;
840 case 4: 839 case 4:
841 cmbChooserField4 -> setCurrentItem( 0 ); 840 cmbChooserField4 -> setCurrentItem( 0 );
842 slotCmbChooser4Change( 0 ); 841 slotCmbChooser4Change( 0 );
843 break; 842 break;
844 } 843 }
845} 844}
846 845
847// Called when something was changed in a textfield (shouldn't it called textchanged? (se)) 846// Called when something was changed in a textfield (shouldn't it called textchanged? (se))
848void ContactEditor::chooserChange( const QString &textChanged, int index, 847void ContactEditor::chooserChange( const QString &textChanged, int index,
849 QLineEdit* , int widgetPos ) { 848 QLineEdit* , int widgetPos ) {
850 849
851 QString type = slChooserNames[index]; // :SX 850 QString type = slChooserNames[index]; // :SX
852 qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", 851 qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i",
853 type.latin1(),textChanged.latin1(), index, widgetPos ); 852 type.latin1(),textChanged.latin1(), index, widgetPos );
854 853
855 if ( type == "Default Email"){ 854 if ( type == "Default Email"){
856 qWarning ("??? Wozu??: %s", textChanged.latin1()); 855 qWarning ("??? Wozu??: %s", textChanged.latin1());
857 defaultEmail = textChanged; 856 defaultEmail = textChanged;
858 857
859 populateDefaultEmailCmb(); 858 populateDefaultEmailCmb();
860 859
861 }else if (type == "Emails"){ 860 }else if (type == "Emails"){
862 qDebug("emails"); 861 qDebug("emails");
863 862
864 QString de; 863 QString de;
865 emails = QStringList::split (",", textChanged ); 864 emails = QStringList::split (",", textChanged );
866 865
867 populateDefaultEmailCmb(); 866 populateDefaultEmailCmb();
868 } 867 }
869 868
870 slChooserValues[index] = textChanged; 869 slChooserValues[index] = textChanged;
871 870
872} 871}
873 872
874void ContactEditor::slotChooser1Change( const QString &textChanged ) { 873void ContactEditor::slotChooser1Change( const QString &textChanged ) {
875 qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); 874 qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1());
876 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); 875 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1);
877} 876}
878 877
879void ContactEditor::slotChooser2Change( const QString &textChanged ) { 878void ContactEditor::slotChooser2Change( const QString &textChanged ) {
880 qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); 879 qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1());
881 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); 880 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2);
882 881
883} 882}
884 883
885void ContactEditor::slotChooser3Change( const QString &textChanged ) { 884void ContactEditor::slotChooser3Change( const QString &textChanged ) {
886 qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); 885 qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1());
887 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); 886 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3);
888} 887}
889 888
890void ContactEditor::slotChooser4Change( const QString &textChanged ) { 889void ContactEditor::slotChooser4Change( const QString &textChanged ) {
891 qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); 890 qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1());
892 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); 891 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4);
893} 892}
894 893
895void ContactEditor::slotAddressChange( const QString &textChanged ) { 894void ContactEditor::slotAddressChange( const QString &textChanged ) {
896 895
897 if ( cmbAddress->currentItem() == 0 ) { 896 if ( cmbAddress->currentItem() == 0 ) {
898 slBusinessAddress[0] = textChanged; 897 slBusinessAddress[0] = textChanged;
899 } else { 898 } else {
900 slHomeAddress[0] = textChanged; 899 slHomeAddress[0] = textChanged;
901 } 900 }
902} 901}
903 902
904void ContactEditor::slotAddress2Change( const QString &textChanged ) { 903void ContactEditor::slotAddress2Change( const QString &textChanged ) {
905 904
906 if ( cmbAddress->currentItem() == 0 ) { 905 if ( cmbAddress->currentItem() == 0 ) {
907 slBusinessAddress[1] = textChanged; 906 slBusinessAddress[1] = textChanged;
908 } else { 907 } else {
909 slHomeAddress[1] = textChanged; 908 slHomeAddress[1] = textChanged;
910 } 909 }
911} 910}
912 911
913void ContactEditor::slotPOBoxChange( const QString &textChanged ) { 912void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
914 913
915 if ( cmbAddress->currentItem() == 0 ) { 914 if ( cmbAddress->currentItem() == 0 ) {
916 slBusinessAddress[2] = textChanged; 915 slBusinessAddress[2] = textChanged;
917 } else { 916 } else {
918 slHomeAddress[2] = textChanged; 917 slHomeAddress[2] = textChanged;
919 } 918 }
920} 919}
921 920
922void ContactEditor::slotCityChange( const QString &textChanged ) { 921void ContactEditor::slotCityChange( const QString &textChanged ) {
923 922
924 if ( cmbAddress->currentItem() == 0 ) { 923 if ( cmbAddress->currentItem() == 0 ) {
925 slBusinessAddress[3] = textChanged; 924 slBusinessAddress[3] = textChanged;
926 } else { 925 } else {
927 slHomeAddress[3] = textChanged; 926 slHomeAddress[3] = textChanged;
928 } 927 }
929} 928}
930 929
931void ContactEditor::slotStateChange( const QString &textChanged ) { 930void ContactEditor::slotStateChange( const QString &textChanged ) {
932 931
933 932
934 if ( cmbAddress->currentItem() == 0 ) { 933 if ( cmbAddress->currentItem() == 0 ) {
935 slBusinessAddress[4] = textChanged; 934 slBusinessAddress[4] = textChanged;
936 } else { 935 } else {
937 slHomeAddress[4] = textChanged; 936 slHomeAddress[4] = textChanged;
938 } 937 }
939} 938}
940 939
941void ContactEditor::slotZipChange( const QString &textChanged ) { 940void ContactEditor::slotZipChange( const QString &textChanged ) {
942 941
943 if ( cmbAddress->currentItem() == 0 ) { 942 if ( cmbAddress->currentItem() == 0 ) {
944 slBusinessAddress[5] = textChanged; 943 slBusinessAddress[5] = textChanged;
945 } else { 944 } else {
946 slHomeAddress[5] = textChanged; 945 slHomeAddress[5] = textChanged;
947 } 946 }
948} 947}
949 948
950void ContactEditor::slotCountryChange( const QString &textChanged ) { 949void ContactEditor::slotCountryChange( const QString &textChanged ) {
951 950
952 if ( cmbAddress->currentItem() == 0 ) { 951 if ( cmbAddress->currentItem() == 0 ) {
953 slBusinessAddress[6] = textChanged; 952 slBusinessAddress[6] = textChanged;
954 } else { 953 } else {
955 slHomeAddress[6] = textChanged; 954 slHomeAddress[6] = textChanged;
956 } 955 }
957} 956}
958 957
959 958
960void ContactEditor::slotCmbChooser1Change( int index ) { 959void ContactEditor::slotCmbChooser1Change( int index ) {
961 qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); 960 qWarning("ContactEditor::slotCmbChooser1Change( %d )", index);
962 if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ 961 if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){
963 962
964 txtChooserField1->setText( slChooserValues[index] ); 963 txtChooserField1->setText( slChooserValues[index] );
965 txtChooserField1->setFocus(); 964 txtChooserField1->setFocus();
966 965
967 } 966 }
968 967
969} 968}
970 969
971void ContactEditor::slotCmbChooser2Change( int index ) { 970void ContactEditor::slotCmbChooser2Change( int index ) {
972 qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); 971 qWarning("ContactEditor::slotCmbChooser2Change( %d )", index);
973 972
974 if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ 973 if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){
975 974
976 txtChooserField2->setText( slChooserValues[index] ); 975 txtChooserField2->setText( slChooserValues[index] );
977 txtChooserField2->setFocus(); 976 txtChooserField2->setFocus();
978 977
979 } 978 }
980} 979}
981 980
982void ContactEditor::slotCmbChooser3Change( int index ) { 981void ContactEditor::slotCmbChooser3Change( int index ) {
983 qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); 982 qWarning("ContactEditor::slotCmbChooser3Change( %d )", index);
984 983
985 if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ 984 if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){
986 985
987 txtChooserField3->setText( slChooserValues[index] ); 986 txtChooserField3->setText( slChooserValues[index] );
988 txtChooserField3->setFocus(); 987 txtChooserField3->setFocus();
989 988
990 } 989 }
991} 990}
992 991
993void ContactEditor::slotCmbChooser4Change( int index ) { 992void ContactEditor::slotCmbChooser4Change( int index ) {
994 qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); 993 qWarning("ContactEditor::slotCmbChooser4Change( %d )", index);
995 994
996 if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ 995 if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){
997 996
998 txtChooserField4->setText( slChooserValues[index] ); 997 txtChooserField4->setText( slChooserValues[index] );
999 txtChooserField4->setFocus(); 998 txtChooserField4->setFocus();
1000 999
1001 } 1000 }
1002} 1001}
1003 1002
1004void ContactEditor::slotAddressTypeChange( int index ) { 1003void ContactEditor::slotAddressTypeChange( int index ) {
1005 1004
1006 1005
1007 if ( !initializing ) 1006 if ( !initializing )
1008 contactfields.setFieldOrder( 4, index ); 1007 contactfields.setFieldOrder( 4, index );
1009 1008
1010 1009
1011 if ( index == 0 ) { 1010 if ( index == 0 ) {
1012 1011
1013 txtAddress->setText( slBusinessAddress[0] ); 1012 txtAddress->setText( slBusinessAddress[0] );
1014 //txtAddress2->setText( (*slBusinessAddress)[1] ); 1013 //txtAddress2->setText( (*slBusinessAddress)[1] );
1015 //txtPOBox->setText( (*slBusinessAddress)[2] ); 1014 //txtPOBox->setText( (*slBusinessAddress)[2] );
1016 txtCity->setText( slBusinessAddress[3] ); 1015 txtCity->setText( slBusinessAddress[3] );
1017 txtState->setText( slBusinessAddress[4] ); 1016 txtState->setText( slBusinessAddress[4] );
1018 txtZip->setText( slBusinessAddress[5] ); 1017 txtZip->setText( slBusinessAddress[5] );
1019 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1018 QLineEdit *txtTmp = cmbCountry->lineEdit();
1020 txtTmp->setText( slBusinessAddress[6] ); 1019 txtTmp->setText( slBusinessAddress[6] );
1021 1020
1022 } else { 1021 } else {
1023 1022
1024 txtAddress->setText( slHomeAddress[0] ); 1023 txtAddress->setText( slHomeAddress[0] );
1025 //txtAddress2->setText( (*slHomeAddress)[1] ); 1024 //txtAddress2->setText( (*slHomeAddress)[1] );
1026 //txtPOBox->setText( (*slHomeAddress)[2] ); 1025 //txtPOBox->setText( (*slHomeAddress)[2] );
1027 txtCity->setText( slHomeAddress[3] ); 1026 txtCity->setText( slHomeAddress[3] );
1028 txtState->setText( slHomeAddress[4] ); 1027 txtState->setText( slHomeAddress[4] );
1029 txtZip->setText( slHomeAddress[5] ); 1028 txtZip->setText( slHomeAddress[5] );
1030 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1029 QLineEdit *txtTmp = cmbCountry->lineEdit();
1031 txtTmp->setText( slHomeAddress[6] ); 1030 txtTmp->setText( slHomeAddress[6] );
1032 1031
1033 } 1032 }
1034 1033
1035} 1034}
1036 1035
1037void ContactEditor::slotFullNameChange( const QString &textChanged ) { 1036void ContactEditor::slotFullNameChange( const QString &textChanged ) {
1038 1037
1039 qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() ); 1038 qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() );
1040 1039
1041 int index = cmbFileAs->currentItem(); 1040 int index = cmbFileAs->currentItem();
1042 1041
1043 cmbFileAs->clear(); 1042 cmbFileAs->clear();
1044 1043
1045 cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); 1044 cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) );
1046 cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); 1045 cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) );
1047 cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); 1046 cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) );
1048 cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); 1047 cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) );
1049 if ( ! txtSuffix->text().isEmpty() ) 1048 if ( ! txtSuffix->text().isEmpty() )
1050 cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); 1049 cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() );
1051 1050
1052 cmbFileAs->setCurrentItem( index ); 1051 cmbFileAs->setCurrentItem( index );
1053 1052
1054 1053
1055} 1054}
1056 1055
1057void ContactEditor::slotSuffixChange( const QString& ) { 1056void ContactEditor::slotSuffixChange( const QString& ) {
1058 // Just want to update the FileAs combo if the suffix was changed.. 1057 // Just want to update the FileAs combo if the suffix was changed..
1059 slotFullNameChange( txtFullName->text() ); 1058 slotFullNameChange( txtFullName->text() );
1060} 1059}
1061 1060
1062void ContactEditor::slotOrganizationChange( const QString &textChanged ){ 1061void ContactEditor::slotOrganizationChange( const QString &textChanged ){
1063 qWarning( "ContactEditor::slotOrganizationChange( %s )", textChanged.latin1() ); 1062 qWarning( "ContactEditor::slotOrganizationChange( %s )", textChanged.latin1() );
1064 // Special handling for storing Companies: 1063 // Special handling for storing Companies:
1065 // If no Fullname is given, we store the Company-Name as lastname 1064 // If no Fullname is given, we store the Company-Name as lastname
1066 // to handle it like a person.. 1065 // to handle it like a person..
1067 if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) ) 1066 if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) )
1068 txtFullName->setText( textChanged ); 1067 txtFullName->setText( textChanged );
1069 1068
1070} 1069}
1071 1070
1072void ContactEditor::accept() { 1071void ContactEditor::accept() {
1073 1072
1074 if ( isEmpty() ) { 1073 if ( isEmpty() ) {
1075 cleanupFields(); 1074 cleanupFields();
1076 reject(); 1075 reject();
1077 } else { 1076 } else {
1078 saveEntry(); 1077 saveEntry();
1079 cleanupFields(); 1078 cleanupFields();
1080 QDialog::accept(); 1079 QDialog::accept();
1081 } 1080 }
1082 1081
1083} 1082}
1084 1083
1085void ContactEditor::slotNote() { 1084void ContactEditor::slotNote() {
1086 1085
1087 dlgNote->showMaximized(); 1086 dlgNote->showMaximized();
1088 if ( !dlgNote->exec() ) { 1087 if ( !dlgNote->exec() ) {
1089 txtNote->setText( ent.notes() ); 1088 txtNote->setText( ent.notes() );
1090 } 1089 }
1091} 1090}
1092 1091
1093void ContactEditor::slotName() { 1092void ContactEditor::slotName() {
1094 1093
1095 QString tmpName; 1094 QString tmpName;
1096 1095
1097 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); 1096 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) );
1098 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); 1097 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) );
1099 txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); 1098 txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
1100 // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); 1099 // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
1101 1100
1102 dlgName->showMaximized(); 1101 dlgName->showMaximized();
1103 if ( dlgName->exec() ) { 1102 if ( dlgName->exec() ) {
1104 if ( txtLastName->text().contains( ' ', TRUE ) ) 1103 if ( txtLastName->text().contains( ' ', TRUE ) )
1105 tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); 1104 tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text();
1106 else 1105 else
1107 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); 1106 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text();
1108 1107
1109 txtFullName->setText( tmpName.simplifyWhiteSpace() ); 1108 txtFullName->setText( tmpName.simplifyWhiteSpace() );
1110 slotFullNameChange( txtFullName->text() ); 1109 slotFullNameChange( txtFullName->text() );
1111 } 1110 }
1112 1111
1113} 1112}
1114 1113
1115void ContactEditor::setNameFocus() { 1114void ContactEditor::setNameFocus() {
1116 1115
1117 txtFullName->setFocus(); 1116 txtFullName->setFocus();
1118 1117
1119} 1118}
1120 1119
1121bool ContactEditor::isEmpty() { 1120bool ContactEditor::isEmpty() {
1122 // Test and see if the record should be saved. 1121 // Test and see if the record should be saved.
1123 // More strict than the original qtopia, needs name or fileas to save 1122 // More strict than the original qtopia, needs name or fileas to save
1124 1123
1125 QString t = txtFullName->text(); 1124 QString t = txtFullName->text();
1126 if ( !t.isEmpty() && containsAlphaNum( t ) ) 1125 if ( !t.isEmpty() && containsAlphaNum( t ) )
1127 return false; 1126 return false;
1128 1127
1129 t = cmbFileAs->currentText(); 1128 t = cmbFileAs->currentText();
1130 if ( !t.isEmpty() && containsAlphaNum( t ) ) 1129 if ( !t.isEmpty() && containsAlphaNum( t ) )
1131 return false; 1130 return false;
1132 1131
1133 return true; 1132 return true;
1134 1133
1135} 1134}
1136 1135
1137QString ContactEditor::parseName( const QString fullName, int type ) { 1136QString ContactEditor::parseName( const QString fullName, int type ) {
1138 1137
1139 QString simplifiedName( fullName.simplifyWhiteSpace() ); 1138 QString simplifiedName( fullName.simplifyWhiteSpace() );
1140 QString strFirstName; 1139 QString strFirstName;
1141 QString strMiddleName; 1140 QString strMiddleName;
1142 QString strLastName; 1141 QString strLastName;
1143 QString strTitle; 1142 QString strTitle;
1144 int commapos; 1143 int commapos;
1145 bool haveLastName = false; 1144 bool haveLastName = false;
1146 1145
1147 qWarning("Fullname: %s", simplifiedName.latin1()); 1146 qWarning("Fullname: %s", simplifiedName.latin1());
1148 1147
1149 commapos = simplifiedName.find( ',', 0, TRUE); 1148 commapos = simplifiedName.find( ',', 0, TRUE);
1150 if ( commapos >= 0 ) { 1149 if ( commapos >= 0 ) {
1151 qWarning(" Commapos: %d", commapos ); 1150 qWarning(" Commapos: %d", commapos );
1152 1151
1153 // A comma (",") separates the lastname from one or 1152 // A comma (",") separates the lastname from one or
1154 // many first names. Thus, remove the lastname from the 1153 // many first names. Thus, remove the lastname from the
1155 // String and parse the firstnames. 1154 // String and parse the firstnames.
1156 1155
1157 strLastName = simplifiedName.left( commapos ); 1156 strLastName = simplifiedName.left( commapos );
1158 simplifiedName= simplifiedName.mid( commapos + 1 ); 1157 simplifiedName= simplifiedName.mid( commapos + 1 );
1159 haveLastName = true; 1158 haveLastName = true;
1160 qWarning("Fullname without ',': %s", simplifiedName.latin1()); 1159 qWarning("Fullname without ',': %s", simplifiedName.latin1());
1161 1160
1162 // If we have any lastname, we should now split all first names. 1161 // If we have any lastname, we should now split all first names.
1163 // The first one will be the used as first, the rest as "middle names" 1162 // The first one will be the used as first, the rest as "middle names"
1164 1163
1165 QStringList allFirstNames = QStringList::split(" ", simplifiedName); 1164 QStringList allFirstNames = QStringList::split(" ", simplifiedName);
1166 QStringList::Iterator it = allFirstNames.begin(); 1165 QStringList::Iterator it = allFirstNames.begin();
1167 strFirstName = *it++; 1166 strFirstName = *it++;
1168 QStringList allSecondNames; 1167 QStringList allSecondNames;
1169 for ( ; it != allFirstNames.end(); ++it ) 1168 for ( ; it != allFirstNames.end(); ++it )
1170 allSecondNames.append( *it ); 1169 allSecondNames.append( *it );
1171 1170
1172 strMiddleName = allSecondNames.join(" "); 1171 strMiddleName = allSecondNames.join(" ");
1173 1172
1174 } else { 1173 } else {
1175 1174
1176 // No comma separator used: We use the first word as firstname, the 1175 // No comma separator used: We use the first word as firstname, the
1177 // last as second/lastname and everything in the middle as middlename 1176 // last as second/lastname and everything in the middle as middlename
1178 1177
1179 QStringList allNames = QStringList::split(" ", simplifiedName); 1178 QStringList allNames = QStringList::split(" ", simplifiedName);
1180 QStringList::Iterator it = allNames.begin(); 1179 QStringList::Iterator it = allNames.begin();
1181 strFirstName = *it++; 1180 strFirstName = *it++;
1182 QStringList allSecondNames; 1181 QStringList allSecondNames;
1183 for ( ; it != --allNames.end(); ++it ) 1182 for ( ; it != --allNames.end(); ++it )
1184 allSecondNames.append( *it ); 1183 allSecondNames.append( *it );
1185 1184
1186 strMiddleName = allSecondNames.join(" "); 1185 strMiddleName = allSecondNames.join(" ");
1187 strLastName = *(--allNames.end()); 1186 strLastName = *(--allNames.end());
1188 1187
1189 } 1188 }
1190 1189
1191 if ( strFirstName == strLastName ) 1190 if ( strFirstName == strLastName )
1192 strFirstName = ""; 1191 strFirstName = "";
1193 1192
1194 qWarning(" strFirstName: %s", strFirstName.latin1()); 1193 qWarning(" strFirstName: %s", strFirstName.latin1());
1195 qWarning(" strMiddleName: %s", strMiddleName.latin1()); 1194 qWarning(" strMiddleName: %s", strMiddleName.latin1());
1196 qWarning(" strLastName: %s", strLastName.latin1()); 1195 qWarning(" strLastName: %s", strLastName.latin1());
1197 qWarning(" strTitle: %s", strTitle.latin1()); 1196 qWarning(" strTitle: %s", strTitle.latin1());
1198 1197
1199 switch (type) { 1198 switch (type) {
1200 case NAME_FL: 1199 case NAME_FL:
1201 return strFirstName + " " + strLastName; 1200 return strFirstName + " " + strLastName;
1202 1201
1203 case NAME_LF: 1202 case NAME_LF:
1204 return strLastName + ", " + strFirstName; 1203 return strLastName + ", " + strFirstName;
1205 1204
1206 case NAME_LFM: 1205 case NAME_LFM:
1207 return strLastName + ", " + strFirstName + " " + strMiddleName; 1206 return strLastName + ", " + strFirstName + " " + strMiddleName;
1208 1207
1209 case NAME_FML: 1208 case NAME_FML:
1210 return strFirstName + " " + strMiddleName + " " + strLastName ; 1209 return strFirstName + " " + strMiddleName + " " + strLastName ;
1211 1210
1212 case NAME_F: 1211 case NAME_F:
1213 return strFirstName; 1212 return strFirstName;
1214 1213
1215 case NAME_M: 1214 case NAME_M:
1216 return strMiddleName; 1215 return strMiddleName;
1217 1216
1218 case NAME_L: 1217 case NAME_L:
1219 return strLastName; 1218 return strLastName;
1220 1219
1221 case NAME_S: 1220 case NAME_S:
1222 return txtSuffix->text(); 1221 return txtSuffix->text();
1223 1222
1224 } 1223 }
1225 return QString::null; 1224 return QString::null;
1226} 1225}
1227 1226
1228void ContactEditor::cleanupFields() { 1227void ContactEditor::cleanupFields() {
1229 QStringList::Iterator it = slChooserValues.begin(); 1228 QStringList::Iterator it = slChooserValues.begin();
1230 1229
1231 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { 1230 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) {
1232 (*it) = ""; 1231 (*it) = "";
1233 } 1232 }
1234 1233
1235 for ( int i = 0; i < 7; i++ ) { 1234 for ( int i = 0; i < 7; i++ ) {
1236 slHomeAddress[i] = ""; 1235 slHomeAddress[i] = "";
1237 slBusinessAddress[i] = ""; 1236 slBusinessAddress[i] = "";
1238 } 1237 }
1239 1238
1240 QListIterator<QLineEdit> itLV( listValue ); 1239 QListIterator<QLineEdit> itLV( listValue );
1241 for ( ; itLV.current(); ++itLV ) { 1240 for ( ; itLV.current(); ++itLV ) {
1242 (*itLV)->setText( "" ); 1241 (*itLV)->setText( "" );
1243 } 1242 }
1244 1243
1245 txtFirstName->setText(""); 1244 txtFirstName->setText("");
1246 txtMiddleName->setText(""); 1245 txtMiddleName->setText("");
1247 txtLastName->setText(""); 1246 txtLastName->setText("");
1248 txtSuffix->setText(""); 1247 txtSuffix->setText("");
1249 txtNote->setText(""); 1248 txtNote->setText("");
1250 txtFullName->setText(""); 1249 txtFullName->setText("");
1251 txtJobTitle->setText(""); 1250 txtJobTitle->setText("");
1252 txtOrganization->setText(""); 1251 txtOrganization->setText("");
1253 txtChooserField1->setText(""); 1252 txtChooserField1->setText("");
1254 txtChooserField2->setText(""); 1253 txtChooserField2->setText("");
1255 txtChooserField3->setText(""); 1254 txtChooserField3->setText("");
1256 txtAddress->setText(""); 1255 txtAddress->setText("");
1257 txtCity->setText(""); 1256 txtCity->setText("");
1258 txtState->setText(""); 1257 txtState->setText("");
1259 txtZip->setText(""); 1258 txtZip->setText("");
1260 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1259 QLineEdit *txtTmp = cmbCountry->lineEdit();
1261 txtTmp->setText(""); 1260 txtTmp->setText("");
1262 txtTmp = cmbFileAs->lineEdit(); 1261 txtTmp = cmbFileAs->lineEdit();
1263 txtTmp->setText(""); 1262 txtTmp->setText("");
1264 1263
1265} 1264}
1266 1265
1267void ContactEditor::setEntry( const OContact &entry ) { 1266void ContactEditor::setEntry( const OContact &entry ) {
1268 1267
1269 initializing = true; 1268 initializing = true;
1270 1269
1271 // Cleanup and activate the general Page .. 1270 // Cleanup and activate the general Page ..
1272 cleanupFields(); 1271 cleanupFields();
1273 tabMain->setCurrentPage( 0 ); 1272 tabMain->setCurrentPage( 0 );
1274 1273
1275 ent = entry; 1274 ent = entry;
1276 1275
1277 emails = QStringList(ent.emailList()); 1276 emails = QStringList(ent.emailList());
1278 defaultEmail = ent.defaultEmail(); 1277 defaultEmail = ent.defaultEmail();
1279 if (defaultEmail.isEmpty()) defaultEmail = emails[0]; 1278 if (defaultEmail.isEmpty()) defaultEmail = emails[0];
1280 qDebug("default email=%s",defaultEmail.latin1()); 1279 qDebug("default email=%s",defaultEmail.latin1());
1281 1280
1282 txtFirstName->setText( ent.firstName() ); 1281 txtFirstName->setText( ent.firstName() );
1283 txtMiddleName->setText( ent.middleName() ); 1282 txtMiddleName->setText( ent.middleName() );
1284 txtLastName->setText( ent.lastName() ); 1283 txtLastName->setText( ent.lastName() );
1285 txtSuffix->setText( ent.suffix() ); 1284 txtSuffix->setText( ent.suffix() );
1286 1285
1287 // QString *tmpString = new QString; 1286 // QString *tmpString = new QString;
1288 // *tmpString = ent.firstName() + " " + ent.middleName() + 1287 // *tmpString = ent.firstName() + " " + ent.middleName() +
1289 // + " " + ent.lastName() + " " + ent.suffix(); 1288 // + " " + ent.lastName() + " " + ent.suffix();
1290 //txtFullName->setText( tmpString->simplifyWhiteSpace() ); 1289 //txtFullName->setText( tmpString->simplifyWhiteSpace() );
1291 1290
1292 if ( !ent.isEmpty() ){ 1291 if ( !ent.isEmpty() ){
1293 // Lastnames with multiple words need to be protected by a comma ! 1292 // Lastnames with multiple words need to be protected by a comma !
1294 if ( ent.lastName().contains( ' ', TRUE ) ) 1293 if ( ent.lastName().contains( ' ', TRUE ) )
1295 txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); 1294 txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() );
1296 else 1295 else
1297 txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); 1296 txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() );
1298 } 1297 }
1299 1298
1300 cmbFileAs->setEditText( ent.fileAs() ); 1299 cmbFileAs->setEditText( ent.fileAs() );
1301 1300
1302 //if (hasTitle) 1301 //if (hasTitle)
1303 txtJobTitle->setText( ent.jobTitle() ); 1302 txtJobTitle->setText( ent.jobTitle() );
1304 1303
1305 //if (hasCompany) 1304 //if (hasCompany)
1306 txtOrganization->setText( ent.company() ); 1305 txtOrganization->setText( ent.company() );
1307 1306
1308 //if (hasNotes) 1307 //if (hasNotes)
1309 txtNote->setText( ent.notes() ); 1308 txtNote->setText( ent.notes() );
1310 1309
1311 //if (hasStreet) { 1310 //if (hasStreet) {
1312 slHomeAddress[0] = ent.homeStreet(); 1311 slHomeAddress[0] = ent.homeStreet();
1313 slBusinessAddress[0] = ent.businessStreet(); 1312 slBusinessAddress[0] = ent.businessStreet();
1314 //} 1313 //}
1315 1314
1316 //if (hasCity) { 1315 //if (hasCity) {
1317 slHomeAddress[3] = ent.homeCity(); 1316 slHomeAddress[3] = ent.homeCity();
1318 slBusinessAddress[3] = ent.businessCity(); 1317 slBusinessAddress[3] = ent.businessCity();
1319 //} 1318 //}
1320 1319
1321 //if (hasState) { 1320 //if (hasState) {
1322 slHomeAddress[4] = ent.homeState(); 1321 slHomeAddress[4] = ent.homeState();
1323 slBusinessAddress[4] = ent.businessState(); 1322 slBusinessAddress[4] = ent.businessState();
1324 //} 1323 //}
1325 1324
1326 //if (hasZip) { 1325 //if (hasZip) {
1327 slHomeAddress[5] = ent.homeZip(); 1326 slHomeAddress[5] = ent.homeZip();
1328 slBusinessAddress[5] = ent.businessZip(); 1327 slBusinessAddress[5] = ent.businessZip();
1329 //} 1328 //}
1330 1329
1331 //if (hasCountry) { 1330 //if (hasCountry) {
1332 slHomeAddress[6] = ent.homeCountry(); 1331 slHomeAddress[6] = ent.homeCountry();
1333 slBusinessAddress[6] = ent.businessCountry(); 1332 slBusinessAddress[6] = ent.businessCountry();
1334 //} 1333 //}
1335 1334
1336 QStringList::ConstIterator it; 1335 QStringList::ConstIterator it;
1337 QListIterator<QLineEdit> itLE( listValue ); 1336 QListIterator<QLineEdit> itLE( listValue );
1338 for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { 1337 for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) {
1339 1338
1340 qWarning(" Filling dynamic Field: %s", (*it).latin1() ); 1339 qWarning(" Filling dynamic Field: %s", (*it).latin1() );
1341 1340
1342 if ( *it == "Department" ) 1341 if ( *it == "Department" )
1343 (*itLE)->setText( ent.department() ); 1342 (*itLE)->setText( ent.department() );
1344 1343
1345 if ( *it == "Company" ) 1344 if ( *it == "Company" )
1346 (*itLE)->setText( ent.company() ); 1345 (*itLE)->setText( ent.company() );
1347 1346
1348 if ( *it == "Office" ) 1347 if ( *it == "Office" )
1349 (*itLE)->setText( ent.office() ); 1348 (*itLE)->setText( ent.office() );
1350 1349
1351 if ( *it == "Profession" ) 1350 if ( *it == "Profession" )
1352 (*itLE)->setText( ent.profession() ); 1351 (*itLE)->setText( ent.profession() );
1353 1352
1354 if ( *it == "Assistant" ) 1353 if ( *it == "Assistant" )
1355 (*itLE)->setText( ent.assistant() ); 1354 (*itLE)->setText( ent.assistant() );
1356 1355
1357 if ( *it == "Manager" ) 1356 if ( *it == "Manager" )
1358 (*itLE)->setText( ent.manager() ); 1357 (*itLE)->setText( ent.manager() );
1359 1358
1360 if ( *it == "Spouse" ) 1359 if ( *it == "Spouse" )
1361 (*itLE)->setText( ent.spouse() ); 1360 (*itLE)->setText( ent.spouse() );
1362 1361
1363 if ( *it == "Nickname" ){ 1362 if ( *it == "Nickname" ){
1364 qWarning("**** Nichname: %s", ent.nickname().latin1() ); 1363 qWarning("**** Nichname: %s", ent.nickname().latin1() );
1365 (*itLE)->setText( ent.nickname() ); 1364 (*itLE)->setText( ent.nickname() );
1366 } 1365 }
1367 1366
1368 if ( *it == "Children" ) 1367 if ( *it == "Children" )
1369 (*itLE)->setText( ent.children() ); 1368 (*itLE)->setText( ent.children() );
1370 1369
1371 } 1370 }
1372 1371
1373 QStringList::Iterator itV; 1372 QStringList::Iterator itV;
1374 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1373 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1375 1374
1376 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) 1375 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) )
1377 *itV = ent.businessPhone(); 1376 *itV = ent.businessPhone();
1378 /* 1377 /*
1379 if ( *it == "Business 2 Phone" ) 1378 if ( *it == "Business 2 Phone" )
1380 *itV = ent.business2Phone(); 1379 *itV = ent.business2Phone();
1381 */ 1380 */
1382 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) 1381 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) )
1383 *itV = ent.businessFax(); 1382 *itV = ent.businessFax();
1384 1383
1385 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) 1384 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) )
1386 *itV = ent.businessMobile(); 1385 *itV = ent.businessMobile();
1387 /* 1386 /*
1388 if ( *it == "Company Phone" ) 1387 if ( *it == "Company Phone" )
1389 *itV = ent.companyPhone(); 1388 *itV = ent.companyPhone();
1390 */ 1389 */
1391 if ( *it == "Default Email" ) 1390 if ( *it == "Default Email" )
1392 *itV = ent.defaultEmail(); 1391 *itV = ent.defaultEmail();
1393 1392
1394 if ( *it == "Emails" ) 1393 if ( *it == "Emails" )
1395 *itV = ent.emailList().join(", "); // :SX 1394 *itV = ent.emailList().join(", "); // :SX
1396 1395
1397 if ( *it == "Home Phone" ) 1396 if ( *it == "Home Phone" )
1398 *itV = ent.homePhone(); 1397 *itV = ent.homePhone();
1399 /* 1398 /*
1400 if ( *it == "Home 2 Phone" ) 1399 if ( *it == "Home 2 Phone" )
1401 *itV = ent.home2Phone(); 1400 *itV = ent.home2Phone();
1402 */ 1401 */
1403 if ( *it == "Home Fax" ) 1402 if ( *it == "Home Fax" )
1404 *itV = ent.homeFax(); 1403 *itV = ent.homeFax();
1405 1404
1406 if ( *it == "Home Mobile" ) 1405 if ( *it == "Home Mobile" )
1407 *itV = ent.homeMobile(); 1406 *itV = ent.homeMobile();
1408 /* 1407 /*
1409 if ( *it == "Car Phone" ) 1408 if ( *it == "Car Phone" )
1410 *itV = ent.carPhone(); 1409 *itV = ent.carPhone();
1411 1410
1412 if ( *it == "ISDN Phone" ) 1411 if ( *it == "ISDN Phone" )
1413 *itV = ent.ISDNPhone(); 1412 *itV = ent.ISDNPhone();
1414 1413
1415 if ( *it == "Other Phone" ) 1414 if ( *it == "Other Phone" )
1416 *itV = ent.otherPhone(); 1415 *itV = ent.otherPhone();
1417 */ 1416 */
1418 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) 1417 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
1419 *itV = ent.businessPager(); 1418 *itV = ent.businessPager();
1420 /* 1419 /*
1421 if ( *it == "Home Pager") 1420 if ( *it == "Home Pager")
1422 *itV = ent.homePager(); 1421 *itV = ent.homePager();
1423 1422
1424 if ( *it == "AIM IM" ) 1423 if ( *it == "AIM IM" )
1425 *itV = ent.AIMIM(); 1424 *itV = ent.AIMIM();
1426 1425
1427 if ( *it == "ICQ IM" ) 1426 if ( *it == "ICQ IM" )
1428 *itV = ent.ICQIM(); 1427 *itV = ent.ICQIM();
1429 1428
1430 if ( *it == "Jabber IM" ) 1429 if ( *it == "Jabber IM" )
1431 *itV = ent.jabberIM(); 1430 *itV = ent.jabberIM();
1432 1431
1433 if ( *it == "MSN IM" ) 1432 if ( *it == "MSN IM" )
1434 *itV = ent.MSNIM(); 1433 *itV = ent.MSNIM();
1435 1434
1436 if ( *it == "Yahoo IM" ) 1435 if ( *it == "Yahoo IM" )
1437 *itV = ent.yahooIM(); 1436 *itV = ent.yahooIM();
1438 */ 1437 */
1439 if ( *it == "Home Web Page" ) 1438 if ( *it == "Home Web Page" )
1440 *itV = ent.homeWebpage(); 1439 *itV = ent.homeWebpage();
1441 1440
1442 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) 1441 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1443 *itV = ent.businessWebpage(); 1442 *itV = ent.businessWebpage();
1444 1443
1445 1444
1446 } 1445 }
1447 1446
1448 1447
1449 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); 1448 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") );
1450 1449
1451 QString gender = ent.gender(); 1450 QString gender = ent.gender();
1452 cmbGender->setCurrentItem( gender.toInt() ); 1451 cmbGender->setCurrentItem( gender.toInt() );
1453 1452
1454 txtNote->setText( ent.notes() ); 1453 txtNote->setText( ent.notes() );
1455 1454
1456 slotAddressTypeChange( cmbAddress->currentItem() ); 1455 slotAddressTypeChange( cmbAddress->currentItem() );
1457 1456
1458 // Get combo-settings from contact and set preset.. 1457 // Get combo-settings from contact and set preset..
1459 contactfields.loadFromRecord( ent ); 1458 contactfields.loadFromRecord( ent );
1460 cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); 1459 cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) );
1461 cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); 1460 cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) );
1462 cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); 1461 cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) );
1463 cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); 1462 cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) );
1464 cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); 1463 cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) );
1465 slotCmbChooser1Change( cmbChooserField1->currentItem() ); 1464 slotCmbChooser1Change( cmbChooserField1->currentItem() );
1466 slotCmbChooser2Change( cmbChooserField2->currentItem() ); 1465 slotCmbChooser2Change( cmbChooserField2->currentItem() );
1467 slotCmbChooser3Change( cmbChooserField3->currentItem() ); 1466 slotCmbChooser3Change( cmbChooserField3->currentItem() );
1468 slotCmbChooser4Change( cmbChooserField4->currentItem() ); 1467 slotCmbChooser4Change( cmbChooserField4->currentItem() );
1469 slotAddressTypeChange( cmbAddress->currentItem() ); 1468 slotAddressTypeChange( cmbAddress->currentItem() );
1470 1469
1471 updateDatePicker(); 1470 updateDatePicker();
1472 1471
1473 initializing = false; 1472 initializing = false;
1474} 1473}
1475void ContactEditor::updateDatePicker() 1474void ContactEditor::updateDatePicker()
1476{ 1475{
1477 // Set DatePicker 1476 // Set DatePicker
1478 if ( !ent.birthday().isNull() ){ 1477 if ( !ent.birthday().isNull() ){
1479 birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); 1478 birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) );
1480 birthdayPicker->setDate( ent.birthday() ); 1479 birthdayPicker->setDate( ent.birthday() );
1481 } else 1480 } else
1482 birthdayButton->setText( tr ("Unknown") ); 1481 birthdayButton->setText( tr ("Unknown") );
1483 1482
1484 if ( !ent.anniversary().isNull() ){ 1483 if ( !ent.anniversary().isNull() ){
1485 anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); 1484 anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) );
1486 anniversaryPicker->setDate( ent.anniversary() ); 1485 anniversaryPicker->setDate( ent.anniversary() );
1487 } else 1486 } else
1488 anniversaryButton->setText( tr ("Unknown") ); 1487 anniversaryButton->setText( tr ("Unknown") );
1489 1488
1490} 1489}
1491 1490
1492void ContactEditor::saveEntry() { 1491void ContactEditor::saveEntry() {
1493 1492
1494 // Store current combo into contact 1493 // Store current combo into contact
1495 contactfields.saveToRecord( ent ); 1494 contactfields.saveToRecord( ent );
1496 1495
1497 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); 1496 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) );
1498 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); 1497 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) );
1499 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); 1498 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
1500 // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); 1499 // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
1501 1500
1502 ent.setFirstName( txtFirstName->text() ); 1501 ent.setFirstName( txtFirstName->text() );
1503 ent.setLastName( txtLastName->text() ); 1502 ent.setLastName( txtLastName->text() );
1504 ent.setMiddleName( txtMiddleName->text() ); 1503 ent.setMiddleName( txtMiddleName->text() );
1505 ent.setSuffix( txtSuffix->text() ); 1504 ent.setSuffix( txtSuffix->text() );
1506 1505
1507 ent.setFileAs( cmbFileAs->currentText() ); 1506 ent.setFileAs( cmbFileAs->currentText() );
1508 1507
1509 ent.setCategories( cmbCat->currentCategories() ); 1508 ent.setCategories( cmbCat->currentCategories() );
1510 1509
1511 1510
1512 //if (hasTitle) 1511 //if (hasTitle)
1513 ent.setJobTitle( txtJobTitle->text() ); 1512 ent.setJobTitle( txtJobTitle->text() );
1514 1513
1515 //if (hasCompany) 1514 //if (hasCompany)
1516 ent.setCompany( txtOrganization->text() ); 1515 ent.setCompany( txtOrganization->text() );
1517 1516
1518 //if (hasNotes) 1517 //if (hasNotes)
1519 ent.setNotes( txtNote->text() ); 1518 ent.setNotes( txtNote->text() );
1520 1519
1521 //if (hasStreet) { 1520 //if (hasStreet) {
1522 ent.setHomeStreet( slHomeAddress[0] ); 1521 ent.setHomeStreet( slHomeAddress[0] );
1523 ent.setBusinessStreet( slBusinessAddress[0] ); 1522 ent.setBusinessStreet( slBusinessAddress[0] );
1524 //} 1523 //}
1525 1524
1526 //if (hasCity) { 1525 //if (hasCity) {
1527 ent.setHomeCity( slHomeAddress[3] ); 1526 ent.setHomeCity( slHomeAddress[3] );
1528 ent.setBusinessCity( slBusinessAddress[3] ); 1527 ent.setBusinessCity( slBusinessAddress[3] );
1529 //} 1528 //}
1530 1529
1531 //if (hasState) { 1530 //if (hasState) {
1532 ent.setHomeState( slHomeAddress[4] ); 1531 ent.setHomeState( slHomeAddress[4] );
1533 ent.setBusinessState( slBusinessAddress[4] ); 1532 ent.setBusinessState( slBusinessAddress[4] );
1534 //} 1533 //}
1535 1534
1536 //if (hasZip) { 1535 //if (hasZip) {
1537 ent.setHomeZip( slHomeAddress[5] ); 1536 ent.setHomeZip( slHomeAddress[5] );
1538 ent.setBusinessZip( slBusinessAddress[5] ); 1537 ent.setBusinessZip( slBusinessAddress[5] );
1539 //} 1538 //}
1540 1539
1541 //if (hasCountry) { 1540 //if (hasCountry) {
1542 ent.setHomeCountry( slHomeAddress[6] ); 1541 ent.setHomeCountry( slHomeAddress[6] );
1543 ent.setBusinessCountry( slBusinessAddress[6] ); 1542 ent.setBusinessCountry( slBusinessAddress[6] );
1544 //} 1543 //}
1545 1544
1546 QStringList::ConstIterator it; 1545 QStringList::ConstIterator it;
1547 QListIterator<QLineEdit> itLE( listValue ); 1546 QListIterator<QLineEdit> itLE( listValue );
1548 for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { 1547 for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) {
1549 1548
1550 if ( *it == "Department" ) 1549 if ( *it == "Department" )
1551 ent.setDepartment( (*itLE)->text() ); 1550 ent.setDepartment( (*itLE)->text() );
1552 1551
1553 if ( *it == "Company" ) 1552 if ( *it == "Company" )
1554 ent.setCompany( (*itLE)->text() ); 1553 ent.setCompany( (*itLE)->text() );
1555 1554
1556 if ( *it == "Office" ) 1555 if ( *it == "Office" )
1557 ent.setOffice( (*itLE)->text() ); 1556 ent.setOffice( (*itLE)->text() );
1558 1557
1559 if ( *it == "Profession" ) 1558 if ( *it == "Profession" )
1560 ent.setProfession( (*itLE)->text() ); 1559 ent.setProfession( (*itLE)->text() );
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h
index e7432ee..72d14a9 100644
--- a/core/pim/addressbook/contacteditor.h
+++ b/core/pim/addressbook/contacteditor.h
@@ -1,192 +1,191 @@
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 <opie/ocontact.h> 24#include <opie/ocontact.h>
25#include <opie/ocontactfields.h>
25 26
26#include <qpe/datebookmonth.h> 27#include <qpe/datebookmonth.h>
27 28
28#include <qdialog.h> 29#include <qdialog.h>
29#include <qlist.h> 30#include <qlist.h>
30#include <qmap.h> 31#include <qmap.h>
31#include <qstringlist.h> 32#include <qstringlist.h>
32#include <qwidgetstack.h> 33#include <qwidgetstack.h>
33 34
34#include "ocontactfields.h"
35
36const int NAME_LF = 0; 35const int NAME_LF = 0;
37const int NAME_LFM = 1; 36const int NAME_LFM = 1;
38const int NAME_FL = 2; 37const int NAME_FL = 2;
39const int NAME_FML = 3; 38const int NAME_FML = 3;
40 39
41const int NAME_F = 4; 40const int NAME_F = 4;
42const int NAME_M = 5; 41const int NAME_M = 5;
43const int NAME_L = 6; 42const int NAME_L = 6;
44const int NAME_S = 7; 43const int NAME_S = 7;
45 44
46 45
47class QScrollView; 46class QScrollView;
48class QTabWidget; 47class QTabWidget;
49class QMultiLineEdit; 48class QMultiLineEdit;
50class QLineEdit; 49class QLineEdit;
51class QComboBox; 50class QComboBox;
52class QPushButton; 51class QPushButton;
53class CategorySelect; 52class CategorySelect;
54class QLabel; 53class QLabel;
55 54
56class ContactEditor : public QDialog { 55class ContactEditor : public QDialog {
57 Q_OBJECT 56 Q_OBJECT
58 57
59 public: 58 public:
60 ContactEditor(const OContact &entry, 59 ContactEditor(const OContact &entry,
61 QWidget *parent = 0, 60 QWidget *parent = 0,
62 const char *name = 0, 61 const char *name = 0,
63 WFlags fl = 0 ); 62 WFlags fl = 0 );
64 ~ContactEditor(); 63 ~ContactEditor();
65 void setNameFocus(); 64 void setNameFocus();
66 void setPersonalView( bool personal = true ); 65 void setPersonalView( bool personal = true );
67 OContact entry() const { return ent; } 66 OContact entry() const { return ent; }
68 67
69 public slots: 68 public slots:
70 void slotNote(); 69 void slotNote();
71 void slotName(); 70 void slotName();
72 void setEntry(const OContact &entry); 71 void setEntry(const OContact &entry);
73 72
74 protected slots: 73 protected slots:
75 void accept(); 74 void accept();
76 75
77 private: 76 private:
78 void init(); 77 void init();
79 void saveEntry(); 78 void saveEntry();
80 bool isEmpty(); 79 bool isEmpty();
81 void cleanupFields(); 80 void cleanupFields();
82 void updateDatePicker(); 81 void updateDatePicker();
83 QString parseName( QString fullName, int type ); 82 QString parseName( QString fullName, int type );
84 void chooserError( int index ); 83 void chooserError( int index );
85 private slots: 84 private slots:
86 void slotChooser1Change( const QString &textChanged ); 85 void slotChooser1Change( const QString &textChanged );
87 void slotChooser2Change( const QString &textChanged ); 86 void slotChooser2Change( const QString &textChanged );
88 void slotChooser3Change( const QString &textChanged ); 87 void slotChooser3Change( const QString &textChanged );
89 void slotChooser4Change( const QString &textChanged ); 88 void slotChooser4Change( const QString &textChanged );
90 void slotCmbChooser1Change( int index ); 89 void slotCmbChooser1Change( int index );
91 void slotCmbChooser2Change( int index ); 90 void slotCmbChooser2Change( int index );
92 void slotCmbChooser3Change( int index ); 91 void slotCmbChooser3Change( int index );
93 void slotCmbChooser4Change( int index ); 92 void slotCmbChooser4Change( int index );
94 void slotAddressTypeChange( int index ); 93 void slotAddressTypeChange( int index );
95 void slotAddressChange( const QString &textChanged ); 94 void slotAddressChange( const QString &textChanged );
96 void slotAddress2Change( const QString &textChanged ); 95 void slotAddress2Change( const QString &textChanged );
97 void slotPOBoxChange( const QString &textChanged ); 96 void slotPOBoxChange( const QString &textChanged );
98 void slotCityChange( const QString &textChanged ); 97 void slotCityChange( const QString &textChanged );
99 void slotStateChange( const QString &textChanged ); 98 void slotStateChange( const QString &textChanged );
100 void slotZipChange( const QString &textChanged ); 99 void slotZipChange( const QString &textChanged );
101 void slotCountryChange( const QString &textChanged ); 100 void slotCountryChange( const QString &textChanged );
102 void slotFullNameChange( const QString &textChanged ); 101 void slotFullNameChange( const QString &textChanged );
103 void slotSuffixChange( const QString &textChanged ); 102 void slotSuffixChange( const QString &textChanged );
104 void slotOrganizationChange( const QString &textChanged ); 103 void slotOrganizationChange( const QString &textChanged );
105 void slotAnniversaryDateChanged( int year, int month, int day); 104 void slotAnniversaryDateChanged( int year, int month, int day);
106 void slotBirthdayDateChanged( int year, int month, int day); 105 void slotBirthdayDateChanged( int year, int month, int day);
107 void slotRemoveBirthday(); 106 void slotRemoveBirthday();
108 void slotRemoveAnniversary(); 107 void slotRemoveAnniversary();
109 void defaultEmailChanged(int); 108 void defaultEmailChanged(int);
110 109
111 private: 110 private:
112 enum StackWidgets { TextField = 1, Combo }; 111 enum StackWidgets { TextField = 1, Combo };
113 int defaultEmailChooserPosition; 112 int defaultEmailChooserPosition;
114 void populateDefaultEmailCmb(); 113 void populateDefaultEmailCmb();
115 void chooserChange( const QString&, int , QLineEdit*, int ); 114 void chooserChange( const QString&, int , QLineEdit*, int );
116 bool cmbChooserChange( int , QWidgetStack*, int ); 115 bool cmbChooserChange( int , QWidgetStack*, int );
117 OContactFields contactfields; 116 OContactFields contactfields;
118 117
119 OContact ent; 118 OContact ent;
120 119
121 QDialog *dlgNote; 120 QDialog *dlgNote;
122 QDialog *dlgName; 121 QDialog *dlgName;
123 122
124 QList<QLineEdit> listValue; 123 QList<QLineEdit> listValue;
125 QList<QLabel> listName; 124 QList<QLabel> listName;
126 125
127 QStringList slDynamicEntries; 126 QStringList slDynamicEntries;
128 QStringList trlDynamicEntries; 127 QStringList trlDynamicEntries;
129 128
130 bool m_personalView; 129 bool m_personalView;
131 130
132 QStringList slHomeAddress; 131 QStringList slHomeAddress;
133 QStringList slBusinessAddress; 132 QStringList slBusinessAddress;
134 QStringList slChooserNames; 133 QStringList slChooserNames;
135 QStringList slChooserValues; 134 QStringList slChooserValues;
136 QStringList emails; 135 QStringList emails;
137 QString defaultEmail; 136 QString defaultEmail;
138 137
139 QMultiLineEdit *txtNote; 138 QMultiLineEdit *txtNote;
140 QLabel *lblNote; 139 QLabel *lblNote;
141 140
142 //QLineEdit *txtTitle; 141 //QLineEdit *txtTitle;
143 QLineEdit *txtFirstName; 142 QLineEdit *txtFirstName;
144 QLineEdit *txtMiddleName; 143 QLineEdit *txtMiddleName;
145 QLineEdit *txtLastName; 144 QLineEdit *txtLastName;
146 QLineEdit *txtSuffix; 145 QLineEdit *txtSuffix;
147 146
148 QTabWidget *tabMain; 147 QTabWidget *tabMain;
149 QScrollView *svGeneral; 148 QScrollView *svGeneral;
150 QPushButton *btnFullName; 149 QPushButton *btnFullName;
151 QPushButton *btnNote; 150 QPushButton *btnNote;
152 QLineEdit *txtFullName; 151 QLineEdit *txtFullName;
153 QLineEdit *txtJobTitle; 152 QLineEdit *txtJobTitle;
154 QLineEdit *txtOrganization; 153 QLineEdit *txtOrganization;
155 QLineEdit *txtChooserField1; 154 QLineEdit *txtChooserField1;
156 QLineEdit *txtChooserField2; 155 QLineEdit *txtChooserField2;
157 QLineEdit *txtChooserField3; 156 QLineEdit *txtChooserField3;
158 QLineEdit *txtChooserField4; 157 QLineEdit *txtChooserField4;
159 QWidgetStack* m_widgetStack1; 158 QWidgetStack* m_widgetStack1;
160 QWidgetStack* m_widgetStack2; 159 QWidgetStack* m_widgetStack2;
161 QWidgetStack* m_widgetStack3; 160 QWidgetStack* m_widgetStack3;
162 QWidgetStack* m_widgetStack4; 161 QWidgetStack* m_widgetStack4;
163 QComboBox *cmbChooserField1; 162 QComboBox *cmbChooserField1;
164 QComboBox *cmbChooserField2; 163 QComboBox *cmbChooserField2;
165 QComboBox *cmbChooserField3; 164 QComboBox *cmbChooserField3;
166 QComboBox *cmbChooserField4; 165 QComboBox *cmbChooserField4;
167 QComboBox *cmbDefaultEmail; 166 QComboBox *cmbDefaultEmail;
168 QComboBox *cmbFileAs; 167 QComboBox *cmbFileAs;
169 CategorySelect *cmbCat; 168 CategorySelect *cmbCat;
170 QLabel *labCat; 169 QLabel *labCat;
171 170
172 QScrollView *svAddress; 171 QScrollView *svAddress;
173 QLineEdit *txtAddress; 172 QLineEdit *txtAddress;
174 //QLineEdit *txtAddress2; 173 //QLineEdit *txtAddress2;
175 //QLineEdit *txtPOBox; 174 //QLineEdit *txtPOBox;
176 QLineEdit *txtCity; 175 QLineEdit *txtCity;
177 QLineEdit *txtState; 176 QLineEdit *txtState;
178 QLineEdit *txtZip; 177 QLineEdit *txtZip;
179 QComboBox *cmbAddress; 178 QComboBox *cmbAddress;
180 QComboBox *cmbCountry; 179 QComboBox *cmbCountry;
181 180
182 QScrollView *svDetails; 181 QScrollView *svDetails;
183 QComboBox *cmbGender; 182 QComboBox *cmbGender;
184 DateBookMonth* birthdayPicker; 183 DateBookMonth* birthdayPicker;
185 QToolButton* birthdayButton; 184 QToolButton* birthdayButton;
186 DateBookMonth* anniversaryPicker; 185 DateBookMonth* anniversaryPicker;
187 QToolButton* anniversaryButton; 186 QToolButton* anniversaryButton;
188 187
189 bool initializing; 188 bool initializing;
190 }; 189 };
191 190
192#endif 191#endif