summaryrefslogtreecommitdiff
authortille <tille>2002-12-19 00:00:42 (UTC)
committer tille <tille>2002-12-19 00:00:42 (UTC)
commit4fc6648f5953d453a31edaf288480ff2458c431f (patch) (unidiff)
treeaff033c63297fef4c37e561c7ce961ce3f15421f
parent7f98b97ff4b112ddc7025b34649a4ed331b37548 (diff)
downloadopie-4fc6648f5953d453a31edaf288480ff2458c431f.zip
opie-4fc6648f5953d453a31edaf288480ff2458c431f.tar.gz
opie-4fc6648f5953d453a31edaf288480ff2458c431f.tar.bz2
fix for email <-> default email bug
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp57
-rw-r--r--core/pim/addressbook/contacteditor.h4
2 files changed, 44 insertions, 17 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index cc3908a..4e73114 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -1,1560 +1,1583 @@
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, 59void 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 cmbDefaultEmail = 0; 73 cmbDefaultEmail = 0;
74 defaultEmailChooserPosition = -1; 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 &)) );
600 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) );
601 connect( txtCity, SIGNAL(textChanged(const QString &)), 599 connect( txtCity, SIGNAL(textChanged(const QString &)),
602 this, SLOT(slotCityChange(const QString &)) ); 600 this, SLOT(slotCityChange(const QString &)) );
603 connect( txtState, SIGNAL(textChanged(const QString &)), 601 connect( txtState, SIGNAL(textChanged(const QString &)),
604 this, SLOT(slotStateChange(const QString &)) ); 602 this, SLOT(slotStateChange(const QString &)) );
605 connect( txtZip, SIGNAL(textChanged(const QString &)), 603 connect( txtZip, SIGNAL(textChanged(const QString &)),
606 this, SLOT(slotZipChange(const QString &)) ); 604 this, SLOT(slotZipChange(const QString &)) );
607 connect( cmbCountry, SIGNAL(textChanged(const QString &)), 605 connect( cmbCountry, SIGNAL(textChanged(const QString &)),
608 this, SLOT(slotCountryChange(const QString &)) ); 606 this, SLOT(slotCountryChange(const QString &)) );
609 connect( cmbCountry, SIGNAL(activated(const QString &)), 607 connect( cmbCountry, SIGNAL(activated(const QString &)),
610 this, SLOT(slotCountryChange(const QString &)) ); 608 this, SLOT(slotCountryChange(const QString &)) );
611 connect( cmbChooserField1, SIGNAL(activated(int)), 609 connect( cmbChooserField1, SIGNAL(activated(int)),
612 this, SLOT(slotCmbChooser1Change(int)) ); 610 this, SLOT(slotCmbChooser1Change(int)) );
613 connect( cmbChooserField2, SIGNAL(activated(int)), 611 connect( cmbChooserField2, SIGNAL(activated(int)),
614 this, SLOT(slotCmbChooser2Change(int)) ); 612 this, SLOT(slotCmbChooser2Change(int)) );
615 connect( cmbChooserField3, SIGNAL(activated(int)), 613 connect( cmbChooserField3, SIGNAL(activated(int)),
616 this, SLOT(slotCmbChooser3Change(int)) ); 614 this, SLOT(slotCmbChooser3Change(int)) );
617 connect( cmbChooserField4, SIGNAL(activated(int)), 615 connect( cmbChooserField4, SIGNAL(activated(int)),
618 this, SLOT(slotCmbChooser4Change(int)) ); 616 this, SLOT(slotCmbChooser4Change(int)) );
619 connect( cmbAddress, SIGNAL(activated(int)), 617 connect( cmbAddress, SIGNAL(activated(int)),
620 this, SLOT(slotAddressTypeChange(int)) ); 618 this, SLOT(slotAddressTypeChange(int)) );
621 619
622 new QPEDialogListener(this); 620 new QPEDialogListener(this);
623 621
624 setPersonalView ( m_personalView ); 622 setPersonalView ( m_personalView );
625} 623}
626 624
627void ContactEditor::defaultEmailChanged(int i){ 625void ContactEditor::defaultEmailChanged(int i){
628 qDebug("defaultEmailChanged"); 626 qDebug("defaultEmailChanged");
629 int index = cmbChooserField1->currentItem(); 627 int index = cmbChooserField1->currentItem();
630 slChooserValues[index] = cmbDefaultEmail->text(i); 628 slChooserValues[index] = cmbDefaultEmail->text(i);
631 629
632} 630}
633 631
634void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid, int widgetPos ) { 632void ContactEditor::populateDefaultEmailCmb(){
633 cmbDefaultEmail->clear();
634 cmbDefaultEmail->insertStringList(emails);
635 for ( int i = 0; i < cmbDefaultEmail->count(); i++){
636 qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<",cmbDefaultEmail->text( i ).latin1(),defaultEmail.latin1());
637 if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){
638 cmbDefaultEmail->setCurrentItem( i );
639 qDebug("set");
640 }
641 }
642}
635 643
636 qDebug("defaultEmailChooserPosition %i, widgetPos %i ",defaultEmailChooserPosition,widgetPos); 644void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid, int widgetPos ) {
637 if (slChooserNames[index] == "Default Email"){ 645 QString type = slChooserNames[index];
646 qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i",type.latin1(),textChanged.latin1(), index, widgetPos );
647 if ( type == "Default Email"){
648 defaultEmail = textChanged;
638 if (cmbDefaultEmail) delete cmbDefaultEmail; 649 if (cmbDefaultEmail) delete cmbDefaultEmail;
639 cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); 650 cmbDefaultEmail = new QComboBox(inputWid->parentWidget());
640 cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); 651 cmbDefaultEmail->setGeometry(inputWid->frameGeometry());
641 cmbDefaultEmail->insertStringList(ent.emailList());
642 connect(cmbDefaultEmail,SIGNAL(activated(int)),
643 SLOT(defaultEmailChanged(int)));
644 QString demail = ent.defaultEmail();
645 for ( int i = 0; i < cmbDefaultEmail->count(); i++)
646 if ( cmbDefaultEmail->text( i ) == demail )
647 cmbDefaultEmail->setCurrentItem( i );
648
649 cmbDefaultEmail->show(); 652 cmbDefaultEmail->show();
653 populateDefaultEmailCmb();
654 connect(cmbDefaultEmail,SIGNAL(activated(int)),
655 SLOT(defaultEmailChanged(int)));
650 defaultEmailChooserPosition = widgetPos; 656 defaultEmailChooserPosition = widgetPos;
651 }else if (defaultEmailChooserPosition == widgetPos){ 657 }else if (defaultEmailChooserPosition == widgetPos){
652 qDebug("cmbDefaultEmail->hide()"); 658 qDebug("cmbDefaultEmail->hide()");
653 if (cmbDefaultEmail) cmbDefaultEmail->hide(); 659 if (cmbDefaultEmail) cmbDefaultEmail->hide();
660 widgetPos=-1;
661 }else if (type == "Emails"){
662 qDebug("emails");
663 QString de;
664 emails = QStringList::split (",", textChanged );
665
666 populateDefaultEmailCmb();
654 } 667 }
668
655 669
656 670
657 slChooserValues[index] = textChanged; 671 slChooserValues[index] = textChanged;
658 672
659} 673}
660 674
661void ContactEditor::slotChooser1Change( const QString &textChanged ) { 675void ContactEditor::slotChooser1Change( const QString &textChanged ) {
662 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); 676 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1);
663} 677}
664 678
665void ContactEditor::slotChooser2Change( const QString &textChanged ) { 679void ContactEditor::slotChooser2Change( const QString &textChanged ) {
666 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); 680 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2);
667 681
668} 682}
669 683
670void ContactEditor::slotChooser3Change( const QString &textChanged ) { 684void ContactEditor::slotChooser3Change( const QString &textChanged ) {
671 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); 685 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3);
672} 686}
673 687
674void ContactEditor::slotChooser4Change( const QString &textChanged ) { 688void ContactEditor::slotChooser4Change( const QString &textChanged ) {
675 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); 689 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4);
676} 690}
677 691
678void ContactEditor::slotAddressChange( const QString &textChanged ) { 692void ContactEditor::slotAddressChange( const QString &textChanged ) {
679 693
680 if ( cmbAddress->currentItem() == 0 ) { 694 if ( cmbAddress->currentItem() == 0 ) {
681 slBusinessAddress[0] = textChanged; 695 slBusinessAddress[0] = textChanged;
682 } else { 696 } else {
683 slHomeAddress[0] = textChanged; 697 slHomeAddress[0] = textChanged;
684 } 698 }
685} 699}
686 700
687void ContactEditor::slotAddress2Change( const QString &textChanged ) { 701void ContactEditor::slotAddress2Change( const QString &textChanged ) {
688 702
689 if ( cmbAddress->currentItem() == 0 ) { 703 if ( cmbAddress->currentItem() == 0 ) {
690 slBusinessAddress[1] = textChanged; 704 slBusinessAddress[1] = textChanged;
691 } else { 705 } else {
692 slHomeAddress[1] = textChanged; 706 slHomeAddress[1] = textChanged;
693 } 707 }
694} 708}
695 709
696void ContactEditor::slotPOBoxChange( const QString &textChanged ) { 710void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
697 711
698 if ( cmbAddress->currentItem() == 0 ) { 712 if ( cmbAddress->currentItem() == 0 ) {
699 slBusinessAddress[2] = textChanged; 713 slBusinessAddress[2] = textChanged;
700 } else { 714 } else {
701 slHomeAddress[2] = textChanged; 715 slHomeAddress[2] = textChanged;
702 } 716 }
703} 717}
704 718
705void ContactEditor::slotCityChange( const QString &textChanged ) { 719void ContactEditor::slotCityChange( const QString &textChanged ) {
706 720
707 if ( cmbAddress->currentItem() == 0 ) { 721 if ( cmbAddress->currentItem() == 0 ) {
708 slBusinessAddress[3] = textChanged; 722 slBusinessAddress[3] = textChanged;
709 } else { 723 } else {
710 slHomeAddress[3] = textChanged; 724 slHomeAddress[3] = textChanged;
711 } 725 }
712} 726}
713 727
714void ContactEditor::slotStateChange( const QString &textChanged ) { 728void ContactEditor::slotStateChange( const QString &textChanged ) {
715 729
716 730
717 if ( cmbAddress->currentItem() == 0 ) { 731 if ( cmbAddress->currentItem() == 0 ) {
718 slBusinessAddress[4] = textChanged; 732 slBusinessAddress[4] = textChanged;
719 } else { 733 } else {
720 slHomeAddress[4] = textChanged; 734 slHomeAddress[4] = textChanged;
721 } 735 }
722} 736}
723 737
724void ContactEditor::slotZipChange( const QString &textChanged ) { 738void ContactEditor::slotZipChange( const QString &textChanged ) {
725 739
726 if ( cmbAddress->currentItem() == 0 ) { 740 if ( cmbAddress->currentItem() == 0 ) {
727 slBusinessAddress[5] = textChanged; 741 slBusinessAddress[5] = textChanged;
728 } else { 742 } else {
729 slHomeAddress[5] = textChanged; 743 slHomeAddress[5] = textChanged;
730 } 744 }
731} 745}
732 746
733void ContactEditor::slotCountryChange( const QString &textChanged ) { 747void ContactEditor::slotCountryChange( const QString &textChanged ) {
734 748
735 if ( cmbAddress->currentItem() == 0 ) { 749 if ( cmbAddress->currentItem() == 0 ) {
736 slBusinessAddress[6] = textChanged; 750 slBusinessAddress[6] = textChanged;
737 } else { 751 } else {
738 slHomeAddress[6] = textChanged; 752 slHomeAddress[6] = textChanged;
739 } 753 }
740} 754}
741 755
756
742void ContactEditor::slotCmbChooser1Change( int index ) { 757void ContactEditor::slotCmbChooser1Change( int index ) {
743 758
744 txtChooserField1->setText( slChooserValues[index] ); 759 txtChooserField1->setText( slChooserValues[index] );
745 txtChooserField1->setFocus(); 760 txtChooserField1->setFocus();
746} 761}
747 762
748void ContactEditor::slotCmbChooser2Change( int index ) { 763void ContactEditor::slotCmbChooser2Change( int index ) {
749 764
750 txtChooserField2->setText( slChooserValues[index] ); 765 txtChooserField2->setText( slChooserValues[index] );
751 txtChooserField2->setFocus(); 766 txtChooserField2->setFocus();
752} 767}
753 768
754void ContactEditor::slotCmbChooser3Change( int index ) { 769void ContactEditor::slotCmbChooser3Change( int index ) {
755 770
756 txtChooserField3->setText( slChooserValues[index] ); 771 txtChooserField3->setText( slChooserValues[index] );
757 txtChooserField3->setFocus(); 772 txtChooserField3->setFocus();
758 773
759} 774}
760 775
761void ContactEditor::slotCmbChooser4Change( int index ) { 776void ContactEditor::slotCmbChooser4Change( int index ) {
762 777
763 txtChooserField4->setText( slChooserValues[index] ); 778 txtChooserField4->setText( slChooserValues[index] );
764 txtChooserField4->setFocus(); 779 txtChooserField4->setFocus();
765 780
766} 781}
767 782
768void ContactEditor::slotAddressTypeChange( int index ) { 783void ContactEditor::slotAddressTypeChange( int index ) {
769 784
770 if ( index == 0 ) { 785 if ( index == 0 ) {
771 786
772 txtAddress->setText( slBusinessAddress[0] ); 787 txtAddress->setText( slBusinessAddress[0] );
773 //txtAddress2->setText( (*slBusinessAddress)[1] ); 788 //txtAddress2->setText( (*slBusinessAddress)[1] );
774 //txtPOBox->setText( (*slBusinessAddress)[2] ); 789 //txtPOBox->setText( (*slBusinessAddress)[2] );
775 txtCity->setText( slBusinessAddress[3] ); 790 txtCity->setText( slBusinessAddress[3] );
776 txtState->setText( slBusinessAddress[4] ); 791 txtState->setText( slBusinessAddress[4] );
777 txtZip->setText( slBusinessAddress[5] ); 792 txtZip->setText( slBusinessAddress[5] );
778 QLineEdit *txtTmp = cmbCountry->lineEdit(); 793 QLineEdit *txtTmp = cmbCountry->lineEdit();
779 txtTmp->setText( slBusinessAddress[6] ); 794 txtTmp->setText( slBusinessAddress[6] );
780 795
781 } else { 796 } else {
782 797
783 txtAddress->setText( slHomeAddress[0] ); 798 txtAddress->setText( slHomeAddress[0] );
784 //txtAddress2->setText( (*slHomeAddress)[1] ); 799 //txtAddress2->setText( (*slHomeAddress)[1] );
785 //txtPOBox->setText( (*slHomeAddress)[2] ); 800 //txtPOBox->setText( (*slHomeAddress)[2] );
786 txtCity->setText( slHomeAddress[3] ); 801 txtCity->setText( slHomeAddress[3] );
787 txtState->setText( slHomeAddress[4] ); 802 txtState->setText( slHomeAddress[4] );
788 txtZip->setText( slHomeAddress[5] ); 803 txtZip->setText( slHomeAddress[5] );
789 QLineEdit *txtTmp = cmbCountry->lineEdit(); 804 QLineEdit *txtTmp = cmbCountry->lineEdit();
790 txtTmp->setText( slHomeAddress[6] ); 805 txtTmp->setText( slHomeAddress[6] );
791 806
792 } 807 }
793 808
794} 809}
795 810
796void ContactEditor::slotFullNameChange( const QString &textChanged ) { 811void ContactEditor::slotFullNameChange( const QString &textChanged ) {
797 812
798 int index = cmbFileAs->currentItem(); 813 int index = cmbFileAs->currentItem();
799 814
800 cmbFileAs->clear(); 815 cmbFileAs->clear();
801 816
802 cmbFileAs->insertItem( parseName( textChanged, 0 ) ); 817 cmbFileAs->insertItem( parseName( textChanged, 0 ) );
803 cmbFileAs->insertItem( parseName( textChanged, 1 ) ); 818 cmbFileAs->insertItem( parseName( textChanged, 1 ) );
804 cmbFileAs->insertItem( parseName( textChanged, 2 ) ); 819 cmbFileAs->insertItem( parseName( textChanged, 2 ) );
805 cmbFileAs->insertItem( parseName( textChanged, 3 ) ); 820 cmbFileAs->insertItem( parseName( textChanged, 3 ) );
806 821
807 cmbFileAs->setCurrentItem( index ); 822 cmbFileAs->setCurrentItem( index );
808 823
809 useFullName = true; 824 useFullName = true;
810 825
811} 826}
812 827
813void ContactEditor::accept() { 828void ContactEditor::accept() {
814 829
815 if ( isEmpty() ) { 830 if ( isEmpty() ) {
816 cleanupFields(); 831 cleanupFields();
817 reject(); 832 reject();
818 } else { 833 } else {
819 saveEntry(); 834 saveEntry();
820 cleanupFields(); 835 cleanupFields();
821 QDialog::accept(); 836 QDialog::accept();
822 } 837 }
823 838
824} 839}
825 840
826void ContactEditor::slotNote() { 841void ContactEditor::slotNote() {
827 842
828 dlgNote->showMaximized(); 843 dlgNote->showMaximized();
829 if ( !dlgNote->exec() ) { 844 if ( !dlgNote->exec() ) {
830 txtNote->setText( ent.notes() ); 845 txtNote->setText( ent.notes() );
831 } 846 }
832} 847}
833 848
834void ContactEditor::slotName() { 849void ContactEditor::slotName() {
835 850
836 QString tmpName; 851 QString tmpName;
837 if (useFullName) { 852 if (useFullName) {
838 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); 853 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) );
839 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); 854 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) );
840 txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); 855 txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
841 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); 856 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
842 } 857 }
843 dlgName->showMaximized(); 858 dlgName->showMaximized();
844 if ( dlgName->exec() ) { 859 if ( dlgName->exec() ) {
845 860
846 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); 861 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text();
847 txtFullName->setText( tmpName.simplifyWhiteSpace() ); 862 txtFullName->setText( tmpName.simplifyWhiteSpace() );
848 slotFullNameChange( txtFullName->text() ); 863 slotFullNameChange( txtFullName->text() );
849 useFullName = false; 864 useFullName = false;
850 } 865 }
851 866
852} 867}
853 868
854void ContactEditor::setNameFocus() { 869void ContactEditor::setNameFocus() {
855 870
856 txtFullName->setFocus(); 871 txtFullName->setFocus();
857 872
858} 873}
859 874
860bool ContactEditor::isEmpty() { 875bool ContactEditor::isEmpty() {
861 // Test and see if the record should be saved. 876 // Test and see if the record should be saved.
862 // More strict than the original qtopia, needs name or fileas to save 877 // More strict than the original qtopia, needs name or fileas to save
863 878
864 QString t = txtFullName->text(); 879 QString t = txtFullName->text();
865 if ( !t.isEmpty() && containsAlphaNum( t ) ) 880 if ( !t.isEmpty() && containsAlphaNum( t ) )
866 return false; 881 return false;
867 882
868 t = cmbFileAs->currentText(); 883 t = cmbFileAs->currentText();
869 if ( !t.isEmpty() && containsAlphaNum( t ) ) 884 if ( !t.isEmpty() && containsAlphaNum( t ) )
870 return false; 885 return false;
871 886
872 return true; 887 return true;
873 888
874} 889}
875 890
876QString ContactEditor::parseName( const QString fullName, int type ) { 891QString ContactEditor::parseName( const QString fullName, int type ) {
877 892
878 QString simplifiedName( fullName.simplifyWhiteSpace() ); 893 QString simplifiedName( fullName.simplifyWhiteSpace() );
879 QString strFirstName; 894 QString strFirstName;
880 QString strMiddleName; 895 QString strMiddleName;
881 QString strLastName; 896 QString strLastName;
882 QString strSuffix; 897 QString strSuffix;
883 QString strTitle; 898 QString strTitle;
884 int commapos; 899 int commapos;
885 int spCount; 900 int spCount;
886 int spPos; 901 int spPos;
887 int spPos2; 902 int spPos2;
888 903
889 904
890 commapos = simplifiedName.find( ',', 0, TRUE); 905 commapos = simplifiedName.find( ',', 0, TRUE);
891 spCount = simplifiedName.contains( ' ', TRUE ); 906 spCount = simplifiedName.contains( ' ', TRUE );
892 907
893 if ( commapos == -1 ) { 908 if ( commapos == -1 ) {
894 909
895 switch (spCount) { 910 switch (spCount) {
896 case 0: 911 case 0:
897 //return simplifiedName; 912 //return simplifiedName;
898 if (txtLastName->text() != "") { 913 if (txtLastName->text() != "") {
899 strLastName = simplifiedName; 914 strLastName = simplifiedName;
900 break; 915 break;
901 } 916 }
902 if (txtMiddleName->text() != "") { 917 if (txtMiddleName->text() != "") {
903 strMiddleName = simplifiedName; 918 strMiddleName = simplifiedName;
904 break; 919 break;
905 } 920 }
906 if (txtSuffix->text() != "") { 921 if (txtSuffix->text() != "") {
907 strSuffix = simplifiedName; 922 strSuffix = simplifiedName;
908 break; 923 break;
909 } 924 }
910 strFirstName = simplifiedName; 925 strFirstName = simplifiedName;
911 break; 926 break;
912 927
913 case 1: 928 case 1:
914 spPos = simplifiedName.find( ' ', 0, TRUE ); 929 spPos = simplifiedName.find( ' ', 0, TRUE );
915 strFirstName = simplifiedName.left( spPos ); 930 strFirstName = simplifiedName.left( spPos );
916 strLastName = simplifiedName.mid( spPos + 1 ); 931 strLastName = simplifiedName.mid( spPos + 1 );
917 break; 932 break;
918 933
919 case 2: 934 case 2:
920 spPos = simplifiedName.find( ' ', 0, TRUE ); 935 spPos = simplifiedName.find( ' ', 0, TRUE );
921 strFirstName = simplifiedName.left( spPos ); 936 strFirstName = simplifiedName.left( spPos );
922 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 937 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
923 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 938 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
924 strLastName = simplifiedName.mid( spPos2 + 1 ); 939 strLastName = simplifiedName.mid( spPos2 + 1 );
925 break; 940 break;
926 941
927 case 3: 942 case 3:
928 spPos = simplifiedName.find( ' ', 0, TRUE ); 943 spPos = simplifiedName.find( ' ', 0, TRUE );
929 strFirstName = simplifiedName.left( spPos ); 944 strFirstName = simplifiedName.left( spPos );
930 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 945 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
931 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 946 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
932 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 947 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
933 strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 948 strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
934 strSuffix = simplifiedName.mid( spPos + 1 ); 949 strSuffix = simplifiedName.mid( spPos + 1 );
935 break; 950 break;
936 951
937 case 4: 952 case 4:
938 spPos = simplifiedName.find( ' ', 0, TRUE ); 953 spPos = simplifiedName.find( ' ', 0, TRUE );
939 strTitle = simplifiedName.left( spPos ); 954 strTitle = simplifiedName.left( spPos );
940 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 955 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
941 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 956 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
942 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 957 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
943 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 958 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
944 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 959 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
945 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 960 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
946 strSuffix = simplifiedName.mid( spPos2 + 1 ); 961 strSuffix = simplifiedName.mid( spPos2 + 1 );
947 break; 962 break;
948 963
949 default: 964 default:
950 spPos = simplifiedName.find( ' ', 0, TRUE ); 965 spPos = simplifiedName.find( ' ', 0, TRUE );
951 strTitle = simplifiedName.left( spPos ); 966 strTitle = simplifiedName.left( spPos );
952 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 967 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
953 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 968 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
954 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 969 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
955 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 970 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
956 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 971 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
957 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 972 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
958 strSuffix = simplifiedName.mid( spPos2 + 1 ); 973 strSuffix = simplifiedName.mid( spPos2 + 1 );
959 break; 974 break;
960 } 975 }
961 } else { 976 } else {
962 simplifiedName.replace( commapos, 1, " " ); 977 simplifiedName.replace( commapos, 1, " " );
963 simplifiedName = simplifiedName.simplifyWhiteSpace(); 978 simplifiedName = simplifiedName.simplifyWhiteSpace();
964 979
965 switch (spCount) { 980 switch (spCount) {
966 case 0: 981 case 0:
967 //return simplifiedName; 982 //return simplifiedName;
968 if (txtLastName->text() != "") { 983 if (txtLastName->text() != "") {
969 strLastName = simplifiedName; 984 strLastName = simplifiedName;
970 break; 985 break;
971 } 986 }
972 if (txtMiddleName->text() != "") { 987 if (txtMiddleName->text() != "") {
973 strMiddleName = simplifiedName; 988 strMiddleName = simplifiedName;
974 break; 989 break;
975 } 990 }
976 if (txtSuffix->text() != "") { 991 if (txtSuffix->text() != "") {
977 strSuffix = simplifiedName; 992 strSuffix = simplifiedName;
978 break; 993 break;
979 } 994 }
980 strFirstName = simplifiedName; 995 strFirstName = simplifiedName;
981 break; 996 break;
982 997
983 case 1: 998 case 1:
984 spPos = simplifiedName.find( ' ', 0, TRUE ); 999 spPos = simplifiedName.find( ' ', 0, TRUE );
985 strLastName = simplifiedName.left( spPos ); 1000 strLastName = simplifiedName.left( spPos );
986 strFirstName = simplifiedName.mid( spPos + 1 ); 1001 strFirstName = simplifiedName.mid( spPos + 1 );
987 break; 1002 break;
988 1003
989 case 2: 1004 case 2:
990 spPos = simplifiedName.find( ' ', 0, TRUE ); 1005 spPos = simplifiedName.find( ' ', 0, TRUE );
991 strLastName = simplifiedName.left( spPos ); 1006 strLastName = simplifiedName.left( spPos );
992 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1007 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
993 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1008 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
994 strMiddleName = simplifiedName.mid( spPos2 + 1 ); 1009 strMiddleName = simplifiedName.mid( spPos2 + 1 );
995 break; 1010 break;
996 1011
997 case 3: 1012 case 3:
998 spPos = simplifiedName.find( ' ', 0, TRUE ); 1013 spPos = simplifiedName.find( ' ', 0, TRUE );
999 strLastName = simplifiedName.left( spPos ); 1014 strLastName = simplifiedName.left( spPos );
1000 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1015 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1001 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1016 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1002 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1017 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1003 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1018 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1004 strSuffix = simplifiedName.mid( spPos + 1 ); 1019 strSuffix = simplifiedName.mid( spPos + 1 );
1005 break; 1020 break;
1006 1021
1007 case 4: 1022 case 4:
1008 spPos = simplifiedName.find( ' ', 0, TRUE ); 1023 spPos = simplifiedName.find( ' ', 0, TRUE );
1009 strLastName = simplifiedName.left( spPos ); 1024 strLastName = simplifiedName.left( spPos );
1010 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1025 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1011 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1026 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1012 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1027 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1013 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1028 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1014 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1029 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1015 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1030 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1016 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1031 strSuffix = simplifiedName.mid( spPos2 + 1 );
1017 break; 1032 break;
1018 1033
1019 default: 1034 default:
1020 spPos = simplifiedName.find( ' ', 0, TRUE ); 1035 spPos = simplifiedName.find( ' ', 0, TRUE );
1021 strLastName = simplifiedName.left( spPos ); 1036 strLastName = simplifiedName.left( spPos );
1022 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1037 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1023 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1038 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1024 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1039 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1025 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); 1040 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos );
1026 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1041 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1027 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1042 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1028 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1043 strSuffix = simplifiedName.mid( spPos2 + 1 );
1029 break; 1044 break;
1030 } 1045 }
1031 } 1046 }
1032 switch (type) { 1047 switch (type) {
1033 case NAME_FL: 1048 case NAME_FL:
1034 return strFirstName + " " + strLastName; 1049 return strFirstName + " " + strLastName;
1035 1050
1036 case NAME_LF: 1051 case NAME_LF:
1037 return strLastName + ", " + strFirstName; 1052 return strLastName + ", " + strFirstName;
1038 1053
1039 case NAME_LFM: 1054 case NAME_LFM:
1040 return strLastName + ", " + strFirstName + " " + strMiddleName; 1055 return strLastName + ", " + strFirstName + " " + strMiddleName;
1041 1056
1042 case NAME_FMLS: 1057 case NAME_FMLS:
1043 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; 1058 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix;
1044 1059
1045 case NAME_F: 1060 case NAME_F:
1046 return strFirstName; 1061 return strFirstName;
1047 1062
1048 case NAME_M: 1063 case NAME_M:
1049 return strMiddleName; 1064 return strMiddleName;
1050 1065
1051 case NAME_L: 1066 case NAME_L:
1052 return strLastName; 1067 return strLastName;
1053 1068
1054 case NAME_S: 1069 case NAME_S:
1055 return strSuffix; 1070 return strSuffix;
1056 1071
1057 } 1072 }
1058 return QString::null; 1073 return QString::null;
1059} 1074}
1060 1075
1061void ContactEditor::cleanupFields() { 1076void ContactEditor::cleanupFields() {
1062 QStringList::Iterator it = slChooserValues.begin(); 1077 QStringList::Iterator it = slChooserValues.begin();
1078
1063 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { 1079 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) {
1064 (*it) = ""; 1080 (*it) = "";
1065 } 1081 }
1066 1082
1067 for ( int i = 0; i < 7; i++ ) { 1083 for ( int i = 0; i < 7; i++ ) {
1068 slHomeAddress[i] = ""; 1084 slHomeAddress[i] = "";
1069 slBusinessAddress[i] = ""; 1085 slBusinessAddress[i] = "";
1070 } 1086 }
1071 1087
1072 QListIterator<QLineEdit> itLV( listValue ); 1088 QListIterator<QLineEdit> itLV( listValue );
1073 for ( ; itLV.current(); ++itLV ) { 1089 for ( ; itLV.current(); ++itLV ) {
1074 (*itLV)->setText( "" ); 1090 (*itLV)->setText( "" );
1075 } 1091 }
1076 1092
1077 txtFirstName->setText(""); 1093 txtFirstName->setText("");
1078 txtMiddleName->setText(""); 1094 txtMiddleName->setText("");
1079 txtLastName->setText(""); 1095 txtLastName->setText("");
1080 txtSuffix->setText(""); 1096 txtSuffix->setText("");
1081 txtNote->setText(""); 1097 txtNote->setText("");
1082 txtFullName->setText(""); 1098 txtFullName->setText("");
1083 txtJobTitle->setText(""); 1099 txtJobTitle->setText("");
1084 txtOrganization->setText(""); 1100 txtOrganization->setText("");
1085 txtChooserField1->setText(""); 1101 txtChooserField1->setText("");
1086 txtChooserField2->setText(""); 1102 txtChooserField2->setText("");
1087 txtChooserField3->setText(""); 1103 txtChooserField3->setText("");
1088 txtAddress->setText(""); 1104 txtAddress->setText("");
1089 txtCity->setText(""); 1105 txtCity->setText("");
1090 txtState->setText(""); 1106 txtState->setText("");
1091 txtZip->setText(""); 1107 txtZip->setText("");
1092 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1108 QLineEdit *txtTmp = cmbCountry->lineEdit();
1093 txtTmp->setText(""); 1109 txtTmp->setText("");
1094 txtTmp = cmbFileAs->lineEdit(); 1110 txtTmp = cmbFileAs->lineEdit();
1095 txtTmp->setText(""); 1111 txtTmp->setText("");
1096 1112
1097} 1113}
1098 1114
1099void ContactEditor::setEntry( const OContact &entry ) { 1115void ContactEditor::setEntry( const OContact &entry ) {
1100 1116
1101 cleanupFields(); 1117 cleanupFields();
1102 1118
1103 ent = entry; 1119 ent = entry;
1104 1120
1121
1122
1123 emails = QStringList(ent.emailList());
1124 defaultEmail = ent.defaultEmail();
1125 if (defaultEmail.isEmpty()) defaultEmail = emails[0];
1126 qDebug("default email=%s",defaultEmail.latin1());
1127
1105 useFullName = false; 1128 useFullName = false;
1106 txtFirstName->setText( ent.firstName() ); 1129 txtFirstName->setText( ent.firstName() );
1107 txtMiddleName->setText( ent.middleName() ); 1130 txtMiddleName->setText( ent.middleName() );
1108 txtLastName->setText( ent.lastName() ); 1131 txtLastName->setText( ent.lastName() );
1109 txtSuffix->setText( ent.suffix() ); 1132 txtSuffix->setText( ent.suffix() );
1110 1133
1111 QString *tmpString = new QString; 1134 QString *tmpString = new QString;
1112 *tmpString = ent.firstName() + " " + ent.middleName() + 1135 *tmpString = ent.firstName() + " " + ent.middleName() +
1113 + " " + ent.lastName() + " " + ent.suffix(); 1136 + " " + ent.lastName() + " " + ent.suffix();
1114 1137
1115 txtFullName->setText( tmpString->simplifyWhiteSpace() ); 1138 txtFullName->setText( tmpString->simplifyWhiteSpace() );
1116 1139
1117 cmbFileAs->setEditText( ent.fileAs() ); 1140 cmbFileAs->setEditText( ent.fileAs() );
1118 1141
1119 //if (hasTitle) 1142 //if (hasTitle)
1120 txtJobTitle->setText( ent.jobTitle() ); 1143 txtJobTitle->setText( ent.jobTitle() );
1121 1144
1122 //if (hasCompany) 1145 //if (hasCompany)
1123 txtOrganization->setText( ent.company() ); 1146 txtOrganization->setText( ent.company() );
1124 1147
1125 //if (hasNotes) 1148 //if (hasNotes)
1126 txtNote->setText( ent.notes() ); 1149 txtNote->setText( ent.notes() );
1127 1150
1128 //if (hasStreet) { 1151 //if (hasStreet) {
1129 slHomeAddress[0] = ent.homeStreet(); 1152 slHomeAddress[0] = ent.homeStreet();
1130 slBusinessAddress[0] = ent.businessStreet(); 1153 slBusinessAddress[0] = ent.businessStreet();
1131 //} 1154 //}
1132 1155
1133 //if (hasCity) { 1156 //if (hasCity) {
1134 slHomeAddress[3] = ent.homeCity(); 1157 slHomeAddress[3] = ent.homeCity();
1135 slBusinessAddress[3] = ent.businessCity(); 1158 slBusinessAddress[3] = ent.businessCity();
1136//} 1159//}
1137 1160
1138//if (hasState) { 1161//if (hasState) {
1139 slHomeAddress[4] = ent.homeState(); 1162 slHomeAddress[4] = ent.homeState();
1140 slBusinessAddress[4] = ent.businessState(); 1163 slBusinessAddress[4] = ent.businessState();
1141//} 1164//}
1142 1165
1143//if (hasZip) { 1166//if (hasZip) {
1144 slHomeAddress[5] = ent.homeZip(); 1167 slHomeAddress[5] = ent.homeZip();
1145 slBusinessAddress[5] = ent.businessZip(); 1168 slBusinessAddress[5] = ent.businessZip();
1146//} 1169//}
1147 1170
1148//if (hasCountry) { 1171//if (hasCountry) {
1149 slHomeAddress[6] = ent.homeCountry(); 1172 slHomeAddress[6] = ent.homeCountry();
1150 slBusinessAddress[6] = ent.businessCountry(); 1173 slBusinessAddress[6] = ent.businessCountry();
1151//} 1174//}
1152 1175
1153 QStringList::ConstIterator it; 1176 QStringList::ConstIterator it;
1154 QListIterator<QLineEdit> itLE( listValue ); 1177 QListIterator<QLineEdit> itLE( listValue );
1155 for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { 1178 for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) {
1156 if ( *it == "Department" ) 1179 if ( *it == "Department" )
1157 (*itLE)->setText( ent.department() ); 1180 (*itLE)->setText( ent.department() );
1158 1181
1159 if ( *it == "Company" ) 1182 if ( *it == "Company" )
1160 (*itLE)->setText( ent.company() ); 1183 (*itLE)->setText( ent.company() );
1161 1184
1162 if ( *it == "Office" ) 1185 if ( *it == "Office" )
1163 (*itLE)->setText( ent.office() ); 1186 (*itLE)->setText( ent.office() );
1164 1187
1165 if ( *it == "Profession" ) 1188 if ( *it == "Profession" )
1166 (*itLE)->setText( ent.profession() ); 1189 (*itLE)->setText( ent.profession() );
1167 1190
1168 if ( *it == "Assistant" ) 1191 if ( *it == "Assistant" )
1169 (*itLE)->setText( ent.assistant() ); 1192 (*itLE)->setText( ent.assistant() );
1170 1193
1171 if ( *it == "Manager" ) 1194 if ( *it == "Manager" )
1172 (*itLE)->setText( ent.manager() ); 1195 (*itLE)->setText( ent.manager() );
1173 1196
1174 if ( *it == "Spouse" ) 1197 if ( *it == "Spouse" )
1175 (*itLE)->setText( ent.spouse() ); 1198 (*itLE)->setText( ent.spouse() );
1176 1199
1177 if ( *it == "Nickname" ) 1200 if ( *it == "Nickname" )
1178 (*itLE)->setText( ent.nickname() ); 1201 (*itLE)->setText( ent.nickname() );
1179 1202
1180 if ( *it == "Children" ) 1203 if ( *it == "Children" )
1181 (*itLE)->setText( ent.children() ); 1204 (*itLE)->setText( ent.children() );
1182 1205
1183 } 1206 }
1184 1207
1185 QStringList::Iterator itV; 1208 QStringList::Iterator itV;
1186 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1209 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1187 1210
1188 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) 1211 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) )
1189 *itV = ent.businessPhone(); 1212 *itV = ent.businessPhone();
1190/* 1213/*
1191 if ( *it == "Business 2 Phone" ) 1214 if ( *it == "Business 2 Phone" )
1192 *itV = ent.business2Phone(); 1215 *itV = ent.business2Phone();
1193*/ 1216*/
1194 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) 1217 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) )
1195 *itV = ent.businessFax(); 1218 *itV = ent.businessFax();
1196 1219
1197 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) 1220 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) )
1198 *itV = ent.businessMobile(); 1221 *itV = ent.businessMobile();
1199/* 1222/*
1200 if ( *it == "Company Phone" ) 1223 if ( *it == "Company Phone" )
1201 *itV = ent.companyPhone(); 1224 *itV = ent.companyPhone();
1202*/ 1225*/
1203 if ( *it == "Default Email" ) 1226 if ( *it == "Default Email" )
1204 *itV = ent.defaultEmail(); 1227 *itV = ent.defaultEmail();
1205 1228
1206 if ( *it == "Emails" ) 1229 if ( *it == "Emails" )
1207 *itV = ent.emailList().join(", "); // :SX 1230 *itV = ent.emailList().join(", "); // :SX
1208 1231
1209 if ( *it == "Home Phone" ) 1232 if ( *it == "Home Phone" )
1210 *itV = ent.homePhone(); 1233 *itV = ent.homePhone();
1211/* 1234/*
1212 if ( *it == "Home 2 Phone" ) 1235 if ( *it == "Home 2 Phone" )
1213 *itV = ent.home2Phone(); 1236 *itV = ent.home2Phone();
1214*/ 1237*/
1215 if ( *it == "Home Fax" ) 1238 if ( *it == "Home Fax" )
1216 *itV = ent.homeFax(); 1239 *itV = ent.homeFax();
1217 1240
1218 if ( *it == "Home Mobile" ) 1241 if ( *it == "Home Mobile" )
1219 *itV = ent.homeMobile(); 1242 *itV = ent.homeMobile();
1220/* 1243/*
1221 if ( *it == "Car Phone" ) 1244 if ( *it == "Car Phone" )
1222 *itV = ent.carPhone(); 1245 *itV = ent.carPhone();
1223 1246
1224 if ( *it == "ISDN Phone" ) 1247 if ( *it == "ISDN Phone" )
1225 *itV = ent.ISDNPhone(); 1248 *itV = ent.ISDNPhone();
1226 1249
1227 if ( *it == "Other Phone" ) 1250 if ( *it == "Other Phone" )
1228 *itV = ent.otherPhone(); 1251 *itV = ent.otherPhone();
1229*/ 1252*/
1230 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) 1253 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
1231 *itV = ent.businessPager(); 1254 *itV = ent.businessPager();
1232/* 1255/*
1233 if ( *it == "Home Pager") 1256 if ( *it == "Home Pager")
1234 *itV = ent.homePager(); 1257 *itV = ent.homePager();
1235 1258
1236 if ( *it == "AIM IM" ) 1259 if ( *it == "AIM IM" )
1237 *itV = ent.AIMIM(); 1260 *itV = ent.AIMIM();
1238 1261
1239 if ( *it == "ICQ IM" ) 1262 if ( *it == "ICQ IM" )
1240 *itV = ent.ICQIM(); 1263 *itV = ent.ICQIM();
1241 1264
1242 if ( *it == "Jabber IM" ) 1265 if ( *it == "Jabber IM" )
1243 *itV = ent.jabberIM(); 1266 *itV = ent.jabberIM();
1244 1267
1245 if ( *it == "MSN IM" ) 1268 if ( *it == "MSN IM" )
1246 *itV = ent.MSNIM(); 1269 *itV = ent.MSNIM();
1247 1270
1248 if ( *it == "Yahoo IM" ) 1271 if ( *it == "Yahoo IM" )
1249 *itV = ent.yahooIM(); 1272 *itV = ent.yahooIM();
1250*/ 1273*/
1251 if ( *it == "Home Web Page" ) 1274 if ( *it == "Home Web Page" )
1252 *itV = ent.homeWebpage(); 1275 *itV = ent.homeWebpage();
1253 1276
1254 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) 1277 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1255 *itV = ent.businessWebpage(); 1278 *itV = ent.businessWebpage();
1256 1279
1257 1280
1258 } 1281 }
1259 1282
1260 1283
1261 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); 1284 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") );
1262 1285
1263 QString gender = ent.gender(); 1286 QString gender = ent.gender();
1264 cmbGender->setCurrentItem( gender.toInt() ); 1287 cmbGender->setCurrentItem( gender.toInt() );
1265 1288
1266 txtNote->setText( ent.notes() ); 1289 txtNote->setText( ent.notes() );
1267 1290
1268 slotCmbChooser1Change( cmbChooserField1->currentItem() ); 1291 slotCmbChooser1Change( cmbChooserField1->currentItem() );
1269 slotCmbChooser2Change( cmbChooserField2->currentItem() ); 1292 slotCmbChooser2Change( cmbChooserField2->currentItem() );
1270 slotCmbChooser3Change( cmbChooserField3->currentItem() ); 1293 slotCmbChooser3Change( cmbChooserField3->currentItem() );
1271 1294
1272 slotAddressTypeChange( cmbAddress->currentItem() ); 1295 slotAddressTypeChange( cmbAddress->currentItem() );
1273 1296
1274 // loadFields(); :SX 1297 // loadFields(); :SX
1275 updateDatePicker(); 1298 updateDatePicker();
1276} 1299}
1277void ContactEditor::updateDatePicker() 1300void ContactEditor::updateDatePicker()
1278{ 1301{
1279 // Set DatePicker 1302 // Set DatePicker
1280 if ( !ent.birthday().isNull() ){ 1303 if ( !ent.birthday().isNull() ){
1281 birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); 1304 birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) );
1282 birthdayPicker->setDate( ent.birthday() ); 1305 birthdayPicker->setDate( ent.birthday() );
1283 } else 1306 } else
1284 birthdayButton->setText( tr ("Unknown") ); 1307 birthdayButton->setText( tr ("Unknown") );
1285 1308
1286 if ( !ent.anniversary().isNull() ){ 1309 if ( !ent.anniversary().isNull() ){
1287 anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); 1310 anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) );
1288 anniversaryPicker->setDate( ent.anniversary() ); 1311 anniversaryPicker->setDate( ent.anniversary() );
1289 } else 1312 } else
1290 anniversaryButton->setText( tr ("Unknown") ); 1313 anniversaryButton->setText( tr ("Unknown") );
1291 1314
1292} 1315}
1293 1316
1294void ContactEditor::saveEntry() { 1317void ContactEditor::saveEntry() {
1295 1318
1296 if ( useFullName ) { 1319 if ( useFullName ) {
1297 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); 1320 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) );
1298 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); 1321 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) );
1299 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); 1322 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
1300 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); 1323 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
1301 1324
1302 useFullName = false; 1325 useFullName = false;
1303 } 1326 }
1304 1327
1305 ent.setFirstName( txtFirstName->text() ); 1328 ent.setFirstName( txtFirstName->text() );
1306 ent.setLastName( txtLastName->text() ); 1329 ent.setLastName( txtLastName->text() );
1307 ent.setMiddleName( txtMiddleName->text() ); 1330 ent.setMiddleName( txtMiddleName->text() );
1308 ent.setSuffix( txtSuffix->text() ); 1331 ent.setSuffix( txtSuffix->text() );
1309 1332
1310 ent.setFileAs( cmbFileAs->currentText() ); 1333 ent.setFileAs( cmbFileAs->currentText() );
1311 1334
1312 ent.setCategories( cmbCat->currentCategories() ); 1335 ent.setCategories( cmbCat->currentCategories() );
1313 1336
1314 1337
1315 //if (hasTitle) 1338 //if (hasTitle)
1316 ent.setJobTitle( txtJobTitle->text() ); 1339 ent.setJobTitle( txtJobTitle->text() );
1317 1340
1318 //if (hasCompany) 1341 //if (hasCompany)
1319 ent.setCompany( txtOrganization->text() ); 1342 ent.setCompany( txtOrganization->text() );
1320 1343
1321 //if (hasNotes) 1344 //if (hasNotes)
1322 ent.setNotes( txtNote->text() ); 1345 ent.setNotes( txtNote->text() );
1323 1346
1324 //if (hasStreet) { 1347 //if (hasStreet) {
1325 ent.setHomeStreet( slHomeAddress[0] ); 1348 ent.setHomeStreet( slHomeAddress[0] );
1326 ent.setBusinessStreet( slBusinessAddress[0] ); 1349 ent.setBusinessStreet( slBusinessAddress[0] );
1327 //} 1350 //}
1328 1351
1329 //if (hasCity) { 1352 //if (hasCity) {
1330 ent.setHomeCity( slHomeAddress[3] ); 1353 ent.setHomeCity( slHomeAddress[3] );
1331 ent.setBusinessCity( slBusinessAddress[3] ); 1354 ent.setBusinessCity( slBusinessAddress[3] );
1332 //} 1355 //}
1333 1356
1334 //if (hasState) { 1357 //if (hasState) {
1335 ent.setHomeState( slHomeAddress[4] ); 1358 ent.setHomeState( slHomeAddress[4] );
1336 ent.setBusinessState( slBusinessAddress[4] ); 1359 ent.setBusinessState( slBusinessAddress[4] );
1337 //} 1360 //}
1338 1361
1339 //if (hasZip) { 1362 //if (hasZip) {
1340 ent.setHomeZip( slHomeAddress[5] ); 1363 ent.setHomeZip( slHomeAddress[5] );
1341 ent.setBusinessZip( slBusinessAddress[5] ); 1364 ent.setBusinessZip( slBusinessAddress[5] );
1342 //} 1365 //}
1343 1366
1344 //if (hasCountry) { 1367 //if (hasCountry) {
1345 ent.setHomeCountry( slHomeAddress[6] ); 1368 ent.setHomeCountry( slHomeAddress[6] );
1346 ent.setBusinessCountry( slBusinessAddress[6] ); 1369 ent.setBusinessCountry( slBusinessAddress[6] );
1347 //} 1370 //}
1348 1371
1349 QStringList::ConstIterator it; 1372 QStringList::ConstIterator it;
1350 QListIterator<QLineEdit> itLE( listValue ); 1373 QListIterator<QLineEdit> itLE( listValue );
1351 for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { 1374 for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) {
1352 1375
1353 if ( *it == "Department" ) 1376 if ( *it == "Department" )
1354 ent.setDepartment( (*itLE)->text() ); 1377 ent.setDepartment( (*itLE)->text() );
1355 1378
1356 if ( *it == "Company" ) 1379 if ( *it == "Company" )
1357 ent.setCompany( (*itLE)->text() ); 1380 ent.setCompany( (*itLE)->text() );
1358 1381
1359 if ( *it == "Office" ) 1382 if ( *it == "Office" )
1360 ent.setOffice( (*itLE)->text() ); 1383 ent.setOffice( (*itLE)->text() );
1361 1384
1362 if ( *it == "Profession" ) 1385 if ( *it == "Profession" )
1363 ent.setProfession( (*itLE)->text() ); 1386 ent.setProfession( (*itLE)->text() );
1364 1387
1365 if ( *it == "Assistant" ) 1388 if ( *it == "Assistant" )
1366 ent.setAssistant( (*itLE)->text() ); 1389 ent.setAssistant( (*itLE)->text() );
1367 1390
1368 if ( *it == "Manager" ) 1391 if ( *it == "Manager" )
1369 ent.setManager( (*itLE)->text() ); 1392 ent.setManager( (*itLE)->text() );
1370 1393
1371 if ( *it == "Spouse" ) 1394 if ( *it == "Spouse" )
1372 ent.setSpouse( (*itLE)->text() ); 1395 ent.setSpouse( (*itLE)->text() );
1373 1396
1374 if ( *it == "Nickname" ) 1397 if ( *it == "Nickname" )
1375 ent.setNickname( (*itLE)->text() ); 1398 ent.setNickname( (*itLE)->text() );
1376 1399
1377 if ( *it == "Children" ) 1400 if ( *it == "Children" )
1378 ent.setChildren( (*itLE)->text() ); 1401 ent.setChildren( (*itLE)->text() );
1379 1402
1380 } 1403 }
1381 1404
1382 1405
1383 QStringList::ConstIterator itV; 1406 QStringList::ConstIterator itV;
1384 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1407 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1385 1408
1386 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) 1409 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) )
1387 ent.setBusinessPhone( *itV ); 1410 ent.setBusinessPhone( *itV );
1388 1411
1389 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) 1412 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) )
1390 ent.setBusinessFax( *itV ); 1413 ent.setBusinessFax( *itV );
1391 1414
1392 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) 1415 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) )
1393 ent.setBusinessMobile( *itV ); 1416 ent.setBusinessMobile( *itV );
1394 1417
1395 if ( *it == "Emails" ){ 1418 if ( *it == "Emails" ){
1396 QString allemail; 1419 QString allemail;
1397 QString defaultmail; 1420 QString defaultmail;
1398 parseEmailFrom( *itV, defaultmail, allemail ); 1421 parseEmailFrom( *itV, defaultmail, allemail );
1399 // ent.clearEmails(); 1422 // ent.clearEmails();
1400 // ent.setDefaultEmail( defaultmail ); 1423 // ent.setDefaultEmail( defaultmail );
1401 ent.setEmails( allemail ); 1424 ent.setEmails( allemail );
1402 } 1425 }
1403 1426
1404 if ( *it == "Default Email") 1427 if ( *it == "Default Email")
1405 ent.setDefaultEmail( *itV ); 1428 ent.setDefaultEmail( *itV );
1406 1429
1407 if ( *it == "Home Phone" ) 1430 if ( *it == "Home Phone" )
1408 ent.setHomePhone( *itV ); 1431 ent.setHomePhone( *itV );
1409 1432
1410 if ( *it == "Home Fax" ) 1433 if ( *it == "Home Fax" )
1411 ent.setHomeFax( *itV ); 1434 ent.setHomeFax( *itV );
1412 1435
1413 if ( *it == "Home Mobile" ) 1436 if ( *it == "Home Mobile" )
1414 ent.setHomeMobile( *itV ); 1437 ent.setHomeMobile( *itV );
1415 1438
1416 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) 1439 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
1417 ent.setBusinessPager( *itV ); 1440 ent.setBusinessPager( *itV );
1418 1441
1419 if ( *it == "Home Web Page" ) 1442 if ( *it == "Home Web Page" )
1420 ent.setHomeWebpage( *itV ); 1443 ent.setHomeWebpage( *itV );
1421 1444
1422 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) 1445 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1423 ent.setBusinessWebpage( *itV ); 1446 ent.setBusinessWebpage( *itV );
1424 1447
1425 1448
1426 } 1449 }
1427 1450
1428 int gender = cmbGender->currentItem(); 1451 int gender = cmbGender->currentItem();
1429 ent.setGender( QString::number( gender ) ); 1452 ent.setGender( QString::number( gender ) );
1430 1453
1431 QString str = txtNote->text(); 1454 QString str = txtNote->text();
1432 if ( !str.isNull() ) 1455 if ( !str.isNull() )
1433 ent.setNotes( str ); 1456 ent.setNotes( str );
1434 1457
1435} 1458}
1436 1459
1437void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 1460void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
1438 QString &strAll ) 1461 QString &strAll )
1439{ 1462{
1440 int where, 1463 int where,
1441 start; 1464 start;
1442 if ( txt.isEmpty() ) 1465 if ( txt.isEmpty() )
1443 return; 1466 return;
1444 // find the first 1467 // find the first
1445 where = txt.find( ',' ); 1468 where = txt.find( ',' );
1446 if ( where < 0 ) { 1469 if ( where < 0 ) {
1447 strDefaultEmail = txt; 1470 strDefaultEmail = txt;
1448 strAll = txt; 1471 strAll = txt;
1449 } else { 1472 } else {
1450 strDefaultEmail = txt.left( where ).stripWhiteSpace(); 1473 strDefaultEmail = txt.left( where ).stripWhiteSpace();
1451 strAll = strDefaultEmail; 1474 strAll = strDefaultEmail;
1452 while ( where > -1 ) { 1475 while ( where > -1 ) {
1453 strAll.append(" "); 1476 strAll.append(" ");
1454 start = where; 1477 start = where;
1455 where = txt.find( ',', where + 1 ); 1478 where = txt.find( ',', where + 1 );
1456 if ( where > - 1 ) 1479 if ( where > - 1 )
1457 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); 1480 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() );
1458 else // grab until the end... 1481 else // grab until the end...
1459 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); 1482 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() );
1460 } 1483 }
1461 } 1484 }
1462} 1485}
1463 1486
1464void parseEmailTo( const QString &strDefaultEmail, 1487void parseEmailTo( const QString &strDefaultEmail,
1465 const QString &strOtherEmail, QString &strBack ) 1488 const QString &strOtherEmail, QString &strBack )
1466{ 1489{
1467 // create a comma dilimeted set of emails... 1490 // create a comma dilimeted set of emails...
1468 // use the power of short circuiting... 1491 // use the power of short circuiting...
1469 bool foundDefault = false; 1492 bool foundDefault = false;
1470 QString strTmp; 1493 QString strTmp;
1471 int start = 0; 1494 int start = 0;
1472 int where; 1495 int where;
1473 // start at the beginng. 1496 // start at the beginng.
1474 strBack = strDefaultEmail; 1497 strBack = strDefaultEmail;
1475 where = 0; 1498 where = 0;
1476 while ( where > -1 ) { 1499 while ( where > -1 ) {
1477 start = where; 1500 start = where;
1478 where = strOtherEmail.find( ' ', where + 1 ); 1501 where = strOtherEmail.find( ' ', where + 1 );
1479 if ( where > 0 ) { 1502 if ( where > 0 ) {
1480 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); 1503 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace();
1481 } else 1504 } else
1482 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); 1505 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace();
1483 if ( foundDefault || strTmp != strDefaultEmail ) { 1506 if ( foundDefault || strTmp != strDefaultEmail ) {
1484 strBack.append( ", " ); 1507 strBack.append( ", " );
1485 strBack.append( strTmp ); 1508 strBack.append( strTmp );
1486 } else 1509 } else
1487 foundDefault = true; 1510 foundDefault = true;
1488 } 1511 }
1489} 1512}
1490 1513
1491 1514
1492static inline bool containsAlphaNum( const QString &str ) 1515static inline bool containsAlphaNum( const QString &str )
1493{ 1516{
1494 int i, 1517 int i,
1495 count = str.length(); 1518 count = str.length();
1496 for ( i = 0; i < count; i++ ) 1519 for ( i = 0; i < count; i++ )
1497 if ( !str[i].isSpace() ) 1520 if ( !str[i].isSpace() )
1498 return TRUE; 1521 return TRUE;
1499 return FALSE; 1522 return FALSE;
1500} 1523}
1501 1524
1502static inline bool constainsWhiteSpace( const QString &str ) 1525static inline bool constainsWhiteSpace( const QString &str )
1503{ 1526{
1504 int i, 1527 int i,
1505 count = str.length(); 1528 count = str.length();
1506 for (i = 0; i < count; i++ ) 1529 for (i = 0; i < count; i++ )
1507 if ( str[i].isSpace() ) 1530 if ( str[i].isSpace() )
1508 return TRUE; 1531 return TRUE;
1509 return FALSE; 1532 return FALSE;
1510} 1533}
1511 1534
1512void ContactEditor::setPersonalView( bool personal ) 1535void ContactEditor::setPersonalView( bool personal )
1513{ 1536{
1514 m_personalView = personal; 1537 m_personalView = personal;
1515 1538
1516 // Currently disbled due to the fact that 1539 // Currently disbled due to the fact that
1517 // show will not work... 1540 // show will not work...
1518 return; 1541 return;
1519 1542
1520 if ( personal ){ 1543 if ( personal ){
1521 cmbCat->hide(); 1544 cmbCat->hide();
1522 labCat->hide(); 1545 labCat->hide();
1523 1546
1524 } else{ 1547 } else{
1525 cmbCat->show(); 1548 cmbCat->show();
1526 labCat->show(); 1549 labCat->show();
1527 } 1550 }
1528} 1551}
1529 1552
1530void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) 1553void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day)
1531{ 1554{
1532 QDate date; 1555 QDate date;
1533 date.setYMD( year, month, day ); 1556 date.setYMD( year, month, day );
1534 QString dateString = TimeString::numberDateString( date ); 1557 QString dateString = TimeString::numberDateString( date );
1535 anniversaryButton->setText( dateString ); 1558 anniversaryButton->setText( dateString );
1536 ent.setAnniversary ( date ); 1559 ent.setAnniversary ( date );
1537} 1560}
1538 1561
1539void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) 1562void ContactEditor::slotBirthdayDateChanged( int year, int month, int day)
1540{ 1563{
1541 QDate date; 1564 QDate date;
1542 date.setYMD( year, month, day ); 1565 date.setYMD( year, month, day );
1543 QString dateString = TimeString::numberDateString( date ); 1566 QString dateString = TimeString::numberDateString( date );
1544 birthdayButton->setText( dateString ); 1567 birthdayButton->setText( dateString );
1545 ent.setBirthday ( date ); 1568 ent.setBirthday ( date );
1546} 1569}
1547 1570
1548void ContactEditor::slotRemoveBirthday() 1571void ContactEditor::slotRemoveBirthday()
1549{ 1572{
1550 qWarning("void ContactEditor::slotRemoveBirthday()"); 1573 qWarning("void ContactEditor::slotRemoveBirthday()");
1551 ent.setBirthday( QDate() ); 1574 ent.setBirthday( QDate() );
1552 updateDatePicker(); 1575 updateDatePicker();
1553} 1576}
1554 1577
1555void ContactEditor::slotRemoveAnniversary() 1578void ContactEditor::slotRemoveAnniversary()
1556{ 1579{
1557 qWarning("void ContactEditor::slotRemoveAnniversary()"); 1580 qWarning("void ContactEditor::slotRemoveAnniversary()");
1558 ent.setAnniversary( QDate() ); 1581 ent.setAnniversary( QDate() );
1559 updateDatePicker(); 1582 updateDatePicker();
1560} 1583}
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h
index 63257f8..bcef679 100644
--- a/core/pim/addressbook/contacteditor.h
+++ b/core/pim/addressbook/contacteditor.h
@@ -1,175 +1,179 @@
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 int defaultEmailChooserPosition; 106 int defaultEmailChooserPosition;
107 void populateDefaultEmailCmb();
107 void chooserChange( const QString&, int , QLineEdit*, int ); 108 void chooserChange( const QString&, int , QLineEdit*, int );
109
108 bool useFullName; 110 bool useFullName;
109 111
110 OContact ent; 112 OContact ent;
111 113
112 QDialog *dlgNote; 114 QDialog *dlgNote;
113 QDialog *dlgName; 115 QDialog *dlgName;
114 116
115 QList<QLineEdit> listValue; 117 QList<QLineEdit> listValue;
116 QList<QLabel> listName; 118 QList<QLabel> listName;
117 119
118 QStringList slDynamicEntries; 120 QStringList slDynamicEntries;
119 QStringList trlDynamicEntries; 121 QStringList trlDynamicEntries;
120 122
121 bool m_personalView; 123 bool m_personalView;
122 124
123 QStringList slHomeAddress; 125 QStringList slHomeAddress;
124 QStringList slBusinessAddress; 126 QStringList slBusinessAddress;
125 QStringList slChooserNames; 127 QStringList slChooserNames;
126 QStringList slChooserValues; 128 QStringList slChooserValues;
129 QStringList emails;
130 QString defaultEmail;
127 131
128 QMultiLineEdit *txtNote; 132 QMultiLineEdit *txtNote;
129 QLabel *lblNote; 133 QLabel *lblNote;
130 134
131 //QLineEdit *txtTitle; 135 //QLineEdit *txtTitle;
132 QLineEdit *txtFirstName; 136 QLineEdit *txtFirstName;
133 QLineEdit *txtMiddleName; 137 QLineEdit *txtMiddleName;
134 QLineEdit *txtLastName; 138 QLineEdit *txtLastName;
135 QLineEdit *txtSuffix; 139 QLineEdit *txtSuffix;
136 140
137 QTabWidget *tabMain; 141 QTabWidget *tabMain;
138 QScrollView *svGeneral; 142 QScrollView *svGeneral;
139 QPushButton *btnFullName; 143 QPushButton *btnFullName;
140 QPushButton *btnNote; 144 QPushButton *btnNote;
141 QLineEdit *txtFullName; 145 QLineEdit *txtFullName;
142 QLineEdit *txtJobTitle; 146 QLineEdit *txtJobTitle;
143 QLineEdit *txtOrganization; 147 QLineEdit *txtOrganization;
144 QLineEdit *txtChooserField1; 148 QLineEdit *txtChooserField1;
145 QLineEdit *txtChooserField2; 149 QLineEdit *txtChooserField2;
146 QLineEdit *txtChooserField3; 150 QLineEdit *txtChooserField3;
147 QLineEdit *txtChooserField4; 151 QLineEdit *txtChooserField4;
148 QComboBox *cmbChooserField1; 152 QComboBox *cmbChooserField1;
149 QComboBox *cmbChooserField2; 153 QComboBox *cmbChooserField2;
150 QComboBox *cmbChooserField3; 154 QComboBox *cmbChooserField3;
151 QComboBox *cmbChooserField4; 155 QComboBox *cmbChooserField4;
152 QComboBox *cmbDefaultEmail; 156 QComboBox *cmbDefaultEmail;
153 QComboBox *cmbFileAs; 157 QComboBox *cmbFileAs;
154 CategorySelect *cmbCat; 158 CategorySelect *cmbCat;
155 QLabel *labCat; 159 QLabel *labCat;
156 160
157 QScrollView *svAddress; 161 QScrollView *svAddress;
158 QLineEdit *txtAddress; 162 QLineEdit *txtAddress;
159 //QLineEdit *txtAddress2; 163 //QLineEdit *txtAddress2;
160 //QLineEdit *txtPOBox; 164 //QLineEdit *txtPOBox;
161 QLineEdit *txtCity; 165 QLineEdit *txtCity;
162 QLineEdit *txtState; 166 QLineEdit *txtState;
163 QLineEdit *txtZip; 167 QLineEdit *txtZip;
164 QComboBox *cmbAddress; 168 QComboBox *cmbAddress;
165 QComboBox *cmbCountry; 169 QComboBox *cmbCountry;
166 170
167 QScrollView *svDetails; 171 QScrollView *svDetails;
168 QComboBox *cmbGender; 172 QComboBox *cmbGender;
169 DateBookMonth* birthdayPicker; 173 DateBookMonth* birthdayPicker;
170 QToolButton* birthdayButton; 174 QToolButton* birthdayButton;
171 DateBookMonth* anniversaryPicker; 175 DateBookMonth* anniversaryPicker;
172 QToolButton* anniversaryButton; 176 QToolButton* anniversaryButton;
173 }; 177 };
174 178
175#endif 179#endif