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