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