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