Diffstat (limited to 'core/pim/addressbook/contacteditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 605 |
1 files changed, 118 insertions, 487 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index e034b35..5a7bf1a 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -18,17 +18,20 @@ | |||
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 | 25 | ||
25 | #include <qpe/categoryselect.h> | 26 | #include <qpe/categoryselect.h> |
26 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
27 | #include <qpe/qpedialog.h> | 28 | #include <qpe/qpedialog.h> |
28 | #include <qpe/timeconversion.h> | 29 | #include <qpe/timeconversion.h> |
30 | #include <opie/ocontact.h> | ||
31 | #include <qpe/resource.h> | ||
29 | 32 | ||
30 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
31 | #include <qlabel.h> | 34 | #include <qlabel.h> |
32 | #include <qtabwidget.h> | 35 | #include <qtabwidget.h> |
33 | #include <qlayout.h> | 36 | #include <qlayout.h> |
34 | #include <qlineedit.h> | 37 | #include <qlineedit.h> |
@@ -37,12 +40,15 @@ | |||
37 | #include <qtoolbutton.h> | 40 | #include <qtoolbutton.h> |
38 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
39 | #include <qmainwindow.h> | 42 | #include <qmainwindow.h> |
40 | #include <qvaluelist.h> | 43 | #include <qvaluelist.h> |
41 | #include <qpopupmenu.h> | 44 | #include <qpopupmenu.h> |
42 | #include <qlistbox.h> | 45 | #include <qlistbox.h> |
46 | #include <qhbox.h> | ||
47 | #include <qaction.h> | ||
48 | #include <qiconset.h> | ||
43 | 49 | ||
44 | static inline bool containsAlphaNum( const QString &str ); | 50 | static inline bool containsAlphaNum( const QString &str ); |
45 | static inline bool constainsWhiteSpace( const QString &str ); | 51 | static inline bool constainsWhiteSpace( const QString &str ); |
46 | 52 | ||
47 | // helper functions, convert our comma delimited list to proper | 53 | // helper functions, convert our comma delimited list to proper |
48 | // file format... | 54 | // file format... |
@@ -51,315 +57,46 @@ void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | |||
51 | 57 | ||
52 | // helper convert from file format to comma delimited... | 58 | // helper convert from file format to comma delimited... |
53 | void parseEmailTo( const QString &strDefaultEmail, | 59 | void parseEmailTo( const QString &strDefaultEmail, |
54 | const QString &strOtherEmail, QString &strBack ); | 60 | const QString &strOtherEmail, QString &strBack ); |
55 | 61 | ||
56 | ContactEditor::ContactEditor(const OContact &entry, | 62 | ContactEditor::ContactEditor(const OContact &entry, |
57 | const QValueList<int> *newOrderedValues, | ||
58 | QStringList *slNewOrdered, | ||
59 | QWidget *parent, | 63 | QWidget *parent, |
60 | const char *name, | 64 | const char *name, |
61 | WFlags fl ) | 65 | WFlags fl ) |
62 | : QDialog( parent, name, TRUE, fl ), | 66 | : QDialog( parent, name, TRUE, fl ), |
63 | orderedValues( newOrderedValues ), | ||
64 | slOrdered( *slNewOrdered ), | ||
65 | m_personalView ( false ) | 67 | m_personalView ( false ) |
66 | { | 68 | { |
67 | 69 | ||
68 | init(); | 70 | init(); |
69 | initMap(); | ||
70 | setEntry( entry ); | 71 | setEntry( entry ); |
71 | qDebug("finish"); | ||
72 | } | 72 | } |
73 | 73 | ||
74 | ContactEditor::~ContactEditor() { | 74 | ContactEditor::~ContactEditor() { |
75 | } | 75 | } |
76 | 76 | ||
77 | void ContactEditor::init() { | 77 | void ContactEditor::init() { |
78 | 78 | ||
79 | useFullName = TRUE; | 79 | useFullName = true; |
80 | 80 | ||
81 | int i = 0; | 81 | uint i = 0; |
82 | /** SHut up and stop leaking | ||
83 | slHomeAddress = new QStringList; | ||
84 | slBusinessAddress = new QStringList; | ||
85 | slChooserNames = new QStringList; | ||
86 | slChooserValues = new QStringList; | ||
87 | |||
88 | slDynamicEntries = new QStringList; | ||
89 | */ | ||
90 | //*slDynamicEntries = *slOrdered; | ||
91 | 82 | ||
92 | QStringList trlChooserNames; | 83 | QStringList trlChooserNames; |
93 | 84 | ||
94 | for (i = 0; i <= 6; i++) { | 85 | for (i = 0; i <= 6; i++) { |
95 | slHomeAddress.append( "" ); | 86 | slHomeAddress.append( "" ); |
96 | slBusinessAddress.append( "" ); | 87 | slBusinessAddress.append( "" ); |
97 | } | 88 | } |
98 | 89 | ||
99 | { | 90 | trlChooserNames = OContactFields::trphonefields(); |
100 | hasGender = FALSE; | 91 | slChooserNames = OContactFields::untrphonefields(); |
101 | hasTitle = FALSE; | 92 | slDynamicEntries = OContactFields::untrdetailsfields(); |
102 | hasCompany = FALSE; | 93 | trlDynamicEntries = OContactFields::trdetailsfields(); |
103 | hasNotes = FALSE; | 94 | for (i = 0; i < slChooserNames.count(); i++) |
104 | hasStreet = FALSE; | 95 | slChooserValues.append(""); |
105 | hasStreet2 = FALSE; | ||
106 | hasPOBox = FALSE; | ||
107 | hasCity = FALSE; | ||
108 | hasState = FALSE; | ||
109 | hasZip = FALSE; | ||
110 | hasCountry = FALSE; | ||
111 | |||
112 | QStringList::ConstIterator it = slOrdered.begin(); | ||
113 | |||
114 | for ( i = 0; it != slOrdered.end(); i++, ++it ) { | ||
115 | |||
116 | if ( (*it) == "Business Fax" ) { | ||
117 | trlChooserNames.append( tr( "Business Fax" ) ); | ||
118 | slChooserNames.append( *it ); | ||
119 | slChooserValues.append("" ); | ||
120 | //slDynamicEntries->remove( it ); | ||
121 | continue; | ||
122 | } | ||
123 | |||
124 | if ( (*it) == "Home Fax" ) { | ||
125 | trlChooserNames.append( tr( "Home Fax" ) ); | ||
126 | slChooserNames.append( *it ); | ||
127 | slChooserValues.append("" ); | ||
128 | //slDynamicEntries->remove( it ); | ||
129 | continue; | ||
130 | } | ||
131 | |||
132 | |||
133 | if ( (*it) == "Business Phone" ) { | ||
134 | trlChooserNames.append( tr( "Business Phone" ) ); | ||
135 | slChooserNames.append( *it ); | ||
136 | slChooserValues.append( "" ); | ||
137 | //slDynamicEntries->remove( it ); | ||
138 | continue; | ||
139 | } | ||
140 | |||
141 | if ( (*it) == "Home Phone" ) { | ||
142 | trlChooserNames.append( tr( "Home Phone" ) ); | ||
143 | slChooserNames.append( *it ); | ||
144 | slChooserValues.append( "" ); | ||
145 | //slDynamicEntries->remove( it ); | ||
146 | continue; | ||
147 | } | ||
148 | 96 | ||
149 | /* | ||
150 | if ( (*it).right( 2 ) == tr( "IM" ) ) { | ||
151 | slChooserNames.append( *it ); | ||
152 | slChooserValues.append( "" ); | ||
153 | //slDynamicEntries->remove( it ); | ||
154 | continue; | ||
155 | } */ | ||
156 | |||
157 | if ( (*it) == "Business Mobile" ) { | ||
158 | trlChooserNames.append( tr( "Business Mobile" ) ); | ||
159 | slChooserNames.append( *it ); | ||
160 | slChooserValues.append( "" ); | ||
161 | //slDynamicEntries->remove( it ); | ||
162 | continue; | ||
163 | } | ||
164 | |||
165 | if ( (*it) == "Home Mobile" ) { | ||
166 | trlChooserNames.append( tr( "Home Mobile" ) ); | ||
167 | slChooserNames.append( *it ); | ||
168 | slChooserValues.append( "" ); | ||
169 | //slDynamicEntries->remove( it ); | ||
170 | continue; | ||
171 | } | ||
172 | |||
173 | |||
174 | if ( (*it) == "Business WebPage" ) { | ||
175 | trlChooserNames.append( tr( "Business WebPage" ) ); | ||
176 | slChooserNames.append( *it ); | ||
177 | slChooserValues.append( "" ); | ||
178 | //slDynamicEntries->remove( it ); | ||
179 | continue; | ||
180 | } | ||
181 | |||
182 | if ( (*it) == "Home Web Page" ) { | ||
183 | trlChooserNames.append( tr( "Home Web Page" ) ); | ||
184 | slChooserNames.append( *it ); | ||
185 | slChooserValues.append( "" ); | ||
186 | //slDynamicEntries->remove( it ); | ||
187 | continue; | ||
188 | } | ||
189 | |||
190 | if ( (*it) == "Business Pager" ) { | ||
191 | trlChooserNames.append( tr( "Business Pager" ) ); | ||
192 | slChooserNames.append( *it ); | ||
193 | slChooserValues.append( "" ); | ||
194 | //slDynamicEntries->remove( it ); | ||
195 | continue; | ||
196 | } | ||
197 | |||
198 | if ( *it == "Default Email" ) { | ||
199 | trlChooserNames.append( tr( "Default Email" ) ); | ||
200 | slChooserNames.append( *it ); | ||
201 | slChooserValues.append( "" ); | ||
202 | //slDynamicEntries->remove( it ); | ||
203 | continue; | ||
204 | } | ||
205 | |||
206 | if ( *it == "Emails" ) { | ||
207 | trlChooserNames.append( tr( "Emails" ) ); | ||
208 | slChooserNames.append( *it ); | ||
209 | slChooserValues.append( "" ); | ||
210 | //slDynamicEntries->remove( it ); | ||
211 | continue; | ||
212 | } | ||
213 | |||
214 | if ( *it == "Name Title" || | ||
215 | *it == "First Name" || | ||
216 | *it == "Middle Name" || | ||
217 | *it == "Last Name" || | ||
218 | *it == "File As" || | ||
219 | *it == "Default Email" || | ||
220 | *it == "Emails" || | ||
221 | *it == "Groups" || | ||
222 | *it == "Anniversary" || | ||
223 | *it == "Birthday" ) | ||
224 | continue; | ||
225 | |||
226 | if ( *it == "Name Title" ) { | ||
227 | //slDynamicEntries->remove( it ); | ||
228 | continue; | ||
229 | } | ||
230 | |||
231 | if ( *it == "First Name" ) { | ||
232 | //slDynamicEntries->remove( it ); | ||
233 | continue; | ||
234 | } | ||
235 | |||
236 | if ( *it == "Middle Name" ) { | ||
237 | //slDynamicEntries->remove( it ); | ||
238 | continue; | ||
239 | } | ||
240 | |||
241 | if ( *it == "Last Name" ) { | ||
242 | //slDynamicEntries->remove( it ); | ||
243 | continue; | ||
244 | } | ||
245 | |||
246 | if ( *it == "Suffix" ) { | ||
247 | //slDynamicEntries->remove( it ); | ||
248 | continue; | ||
249 | } | ||
250 | |||
251 | if ( *it == "File As" ) { | ||
252 | //slDynamicEntries->remove( it ); | ||
253 | continue; | ||
254 | } | ||
255 | |||
256 | if ( *it == "Gender" ) { | ||
257 | hasGender = TRUE; | ||
258 | //slDynamicEntries->remove( it ); | ||
259 | continue; | ||
260 | } | ||
261 | |||
262 | if ( *it == "Job Title" ) { | ||
263 | hasTitle = TRUE; | ||
264 | //slDynamicEntries->remove( it ); | ||
265 | continue; | ||
266 | } | ||
267 | |||
268 | if ( ( *it == "Company") || (*it == "Organization" ) ) { | ||
269 | hasCompany = TRUE; | ||
270 | //slDynamicEntries->remove( it ); | ||
271 | continue; | ||
272 | } | ||
273 | |||
274 | if ( *it == "Notes" ) { | ||
275 | hasNotes = TRUE; | ||
276 | //slDynamicEntries->remove( it ); | ||
277 | continue; | ||
278 | } | ||
279 | |||
280 | if ( *it == "Groups" ) { | ||
281 | //slDynamicEntries->remove( it ); | ||
282 | continue; | ||
283 | } | ||
284 | |||
285 | if ( (*it) == "Business Street" ) { | ||
286 | hasStreet = TRUE; | ||
287 | //slDynamicEntries->remove( it ); | ||
288 | continue; | ||
289 | } | ||
290 | |||
291 | if ( (*it) == "Home Street" ) { | ||
292 | hasStreet = TRUE; | ||
293 | //slDynamicEntries->remove( it ); | ||
294 | continue; | ||
295 | } | ||
296 | /* | ||
297 | if ( (*it).right( 8 ) == tr( "Street 2" ) ) { | ||
298 | hasStreet2 = TRUE; | ||
299 | //slDynamicEntries->remove( it ); | ||
300 | continue; | ||
301 | } | ||
302 | |||
303 | if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { | ||
304 | hasPOBox = TRUE; | ||
305 | //slDynamicEntries->remove( it ); | ||
306 | continue; | ||
307 | } */ | ||
308 | |||
309 | if ( (*it) == "Business City" ) { | ||
310 | hasCity = TRUE; | ||
311 | //slDynamicEntries->remove( it ); | ||
312 | continue; | ||
313 | } | ||
314 | |||
315 | if ( (*it) == "Business State" ) { | ||
316 | hasState = TRUE; | ||
317 | //slDynamicEntries->remove( it ); | ||
318 | continue; | ||
319 | } | ||
320 | |||
321 | if ( (*it) == "Business Zip" ) { | ||
322 | hasZip = TRUE; | ||
323 | //slDynamicEntries->remove( it ); | ||
324 | continue; | ||
325 | } | ||
326 | |||
327 | if ( (*it) == "Business Country" ) { | ||
328 | hasCountry = TRUE; | ||
329 | //slDynamicEntries->remove( it ); | ||
330 | continue; | ||
331 | } | ||
332 | |||
333 | if ( (*it) == "Home City" ) { | ||
334 | hasCity = TRUE; | ||
335 | //slDynamicEntries->remove( it ); | ||
336 | continue; | ||
337 | } | ||
338 | |||
339 | if ( (*it) == "Home State" ) { | ||
340 | hasState = TRUE; | ||
341 | //slDynamicEntries->remove( it ); | ||
342 | continue; | ||
343 | } | ||
344 | |||
345 | if ( (*it) == "Home Zip" ) { | ||
346 | hasZip = TRUE; | ||
347 | //slDynamicEntries->remove( it ); | ||
348 | continue; | ||
349 | } | ||
350 | |||
351 | if ( (*it) == "Home Country" ) { | ||
352 | hasCountry = TRUE; | ||
353 | //slDynamicEntries->remove( it ); | ||
354 | continue; | ||
355 | } | ||
356 | |||
357 | slDynamicEntries.append( *it ); | ||
358 | } | ||
359 | } | ||
360 | 97 | ||
361 | QVBoxLayout *vb = new QVBoxLayout( this ); | 98 | QVBoxLayout *vb = new QVBoxLayout( this ); |
362 | 99 | ||
363 | tabMain = new QTabWidget( this ); | 100 | tabMain = new QTabWidget( this ); |
364 | vb->addWidget( tabMain ); | 101 | vb->addWidget( tabMain ); |
365 | 102 | ||
@@ -417,22 +154,14 @@ void ContactEditor::init() { | |||
417 | gl->addWidget( cmbFileAs, 6, 1 ); | 154 | gl->addWidget( cmbFileAs, 6, 1 ); |
418 | 155 | ||
419 | labCat = new QLabel( tr( "Category" ), container ); | 156 | labCat = new QLabel( tr( "Category" ), container ); |
420 | gl->addWidget( labCat, 7, 0 ); | 157 | gl->addWidget( labCat, 7, 0 ); |
421 | cmbCat = new CategorySelect( container ); | 158 | cmbCat = new CategorySelect( container ); |
422 | gl->addWidget( cmbCat, 7, 1 ); | 159 | gl->addWidget( cmbCat, 7, 1 ); |
423 | 160 | labCat->show(); | |
424 | // We don't need categories for the personal view | 161 | cmbCat->show(); |
425 | if ( m_personalView ){ | ||
426 | qWarning("Disable Category.."); | ||
427 | labCat->hide(); | ||
428 | cmbCat->hide(); | ||
429 | } else { | ||
430 | labCat->show(); | ||
431 | cmbCat->show(); | ||
432 | } | ||
433 | 162 | ||
434 | btnNote = new QPushButton( tr( "Notes..." ), container ); | 163 | btnNote = new QPushButton( tr( "Notes..." ), container ); |
435 | gl->addWidget( btnNote, 8, 1 ); | 164 | gl->addWidget( btnNote, 8, 1 ); |
436 | 165 | ||
437 | tabMain->insertTab( tabViewport, tr( "General" ) ); | 166 | tabMain->insertTab( tabViewport, tr( "General" ) ); |
438 | 167 | ||
@@ -456,23 +185,13 @@ void ContactEditor::init() { | |||
456 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 185 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
457 | 186 | ||
458 | l = new QLabel( tr( "Address" ), container ); | 187 | l = new QLabel( tr( "Address" ), container ); |
459 | gl->addWidget( l, 1, 0 ); | 188 | gl->addWidget( l, 1, 0 ); |
460 | txtAddress = new QLineEdit( container ); | 189 | txtAddress = new QLineEdit( container ); |
461 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); | 190 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); |
462 | /* | ||
463 | l = new QLabel( tr( "Address 2" ), container ); | ||
464 | gl->addWidget( l, 2, 0 ); | ||
465 | txtAddress2 = new QLineEdit( container ); | ||
466 | gl->addMultiCellWidget( txtAddress2, 2, 2, 1, 2 ); | ||
467 | 191 | ||
468 | l = new QLabel( tr( "P.O. Box" ), container ); | ||
469 | gl->addWidget( l, 3, 0 ); | ||
470 | txtPOBox = new QLineEdit( container ); | ||
471 | gl->addMultiCellWidget( txtPOBox, 3, 3, 1, 2 ); | ||
472 | */ | ||
473 | l = new QLabel( tr( "City" ), container ); | 192 | l = new QLabel( tr( "City" ), container ); |
474 | gl->addWidget( l, 2, 0 ); | 193 | gl->addWidget( l, 2, 0 ); |
475 | txtCity = new QLineEdit( container ); | 194 | txtCity = new QLineEdit( container ); |
476 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); | 195 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); |
477 | 196 | ||
478 | l = new QLabel( tr( "State" ), container ); | 197 | l = new QLabel( tr( "State" ), container ); |
@@ -733,42 +452,57 @@ void ContactEditor::init() { | |||
733 | 452 | ||
734 | gl = new QGridLayout( container, 1, 2, 2, 4 ); | 453 | gl = new QGridLayout( container, 1, 2, 2, 4 ); |
735 | 454 | ||
736 | int counter = 0; | 455 | int counter = 0; |
737 | 456 | ||
738 | // Birthday | 457 | // Birthday |
458 | QHBox* hBox = new QHBox( container ); | ||
739 | l = new QLabel( tr("Birthday"), container ); | 459 | l = new QLabel( tr("Birthday"), container ); |
740 | gl->addWidget( l, counter, 0 ); | 460 | gl->addWidget( l, counter, 0 ); |
741 | 461 | ||
742 | QPopupMenu* m1 = new QPopupMenu( container ); | 462 | QPopupMenu* m1 = new QPopupMenu( container ); |
743 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); | 463 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); |
744 | m1->insertItem( birthdayPicker ); | 464 | m1->insertItem( birthdayPicker ); |
745 | 465 | ||
746 | birthdayButton= new QToolButton( container, "buttonStart" ); | 466 | birthdayButton= new QToolButton( hBox, "buttonStart" ); |
747 | birthdayButton->setPopup( m1 ); | 467 | birthdayButton->setPopup( m1 ); |
748 | birthdayButton->setPopupDelay(0); | 468 | birthdayButton->setPopupDelay(0); |
749 | gl->addWidget( birthdayButton, counter , 1 ); | 469 | |
470 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | ||
471 | tr( "Delete" ), | ||
472 | hBox, 0 ); | ||
473 | |||
474 | gl->addWidget( hBox, counter , 1 ); | ||
475 | |||
750 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), | 476 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), |
751 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); | 477 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); |
478 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); | ||
752 | 479 | ||
753 | ++counter; | 480 | ++counter; |
754 | 481 | ||
755 | // Anniversary | 482 | // Anniversary |
483 | hBox = new QHBox( container ); | ||
756 | l = new QLabel( tr("Anniversary"), container ); | 484 | l = new QLabel( tr("Anniversary"), container ); |
757 | gl->addWidget( l, counter, 0 ); | 485 | gl->addWidget( l, counter, 0 ); |
758 | 486 | ||
759 | m1 = new QPopupMenu( container ); | 487 | m1 = new QPopupMenu( container ); |
760 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); | 488 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); |
761 | m1->insertItem( anniversaryPicker ); | 489 | m1->insertItem( anniversaryPicker ); |
762 | 490 | ||
763 | anniversaryButton= new QToolButton( container, "buttonStart" ); | 491 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); |
764 | anniversaryButton->setPopup( m1 ); | 492 | anniversaryButton->setPopup( m1 ); |
765 | anniversaryButton->setPopupDelay(0); | 493 | anniversaryButton->setPopupDelay(0); |
766 | gl->addWidget( anniversaryButton, counter , 1 ); | 494 | |
495 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | ||
496 | tr( "Delete" ), | ||
497 | hBox, 0 ); | ||
498 | gl->addWidget( hBox, counter , 1 ); | ||
499 | |||
767 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), | 500 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), |
768 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); | 501 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); |
502 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); | ||
769 | 503 | ||
770 | ++counter; | 504 | ++counter; |
771 | 505 | ||
772 | // Gender | 506 | // Gender |
773 | l = new QLabel( tr("Gender"), container ); | 507 | l = new QLabel( tr("Gender"), container ); |
774 | gl->addWidget( l, counter, 0 ); | 508 | gl->addWidget( l, counter, 0 ); |
@@ -779,22 +513,27 @@ void ContactEditor::init() { | |||
779 | gl->addWidget( cmbGender, counter, 1 ); | 513 | gl->addWidget( cmbGender, counter, 1 ); |
780 | 514 | ||
781 | ++counter; | 515 | ++counter; |
782 | 516 | ||
783 | // Create Labels and lineedit fields for every dynamic entry | 517 | // Create Labels and lineedit fields for every dynamic entry |
784 | QStringList::ConstIterator it = slDynamicEntries.begin(); | 518 | QStringList::ConstIterator it = slDynamicEntries.begin(); |
785 | for (i = counter; it != slDynamicEntries.end(); i++, ++it) { | 519 | QStringList::ConstIterator trit = trlDynamicEntries.begin(); |
786 | l = new QLabel( QString::null , container ); | 520 | for (i = counter; it != slDynamicEntries.end(); i++, ++it, ++trit) { |
521 | |||
522 | if (((*it) == "Anniversary") || | ||
523 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; | ||
524 | |||
525 | l = new QLabel( (*it).utf8() , container ); | ||
787 | listName.append( l ); | 526 | listName.append( l ); |
788 | gl->addWidget( l, i, 0 ); | 527 | gl->addWidget( l, i, 0 ); |
789 | QLineEdit *e = new QLineEdit( container ); | 528 | QLineEdit *e = new QLineEdit( container ); |
790 | listValue.append( e ); | 529 | listValue.append( e ); |
791 | gl->addWidget( e, i, 1); | 530 | gl->addWidget( e, i, 1); |
792 | } | 531 | } |
793 | // Fill labels with names.. | 532 | // Fill labels with names.. |
794 | loadFields(); | 533 | //loadFields(); |
795 | 534 | ||
796 | 535 | ||
797 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 536 | tabMain->insertTab( tabViewport, tr( "Details" ) ); |
798 | 537 | ||
799 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 538 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); |
800 | dlgNote->setCaption( tr("Enter Note") ); | 539 | dlgNote->setCaption( tr("Enter Note") ); |
@@ -875,40 +614,14 @@ void ContactEditor::init() { | |||
875 | connect( cmbChooserField4, SIGNAL(activated(int)), | 614 | connect( cmbChooserField4, SIGNAL(activated(int)), |
876 | this, SLOT(slotCmbChooser4Change(int)) ); | 615 | this, SLOT(slotCmbChooser4Change(int)) ); |
877 | connect( cmbAddress, SIGNAL(activated(int)), | 616 | connect( cmbAddress, SIGNAL(activated(int)), |
878 | this, SLOT(slotAddressTypeChange(int)) ); | 617 | this, SLOT(slotAddressTypeChange(int)) ); |
879 | 618 | ||
880 | new QPEDialogListener(this); | 619 | new QPEDialogListener(this); |
881 | } | ||
882 | 620 | ||
883 | void ContactEditor::initMap() | 621 | setPersonalView ( m_personalView ); |
884 | { | ||
885 | /* | ||
886 | // since the fields and the XML fields exist, create a map | ||
887 | // between them... | ||
888 | Config cfg1( "AddressBook" ); | ||
889 | Config cfg2( "AddressBook" ); | ||
890 | QString strCfg1, | ||
891 | strCfg2; | ||
892 | int i; | ||
893 | |||
894 | // This stuff better exist... | ||
895 | cfg1.setGroup( "AddressFields" ); | ||
896 | o cfg2.setGroup( "XMLFields" ); | ||
897 | i = 0; | ||
898 | strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null ); | ||
899 | strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), | ||
900 | QString::null ); | ||
901 | while ( !strCfg1.isNull() && !strCfg2.isNull() ) { | ||
902 | mapField.insert( strCfg1, strCfg2 ); | ||
903 | strCfg1 = cfg1.readEntry( "Field" + QString::number(i), | ||
904 | QString::null ); | ||
905 | strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), | ||
906 | QString::null ); | ||
907 | } | ||
908 | */ | ||
909 | } | 622 | } |
910 | 623 | ||
911 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 624 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
912 | 625 | ||
913 | int index = cmbChooserField1->currentItem(); | 626 | int index = cmbChooserField1->currentItem(); |
914 | 627 | ||
@@ -1068,50 +781,13 @@ void ContactEditor::slotFullNameChange( const QString &textChanged ) { | |||
1068 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); | 781 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); |
1069 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); | 782 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); |
1070 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); | 783 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); |
1071 | 784 | ||
1072 | cmbFileAs->setCurrentItem( index ); | 785 | cmbFileAs->setCurrentItem( index ); |
1073 | 786 | ||
1074 | useFullName = TRUE; | 787 | useFullName = true; |
1075 | |||
1076 | } | ||
1077 | |||
1078 | // Loads the detail fields | ||
1079 | void ContactEditor::loadFields() { | ||
1080 | |||
1081 | QStringList::ConstIterator it; | ||
1082 | QListIterator<QLabel> lit( listName ); | ||
1083 | for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) { | ||
1084 | |||
1085 | if ( *it == "Department" ) | ||
1086 | (*lit)->setText( tr( "Department" ) ); | ||
1087 | |||
1088 | if ( *it == "Company" ) | ||
1089 | (*lit)->setText( tr( "Company" ) ); | ||
1090 | |||
1091 | if ( *it == "Office" ) | ||
1092 | (*lit)->setText( tr( "Office" ) ); | ||
1093 | |||
1094 | if ( *it == "Profession" ) | ||
1095 | (*lit)->setText( tr( "Profession" ) ); | ||
1096 | |||
1097 | if ( *it == "Assistant" ) | ||
1098 | (*lit)->setText( tr( "Assistant" ) ); | ||
1099 | |||
1100 | if ( *it == "Manager" ) | ||
1101 | (*lit)->setText( tr( "Manager" ) ); | ||
1102 | |||
1103 | if ( *it == "Spouse" ) | ||
1104 | (*lit)->setText( tr( "Spouse" ) ); | ||
1105 | |||
1106 | if ( *it == "Nickname" ) | ||
1107 | (*lit)->setText( tr( "Nickname" ) ); | ||
1108 | |||
1109 | if ( *it == "Children" ) | ||
1110 | (*lit)->setText( tr( "Children" ) ); | ||
1111 | } | ||
1112 | 788 | ||
1113 | } | 789 | } |
1114 | 790 | ||
1115 | void ContactEditor::accept() { | 791 | void ContactEditor::accept() { |
1116 | 792 | ||
1117 | if ( isEmpty() ) { | 793 | if ( isEmpty() ) { |
@@ -1133,25 +809,25 @@ void ContactEditor::slotNote() { | |||
1133 | } | 809 | } |
1134 | } | 810 | } |
1135 | 811 | ||
1136 | void ContactEditor::slotName() { | 812 | void ContactEditor::slotName() { |
1137 | 813 | ||
1138 | QString tmpName; | 814 | QString tmpName; |
1139 | if (useFullName == TRUE) { | 815 | if (useFullName) { |
1140 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 816 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
1141 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 817 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
1142 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 818 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1143 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 819 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1144 | } | 820 | } |
1145 | dlgName->showMaximized(); | 821 | dlgName->showMaximized(); |
1146 | if ( dlgName->exec() ) { | 822 | if ( dlgName->exec() ) { |
1147 | 823 | ||
1148 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); | 824 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); |
1149 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 825 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
1150 | slotFullNameChange( txtFullName->text() ); | 826 | slotFullNameChange( txtFullName->text() ); |
1151 | useFullName = FALSE; | 827 | useFullName = false; |
1152 | } | 828 | } |
1153 | 829 | ||
1154 | } | 830 | } |
1155 | 831 | ||
1156 | void ContactEditor::setNameFocus() { | 832 | void ContactEditor::setNameFocus() { |
1157 | 833 | ||
@@ -1358,44 +1034,40 @@ QString ContactEditor::parseName( const QString fullName, int type ) { | |||
1358 | 1034 | ||
1359 | } | 1035 | } |
1360 | return QString::null; | 1036 | return QString::null; |
1361 | } | 1037 | } |
1362 | 1038 | ||
1363 | void ContactEditor::cleanupFields() { | 1039 | void ContactEditor::cleanupFields() { |
1364 | |||
1365 | QStringList::Iterator it = slChooserValues.begin(); | 1040 | QStringList::Iterator it = slChooserValues.begin(); |
1366 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { | 1041 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { |
1367 | (*it) = ""; | 1042 | (*it) = ""; |
1368 | } | 1043 | } |
1369 | 1044 | ||
1370 | for ( int i = 0; i < 7; i++ ) { | 1045 | for ( int i = 0; i < 7; i++ ) { |
1371 | slHomeAddress[i] = ""; | 1046 | slHomeAddress[i] = ""; |
1372 | slBusinessAddress[i] = ""; | 1047 | slBusinessAddress[i] = ""; |
1373 | } | 1048 | } |
1374 | 1049 | ||
1375 | QStringList::ConstIterator cit; | 1050 | QListIterator<QLineEdit> itLV( listValue ); |
1376 | QListIterator<QLineEdit> itLE( listValue ); | 1051 | for ( ; itLV.current(); ++itLV ) { |
1377 | for ( cit = slDynamicEntries.begin(); cit != slDynamicEntries.end(); ++cit, ++itLE) { | 1052 | (*itLV)->setText( "" ); |
1378 | (*itLE)->setText( "" ); | 1053 | } |
1379 | } | 1054 | |
1380 | |||
1381 | txtFirstName->setText(""); | 1055 | txtFirstName->setText(""); |
1382 | txtMiddleName->setText(""); | 1056 | txtMiddleName->setText(""); |
1383 | txtLastName->setText(""); | 1057 | txtLastName->setText(""); |
1384 | txtSuffix->setText(""); | 1058 | txtSuffix->setText(""); |
1385 | txtNote->setText(""); | 1059 | txtNote->setText(""); |
1386 | txtFullName->setText(""); | 1060 | txtFullName->setText(""); |
1387 | txtJobTitle->setText(""); | 1061 | txtJobTitle->setText(""); |
1388 | txtOrganization->setText(""); | 1062 | txtOrganization->setText(""); |
1389 | txtChooserField1->setText(""); | 1063 | txtChooserField1->setText(""); |
1390 | txtChooserField2->setText(""); | 1064 | txtChooserField2->setText(""); |
1391 | txtChooserField3->setText(""); | 1065 | txtChooserField3->setText(""); |
1392 | txtAddress->setText(""); | 1066 | txtAddress->setText(""); |
1393 | //txtAddress2->setText(""); | ||
1394 | txtCity->setText(""); | 1067 | txtCity->setText(""); |
1395 | //txtPOBox->setText(""); | ||
1396 | txtState->setText(""); | 1068 | txtState->setText(""); |
1397 | txtZip->setText(""); | 1069 | txtZip->setText(""); |
1398 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1070 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1399 | txtTmp->setText(""); | 1071 | txtTmp->setText(""); |
1400 | txtTmp = cmbFileAs->lineEdit(); | 1072 | txtTmp = cmbFileAs->lineEdit(); |
1401 | txtTmp->setText(""); | 1073 | txtTmp->setText(""); |
@@ -1403,16 +1075,15 @@ void ContactEditor::cleanupFields() { | |||
1403 | } | 1075 | } |
1404 | 1076 | ||
1405 | void ContactEditor::setEntry( const OContact &entry ) { | 1077 | void ContactEditor::setEntry( const OContact &entry ) { |
1406 | 1078 | ||
1407 | cleanupFields(); | 1079 | cleanupFields(); |
1408 | 1080 | ||
1409 | |||
1410 | ent = entry; | 1081 | ent = entry; |
1411 | 1082 | ||
1412 | useFullName = FALSE; | 1083 | useFullName = false; |
1413 | txtFirstName->setText( ent.firstName() ); | 1084 | txtFirstName->setText( ent.firstName() ); |
1414 | txtMiddleName->setText( ent.middleName() ); | 1085 | txtMiddleName->setText( ent.middleName() ); |
1415 | txtLastName->setText( ent.lastName() ); | 1086 | txtLastName->setText( ent.lastName() ); |
1416 | txtSuffix->setText( ent.suffix() ); | 1087 | txtSuffix->setText( ent.suffix() ); |
1417 | 1088 | ||
1418 | QString *tmpString = new QString; | 1089 | QString *tmpString = new QString; |
@@ -1420,59 +1091,49 @@ void ContactEditor::setEntry( const OContact &entry ) { | |||
1420 | + " " + ent.lastName() + " " + ent.suffix(); | 1091 | + " " + ent.lastName() + " " + ent.suffix(); |
1421 | 1092 | ||
1422 | txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1093 | txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1423 | 1094 | ||
1424 | cmbFileAs->setEditText( ent.fileAs() ); | 1095 | cmbFileAs->setEditText( ent.fileAs() ); |
1425 | 1096 | ||
1426 | if (hasTitle) | 1097 | //if (hasTitle) |
1427 | txtJobTitle->setText( ent.jobTitle() ); | 1098 | txtJobTitle->setText( ent.jobTitle() ); |
1428 | 1099 | ||
1429 | if (hasCompany) | 1100 | //if (hasCompany) |
1430 | txtOrganization->setText( ent.company() ); | 1101 | txtOrganization->setText( ent.company() ); |
1431 | 1102 | ||
1432 | if (hasNotes) | 1103 | //if (hasNotes) |
1433 | txtNote->setText( ent.notes() ); | 1104 | txtNote->setText( ent.notes() ); |
1434 | 1105 | ||
1435 | if (hasStreet) { | 1106 | //if (hasStreet) { |
1436 | slHomeAddress[0] = ent.homeStreet(); | 1107 | slHomeAddress[0] = ent.homeStreet(); |
1437 | slBusinessAddress[0] = ent.businessStreet(); | 1108 | slBusinessAddress[0] = ent.businessStreet(); |
1438 | } | 1109 | //} |
1439 | /* | ||
1440 | if (hasStreet2) { | ||
1441 | (*slHomeAddress)[1] = ent.homeStreet2(); | ||
1442 | (*slBusinessAddress)[1] = ent.businessStreet2(); | ||
1443 | } | ||
1444 | 1110 | ||
1445 | if (hasPOBox) { | 1111 | //if (hasCity) { |
1446 | (*slHomeAddress)[2] = ent.homePOBox(); | ||
1447 | (*slBusinessAddress)[2] = ent.businessPOBox(); | ||
1448 | } | ||
1449 | */ | ||
1450 | if (hasCity) { | ||
1451 | slHomeAddress[3] = ent.homeCity(); | 1112 | slHomeAddress[3] = ent.homeCity(); |
1452 | slBusinessAddress[3] = ent.businessCity(); | 1113 | slBusinessAddress[3] = ent.businessCity(); |
1453 | } | 1114 | //} |
1454 | 1115 | ||
1455 | if (hasState) { | 1116 | //if (hasState) { |
1456 | slHomeAddress[4] = ent.homeState(); | 1117 | slHomeAddress[4] = ent.homeState(); |
1457 | slBusinessAddress[4] = ent.businessState(); | 1118 | slBusinessAddress[4] = ent.businessState(); |
1458 | } | 1119 | //} |
1459 | 1120 | ||
1460 | if (hasZip) { | 1121 | //if (hasZip) { |
1461 | slHomeAddress[5] = ent.homeZip(); | 1122 | slHomeAddress[5] = ent.homeZip(); |
1462 | slBusinessAddress[5] = ent.businessZip(); | 1123 | slBusinessAddress[5] = ent.businessZip(); |
1463 | } | 1124 | //} |
1464 | 1125 | ||
1465 | if (hasCountry) { | 1126 | //if (hasCountry) { |
1466 | slHomeAddress[6] = ent.homeCountry(); | 1127 | slHomeAddress[6] = ent.homeCountry(); |
1467 | slBusinessAddress[6] = ent.businessCountry(); | 1128 | slBusinessAddress[6] = ent.businessCountry(); |
1468 | } | 1129 | //} |
1469 | 1130 | ||
1470 | QStringList::ConstIterator it; | 1131 | QStringList::ConstIterator it; |
1471 | QListIterator<QLineEdit> itLE( listValue ); | 1132 | QListIterator<QLineEdit> itLE( listValue ); |
1472 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { | 1133 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { |
1473 | if ( *it == "Department" ) | 1134 | if ( *it == "Department" ) |
1474 | (*itLE)->setText( ent.department() ); | 1135 | (*itLE)->setText( ent.department() ); |
1475 | 1136 | ||
1476 | if ( *it == "Company" ) | 1137 | if ( *it == "Company" ) |
1477 | (*itLE)->setText( ent.company() ); | 1138 | (*itLE)->setText( ent.company() ); |
1478 | 1139 | ||
@@ -1586,13 +1247,16 @@ void ContactEditor::setEntry( const OContact &entry ) { | |||
1586 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1247 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1587 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1248 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1588 | 1249 | ||
1589 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1250 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1590 | 1251 | ||
1591 | // loadFields(); :SX | 1252 | // loadFields(); :SX |
1592 | 1253 | updateDatePicker(); | |
1254 | } | ||
1255 | void ContactEditor::updateDatePicker() | ||
1256 | { | ||
1593 | // Set DatePicker | 1257 | // Set DatePicker |
1594 | if ( !ent.birthday().isNull() ){ | 1258 | if ( !ent.birthday().isNull() ){ |
1595 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); | 1259 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); |
1596 | birthdayPicker->setDate( ent.birthday() ); | 1260 | birthdayPicker->setDate( ent.birthday() ); |
1597 | } else | 1261 | } else |
1598 | birthdayButton->setText( tr ("Unknown") ); | 1262 | birthdayButton->setText( tr ("Unknown") ); |
@@ -1604,83 +1268,69 @@ void ContactEditor::setEntry( const OContact &entry ) { | |||
1604 | anniversaryButton->setText( tr ("Unknown") ); | 1268 | anniversaryButton->setText( tr ("Unknown") ); |
1605 | 1269 | ||
1606 | } | 1270 | } |
1607 | 1271 | ||
1608 | void ContactEditor::saveEntry() { | 1272 | void ContactEditor::saveEntry() { |
1609 | 1273 | ||
1610 | if ( useFullName == TRUE ) { | 1274 | if ( useFullName ) { |
1611 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); | 1275 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); |
1612 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); | 1276 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); |
1613 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); | 1277 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); |
1614 | txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); | 1278 | txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); |
1615 | 1279 | ||
1616 | useFullName = FALSE; | 1280 | useFullName = false; |
1617 | } | 1281 | } |
1618 | |||
1619 | /*if ( ent.firstName() != txtFirstName->text() || | ||
1620 | ent.lastName != txtLastName->text() || | ||
1621 | ent.middleName != txtMiddleName->text() ) { | ||
1622 | */ | ||
1623 | ent.setFirstName( txtFirstName->text() ); | ||
1624 | ent.setLastName( txtLastName->text() ); | ||
1625 | ent.setMiddleName( txtMiddleName->text() ); | ||
1626 | ent.setSuffix( txtSuffix->text() ); | ||
1627 | 1282 | ||
1628 | //} | 1283 | ent.setFirstName( txtFirstName->text() ); |
1284 | ent.setLastName( txtLastName->text() ); | ||
1285 | ent.setMiddleName( txtMiddleName->text() ); | ||
1286 | ent.setSuffix( txtSuffix->text() ); | ||
1629 | 1287 | ||
1630 | ent.setFileAs( cmbFileAs->currentText() ); | 1288 | ent.setFileAs( cmbFileAs->currentText() ); |
1631 | 1289 | ||
1632 | ent.setCategories( cmbCat->currentCategories() ); | 1290 | ent.setCategories( cmbCat->currentCategories() ); |
1633 | 1291 | ||
1634 | if (hasTitle) | 1292 | |
1293 | //if (hasTitle) | ||
1635 | ent.setJobTitle( txtJobTitle->text() ); | 1294 | ent.setJobTitle( txtJobTitle->text() ); |
1636 | 1295 | ||
1637 | if (hasCompany) | 1296 | //if (hasCompany) |
1638 | ent.setCompany( txtOrganization->text() ); | 1297 | ent.setCompany( txtOrganization->text() ); |
1639 | 1298 | ||
1640 | if (hasNotes) | 1299 | //if (hasNotes) |
1641 | ent.setNotes( txtNote->text() ); | 1300 | ent.setNotes( txtNote->text() ); |
1642 | 1301 | ||
1643 | if (hasStreet) { | 1302 | //if (hasStreet) { |
1644 | ent.setHomeStreet( slHomeAddress[0] ); | 1303 | ent.setHomeStreet( slHomeAddress[0] ); |
1645 | ent.setBusinessStreet( slBusinessAddress[0] ); | 1304 | ent.setBusinessStreet( slBusinessAddress[0] ); |
1646 | } | 1305 | //} |
1647 | /* | ||
1648 | if (hasStreet2) { | ||
1649 | ent.setHomeStreet2( (*slHomeAddress)[1] ); | ||
1650 | ent.setBusinessStreet2( (*slBusinessAddress)[1] ); | ||
1651 | } | ||
1652 | 1306 | ||
1653 | if (hasPOBox) { | 1307 | //if (hasCity) { |
1654 | ent.setHomePOBox( (*slHomeAddress)[2] ); | ||
1655 | ent.setBusinessPOBox( (*slBusinessAddress)[2] ); | ||
1656 | } | ||
1657 | */ | ||
1658 | if (hasCity) { | ||
1659 | ent.setHomeCity( slHomeAddress[3] ); | 1308 | ent.setHomeCity( slHomeAddress[3] ); |
1660 | ent.setBusinessCity( slBusinessAddress[3] ); | 1309 | ent.setBusinessCity( slBusinessAddress[3] ); |
1661 | } | 1310 | //} |
1662 | 1311 | ||
1663 | if (hasState) { | 1312 | //if (hasState) { |
1664 | ent.setHomeState( slHomeAddress[4] ); | 1313 | ent.setHomeState( slHomeAddress[4] ); |
1665 | ent.setBusinessState( slBusinessAddress[4] ); | 1314 | ent.setBusinessState( slBusinessAddress[4] ); |
1666 | } | 1315 | //} |
1667 | 1316 | ||
1668 | if (hasZip) { | 1317 | //if (hasZip) { |
1669 | ent.setHomeZip( slHomeAddress[5] ); | 1318 | ent.setHomeZip( slHomeAddress[5] ); |
1670 | ent.setBusinessZip( slBusinessAddress[5] ); | 1319 | ent.setBusinessZip( slBusinessAddress[5] ); |
1671 | } | 1320 | //} |
1672 | 1321 | ||
1673 | if (hasCountry) { | 1322 | //if (hasCountry) { |
1674 | ent.setHomeCountry( slHomeAddress[6] ); | 1323 | ent.setHomeCountry( slHomeAddress[6] ); |
1675 | ent.setBusinessCountry( slBusinessAddress[6] ); | 1324 | ent.setBusinessCountry( slBusinessAddress[6] ); |
1676 | } | 1325 | //} |
1677 | 1326 | ||
1678 | QStringList::ConstIterator it; | 1327 | QStringList::ConstIterator it; |
1679 | QListIterator<QLineEdit> itLE( listValue ); | 1328 | QListIterator<QLineEdit> itLE( listValue ); |
1680 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { | 1329 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { |
1330 | |||
1681 | if ( *it == "Department" ) | 1331 | if ( *it == "Department" ) |
1682 | ent.setDepartment( (*itLE)->text() ); | 1332 | ent.setDepartment( (*itLE)->text() ); |
1683 | 1333 | ||
1684 | if ( *it == "Company" ) | 1334 | if ( *it == "Company" ) |
1685 | ent.setCompany( (*itLE)->text() ); | 1335 | ent.setCompany( (*itLE)->text() ); |
1686 | 1336 | ||
@@ -1704,84 +1354,46 @@ void ContactEditor::saveEntry() { | |||
1704 | 1354 | ||
1705 | if ( *it == "Children" ) | 1355 | if ( *it == "Children" ) |
1706 | ent.setChildren( (*itLE)->text() ); | 1356 | ent.setChildren( (*itLE)->text() ); |
1707 | 1357 | ||
1708 | } | 1358 | } |
1709 | 1359 | ||
1360 | |||
1710 | QStringList::ConstIterator itV; | 1361 | QStringList::ConstIterator itV; |
1711 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1362 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1712 | 1363 | ||
1713 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) | 1364 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) |
1714 | ent.setBusinessPhone( *itV ); | 1365 | ent.setBusinessPhone( *itV ); |
1715 | /* | 1366 | |
1716 | if ( *it == tr("Business 2 Phone" ) | ||
1717 | ent.setBusiness2Phone( *itV ); | ||
1718 | */ | ||
1719 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) | 1367 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) |
1720 | ent.setBusinessFax( *itV ); | 1368 | ent.setBusinessFax( *itV ); |
1721 | 1369 | ||
1722 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) | 1370 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) |
1723 | ent.setBusinessMobile( *itV ); | 1371 | ent.setBusinessMobile( *itV ); |
1724 | /* | ||
1725 | if ( *it == "Company Phone" ) | ||
1726 | ent.setCompanyPhone( *itV ); | ||
1727 | */ | ||
1728 | //if ( *it == "Default Email" ) | ||
1729 | //ent.setDefaultEmail( *itV ); | ||
1730 | 1372 | ||
1731 | if ( *it == "Emails" ){ | 1373 | if ( *it == "Emails" ){ |
1732 | QString allemail; | 1374 | QString allemail; |
1733 | QString defaultmail; | 1375 | QString defaultmail; |
1734 | parseEmailFrom( *itV, defaultmail, allemail ); | 1376 | parseEmailFrom( *itV, defaultmail, allemail ); |
1735 | // ent.clearEmails(); | 1377 | // ent.clearEmails(); |
1736 | ent.setDefaultEmail( defaultmail ); | 1378 | ent.setDefaultEmail( defaultmail ); |
1737 | ent.setEmails( allemail ); | 1379 | ent.setEmails( allemail ); |
1738 | } | 1380 | } |
1739 | 1381 | ||
1740 | if ( *it == "Home Phone" ) | 1382 | if ( *it == "Home Phone" ) |
1741 | ent.setHomePhone( *itV ); | 1383 | ent.setHomePhone( *itV ); |
1742 | /* | 1384 | |
1743 | if ( *it == "Home 2 Phone" ) | ||
1744 | ent.setHome2Phone( *itV ); | ||
1745 | */ | ||
1746 | if ( *it == "Home Fax" ) | 1385 | if ( *it == "Home Fax" ) |
1747 | ent.setHomeFax( *itV ); | 1386 | ent.setHomeFax( *itV ); |
1748 | 1387 | ||
1749 | if ( *it == "Home Mobile" ) | 1388 | if ( *it == "Home Mobile" ) |
1750 | ent.setHomeMobile( *itV ); | 1389 | ent.setHomeMobile( *itV ); |
1751 | /* | ||
1752 | if ( *it == "Car Phone" ) | ||
1753 | ent.setCarPhone( *itV ); | ||
1754 | |||
1755 | if ( *it == "ISDN Phone" ) | ||
1756 | ent.setISDNPhone( *itV ); | ||
1757 | 1390 | ||
1758 | if ( *it == "Other Phone" ) | ||
1759 | ent.setOtherPhone( *itV ); | ||
1760 | */ | ||
1761 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1391 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1762 | ent.setBusinessPager( *itV ); | 1392 | ent.setBusinessPager( *itV ); |
1763 | /* | ||
1764 | if ( *it == "Home Pager" ) | ||
1765 | ent.setHomePager( *itV ); | ||
1766 | 1393 | ||
1767 | if ( *it == "AIM IM" ) | ||
1768 | ent.setAIMIM( *itV ); | ||
1769 | |||
1770 | if ( *it == "ICQ IM" ) | ||
1771 | ent.setICQIM( *itV ); | ||
1772 | |||
1773 | if ( *it == "Jabber IM" ) | ||
1774 | ent.setJabberIM( *itV ); | ||
1775 | |||
1776 | if ( *it == "MSN IM" ) | ||
1777 | ent.setMSNIM( *itV ); | ||
1778 | |||
1779 | if ( *it == "Yahoo IM" ) | ||
1780 | ent.setYahooIM( *itV ); | ||
1781 | */ | ||
1782 | if ( *it == "Home Web Page" ) | 1394 | if ( *it == "Home Web Page" ) |
1783 | ent.setHomeWebpage( *itV ); | 1395 | ent.setHomeWebpage( *itV ); |
1784 | 1396 | ||
1785 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1397 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1786 | ent.setBusinessWebpage( *itV ); | 1398 | ent.setBusinessWebpage( *itV ); |
1787 | 1399 | ||
@@ -1872,19 +1484,24 @@ static inline bool constainsWhiteSpace( const QString &str ) | |||
1872 | return FALSE; | 1484 | return FALSE; |
1873 | } | 1485 | } |
1874 | 1486 | ||
1875 | void ContactEditor::setPersonalView( bool personal ) | 1487 | void ContactEditor::setPersonalView( bool personal ) |
1876 | { | 1488 | { |
1877 | m_personalView = personal; | 1489 | m_personalView = personal; |
1490 | |||
1491 | // Currently disbled due to the fact that | ||
1492 | // show will not work... | ||
1493 | return; | ||
1494 | |||
1878 | if ( personal ){ | 1495 | if ( personal ){ |
1879 | cmbCat->hide(); | 1496 | cmbCat->hide(); |
1880 | labCat->hide(); | 1497 | labCat->hide(); |
1498 | |||
1881 | } else{ | 1499 | } else{ |
1882 | cmbCat->show(); | 1500 | cmbCat->show(); |
1883 | labCat->show(); | 1501 | labCat->show(); |
1884 | |||
1885 | } | 1502 | } |
1886 | } | 1503 | } |
1887 | 1504 | ||
1888 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) | 1505 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) |
1889 | { | 1506 | { |
1890 | QDate date; | 1507 | QDate date; |
@@ -1899,6 +1516,20 @@ void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) | |||
1899 | QDate date; | 1516 | QDate date; |
1900 | date.setYMD( year, month, day ); | 1517 | date.setYMD( year, month, day ); |
1901 | QString dateString = TimeString::numberDateString( date ); | 1518 | QString dateString = TimeString::numberDateString( date ); |
1902 | birthdayButton->setText( dateString ); | 1519 | birthdayButton->setText( dateString ); |
1903 | ent.setBirthday ( date ); | 1520 | ent.setBirthday ( date ); |
1904 | } | 1521 | } |
1522 | |||
1523 | void ContactEditor::slotRemoveBirthday() | ||
1524 | { | ||
1525 | qWarning("void ContactEditor::slotRemoveBirthday()"); | ||
1526 | ent.setBirthday( QDate() ); | ||
1527 | updateDatePicker(); | ||
1528 | } | ||
1529 | |||
1530 | void ContactEditor::slotRemoveAnniversary() | ||
1531 | { | ||
1532 | qWarning("void ContactEditor::slotRemoveAnniversary()"); | ||
1533 | ent.setAnniversary( QDate() ); | ||
1534 | updateDatePicker(); | ||
1535 | } | ||