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