summaryrefslogtreecommitdiff
authoreilers <eilers>2002-12-27 12:25:08 (UTC)
committer eilers <eilers>2002-12-27 12:25:08 (UTC)
commit36c8b8ffff2c8a7a454aa1b8afbe96bd9b1535f9 (patch) (unidiff)
tree82c1e5d1763f7f3afbc9b02f48894f2ca24ef764
parenteea5575187d95968ad76b49e4334e1165952163c (diff)
downloadopie-36c8b8ffff2c8a7a454aa1b8afbe96bd9b1535f9.zip
opie-36c8b8ffff2c8a7a454aa1b8afbe96bd9b1535f9.tar.gz
opie-36c8b8ffff2c8a7a454aa1b8afbe96bd9b1535f9.tar.bz2
Children and nickname was not shown .. fixed !
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 254cff7..1b83308 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -1,224 +1,245 @@
1/* 1/*
2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> 2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org>
3 * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) 3 * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de)
4 * 4 *
5 * This file is an add-on for the OPIE Palmtop Environment 5 * This file is an add-on for the OPIE Palmtop Environment
6 * 6 *
7 * This file may be distributed and/or modified under the terms of the 7 * This file may be distributed and/or modified under the terms of the
8 * GNU General Public License version 2 as published by the Free Software 8 * GNU General Public License version 2 as published by the Free Software
9 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging 9 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging
10 * of this file. 10 * of this file.
11 * 11 *
12 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 * 14 *
15 * 15 *
16 * This is a rewrite of the abeditor.h file, modified to provide a more 16 * This is a rewrite of the abeditor.h file, modified to provide a more
17 * intuitive interface to TrollTech's original Address Book editor. This 17 * intuitive interface to TrollTech's original Address Book editor. This
18 * is made to operate exactly in interface with the exception of name. 18 * is made to operate exactly in interface with the exception of name.
19 * 19 *
20 */ 20 */
21 21
22#include "contacteditor.h" 22#include "contacteditor.h"
23#include "addresspicker.h" 23#include "addresspicker.h"
24#include "ocontactfields.h" 24#include "ocontactfields.h"
25 25
26#include <qpe/categoryselect.h> 26#include <qpe/categoryselect.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qpe/qpedialog.h> 28#include <qpe/qpedialog.h>
29#include <qpe/timeconversion.h> 29#include <qpe/timeconversion.h>
30#include <opie/ocontact.h> 30#include <opie/ocontact.h>
31#include <qpe/resource.h> 31#include <qpe/resource.h>
32 32
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qlabel.h> 34#include <qlabel.h>
35#include <qtabwidget.h> 35#include <qtabwidget.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qlineedit.h> 37#include <qlineedit.h>
38#include <qmultilineedit.h> 38#include <qmultilineedit.h>
39#include <qscrollview.h> 39#include <qscrollview.h>
40#include <qtoolbutton.h> 40#include <qtoolbutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qmainwindow.h> 42#include <qmainwindow.h>
43#include <qvaluelist.h> 43#include <qvaluelist.h>
44#include <qpopupmenu.h> 44#include <qpopupmenu.h>
45#include <qlistbox.h> 45#include <qlistbox.h>
46#include <qhbox.h> 46#include <qhbox.h>
47#include <qaction.h> 47#include <qaction.h>
48#include <qiconset.h> 48#include <qiconset.h>
49 49
50#include <assert.h>
51
50static inline bool containsAlphaNum( const QString &str ); 52static inline bool containsAlphaNum( const QString &str );
51static inline bool constainsWhiteSpace( const QString &str ); 53static inline bool constainsWhiteSpace( const QString &str );
52 54
53// helper functions, convert our comma delimited list to proper 55// helper functions, convert our comma delimited list to proper
54// file format... 56// file format...
55void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 57void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
56 QString &strAll ); 58 QString &strAll );
57 59
58// helper convert from file format to comma delimited... 60// helper convert from file format to comma delimited...
59void parseEmailTo( const QString &strDefaultEmail, 61void parseEmailTo( const QString &strDefaultEmail,
60 const QString &strOtherEmail, QString &strBack ); 62 const QString &strOtherEmail, QString &strBack );
61 63
62 ContactEditor::ContactEditor(const OContact &entry, 64 ContactEditor::ContactEditor(const OContact &entry,
63 QWidget *parent, 65 QWidget *parent,
64 const char *name, 66 const char *name,
65 WFlags fl ) 67 WFlags fl )
66 : QDialog( parent, name, TRUE, fl ), 68 : QDialog( parent, name, TRUE, fl ),
67 m_personalView ( false ) 69 m_personalView ( false )
68 70
69{ 71{
70 72
71 init(); 73 init();
72 setEntry( entry ); 74 setEntry( entry );
73 cmbDefaultEmail = 0; 75 cmbDefaultEmail = 0;
74 defaultEmailChooserPosition = -1; 76 defaultEmailChooserPosition = -1;
75} 77}
76 78
77ContactEditor::~ContactEditor() { 79ContactEditor::~ContactEditor() {
78} 80}
79 81
80void ContactEditor::init() { 82void ContactEditor::init() {
81 83
82 useFullName = true; 84 useFullName = true;
83 85
84 uint i = 0; 86 uint i = 0;
85 87
86 QStringList trlChooserNames; 88 QStringList trlChooserNames;
87 89
88 for (i = 0; i <= 6; i++) { 90 for (i = 0; i <= 6; i++) {
89 slHomeAddress.append( "" ); 91 slHomeAddress.append( "" );
90 slBusinessAddress.append( "" ); 92 slBusinessAddress.append( "" );
91 } 93 }
92 94
93 trlChooserNames = OContactFields::trphonefields( false ); 95 trlChooserNames = OContactFields::trphonefields( false );
94 slChooserNames = OContactFields::untrphonefields( false ); 96 slChooserNames = OContactFields::untrphonefields( false );
95 slDynamicEntries = OContactFields::untrdetailsfields( false ); 97 slDynamicEntries = OContactFields::untrdetailsfields( false );
96 trlDynamicEntries = OContactFields::trdetailsfields( false ); 98 trlDynamicEntries = OContactFields::trdetailsfields( false );
99
100 // Ok, we have to remove elements from the list of dynamic entries
101 // which are now stored in special (not dynamic) widgets..
102 // Otherwise we will get problems with field assignments! (se)
103 slDynamicEntries.remove("Anniversary");
104 slDynamicEntries.remove("Birthday");
105 slDynamicEntries.remove("Gender");
106
107 // The same with translated fields.. But I will
108 // use the translation map to avoid mismatches..
109 QMap<int, QString> translMap = OContactFields::idToTrFields();
110 trlDynamicEntries.remove( translMap[Qtopia::Anniversary] );
111 trlDynamicEntries.remove( translMap[Qtopia::Birthday] );
112 trlDynamicEntries.remove( translMap[Qtopia::Gender] );
113
114 // Last Check to be sure..
115 assert( slDynamicEntries.count() == trlDynamicEntries.count() );
116 assert( slChooserNames.count() == trlChooserNames.count() );
117
97 for (i = 0; i < slChooserNames.count(); i++) 118 for (i = 0; i < slChooserNames.count(); i++)
98 slChooserValues.append(""); 119 slChooserValues.append("");
99 120
100 121
101 QVBoxLayout *vb = new QVBoxLayout( this ); 122 QVBoxLayout *vb = new QVBoxLayout( this );
102 123
103 tabMain = new QTabWidget( this ); 124 tabMain = new QTabWidget( this );
104 vb->addWidget( tabMain ); 125 vb->addWidget( tabMain );
105 126
106 QWidget *tabViewport = new QWidget ( tabMain ); 127 QWidget *tabViewport = new QWidget ( tabMain );
107 128
108 vb = new QVBoxLayout( tabViewport ); 129 vb = new QVBoxLayout( tabViewport );
109 130
110 svGeneral = new QScrollView( tabViewport ); 131 svGeneral = new QScrollView( tabViewport );
111 vb->addWidget( svGeneral, 0, 0 ); 132 vb->addWidget( svGeneral, 0, 0 );
112 svGeneral->setResizePolicy( QScrollView::AutoOneFit ); 133 svGeneral->setResizePolicy( QScrollView::AutoOneFit );
113 svGeneral->setFrameStyle( QFrame::NoFrame ); 134 svGeneral->setFrameStyle( QFrame::NoFrame );
114 135
115 QWidget *container = new QWidget( svGeneral->viewport() ); 136 QWidget *container = new QWidget( svGeneral->viewport() );
116 svGeneral->addChild( container ); 137 svGeneral->addChild( container );
117 138
118 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); 139 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 );
119 gl->setResizeMode( QLayout::FreeResize ); 140 gl->setResizeMode( QLayout::FreeResize );
120 141
121 btnFullName = new QPushButton( tr( "Full Name..." ), container ); 142 btnFullName = new QPushButton( tr( "Full Name..." ), container );
122 gl->addWidget( btnFullName, 0, 0 ); 143 gl->addWidget( btnFullName, 0, 0 );
123 txtFullName = new QLineEdit( container ); 144 txtFullName = new QLineEdit( container );
124 gl->addWidget( txtFullName, 0, 1 ); 145 gl->addWidget( txtFullName, 0, 1 );
125 146
126 QLabel *l = new QLabel( tr( "Job Title" ), container ); 147 QLabel *l = new QLabel( tr( "Job Title" ), container );
127 gl->addWidget( l, 1, 0 ); 148 gl->addWidget( l, 1, 0 );
128 txtJobTitle = new QLineEdit( container ); 149 txtJobTitle = new QLineEdit( container );
129 gl->addWidget( txtJobTitle, 1, 1 ); 150 gl->addWidget( txtJobTitle, 1, 1 );
130 151
131 l = new QLabel( tr( "Organization" ), container ); 152 l = new QLabel( tr( "Organization" ), container );
132 gl->addWidget( l, 2, 0 ); 153 gl->addWidget( l, 2, 0 );
133 txtOrganization = new QLineEdit( container ); 154 txtOrganization = new QLineEdit( container );
134 gl->addWidget( txtOrganization, 2, 1 ); 155 gl->addWidget( txtOrganization, 2, 1 );
135 156
136 cmbChooserField1 = new QComboBox( FALSE, container ); 157 cmbChooserField1 = new QComboBox( FALSE, container );
137 cmbChooserField1->setMaximumWidth( 90 ); 158 cmbChooserField1->setMaximumWidth( 90 );
138 gl->addWidget( cmbChooserField1, 3, 0 ); 159 gl->addWidget( cmbChooserField1, 3, 0 );
139 txtChooserField1 = new QLineEdit( container ); 160 txtChooserField1 = new QLineEdit( container );
140 gl->addWidget( txtChooserField1, 3, 1 ); 161 gl->addWidget( txtChooserField1, 3, 1 );
141 162
142 cmbChooserField2 = new QComboBox( FALSE, container ); 163 cmbChooserField2 = new QComboBox( FALSE, container );
143 cmbChooserField2->setMaximumWidth( 90 ); 164 cmbChooserField2->setMaximumWidth( 90 );
144 gl->addWidget( cmbChooserField2, 4, 0 ); 165 gl->addWidget( cmbChooserField2, 4, 0 );
145 txtChooserField2 = new QLineEdit( container ); 166 txtChooserField2 = new QLineEdit( container );
146 gl->addWidget( txtChooserField2, 4, 1 ); 167 gl->addWidget( txtChooserField2, 4, 1 );
147 168
148 cmbChooserField3 = new QComboBox( FALSE, container ); 169 cmbChooserField3 = new QComboBox( FALSE, container );
149 cmbChooserField3->setMaximumWidth( 90 ); 170 cmbChooserField3->setMaximumWidth( 90 );
150 gl->addWidget( cmbChooserField3, 5, 0 ); 171 gl->addWidget( cmbChooserField3, 5, 0 );
151 txtChooserField3 = new QLineEdit( container ); 172 txtChooserField3 = new QLineEdit( container );
152 gl->addWidget( txtChooserField3, 5, 1 ); 173 gl->addWidget( txtChooserField3, 5, 1 );
153 174
154 l = new QLabel( tr( "File As" ), container ); 175 l = new QLabel( tr( "File As" ), container );
155 gl->addWidget( l, 6, 0 ); 176 gl->addWidget( l, 6, 0 );
156 cmbFileAs = new QComboBox( TRUE, container ); 177 cmbFileAs = new QComboBox( TRUE, container );
157 gl->addWidget( cmbFileAs, 6, 1 ); 178 gl->addWidget( cmbFileAs, 6, 1 );
158 179
159 labCat = new QLabel( tr( "Category" ), container ); 180 labCat = new QLabel( tr( "Category" ), container );
160 gl->addWidget( labCat, 7, 0 ); 181 gl->addWidget( labCat, 7, 0 );
161 cmbCat = new CategorySelect( container ); 182 cmbCat = new CategorySelect( container );
162 gl->addWidget( cmbCat, 7, 1 ); 183 gl->addWidget( cmbCat, 7, 1 );
163 labCat->show(); 184 labCat->show();
164 cmbCat->show(); 185 cmbCat->show();
165 186
166 btnNote = new QPushButton( tr( "Notes..." ), container ); 187 btnNote = new QPushButton( tr( "Notes..." ), container );
167 gl->addWidget( btnNote, 8, 1 ); 188 gl->addWidget( btnNote, 8, 1 );
168 189
169 tabMain->insertTab( tabViewport, tr( "General" ) ); 190 tabMain->insertTab( tabViewport, tr( "General" ) );
170 191
171 tabViewport = new QWidget ( tabMain ); 192 tabViewport = new QWidget ( tabMain );
172 193
173 vb = new QVBoxLayout( tabViewport ); 194 vb = new QVBoxLayout( tabViewport );
174 195
175 svAddress = new QScrollView( tabViewport ); 196 svAddress = new QScrollView( tabViewport );
176 vb->addWidget( svAddress, 0, 0 ); 197 vb->addWidget( svAddress, 0, 0 );
177 svAddress->setResizePolicy( QScrollView::AutoOneFit ); 198 svAddress->setResizePolicy( QScrollView::AutoOneFit );
178 svAddress->setFrameStyle( QFrame::NoFrame ); 199 svAddress->setFrameStyle( QFrame::NoFrame );
179 200
180 container = new QWidget( svAddress->viewport() ); 201 container = new QWidget( svAddress->viewport() );
181 svAddress->addChild( container ); 202 svAddress->addChild( container );
182 203
183 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem 204 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem
184 205
185 cmbAddress = new QComboBox( FALSE, container ); 206 cmbAddress = new QComboBox( FALSE, container );
186 cmbAddress->insertItem( tr( "Business" ) ); 207 cmbAddress->insertItem( tr( "Business" ) );
187 cmbAddress->insertItem( tr( "Home" ) ); 208 cmbAddress->insertItem( tr( "Home" ) );
188 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); 209 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 );
189 210
190 l = new QLabel( tr( "Address" ), container ); 211 l = new QLabel( tr( "Address" ), container );
191 gl->addWidget( l, 1, 0 ); 212 gl->addWidget( l, 1, 0 );
192 txtAddress = new QLineEdit( container ); 213 txtAddress = new QLineEdit( container );
193 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); 214 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 );
194 215
195 l = new QLabel( tr( "City" ), container ); 216 l = new QLabel( tr( "City" ), container );
196 gl->addWidget( l, 2, 0 ); 217 gl->addWidget( l, 2, 0 );
197 txtCity = new QLineEdit( container ); 218 txtCity = new QLineEdit( container );
198 gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); 219 gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 );
199 220
200 l = new QLabel( tr( "State" ), container ); 221 l = new QLabel( tr( "State" ), container );
201 gl->addWidget( l, 3, 0 ); 222 gl->addWidget( l, 3, 0 );
202 txtState = new QLineEdit( container ); 223 txtState = new QLineEdit( container );
203 gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); 224 gl->addMultiCellWidget( txtState, 3, 3, 1, 2 );
204 225
205 l = new QLabel( tr( "Zip Code" ), container ); 226 l = new QLabel( tr( "Zip Code" ), container );
206 gl->addWidget( l, 4, 0 ); 227 gl->addWidget( l, 4, 0 );
207 txtZip = new QLineEdit( container ); 228 txtZip = new QLineEdit( container );
208 gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); 229 gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 );
209 230
210 l = new QLabel( tr( "Country" ), container ); 231 l = new QLabel( tr( "Country" ), container );
211 gl->addWidget( l, 5, 0 ); 232 gl->addWidget( l, 5, 0 );
212 cmbCountry = new QComboBox( TRUE, container ); 233 cmbCountry = new QComboBox( TRUE, container );
213 cmbCountry->insertItem( tr( "" ) ); 234 cmbCountry->insertItem( tr( "" ) );
214 cmbCountry->insertItem( tr ( "United States" ) ); 235 cmbCountry->insertItem( tr ( "United States" ) );
215 cmbCountry->insertItem( tr ( "United Kingdom" ) ); 236 cmbCountry->insertItem( tr ( "United Kingdom" ) );
216 cmbCountry->insertItem( tr ( "Afganistan" ) ); 237 cmbCountry->insertItem( tr ( "Afganistan" ) );
217 cmbCountry->insertItem( tr ( "Albania" ) ); 238 cmbCountry->insertItem( tr ( "Albania" ) );
218 cmbCountry->insertItem( tr ( "Algeria" ) ); 239 cmbCountry->insertItem( tr ( "Algeria" ) );
219 cmbCountry->insertItem( tr ( "American Samoa" ) ); 240 cmbCountry->insertItem( tr ( "American Samoa" ) );
220 cmbCountry->insertItem( tr ( "Andorra" ) ); 241 cmbCountry->insertItem( tr ( "Andorra" ) );
221 cmbCountry->insertItem( tr ( "Angola" ) ); 242 cmbCountry->insertItem( tr ( "Angola" ) );
222 cmbCountry->insertItem( tr ( "Anguilla" ) ); 243 cmbCountry->insertItem( tr ( "Anguilla" ) );
223 cmbCountry->insertItem( tr ( "Antartica" ) ); 244 cmbCountry->insertItem( tr ( "Antartica" ) );
224 cmbCountry->insertItem( tr ( "Argentina" ) ); 245 cmbCountry->insertItem( tr ( "Argentina" ) );
@@ -1051,279 +1072,284 @@ QString ContactEditor::parseName( const QString fullName, int type ) {
1051 case NAME_LF: 1072 case NAME_LF:
1052 return strLastName + ", " + strFirstName; 1073 return strLastName + ", " + strFirstName;
1053 1074
1054 case NAME_LFM: 1075 case NAME_LFM:
1055 return strLastName + ", " + strFirstName + " " + strMiddleName; 1076 return strLastName + ", " + strFirstName + " " + strMiddleName;
1056 1077
1057 case NAME_FMLS: 1078 case NAME_FMLS:
1058 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; 1079 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix;
1059 1080
1060 case NAME_F: 1081 case NAME_F:
1061 return strFirstName; 1082 return strFirstName;
1062 1083
1063 case NAME_M: 1084 case NAME_M:
1064 return strMiddleName; 1085 return strMiddleName;
1065 1086
1066 case NAME_L: 1087 case NAME_L:
1067 return strLastName; 1088 return strLastName;
1068 1089
1069 case NAME_S: 1090 case NAME_S:
1070 return strSuffix; 1091 return strSuffix;
1071 1092
1072 } 1093 }
1073 return QString::null; 1094 return QString::null;
1074} 1095}
1075 1096
1076void ContactEditor::cleanupFields() { 1097void ContactEditor::cleanupFields() {
1077 QStringList::Iterator it = slChooserValues.begin(); 1098 QStringList::Iterator it = slChooserValues.begin();
1078 1099
1079 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { 1100 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) {
1080 (*it) = ""; 1101 (*it) = "";
1081 } 1102 }
1082 1103
1083 for ( int i = 0; i < 7; i++ ) { 1104 for ( int i = 0; i < 7; i++ ) {
1084 slHomeAddress[i] = ""; 1105 slHomeAddress[i] = "";
1085 slBusinessAddress[i] = ""; 1106 slBusinessAddress[i] = "";
1086 } 1107 }
1087 1108
1088 QListIterator<QLineEdit> itLV( listValue ); 1109 QListIterator<QLineEdit> itLV( listValue );
1089 for ( ; itLV.current(); ++itLV ) { 1110 for ( ; itLV.current(); ++itLV ) {
1090 (*itLV)->setText( "" ); 1111 (*itLV)->setText( "" );
1091 } 1112 }
1092 1113
1093 txtFirstName->setText(""); 1114 txtFirstName->setText("");
1094 txtMiddleName->setText(""); 1115 txtMiddleName->setText("");
1095 txtLastName->setText(""); 1116 txtLastName->setText("");
1096 txtSuffix->setText(""); 1117 txtSuffix->setText("");
1097 txtNote->setText(""); 1118 txtNote->setText("");
1098 txtFullName->setText(""); 1119 txtFullName->setText("");
1099 txtJobTitle->setText(""); 1120 txtJobTitle->setText("");
1100 txtOrganization->setText(""); 1121 txtOrganization->setText("");
1101 txtChooserField1->setText(""); 1122 txtChooserField1->setText("");
1102 txtChooserField2->setText(""); 1123 txtChooserField2->setText("");
1103 txtChooserField3->setText(""); 1124 txtChooserField3->setText("");
1104 txtAddress->setText(""); 1125 txtAddress->setText("");
1105 txtCity->setText(""); 1126 txtCity->setText("");
1106 txtState->setText(""); 1127 txtState->setText("");
1107 txtZip->setText(""); 1128 txtZip->setText("");
1108 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1129 QLineEdit *txtTmp = cmbCountry->lineEdit();
1109 txtTmp->setText(""); 1130 txtTmp->setText("");
1110 txtTmp = cmbFileAs->lineEdit(); 1131 txtTmp = cmbFileAs->lineEdit();
1111 txtTmp->setText(""); 1132 txtTmp->setText("");
1112 1133
1113} 1134}
1114 1135
1115void ContactEditor::setEntry( const OContact &entry ) { 1136void ContactEditor::setEntry( const OContact &entry ) {
1116 1137
1117 cleanupFields(); 1138 cleanupFields();
1118 1139
1119 ent = entry; 1140 ent = entry;
1120 1141
1121 1142
1122 1143
1123 emails = QStringList(ent.emailList()); 1144 emails = QStringList(ent.emailList());
1124 defaultEmail = ent.defaultEmail(); 1145 defaultEmail = ent.defaultEmail();
1125 if (defaultEmail.isEmpty()) defaultEmail = emails[0]; 1146 if (defaultEmail.isEmpty()) defaultEmail = emails[0];
1126 qDebug("default email=%s",defaultEmail.latin1()); 1147 qDebug("default email=%s",defaultEmail.latin1());
1127 1148
1128 useFullName = false; 1149 useFullName = false;
1129 txtFirstName->setText( ent.firstName() ); 1150 txtFirstName->setText( ent.firstName() );
1130 txtMiddleName->setText( ent.middleName() ); 1151 txtMiddleName->setText( ent.middleName() );
1131 txtLastName->setText( ent.lastName() ); 1152 txtLastName->setText( ent.lastName() );
1132 txtSuffix->setText( ent.suffix() ); 1153 txtSuffix->setText( ent.suffix() );
1133 1154
1134 QString *tmpString = new QString; 1155 QString *tmpString = new QString;
1135 *tmpString = ent.firstName() + " " + ent.middleName() + 1156 *tmpString = ent.firstName() + " " + ent.middleName() +
1136 + " " + ent.lastName() + " " + ent.suffix(); 1157 + " " + ent.lastName() + " " + ent.suffix();
1137 1158
1138 txtFullName->setText( tmpString->simplifyWhiteSpace() ); 1159 txtFullName->setText( tmpString->simplifyWhiteSpace() );
1139 1160
1140 cmbFileAs->setEditText( ent.fileAs() ); 1161 cmbFileAs->setEditText( ent.fileAs() );
1141 1162
1142 //if (hasTitle) 1163 //if (hasTitle)
1143 txtJobTitle->setText( ent.jobTitle() ); 1164 txtJobTitle->setText( ent.jobTitle() );
1144 1165
1145 //if (hasCompany) 1166 //if (hasCompany)
1146 txtOrganization->setText( ent.company() ); 1167 txtOrganization->setText( ent.company() );
1147 1168
1148 //if (hasNotes) 1169 //if (hasNotes)
1149 txtNote->setText( ent.notes() ); 1170 txtNote->setText( ent.notes() );
1150 1171
1151 //if (hasStreet) { 1172 //if (hasStreet) {
1152 slHomeAddress[0] = ent.homeStreet(); 1173 slHomeAddress[0] = ent.homeStreet();
1153 slBusinessAddress[0] = ent.businessStreet(); 1174 slBusinessAddress[0] = ent.businessStreet();
1154 //} 1175 //}
1155 1176
1156 //if (hasCity) { 1177 //if (hasCity) {
1157 slHomeAddress[3] = ent.homeCity(); 1178 slHomeAddress[3] = ent.homeCity();
1158 slBusinessAddress[3] = ent.businessCity(); 1179 slBusinessAddress[3] = ent.businessCity();
1159//} 1180//}
1160 1181
1161//if (hasState) { 1182//if (hasState) {
1162 slHomeAddress[4] = ent.homeState(); 1183 slHomeAddress[4] = ent.homeState();
1163 slBusinessAddress[4] = ent.businessState(); 1184 slBusinessAddress[4] = ent.businessState();
1164//} 1185//}
1165 1186
1166//if (hasZip) { 1187//if (hasZip) {
1167 slHomeAddress[5] = ent.homeZip(); 1188 slHomeAddress[5] = ent.homeZip();
1168 slBusinessAddress[5] = ent.businessZip(); 1189 slBusinessAddress[5] = ent.businessZip();
1169//} 1190//}
1170 1191
1171//if (hasCountry) { 1192//if (hasCountry) {
1172 slHomeAddress[6] = ent.homeCountry(); 1193 slHomeAddress[6] = ent.homeCountry();
1173 slBusinessAddress[6] = ent.businessCountry(); 1194 slBusinessAddress[6] = ent.businessCountry();
1174//} 1195//}
1175 1196
1176 QStringList::ConstIterator it; 1197 QStringList::ConstIterator it;
1177 QListIterator<QLineEdit> itLE( listValue ); 1198 QListIterator<QLineEdit> itLE( listValue );
1178 for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { 1199 for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) {
1200
1201 qWarning(" Filling dynamic Field: %s", (*it).latin1() );
1202
1179 if ( *it == "Department" ) 1203 if ( *it == "Department" )
1180 (*itLE)->setText( ent.department() ); 1204 (*itLE)->setText( ent.department() );
1181 1205
1182 if ( *it == "Company" ) 1206 if ( *it == "Company" )
1183 (*itLE)->setText( ent.company() ); 1207 (*itLE)->setText( ent.company() );
1184 1208
1185 if ( *it == "Office" ) 1209 if ( *it == "Office" )
1186 (*itLE)->setText( ent.office() ); 1210 (*itLE)->setText( ent.office() );
1187 1211
1188 if ( *it == "Profession" ) 1212 if ( *it == "Profession" )
1189 (*itLE)->setText( ent.profession() ); 1213 (*itLE)->setText( ent.profession() );
1190 1214
1191 if ( *it == "Assistant" ) 1215 if ( *it == "Assistant" )
1192 (*itLE)->setText( ent.assistant() ); 1216 (*itLE)->setText( ent.assistant() );
1193 1217
1194 if ( *it == "Manager" ) 1218 if ( *it == "Manager" )
1195 (*itLE)->setText( ent.manager() ); 1219 (*itLE)->setText( ent.manager() );
1196 1220
1197 if ( *it == "Spouse" ) 1221 if ( *it == "Spouse" )
1198 (*itLE)->setText( ent.spouse() ); 1222 (*itLE)->setText( ent.spouse() );
1199 1223
1200 if ( *it == "Nickname" ) 1224 if ( *it == "Nickname" ){
1225 qWarning("**** Nichname: %s", ent.nickname().latin1() );
1201 (*itLE)->setText( ent.nickname() ); 1226 (*itLE)->setText( ent.nickname() );
1227 }
1202 1228
1203 if ( *it == "Children" ) 1229 if ( *it == "Children" )
1204 (*itLE)->setText( ent.children() ); 1230 (*itLE)->setText( ent.children() );
1205 1231
1206 } 1232 }
1207 1233
1208 QStringList::Iterator itV; 1234 QStringList::Iterator itV;
1209 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1235 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1210 1236
1211 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) 1237 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) )
1212 *itV = ent.businessPhone(); 1238 *itV = ent.businessPhone();
1213/* 1239/*
1214 if ( *it == "Business 2 Phone" ) 1240 if ( *it == "Business 2 Phone" )
1215 *itV = ent.business2Phone(); 1241 *itV = ent.business2Phone();
1216*/ 1242*/
1217 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) 1243 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) )
1218 *itV = ent.businessFax(); 1244 *itV = ent.businessFax();
1219 1245
1220 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) 1246 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) )
1221 *itV = ent.businessMobile(); 1247 *itV = ent.businessMobile();
1222/* 1248/*
1223 if ( *it == "Company Phone" ) 1249 if ( *it == "Company Phone" )
1224 *itV = ent.companyPhone(); 1250 *itV = ent.companyPhone();
1225*/ 1251*/
1226 if ( *it == "Default Email" ) 1252 if ( *it == "Default Email" )
1227 *itV = ent.defaultEmail(); 1253 *itV = ent.defaultEmail();
1228 1254
1229 if ( *it == "Emails" ) 1255 if ( *it == "Emails" )
1230 *itV = ent.emailList().join(", "); // :SX 1256 *itV = ent.emailList().join(", "); // :SX
1231 1257
1232 if ( *it == "Home Phone" ) 1258 if ( *it == "Home Phone" )
1233 *itV = ent.homePhone(); 1259 *itV = ent.homePhone();
1234/* 1260/*
1235 if ( *it == "Home 2 Phone" ) 1261 if ( *it == "Home 2 Phone" )
1236 *itV = ent.home2Phone(); 1262 *itV = ent.home2Phone();
1237*/ 1263*/
1238 if ( *it == "Home Fax" ) 1264 if ( *it == "Home Fax" )
1239 *itV = ent.homeFax(); 1265 *itV = ent.homeFax();
1240 1266
1241 if ( *it == "Home Mobile" ) 1267 if ( *it == "Home Mobile" )
1242 *itV = ent.homeMobile(); 1268 *itV = ent.homeMobile();
1243/* 1269/*
1244 if ( *it == "Car Phone" ) 1270 if ( *it == "Car Phone" )
1245 *itV = ent.carPhone(); 1271 *itV = ent.carPhone();
1246 1272
1247 if ( *it == "ISDN Phone" ) 1273 if ( *it == "ISDN Phone" )
1248 *itV = ent.ISDNPhone(); 1274 *itV = ent.ISDNPhone();
1249 1275
1250 if ( *it == "Other Phone" ) 1276 if ( *it == "Other Phone" )
1251 *itV = ent.otherPhone(); 1277 *itV = ent.otherPhone();
1252*/ 1278*/
1253 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) 1279 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
1254 *itV = ent.businessPager(); 1280 *itV = ent.businessPager();
1255/* 1281/*
1256 if ( *it == "Home Pager") 1282 if ( *it == "Home Pager")
1257 *itV = ent.homePager(); 1283 *itV = ent.homePager();
1258 1284
1259 if ( *it == "AIM IM" ) 1285 if ( *it == "AIM IM" )
1260 *itV = ent.AIMIM(); 1286 *itV = ent.AIMIM();
1261 1287
1262 if ( *it == "ICQ IM" ) 1288 if ( *it == "ICQ IM" )
1263 *itV = ent.ICQIM(); 1289 *itV = ent.ICQIM();
1264 1290
1265 if ( *it == "Jabber IM" ) 1291 if ( *it == "Jabber IM" )
1266 *itV = ent.jabberIM(); 1292 *itV = ent.jabberIM();
1267 1293
1268 if ( *it == "MSN IM" ) 1294 if ( *it == "MSN IM" )
1269 *itV = ent.MSNIM(); 1295 *itV = ent.MSNIM();
1270 1296
1271 if ( *it == "Yahoo IM" ) 1297 if ( *it == "Yahoo IM" )
1272 *itV = ent.yahooIM(); 1298 *itV = ent.yahooIM();
1273*/ 1299*/
1274 if ( *it == "Home Web Page" ) 1300 if ( *it == "Home Web Page" )
1275 *itV = ent.homeWebpage(); 1301 *itV = ent.homeWebpage();
1276 1302
1277 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) 1303 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1278 *itV = ent.businessWebpage(); 1304 *itV = ent.businessWebpage();
1279 1305
1280 1306
1281 } 1307 }
1282 1308
1283 1309
1284 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); 1310 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") );
1285 1311
1286 QString gender = ent.gender(); 1312 QString gender = ent.gender();
1287 cmbGender->setCurrentItem( gender.toInt() ); 1313 cmbGender->setCurrentItem( gender.toInt() );
1288 1314
1289 txtNote->setText( ent.notes() ); 1315 txtNote->setText( ent.notes() );
1290 1316
1291 slotCmbChooser1Change( cmbChooserField1->currentItem() ); 1317 slotCmbChooser1Change( cmbChooserField1->currentItem() );
1292 slotCmbChooser2Change( cmbChooserField2->currentItem() ); 1318 slotCmbChooser2Change( cmbChooserField2->currentItem() );
1293 slotCmbChooser3Change( cmbChooserField3->currentItem() ); 1319 slotCmbChooser3Change( cmbChooserField3->currentItem() );
1294 1320
1295 slotAddressTypeChange( cmbAddress->currentItem() ); 1321 slotAddressTypeChange( cmbAddress->currentItem() );
1296 1322
1297 // loadFields(); :SX 1323 // loadFields(); :SX
1298 updateDatePicker(); 1324 updateDatePicker();
1299} 1325}
1300void ContactEditor::updateDatePicker() 1326void ContactEditor::updateDatePicker()
1301{ 1327{
1302 // Set DatePicker 1328 // Set DatePicker
1303 if ( !ent.birthday().isNull() ){ 1329 if ( !ent.birthday().isNull() ){
1304 birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); 1330 birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) );
1305 birthdayPicker->setDate( ent.birthday() ); 1331 birthdayPicker->setDate( ent.birthday() );
1306 } else 1332 } else
1307 birthdayButton->setText( tr ("Unknown") ); 1333 birthdayButton->setText( tr ("Unknown") );
1308 1334
1309 if ( !ent.anniversary().isNull() ){ 1335 if ( !ent.anniversary().isNull() ){
1310 anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); 1336 anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) );
1311 anniversaryPicker->setDate( ent.anniversary() ); 1337 anniversaryPicker->setDate( ent.anniversary() );
1312 } else 1338 } else
1313 anniversaryButton->setText( tr ("Unknown") ); 1339 anniversaryButton->setText( tr ("Unknown") );
1314 1340
1315} 1341}
1316 1342
1317void ContactEditor::saveEntry() { 1343void ContactEditor::saveEntry() {
1318 1344
1319 if ( useFullName ) { 1345 if ( useFullName ) {
1320 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); 1346 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) );
1321 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); 1347 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) );
1322 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); 1348 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
1323 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); 1349 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
1324 1350
1325 useFullName = false; 1351 useFullName = false;
1326 } 1352 }
1327 1353
1328 ent.setFirstName( txtFirstName->text() ); 1354 ent.setFirstName( txtFirstName->text() );
1329 ent.setLastName( txtLastName->text() ); 1355 ent.setLastName( txtLastName->text() );