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