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