summaryrefslogtreecommitdiff
authoreilers <eilers>2002-12-27 13:03:34 (UTC)
committer eilers <eilers>2002-12-27 13:03:34 (UTC)
commit158fd475abbc652613d5eed362dae79f94b17803 (patch) (unidiff)
tree60b38278a274ac97d0ebb1226cfd881418d735bf
parent8ae81608ed194e36236ea68c5fbed54ac6c0275c (diff)
downloadopie-158fd475abbc652613d5eed362dae79f94b17803.zip
opie-158fd475abbc652613d5eed362dae79f94b17803.tar.gz
opie-158fd475abbc652613d5eed362dae79f94b17803.tar.bz2
Fixing nullpointer crash if "emails" selected
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 1b83308..b68d88c 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -1,1609 +1,1613 @@
1/* 1/*
2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> 2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org>
3 * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) 3 * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de)
4 * 4 *
5 * This file is an add-on for the OPIE Palmtop Environment 5 * This file is an add-on for the OPIE Palmtop Environment
6 * 6 *
7 * This file may be distributed and/or modified under the terms of the 7 * This file may be distributed and/or modified under the terms of the
8 * GNU General Public License version 2 as published by the Free Software 8 * GNU General Public License version 2 as published by the Free Software
9 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging 9 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging
10 * of this file. 10 * of this file.
11 * 11 *
12 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 * 14 *
15 * 15 *
16 * This is a rewrite of the abeditor.h file, modified to provide a more 16 * This is a rewrite of the abeditor.h file, modified to provide a more
17 * intuitive interface to TrollTech's original Address Book editor. This 17 * intuitive interface to TrollTech's original Address Book editor. This
18 * is made to operate exactly in interface with the exception of name. 18 * is made to operate exactly in interface with the exception of name.
19 * 19 *
20 */ 20 */
21 21
22#include "contacteditor.h" 22#include "contacteditor.h"
23#include "addresspicker.h" 23#include "addresspicker.h"
24#include "ocontactfields.h" 24#include "ocontactfields.h"
25 25
26#include <qpe/categoryselect.h> 26#include <qpe/categoryselect.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qpe/qpedialog.h> 28#include <qpe/qpedialog.h>
29#include <qpe/timeconversion.h> 29#include <qpe/timeconversion.h>
30#include <opie/ocontact.h> 30#include <opie/ocontact.h>
31#include <qpe/resource.h> 31#include <qpe/resource.h>
32 32
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qlabel.h> 34#include <qlabel.h>
35#include <qtabwidget.h> 35#include <qtabwidget.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qlineedit.h> 37#include <qlineedit.h>
38#include <qmultilineedit.h> 38#include <qmultilineedit.h>
39#include <qscrollview.h> 39#include <qscrollview.h>
40#include <qtoolbutton.h> 40#include <qtoolbutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qmainwindow.h> 42#include <qmainwindow.h>
43#include <qvaluelist.h> 43#include <qvaluelist.h>
44#include <qpopupmenu.h> 44#include <qpopupmenu.h>
45#include <qlistbox.h> 45#include <qlistbox.h>
46#include <qhbox.h> 46#include <qhbox.h>
47#include <qaction.h> 47#include <qaction.h>
48#include <qiconset.h> 48#include <qiconset.h>
49 49
50#include <assert.h> 50#include <assert.h>
51 51
52static inline bool containsAlphaNum( const QString &str ); 52static inline bool containsAlphaNum( const QString &str );
53static inline bool constainsWhiteSpace( const QString &str ); 53static inline bool constainsWhiteSpace( const QString &str );
54 54
55// helper functions, convert our comma delimited list to proper 55// helper functions, convert our comma delimited list to proper
56// file format... 56// file format...
57void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 57void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
58 QString &strAll ); 58 QString &strAll );
59 59
60// helper convert from file format to comma delimited... 60// helper convert from file format to comma delimited...
61void parseEmailTo( const QString &strDefaultEmail, 61void parseEmailTo( const QString &strDefaultEmail,
62 const QString &strOtherEmail, QString &strBack ); 62 const QString &strOtherEmail, QString &strBack );
63 63
64 ContactEditor::ContactEditor(const OContact &entry, 64 ContactEditor::ContactEditor(const OContact &entry,
65 QWidget *parent, 65 QWidget *parent,
66 const char *name, 66 const char *name,
67 WFlags fl ) 67 WFlags fl )
68 : QDialog( parent, name, TRUE, fl ), 68 : QDialog( parent, name, TRUE, fl ),
69 m_personalView ( false ) 69 m_personalView ( false )
70 70
71{ 71{
72 72
73 init(); 73 init();
74 setEntry( entry ); 74 setEntry( entry );
75 cmbDefaultEmail = 0; 75 cmbDefaultEmail = 0;
76 defaultEmailChooserPosition = -1; 76 defaultEmailChooserPosition = -1;
77} 77}
78 78
79ContactEditor::~ContactEditor() { 79ContactEditor::~ContactEditor() {
80} 80}
81 81
82void ContactEditor::init() { 82void ContactEditor::init() {
83 83
84 useFullName = true; 84 useFullName = true;
85 85
86 uint i = 0; 86 uint i = 0;
87 87
88 QStringList trlChooserNames; 88 QStringList trlChooserNames;
89 89
90 for (i = 0; i <= 6; i++) { 90 for (i = 0; i <= 6; i++) {
91 slHomeAddress.append( "" ); 91 slHomeAddress.append( "" );
92 slBusinessAddress.append( "" ); 92 slBusinessAddress.append( "" );
93 } 93 }
94 94
95 trlChooserNames = OContactFields::trphonefields( false ); 95 trlChooserNames = OContactFields::trphonefields( false );
96 slChooserNames = OContactFields::untrphonefields( false ); 96 slChooserNames = OContactFields::untrphonefields( false );
97 slDynamicEntries = OContactFields::untrdetailsfields( false ); 97 slDynamicEntries = OContactFields::untrdetailsfields( false );
98 trlDynamicEntries = OContactFields::trdetailsfields( false ); 98 trlDynamicEntries = OContactFields::trdetailsfields( false );
99 99
100 // Ok, we have to remove elements from the list of dynamic entries 100 // Ok, we have to remove elements from the list of dynamic entries
101 // which are now stored in special (not dynamic) widgets.. 101 // which are now stored in special (not dynamic) widgets..
102 // Otherwise we will get problems with field assignments! (se) 102 // Otherwise we will get problems with field assignments! (se)
103 slDynamicEntries.remove("Anniversary"); 103 slDynamicEntries.remove("Anniversary");
104 slDynamicEntries.remove("Birthday"); 104 slDynamicEntries.remove("Birthday");
105 slDynamicEntries.remove("Gender"); 105 slDynamicEntries.remove("Gender");
106 106
107 // The same with translated fields.. But I will 107 // The same with translated fields.. But I will
108 // use the translation map to avoid mismatches.. 108 // use the translation map to avoid mismatches..
109 QMap<int, QString> translMap = OContactFields::idToTrFields(); 109 QMap<int, QString> translMap = OContactFields::idToTrFields();
110 trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); 110 trlDynamicEntries.remove( translMap[Qtopia::Anniversary] );
111 trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); 111 trlDynamicEntries.remove( translMap[Qtopia::Birthday] );
112 trlDynamicEntries.remove( translMap[Qtopia::Gender] ); 112 trlDynamicEntries.remove( translMap[Qtopia::Gender] );
113 113
114 // Last Check to be sure.. 114 // Last Check to be sure..
115 assert( slDynamicEntries.count() == trlDynamicEntries.count() ); 115 assert( slDynamicEntries.count() == trlDynamicEntries.count() );
116 assert( slChooserNames.count() == trlChooserNames.count() ); 116 assert( slChooserNames.count() == trlChooserNames.count() );
117 117
118 for (i = 0; i < slChooserNames.count(); i++) 118 for (i = 0; i < slChooserNames.count(); i++)
119 slChooserValues.append(""); 119 slChooserValues.append("");
120 120
121 121
122 QVBoxLayout *vb = new QVBoxLayout( this ); 122 QVBoxLayout *vb = new QVBoxLayout( this );
123 123
124 tabMain = new QTabWidget( this ); 124 tabMain = new QTabWidget( this );
125 vb->addWidget( tabMain ); 125 vb->addWidget( tabMain );
126 126
127 QWidget *tabViewport = new QWidget ( tabMain ); 127 QWidget *tabViewport = new QWidget ( tabMain );
128 128
129 vb = new QVBoxLayout( tabViewport ); 129 vb = new QVBoxLayout( tabViewport );
130 130
131 svGeneral = new QScrollView( tabViewport ); 131 svGeneral = new QScrollView( tabViewport );
132 vb->addWidget( svGeneral, 0, 0 ); 132 vb->addWidget( svGeneral, 0, 0 );
133 svGeneral->setResizePolicy( QScrollView::AutoOneFit ); 133 svGeneral->setResizePolicy( QScrollView::AutoOneFit );
134 svGeneral->setFrameStyle( QFrame::NoFrame ); 134 svGeneral->setFrameStyle( QFrame::NoFrame );
135 135
136 QWidget *container = new QWidget( svGeneral->viewport() ); 136 QWidget *container = new QWidget( svGeneral->viewport() );
137 svGeneral->addChild( container ); 137 svGeneral->addChild( container );
138 138
139 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); 139 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 );
140 gl->setResizeMode( QLayout::FreeResize ); 140 gl->setResizeMode( QLayout::FreeResize );
141 141
142 btnFullName = new QPushButton( tr( "Full Name..." ), container ); 142 btnFullName = new QPushButton( tr( "Full Name..." ), container );
143 gl->addWidget( btnFullName, 0, 0 ); 143 gl->addWidget( btnFullName, 0, 0 );
144 txtFullName = new QLineEdit( container ); 144 txtFullName = new QLineEdit( container );
145 gl->addWidget( txtFullName, 0, 1 ); 145 gl->addWidget( txtFullName, 0, 1 );
146 146
147 QLabel *l = new QLabel( tr( "Job Title" ), container ); 147 QLabel *l = new QLabel( tr( "Job Title" ), container );
148 gl->addWidget( l, 1, 0 ); 148 gl->addWidget( l, 1, 0 );
149 txtJobTitle = new QLineEdit( container ); 149 txtJobTitle = new QLineEdit( container );
150 gl->addWidget( txtJobTitle, 1, 1 ); 150 gl->addWidget( txtJobTitle, 1, 1 );
151 151
152 l = new QLabel( tr( "Organization" ), container ); 152 l = new QLabel( tr( "Organization" ), container );
153 gl->addWidget( l, 2, 0 ); 153 gl->addWidget( l, 2, 0 );
154 txtOrganization = new QLineEdit( container ); 154 txtOrganization = new QLineEdit( container );
155 gl->addWidget( txtOrganization, 2, 1 ); 155 gl->addWidget( txtOrganization, 2, 1 );
156 156
157 cmbChooserField1 = new QComboBox( FALSE, container ); 157 cmbChooserField1 = new QComboBox( FALSE, container );
158 cmbChooserField1->setMaximumWidth( 90 ); 158 cmbChooserField1->setMaximumWidth( 90 );
159 gl->addWidget( cmbChooserField1, 3, 0 ); 159 gl->addWidget( cmbChooserField1, 3, 0 );
160 txtChooserField1 = new QLineEdit( container ); 160 txtChooserField1 = new QLineEdit( container );
161 gl->addWidget( txtChooserField1, 3, 1 ); 161 gl->addWidget( txtChooserField1, 3, 1 );
162 162
163 cmbChooserField2 = new QComboBox( FALSE, container ); 163 cmbChooserField2 = new QComboBox( FALSE, container );
164 cmbChooserField2->setMaximumWidth( 90 ); 164 cmbChooserField2->setMaximumWidth( 90 );
165 gl->addWidget( cmbChooserField2, 4, 0 ); 165 gl->addWidget( cmbChooserField2, 4, 0 );
166 txtChooserField2 = new QLineEdit( container ); 166 txtChooserField2 = new QLineEdit( container );
167 gl->addWidget( txtChooserField2, 4, 1 ); 167 gl->addWidget( txtChooserField2, 4, 1 );
168 168
169 cmbChooserField3 = new QComboBox( FALSE, container ); 169 cmbChooserField3 = new QComboBox( FALSE, container );
170 cmbChooserField3->setMaximumWidth( 90 ); 170 cmbChooserField3->setMaximumWidth( 90 );
171 gl->addWidget( cmbChooserField3, 5, 0 ); 171 gl->addWidget( cmbChooserField3, 5, 0 );
172 txtChooserField3 = new QLineEdit( container ); 172 txtChooserField3 = new QLineEdit( container );
173 gl->addWidget( txtChooserField3, 5, 1 ); 173 gl->addWidget( txtChooserField3, 5, 1 );
174 174
175 l = new QLabel( tr( "File As" ), container ); 175 l = new QLabel( tr( "File As" ), container );
176 gl->addWidget( l, 6, 0 ); 176 gl->addWidget( l, 6, 0 );
177 cmbFileAs = new QComboBox( TRUE, container ); 177 cmbFileAs = new QComboBox( TRUE, container );
178 gl->addWidget( cmbFileAs, 6, 1 ); 178 gl->addWidget( cmbFileAs, 6, 1 );
179 179
180 labCat = new QLabel( tr( "Category" ), container ); 180 labCat = new QLabel( tr( "Category" ), container );
181 gl->addWidget( labCat, 7, 0 ); 181 gl->addWidget( labCat, 7, 0 );
182 cmbCat = new CategorySelect( container ); 182 cmbCat = new CategorySelect( container );
183 gl->addWidget( cmbCat, 7, 1 ); 183 gl->addWidget( cmbCat, 7, 1 );
184 labCat->show(); 184 labCat->show();
185 cmbCat->show(); 185 cmbCat->show();
186 186
187 btnNote = new QPushButton( tr( "Notes..." ), container ); 187 btnNote = new QPushButton( tr( "Notes..." ), container );
188 gl->addWidget( btnNote, 8, 1 ); 188 gl->addWidget( btnNote, 8, 1 );
189 189
190 tabMain->insertTab( tabViewport, tr( "General" ) ); 190 tabMain->insertTab( tabViewport, tr( "General" ) );
191 191
192 tabViewport = new QWidget ( tabMain ); 192 tabViewport = new QWidget ( tabMain );
193 193
194 vb = new QVBoxLayout( tabViewport ); 194 vb = new QVBoxLayout( tabViewport );
195 195
196 svAddress = new QScrollView( tabViewport ); 196 svAddress = new QScrollView( tabViewport );
197 vb->addWidget( svAddress, 0, 0 ); 197 vb->addWidget( svAddress, 0, 0 );
198 svAddress->setResizePolicy( QScrollView::AutoOneFit ); 198 svAddress->setResizePolicy( QScrollView::AutoOneFit );
199 svAddress->setFrameStyle( QFrame::NoFrame ); 199 svAddress->setFrameStyle( QFrame::NoFrame );
200 200
201 container = new QWidget( svAddress->viewport() ); 201 container = new QWidget( svAddress->viewport() );
202 svAddress->addChild( container ); 202 svAddress->addChild( container );
203 203
204 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem 204 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem
205 205
206 cmbAddress = new QComboBox( FALSE, container ); 206 cmbAddress = new QComboBox( FALSE, container );
207 cmbAddress->insertItem( tr( "Business" ) ); 207 cmbAddress->insertItem( tr( "Business" ) );
208 cmbAddress->insertItem( tr( "Home" ) ); 208 cmbAddress->insertItem( tr( "Home" ) );
209 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); 209 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 );
210 210
211 l = new QLabel( tr( "Address" ), container ); 211 l = new QLabel( tr( "Address" ), container );
212 gl->addWidget( l, 1, 0 ); 212 gl->addWidget( l, 1, 0 );
213 txtAddress = new QLineEdit( container ); 213 txtAddress = new QLineEdit( container );
214 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); 214 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 );
215 215
216 l = new QLabel( tr( "City" ), container ); 216 l = new QLabel( tr( "City" ), container );
217 gl->addWidget( l, 2, 0 ); 217 gl->addWidget( l, 2, 0 );
218 txtCity = new QLineEdit( container ); 218 txtCity = new QLineEdit( container );
219 gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); 219 gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 );
220 220
221 l = new QLabel( tr( "State" ), container ); 221 l = new QLabel( tr( "State" ), container );
222 gl->addWidget( l, 3, 0 ); 222 gl->addWidget( l, 3, 0 );
223 txtState = new QLineEdit( container ); 223 txtState = new QLineEdit( container );
224 gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); 224 gl->addMultiCellWidget( txtState, 3, 3, 1, 2 );
225 225
226 l = new QLabel( tr( "Zip Code" ), container ); 226 l = new QLabel( tr( "Zip Code" ), container );
227 gl->addWidget( l, 4, 0 ); 227 gl->addWidget( l, 4, 0 );
228 txtZip = new QLineEdit( container ); 228 txtZip = new QLineEdit( container );
229 gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); 229 gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 );
230 230
231 l = new QLabel( tr( "Country" ), container ); 231 l = new QLabel( tr( "Country" ), container );
232 gl->addWidget( l, 5, 0 ); 232 gl->addWidget( l, 5, 0 );
233 cmbCountry = new QComboBox( TRUE, container ); 233 cmbCountry = new QComboBox( TRUE, container );
234 cmbCountry->insertItem( tr( "" ) ); 234 cmbCountry->insertItem( tr( "" ) );
235 cmbCountry->insertItem( tr ( "United States" ) ); 235 cmbCountry->insertItem( tr ( "United States" ) );
236 cmbCountry->insertItem( tr ( "United Kingdom" ) ); 236 cmbCountry->insertItem( tr ( "United Kingdom" ) );
237 cmbCountry->insertItem( tr ( "Afganistan" ) ); 237 cmbCountry->insertItem( tr ( "Afganistan" ) );
238 cmbCountry->insertItem( tr ( "Albania" ) ); 238 cmbCountry->insertItem( tr ( "Albania" ) );
239 cmbCountry->insertItem( tr ( "Algeria" ) ); 239 cmbCountry->insertItem( tr ( "Algeria" ) );
240 cmbCountry->insertItem( tr ( "American Samoa" ) ); 240 cmbCountry->insertItem( tr ( "American Samoa" ) );
241 cmbCountry->insertItem( tr ( "Andorra" ) ); 241 cmbCountry->insertItem( tr ( "Andorra" ) );
242 cmbCountry->insertItem( tr ( "Angola" ) ); 242 cmbCountry->insertItem( tr ( "Angola" ) );
243 cmbCountry->insertItem( tr ( "Anguilla" ) ); 243 cmbCountry->insertItem( tr ( "Anguilla" ) );
244 cmbCountry->insertItem( tr ( "Antartica" ) ); 244 cmbCountry->insertItem( tr ( "Antartica" ) );
245 cmbCountry->insertItem( tr ( "Argentina" ) ); 245 cmbCountry->insertItem( tr ( "Argentina" ) );
246 cmbCountry->insertItem( tr ( "Armania" ) ); 246 cmbCountry->insertItem( tr ( "Armania" ) );
247 cmbCountry->insertItem( tr ( "Aruba" ) ); 247 cmbCountry->insertItem( tr ( "Aruba" ) );
248 cmbCountry->insertItem( tr ( "Australia" ) ); 248 cmbCountry->insertItem( tr ( "Australia" ) );
249 cmbCountry->insertItem( tr ( "Austria" ) ); 249 cmbCountry->insertItem( tr ( "Austria" ) );
250 cmbCountry->insertItem( tr ( "Azerbaijan" ) ); 250 cmbCountry->insertItem( tr ( "Azerbaijan" ) );
251 cmbCountry->insertItem( tr ( "Bahamas" ) ); 251 cmbCountry->insertItem( tr ( "Bahamas" ) );
252 cmbCountry->insertItem( tr ( "Bahrain" ) ); 252 cmbCountry->insertItem( tr ( "Bahrain" ) );
253 cmbCountry->insertItem( tr ( "Bangladesh" ) ); 253 cmbCountry->insertItem( tr ( "Bangladesh" ) );
254 cmbCountry->insertItem( tr ( "Barbados" ) ); 254 cmbCountry->insertItem( tr ( "Barbados" ) );
255 cmbCountry->insertItem( tr ( "Belarus" ) ); 255 cmbCountry->insertItem( tr ( "Belarus" ) );
256 cmbCountry->insertItem( tr ( "Belgium" ) ); 256 cmbCountry->insertItem( tr ( "Belgium" ) );
257 cmbCountry->insertItem( tr ( "Belize" ) ); 257 cmbCountry->insertItem( tr ( "Belize" ) );
258 cmbCountry->insertItem( tr ( "Benin" ) ); 258 cmbCountry->insertItem( tr ( "Benin" ) );
259 cmbCountry->insertItem( tr ( "Bermuda" ) ); 259 cmbCountry->insertItem( tr ( "Bermuda" ) );
260 cmbCountry->insertItem( tr ( "Bhutan" ) ); 260 cmbCountry->insertItem( tr ( "Bhutan" ) );
261 cmbCountry->insertItem( tr ( "Boliva" ) ); 261 cmbCountry->insertItem( tr ( "Boliva" ) );
262 cmbCountry->insertItem( tr ( "Botswana" ) ); 262 cmbCountry->insertItem( tr ( "Botswana" ) );
263 cmbCountry->insertItem( tr ( "Bouvet Island" ) ); 263 cmbCountry->insertItem( tr ( "Bouvet Island" ) );
264 cmbCountry->insertItem( tr ( "Brazil" ) ); 264 cmbCountry->insertItem( tr ( "Brazil" ) );
265 cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); 265 cmbCountry->insertItem( tr ( "Brunei Darussalam" ) );
266 cmbCountry->insertItem( tr ( "Bulgaria" ) ); 266 cmbCountry->insertItem( tr ( "Bulgaria" ) );
267 cmbCountry->insertItem( tr ( "Burkina Faso" ) ); 267 cmbCountry->insertItem( tr ( "Burkina Faso" ) );
268 cmbCountry->insertItem( tr ( "Burundi" ) ); 268 cmbCountry->insertItem( tr ( "Burundi" ) );
269 cmbCountry->insertItem( tr ( "Cambodia" ) ); 269 cmbCountry->insertItem( tr ( "Cambodia" ) );
270 cmbCountry->insertItem( tr ( "Camaroon" ) ); 270 cmbCountry->insertItem( tr ( "Camaroon" ) );
271 cmbCountry->insertItem( tr ( "Canada" ) ); 271 cmbCountry->insertItem( tr ( "Canada" ) );
272 cmbCountry->insertItem( tr ( "Cape Verde" ) ); 272 cmbCountry->insertItem( tr ( "Cape Verde" ) );
273 cmbCountry->insertItem( tr ( "Cayman Islands" ) ); 273 cmbCountry->insertItem( tr ( "Cayman Islands" ) );
274 cmbCountry->insertItem( tr ( "Chad" ) ); 274 cmbCountry->insertItem( tr ( "Chad" ) );
275 cmbCountry->insertItem( tr ( "Chile" ) ); 275 cmbCountry->insertItem( tr ( "Chile" ) );
276 cmbCountry->insertItem( tr ( "China" ) ); 276 cmbCountry->insertItem( tr ( "China" ) );
277 cmbCountry->insertItem( tr ( "Christmas Island" ) ); 277 cmbCountry->insertItem( tr ( "Christmas Island" ) );
278 cmbCountry->insertItem( tr ( "Colombia" ) ); 278 cmbCountry->insertItem( tr ( "Colombia" ) );
279 cmbCountry->insertItem( tr ( "Comoros" ) ); 279 cmbCountry->insertItem( tr ( "Comoros" ) );
280 cmbCountry->insertItem( tr ( "Congo" ) ); 280 cmbCountry->insertItem( tr ( "Congo" ) );
281 cmbCountry->insertItem( tr ( "Cook Island" ) ); 281 cmbCountry->insertItem( tr ( "Cook Island" ) );
282 cmbCountry->insertItem( tr ( "Costa Rica" ) ); 282 cmbCountry->insertItem( tr ( "Costa Rica" ) );
283 cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); 283 cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) );
284 cmbCountry->insertItem( tr ( "Croatia" ) ); 284 cmbCountry->insertItem( tr ( "Croatia" ) );
285 cmbCountry->insertItem( tr ( "Cuba" ) ); 285 cmbCountry->insertItem( tr ( "Cuba" ) );
286 cmbCountry->insertItem( tr ( "Cyprus" ) ); 286 cmbCountry->insertItem( tr ( "Cyprus" ) );
287 cmbCountry->insertItem( tr ( "Czech Republic" ) ); 287 cmbCountry->insertItem( tr ( "Czech Republic" ) );
288 cmbCountry->insertItem( tr ( "Denmark" ) ); 288 cmbCountry->insertItem( tr ( "Denmark" ) );
289 cmbCountry->insertItem( tr ( "Djibouti" ) ); 289 cmbCountry->insertItem( tr ( "Djibouti" ) );
290 cmbCountry->insertItem( tr ( "Dominica" ) ); 290 cmbCountry->insertItem( tr ( "Dominica" ) );
291 cmbCountry->insertItem( tr ( "Dominican Republic" ) ); 291 cmbCountry->insertItem( tr ( "Dominican Republic" ) );
292 cmbCountry->insertItem( tr ( "East Timor" ) ); 292 cmbCountry->insertItem( tr ( "East Timor" ) );
293 cmbCountry->insertItem( tr ( "Ecuador" ) ); 293 cmbCountry->insertItem( tr ( "Ecuador" ) );
294 cmbCountry->insertItem( tr ( "Egypt" ) ); 294 cmbCountry->insertItem( tr ( "Egypt" ) );
295 cmbCountry->insertItem( tr ( "El Salvador" ) ); 295 cmbCountry->insertItem( tr ( "El Salvador" ) );
296 cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); 296 cmbCountry->insertItem( tr ( "Equatorial Guinea" ) );
297 cmbCountry->insertItem( tr ( "Eritrea" ) ); 297 cmbCountry->insertItem( tr ( "Eritrea" ) );
298 cmbCountry->insertItem( tr ( "Estonia" ) ); 298 cmbCountry->insertItem( tr ( "Estonia" ) );
299 cmbCountry->insertItem( tr ( "Ethiopia" ) ); 299 cmbCountry->insertItem( tr ( "Ethiopia" ) );
300 cmbCountry->insertItem( tr ( "Falkland Islands" ) ); 300 cmbCountry->insertItem( tr ( "Falkland Islands" ) );
301 cmbCountry->insertItem( tr ( "Faroe Islands" ) ); 301 cmbCountry->insertItem( tr ( "Faroe Islands" ) );
302 cmbCountry->insertItem( tr ( "Fiji" ) ); 302 cmbCountry->insertItem( tr ( "Fiji" ) );
303 cmbCountry->insertItem( tr ( "Finland" ) ); 303 cmbCountry->insertItem( tr ( "Finland" ) );
304 cmbCountry->insertItem( tr ( "France" ) ); 304 cmbCountry->insertItem( tr ( "France" ) );
305 cmbCountry->insertItem( tr ( "French Guiana" ) ); 305 cmbCountry->insertItem( tr ( "French Guiana" ) );
306 cmbCountry->insertItem( tr ( "French Polynesia" ) ); 306 cmbCountry->insertItem( tr ( "French Polynesia" ) );
307 cmbCountry->insertItem( tr ( "Gabon" ) ); 307 cmbCountry->insertItem( tr ( "Gabon" ) );
308 cmbCountry->insertItem( tr ( "Gambia" ) ); 308 cmbCountry->insertItem( tr ( "Gambia" ) );
309 cmbCountry->insertItem( tr ( "Georgia" ) ); 309 cmbCountry->insertItem( tr ( "Georgia" ) );
310 cmbCountry->insertItem( tr ( "Germany" ) ); 310 cmbCountry->insertItem( tr ( "Germany" ) );
311 cmbCountry->insertItem( tr ( "Gahna" ) ); 311 cmbCountry->insertItem( tr ( "Gahna" ) );
312 cmbCountry->insertItem( tr ( "Gibraltar" ) ); 312 cmbCountry->insertItem( tr ( "Gibraltar" ) );
313 cmbCountry->insertItem( tr ( "Greece" ) ); 313 cmbCountry->insertItem( tr ( "Greece" ) );
314 cmbCountry->insertItem( tr ( "Greenland" ) ); 314 cmbCountry->insertItem( tr ( "Greenland" ) );
315 cmbCountry->insertItem( tr ( "Grenada" ) ); 315 cmbCountry->insertItem( tr ( "Grenada" ) );
316 cmbCountry->insertItem( tr ( "Guadelupe" ) ); 316 cmbCountry->insertItem( tr ( "Guadelupe" ) );
317 cmbCountry->insertItem( tr ( "Guam" ) ); 317 cmbCountry->insertItem( tr ( "Guam" ) );
318 cmbCountry->insertItem( tr ( "Guatemala" ) ); 318 cmbCountry->insertItem( tr ( "Guatemala" ) );
319 cmbCountry->insertItem( tr ( "Guinea" ) ); 319 cmbCountry->insertItem( tr ( "Guinea" ) );
320 cmbCountry->insertItem( tr ( "Guinea-bissau" ) ); 320 cmbCountry->insertItem( tr ( "Guinea-bissau" ) );
321 cmbCountry->insertItem( tr ( "Guyana" ) ); 321 cmbCountry->insertItem( tr ( "Guyana" ) );
322 cmbCountry->insertItem( tr ( "Haiti" ) ); 322 cmbCountry->insertItem( tr ( "Haiti" ) );
323 cmbCountry->insertItem( tr ( "Holy See" ) ); 323 cmbCountry->insertItem( tr ( "Holy See" ) );
324 cmbCountry->insertItem( tr ( "Honduras" ) ); 324 cmbCountry->insertItem( tr ( "Honduras" ) );
325 cmbCountry->insertItem( tr ( "Hong Kong" ) ); 325 cmbCountry->insertItem( tr ( "Hong Kong" ) );
326 cmbCountry->insertItem( tr ( "Hungary" ) ); 326 cmbCountry->insertItem( tr ( "Hungary" ) );
327 cmbCountry->insertItem( tr ( "Iceland" ) ); 327 cmbCountry->insertItem( tr ( "Iceland" ) );
328 cmbCountry->insertItem( tr ( "India" ) ); 328 cmbCountry->insertItem( tr ( "India" ) );
329 cmbCountry->insertItem( tr ( "Indonesia" ) ); 329 cmbCountry->insertItem( tr ( "Indonesia" ) );
330 cmbCountry->insertItem( tr ( "Ireland" ) ); 330 cmbCountry->insertItem( tr ( "Ireland" ) );
331 cmbCountry->insertItem( tr ( "Israel" ) ); 331 cmbCountry->insertItem( tr ( "Israel" ) );
332 cmbCountry->insertItem( tr ( "Italy" ) ); 332 cmbCountry->insertItem( tr ( "Italy" ) );
333 cmbCountry->insertItem( tr ( "Jamacia" ) ); 333 cmbCountry->insertItem( tr ( "Jamacia" ) );
334 cmbCountry->insertItem( tr ( "Japan" ) ); 334 cmbCountry->insertItem( tr ( "Japan" ) );
335 cmbCountry->insertItem( tr ( "Jordan" ) ); 335 cmbCountry->insertItem( tr ( "Jordan" ) );
336 cmbCountry->insertItem( tr ( "Kazakhstan" ) ); 336 cmbCountry->insertItem( tr ( "Kazakhstan" ) );
337 cmbCountry->insertItem( tr ( "Kenya" ) ); 337 cmbCountry->insertItem( tr ( "Kenya" ) );
338 cmbCountry->insertItem( tr ( "Kribati" ) ); 338 cmbCountry->insertItem( tr ( "Kribati" ) );
339 cmbCountry->insertItem( tr ( "Korea" ) ); 339 cmbCountry->insertItem( tr ( "Korea" ) );
340 cmbCountry->insertItem( tr ( "Kuwait" ) ); 340 cmbCountry->insertItem( tr ( "Kuwait" ) );
341 cmbCountry->insertItem( tr ( "Kyrgystan" ) ); 341 cmbCountry->insertItem( tr ( "Kyrgystan" ) );
342 cmbCountry->insertItem( tr ( "Laos" ) ); 342 cmbCountry->insertItem( tr ( "Laos" ) );
343 cmbCountry->insertItem( tr ( "Latvia" ) ); 343 cmbCountry->insertItem( tr ( "Latvia" ) );
344 cmbCountry->insertItem( tr ( "Lebanon" ) ); 344 cmbCountry->insertItem( tr ( "Lebanon" ) );
345 cmbCountry->insertItem( tr ( "Lesotho" ) ); 345 cmbCountry->insertItem( tr ( "Lesotho" ) );
346 cmbCountry->insertItem( tr ( "Liberia" ) ); 346 cmbCountry->insertItem( tr ( "Liberia" ) );
347 cmbCountry->insertItem( tr ( "Liechtenstein" ) ); 347 cmbCountry->insertItem( tr ( "Liechtenstein" ) );
348 cmbCountry->insertItem( tr ( "Lithuania" ) ); 348 cmbCountry->insertItem( tr ( "Lithuania" ) );
349 cmbCountry->insertItem( tr ( "Luxembourg" ) ); 349 cmbCountry->insertItem( tr ( "Luxembourg" ) );
350 cmbCountry->insertItem( tr ( "Macau" ) ); 350 cmbCountry->insertItem( tr ( "Macau" ) );
351 cmbCountry->insertItem( tr ( "Macedonia" ) ); 351 cmbCountry->insertItem( tr ( "Macedonia" ) );
352 cmbCountry->insertItem( tr ( "Madagascar" ) ); 352 cmbCountry->insertItem( tr ( "Madagascar" ) );
353 cmbCountry->insertItem( tr ( "Malawi" ) ); 353 cmbCountry->insertItem( tr ( "Malawi" ) );
354 cmbCountry->insertItem( tr ( "Malaysia" ) ); 354 cmbCountry->insertItem( tr ( "Malaysia" ) );
355 cmbCountry->insertItem( tr ( "Maldives" ) ); 355 cmbCountry->insertItem( tr ( "Maldives" ) );
356 cmbCountry->insertItem( tr ( "Mali" ) ); 356 cmbCountry->insertItem( tr ( "Mali" ) );
357 cmbCountry->insertItem( tr ( "Malta" ) ); 357 cmbCountry->insertItem( tr ( "Malta" ) );
358 cmbCountry->insertItem( tr ( "Martinique" ) ); 358 cmbCountry->insertItem( tr ( "Martinique" ) );
359 cmbCountry->insertItem( tr ( "Mauritania" ) ); 359 cmbCountry->insertItem( tr ( "Mauritania" ) );
360 cmbCountry->insertItem( tr ( "Mauritius" ) ); 360 cmbCountry->insertItem( tr ( "Mauritius" ) );
361 cmbCountry->insertItem( tr ( "Mayotte" ) ); 361 cmbCountry->insertItem( tr ( "Mayotte" ) );
362 cmbCountry->insertItem( tr ( "Mexico" ) ); 362 cmbCountry->insertItem( tr ( "Mexico" ) );
363 cmbCountry->insertItem( tr ( "Micronesia" ) ); 363 cmbCountry->insertItem( tr ( "Micronesia" ) );
364 cmbCountry->insertItem( tr ( "Moldova" ) ); 364 cmbCountry->insertItem( tr ( "Moldova" ) );
365 cmbCountry->insertItem( tr ( "Monaco" ) ); 365 cmbCountry->insertItem( tr ( "Monaco" ) );
366 cmbCountry->insertItem( tr ( "Mongolia" ) ); 366 cmbCountry->insertItem( tr ( "Mongolia" ) );
367 cmbCountry->insertItem( tr ( "Montserrat" ) ); 367 cmbCountry->insertItem( tr ( "Montserrat" ) );
368 cmbCountry->insertItem( tr ( "Morocco" ) ); 368 cmbCountry->insertItem( tr ( "Morocco" ) );
369 cmbCountry->insertItem( tr ( "Mozambique" ) ); 369 cmbCountry->insertItem( tr ( "Mozambique" ) );
370 cmbCountry->insertItem( tr ( "Myanmar" ) ); 370 cmbCountry->insertItem( tr ( "Myanmar" ) );
371 cmbCountry->insertItem( tr ( "Namibia" ) ); 371 cmbCountry->insertItem( tr ( "Namibia" ) );
372 cmbCountry->insertItem( tr ( "Nauru" ) ); 372 cmbCountry->insertItem( tr ( "Nauru" ) );
373 cmbCountry->insertItem( tr ( "Nepal" ) ); 373 cmbCountry->insertItem( tr ( "Nepal" ) );
374 cmbCountry->insertItem( tr ( "Netherlands" ) ); 374 cmbCountry->insertItem( tr ( "Netherlands" ) );
375 cmbCountry->insertItem( tr ( "New Caledonia" ) ); 375 cmbCountry->insertItem( tr ( "New Caledonia" ) );
376 cmbCountry->insertItem( tr ( "New Zealand" ) ); 376 cmbCountry->insertItem( tr ( "New Zealand" ) );
377 cmbCountry->insertItem( tr ( "Nicaragua" ) ); 377 cmbCountry->insertItem( tr ( "Nicaragua" ) );
378 cmbCountry->insertItem( tr ( "Niger" ) ); 378 cmbCountry->insertItem( tr ( "Niger" ) );
379 cmbCountry->insertItem( tr ( "Nigeria" ) ); 379 cmbCountry->insertItem( tr ( "Nigeria" ) );
380 cmbCountry->insertItem( tr ( "Niue" ) ); 380 cmbCountry->insertItem( tr ( "Niue" ) );
381 cmbCountry->insertItem( tr ( "Norway" ) ); 381 cmbCountry->insertItem( tr ( "Norway" ) );
382 cmbCountry->insertItem( tr ( "Oman" ) ); 382 cmbCountry->insertItem( tr ( "Oman" ) );
383 cmbCountry->insertItem( tr ( "Pakistan" ) ); 383 cmbCountry->insertItem( tr ( "Pakistan" ) );
384 cmbCountry->insertItem( tr ( "Palau" ) ); 384 cmbCountry->insertItem( tr ( "Palau" ) );
385 cmbCountry->insertItem( tr ( "Palestinian Territory" ) ); 385 cmbCountry->insertItem( tr ( "Palestinian Territory" ) );
386 cmbCountry->insertItem( tr ( "Panama" ) ); 386 cmbCountry->insertItem( tr ( "Panama" ) );
387 cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); 387 cmbCountry->insertItem( tr ( "Papua New Guinea" ) );
388 cmbCountry->insertItem( tr ( "Paraguay" ) ); 388 cmbCountry->insertItem( tr ( "Paraguay" ) );
389 cmbCountry->insertItem( tr ( "Peru" ) ); 389 cmbCountry->insertItem( tr ( "Peru" ) );
390 cmbCountry->insertItem( tr ( "Philippines" ) ); 390 cmbCountry->insertItem( tr ( "Philippines" ) );
391 cmbCountry->insertItem( tr ( "Pitcairn" ) ); 391 cmbCountry->insertItem( tr ( "Pitcairn" ) );
392 cmbCountry->insertItem( tr ( "Poland" ) ); 392 cmbCountry->insertItem( tr ( "Poland" ) );
393 cmbCountry->insertItem( tr ( "Portugal" ) ); 393 cmbCountry->insertItem( tr ( "Portugal" ) );
394 cmbCountry->insertItem( tr ( "Puerto Rico" ) ); 394 cmbCountry->insertItem( tr ( "Puerto Rico" ) );
395 cmbCountry->insertItem( tr ( "Qatar" ) ); 395 cmbCountry->insertItem( tr ( "Qatar" ) );
396 cmbCountry->insertItem( tr ( "Reunion" ) ); 396 cmbCountry->insertItem( tr ( "Reunion" ) );
397 cmbCountry->insertItem( tr ( "Romania" ) ); 397 cmbCountry->insertItem( tr ( "Romania" ) );
398 cmbCountry->insertItem( tr ( "Russia" ) ); 398 cmbCountry->insertItem( tr ( "Russia" ) );
399 cmbCountry->insertItem( tr ( "Rwanda" ) ); 399 cmbCountry->insertItem( tr ( "Rwanda" ) );
400 cmbCountry->insertItem( tr ( "Saint Lucia" ) ); 400 cmbCountry->insertItem( tr ( "Saint Lucia" ) );
401 cmbCountry->insertItem( tr ( "Samoa" ) ); 401 cmbCountry->insertItem( tr ( "Samoa" ) );
402 cmbCountry->insertItem( tr ( "San Marino" ) ); 402 cmbCountry->insertItem( tr ( "San Marino" ) );
403 cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); 403 cmbCountry->insertItem( tr ( "Saudi Arabia" ) );
404 cmbCountry->insertItem( tr ( "Senegal" ) ); 404 cmbCountry->insertItem( tr ( "Senegal" ) );
405 cmbCountry->insertItem( tr ( "Seychelles" ) ); 405 cmbCountry->insertItem( tr ( "Seychelles" ) );
406 cmbCountry->insertItem( tr ( "Sierra Leone" ) ); 406 cmbCountry->insertItem( tr ( "Sierra Leone" ) );
407 cmbCountry->insertItem( tr ( "Singapore" ) ); 407 cmbCountry->insertItem( tr ( "Singapore" ) );
408 cmbCountry->insertItem( tr ( "Slovakia" ) ); 408 cmbCountry->insertItem( tr ( "Slovakia" ) );
409 cmbCountry->insertItem( tr ( "Slovenia" ) ); 409 cmbCountry->insertItem( tr ( "Slovenia" ) );
410 cmbCountry->insertItem( tr ( "Solomon Islands" ) ); 410 cmbCountry->insertItem( tr ( "Solomon Islands" ) );
411 cmbCountry->insertItem( tr ( "Somalia" ) ); 411 cmbCountry->insertItem( tr ( "Somalia" ) );
412 cmbCountry->insertItem( tr ( "South Africa" ) ); 412 cmbCountry->insertItem( tr ( "South Africa" ) );
413 cmbCountry->insertItem( tr ( "Spain" ) ); 413 cmbCountry->insertItem( tr ( "Spain" ) );
414 cmbCountry->insertItem( tr ( "Sri Lanka" ) ); 414 cmbCountry->insertItem( tr ( "Sri Lanka" ) );
415 cmbCountry->insertItem( tr ( "St. Helena" ) ); 415 cmbCountry->insertItem( tr ( "St. Helena" ) );
416 cmbCountry->insertItem( tr ( "Sudan" ) ); 416 cmbCountry->insertItem( tr ( "Sudan" ) );
417 cmbCountry->insertItem( tr ( "Suriname" ) ); 417 cmbCountry->insertItem( tr ( "Suriname" ) );
418 cmbCountry->insertItem( tr ( "Swaziland" ) ); 418 cmbCountry->insertItem( tr ( "Swaziland" ) );
419 cmbCountry->insertItem( tr ( "Sweden" ) ); 419 cmbCountry->insertItem( tr ( "Sweden" ) );
420 cmbCountry->insertItem( tr ( "Switzerland" ) ); 420 cmbCountry->insertItem( tr ( "Switzerland" ) );
421 cmbCountry->insertItem( tr ( "Taiwan" ) ); 421 cmbCountry->insertItem( tr ( "Taiwan" ) );
422 cmbCountry->insertItem( tr ( "Tajikistan" ) ); 422 cmbCountry->insertItem( tr ( "Tajikistan" ) );
423 cmbCountry->insertItem( tr ( "Tanzania" ) ); 423 cmbCountry->insertItem( tr ( "Tanzania" ) );
424 cmbCountry->insertItem( tr ( "Thailand" ) ); 424 cmbCountry->insertItem( tr ( "Thailand" ) );
425 cmbCountry->insertItem( tr ( "Togo" ) ); 425 cmbCountry->insertItem( tr ( "Togo" ) );
426 cmbCountry->insertItem( tr ( "Tokelau" ) ); 426 cmbCountry->insertItem( tr ( "Tokelau" ) );
427 cmbCountry->insertItem( tr ( "Tonga" ) ); 427 cmbCountry->insertItem( tr ( "Tonga" ) );
428 cmbCountry->insertItem( tr ( "Tunisia" ) ); 428 cmbCountry->insertItem( tr ( "Tunisia" ) );
429 cmbCountry->insertItem( tr ( "Turkey" ) ); 429 cmbCountry->insertItem( tr ( "Turkey" ) );
430 cmbCountry->insertItem( tr ( "Turkmenistan" ) ); 430 cmbCountry->insertItem( tr ( "Turkmenistan" ) );
431 cmbCountry->insertItem( tr ( "Tuvalu" ) ); 431 cmbCountry->insertItem( tr ( "Tuvalu" ) );
432 cmbCountry->insertItem( tr ( "Uganda" ) ); 432 cmbCountry->insertItem( tr ( "Uganda" ) );
433 cmbCountry->insertItem( tr ( "Ukraine" ) ); 433 cmbCountry->insertItem( tr ( "Ukraine" ) );
434 cmbCountry->insertItem( tr ( "Uruguay" ) ); 434 cmbCountry->insertItem( tr ( "Uruguay" ) );
435 cmbCountry->insertItem( tr ( "Uzbekistan" ) ); 435 cmbCountry->insertItem( tr ( "Uzbekistan" ) );
436 cmbCountry->insertItem( tr ( "Vanuatu" ) ); 436 cmbCountry->insertItem( tr ( "Vanuatu" ) );
437 cmbCountry->insertItem( tr ( "Venezuela" ) ); 437 cmbCountry->insertItem( tr ( "Venezuela" ) );
438 cmbCountry->insertItem( tr ( "Viet Nam" ) ); 438 cmbCountry->insertItem( tr ( "Viet Nam" ) );
439 cmbCountry->insertItem( tr ( "Virgin Islands" ) ); 439 cmbCountry->insertItem( tr ( "Virgin Islands" ) );
440 cmbCountry->insertItem( tr ( "Western Sahara" ) ); 440 cmbCountry->insertItem( tr ( "Western Sahara" ) );
441 cmbCountry->insertItem( tr ( "Yemen" ) ); 441 cmbCountry->insertItem( tr ( "Yemen" ) );
442 cmbCountry->insertItem( tr ( "Yugoslavia" ) ); 442 cmbCountry->insertItem( tr ( "Yugoslavia" ) );
443 cmbCountry->insertItem( tr ( "Zambia" ) ); 443 cmbCountry->insertItem( tr ( "Zambia" ) );
444 cmbCountry->insertItem( tr ( "Zimbabwe" ) ); 444 cmbCountry->insertItem( tr ( "Zimbabwe" ) );
445 if (cmbCountry->listBox()!=0) 445 if (cmbCountry->listBox()!=0)
446 cmbCountry->listBox()->sort(); 446 cmbCountry->listBox()->sort();
447 447
448 cmbCountry->setMaximumWidth( 135 ); 448 cmbCountry->setMaximumWidth( 135 );
449 449
450 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); 450 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 );
451 451
452 cmbChooserField4 = new QComboBox( FALSE, container ); 452 cmbChooserField4 = new QComboBox( FALSE, container );
453 cmbChooserField4->setMaximumWidth( 90 ); 453 cmbChooserField4->setMaximumWidth( 90 );
454 gl->addWidget( cmbChooserField4, 6, 0 ); 454 gl->addWidget( cmbChooserField4, 6, 0 );
455 txtChooserField4 = new QLineEdit( container ); 455 txtChooserField4 = new QLineEdit( container );
456 gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 ); 456 gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 );
457 457
458 QSpacerItem *space = new QSpacerItem(1,1, 458 QSpacerItem *space = new QSpacerItem(1,1,
459 QSizePolicy::Maximum, 459 QSizePolicy::Maximum,
460 QSizePolicy::MinimumExpanding ); 460 QSizePolicy::MinimumExpanding );
461 gl->addItem( space, 7, 0 ); 461 gl->addItem( space, 7, 0 );
462 462
463 tabMain->insertTab( tabViewport, tr( "Address" ) ); 463 tabMain->insertTab( tabViewport, tr( "Address" ) );
464 464
465 tabViewport = new QWidget ( tabMain ); 465 tabViewport = new QWidget ( tabMain );
466 466
467 vb = new QVBoxLayout( tabViewport ); 467 vb = new QVBoxLayout( tabViewport );
468 468
469 svDetails = new QScrollView( tabViewport ); 469 svDetails = new QScrollView( tabViewport );
470 vb->addWidget( svDetails, 0, 0 ); 470 vb->addWidget( svDetails, 0, 0 );
471 svDetails->setResizePolicy( QScrollView::AutoOneFit ); 471 svDetails->setResizePolicy( QScrollView::AutoOneFit );
472 svDetails->setFrameStyle( QFrame::NoFrame ); 472 svDetails->setFrameStyle( QFrame::NoFrame );
473 473
474 container = new QWidget( svDetails->viewport() ); 474 container = new QWidget( svDetails->viewport() );
475 svDetails->addChild( container ); 475 svDetails->addChild( container );
476 476
477 gl = new QGridLayout( container, 1, 2, 2, 4 ); 477 gl = new QGridLayout( container, 1, 2, 2, 4 );
478 478
479 int counter = 0; 479 int counter = 0;
480 480
481 // Birthday 481 // Birthday
482 QHBox* hBox = new QHBox( container ); 482 QHBox* hBox = new QHBox( container );
483 l = new QLabel( tr("Birthday"), container ); 483 l = new QLabel( tr("Birthday"), container );
484 gl->addWidget( l, counter, 0 ); 484 gl->addWidget( l, counter, 0 );
485 485
486 QPopupMenu* m1 = new QPopupMenu( container ); 486 QPopupMenu* m1 = new QPopupMenu( container );
487 birthdayPicker = new DateBookMonth( m1, 0, TRUE ); 487 birthdayPicker = new DateBookMonth( m1, 0, TRUE );
488 m1->insertItem( birthdayPicker ); 488 m1->insertItem( birthdayPicker );
489 489
490 birthdayButton= new QToolButton( hBox, "buttonStart" ); 490 birthdayButton= new QToolButton( hBox, "buttonStart" );
491 birthdayButton->setPopup( m1 ); 491 birthdayButton->setPopup( m1 );
492 birthdayButton->setPopupDelay(0); 492 birthdayButton->setPopupDelay(0);
493 493
494 QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), 494 QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
495 tr( "Delete" ), 495 tr( "Delete" ),
496 hBox, 0 ); 496 hBox, 0 );
497 497
498 gl->addWidget( hBox, counter , 1 ); 498 gl->addWidget( hBox, counter , 1 );
499 499
500 connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), 500 connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ),
501 this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); 501 this, SLOT( slotBirthdayDateChanged( int, int, int ) ) );
502 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); 502 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) );
503 503
504 ++counter; 504 ++counter;
505 505
506 // Anniversary 506 // Anniversary
507 hBox = new QHBox( container ); 507 hBox = new QHBox( container );
508 l = new QLabel( tr("Anniversary"), container ); 508 l = new QLabel( tr("Anniversary"), container );
509 gl->addWidget( l, counter, 0 ); 509 gl->addWidget( l, counter, 0 );
510 510
511 m1 = new QPopupMenu( container ); 511 m1 = new QPopupMenu( container );
512 anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); 512 anniversaryPicker = new DateBookMonth( m1, 0, TRUE );
513 m1->insertItem( anniversaryPicker ); 513 m1->insertItem( anniversaryPicker );
514 514
515 anniversaryButton= new QToolButton( hBox, "buttonStart" ); 515 anniversaryButton= new QToolButton( hBox, "buttonStart" );
516 anniversaryButton->setPopup( m1 ); 516 anniversaryButton->setPopup( m1 );
517 anniversaryButton->setPopupDelay(0); 517 anniversaryButton->setPopupDelay(0);
518 518
519 deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), 519 deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
520 tr( "Delete" ), 520 tr( "Delete" ),
521 hBox, 0 ); 521 hBox, 0 );
522 gl->addWidget( hBox, counter , 1 ); 522 gl->addWidget( hBox, counter , 1 );
523 523
524 connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), 524 connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ),
525 this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); 525 this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) );
526 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); 526 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) );
527 527
528 ++counter; 528 ++counter;
529 529
530 // Gender 530 // Gender
531 l = new QLabel( tr("Gender"), container ); 531 l = new QLabel( tr("Gender"), container );
532 gl->addWidget( l, counter, 0 ); 532 gl->addWidget( l, counter, 0 );
533 cmbGender = new QComboBox( container ); 533 cmbGender = new QComboBox( container );
534 cmbGender->insertItem( "", 0 ); 534 cmbGender->insertItem( "", 0 );
535 cmbGender->insertItem( tr("Male"), 1); 535 cmbGender->insertItem( tr("Male"), 1);
536 cmbGender->insertItem( tr("Female"), 2); 536 cmbGender->insertItem( tr("Female"), 2);
537 gl->addWidget( cmbGender, counter, 1 ); 537 gl->addWidget( cmbGender, counter, 1 );
538 538
539 ++counter; 539 ++counter;
540 540
541 // Create Labels and lineedit fields for every dynamic entry 541 // Create Labels and lineedit fields for every dynamic entry
542 QStringList::ConstIterator it = slDynamicEntries.begin(); 542 QStringList::ConstIterator it = slDynamicEntries.begin();
543 QStringList::ConstIterator trit = trlDynamicEntries.begin(); 543 QStringList::ConstIterator trit = trlDynamicEntries.begin();
544 for (i = counter; it != slDynamicEntries.end(); i++, ++it, ++trit) { 544 for (i = counter; it != slDynamicEntries.end(); i++, ++it, ++trit) {
545 545
546 if (((*it) == "Anniversary") || 546 if (((*it) == "Anniversary") ||
547 ((*it) == "Birthday")|| ((*it) == "Gender")) continue; 547 ((*it) == "Birthday")|| ((*it) == "Gender")) continue;
548 548
549 l = new QLabel( (*it).utf8() , container ); 549 l = new QLabel( (*it).utf8() , container );
550 listName.append( l ); 550 listName.append( l );
551 gl->addWidget( l, i, 0 ); 551 gl->addWidget( l, i, 0 );
552 QLineEdit *e = new QLineEdit( container ); 552 QLineEdit *e = new QLineEdit( container );
553 listValue.append( e ); 553 listValue.append( e );
554 gl->addWidget( e, i, 1); 554 gl->addWidget( e, i, 1);
555 } 555 }
556 // Fill labels with names.. 556 // Fill labels with names..
557 //loadFields(); 557 //loadFields();
558 558
559 559
560 tabMain->insertTab( tabViewport, tr( "Details" ) ); 560 tabMain->insertTab( tabViewport, tr( "Details" ) );
561 561
562 dlgNote = new QDialog( this, "Note Dialog", TRUE ); 562 dlgNote = new QDialog( this, "Note Dialog", TRUE );
563 dlgNote->setCaption( tr("Enter Note") ); 563 dlgNote->setCaption( tr("Enter Note") );
564 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); 564 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote );
565 txtNote = new QMultiLineEdit( dlgNote ); 565 txtNote = new QMultiLineEdit( dlgNote );
566 vbNote->addWidget( txtNote ); 566 vbNote->addWidget( txtNote );
567 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); 567 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) );
568 568
569 dlgName = new QDialog( this, "Name Dialog", TRUE ); 569 dlgName = new QDialog( this, "Name Dialog", TRUE );
570 dlgName->setCaption( tr("Edit Name") ); 570 dlgName->setCaption( tr("Edit Name") );
571 gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); 571 gl = new QGridLayout( dlgName, 5, 2, 2, 3 );
572 572
573 l = new QLabel( tr("First Name"), dlgName ); 573 l = new QLabel( tr("First Name"), dlgName );
574 gl->addWidget( l, 0, 0 ); 574 gl->addWidget( l, 0, 0 );
575 txtFirstName = new QLineEdit( dlgName ); 575 txtFirstName = new QLineEdit( dlgName );
576 gl->addWidget( txtFirstName, 0, 1 ); 576 gl->addWidget( txtFirstName, 0, 1 );
577 577
578 l = new QLabel( tr("Middle Name"), dlgName ); 578 l = new QLabel( tr("Middle Name"), dlgName );
579 gl->addWidget( l, 1, 0 ); 579 gl->addWidget( l, 1, 0 );
580 txtMiddleName = new QLineEdit( dlgName ); 580 txtMiddleName = new QLineEdit( dlgName );
581 gl->addWidget( txtMiddleName, 1, 1 ); 581 gl->addWidget( txtMiddleName, 1, 1 );
582 582
583 l = new QLabel( tr("Last Name"), dlgName ); 583 l = new QLabel( tr("Last Name"), dlgName );
584 gl->addWidget( l, 2, 0 ); 584 gl->addWidget( l, 2, 0 );
585 txtLastName = new QLineEdit( dlgName ); 585 txtLastName = new QLineEdit( dlgName );
586 gl->addWidget( txtLastName, 2, 1 ); 586 gl->addWidget( txtLastName, 2, 1 );
587 587
588 l = new QLabel( tr("Suffix"), dlgName ); 588 l = new QLabel( tr("Suffix"), dlgName );
589 gl->addWidget( l, 3, 0 ); 589 gl->addWidget( l, 3, 0 );
590 txtSuffix = new QLineEdit( dlgName ); 590 txtSuffix = new QLineEdit( dlgName );
591 gl->addWidget( txtSuffix, 3, 1 ); 591 gl->addWidget( txtSuffix, 3, 1 );
592 space = new QSpacerItem(1,1, 592 space = new QSpacerItem(1,1,
593 QSizePolicy::Maximum, 593 QSizePolicy::Maximum,
594 QSizePolicy::MinimumExpanding ); 594 QSizePolicy::MinimumExpanding );
595 gl->addItem( space, 4, 0 ); 595 gl->addItem( space, 4, 0 );
596 596
597 cmbChooserField1->insertStringList( trlChooserNames ); 597 cmbChooserField1->insertStringList( trlChooserNames );
598 cmbChooserField2->insertStringList( trlChooserNames ); 598 cmbChooserField2->insertStringList( trlChooserNames );
599 cmbChooserField3->insertStringList( trlChooserNames ); 599 cmbChooserField3->insertStringList( trlChooserNames );
600 cmbChooserField4->insertStringList( trlChooserNames ); 600 cmbChooserField4->insertStringList( trlChooserNames );
601 601
602 cmbChooserField1->setCurrentItem( 0 ); 602 cmbChooserField1->setCurrentItem( 0 );
603 cmbChooserField2->setCurrentItem( 1 ); 603 cmbChooserField2->setCurrentItem( 1 );
604 cmbChooserField3->setCurrentItem( 2 ); 604 cmbChooserField3->setCurrentItem( 2 );
605 605
606 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 606 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
607 607
608 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); 608 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) );
609 609
610 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), 610 connect( txtChooserField1, SIGNAL(textChanged(const QString &)),
611 this, SLOT(slotChooser1Change(const QString &)) ); 611 this, SLOT(slotChooser1Change(const QString &)) );
612 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), 612 connect( txtChooserField2, SIGNAL(textChanged(const QString &)),
613 this, SLOT(slotChooser2Change(const QString &)) ); 613 this, SLOT(slotChooser2Change(const QString &)) );
614 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), 614 connect( txtChooserField3, SIGNAL(textChanged(const QString &)),
615 this, SLOT(slotChooser3Change(const QString &)) ); 615 this, SLOT(slotChooser3Change(const QString &)) );
616 connect( txtChooserField4, SIGNAL(textChanged(const QString &)), 616 connect( txtChooserField4, SIGNAL(textChanged(const QString &)),
617 this, SLOT(slotChooser4Change(const QString &)) ); 617 this, SLOT(slotChooser4Change(const QString &)) );
618 connect( txtAddress, SIGNAL(textChanged(const QString &)), 618 connect( txtAddress, SIGNAL(textChanged(const QString &)),
619 this, SLOT(slotAddressChange(const QString &)) ); 619 this, SLOT(slotAddressChange(const QString &)) );
620 connect( txtCity, SIGNAL(textChanged(const QString &)), 620 connect( txtCity, SIGNAL(textChanged(const QString &)),
621 this, SLOT(slotCityChange(const QString &)) ); 621 this, SLOT(slotCityChange(const QString &)) );
622 connect( txtState, SIGNAL(textChanged(const QString &)), 622 connect( txtState, SIGNAL(textChanged(const QString &)),
623 this, SLOT(slotStateChange(const QString &)) ); 623 this, SLOT(slotStateChange(const QString &)) );
624 connect( txtZip, SIGNAL(textChanged(const QString &)), 624 connect( txtZip, SIGNAL(textChanged(const QString &)),
625 this, SLOT(slotZipChange(const QString &)) ); 625 this, SLOT(slotZipChange(const QString &)) );
626 connect( cmbCountry, SIGNAL(textChanged(const QString &)), 626 connect( cmbCountry, SIGNAL(textChanged(const QString &)),
627 this, SLOT(slotCountryChange(const QString &)) ); 627 this, SLOT(slotCountryChange(const QString &)) );
628 connect( cmbCountry, SIGNAL(activated(const QString &)), 628 connect( cmbCountry, SIGNAL(activated(const QString &)),
629 this, SLOT(slotCountryChange(const QString &)) ); 629 this, SLOT(slotCountryChange(const QString &)) );
630 connect( cmbChooserField1, SIGNAL(activated(int)), 630 connect( cmbChooserField1, SIGNAL(activated(int)),
631 this, SLOT(slotCmbChooser1Change(int)) ); 631 this, SLOT(slotCmbChooser1Change(int)) );
632 connect( cmbChooserField2, SIGNAL(activated(int)), 632 connect( cmbChooserField2, SIGNAL(activated(int)),
633 this, SLOT(slotCmbChooser2Change(int)) ); 633 this, SLOT(slotCmbChooser2Change(int)) );
634 connect( cmbChooserField3, SIGNAL(activated(int)), 634 connect( cmbChooserField3, SIGNAL(activated(int)),
635 this, SLOT(slotCmbChooser3Change(int)) ); 635 this, SLOT(slotCmbChooser3Change(int)) );
636 connect( cmbChooserField4, SIGNAL(activated(int)), 636 connect( cmbChooserField4, SIGNAL(activated(int)),
637 this, SLOT(slotCmbChooser4Change(int)) ); 637 this, SLOT(slotCmbChooser4Change(int)) );
638 connect( cmbAddress, SIGNAL(activated(int)), 638 connect( cmbAddress, SIGNAL(activated(int)),
639 this, SLOT(slotAddressTypeChange(int)) ); 639 this, SLOT(slotAddressTypeChange(int)) );
640 640
641 new QPEDialogListener(this); 641 new QPEDialogListener(this);
642 642
643 setPersonalView ( m_personalView ); 643 setPersonalView ( m_personalView );
644} 644}
645 645
646void ContactEditor::defaultEmailChanged(int i){ 646void ContactEditor::defaultEmailChanged(int i){
647 qDebug("defaultEmailChanged"); 647 qDebug("defaultEmailChanged");
648 int index = cmbChooserField1->currentItem(); 648 int index = cmbChooserField1->currentItem();
649 slChooserValues[index] = cmbDefaultEmail->text(i); 649 slChooserValues[index] = cmbDefaultEmail->text(i);
650 650
651} 651}
652 652
653void ContactEditor::populateDefaultEmailCmb(){ 653void ContactEditor::populateDefaultEmailCmb(){
654 cmbDefaultEmail->clear(); 654 cmbDefaultEmail->clear();
655 cmbDefaultEmail->insertStringList(emails); 655 cmbDefaultEmail->insertStringList(emails);
656 for ( int i = 0; i < cmbDefaultEmail->count(); i++){ 656 for ( int i = 0; i < cmbDefaultEmail->count(); i++){
657 qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<",cmbDefaultEmail->text( i ).latin1(),defaultEmail.latin1()); 657 qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<",cmbDefaultEmail->text( i ).latin1(),defaultEmail.latin1());
658 if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ 658 if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){
659 cmbDefaultEmail->setCurrentItem( i ); 659 cmbDefaultEmail->setCurrentItem( i );
660 qDebug("set"); 660 qDebug("set");
661 } 661 }
662 } 662 }
663} 663}
664 664
665void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid, int widgetPos ) { 665void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid, int widgetPos ) {
666 QString type = slChooserNames[index]; 666 QString type = slChooserNames[index];
667 qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i",type.latin1(),textChanged.latin1(), index, widgetPos ); 667 qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i",type.latin1(),textChanged.latin1(), index, widgetPos );
668 if ( type == "Default Email"){ 668 if ( type == "Default Email"){
669 defaultEmail = textChanged; 669 defaultEmail = textChanged;
670 if (cmbDefaultEmail) delete cmbDefaultEmail; 670 if (cmbDefaultEmail){
671 delete cmbDefaultEmail;
672 cmbDefaultEmail = 0l;
673 }
671 cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); 674 cmbDefaultEmail = new QComboBox(inputWid->parentWidget());
672 cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); 675 cmbDefaultEmail->setGeometry(inputWid->frameGeometry());
673 cmbDefaultEmail->show(); 676 cmbDefaultEmail->show();
674 populateDefaultEmailCmb(); 677 populateDefaultEmailCmb();
675 connect(cmbDefaultEmail,SIGNAL(activated(int)), 678 connect(cmbDefaultEmail,SIGNAL(activated(int)),
676 SLOT(defaultEmailChanged(int))); 679 SLOT(defaultEmailChanged(int)));
677 defaultEmailChooserPosition = widgetPos; 680 defaultEmailChooserPosition = widgetPos;
678 }else if (defaultEmailChooserPosition == widgetPos){ 681 }else if (defaultEmailChooserPosition == widgetPos){
679 qDebug("cmbDefaultEmail->hide()"); 682 qDebug("cmbDefaultEmail->hide()");
680 if (cmbDefaultEmail) cmbDefaultEmail->hide(); 683 if (cmbDefaultEmail) cmbDefaultEmail->hide();
681 widgetPos=-1; 684 widgetPos=-1;
682 }else if (type == "Emails"){ 685 }else if (type == "Emails"){
683 qDebug("emails"); 686 qDebug("emails");
684 QString de; 687 QString de;
685 emails = QStringList::split (",", textChanged ); 688 emails = QStringList::split (",", textChanged );
686 689
687 populateDefaultEmailCmb(); 690 if ( cmbDefaultEmail )
691 populateDefaultEmailCmb();
688 } 692 }
689 693
690 694
691 695
692 slChooserValues[index] = textChanged; 696 slChooserValues[index] = textChanged;
693 697
694} 698}
695 699
696void ContactEditor::slotChooser1Change( const QString &textChanged ) { 700void ContactEditor::slotChooser1Change( const QString &textChanged ) {
697 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); 701 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1);
698} 702}
699 703
700void ContactEditor::slotChooser2Change( const QString &textChanged ) { 704void ContactEditor::slotChooser2Change( const QString &textChanged ) {
701 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); 705 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2);
702 706
703} 707}
704 708
705void ContactEditor::slotChooser3Change( const QString &textChanged ) { 709void ContactEditor::slotChooser3Change( const QString &textChanged ) {
706 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); 710 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3);
707} 711}
708 712
709void ContactEditor::slotChooser4Change( const QString &textChanged ) { 713void ContactEditor::slotChooser4Change( const QString &textChanged ) {
710 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); 714 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4);
711} 715}
712 716
713void ContactEditor::slotAddressChange( const QString &textChanged ) { 717void ContactEditor::slotAddressChange( const QString &textChanged ) {
714 718
715 if ( cmbAddress->currentItem() == 0 ) { 719 if ( cmbAddress->currentItem() == 0 ) {
716 slBusinessAddress[0] = textChanged; 720 slBusinessAddress[0] = textChanged;
717 } else { 721 } else {
718 slHomeAddress[0] = textChanged; 722 slHomeAddress[0] = textChanged;
719 } 723 }
720} 724}
721 725
722void ContactEditor::slotAddress2Change( const QString &textChanged ) { 726void ContactEditor::slotAddress2Change( const QString &textChanged ) {
723 727
724 if ( cmbAddress->currentItem() == 0 ) { 728 if ( cmbAddress->currentItem() == 0 ) {
725 slBusinessAddress[1] = textChanged; 729 slBusinessAddress[1] = textChanged;
726 } else { 730 } else {
727 slHomeAddress[1] = textChanged; 731 slHomeAddress[1] = textChanged;
728 } 732 }
729} 733}
730 734
731void ContactEditor::slotPOBoxChange( const QString &textChanged ) { 735void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
732 736
733 if ( cmbAddress->currentItem() == 0 ) { 737 if ( cmbAddress->currentItem() == 0 ) {
734 slBusinessAddress[2] = textChanged; 738 slBusinessAddress[2] = textChanged;
735 } else { 739 } else {
736 slHomeAddress[2] = textChanged; 740 slHomeAddress[2] = textChanged;
737 } 741 }
738} 742}
739 743
740void ContactEditor::slotCityChange( const QString &textChanged ) { 744void ContactEditor::slotCityChange( const QString &textChanged ) {
741 745
742 if ( cmbAddress->currentItem() == 0 ) { 746 if ( cmbAddress->currentItem() == 0 ) {
743 slBusinessAddress[3] = textChanged; 747 slBusinessAddress[3] = textChanged;
744 } else { 748 } else {
745 slHomeAddress[3] = textChanged; 749 slHomeAddress[3] = textChanged;
746 } 750 }
747} 751}
748 752
749void ContactEditor::slotStateChange( const QString &textChanged ) { 753void ContactEditor::slotStateChange( const QString &textChanged ) {
750 754
751 755
752 if ( cmbAddress->currentItem() == 0 ) { 756 if ( cmbAddress->currentItem() == 0 ) {
753 slBusinessAddress[4] = textChanged; 757 slBusinessAddress[4] = textChanged;
754 } else { 758 } else {
755 slHomeAddress[4] = textChanged; 759 slHomeAddress[4] = textChanged;
756 } 760 }
757} 761}
758 762
759void ContactEditor::slotZipChange( const QString &textChanged ) { 763void ContactEditor::slotZipChange( const QString &textChanged ) {
760 764
761 if ( cmbAddress->currentItem() == 0 ) { 765 if ( cmbAddress->currentItem() == 0 ) {
762 slBusinessAddress[5] = textChanged; 766 slBusinessAddress[5] = textChanged;
763 } else { 767 } else {
764 slHomeAddress[5] = textChanged; 768 slHomeAddress[5] = textChanged;
765 } 769 }
766} 770}
767 771
768void ContactEditor::slotCountryChange( const QString &textChanged ) { 772void ContactEditor::slotCountryChange( const QString &textChanged ) {
769 773
770 if ( cmbAddress->currentItem() == 0 ) { 774 if ( cmbAddress->currentItem() == 0 ) {
771 slBusinessAddress[6] = textChanged; 775 slBusinessAddress[6] = textChanged;
772 } else { 776 } else {
773 slHomeAddress[6] = textChanged; 777 slHomeAddress[6] = textChanged;
774 } 778 }
775} 779}
776 780
777 781
778void ContactEditor::slotCmbChooser1Change( int index ) { 782void ContactEditor::slotCmbChooser1Change( int index ) {
779 783
780 txtChooserField1->setText( slChooserValues[index] ); 784 txtChooserField1->setText( slChooserValues[index] );
781 txtChooserField1->setFocus(); 785 txtChooserField1->setFocus();
782} 786}
783 787
784void ContactEditor::slotCmbChooser2Change( int index ) { 788void ContactEditor::slotCmbChooser2Change( int index ) {
785 789
786 txtChooserField2->setText( slChooserValues[index] ); 790 txtChooserField2->setText( slChooserValues[index] );
787 txtChooserField2->setFocus(); 791 txtChooserField2->setFocus();
788} 792}
789 793
790void ContactEditor::slotCmbChooser3Change( int index ) { 794void ContactEditor::slotCmbChooser3Change( int index ) {
791 795
792 txtChooserField3->setText( slChooserValues[index] ); 796 txtChooserField3->setText( slChooserValues[index] );
793 txtChooserField3->setFocus(); 797 txtChooserField3->setFocus();
794 798
795} 799}
796 800
797void ContactEditor::slotCmbChooser4Change( int index ) { 801void ContactEditor::slotCmbChooser4Change( int index ) {
798 802
799 txtChooserField4->setText( slChooserValues[index] ); 803 txtChooserField4->setText( slChooserValues[index] );
800 txtChooserField4->setFocus(); 804 txtChooserField4->setFocus();
801 805
802} 806}
803 807
804void ContactEditor::slotAddressTypeChange( int index ) { 808void ContactEditor::slotAddressTypeChange( int index ) {
805 809
806 if ( index == 0 ) { 810 if ( index == 0 ) {
807 811
808 txtAddress->setText( slBusinessAddress[0] ); 812 txtAddress->setText( slBusinessAddress[0] );
809 //txtAddress2->setText( (*slBusinessAddress)[1] ); 813 //txtAddress2->setText( (*slBusinessAddress)[1] );
810 //txtPOBox->setText( (*slBusinessAddress)[2] ); 814 //txtPOBox->setText( (*slBusinessAddress)[2] );
811 txtCity->setText( slBusinessAddress[3] ); 815 txtCity->setText( slBusinessAddress[3] );
812 txtState->setText( slBusinessAddress[4] ); 816 txtState->setText( slBusinessAddress[4] );
813 txtZip->setText( slBusinessAddress[5] ); 817 txtZip->setText( slBusinessAddress[5] );
814 QLineEdit *txtTmp = cmbCountry->lineEdit(); 818 QLineEdit *txtTmp = cmbCountry->lineEdit();
815 txtTmp->setText( slBusinessAddress[6] ); 819 txtTmp->setText( slBusinessAddress[6] );
816 820
817 } else { 821 } else {
818 822
819 txtAddress->setText( slHomeAddress[0] ); 823 txtAddress->setText( slHomeAddress[0] );
820 //txtAddress2->setText( (*slHomeAddress)[1] ); 824 //txtAddress2->setText( (*slHomeAddress)[1] );
821 //txtPOBox->setText( (*slHomeAddress)[2] ); 825 //txtPOBox->setText( (*slHomeAddress)[2] );
822 txtCity->setText( slHomeAddress[3] ); 826 txtCity->setText( slHomeAddress[3] );
823 txtState->setText( slHomeAddress[4] ); 827 txtState->setText( slHomeAddress[4] );
824 txtZip->setText( slHomeAddress[5] ); 828 txtZip->setText( slHomeAddress[5] );
825 QLineEdit *txtTmp = cmbCountry->lineEdit(); 829 QLineEdit *txtTmp = cmbCountry->lineEdit();
826 txtTmp->setText( slHomeAddress[6] ); 830 txtTmp->setText( slHomeAddress[6] );
827 831
828 } 832 }
829 833
830} 834}
831 835
832void ContactEditor::slotFullNameChange( const QString &textChanged ) { 836void ContactEditor::slotFullNameChange( const QString &textChanged ) {
833 837
834 int index = cmbFileAs->currentItem(); 838 int index = cmbFileAs->currentItem();
835 839
836 cmbFileAs->clear(); 840 cmbFileAs->clear();
837 841
838 cmbFileAs->insertItem( parseName( textChanged, 0 ) ); 842 cmbFileAs->insertItem( parseName( textChanged, 0 ) );
839 cmbFileAs->insertItem( parseName( textChanged, 1 ) ); 843 cmbFileAs->insertItem( parseName( textChanged, 1 ) );
840 cmbFileAs->insertItem( parseName( textChanged, 2 ) ); 844 cmbFileAs->insertItem( parseName( textChanged, 2 ) );
841 cmbFileAs->insertItem( parseName( textChanged, 3 ) ); 845 cmbFileAs->insertItem( parseName( textChanged, 3 ) );
842 846
843 cmbFileAs->setCurrentItem( index ); 847 cmbFileAs->setCurrentItem( index );
844 848
845 useFullName = true; 849 useFullName = true;
846 850
847} 851}
848 852
849void ContactEditor::accept() { 853void ContactEditor::accept() {
850 854
851 if ( isEmpty() ) { 855 if ( isEmpty() ) {
852 cleanupFields(); 856 cleanupFields();
853 reject(); 857 reject();
854 } else { 858 } else {
855 saveEntry(); 859 saveEntry();
856 cleanupFields(); 860 cleanupFields();
857 QDialog::accept(); 861 QDialog::accept();
858 } 862 }
859 863
860} 864}
861 865
862void ContactEditor::slotNote() { 866void ContactEditor::slotNote() {
863 867
864 dlgNote->showMaximized(); 868 dlgNote->showMaximized();
865 if ( !dlgNote->exec() ) { 869 if ( !dlgNote->exec() ) {
866 txtNote->setText( ent.notes() ); 870 txtNote->setText( ent.notes() );
867 } 871 }
868} 872}
869 873
870void ContactEditor::slotName() { 874void ContactEditor::slotName() {
871 875
872 QString tmpName; 876 QString tmpName;
873 if (useFullName) { 877 if (useFullName) {
874 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); 878 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) );
875 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); 879 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) );
876 txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); 880 txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
877 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); 881 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
878 } 882 }
879 dlgName->showMaximized(); 883 dlgName->showMaximized();
880 if ( dlgName->exec() ) { 884 if ( dlgName->exec() ) {
881 885
882 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); 886 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text();
883 txtFullName->setText( tmpName.simplifyWhiteSpace() ); 887 txtFullName->setText( tmpName.simplifyWhiteSpace() );
884 slotFullNameChange( txtFullName->text() ); 888 slotFullNameChange( txtFullName->text() );
885 useFullName = false; 889 useFullName = false;
886 } 890 }
887 891
888} 892}
889 893
890void ContactEditor::setNameFocus() { 894void ContactEditor::setNameFocus() {
891 895
892 txtFullName->setFocus(); 896 txtFullName->setFocus();
893 897
894} 898}
895 899
896bool ContactEditor::isEmpty() { 900bool ContactEditor::isEmpty() {
897 // Test and see if the record should be saved. 901 // Test and see if the record should be saved.
898 // More strict than the original qtopia, needs name or fileas to save 902 // More strict than the original qtopia, needs name or fileas to save
899 903
900 QString t = txtFullName->text(); 904 QString t = txtFullName->text();
901 if ( !t.isEmpty() && containsAlphaNum( t ) ) 905 if ( !t.isEmpty() && containsAlphaNum( t ) )
902 return false; 906 return false;
903 907
904 t = cmbFileAs->currentText(); 908 t = cmbFileAs->currentText();
905 if ( !t.isEmpty() && containsAlphaNum( t ) ) 909 if ( !t.isEmpty() && containsAlphaNum( t ) )
906 return false; 910 return false;
907 911
908 return true; 912 return true;
909 913
910} 914}
911 915
912QString ContactEditor::parseName( const QString fullName, int type ) { 916QString ContactEditor::parseName( const QString fullName, int type ) {
913 917
914 QString simplifiedName( fullName.simplifyWhiteSpace() ); 918 QString simplifiedName( fullName.simplifyWhiteSpace() );
915 QString strFirstName; 919 QString strFirstName;
916 QString strMiddleName; 920 QString strMiddleName;
917 QString strLastName; 921 QString strLastName;
918 QString strSuffix; 922 QString strSuffix;
919 QString strTitle; 923 QString strTitle;
920 int commapos; 924 int commapos;
921 int spCount; 925 int spCount;
922 int spPos; 926 int spPos;
923 int spPos2; 927 int spPos2;
924 928
925 929
926 commapos = simplifiedName.find( ',', 0, TRUE); 930 commapos = simplifiedName.find( ',', 0, TRUE);
927 spCount = simplifiedName.contains( ' ', TRUE ); 931 spCount = simplifiedName.contains( ' ', TRUE );
928 932
929 if ( commapos == -1 ) { 933 if ( commapos == -1 ) {
930 934
931 switch (spCount) { 935 switch (spCount) {
932 case 0: 936 case 0:
933 //return simplifiedName; 937 //return simplifiedName;
934 if (txtLastName->text() != "") { 938 if (txtLastName->text() != "") {
935 strLastName = simplifiedName; 939 strLastName = simplifiedName;
936 break; 940 break;
937 } 941 }
938 if (txtMiddleName->text() != "") { 942 if (txtMiddleName->text() != "") {
939 strMiddleName = simplifiedName; 943 strMiddleName = simplifiedName;
940 break; 944 break;
941 } 945 }
942 if (txtSuffix->text() != "") { 946 if (txtSuffix->text() != "") {
943 strSuffix = simplifiedName; 947 strSuffix = simplifiedName;
944 break; 948 break;
945 } 949 }
946 strFirstName = simplifiedName; 950 strFirstName = simplifiedName;
947 break; 951 break;
948 952
949 case 1: 953 case 1:
950 spPos = simplifiedName.find( ' ', 0, TRUE ); 954 spPos = simplifiedName.find( ' ', 0, TRUE );
951 strFirstName = simplifiedName.left( spPos ); 955 strFirstName = simplifiedName.left( spPos );
952 strLastName = simplifiedName.mid( spPos + 1 ); 956 strLastName = simplifiedName.mid( spPos + 1 );
953 break; 957 break;
954 958
955 case 2: 959 case 2:
956 spPos = simplifiedName.find( ' ', 0, TRUE ); 960 spPos = simplifiedName.find( ' ', 0, TRUE );
957 strFirstName = simplifiedName.left( spPos ); 961 strFirstName = simplifiedName.left( spPos );
958 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 962 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
959 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 963 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
960 strLastName = simplifiedName.mid( spPos2 + 1 ); 964 strLastName = simplifiedName.mid( spPos2 + 1 );
961 break; 965 break;
962 966
963 case 3: 967 case 3:
964 spPos = simplifiedName.find( ' ', 0, TRUE ); 968 spPos = simplifiedName.find( ' ', 0, TRUE );
965 strFirstName = simplifiedName.left( spPos ); 969 strFirstName = simplifiedName.left( spPos );
966 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 970 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
967 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 971 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
968 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 972 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
969 strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 973 strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
970 strSuffix = simplifiedName.mid( spPos + 1 ); 974 strSuffix = simplifiedName.mid( spPos + 1 );
971 break; 975 break;
972 976
973 case 4: 977 case 4:
974 spPos = simplifiedName.find( ' ', 0, TRUE ); 978 spPos = simplifiedName.find( ' ', 0, TRUE );
975 strTitle = simplifiedName.left( spPos ); 979 strTitle = simplifiedName.left( spPos );
976 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 980 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
977 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 981 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
978 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 982 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
979 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 983 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
980 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 984 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
981 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 985 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
982 strSuffix = simplifiedName.mid( spPos2 + 1 ); 986 strSuffix = simplifiedName.mid( spPos2 + 1 );
983 break; 987 break;
984 988
985 default: 989 default:
986 spPos = simplifiedName.find( ' ', 0, TRUE ); 990 spPos = simplifiedName.find( ' ', 0, TRUE );
987 strTitle = simplifiedName.left( spPos ); 991 strTitle = simplifiedName.left( spPos );
988 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 992 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
989 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 993 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
990 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 994 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
991 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 995 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
992 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 996 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
993 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 997 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
994 strSuffix = simplifiedName.mid( spPos2 + 1 ); 998 strSuffix = simplifiedName.mid( spPos2 + 1 );
995 break; 999 break;
996 } 1000 }
997 } else { 1001 } else {
998 simplifiedName.replace( commapos, 1, " " ); 1002 simplifiedName.replace( commapos, 1, " " );
999 simplifiedName = simplifiedName.simplifyWhiteSpace(); 1003 simplifiedName = simplifiedName.simplifyWhiteSpace();
1000 1004
1001 switch (spCount) { 1005 switch (spCount) {
1002 case 0: 1006 case 0:
1003 //return simplifiedName; 1007 //return simplifiedName;
1004 if (txtLastName->text() != "") { 1008 if (txtLastName->text() != "") {
1005 strLastName = simplifiedName; 1009 strLastName = simplifiedName;
1006 break; 1010 break;
1007 } 1011 }
1008 if (txtMiddleName->text() != "") { 1012 if (txtMiddleName->text() != "") {
1009 strMiddleName = simplifiedName; 1013 strMiddleName = simplifiedName;
1010 break; 1014 break;
1011 } 1015 }
1012 if (txtSuffix->text() != "") { 1016 if (txtSuffix->text() != "") {
1013 strSuffix = simplifiedName; 1017 strSuffix = simplifiedName;
1014 break; 1018 break;
1015 } 1019 }
1016 strFirstName = simplifiedName; 1020 strFirstName = simplifiedName;
1017 break; 1021 break;
1018 1022
1019 case 1: 1023 case 1:
1020 spPos = simplifiedName.find( ' ', 0, TRUE ); 1024 spPos = simplifiedName.find( ' ', 0, TRUE );
1021 strLastName = simplifiedName.left( spPos ); 1025 strLastName = simplifiedName.left( spPos );
1022 strFirstName = simplifiedName.mid( spPos + 1 ); 1026 strFirstName = simplifiedName.mid( spPos + 1 );
1023 break; 1027 break;
1024 1028
1025 case 2: 1029 case 2:
1026 spPos = simplifiedName.find( ' ', 0, TRUE ); 1030 spPos = simplifiedName.find( ' ', 0, TRUE );
1027 strLastName = simplifiedName.left( spPos ); 1031 strLastName = simplifiedName.left( spPos );
1028 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1032 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1029 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1033 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1030 strMiddleName = simplifiedName.mid( spPos2 + 1 ); 1034 strMiddleName = simplifiedName.mid( spPos2 + 1 );
1031 break; 1035 break;
1032 1036
1033 case 3: 1037 case 3:
1034 spPos = simplifiedName.find( ' ', 0, TRUE ); 1038 spPos = simplifiedName.find( ' ', 0, TRUE );
1035 strLastName = simplifiedName.left( spPos ); 1039 strLastName = simplifiedName.left( spPos );
1036 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1040 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1037 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1041 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1038 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1042 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1039 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1043 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1040 strSuffix = simplifiedName.mid( spPos + 1 ); 1044 strSuffix = simplifiedName.mid( spPos + 1 );
1041 break; 1045 break;
1042 1046
1043 case 4: 1047 case 4:
1044 spPos = simplifiedName.find( ' ', 0, TRUE ); 1048 spPos = simplifiedName.find( ' ', 0, TRUE );
1045 strLastName = simplifiedName.left( spPos ); 1049 strLastName = simplifiedName.left( spPos );
1046 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1050 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1047 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1051 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1048 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1052 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1049 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1053 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1050 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1054 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1051 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1055 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1052 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1056 strSuffix = simplifiedName.mid( spPos2 + 1 );
1053 break; 1057 break;
1054 1058
1055 default: 1059 default:
1056 spPos = simplifiedName.find( ' ', 0, TRUE ); 1060 spPos = simplifiedName.find( ' ', 0, TRUE );
1057 strLastName = simplifiedName.left( spPos ); 1061 strLastName = simplifiedName.left( spPos );
1058 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1062 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1059 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1063 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1060 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1064 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1061 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); 1065 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos );
1062 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1066 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1063 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1067 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1064 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1068 strSuffix = simplifiedName.mid( spPos2 + 1 );
1065 break; 1069 break;
1066 } 1070 }
1067 } 1071 }
1068 switch (type) { 1072 switch (type) {
1069 case NAME_FL: 1073 case NAME_FL:
1070 return strFirstName + " " + strLastName; 1074 return strFirstName + " " + strLastName;
1071 1075
1072 case NAME_LF: 1076 case NAME_LF:
1073 return strLastName + ", " + strFirstName; 1077 return strLastName + ", " + strFirstName;
1074 1078
1075 case NAME_LFM: 1079 case NAME_LFM:
1076 return strLastName + ", " + strFirstName + " " + strMiddleName; 1080 return strLastName + ", " + strFirstName + " " + strMiddleName;
1077 1081
1078 case NAME_FMLS: 1082 case NAME_FMLS:
1079 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; 1083 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix;
1080 1084
1081 case NAME_F: 1085 case NAME_F:
1082 return strFirstName; 1086 return strFirstName;
1083 1087
1084 case NAME_M: 1088 case NAME_M:
1085 return strMiddleName; 1089 return strMiddleName;
1086 1090
1087 case NAME_L: 1091 case NAME_L:
1088 return strLastName; 1092 return strLastName;
1089 1093
1090 case NAME_S: 1094 case NAME_S:
1091 return strSuffix; 1095 return strSuffix;
1092 1096
1093 } 1097 }
1094 return QString::null; 1098 return QString::null;
1095} 1099}
1096 1100
1097void ContactEditor::cleanupFields() { 1101void ContactEditor::cleanupFields() {
1098 QStringList::Iterator it = slChooserValues.begin(); 1102 QStringList::Iterator it = slChooserValues.begin();
1099 1103
1100 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { 1104 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) {
1101 (*it) = ""; 1105 (*it) = "";
1102 } 1106 }
1103 1107
1104 for ( int i = 0; i < 7; i++ ) { 1108 for ( int i = 0; i < 7; i++ ) {
1105 slHomeAddress[i] = ""; 1109 slHomeAddress[i] = "";
1106 slBusinessAddress[i] = ""; 1110 slBusinessAddress[i] = "";
1107 } 1111 }
1108 1112
1109 QListIterator<QLineEdit> itLV( listValue ); 1113 QListIterator<QLineEdit> itLV( listValue );
1110 for ( ; itLV.current(); ++itLV ) { 1114 for ( ; itLV.current(); ++itLV ) {
1111 (*itLV)->setText( "" ); 1115 (*itLV)->setText( "" );
1112 } 1116 }
1113 1117
1114 txtFirstName->setText(""); 1118 txtFirstName->setText("");
1115 txtMiddleName->setText(""); 1119 txtMiddleName->setText("");
1116 txtLastName->setText(""); 1120 txtLastName->setText("");
1117 txtSuffix->setText(""); 1121 txtSuffix->setText("");
1118 txtNote->setText(""); 1122 txtNote->setText("");
1119 txtFullName->setText(""); 1123 txtFullName->setText("");
1120 txtJobTitle->setText(""); 1124 txtJobTitle->setText("");
1121 txtOrganization->setText(""); 1125 txtOrganization->setText("");
1122 txtChooserField1->setText(""); 1126 txtChooserField1->setText("");
1123 txtChooserField2->setText(""); 1127 txtChooserField2->setText("");
1124 txtChooserField3->setText(""); 1128 txtChooserField3->setText("");
1125 txtAddress->setText(""); 1129 txtAddress->setText("");
1126 txtCity->setText(""); 1130 txtCity->setText("");
1127 txtState->setText(""); 1131 txtState->setText("");
1128 txtZip->setText(""); 1132 txtZip->setText("");
1129 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1133 QLineEdit *txtTmp = cmbCountry->lineEdit();
1130 txtTmp->setText(""); 1134 txtTmp->setText("");
1131 txtTmp = cmbFileAs->lineEdit(); 1135 txtTmp = cmbFileAs->lineEdit();
1132 txtTmp->setText(""); 1136 txtTmp->setText("");
1133 1137
1134} 1138}
1135 1139
1136void ContactEditor::setEntry( const OContact &entry ) { 1140void ContactEditor::setEntry( const OContact &entry ) {
1137 1141
1138 cleanupFields(); 1142 cleanupFields();
1139 1143
1140 ent = entry; 1144 ent = entry;
1141 1145
1142 1146
1143 1147
1144 emails = QStringList(ent.emailList()); 1148 emails = QStringList(ent.emailList());
1145 defaultEmail = ent.defaultEmail(); 1149 defaultEmail = ent.defaultEmail();
1146 if (defaultEmail.isEmpty()) defaultEmail = emails[0]; 1150 if (defaultEmail.isEmpty()) defaultEmail = emails[0];
1147 qDebug("default email=%s",defaultEmail.latin1()); 1151 qDebug("default email=%s",defaultEmail.latin1());
1148 1152
1149 useFullName = false; 1153 useFullName = false;
1150 txtFirstName->setText( ent.firstName() ); 1154 txtFirstName->setText( ent.firstName() );
1151 txtMiddleName->setText( ent.middleName() ); 1155 txtMiddleName->setText( ent.middleName() );
1152 txtLastName->setText( ent.lastName() ); 1156 txtLastName->setText( ent.lastName() );
1153 txtSuffix->setText( ent.suffix() ); 1157 txtSuffix->setText( ent.suffix() );
1154 1158
1155 QString *tmpString = new QString; 1159 QString *tmpString = new QString;
1156 *tmpString = ent.firstName() + " " + ent.middleName() + 1160 *tmpString = ent.firstName() + " " + ent.middleName() +
1157 + " " + ent.lastName() + " " + ent.suffix(); 1161 + " " + ent.lastName() + " " + ent.suffix();
1158 1162
1159 txtFullName->setText( tmpString->simplifyWhiteSpace() ); 1163 txtFullName->setText( tmpString->simplifyWhiteSpace() );
1160 1164
1161 cmbFileAs->setEditText( ent.fileAs() ); 1165 cmbFileAs->setEditText( ent.fileAs() );
1162 1166
1163 //if (hasTitle) 1167 //if (hasTitle)
1164 txtJobTitle->setText( ent.jobTitle() ); 1168 txtJobTitle->setText( ent.jobTitle() );
1165 1169
1166 //if (hasCompany) 1170 //if (hasCompany)
1167 txtOrganization->setText( ent.company() ); 1171 txtOrganization->setText( ent.company() );
1168 1172
1169 //if (hasNotes) 1173 //if (hasNotes)
1170 txtNote->setText( ent.notes() ); 1174 txtNote->setText( ent.notes() );
1171 1175
1172 //if (hasStreet) { 1176 //if (hasStreet) {
1173 slHomeAddress[0] = ent.homeStreet(); 1177 slHomeAddress[0] = ent.homeStreet();
1174 slBusinessAddress[0] = ent.businessStreet(); 1178 slBusinessAddress[0] = ent.businessStreet();
1175 //} 1179 //}
1176 1180
1177 //if (hasCity) { 1181 //if (hasCity) {
1178 slHomeAddress[3] = ent.homeCity(); 1182 slHomeAddress[3] = ent.homeCity();
1179 slBusinessAddress[3] = ent.businessCity(); 1183 slBusinessAddress[3] = ent.businessCity();
1180//} 1184//}
1181 1185
1182//if (hasState) { 1186//if (hasState) {
1183 slHomeAddress[4] = ent.homeState(); 1187 slHomeAddress[4] = ent.homeState();
1184 slBusinessAddress[4] = ent.businessState(); 1188 slBusinessAddress[4] = ent.businessState();
1185//} 1189//}
1186 1190
1187//if (hasZip) { 1191//if (hasZip) {
1188 slHomeAddress[5] = ent.homeZip(); 1192 slHomeAddress[5] = ent.homeZip();
1189 slBusinessAddress[5] = ent.businessZip(); 1193 slBusinessAddress[5] = ent.businessZip();
1190//} 1194//}
1191 1195
1192//if (hasCountry) { 1196//if (hasCountry) {
1193 slHomeAddress[6] = ent.homeCountry(); 1197 slHomeAddress[6] = ent.homeCountry();
1194 slBusinessAddress[6] = ent.businessCountry(); 1198 slBusinessAddress[6] = ent.businessCountry();
1195//} 1199//}
1196 1200
1197 QStringList::ConstIterator it; 1201 QStringList::ConstIterator it;
1198 QListIterator<QLineEdit> itLE( listValue ); 1202 QListIterator<QLineEdit> itLE( listValue );
1199 for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { 1203 for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) {
1200 1204
1201 qWarning(" Filling dynamic Field: %s", (*it).latin1() ); 1205 qWarning(" Filling dynamic Field: %s", (*it).latin1() );
1202 1206
1203 if ( *it == "Department" ) 1207 if ( *it == "Department" )
1204 (*itLE)->setText( ent.department() ); 1208 (*itLE)->setText( ent.department() );
1205 1209
1206 if ( *it == "Company" ) 1210 if ( *it == "Company" )
1207 (*itLE)->setText( ent.company() ); 1211 (*itLE)->setText( ent.company() );
1208 1212
1209 if ( *it == "Office" ) 1213 if ( *it == "Office" )
1210 (*itLE)->setText( ent.office() ); 1214 (*itLE)->setText( ent.office() );
1211 1215
1212 if ( *it == "Profession" ) 1216 if ( *it == "Profession" )
1213 (*itLE)->setText( ent.profession() ); 1217 (*itLE)->setText( ent.profession() );
1214 1218
1215 if ( *it == "Assistant" ) 1219 if ( *it == "Assistant" )
1216 (*itLE)->setText( ent.assistant() ); 1220 (*itLE)->setText( ent.assistant() );
1217 1221
1218 if ( *it == "Manager" ) 1222 if ( *it == "Manager" )
1219 (*itLE)->setText( ent.manager() ); 1223 (*itLE)->setText( ent.manager() );
1220 1224
1221 if ( *it == "Spouse" ) 1225 if ( *it == "Spouse" )
1222 (*itLE)->setText( ent.spouse() ); 1226 (*itLE)->setText( ent.spouse() );
1223 1227
1224 if ( *it == "Nickname" ){ 1228 if ( *it == "Nickname" ){
1225 qWarning("**** Nichname: %s", ent.nickname().latin1() ); 1229 qWarning("**** Nichname: %s", ent.nickname().latin1() );
1226 (*itLE)->setText( ent.nickname() ); 1230 (*itLE)->setText( ent.nickname() );
1227 } 1231 }
1228 1232
1229 if ( *it == "Children" ) 1233 if ( *it == "Children" )
1230 (*itLE)->setText( ent.children() ); 1234 (*itLE)->setText( ent.children() );
1231 1235
1232 } 1236 }
1233 1237
1234 QStringList::Iterator itV; 1238 QStringList::Iterator itV;
1235 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1239 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1236 1240
1237 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) 1241 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) )
1238 *itV = ent.businessPhone(); 1242 *itV = ent.businessPhone();
1239/* 1243/*
1240 if ( *it == "Business 2 Phone" ) 1244 if ( *it == "Business 2 Phone" )
1241 *itV = ent.business2Phone(); 1245 *itV = ent.business2Phone();
1242*/ 1246*/
1243 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) 1247 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) )
1244 *itV = ent.businessFax(); 1248 *itV = ent.businessFax();
1245 1249
1246 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) 1250 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) )
1247 *itV = ent.businessMobile(); 1251 *itV = ent.businessMobile();
1248/* 1252/*
1249 if ( *it == "Company Phone" ) 1253 if ( *it == "Company Phone" )
1250 *itV = ent.companyPhone(); 1254 *itV = ent.companyPhone();
1251*/ 1255*/
1252 if ( *it == "Default Email" ) 1256 if ( *it == "Default Email" )
1253 *itV = ent.defaultEmail(); 1257 *itV = ent.defaultEmail();
1254 1258
1255 if ( *it == "Emails" ) 1259 if ( *it == "Emails" )
1256 *itV = ent.emailList().join(", "); // :SX 1260 *itV = ent.emailList().join(", "); // :SX
1257 1261
1258 if ( *it == "Home Phone" ) 1262 if ( *it == "Home Phone" )
1259 *itV = ent.homePhone(); 1263 *itV = ent.homePhone();
1260/* 1264/*
1261 if ( *it == "Home 2 Phone" ) 1265 if ( *it == "Home 2 Phone" )
1262 *itV = ent.home2Phone(); 1266 *itV = ent.home2Phone();
1263*/ 1267*/
1264 if ( *it == "Home Fax" ) 1268 if ( *it == "Home Fax" )
1265 *itV = ent.homeFax(); 1269 *itV = ent.homeFax();
1266 1270
1267 if ( *it == "Home Mobile" ) 1271 if ( *it == "Home Mobile" )
1268 *itV = ent.homeMobile(); 1272 *itV = ent.homeMobile();
1269/* 1273/*
1270 if ( *it == "Car Phone" ) 1274 if ( *it == "Car Phone" )
1271 *itV = ent.carPhone(); 1275 *itV = ent.carPhone();
1272 1276
1273 if ( *it == "ISDN Phone" ) 1277 if ( *it == "ISDN Phone" )
1274 *itV = ent.ISDNPhone(); 1278 *itV = ent.ISDNPhone();
1275 1279
1276 if ( *it == "Other Phone" ) 1280 if ( *it == "Other Phone" )
1277 *itV = ent.otherPhone(); 1281 *itV = ent.otherPhone();
1278*/ 1282*/
1279 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) 1283 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
1280 *itV = ent.businessPager(); 1284 *itV = ent.businessPager();
1281/* 1285/*
1282 if ( *it == "Home Pager") 1286 if ( *it == "Home Pager")
1283 *itV = ent.homePager(); 1287 *itV = ent.homePager();
1284 1288
1285 if ( *it == "AIM IM" ) 1289 if ( *it == "AIM IM" )
1286 *itV = ent.AIMIM(); 1290 *itV = ent.AIMIM();
1287 1291
1288 if ( *it == "ICQ IM" ) 1292 if ( *it == "ICQ IM" )
1289 *itV = ent.ICQIM(); 1293 *itV = ent.ICQIM();
1290 1294
1291 if ( *it == "Jabber IM" ) 1295 if ( *it == "Jabber IM" )
1292 *itV = ent.jabberIM(); 1296 *itV = ent.jabberIM();
1293 1297
1294 if ( *it == "MSN IM" ) 1298 if ( *it == "MSN IM" )
1295 *itV = ent.MSNIM(); 1299 *itV = ent.MSNIM();
1296 1300
1297 if ( *it == "Yahoo IM" ) 1301 if ( *it == "Yahoo IM" )
1298 *itV = ent.yahooIM(); 1302 *itV = ent.yahooIM();
1299*/ 1303*/
1300 if ( *it == "Home Web Page" ) 1304 if ( *it == "Home Web Page" )
1301 *itV = ent.homeWebpage(); 1305 *itV = ent.homeWebpage();
1302 1306
1303 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) 1307 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1304 *itV = ent.businessWebpage(); 1308 *itV = ent.businessWebpage();
1305 1309
1306 1310
1307 } 1311 }
1308 1312
1309 1313
1310 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); 1314 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") );
1311 1315
1312 QString gender = ent.gender(); 1316 QString gender = ent.gender();
1313 cmbGender->setCurrentItem( gender.toInt() ); 1317 cmbGender->setCurrentItem( gender.toInt() );
1314 1318
1315 txtNote->setText( ent.notes() ); 1319 txtNote->setText( ent.notes() );
1316 1320
1317 slotCmbChooser1Change( cmbChooserField1->currentItem() ); 1321 slotCmbChooser1Change( cmbChooserField1->currentItem() );
1318 slotCmbChooser2Change( cmbChooserField2->currentItem() ); 1322 slotCmbChooser2Change( cmbChooserField2->currentItem() );
1319 slotCmbChooser3Change( cmbChooserField3->currentItem() ); 1323 slotCmbChooser3Change( cmbChooserField3->currentItem() );
1320 1324
1321 slotAddressTypeChange( cmbAddress->currentItem() ); 1325 slotAddressTypeChange( cmbAddress->currentItem() );
1322 1326
1323 // loadFields(); :SX 1327 // loadFields(); :SX
1324 updateDatePicker(); 1328 updateDatePicker();
1325} 1329}
1326void ContactEditor::updateDatePicker() 1330void ContactEditor::updateDatePicker()
1327{ 1331{
1328 // Set DatePicker 1332 // Set DatePicker
1329 if ( !ent.birthday().isNull() ){ 1333 if ( !ent.birthday().isNull() ){
1330 birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); 1334 birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) );
1331 birthdayPicker->setDate( ent.birthday() ); 1335 birthdayPicker->setDate( ent.birthday() );
1332 } else 1336 } else
1333 birthdayButton->setText( tr ("Unknown") ); 1337 birthdayButton->setText( tr ("Unknown") );
1334 1338
1335 if ( !ent.anniversary().isNull() ){ 1339 if ( !ent.anniversary().isNull() ){
1336 anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); 1340 anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) );
1337 anniversaryPicker->setDate( ent.anniversary() ); 1341 anniversaryPicker->setDate( ent.anniversary() );
1338 } else 1342 } else
1339 anniversaryButton->setText( tr ("Unknown") ); 1343 anniversaryButton->setText( tr ("Unknown") );
1340 1344
1341} 1345}
1342 1346
1343void ContactEditor::saveEntry() { 1347void ContactEditor::saveEntry() {
1344 1348
1345 if ( useFullName ) { 1349 if ( useFullName ) {
1346 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); 1350 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) );
1347 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); 1351 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) );
1348 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); 1352 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
1349 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); 1353 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
1350 1354
1351 useFullName = false; 1355 useFullName = false;
1352 } 1356 }
1353 1357
1354 ent.setFirstName( txtFirstName->text() ); 1358 ent.setFirstName( txtFirstName->text() );
1355 ent.setLastName( txtLastName->text() ); 1359 ent.setLastName( txtLastName->text() );
1356 ent.setMiddleName( txtMiddleName->text() ); 1360 ent.setMiddleName( txtMiddleName->text() );
1357 ent.setSuffix( txtSuffix->text() ); 1361 ent.setSuffix( txtSuffix->text() );
1358 1362
1359 ent.setFileAs( cmbFileAs->currentText() ); 1363 ent.setFileAs( cmbFileAs->currentText() );
1360 1364
1361 ent.setCategories( cmbCat->currentCategories() ); 1365 ent.setCategories( cmbCat->currentCategories() );
1362 1366
1363 1367
1364 //if (hasTitle) 1368 //if (hasTitle)
1365 ent.setJobTitle( txtJobTitle->text() ); 1369 ent.setJobTitle( txtJobTitle->text() );
1366 1370
1367 //if (hasCompany) 1371 //if (hasCompany)
1368 ent.setCompany( txtOrganization->text() ); 1372 ent.setCompany( txtOrganization->text() );
1369 1373
1370 //if (hasNotes) 1374 //if (hasNotes)
1371 ent.setNotes( txtNote->text() ); 1375 ent.setNotes( txtNote->text() );
1372 1376
1373 //if (hasStreet) { 1377 //if (hasStreet) {
1374 ent.setHomeStreet( slHomeAddress[0] ); 1378 ent.setHomeStreet( slHomeAddress[0] );
1375 ent.setBusinessStreet( slBusinessAddress[0] ); 1379 ent.setBusinessStreet( slBusinessAddress[0] );
1376 //} 1380 //}
1377 1381
1378 //if (hasCity) { 1382 //if (hasCity) {
1379 ent.setHomeCity( slHomeAddress[3] ); 1383 ent.setHomeCity( slHomeAddress[3] );
1380 ent.setBusinessCity( slBusinessAddress[3] ); 1384 ent.setBusinessCity( slBusinessAddress[3] );
1381 //} 1385 //}
1382 1386
1383 //if (hasState) { 1387 //if (hasState) {
1384 ent.setHomeState( slHomeAddress[4] ); 1388 ent.setHomeState( slHomeAddress[4] );
1385 ent.setBusinessState( slBusinessAddress[4] ); 1389 ent.setBusinessState( slBusinessAddress[4] );
1386 //} 1390 //}
1387 1391
1388 //if (hasZip) { 1392 //if (hasZip) {
1389 ent.setHomeZip( slHomeAddress[5] ); 1393 ent.setHomeZip( slHomeAddress[5] );
1390 ent.setBusinessZip( slBusinessAddress[5] ); 1394 ent.setBusinessZip( slBusinessAddress[5] );
1391 //} 1395 //}
1392 1396
1393 //if (hasCountry) { 1397 //if (hasCountry) {
1394 ent.setHomeCountry( slHomeAddress[6] ); 1398 ent.setHomeCountry( slHomeAddress[6] );
1395 ent.setBusinessCountry( slBusinessAddress[6] ); 1399 ent.setBusinessCountry( slBusinessAddress[6] );
1396 //} 1400 //}
1397 1401
1398 QStringList::ConstIterator it; 1402 QStringList::ConstIterator it;
1399 QListIterator<QLineEdit> itLE( listValue ); 1403 QListIterator<QLineEdit> itLE( listValue );
1400 for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { 1404 for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) {
1401 1405
1402 if ( *it == "Department" ) 1406 if ( *it == "Department" )
1403 ent.setDepartment( (*itLE)->text() ); 1407 ent.setDepartment( (*itLE)->text() );
1404 1408
1405 if ( *it == "Company" ) 1409 if ( *it == "Company" )
1406 ent.setCompany( (*itLE)->text() ); 1410 ent.setCompany( (*itLE)->text() );
1407 1411
1408 if ( *it == "Office" ) 1412 if ( *it == "Office" )
1409 ent.setOffice( (*itLE)->text() ); 1413 ent.setOffice( (*itLE)->text() );
1410 1414
1411 if ( *it == "Profession" ) 1415 if ( *it == "Profession" )
1412 ent.setProfession( (*itLE)->text() ); 1416 ent.setProfession( (*itLE)->text() );
1413 1417
1414 if ( *it == "Assistant" ) 1418 if ( *it == "Assistant" )
1415 ent.setAssistant( (*itLE)->text() ); 1419 ent.setAssistant( (*itLE)->text() );
1416 1420
1417 if ( *it == "Manager" ) 1421 if ( *it == "Manager" )
1418 ent.setManager( (*itLE)->text() ); 1422 ent.setManager( (*itLE)->text() );
1419 1423
1420 if ( *it == "Spouse" ) 1424 if ( *it == "Spouse" )
1421 ent.setSpouse( (*itLE)->text() ); 1425 ent.setSpouse( (*itLE)->text() );
1422 1426
1423 if ( *it == "Nickname" ) 1427 if ( *it == "Nickname" )
1424 ent.setNickname( (*itLE)->text() ); 1428 ent.setNickname( (*itLE)->text() );
1425 1429
1426 if ( *it == "Children" ) 1430 if ( *it == "Children" )
1427 ent.setChildren( (*itLE)->text() ); 1431 ent.setChildren( (*itLE)->text() );
1428 1432
1429 } 1433 }
1430 1434
1431 1435
1432 QStringList::ConstIterator itV; 1436 QStringList::ConstIterator itV;
1433 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1437 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1434 1438
1435 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) 1439 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) )
1436 ent.setBusinessPhone( *itV ); 1440 ent.setBusinessPhone( *itV );
1437 1441
1438 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) 1442 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) )
1439 ent.setBusinessFax( *itV ); 1443 ent.setBusinessFax( *itV );
1440 1444
1441 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) 1445 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) )
1442 ent.setBusinessMobile( *itV ); 1446 ent.setBusinessMobile( *itV );
1443 1447
1444 if ( *it == "Emails" ){ 1448 if ( *it == "Emails" ){
1445 QString allemail; 1449 QString allemail;
1446 QString defaultmail; 1450 QString defaultmail;
1447 parseEmailFrom( *itV, defaultmail, allemail ); 1451 parseEmailFrom( *itV, defaultmail, allemail );
1448 // ent.clearEmails(); 1452 // ent.clearEmails();
1449 // ent.setDefaultEmail( defaultmail ); 1453 // ent.setDefaultEmail( defaultmail );
1450 ent.setEmails( allemail ); 1454 ent.setEmails( allemail );
1451 } 1455 }
1452 1456
1453 if ( *it == "Default Email") 1457 if ( *it == "Default Email")
1454 ent.setDefaultEmail( *itV ); 1458 ent.setDefaultEmail( *itV );
1455 1459
1456 if ( *it == "Home Phone" ) 1460 if ( *it == "Home Phone" )
1457 ent.setHomePhone( *itV ); 1461 ent.setHomePhone( *itV );
1458 1462
1459 if ( *it == "Home Fax" ) 1463 if ( *it == "Home Fax" )
1460 ent.setHomeFax( *itV ); 1464 ent.setHomeFax( *itV );
1461 1465
1462 if ( *it == "Home Mobile" ) 1466 if ( *it == "Home Mobile" )
1463 ent.setHomeMobile( *itV ); 1467 ent.setHomeMobile( *itV );
1464 1468
1465 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) 1469 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
1466 ent.setBusinessPager( *itV ); 1470 ent.setBusinessPager( *itV );
1467 1471
1468 if ( *it == "Home Web Page" ) 1472 if ( *it == "Home Web Page" )
1469 ent.setHomeWebpage( *itV ); 1473 ent.setHomeWebpage( *itV );
1470 1474
1471 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) 1475 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1472 ent.setBusinessWebpage( *itV ); 1476 ent.setBusinessWebpage( *itV );
1473 1477
1474 1478
1475 } 1479 }
1476 1480
1477 int gender = cmbGender->currentItem(); 1481 int gender = cmbGender->currentItem();
1478 ent.setGender( QString::number( gender ) ); 1482 ent.setGender( QString::number( gender ) );
1479 1483
1480 QString str = txtNote->text(); 1484 QString str = txtNote->text();
1481 if ( !str.isNull() ) 1485 if ( !str.isNull() )
1482 ent.setNotes( str ); 1486 ent.setNotes( str );
1483 1487
1484} 1488}
1485 1489
1486void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 1490void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
1487 QString &strAll ) 1491 QString &strAll )
1488{ 1492{
1489 int where, 1493 int where,
1490 start; 1494 start;
1491 if ( txt.isEmpty() ) 1495 if ( txt.isEmpty() )
1492 return; 1496 return;
1493 // find the first 1497 // find the first
1494 where = txt.find( ',' ); 1498 where = txt.find( ',' );
1495 if ( where < 0 ) { 1499 if ( where < 0 ) {
1496 strDefaultEmail = txt; 1500 strDefaultEmail = txt;
1497 strAll = txt; 1501 strAll = txt;
1498 } else { 1502 } else {
1499 strDefaultEmail = txt.left( where ).stripWhiteSpace(); 1503 strDefaultEmail = txt.left( where ).stripWhiteSpace();
1500 strAll = strDefaultEmail; 1504 strAll = strDefaultEmail;
1501 while ( where > -1 ) { 1505 while ( where > -1 ) {
1502 strAll.append(" "); 1506 strAll.append(" ");
1503 start = where; 1507 start = where;
1504 where = txt.find( ',', where + 1 ); 1508 where = txt.find( ',', where + 1 );
1505 if ( where > - 1 ) 1509 if ( where > - 1 )
1506 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); 1510 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() );
1507 else // grab until the end... 1511 else // grab until the end...
1508 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); 1512 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() );
1509 } 1513 }
1510 } 1514 }
1511} 1515}
1512 1516
1513void parseEmailTo( const QString &strDefaultEmail, 1517void parseEmailTo( const QString &strDefaultEmail,
1514 const QString &strOtherEmail, QString &strBack ) 1518 const QString &strOtherEmail, QString &strBack )
1515{ 1519{
1516 // create a comma dilimeted set of emails... 1520 // create a comma dilimeted set of emails...
1517 // use the power of short circuiting... 1521 // use the power of short circuiting...
1518 bool foundDefault = false; 1522 bool foundDefault = false;
1519 QString strTmp; 1523 QString strTmp;
1520 int start = 0; 1524 int start = 0;
1521 int where; 1525 int where;
1522 // start at the beginng. 1526 // start at the beginng.
1523 strBack = strDefaultEmail; 1527 strBack = strDefaultEmail;
1524 where = 0; 1528 where = 0;
1525 while ( where > -1 ) { 1529 while ( where > -1 ) {
1526 start = where; 1530 start = where;
1527 where = strOtherEmail.find( ' ', where + 1 ); 1531 where = strOtherEmail.find( ' ', where + 1 );
1528 if ( where > 0 ) { 1532 if ( where > 0 ) {
1529 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); 1533 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace();
1530 } else 1534 } else
1531 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); 1535 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace();
1532 if ( foundDefault || strTmp != strDefaultEmail ) { 1536 if ( foundDefault || strTmp != strDefaultEmail ) {
1533 strBack.append( ", " ); 1537 strBack.append( ", " );
1534 strBack.append( strTmp ); 1538 strBack.append( strTmp );
1535 } else 1539 } else
1536 foundDefault = true; 1540 foundDefault = true;
1537 } 1541 }
1538} 1542}
1539 1543
1540 1544
1541static inline bool containsAlphaNum( const QString &str ) 1545static inline bool containsAlphaNum( const QString &str )
1542{ 1546{
1543 int i, 1547 int i,
1544 count = str.length(); 1548 count = str.length();
1545 for ( i = 0; i < count; i++ ) 1549 for ( i = 0; i < count; i++ )
1546 if ( !str[i].isSpace() ) 1550 if ( !str[i].isSpace() )
1547 return TRUE; 1551 return TRUE;
1548 return FALSE; 1552 return FALSE;
1549} 1553}
1550 1554
1551static inline bool constainsWhiteSpace( const QString &str ) 1555static inline bool constainsWhiteSpace( const QString &str )
1552{ 1556{
1553 int i, 1557 int i,
1554 count = str.length(); 1558 count = str.length();
1555 for (i = 0; i < count; i++ ) 1559 for (i = 0; i < count; i++ )
1556 if ( str[i].isSpace() ) 1560 if ( str[i].isSpace() )
1557 return TRUE; 1561 return TRUE;
1558 return FALSE; 1562 return FALSE;
1559} 1563}
1560 1564
1561void ContactEditor::setPersonalView( bool personal ) 1565void ContactEditor::setPersonalView( bool personal )
1562{ 1566{
1563 m_personalView = personal; 1567 m_personalView = personal;
1564 1568
1565 // Currently disbled due to the fact that 1569 // Currently disbled due to the fact that
1566 // show will not work... 1570 // show will not work...
1567 return; 1571 return;
1568 1572
1569 if ( personal ){ 1573 if ( personal ){
1570 cmbCat->hide(); 1574 cmbCat->hide();
1571 labCat->hide(); 1575 labCat->hide();
1572 1576
1573 } else{ 1577 } else{
1574 cmbCat->show(); 1578 cmbCat->show();
1575 labCat->show(); 1579 labCat->show();
1576 } 1580 }
1577} 1581}
1578 1582
1579void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) 1583void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day)
1580{ 1584{
1581 QDate date; 1585 QDate date;
1582 date.setYMD( year, month, day ); 1586 date.setYMD( year, month, day );
1583 QString dateString = TimeString::numberDateString( date ); 1587 QString dateString = TimeString::numberDateString( date );
1584 anniversaryButton->setText( dateString ); 1588 anniversaryButton->setText( dateString );
1585 ent.setAnniversary ( date ); 1589 ent.setAnniversary ( date );
1586} 1590}
1587 1591
1588void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) 1592void ContactEditor::slotBirthdayDateChanged( int year, int month, int day)
1589{ 1593{
1590 QDate date; 1594 QDate date;
1591 date.setYMD( year, month, day ); 1595 date.setYMD( year, month, day );
1592 QString dateString = TimeString::numberDateString( date ); 1596 QString dateString = TimeString::numberDateString( date );
1593 birthdayButton->setText( dateString ); 1597 birthdayButton->setText( dateString );
1594 ent.setBirthday ( date ); 1598 ent.setBirthday ( date );
1595} 1599}
1596 1600
1597void ContactEditor::slotRemoveBirthday() 1601void ContactEditor::slotRemoveBirthday()
1598{ 1602{
1599 qWarning("void ContactEditor::slotRemoveBirthday()"); 1603 qWarning("void ContactEditor::slotRemoveBirthday()");
1600 ent.setBirthday( QDate() ); 1604 ent.setBirthday( QDate() );
1601 updateDatePicker(); 1605 updateDatePicker();
1602} 1606}
1603 1607
1604void ContactEditor::slotRemoveAnniversary() 1608void ContactEditor::slotRemoveAnniversary()
1605{ 1609{
1606 qWarning("void ContactEditor::slotRemoveAnniversary()"); 1610 qWarning("void ContactEditor::slotRemoveAnniversary()");
1607 ent.setAnniversary( QDate() ); 1611 ent.setAnniversary( QDate() );
1608 updateDatePicker(); 1612 updateDatePicker();
1609} 1613}