summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp218
1 files changed, 156 insertions, 62 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index fa60f98..d419142 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -1,456 +1,521 @@
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).right( 3 ) == tr( "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
115 if ( (*it) == tr( "Home Fax" ) ) {
116 slChooserNames.append( *it );
117 slChooserValues.append("" );
118 //slDynamicEntries->remove( it );
119 continue;
120 }
121
114 122
115 if ( (*it).right( 5 ) == tr( "Phone" ) ) { 123 if ( (*it) == tr( "Business Phone" ) ) {
116 slChooserNames.append( *it ); 124 slChooserNames.append( *it );
117 slChooserValues.append( "" ); 125 slChooserValues.append( "" );
118 //slDynamicEntries->remove( it ); 126 //slDynamicEntries->remove( it );
119 continue; 127 continue;
120 } 128 }
121 129
130 if ( (*it) == tr( "Home Phone" ) ) {
131 slChooserNames.append( *it );
132 slChooserValues.append( "" );
133 //slDynamicEntries->remove( it );
134 continue;
135 }
136
137/*
122 if ( (*it).right( 2 ) == tr( "IM" ) ) { 138 if ( (*it).right( 2 ) == tr( "IM" ) ) {
123 slChooserNames.append( *it ); 139 slChooserNames.append( *it );
124 slChooserValues.append( "" ); 140 slChooserValues.append( "" );
125 //slDynamicEntries->remove( it ); 141 //slDynamicEntries->remove( it );
126 continue; 142 continue;
143 } */
144
145 if ( (*it) == tr( "Business Mobile" ) ) {
146 slChooserNames.append( *it );
147 slChooserValues.append( "" );
148 //slDynamicEntries->remove( it );
149 continue;
150 }
151
152 if ( (*it) == tr( "Home Mobile" ) ) {
153 slChooserNames.append( *it );
154 slChooserValues.append( "" );
155 //slDynamicEntries->remove( it );
156 continue;
127 } 157 }
128 158
129 if ( (*it).right( 6 ) == tr( "Mobile" ) ) { 159
160 if ( (*it) == tr( "Business WebPage" ) ) {
130 slChooserNames.append( *it ); 161 slChooserNames.append( *it );
131 slChooserValues.append( "" ); 162 slChooserValues.append( "" );
132 //slDynamicEntries->remove( it ); 163 //slDynamicEntries->remove( it );
133 continue; 164 continue;
134 } 165 }
135 166
136 if ( (*it).right( 4 ) == tr( "Page" ) ) { 167 if ( (*it) == tr( "Home Web Page" ) ) {
137 slChooserNames.append( *it ); 168 slChooserNames.append( *it );
138 slChooserValues.append( "" ); 169 slChooserValues.append( "" );
139 //slDynamicEntries->remove( it ); 170 //slDynamicEntries->remove( it );
140 continue; 171 continue;
141 } 172 }
142 173
143 if ( (*it).right( 5 ) == tr( "Pager" ) ) { 174 if ( (*it) == tr( "Business Pager" ) ) {
144 slChooserNames.append( *it ); 175 slChooserNames.append( *it );
145 slChooserValues.append( "" ); 176 slChooserValues.append( "" );
146 //slDynamicEntries->remove( it ); 177 //slDynamicEntries->remove( it );
147 continue; 178 continue;
148 } 179 }
149 180
150 if ( *it == tr( "Default Email" ) ) { 181 if ( *it == tr( "Default Email" ) ) {
151 slChooserNames.append( *it ); 182 slChooserNames.append( *it );
152 slChooserValues.append( "" ); 183 slChooserValues.append( "" );
153 //slDynamicEntries->remove( it ); 184 //slDynamicEntries->remove( it );
154 continue; 185 continue;
155 } 186 }
156 187
157 if ( *it == tr( "Emails" ) ) { 188 if ( *it == tr( "Emails" ) ) {
158 slChooserNames.append( *it ); 189 slChooserNames.append( *it );
159 slChooserValues.append( "" ); 190 slChooserValues.append( "" );
160 //slDynamicEntries->remove( it ); 191 //slDynamicEntries->remove( it );
161 continue; 192 continue;
162 } 193 }
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" )
196 continue;
163 197
164 if ( *it == tr( "Name Title" ) ) { 198 if ( *it == tr( "Name Title" ) ) {
165 //slDynamicEntries->remove( it ); 199 //slDynamicEntries->remove( it );
166 continue; 200 continue;
167 } 201 }
168 202
169 if ( *it == tr( "First Name" ) ) { 203 if ( *it == tr( "First Name" ) ) {
170 //slDynamicEntries->remove( it ); 204 //slDynamicEntries->remove( it );
171 continue; 205 continue;
172 } 206 }
173 207
174 if ( *it == tr( "Middle Name" ) ) { 208 if ( *it == tr( "Middle Name" ) ) {
175 //slDynamicEntries->remove( it ); 209 //slDynamicEntries->remove( it );
176 continue; 210 continue;
177 } 211 }
178 212
179 if ( *it == tr( "Last Name" ) ) { 213 if ( *it == tr( "Last Name" ) ) {
180 //slDynamicEntries->remove( it ); 214 //slDynamicEntries->remove( it );
181 continue; 215 continue;
182 } 216 }
183 217
184 if ( *it == tr( "Suffix" ) ) { 218 if ( *it == tr( "Suffix" ) ) {
185 //slDynamicEntries->remove( it ); 219 //slDynamicEntries->remove( it );
186 continue; 220 continue;
187 } 221 }
188 222
189 if ( *it == tr( "File As" ) ) { 223 if ( *it == tr( "File As" ) ) {
190 //slDynamicEntries->remove( it ); 224 //slDynamicEntries->remove( it );
191 continue; 225 continue;
192 } 226 }
193 227
194 if ( *it == tr( "Gender" ) ) { 228 if ( *it == tr( "Gender" ) ) {
195 hasGender = TRUE; 229 hasGender = TRUE;
196 //slDynamicEntries->remove( it ); 230 //slDynamicEntries->remove( it );
197 continue; 231 continue;
198 } 232 }
199 233
200 if ( *it == tr( "Job Title" ) ) { 234 if ( *it == tr( "Job Title" ) ) {
201 hasTitle = TRUE; 235 hasTitle = TRUE;
202 //slDynamicEntries->remove( it ); 236 //slDynamicEntries->remove( it );
203 continue; 237 continue;
204 } 238 }
205 239
206 if ( *it == tr( "Company" ) ) { 240 if ( *it == tr( "Company") || *it == tr( "Organization" ) ) {
207 hasCompany = TRUE; 241 hasCompany = TRUE;
208 //slDynamicEntries->remove( it ); 242 //slDynamicEntries->remove( it );
209 continue; 243 continue;
210 } 244 }
211 245
212 if ( *it == tr( "Notes" ) ) { 246 if ( *it == tr( "Notes" ) ) {
213 hasNotes = TRUE; 247 hasNotes = TRUE;
214 //slDynamicEntries->remove( it ); 248 //slDynamicEntries->remove( it );
215 continue; 249 continue;
216 } 250 }
217 251
218 if ( *it == tr( "Groups" ) ) { 252 if ( *it == tr( "Groups" ) ) {
219 //slDynamicEntries->remove( it ); 253 //slDynamicEntries->remove( it );
220 continue; 254 continue;
221 } 255 }
222 256
223 if ( (*it).right( 6 ) == tr( "Street" ) ) { 257 if ( (*it) == tr( "Business Street" ) ) {
224 hasStreet = TRUE; 258 hasStreet = TRUE;
225 //slDynamicEntries->remove( it ); 259 //slDynamicEntries->remove( it );
226 continue; 260 continue;
227 } 261 }
228 262
263 if ( (*it) == tr( "Home Street" ) ) {
264 hasStreet = TRUE;
265 //slDynamicEntries->remove( it );
266 continue;
267 }
268/*
229 if ( (*it).right( 8 ) == tr( "Street 2" ) ) { 269 if ( (*it).right( 8 ) == tr( "Street 2" ) ) {
230 hasStreet2 = TRUE; 270 hasStreet2 = TRUE;
231 //slDynamicEntries->remove( it ); 271 //slDynamicEntries->remove( it );
232 continue; 272 continue;
233 } 273 }
234 274
235 if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { 275 if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) {
236 hasPOBox = TRUE; 276 hasPOBox = TRUE;
237 //slDynamicEntries->remove( it ); 277 //slDynamicEntries->remove( it );
238 continue; 278 continue;
279 } */
280
281 if ( (*it) == tr( "Business City" ) ) {
282 hasCity = TRUE;
283 //slDynamicEntries->remove( it );
284 continue;
285 }
286
287 if ( (*it) == tr( "Business State" ) ) {
288 hasState = TRUE;
289 //slDynamicEntries->remove( it );
290 continue;
291 }
292
293 if ( (*it) == tr( "Business Zip" ) ) {
294 hasZip = TRUE;
295 //slDynamicEntries->remove( it );
296 continue;
297 }
298
299 if ( (*it) == tr( "Business Country" ) ) {
300 hasCountry = TRUE;
301 //slDynamicEntries->remove( it );
302 continue;
239 } 303 }
240 304
241 if ( (*it).right( 4 ) == tr( "City" ) ) { 305 if ( (*it) == tr( "Home City" ) ) {
242 hasCity = TRUE; 306 hasCity = TRUE;
243 //slDynamicEntries->remove( it ); 307 //slDynamicEntries->remove( it );
244 continue; 308 continue;
245 } 309 }
246 310
247 if ( (*it).right( 5 ) == tr( "State" ) ) { 311 if ( (*it) == tr( "Home State" ) ) {
248 hasState = TRUE; 312 hasState = TRUE;
249 //slDynamicEntries->remove( it ); 313 //slDynamicEntries->remove( it );
250 continue; 314 continue;
251 } 315 }
252 316
253 if ( (*it).right( 3 ) == tr( "Zip" ) ) { 317 if ( (*it) == tr( "Home Zip" ) ) {
254 hasZip = TRUE; 318 hasZip = TRUE;
255 //slDynamicEntries->remove( it ); 319 //slDynamicEntries->remove( it );
256 continue; 320 continue;
257 } 321 }
258 322
259 if ( (*it).right( 7 ) == tr( "Country" ) ) { 323 if ( (*it) == tr( "Home Country" ) ) {
260 hasCountry = TRUE; 324 hasCountry = TRUE;
261 //slDynamicEntries->remove( it ); 325 //slDynamicEntries->remove( it );
262 continue; 326 continue;
263 } 327 }
264 328
329
265 slDynamicEntries.append( *it ); 330 slDynamicEntries.append( *it );
266 } 331 }
267 } 332 }
268 333
269 QVBoxLayout *vb = new QVBoxLayout( this ); 334 QVBoxLayout *vb = new QVBoxLayout( this );
270 335
271 tabMain = new QTabWidget( this ); 336 tabMain = new QTabWidget( this );
272 vb->addWidget( tabMain ); 337 vb->addWidget( tabMain );
273 338
274 QWidget *tabViewport = new QWidget ( tabMain ); 339 QWidget *tabViewport = new QWidget ( tabMain );
275 340
276 vb = new QVBoxLayout( tabViewport ); 341 vb = new QVBoxLayout( tabViewport );
277 342
278 svGeneral = new QScrollView( tabViewport ); 343 svGeneral = new QScrollView( tabViewport );
279 vb->addWidget( svGeneral, 0, 0 ); 344 vb->addWidget( svGeneral, 0, 0 );
280 svGeneral->setResizePolicy( QScrollView::AutoOneFit ); 345 svGeneral->setResizePolicy( QScrollView::AutoOneFit );
281 svGeneral->setFrameStyle( QFrame::NoFrame ); 346 svGeneral->setFrameStyle( QFrame::NoFrame );
282 347
283 QWidget *container = new QWidget( svGeneral->viewport() ); 348 QWidget *container = new QWidget( svGeneral->viewport() );
284 svGeneral->addChild( container ); 349 svGeneral->addChild( container );
285 350
286 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); 351 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 );
287 gl->setResizeMode( QLayout::FreeResize ); 352 gl->setResizeMode( QLayout::FreeResize );
288 353
289 btnFullName = new QPushButton( tr( "Full Name..." ), container ); 354 btnFullName = new QPushButton( tr( "Full Name..." ), container );
290 gl->addWidget( btnFullName, 0, 0 ); 355 gl->addWidget( btnFullName, 0, 0 );
291 txtFullName = new QLineEdit( container ); 356 txtFullName = new QLineEdit( container );
292 gl->addWidget( txtFullName, 0, 1 ); 357 gl->addWidget( txtFullName, 0, 1 );
293 358
294 QLabel *l = new QLabel( tr( "Job Title" ), container ); 359 QLabel *l = new QLabel( tr( "Job Title" ), container );
295 gl->addWidget( l, 1, 0 ); 360 gl->addWidget( l, 1, 0 );
296 txtJobTitle = new QLineEdit( container ); 361 txtJobTitle = new QLineEdit( container );
297 gl->addWidget( txtJobTitle, 1, 1 ); 362 gl->addWidget( txtJobTitle, 1, 1 );
298 363
299 l = new QLabel( tr( "Organization" ), container ); 364 l = new QLabel( tr( "Organization" ), container );
300 gl->addWidget( l, 2, 0 ); 365 gl->addWidget( l, 2, 0 );
301 txtOrganization = new QLineEdit( container ); 366 txtOrganization = new QLineEdit( container );
302 gl->addWidget( txtOrganization, 2, 1 ); 367 gl->addWidget( txtOrganization, 2, 1 );
303 368
304 cmbChooserField1 = new QComboBox( FALSE, container ); 369 cmbChooserField1 = new QComboBox( FALSE, container );
305 cmbChooserField1->setMaximumWidth( 90 ); 370 cmbChooserField1->setMaximumWidth( 90 );
306 gl->addWidget( cmbChooserField1, 3, 0 ); 371 gl->addWidget( cmbChooserField1, 3, 0 );
307 txtChooserField1 = new QLineEdit( container ); 372 txtChooserField1 = new QLineEdit( container );
308 gl->addWidget( txtChooserField1, 3, 1 ); 373 gl->addWidget( txtChooserField1, 3, 1 );
309 374
310 cmbChooserField2 = new QComboBox( FALSE, container ); 375 cmbChooserField2 = new QComboBox( FALSE, container );
311 cmbChooserField2->setMaximumWidth( 90 ); 376 cmbChooserField2->setMaximumWidth( 90 );
312 gl->addWidget( cmbChooserField2, 4, 0 ); 377 gl->addWidget( cmbChooserField2, 4, 0 );
313 txtChooserField2 = new QLineEdit( container ); 378 txtChooserField2 = new QLineEdit( container );
314 gl->addWidget( txtChooserField2, 4, 1 ); 379 gl->addWidget( txtChooserField2, 4, 1 );
315 380
316 cmbChooserField3 = new QComboBox( FALSE, container ); 381 cmbChooserField3 = new QComboBox( FALSE, container );
317 cmbChooserField3->setMaximumWidth( 90 ); 382 cmbChooserField3->setMaximumWidth( 90 );
318 gl->addWidget( cmbChooserField3, 5, 0 ); 383 gl->addWidget( cmbChooserField3, 5, 0 );
319 txtChooserField3 = new QLineEdit( container ); 384 txtChooserField3 = new QLineEdit( container );
320 gl->addWidget( txtChooserField3, 5, 1 ); 385 gl->addWidget( txtChooserField3, 5, 1 );
321 386
322 l = new QLabel( tr( "File As" ), container ); 387 l = new QLabel( tr( "File As" ), container );
323 gl->addWidget( l, 6, 0 ); 388 gl->addWidget( l, 6, 0 );
324 cmbFileAs = new QComboBox( TRUE, container ); 389 cmbFileAs = new QComboBox( TRUE, container );
325 gl->addWidget( cmbFileAs, 6, 1 ); 390 gl->addWidget( cmbFileAs, 6, 1 );
326 391
327 l = new QLabel( tr( "Category" ), container ); 392 l = new QLabel( tr( "Category" ), container );
328 gl->addWidget( l, 7, 0 ); 393 gl->addWidget( l, 7, 0 );
329 cmbCat = new CategorySelect( container ); 394 cmbCat = new CategorySelect( container );
330 gl->addWidget( cmbCat, 7, 1 ); 395 gl->addWidget( cmbCat, 7, 1 );
331 396
332 btnNote = new QPushButton( tr( "Notes..." ), container ); 397 btnNote = new QPushButton( tr( "Notes..." ), container );
333 gl->addWidget( btnNote, 8, 1 ); 398 gl->addWidget( btnNote, 8, 1 );
334 399
335 tabMain->insertTab( tabViewport, tr( "General" ) ); 400 tabMain->insertTab( tabViewport, tr( "General" ) );
336 401
337 tabViewport = new QWidget ( tabMain ); 402 tabViewport = new QWidget ( tabMain );
338 403
339 vb = new QVBoxLayout( tabViewport ); 404 vb = new QVBoxLayout( tabViewport );
340 405
341 svAddress = new QScrollView( tabViewport ); 406 svAddress = new QScrollView( tabViewport );
342 vb->addWidget( svAddress, 0, 0 ); 407 vb->addWidget( svAddress, 0, 0 );
343 svAddress->setResizePolicy( QScrollView::AutoOneFit ); 408 svAddress->setResizePolicy( QScrollView::AutoOneFit );
344 svAddress->setFrameStyle( QFrame::NoFrame ); 409 svAddress->setFrameStyle( QFrame::NoFrame );
345 410
346 container = new QWidget( svAddress->viewport() ); 411 container = new QWidget( svAddress->viewport() );
347 svAddress->addChild( container ); 412 svAddress->addChild( container );
348 413
349 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem 414 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem
350 415
351 cmbAddress = new QComboBox( FALSE, container ); 416 cmbAddress = new QComboBox( FALSE, container );
352 cmbAddress->insertItem( tr( "Business" ) ); 417 cmbAddress->insertItem( tr( "Business" ) );
353 cmbAddress->insertItem( tr( "Home" ) ); 418 cmbAddress->insertItem( tr( "Home" ) );
354 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); 419 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 );
355 420
356 l = new QLabel( tr( "Address" ), container ); 421 l = new QLabel( tr( "Address" ), container );
357 gl->addWidget( l, 1, 0 ); 422 gl->addWidget( l, 1, 0 );
358 txtAddress = new QLineEdit( container ); 423 txtAddress = new QLineEdit( container );
359 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); 424 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 );
360/* 425/*
361 l = new QLabel( tr( "Address 2" ), container ); 426 l = new QLabel( tr( "Address 2" ), container );
362 gl->addWidget( l, 2, 0 ); 427 gl->addWidget( l, 2, 0 );
363 txtAddress2 = new QLineEdit( container ); 428 txtAddress2 = new QLineEdit( container );
364 gl->addMultiCellWidget( txtAddress2, 2, 2, 1, 2 ); 429 gl->addMultiCellWidget( txtAddress2, 2, 2, 1, 2 );
365 430
366 l = new QLabel( tr( "P.O. Box" ), container ); 431 l = new QLabel( tr( "P.O. Box" ), container );
367 gl->addWidget( l, 3, 0 ); 432 gl->addWidget( l, 3, 0 );
368 txtPOBox = new QLineEdit( container ); 433 txtPOBox = new QLineEdit( container );
369 gl->addMultiCellWidget( txtPOBox, 3, 3, 1, 2 ); 434 gl->addMultiCellWidget( txtPOBox, 3, 3, 1, 2 );
370*/ 435*/
371 l = new QLabel( tr( "City" ), container ); 436 l = new QLabel( tr( "City" ), container );
372 gl->addWidget( l, 2, 0 ); 437 gl->addWidget( l, 2, 0 );
373 txtCity = new QLineEdit( container ); 438 txtCity = new QLineEdit( container );
374 gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); 439 gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 );
375 440
376 l = new QLabel( tr( "State" ), container ); 441 l = new QLabel( tr( "State" ), container );
377 gl->addWidget( l, 3, 0 ); 442 gl->addWidget( l, 3, 0 );
378 txtState = new QLineEdit( container ); 443 txtState = new QLineEdit( container );
379 gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); 444 gl->addMultiCellWidget( txtState, 3, 3, 1, 2 );
380 445
381 l = new QLabel( tr( "Zip Code" ), container ); 446 l = new QLabel( tr( "Zip Code" ), container );
382 gl->addWidget( l, 4, 0 ); 447 gl->addWidget( l, 4, 0 );
383 txtZip = new QLineEdit( container ); 448 txtZip = new QLineEdit( container );
384 gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); 449 gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 );
385 450
386 l = new QLabel( tr( "Country" ), container ); 451 l = new QLabel( tr( "Country" ), container );
387 gl->addWidget( l, 5, 0 ); 452 gl->addWidget( l, 5, 0 );
388 cmbCountry = new QComboBox( TRUE, container ); 453 cmbCountry = new QComboBox( TRUE, container );
389 cmbCountry->insertItem( tr( "" ) ); 454 cmbCountry->insertItem( tr( "" ) );
390 cmbCountry->insertItem( tr ( "United States" ) ); 455 cmbCountry->insertItem( tr ( "United States" ) );
391 cmbCountry->insertItem( tr ( "United Kingdom" ) ); 456 cmbCountry->insertItem( tr ( "United Kingdom" ) );
392 cmbCountry->insertItem( tr ( "Afganistan" ) ); 457 cmbCountry->insertItem( tr ( "Afganistan" ) );
393 cmbCountry->insertItem( tr ( "Albania" ) ); 458 cmbCountry->insertItem( tr ( "Albania" ) );
394 cmbCountry->insertItem( tr ( "Algeria" ) ); 459 cmbCountry->insertItem( tr ( "Algeria" ) );
395 cmbCountry->insertItem( tr ( "American Samoa" ) ); 460 cmbCountry->insertItem( tr ( "American Samoa" ) );
396 cmbCountry->insertItem( tr ( "Andorra" ) ); 461 cmbCountry->insertItem( tr ( "Andorra" ) );
397 cmbCountry->insertItem( tr ( "Angola" ) ); 462 cmbCountry->insertItem( tr ( "Angola" ) );
398 cmbCountry->insertItem( tr ( "Anguilla" ) ); 463 cmbCountry->insertItem( tr ( "Anguilla" ) );
399 cmbCountry->insertItem( tr ( "Antartica" ) ); 464 cmbCountry->insertItem( tr ( "Antartica" ) );
400 cmbCountry->insertItem( tr ( "Argentina" ) ); 465 cmbCountry->insertItem( tr ( "Argentina" ) );
401 cmbCountry->insertItem( tr ( "Armania" ) ); 466 cmbCountry->insertItem( tr ( "Armania" ) );
402 cmbCountry->insertItem( tr ( "Aruba" ) ); 467 cmbCountry->insertItem( tr ( "Aruba" ) );
403 cmbCountry->insertItem( tr ( "Australia" ) ); 468 cmbCountry->insertItem( tr ( "Australia" ) );
404 cmbCountry->insertItem( tr ( "Austria" ) ); 469 cmbCountry->insertItem( tr ( "Austria" ) );
405 cmbCountry->insertItem( tr ( "Azerbaijan" ) ); 470 cmbCountry->insertItem( tr ( "Azerbaijan" ) );
406 cmbCountry->insertItem( tr ( "Bahamas" ) ); 471 cmbCountry->insertItem( tr ( "Bahamas" ) );
407 cmbCountry->insertItem( tr ( "Bahrain" ) ); 472 cmbCountry->insertItem( tr ( "Bahrain" ) );
408 cmbCountry->insertItem( tr ( "Bangladesh" ) ); 473 cmbCountry->insertItem( tr ( "Bangladesh" ) );
409 cmbCountry->insertItem( tr ( "Barbados" ) ); 474 cmbCountry->insertItem( tr ( "Barbados" ) );
410 cmbCountry->insertItem( tr ( "Belarus" ) ); 475 cmbCountry->insertItem( tr ( "Belarus" ) );
411 cmbCountry->insertItem( tr ( "Belgium" ) ); 476 cmbCountry->insertItem( tr ( "Belgium" ) );
412 cmbCountry->insertItem( tr ( "Belize" ) ); 477 cmbCountry->insertItem( tr ( "Belize" ) );
413 cmbCountry->insertItem( tr ( "Benin" ) ); 478 cmbCountry->insertItem( tr ( "Benin" ) );
414 cmbCountry->insertItem( tr ( "Bermuda" ) ); 479 cmbCountry->insertItem( tr ( "Bermuda" ) );
415 cmbCountry->insertItem( tr ( "Bhutan" ) ); 480 cmbCountry->insertItem( tr ( "Bhutan" ) );
416 cmbCountry->insertItem( tr ( "Boliva" ) ); 481 cmbCountry->insertItem( tr ( "Boliva" ) );
417 cmbCountry->insertItem( tr ( "Botswana" ) ); 482 cmbCountry->insertItem( tr ( "Botswana" ) );
418 cmbCountry->insertItem( tr ( "Bouvet Island" ) ); 483 cmbCountry->insertItem( tr ( "Bouvet Island" ) );
419 cmbCountry->insertItem( tr ( "Brazil" ) ); 484 cmbCountry->insertItem( tr ( "Brazil" ) );
420 cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); 485 cmbCountry->insertItem( tr ( "Brunei Darussalam" ) );
421 cmbCountry->insertItem( tr ( "Bulgaria" ) ); 486 cmbCountry->insertItem( tr ( "Bulgaria" ) );
422 cmbCountry->insertItem( tr ( "Burkina Faso" ) ); 487 cmbCountry->insertItem( tr ( "Burkina Faso" ) );
423 cmbCountry->insertItem( tr ( "Burundi" ) ); 488 cmbCountry->insertItem( tr ( "Burundi" ) );
424 cmbCountry->insertItem( tr ( "Cambodia" ) ); 489 cmbCountry->insertItem( tr ( "Cambodia" ) );
425 cmbCountry->insertItem( tr ( "Camaroon" ) ); 490 cmbCountry->insertItem( tr ( "Camaroon" ) );
426 cmbCountry->insertItem( tr ( "Canada" ) ); 491 cmbCountry->insertItem( tr ( "Canada" ) );
427 cmbCountry->insertItem( tr ( "Cape Verde" ) ); 492 cmbCountry->insertItem( tr ( "Cape Verde" ) );
428 cmbCountry->insertItem( tr ( "Cayman Islands" ) ); 493 cmbCountry->insertItem( tr ( "Cayman Islands" ) );
429 cmbCountry->insertItem( tr ( "Chad" ) ); 494 cmbCountry->insertItem( tr ( "Chad" ) );
430 cmbCountry->insertItem( tr ( "Chile" ) ); 495 cmbCountry->insertItem( tr ( "Chile" ) );
431 cmbCountry->insertItem( tr ( "China" ) ); 496 cmbCountry->insertItem( tr ( "China" ) );
432 cmbCountry->insertItem( tr ( "Christmas Island" ) ); 497 cmbCountry->insertItem( tr ( "Christmas Island" ) );
433 cmbCountry->insertItem( tr ( "Colombia" ) ); 498 cmbCountry->insertItem( tr ( "Colombia" ) );
434 cmbCountry->insertItem( tr ( "Comoros" ) ); 499 cmbCountry->insertItem( tr ( "Comoros" ) );
435 cmbCountry->insertItem( tr ( "Congo" ) ); 500 cmbCountry->insertItem( tr ( "Congo" ) );
436 cmbCountry->insertItem( tr ( "Cook Island" ) ); 501 cmbCountry->insertItem( tr ( "Cook Island" ) );
437 cmbCountry->insertItem( tr ( "Costa Rica" ) ); 502 cmbCountry->insertItem( tr ( "Costa Rica" ) );
438 cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); 503 cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) );
439 cmbCountry->insertItem( tr ( "Croatia" ) ); 504 cmbCountry->insertItem( tr ( "Croatia" ) );
440 cmbCountry->insertItem( tr ( "Cuba" ) ); 505 cmbCountry->insertItem( tr ( "Cuba" ) );
441 cmbCountry->insertItem( tr ( "Cyprus" ) ); 506 cmbCountry->insertItem( tr ( "Cyprus" ) );
442 cmbCountry->insertItem( tr ( "Czech Republic" ) ); 507 cmbCountry->insertItem( tr ( "Czech Republic" ) );
443 cmbCountry->insertItem( tr ( "Denmark" ) ); 508 cmbCountry->insertItem( tr ( "Denmark" ) );
444 cmbCountry->insertItem( tr ( "Djibouti" ) ); 509 cmbCountry->insertItem( tr ( "Djibouti" ) );
445 cmbCountry->insertItem( tr ( "Dominica" ) ); 510 cmbCountry->insertItem( tr ( "Dominica" ) );
446 cmbCountry->insertItem( tr ( "Dominican Republic" ) ); 511 cmbCountry->insertItem( tr ( "Dominican Republic" ) );
447 cmbCountry->insertItem( tr ( "East Timor" ) ); 512 cmbCountry->insertItem( tr ( "East Timor" ) );
448 cmbCountry->insertItem( tr ( "Ecuador" ) ); 513 cmbCountry->insertItem( tr ( "Ecuador" ) );
449 cmbCountry->insertItem( tr ( "Egypt" ) ); 514 cmbCountry->insertItem( tr ( "Egypt" ) );
450 cmbCountry->insertItem( tr ( "El Salvador" ) ); 515 cmbCountry->insertItem( tr ( "El Salvador" ) );
451 cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); 516 cmbCountry->insertItem( tr ( "Equatorial Guinea" ) );
452 cmbCountry->insertItem( tr ( "Eritrea" ) ); 517 cmbCountry->insertItem( tr ( "Eritrea" ) );
453 cmbCountry->insertItem( tr ( "Estonia" ) ); 518 cmbCountry->insertItem( tr ( "Estonia" ) );
454 cmbCountry->insertItem( tr ( "Ethiopia" ) ); 519 cmbCountry->insertItem( tr ( "Ethiopia" ) );
455 cmbCountry->insertItem( tr ( "Falkland Islands" ) ); 520 cmbCountry->insertItem( tr ( "Falkland Islands" ) );
456 cmbCountry->insertItem( tr ( "Faroe Islands" ) ); 521 cmbCountry->insertItem( tr ( "Faroe Islands" ) );
@@ -771,893 +836,922 @@ void ContactEditor::slotChooser1Change( const QString &textChanged ) {
771 836
772void ContactEditor::slotChooser2Change( const QString &textChanged ) { 837void ContactEditor::slotChooser2Change( const QString &textChanged ) {
773 838
774 int index = cmbChooserField2->currentItem(); 839 int index = cmbChooserField2->currentItem();
775 840
776 slChooserValues[index] = textChanged; 841 slChooserValues[index] = textChanged;
777 842
778} 843}
779 844
780void ContactEditor::slotChooser3Change( const QString &textChanged ) { 845void ContactEditor::slotChooser3Change( const QString &textChanged ) {
781 846
782 int index = cmbChooserField3->currentItem(); 847 int index = cmbChooserField3->currentItem();
783 848
784 slChooserValues[index] = textChanged; 849 slChooserValues[index] = textChanged;
785 850
786} 851}
787 852
788void ContactEditor::slotChooser4Change( const QString &textChanged ) { 853void ContactEditor::slotChooser4Change( const QString &textChanged ) {
789 854
790 int index = cmbChooserField4->currentItem(); 855 int index = cmbChooserField4->currentItem();
791 856
792 slChooserValues[index] = textChanged; 857 slChooserValues[index] = textChanged;
793 858
794} 859}
795 860
796void ContactEditor::slotAddressChange( const QString &textChanged ) { 861void ContactEditor::slotAddressChange( const QString &textChanged ) {
797 862
798 if ( cmbAddress->currentItem() == 0 ) { 863 if ( cmbAddress->currentItem() == 0 ) {
799 slBusinessAddress[0] = textChanged; 864 slBusinessAddress[0] = textChanged;
800 } else { 865 } else {
801 slHomeAddress[0] = textChanged; 866 slHomeAddress[0] = textChanged;
802 } 867 }
803} 868}
804 869
805void ContactEditor::slotAddress2Change( const QString &textChanged ) { 870void ContactEditor::slotAddress2Change( const QString &textChanged ) {
806 871
807 if ( cmbAddress->currentItem() == 0 ) { 872 if ( cmbAddress->currentItem() == 0 ) {
808 slBusinessAddress[1] = textChanged; 873 slBusinessAddress[1] = textChanged;
809 } else { 874 } else {
810 slHomeAddress[1] = textChanged; 875 slHomeAddress[1] = textChanged;
811 } 876 }
812} 877}
813 878
814void ContactEditor::slotPOBoxChange( const QString &textChanged ) { 879void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
815 880
816 if ( cmbAddress->currentItem() == 0 ) { 881 if ( cmbAddress->currentItem() == 0 ) {
817 slBusinessAddress[2] = textChanged; 882 slBusinessAddress[2] = textChanged;
818 } else { 883 } else {
819 slHomeAddress[2] = textChanged; 884 slHomeAddress[2] = textChanged;
820 } 885 }
821} 886}
822 887
823void ContactEditor::slotCityChange( const QString &textChanged ) { 888void ContactEditor::slotCityChange( const QString &textChanged ) {
824 889
825 if ( cmbAddress->currentItem() == 0 ) { 890 if ( cmbAddress->currentItem() == 0 ) {
826 slBusinessAddress[3] = textChanged; 891 slBusinessAddress[3] = textChanged;
827 } else { 892 } else {
828 slHomeAddress[3] = textChanged; 893 slHomeAddress[3] = textChanged;
829 } 894 }
830} 895}
831 896
832void ContactEditor::slotStateChange( const QString &textChanged ) { 897void ContactEditor::slotStateChange( const QString &textChanged ) {
833 898
834 899
835 if ( cmbAddress->currentItem() == 0 ) { 900 if ( cmbAddress->currentItem() == 0 ) {
836 slBusinessAddress[4] = textChanged; 901 slBusinessAddress[4] = textChanged;
837 } else { 902 } else {
838 slHomeAddress[4] = textChanged; 903 slHomeAddress[4] = textChanged;
839 } 904 }
840} 905}
841 906
842void ContactEditor::slotZipChange( const QString &textChanged ) { 907void ContactEditor::slotZipChange( const QString &textChanged ) {
843 908
844 if ( cmbAddress->currentItem() == 0 ) { 909 if ( cmbAddress->currentItem() == 0 ) {
845 slBusinessAddress[5] = textChanged; 910 slBusinessAddress[5] = textChanged;
846 } else { 911 } else {
847 slHomeAddress[5] = textChanged; 912 slHomeAddress[5] = textChanged;
848 } 913 }
849} 914}
850 915
851void ContactEditor::slotCountryChange( const QString &textChanged ) { 916void ContactEditor::slotCountryChange( const QString &textChanged ) {
852 917
853 if ( cmbAddress->currentItem() == 0 ) { 918 if ( cmbAddress->currentItem() == 0 ) {
854 slBusinessAddress[6] = textChanged; 919 slBusinessAddress[6] = textChanged;
855 } else { 920 } else {
856 slHomeAddress[6] = textChanged; 921 slHomeAddress[6] = textChanged;
857 } 922 }
858} 923}
859 924
860void ContactEditor::slotCmbChooser1Change( int index ) { 925void ContactEditor::slotCmbChooser1Change( int index ) {
861 926
862 txtChooserField1->setText( slChooserValues[index] ); 927 txtChooserField1->setText( slChooserValues[index] );
863 txtChooserField1->setFocus(); 928 txtChooserField1->setFocus();
864} 929}
865 930
866void ContactEditor::slotCmbChooser2Change( int index ) { 931void ContactEditor::slotCmbChooser2Change( int index ) {
867 932
868 txtChooserField2->setText( slChooserValues[index] ); 933 txtChooserField2->setText( slChooserValues[index] );
869 txtChooserField2->setFocus(); 934 txtChooserField2->setFocus();
870} 935}
871 936
872void ContactEditor::slotCmbChooser3Change( int index ) { 937void ContactEditor::slotCmbChooser3Change( int index ) {
873 938
874 txtChooserField3->setText( slChooserValues[index] ); 939 txtChooserField3->setText( slChooserValues[index] );
875 txtChooserField3->setFocus(); 940 txtChooserField3->setFocus();
876 941
877} 942}
878 943
879void ContactEditor::slotCmbChooser4Change( int index ) { 944void ContactEditor::slotCmbChooser4Change( int index ) {
880 945
881 txtChooserField4->setText( slChooserValues[index] ); 946 txtChooserField4->setText( slChooserValues[index] );
882 txtChooserField4->setFocus(); 947 txtChooserField4->setFocus();
883 948
884} 949}
885 950
886void ContactEditor::slotAddressTypeChange( int index ) { 951void ContactEditor::slotAddressTypeChange( int index ) {
887 952
888 if ( index == 0 ) { 953 if ( index == 0 ) {
889 954
890 txtAddress->setText( slBusinessAddress[0] ); 955 txtAddress->setText( slBusinessAddress[0] );
891 //txtAddress2->setText( (*slBusinessAddress)[1] ); 956 //txtAddress2->setText( (*slBusinessAddress)[1] );
892 //txtPOBox->setText( (*slBusinessAddress)[2] ); 957 //txtPOBox->setText( (*slBusinessAddress)[2] );
893 txtCity->setText( slBusinessAddress[3] ); 958 txtCity->setText( slBusinessAddress[3] );
894 txtState->setText( slBusinessAddress[4] ); 959 txtState->setText( slBusinessAddress[4] );
895 txtZip->setText( slBusinessAddress[5] ); 960 txtZip->setText( slBusinessAddress[5] );
896 QLineEdit *txtTmp = cmbCountry->lineEdit(); 961 QLineEdit *txtTmp = cmbCountry->lineEdit();
897 txtTmp->setText( slBusinessAddress[6] ); 962 txtTmp->setText( slBusinessAddress[6] );
898 963
899 } else { 964 } else {
900 965
901 txtAddress->setText( slHomeAddress[0] ); 966 txtAddress->setText( slHomeAddress[0] );
902 //txtAddress2->setText( (*slHomeAddress)[1] ); 967 //txtAddress2->setText( (*slHomeAddress)[1] );
903 //txtPOBox->setText( (*slHomeAddress)[2] ); 968 //txtPOBox->setText( (*slHomeAddress)[2] );
904 txtCity->setText( slHomeAddress[3] ); 969 txtCity->setText( slHomeAddress[3] );
905 txtState->setText( slHomeAddress[4] ); 970 txtState->setText( slHomeAddress[4] );
906 txtZip->setText( slHomeAddress[5] ); 971 txtZip->setText( slHomeAddress[5] );
907 QLineEdit *txtTmp = cmbCountry->lineEdit(); 972 QLineEdit *txtTmp = cmbCountry->lineEdit();
908 txtTmp->setText( slHomeAddress[6] ); 973 txtTmp->setText( slHomeAddress[6] );
909 974
910 } 975 }
911 976
912} 977}
913 978
914void ContactEditor::slotFullNameChange( const QString &textChanged ) { 979void ContactEditor::slotFullNameChange( const QString &textChanged ) {
915 980
916 int index = cmbFileAs->currentItem(); 981 int index = cmbFileAs->currentItem();
917 982
918 cmbFileAs->clear(); 983 cmbFileAs->clear();
919 984
920 cmbFileAs->insertItem( parseName( textChanged, 0 ) ); 985 cmbFileAs->insertItem( parseName( textChanged, 0 ) );
921 cmbFileAs->insertItem( parseName( textChanged, 1 ) ); 986 cmbFileAs->insertItem( parseName( textChanged, 1 ) );
922 cmbFileAs->insertItem( parseName( textChanged, 2 ) ); 987 cmbFileAs->insertItem( parseName( textChanged, 2 ) );
923 cmbFileAs->insertItem( parseName( textChanged, 3 ) ); 988 cmbFileAs->insertItem( parseName( textChanged, 3 ) );
924 989
925 cmbFileAs->setCurrentItem( index ); 990 cmbFileAs->setCurrentItem( index );
926 991
927 useFullName = TRUE; 992 useFullName = TRUE;
928 993
929} 994}
930 995
931void ContactEditor::loadFields() { 996void ContactEditor::loadFields() {
932 997
933 QStringList::ConstIterator it; 998 QStringList::ConstIterator it;
934 QListIterator<QLabel> lit( listName ); 999 QListIterator<QLabel> lit( listName );
935 for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) { 1000 for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) {
936 (*lit)->setText( *it ); 1001 (*lit)->setText( *it );
937 } 1002 }
938} 1003}
939 1004
940void ContactEditor::accept() { 1005void ContactEditor::accept() {
941 1006
942 if ( isEmpty() ) { 1007 if ( isEmpty() ) {
943 cleanupFields(); 1008 cleanupFields();
944 reject(); 1009 reject();
945 } else { 1010 } else {
946 saveEntry(); 1011 saveEntry();
947 cleanupFields(); 1012 cleanupFields();
948 QDialog::accept(); 1013 QDialog::accept();
949 } 1014 }
950 1015
951} 1016}
952 1017
953void ContactEditor::slotNote() { 1018void ContactEditor::slotNote() {
954 1019
955 dlgNote->showMaximized(); 1020 dlgNote->showMaximized();
956 if ( !dlgNote->exec() ) { 1021 if ( !dlgNote->exec() ) {
957 txtNote->setText( ent.notes() ); 1022 txtNote->setText( ent.notes() );
958 } 1023 }
959} 1024}
960 1025
961void ContactEditor::slotName() { 1026void ContactEditor::slotName() {
962 1027
963 if (useFullName = TRUE) { 1028 QString tmpName;
1029 if (useFullName == TRUE) {
964 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); 1030 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) );
965 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); 1031 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) );
966 txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); 1032 txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
967 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); 1033 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
968 } 1034 }
969
970 dlgName->showMaximized(); 1035 dlgName->showMaximized();
971 if ( dlgName->exec() ) { 1036 if ( dlgName->exec() ) {
972 txtFullName->setText( txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text() ); 1037
1038 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text();
1039 txtFullName->setText( tmpName.simplifyWhiteSpace() );
973 slotFullNameChange( txtFullName->text() ); 1040 slotFullNameChange( txtFullName->text() );
974 useFullName = FALSE; 1041 useFullName = FALSE;
975 } 1042 }
976 1043
977} 1044}
978 1045
979void ContactEditor::setNameFocus() { 1046void ContactEditor::setNameFocus() {
980 1047
981 txtFullName->setFocus(); 1048 txtFullName->setFocus();
982 1049
983} 1050}
984 1051
985bool ContactEditor::isEmpty() { 1052bool ContactEditor::isEmpty() {
986 // Test and see if the record should be saved. 1053 // Test and see if the record should be saved.
987 // 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
988 1055
989 QString t = txtFullName->text(); 1056 QString t = txtFullName->text();
990 if ( !t.isEmpty() && containsAlphaNum( t ) ) 1057 if ( !t.isEmpty() && containsAlphaNum( t ) )
991 return false; 1058 return false;
992 1059
993 t = cmbFileAs->currentText(); 1060 t = cmbFileAs->currentText();
994 if ( !t.isEmpty() && containsAlphaNum( t ) ) 1061 if ( !t.isEmpty() && containsAlphaNum( t ) )
995 return false; 1062 return false;
996 1063
997 return true; 1064 return true;
998 1065
999} 1066}
1000 1067
1001QString ContactEditor::parseName( const QString fullName, int type ) { 1068QString ContactEditor::parseName( const QString fullName, int type ) {
1002 1069
1003 QString simplifiedName( fullName.simplifyWhiteSpace() ); 1070 QString simplifiedName( fullName.simplifyWhiteSpace() );
1004 QString strFirstName; 1071 QString strFirstName;
1005 QString strMiddleName; 1072 QString strMiddleName;
1006 QString strLastName; 1073 QString strLastName;
1007 QString strSuffix; 1074 QString strSuffix;
1008 QString strTitle; 1075 QString strTitle;
1009 int commapos; 1076 int commapos;
1010 int spCount; 1077 int spCount;
1011 int spPos; 1078 int spPos;
1012 int spPos2; 1079 int spPos2;
1013 1080
1014 1081
1015 commapos = simplifiedName.find( ',', 0, TRUE); 1082 commapos = simplifiedName.find( ',', 0, TRUE);
1016 spCount = simplifiedName.contains( ' ', TRUE ); 1083 spCount = simplifiedName.contains( ' ', TRUE );
1017 1084
1018 if ( commapos == -1 ) { 1085 if ( commapos == -1 ) {
1019 1086
1020 switch (spCount) { 1087 switch (spCount) {
1021 case 0: 1088 case 0:
1022 return simplifiedName; 1089 //return simplifiedName;
1090 if (txtLastName->text() != "") {
1091 strLastName = simplifiedName;
1092 break;
1093 }
1094 if (txtMiddleName->text() != "") {
1095 strMiddleName = simplifiedName;
1096 break;
1097 }
1098 if (txtSuffix->text() != "") {
1099 strSuffix = simplifiedName;
1100 break;
1101 }
1102 strFirstName = simplifiedName;
1103 break;
1023 1104
1024 case 1: 1105 case 1:
1025 spPos = simplifiedName.find( ' ', 0, TRUE ); 1106 spPos = simplifiedName.find( ' ', 0, TRUE );
1026 strFirstName = simplifiedName.left( spPos ); 1107 strFirstName = simplifiedName.left( spPos );
1027 strLastName = simplifiedName.mid( spPos + 1 ); 1108 strLastName = simplifiedName.mid( spPos + 1 );
1028 break; 1109 break;
1029 1110
1030 case 2: 1111 case 2:
1031 spPos = simplifiedName.find( ' ', 0, TRUE ); 1112 spPos = simplifiedName.find( ' ', 0, TRUE );
1032 strFirstName = simplifiedName.left( spPos ); 1113 strFirstName = simplifiedName.left( spPos );
1033 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1114 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1034 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1115 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1035 strLastName = simplifiedName.mid( spPos2 + 1 ); 1116 strLastName = simplifiedName.mid( spPos2 + 1 );
1036 break; 1117 break;
1037 1118
1038 case 3: 1119 case 3:
1039 spPos = simplifiedName.find( ' ', 0, TRUE ); 1120 spPos = simplifiedName.find( ' ', 0, TRUE );
1040 strFirstName = simplifiedName.left( spPos ); 1121 strFirstName = simplifiedName.left( spPos );
1041 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1122 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1042 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1123 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1043 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1124 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1044 strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1125 strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1045 strSuffix = simplifiedName.mid( spPos + 1 ); 1126 strSuffix = simplifiedName.mid( spPos + 1 );
1046 break; 1127 break;
1047 1128
1048 case 4: 1129 case 4:
1049 spPos = simplifiedName.find( ' ', 0, TRUE ); 1130 spPos = simplifiedName.find( ' ', 0, TRUE );
1050 strTitle = simplifiedName.left( spPos ); 1131 strTitle = simplifiedName.left( spPos );
1051 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1132 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1052 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1133 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1053 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1134 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1054 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1135 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1055 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1136 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1056 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1137 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1057 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1138 strSuffix = simplifiedName.mid( spPos2 + 1 );
1058 break; 1139 break;
1059 1140
1060 default: 1141 default:
1061 spPos = simplifiedName.find( ' ', 0, TRUE ); 1142 spPos = simplifiedName.find( ' ', 0, TRUE );
1062 strTitle = simplifiedName.left( spPos ); 1143 strTitle = simplifiedName.left( spPos );
1063 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1144 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1064 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1145 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1065 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1146 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1066 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1147 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1067 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1148 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1068 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1149 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1069 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1150 strSuffix = simplifiedName.mid( spPos2 + 1 );
1070 break; 1151 break;
1071 } 1152 }
1072 } else { 1153 } else {
1073 simplifiedName.replace( commapos, 1, " " ); 1154 simplifiedName.replace( commapos, 1, " " );
1074 simplifiedName = simplifiedName.simplifyWhiteSpace(); 1155 simplifiedName = simplifiedName.simplifyWhiteSpace();
1075 1156
1076 switch (spCount) { 1157 switch (spCount) {
1077 case 0: 1158 case 0:
1078 return simplifiedName; 1159 //return simplifiedName;
1160 if (txtLastName->text() != "") {
1161 strLastName = simplifiedName;
1162 break;
1163 }
1164 if (txtMiddleName->text() != "") {
1165 strMiddleName = simplifiedName;
1166 break;
1167 }
1168 if (txtSuffix->text() != "") {
1169 strSuffix = simplifiedName;
1170 break;
1171 }
1172 strFirstName = simplifiedName;
1173 break;
1079 1174
1080 case 1: 1175 case 1:
1081 spPos = simplifiedName.find( ' ', 0, TRUE ); 1176 spPos = simplifiedName.find( ' ', 0, TRUE );
1082 strLastName = simplifiedName.left( spPos ); 1177 strLastName = simplifiedName.left( spPos );
1083 strFirstName = simplifiedName.mid( spPos + 1 ); 1178 strFirstName = simplifiedName.mid( spPos + 1 );
1084 break; 1179 break;
1085 1180
1086 case 2: 1181 case 2:
1087 spPos = simplifiedName.find( ' ', 0, TRUE ); 1182 spPos = simplifiedName.find( ' ', 0, TRUE );
1088 strLastName = simplifiedName.left( spPos ); 1183 strLastName = simplifiedName.left( spPos );
1089 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1184 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1090 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1185 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1091 strMiddleName = simplifiedName.mid( spPos2 + 1 ); 1186 strMiddleName = simplifiedName.mid( spPos2 + 1 );
1092 break; 1187 break;
1093 1188
1094 case 3: 1189 case 3:
1095 spPos = simplifiedName.find( ' ', 0, TRUE ); 1190 spPos = simplifiedName.find( ' ', 0, TRUE );
1096 strLastName = simplifiedName.left( spPos ); 1191 strLastName = simplifiedName.left( spPos );
1097 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1192 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1098 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1193 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1099 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1194 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1100 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1195 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1101 strSuffix = simplifiedName.mid( spPos + 1 ); 1196 strSuffix = simplifiedName.mid( spPos + 1 );
1102 break; 1197 break;
1103 1198
1104 case 4: 1199 case 4:
1105 spPos = simplifiedName.find( ' ', 0, TRUE ); 1200 spPos = simplifiedName.find( ' ', 0, TRUE );
1106 strLastName = simplifiedName.left( spPos ); 1201 strLastName = simplifiedName.left( spPos );
1107 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1202 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1108 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1203 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1109 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1204 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1110 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1205 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1111 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1206 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1112 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1207 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1113 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1208 strSuffix = simplifiedName.mid( spPos2 + 1 );
1114 break; 1209 break;
1115 1210
1116 default: 1211 default:
1117 spPos = simplifiedName.find( ' ', 0, TRUE ); 1212 spPos = simplifiedName.find( ' ', 0, TRUE );
1118 strLastName = simplifiedName.left( spPos ); 1213 strLastName = simplifiedName.left( spPos );
1119 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1214 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1120 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1215 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1121 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1216 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1122 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); 1217 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos );
1123 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1218 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1124 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1219 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1125 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1220 strSuffix = simplifiedName.mid( spPos2 + 1 );
1126 break; 1221 break;
1127 } 1222 }
1128 } 1223 }
1129
1130 switch (type) { 1224 switch (type) {
1131 case NAME_FL: 1225 case NAME_FL:
1132 return strFirstName + " " + strLastName; 1226 return strFirstName + " " + strLastName;
1133 1227
1134 case NAME_LF: 1228 case NAME_LF:
1135 return strLastName + ", " + strFirstName; 1229 return strLastName + ", " + strFirstName;
1136 1230
1137 case NAME_LFM: 1231 case NAME_LFM:
1138 return strLastName + ", " + strFirstName + " " + strMiddleName; 1232 return strLastName + ", " + strFirstName + " " + strMiddleName;
1139 1233
1140 case NAME_FMLS: 1234 case NAME_FMLS:
1141 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; 1235 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix;
1142 1236
1143 case NAME_F: 1237 case NAME_F:
1144 return strFirstName; 1238 return strFirstName;
1145 1239
1146 case NAME_M: 1240 case NAME_M:
1147 return strMiddleName; 1241 return strMiddleName;
1148 1242
1149 case NAME_L: 1243 case NAME_L:
1150 return strLastName; 1244 return strLastName;
1151 1245
1152 case NAME_S: 1246 case NAME_S:
1153 return strSuffix; 1247 return strSuffix;
1154 1248
1155 } 1249 }
1156 return QString::null; 1250 return QString::null;
1157} 1251}
1158 1252
1159void ContactEditor::cleanupFields() { 1253void ContactEditor::cleanupFields() {
1160 1254
1161 QStringList::Iterator it = slChooserValues.begin(); 1255 QStringList::Iterator it = slChooserValues.begin();
1162 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { 1256 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) {
1163 (*it) = ""; 1257 (*it) = "";
1164 } 1258 }
1165 1259
1166 for ( int i = 0; i < 7; i++ ) { 1260 for ( int i = 0; i < 7; i++ ) {
1167 slHomeAddress[i] = ""; 1261 slHomeAddress[i] = "";
1168 slBusinessAddress[i] = ""; 1262 slBusinessAddress[i] = "";
1169 } 1263 }
1170 1264
1171 QStringList::ConstIterator cit; 1265 QStringList::ConstIterator cit;
1172 QListIterator<QLineEdit> itLE( listValue ); 1266 QListIterator<QLineEdit> itLE( listValue );
1173 for ( cit = slDynamicEntries.begin(); cit != slDynamicEntries.end(); ++cit, ++itLE) { 1267 for ( cit = slDynamicEntries.begin(); cit != slDynamicEntries.end(); ++cit, ++itLE) {
1174 (*itLE)->setText( "" ); 1268 (*itLE)->setText( "" );
1175 } 1269 }
1176 1270
1177 txtFirstName->setText(""); 1271 txtFirstName->setText("");
1178 txtMiddleName->setText(""); 1272 txtMiddleName->setText("");
1179 txtLastName->setText(""); 1273 txtLastName->setText("");
1180 txtSuffix->setText(""); 1274 txtSuffix->setText("");
1181 txtNote->setText(""); 1275 txtNote->setText("");
1182 txtFullName->setText(""); 1276 txtFullName->setText("");
1183 txtJobTitle->setText(""); 1277 txtJobTitle->setText("");
1184 txtOrganization->setText(""); 1278 txtOrganization->setText("");
1185 txtChooserField1->setText(""); 1279 txtChooserField1->setText("");
1186 txtChooserField2->setText(""); 1280 txtChooserField2->setText("");
1187 txtChooserField3->setText(""); 1281 txtChooserField3->setText("");
1188 txtAddress->setText(""); 1282 txtAddress->setText("");
1189 //txtAddress2->setText(""); 1283 //txtAddress2->setText("");
1190 txtCity->setText(""); 1284 txtCity->setText("");
1191 //txtPOBox->setText(""); 1285 //txtPOBox->setText("");
1192 txtState->setText(""); 1286 txtState->setText("");
1193 txtZip->setText(""); 1287 txtZip->setText("");
1194 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1288 QLineEdit *txtTmp = cmbCountry->lineEdit();
1195 txtTmp->setText(""); 1289 txtTmp->setText("");
1196 txtTmp = cmbFileAs->lineEdit(); 1290 txtTmp = cmbFileAs->lineEdit();
1197 txtTmp->setText(""); 1291 txtTmp->setText("");
1198 1292
1199} 1293}
1200 1294
1201void ContactEditor::setEntry( const Contact &entry ) { 1295void ContactEditor::setEntry( const Contact &entry ) {
1202 1296
1203 cleanupFields(); 1297 cleanupFields();
1204 1298
1205 1299
1206 ent = entry; 1300 ent = entry;
1207 1301
1208 useFullName = FALSE; 1302 useFullName = FALSE;
1209 txtFirstName->setText( ent.firstName() ); 1303 txtFirstName->setText( ent.firstName() );
1210 txtMiddleName->setText( ent.middleName() ); 1304 txtMiddleName->setText( ent.middleName() );
1211 txtLastName->setText( ent.lastName() ); 1305 txtLastName->setText( ent.lastName() );
1212 txtSuffix->setText( ent.suffix() ); 1306 txtSuffix->setText( ent.suffix() );
1213 1307
1214 QString *tmpString = new QString; 1308 QString *tmpString = new QString;
1215 *tmpString = ent.firstName() + " " + ent.middleName() + 1309 *tmpString = ent.firstName() + " " + ent.middleName() +
1216 + " " + ent.lastName() + " " + ent.suffix(); 1310 + " " + ent.lastName() + " " + ent.suffix();
1217 1311
1218 txtFullName->setText( tmpString->simplifyWhiteSpace() ); 1312 txtFullName->setText( tmpString->simplifyWhiteSpace() );
1219 1313
1220 cmbFileAs->setEditText( ent.fileAs() ); 1314 cmbFileAs->setEditText( ent.fileAs() );
1221 1315
1222 if (hasTitle) 1316 if (hasTitle)
1223 txtJobTitle->setText( ent.jobTitle() ); 1317 txtJobTitle->setText( ent.jobTitle() );
1224 1318
1225 if (hasCompany) 1319 if (hasCompany)
1226 txtOrganization->setText( ent.company() ); 1320 txtOrganization->setText( ent.company() );
1227 1321
1228 if (hasNotes) 1322 if (hasNotes)
1229 txtNote->setText( ent.notes() ); 1323 txtNote->setText( ent.notes() );
1230 1324
1231 if (hasStreet) { 1325 if (hasStreet) {
1232 slHomeAddress[0] = ent.homeStreet(); 1326 slHomeAddress[0] = ent.homeStreet();
1233 slBusinessAddress[0] = ent.businessStreet(); 1327 slBusinessAddress[0] = ent.businessStreet();
1234 } 1328 }
1235/* 1329/*
1236 if (hasStreet2) { 1330 if (hasStreet2) {
1237 (*slHomeAddress)[1] = ent.homeStreet2(); 1331 (*slHomeAddress)[1] = ent.homeStreet2();
1238 (*slBusinessAddress)[1] = ent.businessStreet2(); 1332 (*slBusinessAddress)[1] = ent.businessStreet2();
1239 } 1333 }
1240 1334
1241 if (hasPOBox) { 1335 if (hasPOBox) {
1242 (*slHomeAddress)[2] = ent.homePOBox(); 1336 (*slHomeAddress)[2] = ent.homePOBox();
1243 (*slBusinessAddress)[2] = ent.businessPOBox(); 1337 (*slBusinessAddress)[2] = ent.businessPOBox();
1244 } 1338 }
1245*/ 1339*/
1246 if (hasCity) { 1340 if (hasCity) {
1247 slHomeAddress[3] = ent.homeCity(); 1341 slHomeAddress[3] = ent.homeCity();
1248 slBusinessAddress[3] = ent.businessCity(); 1342 slBusinessAddress[3] = ent.businessCity();
1249 } 1343 }
1250 1344
1251 if (hasState) { 1345 if (hasState) {
1252 slHomeAddress[4] = ent.homeState(); 1346 slHomeAddress[4] = ent.homeState();
1253 slBusinessAddress[4] = ent.businessState(); 1347 slBusinessAddress[4] = ent.businessState();
1254 } 1348 }
1255 1349
1256 if (hasZip) { 1350 if (hasZip) {
1257 slHomeAddress[5] = ent.homeZip(); 1351 slHomeAddress[5] = ent.homeZip();
1258 slBusinessAddress[5] = ent.businessZip(); 1352 slBusinessAddress[5] = ent.businessZip();
1259 } 1353 }
1260 1354
1261 if (hasCountry) { 1355 if (hasCountry) {
1262 slHomeAddress[6] = ent.homeCountry(); 1356 slHomeAddress[6] = ent.homeCountry();
1263 slBusinessAddress[6] = ent.businessCountry(); 1357 slBusinessAddress[6] = ent.businessCountry();
1264 } 1358 }
1265 1359
1266 QStringList::ConstIterator it; 1360 QStringList::ConstIterator it;
1267 QListIterator<QLineEdit> itLE( listValue ); 1361 QListIterator<QLineEdit> itLE( listValue );
1268 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { 1362 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) {
1269 if ( *it == "Department" ) 1363 if ( *it == tr("Department") )
1270 (*itLE)->setText( ent.department() ); 1364 (*itLE)->setText( ent.department() );
1271 1365
1272 if ( *it == "Company" ) 1366 if ( *it == tr("Company" ))
1273 (*itLE)->setText( ent.company() ); 1367 (*itLE)->setText( ent.company() );
1274 1368
1275 if ( *it == "Office" ) 1369 if ( *it == tr("Office" ))
1276 (*itLE)->setText( ent.office() ); 1370 (*itLE)->setText( ent.office() );
1277 1371
1278 if ( *it == "Profession" ) 1372 if ( *it == tr("Profession" ))
1279 (*itLE)->setText( ent.profession() ); 1373 (*itLE)->setText( ent.profession() );
1280 1374
1281 if ( *it == "Assistant" ) 1375 if ( *it == tr("Assistant" ))
1282 (*itLE)->setText( ent.assistant() ); 1376 (*itLE)->setText( ent.assistant() );
1283 1377
1284 if ( *it == "Manager" ) 1378 if ( *it == tr("Manager" ))
1285 (*itLE)->setText( ent.manager() ); 1379 (*itLE)->setText( ent.manager() );
1286 1380
1287 if ( *it == "Spouse" ) 1381 if ( *it == tr("Spouse" ))
1288 (*itLE)->setText( ent.spouse() ); 1382 (*itLE)->setText( ent.spouse() );
1289 1383
1290 if ( *it == "Birthday" ) 1384 if ( *it == tr("Birthday" ))
1291 (*itLE)->setText( ent.birthday() ); 1385 (*itLE)->setText( ent.birthday() );
1292 1386
1293 if ( *it == "Anniversary" ) 1387 if ( *it == tr("Anniversary" ))
1294 (*itLE)->setText( ent.anniversary() ); 1388 (*itLE)->setText( ent.anniversary() );
1295 1389
1296 if ( *it == "Nickname" ) 1390 if ( *it == tr("Nickname" ))
1297 (*itLE)->setText( ent.nickname() ); 1391 (*itLE)->setText( ent.nickname() );
1298 1392
1299 if ( *it == "Children" ) 1393 if ( *it == tr("Children" ))
1300 (*itLE)->setText( ent.children() ); 1394 (*itLE)->setText( ent.children() );
1301 1395
1302 } 1396 }
1303 1397
1304 QStringList::Iterator itV; 1398 QStringList::Iterator itV;
1305 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 ) {
1306 1400
1307 if ( *it == "Business Phone" || *it == "Work Phone" ) 1401 if ( *it == tr("Business Phone") || *it == tr("Work Phone" ))
1308 *itV = ent.businessPhone(); 1402 *itV = ent.businessPhone();
1309/* 1403/*
1310 if ( *it == "Business 2 Phone" ) 1404 if ( *it == "Business 2 Phone" )
1311 *itV = ent.business2Phone(); 1405 *itV = ent.business2Phone();
1312*/ 1406*/
1313 if ( *it == "Business Fax" || *it == "Work Fax" ) 1407 if ( *it == tr("Business Fax") || *it == tr("Work Fax" ))
1314 *itV = ent.businessFax(); 1408 *itV = ent.businessFax();
1315 1409
1316 if ( *it == "Business Mobile" || *it == "work Mobile" ) 1410 if ( *it == tr("Business Mobile") || *it == tr("work Mobile" ))
1317 *itV = ent.businessMobile(); 1411 *itV = ent.businessMobile();
1318/* 1412/*
1319 if ( *it == "Company Phone" ) 1413 if ( *it == "Company Phone" )
1320 *itV = ent.companyPhone(); 1414 *itV = ent.companyPhone();
1321*/ 1415*/
1322 if ( *it == "Default Email" ) 1416 if ( *it == tr("Default Email" ))
1323 *itV = ent.defaultEmail(); 1417 *itV = ent.defaultEmail();
1324 1418
1325 if ( *it == "Emails" ) 1419 if ( *it == tr("Emails" ))
1326 *itV = ent.emails(); 1420 *itV = ent.emails();
1327 1421
1328 if ( *it == "Home Phone" ) 1422 if ( *it == tr("Home Phone" ))
1329 *itV = ent.homePhone(); 1423 *itV = ent.homePhone();
1330/* 1424/*
1331 if ( *it == "Home 2 Phone" ) 1425 if ( *it == "Home 2 Phone" )
1332 *itV = ent.home2Phone(); 1426 *itV = ent.home2Phone();
1333*/ 1427*/
1334 if ( *it == "Home Fax" ) 1428 if ( *it == tr("Home Fax" ))
1335 *itV = ent.homeFax(); 1429 *itV = ent.homeFax();
1336 1430
1337 if ( *it == "Home Mobile" ) 1431 if ( *it == tr("Home Mobile" ))
1338 *itV = ent.homeMobile(); 1432 *itV = ent.homeMobile();
1339/* 1433/*
1340 if ( *it == "Car Phone" ) 1434 if ( *it == "Car Phone" )
1341 *itV = ent.carPhone(); 1435 *itV = ent.carPhone();
1342 1436
1343 if ( *it == "ISDN Phone" ) 1437 if ( *it == "ISDN Phone" )
1344 *itV = ent.ISDNPhone(); 1438 *itV = ent.ISDNPhone();
1345 1439
1346 if ( *it == "Other Phone" ) 1440 if ( *it == "Other Phone" )
1347 *itV = ent.otherPhone(); 1441 *itV = ent.otherPhone();
1348*/ 1442*/
1349 if ( *it == "Business Pager" || *it == "Work Pager" ) 1443 if ( *it == tr("Business Pager") || *it == tr("Work Pager" ))
1350 *itV = ent.businessPager(); 1444 *itV = ent.businessPager();
1351/* 1445/*
1352 if ( *it == "Home Pager") 1446 if ( *it == "Home Pager")
1353 *itV = ent.homePager(); 1447 *itV = ent.homePager();
1354 1448
1355 if ( *it == "AIM IM" ) 1449 if ( *it == "AIM IM" )
1356 *itV = ent.AIMIM(); 1450 *itV = ent.AIMIM();
1357 1451
1358 if ( *it == "ICQ IM" ) 1452 if ( *it == "ICQ IM" )
1359 *itV = ent.ICQIM(); 1453 *itV = ent.ICQIM();
1360 1454
1361 if ( *it == "Jabber IM" ) 1455 if ( *it == "Jabber IM" )
1362 *itV = ent.jabberIM(); 1456 *itV = ent.jabberIM();
1363 1457
1364 if ( *it == "MSN IM" ) 1458 if ( *it == "MSN IM" )
1365 *itV = ent.MSNIM(); 1459 *itV = ent.MSNIM();
1366 1460
1367 if ( *it == "Yahoo IM" ) 1461 if ( *it == "Yahoo IM" )
1368 *itV = ent.yahooIM(); 1462 *itV = ent.yahooIM();
1369*/ 1463*/
1370 if ( *it == "Home Web Page" ) 1464 if ( *it == tr("Home Web Page") )
1371 *itV = ent.homeWebpage(); 1465 *itV = ent.homeWebpage();
1372 if ( *it == "Business Web Page" || *it == "Work Web Page" ) 1466 if ( *it == tr("Business WebPage") || *it == tr("Work Web Page") )
1373 *itV = ent.businessWebpage(); 1467 *itV = ent.businessWebpage();
1374 1468
1375 1469
1376 } 1470 }
1377 1471
1378 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); 1472 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") );
1379 1473
1380 QString gender = ent.gender(); 1474 QString gender = ent.gender();
1381 cmbGender->setCurrentItem( gender.toInt() ); 1475 cmbGender->setCurrentItem( gender.toInt() );
1382 1476
1383 txtNote->setText( ent.notes() ); 1477 txtNote->setText( ent.notes() );
1384 1478
1385 slotCmbChooser1Change( cmbChooserField1->currentItem() ); 1479 slotCmbChooser1Change( cmbChooserField1->currentItem() );
1386 slotCmbChooser2Change( cmbChooserField2->currentItem() ); 1480 slotCmbChooser2Change( cmbChooserField2->currentItem() );
1387 slotCmbChooser3Change( cmbChooserField3->currentItem() ); 1481 slotCmbChooser3Change( cmbChooserField3->currentItem() );
1388 1482
1389 slotAddressTypeChange( cmbAddress->currentItem() ); 1483 slotAddressTypeChange( cmbAddress->currentItem() );
1390 1484
1391} 1485}
1392 1486
1393void ContactEditor::saveEntry() { 1487void ContactEditor::saveEntry() {
1394 1488
1395 if ( useFullName == TRUE ) { 1489 if ( useFullName == TRUE ) {
1396 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); 1490 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) );
1397 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); 1491 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) );
1398 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); 1492 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
1399 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); 1493 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
1400 1494
1401 useFullName = FALSE; 1495 useFullName = FALSE;
1402 } 1496 }
1403 1497
1404 /*if ( ent.firstName() != txtFirstName->text() || 1498 /*if ( ent.firstName() != txtFirstName->text() ||
1405 ent.lastName != txtLastName->text() || 1499 ent.lastName != txtLastName->text() ||
1406 ent.middleName != txtMiddleName->text() ) { 1500 ent.middleName != txtMiddleName->text() ) {
1407 */ 1501 */
1408 ent.setFirstName( txtFirstName->text() ); 1502 ent.setFirstName( txtFirstName->text() );
1409 ent.setLastName( txtLastName->text() ); 1503 ent.setLastName( txtLastName->text() );
1410 ent.setMiddleName( txtMiddleName->text() ); 1504 ent.setMiddleName( txtMiddleName->text() );
1411 ent.setSuffix( txtSuffix->text() ); 1505 ent.setSuffix( txtSuffix->text() );
1412 1506
1413 //} 1507 //}
1414 1508
1415 ent.setFileAs( cmbFileAs->currentText() ); 1509 ent.setFileAs( cmbFileAs->currentText() );
1416 1510
1417 ent.setCategories( cmbCat->currentCategories() ); 1511 ent.setCategories( cmbCat->currentCategories() );
1418 1512
1419 if (hasTitle) 1513 if (hasTitle)
1420 ent.setJobTitle( txtJobTitle->text() ); 1514 ent.setJobTitle( txtJobTitle->text() );
1421 1515
1422 if (hasCompany) 1516 if (hasCompany)
1423 ent.setCompany( txtOrganization->text() ); 1517 ent.setCompany( txtOrganization->text() );
1424 1518
1425 if (hasNotes) 1519 if (hasNotes)
1426 ent.setNotes( txtNote->text() ); 1520 ent.setNotes( txtNote->text() );
1427 1521
1428 if (hasStreet) { 1522 if (hasStreet) {
1429 ent.setHomeStreet( slHomeAddress[0] ); 1523 ent.setHomeStreet( slHomeAddress[0] );
1430 ent.setBusinessStreet( slBusinessAddress[0] ); 1524 ent.setBusinessStreet( slBusinessAddress[0] );
1431 } 1525 }
1432/* 1526/*
1433 if (hasStreet2) { 1527 if (hasStreet2) {
1434 ent.setHomeStreet2( (*slHomeAddress)[1] ); 1528 ent.setHomeStreet2( (*slHomeAddress)[1] );
1435 ent.setBusinessStreet2( (*slBusinessAddress)[1] ); 1529 ent.setBusinessStreet2( (*slBusinessAddress)[1] );
1436 } 1530 }
1437 1531
1438 if (hasPOBox) { 1532 if (hasPOBox) {
1439 ent.setHomePOBox( (*slHomeAddress)[2] ); 1533 ent.setHomePOBox( (*slHomeAddress)[2] );
1440 ent.setBusinessPOBox( (*slBusinessAddress)[2] ); 1534 ent.setBusinessPOBox( (*slBusinessAddress)[2] );
1441 } 1535 }
1442*/ 1536*/
1443 if (hasCity) { 1537 if (hasCity) {
1444 ent.setHomeCity( slHomeAddress[3] ); 1538 ent.setHomeCity( slHomeAddress[3] );
1445 ent.setBusinessCity( slBusinessAddress[3] ); 1539 ent.setBusinessCity( slBusinessAddress[3] );
1446 } 1540 }
1447 1541
1448 if (hasState) { 1542 if (hasState) {
1449 ent.setHomeState( slHomeAddress[4] ); 1543 ent.setHomeState( slHomeAddress[4] );
1450 ent.setBusinessState( slBusinessAddress[4] ); 1544 ent.setBusinessState( slBusinessAddress[4] );
1451 } 1545 }
1452 1546
1453 if (hasZip) { 1547 if (hasZip) {
1454 ent.setHomeZip( slHomeAddress[5] ); 1548 ent.setHomeZip( slHomeAddress[5] );
1455 ent.setBusinessZip( slBusinessAddress[5] ); 1549 ent.setBusinessZip( slBusinessAddress[5] );
1456 } 1550 }
1457 1551
1458 if (hasCountry) { 1552 if (hasCountry) {
1459 ent.setHomeCountry( slHomeAddress[6] ); 1553 ent.setHomeCountry( slHomeAddress[6] );
1460 ent.setBusinessCountry( slBusinessAddress[6] ); 1554 ent.setBusinessCountry( slBusinessAddress[6] );
1461 } 1555 }
1462 1556
1463 QStringList::ConstIterator it; 1557 QStringList::ConstIterator it;
1464 QListIterator<QLineEdit> itLE( listValue ); 1558 QListIterator<QLineEdit> itLE( listValue );
1465 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { 1559 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) {
1466 if ( *it == "Department" ) 1560 if ( *it == tr("Department" ))
1467 ent.setDepartment( (*itLE)->text() ); 1561 ent.setDepartment( (*itLE)->text() );
1468 1562
1469 if ( *it == "Company" ) 1563 if ( *it == tr("Company" ))
1470 ent.setCompany( (*itLE)->text() ); 1564 ent.setCompany( (*itLE)->text() );
1471 1565
1472 if ( *it == "Office" ) 1566 if ( *it == tr("Office" ))
1473 ent.setOffice( (*itLE)->text() ); 1567 ent.setOffice( (*itLE)->text() );
1474 1568
1475 if ( *it == "Profession" ) 1569 if ( *it == tr("Profession" ))
1476 ent.setProfession( (*itLE)->text() ); 1570 ent.setProfession( (*itLE)->text() );
1477 1571
1478 if ( *it == "Assistant" ) 1572 if ( *it == tr("Assistant" ))
1479 ent.setAssistant( (*itLE)->text() ); 1573 ent.setAssistant( (*itLE)->text() );
1480 1574
1481 if ( *it == "Manager" ) 1575 if ( *it == tr("Manager" ))
1482 ent.setManager( (*itLE)->text() ); 1576 ent.setManager( (*itLE)->text() );
1483 1577
1484 if ( *it == "Spouse" ) 1578 if ( *it == tr("Spouse" ))
1485 ent.setSpouse( (*itLE)->text() ); 1579 ent.setSpouse( (*itLE)->text() );
1486 1580
1487 if ( *it == "Birthday" ) 1581 if ( *it == tr("Birthday" ))
1488 ent.setBirthday( (*itLE)->text() ); 1582 ent.setBirthday( (*itLE)->text() );
1489 1583
1490 if ( *it == "Anniversary" ) 1584 if ( *it == tr("Anniversary" ))
1491 ent.setAnniversary( (*itLE)->text() ); 1585 ent.setAnniversary( (*itLE)->text() );
1492 1586
1493 if ( *it == "Nickname" ) 1587 if ( *it == tr("Nickname" ))
1494 ent.setNickname( (*itLE)->text() ); 1588 ent.setNickname( (*itLE)->text() );
1495 1589
1496 if ( *it == "Children" ) 1590 if ( *it == tr("Children" ))
1497 ent.setChildren( (*itLE)->text() ); 1591 ent.setChildren( (*itLE)->text() );
1498 1592
1499 } 1593 }
1500 1594
1501 QStringList::ConstIterator itV; 1595 QStringList::ConstIterator itV;
1502 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 ) {
1503 1597
1504 if ( *it == "Business Phone" || *it == "Work Phone" ) 1598 if ( *it == tr("Business Phone") || *it == tr("Work Phone" ))
1505 ent.setBusinessPhone( *itV ); 1599 ent.setBusinessPhone( *itV );
1506/* 1600/*
1507 if ( *it == "Business 2 Phone" ) 1601 if ( *it == tr("Business 2 Phone" )
1508 ent.setBusiness2Phone( *itV ); 1602 ent.setBusiness2Phone( *itV );
1509*/ 1603*/
1510 if ( *it == "Business Fax" || *it == "Work Fax" ) 1604 if ( *it == tr("Business Fax") || *it == tr("Work Fax" ))
1511 ent.setBusinessFax( *itV ); 1605 ent.setBusinessFax( *itV );
1512 1606
1513 if ( *it == "Business Mobile" || *it == "Work Mobile" ) 1607 if ( *it == tr("Business Mobile") || *it == tr("Work Mobile" ))
1514 ent.setBusinessMobile( *itV ); 1608 ent.setBusinessMobile( *itV );
1515/* 1609/*
1516 if ( *it == "Company Phone" ) 1610 if ( *it == "Company Phone" )
1517 ent.setCompanyPhone( *itV ); 1611 ent.setCompanyPhone( *itV );
1518*/ 1612*/
1519 //if ( *it == "Default Email" ) 1613 //if ( *it == "Default Email" )
1520 //ent.setDefaultEmail( *itV ); 1614 //ent.setDefaultEmail( *itV );
1521 1615
1522 if ( *it == "Emails" ) { 1616 if ( *it == tr("Emails" )) {
1523 QString allemail; 1617 QString allemail;
1524 QString defaultmail; 1618 QString defaultmail;
1525 parseEmailFrom( *itV, defaultmail, allemail ); 1619 parseEmailFrom( *itV, defaultmail, allemail );
1526 ent.setDefaultEmail( defaultmail ); 1620 ent.setDefaultEmail( defaultmail );
1527 ent.setEmails( *itV ); 1621 ent.setEmails( *itV );
1528 } 1622 }
1529 1623
1530 if ( *it == "Home Phone" ) 1624 if ( *it == tr("Home Phone" ))
1531 ent.setHomePhone( *itV ); 1625 ent.setHomePhone( *itV );
1532/* 1626/*
1533 if ( *it == "Home 2 Phone" ) 1627 if ( *it == "Home 2 Phone" )
1534 ent.setHome2Phone( *itV ); 1628 ent.setHome2Phone( *itV );
1535*/ 1629*/
1536 if ( *it == "Home Fax" ) 1630 if ( *it == tr("Home Fax" ))
1537 ent.setHomeFax( *itV ); 1631 ent.setHomeFax( *itV );
1538 1632
1539 if ( *it == "Home Mobile" ) 1633 if ( *it == tr("Home Mobile" ))
1540 ent.setHomeMobile( *itV ); 1634 ent.setHomeMobile( *itV );
1541/* 1635/*
1542 if ( *it == "Car Phone" ) 1636 if ( *it == "Car Phone" )
1543 ent.setCarPhone( *itV ); 1637 ent.setCarPhone( *itV );
1544 1638
1545 if ( *it == "ISDN Phone" ) 1639 if ( *it == "ISDN Phone" )
1546 ent.setISDNPhone( *itV ); 1640 ent.setISDNPhone( *itV );
1547 1641
1548 if ( *it == "Other Phone" ) 1642 if ( *it == "Other Phone" )
1549 ent.setOtherPhone( *itV ); 1643 ent.setOtherPhone( *itV );
1550*/ 1644*/
1551 if ( *it == "Business Pager" || *it == "Work Pager" ) 1645 if ( *it == tr("Business Pager") || *it == tr("Work Pager") )
1552 ent.setBusinessPager( *itV ); 1646 ent.setBusinessPager( *itV );
1553/* 1647/*
1554 if ( *it == "Home Pager" ) 1648 if ( *it == "Home Pager" )
1555 ent.setHomePager( *itV ); 1649 ent.setHomePager( *itV );
1556 1650
1557 if ( *it == "AIM IM" ) 1651 if ( *it == "AIM IM" )
1558 ent.setAIMIM( *itV ); 1652 ent.setAIMIM( *itV );
1559 1653
1560 if ( *it == "ICQ IM" ) 1654 if ( *it == "ICQ IM" )
1561 ent.setICQIM( *itV ); 1655 ent.setICQIM( *itV );
1562 1656
1563 if ( *it == "Jabber IM" ) 1657 if ( *it == "Jabber IM" )
1564 ent.setJabberIM( *itV ); 1658 ent.setJabberIM( *itV );
1565 1659
1566 if ( *it == "MSN IM" ) 1660 if ( *it == "MSN IM" )
1567 ent.setMSNIM( *itV ); 1661 ent.setMSNIM( *itV );
1568 1662
1569 if ( *it == "Yahoo IM" ) 1663 if ( *it == "Yahoo IM" )
1570 ent.setYahooIM( *itV ); 1664 ent.setYahooIM( *itV );
1571*/ 1665*/
1572 if ( *it == "Home Web Page" ) 1666 if ( *it == tr("Home Web Page") )
1573 ent.setHomeWebpage( *itV ); 1667 ent.setHomeWebpage( *itV );
1574 if ( *it == "Business Web Page" || *it == "Work Web Page" ) 1668 if ( *it == tr("Business WebPage") || *it == tr("Work Web Page" ))
1575 ent.setBusinessWebpage( *itV ); 1669 ent.setBusinessWebpage( *itV );
1576 1670
1577 1671
1578 } 1672 }
1579 1673
1580 int gender = cmbGender->currentItem(); 1674 int gender = cmbGender->currentItem();
1581 ent.setGender( QString::number( gender ) ); 1675 ent.setGender( QString::number( gender ) );
1582 1676
1583 QString str = txtNote->text(); 1677 QString str = txtNote->text();
1584 if ( !str.isNull() ) 1678 if ( !str.isNull() )
1585 ent.setNotes( str ); 1679 ent.setNotes( str );
1586 1680
1587} 1681}
1588 1682
1589void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 1683void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
1590 QString &strAll ) 1684 QString &strAll )
1591{ 1685{
1592 int where, 1686 int where,
1593 start; 1687 start;
1594 if ( txt.isEmpty() ) 1688 if ( txt.isEmpty() )
1595 return; 1689 return;
1596 // find the first 1690 // find the first
1597 where = txt.find( ',' ); 1691 where = txt.find( ',' );
1598 if ( where < 0 ) { 1692 if ( where < 0 ) {
1599 strDefaultEmail = txt; 1693 strDefaultEmail = txt;
1600 strAll = txt; 1694 strAll = txt;
1601 } else { 1695 } else {
1602 strDefaultEmail = txt.left( where ).stripWhiteSpace(); 1696 strDefaultEmail = txt.left( where ).stripWhiteSpace();
1603 strAll = strDefaultEmail; 1697 strAll = strDefaultEmail;
1604 while ( where > -1 ) { 1698 while ( where > -1 ) {
1605 strAll.append(" "); 1699 strAll.append(" ");
1606 start = where; 1700 start = where;
1607 where = txt.find( ',', where + 1 ); 1701 where = txt.find( ',', where + 1 );
1608 if ( where > - 1 ) 1702 if ( where > - 1 )
1609 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); 1703 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() );
1610 else // grab until the end... 1704 else // grab until the end...
1611 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); 1705 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() );
1612 } 1706 }
1613 } 1707 }
1614} 1708}
1615 1709
1616void parseEmailTo( const QString &strDefaultEmail, 1710void parseEmailTo( const QString &strDefaultEmail,
1617 const QString &strOtherEmail, QString &strBack ) 1711 const QString &strOtherEmail, QString &strBack )
1618{ 1712{
1619 // create a comma dilimeted set of emails... 1713 // create a comma dilimeted set of emails...
1620 // use the power of short circuiting... 1714 // use the power of short circuiting...
1621 bool foundDefault = false; 1715 bool foundDefault = false;
1622 QString strTmp; 1716 QString strTmp;
1623 int start = 0; 1717 int start = 0;
1624 int where; 1718 int where;
1625 // start at the beginng. 1719 // start at the beginng.
1626 strBack = strDefaultEmail; 1720 strBack = strDefaultEmail;
1627 where = 0; 1721 where = 0;
1628 while ( where > -1 ) { 1722 while ( where > -1 ) {
1629 start = where; 1723 start = where;
1630 where = strOtherEmail.find( ' ', where + 1 ); 1724 where = strOtherEmail.find( ' ', where + 1 );
1631 if ( where > 0 ) { 1725 if ( where > 0 ) {
1632 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); 1726 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace();
1633 } else 1727 } else
1634 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); 1728 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace();
1635 if ( foundDefault || strTmp != strDefaultEmail ) { 1729 if ( foundDefault || strTmp != strDefaultEmail ) {
1636 strBack.append( ", " ); 1730 strBack.append( ", " );
1637 strBack.append( strTmp ); 1731 strBack.append( strTmp );
1638 } else 1732 } else
1639 foundDefault = true; 1733 foundDefault = true;
1640 } 1734 }
1641} 1735}
1642 1736
1643 1737
1644static inline bool containsAlphaNum( const QString &str ) 1738static inline bool containsAlphaNum( const QString &str )
1645{ 1739{
1646 int i, 1740 int i,
1647 count = str.length(); 1741 count = str.length();
1648 for ( i = 0; i < count; i++ ) 1742 for ( i = 0; i < count; i++ )
1649 if ( !str[i].isSpace() ) 1743 if ( !str[i].isSpace() )
1650 return TRUE; 1744 return TRUE;
1651 return FALSE; 1745 return FALSE;
1652} 1746}
1653 1747
1654static inline bool constainsWhiteSpace( const QString &str ) 1748static inline bool constainsWhiteSpace( const QString &str )
1655{ 1749{
1656 int i, 1750 int i,
1657 count = str.length(); 1751 count = str.length();
1658 for (i = 0; i < count; i++ ) 1752 for (i = 0; i < count; i++ )
1659 if ( str[i].isSpace() ) 1753 if ( str[i].isSpace() )
1660 return TRUE; 1754 return TRUE;
1661 return FALSE; 1755 return FALSE;
1662} 1756}
1663 1757