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,792 +1,791 @@
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 ){
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