summaryrefslogtreecommitdiff
authortille <tille>2002-12-18 13:01:15 (UTC)
committer tille <tille>2002-12-18 13:01:15 (UTC)
commit9471f69c44e811781ed9f643f5b84d7b459df601 (patch) (unidiff)
treef8daf275c36b9a068cbec9ff487a195e639ff8bf
parent930884a92b064766ed436111778fc55f157c6e1c (diff)
downloadopie-9471f69c44e811781ed9f643f5b84d7b459df601.zip
opie-9471f69c44e811781ed9f643f5b84d7b459df601.tar.gz
opie-9471f69c44e811781ed9f643f5b84d7b459df601.tar.bz2
changing from defaultemail to something else now hides the combo
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp19
-rw-r--r--core/pim/addressbook/contacteditor.h3
2 files changed, 14 insertions, 8 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index f125edb..cc3908a 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -1,266 +1,266 @@
1/* 1/*
2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> 2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org>
3 * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) 3 * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de)
4 * 4 *
5 * This file is an add-on for the OPIE Palmtop Environment 5 * This file is an add-on for the OPIE Palmtop Environment
6 * 6 *
7 * This file may be distributed and/or modified under the terms of the 7 * This file may be distributed and/or modified under the terms of the
8 * GNU General Public License version 2 as published by the Free Software 8 * GNU General Public License version 2 as published by the Free Software
9 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging 9 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging
10 * of this file. 10 * of this file.
11 * 11 *
12 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 * 14 *
15 * 15 *
16 * This is a rewrite of the abeditor.h file, modified to provide a more 16 * This is a rewrite of the abeditor.h file, modified to provide a more
17 * intuitive interface to TrollTech's original Address Book editor. This 17 * intuitive interface to TrollTech's original Address Book editor. This
18 * is made to operate exactly in interface with the exception of name. 18 * is made to operate exactly in interface with the exception of name.
19 * 19 *
20 */ 20 */
21 21
22#include "contacteditor.h" 22#include "contacteditor.h"
23#include "addresspicker.h" 23#include "addresspicker.h"
24#include "ocontactfields.h" 24#include "ocontactfields.h"
25 25
26#include <qpe/categoryselect.h> 26#include <qpe/categoryselect.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qpe/qpedialog.h> 28#include <qpe/qpedialog.h>
29#include <qpe/timeconversion.h> 29#include <qpe/timeconversion.h>
30#include <opie/ocontact.h> 30#include <opie/ocontact.h>
31#include <qpe/resource.h> 31#include <qpe/resource.h>
32 32
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qlabel.h> 34#include <qlabel.h>
35#include <qtabwidget.h> 35#include <qtabwidget.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qlineedit.h> 37#include <qlineedit.h>
38#include <qmultilineedit.h> 38#include <qmultilineedit.h>
39#include <qscrollview.h> 39#include <qscrollview.h>
40#include <qtoolbutton.h> 40#include <qtoolbutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qmainwindow.h> 42#include <qmainwindow.h>
43#include <qvaluelist.h> 43#include <qvaluelist.h>
44#include <qpopupmenu.h> 44#include <qpopupmenu.h>
45#include <qlistbox.h> 45#include <qlistbox.h>
46#include <qhbox.h> 46#include <qhbox.h>
47#include <qaction.h> 47#include <qaction.h>
48#include <qiconset.h> 48#include <qiconset.h>
49 49
50static inline bool containsAlphaNum( const QString &str ); 50static inline bool containsAlphaNum( const QString &str );
51static inline bool constainsWhiteSpace( const QString &str ); 51static inline bool constainsWhiteSpace( const QString &str );
52 52
53// helper functions, convert our comma delimited list to proper 53// helper functions, convert our comma delimited list to proper
54// file format... 54// file format...
55void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 55void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
56 QString &strAll ); 56 QString &strAll );
57 57
58// helper convert from file format to comma delimited... 58// helper convert from file format to comma delimited...
59//void parseEmailTo( const QString &strDefaultEmail, 59//void parseEmailTo( const QString &strDefaultEmail,
60 // const QString &strOtherEmail, QString &strBack ); 60 // const QString &strOtherEmail, QString &strBack );
61 61
62 ContactEditor::ContactEditor(const OContact &entry, 62 ContactEditor::ContactEditor(const OContact &entry,
63 QWidget *parent, 63 QWidget *parent,
64 const char *name, 64 const char *name,
65 WFlags fl ) 65 WFlags fl )
66 : QDialog( parent, name, TRUE, fl ), 66 : QDialog( parent, name, TRUE, fl ),
67 m_personalView ( false ) 67 m_personalView ( false )
68 68
69{ 69{
70 70
71 init(); 71 init();
72 setEntry( entry ); 72 setEntry( entry );
73
74 cmbDefaultEmail = 0; 73 cmbDefaultEmail = 0;
74 defaultEmailChooserPosition = -1;
75} 75}
76 76
77ContactEditor::~ContactEditor() { 77ContactEditor::~ContactEditor() {
78} 78}
79 79
80void ContactEditor::init() { 80void ContactEditor::init() {
81 81
82 useFullName = true; 82 useFullName = true;
83 83
84 uint i = 0; 84 uint i = 0;
85 85
86 QStringList trlChooserNames; 86 QStringList trlChooserNames;
87 87
88 for (i = 0; i <= 6; i++) { 88 for (i = 0; i <= 6; i++) {
89 slHomeAddress.append( "" ); 89 slHomeAddress.append( "" );
90 slBusinessAddress.append( "" ); 90 slBusinessAddress.append( "" );
91 } 91 }
92 92
93 trlChooserNames = OContactFields::trphonefields(); 93 trlChooserNames = OContactFields::trphonefields();
94 slChooserNames = OContactFields::untrphonefields(); 94 slChooserNames = OContactFields::untrphonefields();
95 slDynamicEntries = OContactFields::untrdetailsfields(); 95 slDynamicEntries = OContactFields::untrdetailsfields();
96 trlDynamicEntries = OContactFields::trdetailsfields(); 96 trlDynamicEntries = OContactFields::trdetailsfields();
97 for (i = 0; i < slChooserNames.count(); i++) 97 for (i = 0; i < slChooserNames.count(); i++)
98 slChooserValues.append(""); 98 slChooserValues.append("");
99 99
100 100
101 QVBoxLayout *vb = new QVBoxLayout( this ); 101 QVBoxLayout *vb = new QVBoxLayout( this );
102 102
103 tabMain = new QTabWidget( this ); 103 tabMain = new QTabWidget( this );
104 vb->addWidget( tabMain ); 104 vb->addWidget( tabMain );
105 105
106 QWidget *tabViewport = new QWidget ( tabMain ); 106 QWidget *tabViewport = new QWidget ( tabMain );
107 107
108 vb = new QVBoxLayout( tabViewport ); 108 vb = new QVBoxLayout( tabViewport );
109 109
110 svGeneral = new QScrollView( tabViewport ); 110 svGeneral = new QScrollView( tabViewport );
111 vb->addWidget( svGeneral, 0, 0 ); 111 vb->addWidget( svGeneral, 0, 0 );
112 svGeneral->setResizePolicy( QScrollView::AutoOneFit ); 112 svGeneral->setResizePolicy( QScrollView::AutoOneFit );
113 svGeneral->setFrameStyle( QFrame::NoFrame ); 113 svGeneral->setFrameStyle( QFrame::NoFrame );
114 114
115 QWidget *container = new QWidget( svGeneral->viewport() ); 115 QWidget *container = new QWidget( svGeneral->viewport() );
116 svGeneral->addChild( container ); 116 svGeneral->addChild( container );
117 117
118 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); 118 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 );
119 gl->setResizeMode( QLayout::FreeResize ); 119 gl->setResizeMode( QLayout::FreeResize );
120 120
121 btnFullName = new QPushButton( tr( "Full Name..." ), container ); 121 btnFullName = new QPushButton( tr( "Full Name..." ), container );
122 gl->addWidget( btnFullName, 0, 0 ); 122 gl->addWidget( btnFullName, 0, 0 );
123 txtFullName = new QLineEdit( container ); 123 txtFullName = new QLineEdit( container );
124 gl->addWidget( txtFullName, 0, 1 ); 124 gl->addWidget( txtFullName, 0, 1 );
125 125
126 QLabel *l = new QLabel( tr( "Job Title" ), container ); 126 QLabel *l = new QLabel( tr( "Job Title" ), container );
127 gl->addWidget( l, 1, 0 ); 127 gl->addWidget( l, 1, 0 );
128 txtJobTitle = new QLineEdit( container ); 128 txtJobTitle = new QLineEdit( container );
129 gl->addWidget( txtJobTitle, 1, 1 ); 129 gl->addWidget( txtJobTitle, 1, 1 );
130 130
131 l = new QLabel( tr( "Organization" ), container ); 131 l = new QLabel( tr( "Organization" ), container );
132 gl->addWidget( l, 2, 0 ); 132 gl->addWidget( l, 2, 0 );
133 txtOrganization = new QLineEdit( container ); 133 txtOrganization = new QLineEdit( container );
134 gl->addWidget( txtOrganization, 2, 1 ); 134 gl->addWidget( txtOrganization, 2, 1 );
135 135
136 cmbChooserField1 = new QComboBox( FALSE, container ); 136 cmbChooserField1 = new QComboBox( FALSE, container );
137 cmbChooserField1->setMaximumWidth( 90 ); 137 cmbChooserField1->setMaximumWidth( 90 );
138 gl->addWidget( cmbChooserField1, 3, 0 ); 138 gl->addWidget( cmbChooserField1, 3, 0 );
139 txtChooserField1 = new QLineEdit( container ); 139 txtChooserField1 = new QLineEdit( container );
140 gl->addWidget( txtChooserField1, 3, 1 ); 140 gl->addWidget( txtChooserField1, 3, 1 );
141 141
142 cmbChooserField2 = new QComboBox( FALSE, container ); 142 cmbChooserField2 = new QComboBox( FALSE, container );
143 cmbChooserField2->setMaximumWidth( 90 ); 143 cmbChooserField2->setMaximumWidth( 90 );
144 gl->addWidget( cmbChooserField2, 4, 0 ); 144 gl->addWidget( cmbChooserField2, 4, 0 );
145 txtChooserField2 = new QLineEdit( container ); 145 txtChooserField2 = new QLineEdit( container );
146 gl->addWidget( txtChooserField2, 4, 1 ); 146 gl->addWidget( txtChooserField2, 4, 1 );
147 147
148 cmbChooserField3 = new QComboBox( FALSE, container ); 148 cmbChooserField3 = new QComboBox( FALSE, container );
149 cmbChooserField3->setMaximumWidth( 90 ); 149 cmbChooserField3->setMaximumWidth( 90 );
150 gl->addWidget( cmbChooserField3, 5, 0 ); 150 gl->addWidget( cmbChooserField3, 5, 0 );
151 txtChooserField3 = new QLineEdit( container ); 151 txtChooserField3 = new QLineEdit( container );
152 gl->addWidget( txtChooserField3, 5, 1 ); 152 gl->addWidget( txtChooserField3, 5, 1 );
153 153
154 l = new QLabel( tr( "File As" ), container ); 154 l = new QLabel( tr( "File As" ), container );
155 gl->addWidget( l, 6, 0 ); 155 gl->addWidget( l, 6, 0 );
156 cmbFileAs = new QComboBox( TRUE, container ); 156 cmbFileAs = new QComboBox( TRUE, container );
157 gl->addWidget( cmbFileAs, 6, 1 ); 157 gl->addWidget( cmbFileAs, 6, 1 );
158 158
159 labCat = new QLabel( tr( "Category" ), container ); 159 labCat = new QLabel( tr( "Category" ), container );
160 gl->addWidget( labCat, 7, 0 ); 160 gl->addWidget( labCat, 7, 0 );
161 cmbCat = new CategorySelect( container ); 161 cmbCat = new CategorySelect( container );
162 gl->addWidget( cmbCat, 7, 1 ); 162 gl->addWidget( cmbCat, 7, 1 );
163 labCat->show(); 163 labCat->show();
164 cmbCat->show(); 164 cmbCat->show();
165 165
166 btnNote = new QPushButton( tr( "Notes..." ), container ); 166 btnNote = new QPushButton( tr( "Notes..." ), container );
167 gl->addWidget( btnNote, 8, 1 ); 167 gl->addWidget( btnNote, 8, 1 );
168 168
169 tabMain->insertTab( tabViewport, tr( "General" ) ); 169 tabMain->insertTab( tabViewport, tr( "General" ) );
170 170
171 tabViewport = new QWidget ( tabMain ); 171 tabViewport = new QWidget ( tabMain );
172 172
173 vb = new QVBoxLayout( tabViewport ); 173 vb = new QVBoxLayout( tabViewport );
174 174
175 svAddress = new QScrollView( tabViewport ); 175 svAddress = new QScrollView( tabViewport );
176 vb->addWidget( svAddress, 0, 0 ); 176 vb->addWidget( svAddress, 0, 0 );
177 svAddress->setResizePolicy( QScrollView::AutoOneFit ); 177 svAddress->setResizePolicy( QScrollView::AutoOneFit );
178 svAddress->setFrameStyle( QFrame::NoFrame ); 178 svAddress->setFrameStyle( QFrame::NoFrame );
179 179
180 container = new QWidget( svAddress->viewport() ); 180 container = new QWidget( svAddress->viewport() );
181 svAddress->addChild( container ); 181 svAddress->addChild( container );
182 182
183 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem 183 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem
184 184
185 cmbAddress = new QComboBox( FALSE, container ); 185 cmbAddress = new QComboBox( FALSE, container );
186 cmbAddress->insertItem( tr( "Business" ) ); 186 cmbAddress->insertItem( tr( "Business" ) );
187 cmbAddress->insertItem( tr( "Home" ) ); 187 cmbAddress->insertItem( tr( "Home" ) );
188 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); 188 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 );
189 189
190 l = new QLabel( tr( "Address" ), container ); 190 l = new QLabel( tr( "Address" ), container );
191 gl->addWidget( l, 1, 0 ); 191 gl->addWidget( l, 1, 0 );
192 txtAddress = new QLineEdit( container ); 192 txtAddress = new QLineEdit( container );
193 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); 193 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 );
194 194
195 l = new QLabel( tr( "City" ), container ); 195 l = new QLabel( tr( "City" ), container );
196 gl->addWidget( l, 2, 0 ); 196 gl->addWidget( l, 2, 0 );
197 txtCity = new QLineEdit( container ); 197 txtCity = new QLineEdit( container );
198 gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); 198 gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 );
199 199
200 l = new QLabel( tr( "State" ), container ); 200 l = new QLabel( tr( "State" ), container );
201 gl->addWidget( l, 3, 0 ); 201 gl->addWidget( l, 3, 0 );
202 txtState = new QLineEdit( container ); 202 txtState = new QLineEdit( container );
203 gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); 203 gl->addMultiCellWidget( txtState, 3, 3, 1, 2 );
204 204
205 l = new QLabel( tr( "Zip Code" ), container ); 205 l = new QLabel( tr( "Zip Code" ), container );
206 gl->addWidget( l, 4, 0 ); 206 gl->addWidget( l, 4, 0 );
207 txtZip = new QLineEdit( container ); 207 txtZip = new QLineEdit( container );
208 gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); 208 gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 );
209 209
210 l = new QLabel( tr( "Country" ), container ); 210 l = new QLabel( tr( "Country" ), container );
211 gl->addWidget( l, 5, 0 ); 211 gl->addWidget( l, 5, 0 );
212 cmbCountry = new QComboBox( TRUE, container ); 212 cmbCountry = new QComboBox( TRUE, container );
213 cmbCountry->insertItem( tr( "" ) ); 213 cmbCountry->insertItem( tr( "" ) );
214 cmbCountry->insertItem( tr ( "United States" ) ); 214 cmbCountry->insertItem( tr ( "United States" ) );
215 cmbCountry->insertItem( tr ( "United Kingdom" ) ); 215 cmbCountry->insertItem( tr ( "United Kingdom" ) );
216 cmbCountry->insertItem( tr ( "Afganistan" ) ); 216 cmbCountry->insertItem( tr ( "Afganistan" ) );
217 cmbCountry->insertItem( tr ( "Albania" ) ); 217 cmbCountry->insertItem( tr ( "Albania" ) );
218 cmbCountry->insertItem( tr ( "Algeria" ) ); 218 cmbCountry->insertItem( tr ( "Algeria" ) );
219 cmbCountry->insertItem( tr ( "American Samoa" ) ); 219 cmbCountry->insertItem( tr ( "American Samoa" ) );
220 cmbCountry->insertItem( tr ( "Andorra" ) ); 220 cmbCountry->insertItem( tr ( "Andorra" ) );
221 cmbCountry->insertItem( tr ( "Angola" ) ); 221 cmbCountry->insertItem( tr ( "Angola" ) );
222 cmbCountry->insertItem( tr ( "Anguilla" ) ); 222 cmbCountry->insertItem( tr ( "Anguilla" ) );
223 cmbCountry->insertItem( tr ( "Antartica" ) ); 223 cmbCountry->insertItem( tr ( "Antartica" ) );
224 cmbCountry->insertItem( tr ( "Argentina" ) ); 224 cmbCountry->insertItem( tr ( "Argentina" ) );
225 cmbCountry->insertItem( tr ( "Armania" ) ); 225 cmbCountry->insertItem( tr ( "Armania" ) );
226 cmbCountry->insertItem( tr ( "Aruba" ) ); 226 cmbCountry->insertItem( tr ( "Aruba" ) );
227 cmbCountry->insertItem( tr ( "Australia" ) ); 227 cmbCountry->insertItem( tr ( "Australia" ) );
228 cmbCountry->insertItem( tr ( "Austria" ) ); 228 cmbCountry->insertItem( tr ( "Austria" ) );
229 cmbCountry->insertItem( tr ( "Azerbaijan" ) ); 229 cmbCountry->insertItem( tr ( "Azerbaijan" ) );
230 cmbCountry->insertItem( tr ( "Bahamas" ) ); 230 cmbCountry->insertItem( tr ( "Bahamas" ) );
231 cmbCountry->insertItem( tr ( "Bahrain" ) ); 231 cmbCountry->insertItem( tr ( "Bahrain" ) );
232 cmbCountry->insertItem( tr ( "Bangladesh" ) ); 232 cmbCountry->insertItem( tr ( "Bangladesh" ) );
233 cmbCountry->insertItem( tr ( "Barbados" ) ); 233 cmbCountry->insertItem( tr ( "Barbados" ) );
234 cmbCountry->insertItem( tr ( "Belarus" ) ); 234 cmbCountry->insertItem( tr ( "Belarus" ) );
235 cmbCountry->insertItem( tr ( "Belgium" ) ); 235 cmbCountry->insertItem( tr ( "Belgium" ) );
236 cmbCountry->insertItem( tr ( "Belize" ) ); 236 cmbCountry->insertItem( tr ( "Belize" ) );
237 cmbCountry->insertItem( tr ( "Benin" ) ); 237 cmbCountry->insertItem( tr ( "Benin" ) );
238 cmbCountry->insertItem( tr ( "Bermuda" ) ); 238 cmbCountry->insertItem( tr ( "Bermuda" ) );
239 cmbCountry->insertItem( tr ( "Bhutan" ) ); 239 cmbCountry->insertItem( tr ( "Bhutan" ) );
240 cmbCountry->insertItem( tr ( "Boliva" ) ); 240 cmbCountry->insertItem( tr ( "Boliva" ) );
241 cmbCountry->insertItem( tr ( "Botswana" ) ); 241 cmbCountry->insertItem( tr ( "Botswana" ) );
242 cmbCountry->insertItem( tr ( "Bouvet Island" ) ); 242 cmbCountry->insertItem( tr ( "Bouvet Island" ) );
243 cmbCountry->insertItem( tr ( "Brazil" ) ); 243 cmbCountry->insertItem( tr ( "Brazil" ) );
244 cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); 244 cmbCountry->insertItem( tr ( "Brunei Darussalam" ) );
245 cmbCountry->insertItem( tr ( "Bulgaria" ) ); 245 cmbCountry->insertItem( tr ( "Bulgaria" ) );
246 cmbCountry->insertItem( tr ( "Burkina Faso" ) ); 246 cmbCountry->insertItem( tr ( "Burkina Faso" ) );
247 cmbCountry->insertItem( tr ( "Burundi" ) ); 247 cmbCountry->insertItem( tr ( "Burundi" ) );
248 cmbCountry->insertItem( tr ( "Cambodia" ) ); 248 cmbCountry->insertItem( tr ( "Cambodia" ) );
249 cmbCountry->insertItem( tr ( "Camaroon" ) ); 249 cmbCountry->insertItem( tr ( "Camaroon" ) );
250 cmbCountry->insertItem( tr ( "Canada" ) ); 250 cmbCountry->insertItem( tr ( "Canada" ) );
251 cmbCountry->insertItem( tr ( "Cape Verde" ) ); 251 cmbCountry->insertItem( tr ( "Cape Verde" ) );
252 cmbCountry->insertItem( tr ( "Cayman Islands" ) ); 252 cmbCountry->insertItem( tr ( "Cayman Islands" ) );
253 cmbCountry->insertItem( tr ( "Chad" ) ); 253 cmbCountry->insertItem( tr ( "Chad" ) );
254 cmbCountry->insertItem( tr ( "Chile" ) ); 254 cmbCountry->insertItem( tr ( "Chile" ) );
255 cmbCountry->insertItem( tr ( "China" ) ); 255 cmbCountry->insertItem( tr ( "China" ) );
256 cmbCountry->insertItem( tr ( "Christmas Island" ) ); 256 cmbCountry->insertItem( tr ( "Christmas Island" ) );
257 cmbCountry->insertItem( tr ( "Colombia" ) ); 257 cmbCountry->insertItem( tr ( "Colombia" ) );
258 cmbCountry->insertItem( tr ( "Comoros" ) ); 258 cmbCountry->insertItem( tr ( "Comoros" ) );
259 cmbCountry->insertItem( tr ( "Congo" ) ); 259 cmbCountry->insertItem( tr ( "Congo" ) );
260 cmbCountry->insertItem( tr ( "Cook Island" ) ); 260 cmbCountry->insertItem( tr ( "Cook Island" ) );
261 cmbCountry->insertItem( tr ( "Costa Rica" ) ); 261 cmbCountry->insertItem( tr ( "Costa Rica" ) );
262 cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); 262 cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) );
263 cmbCountry->insertItem( tr ( "Croatia" ) ); 263 cmbCountry->insertItem( tr ( "Croatia" ) );
264 cmbCountry->insertItem( tr ( "Cuba" ) ); 264 cmbCountry->insertItem( tr ( "Cuba" ) );
265 cmbCountry->insertItem( tr ( "Cyprus" ) ); 265 cmbCountry->insertItem( tr ( "Cyprus" ) );
266 cmbCountry->insertItem( tr ( "Czech Republic" ) ); 266 cmbCountry->insertItem( tr ( "Czech Republic" ) );
@@ -442,421 +442,426 @@ void ContactEditor::init() {
442 tabMain->insertTab( tabViewport, tr( "Address" ) ); 442 tabMain->insertTab( tabViewport, tr( "Address" ) );
443 443
444 tabViewport = new QWidget ( tabMain ); 444 tabViewport = new QWidget ( tabMain );
445 445
446 vb = new QVBoxLayout( tabViewport ); 446 vb = new QVBoxLayout( tabViewport );
447 447
448 svDetails = new QScrollView( tabViewport ); 448 svDetails = new QScrollView( tabViewport );
449 vb->addWidget( svDetails, 0, 0 ); 449 vb->addWidget( svDetails, 0, 0 );
450 svDetails->setResizePolicy( QScrollView::AutoOneFit ); 450 svDetails->setResizePolicy( QScrollView::AutoOneFit );
451 svDetails->setFrameStyle( QFrame::NoFrame ); 451 svDetails->setFrameStyle( QFrame::NoFrame );
452 452
453 container = new QWidget( svDetails->viewport() ); 453 container = new QWidget( svDetails->viewport() );
454 svDetails->addChild( container ); 454 svDetails->addChild( container );
455 455
456 gl = new QGridLayout( container, 1, 2, 2, 4 ); 456 gl = new QGridLayout( container, 1, 2, 2, 4 );
457 457
458 int counter = 0; 458 int counter = 0;
459 459
460 // Birthday 460 // Birthday
461 QHBox* hBox = new QHBox( container ); 461 QHBox* hBox = new QHBox( container );
462 l = new QLabel( tr("Birthday"), container ); 462 l = new QLabel( tr("Birthday"), container );
463 gl->addWidget( l, counter, 0 ); 463 gl->addWidget( l, counter, 0 );
464 464
465 QPopupMenu* m1 = new QPopupMenu( container ); 465 QPopupMenu* m1 = new QPopupMenu( container );
466 birthdayPicker = new DateBookMonth( m1, 0, TRUE ); 466 birthdayPicker = new DateBookMonth( m1, 0, TRUE );
467 m1->insertItem( birthdayPicker ); 467 m1->insertItem( birthdayPicker );
468 468
469 birthdayButton= new QToolButton( hBox, "buttonStart" ); 469 birthdayButton= new QToolButton( hBox, "buttonStart" );
470 birthdayButton->setPopup( m1 ); 470 birthdayButton->setPopup( m1 );
471 birthdayButton->setPopupDelay(0); 471 birthdayButton->setPopupDelay(0);
472 472
473 QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), 473 QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
474 tr( "Delete" ), 474 tr( "Delete" ),
475 hBox, 0 ); 475 hBox, 0 );
476 476
477 gl->addWidget( hBox, counter , 1 ); 477 gl->addWidget( hBox, counter , 1 );
478 478
479 connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), 479 connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ),
480 this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); 480 this, SLOT( slotBirthdayDateChanged( int, int, int ) ) );
481 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); 481 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) );
482 482
483 ++counter; 483 ++counter;
484 484
485 // Anniversary 485 // Anniversary
486 hBox = new QHBox( container ); 486 hBox = new QHBox( container );
487 l = new QLabel( tr("Anniversary"), container ); 487 l = new QLabel( tr("Anniversary"), container );
488 gl->addWidget( l, counter, 0 ); 488 gl->addWidget( l, counter, 0 );
489 489
490 m1 = new QPopupMenu( container ); 490 m1 = new QPopupMenu( container );
491 anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); 491 anniversaryPicker = new DateBookMonth( m1, 0, TRUE );
492 m1->insertItem( anniversaryPicker ); 492 m1->insertItem( anniversaryPicker );
493 493
494 anniversaryButton= new QToolButton( hBox, "buttonStart" ); 494 anniversaryButton= new QToolButton( hBox, "buttonStart" );
495 anniversaryButton->setPopup( m1 ); 495 anniversaryButton->setPopup( m1 );
496 anniversaryButton->setPopupDelay(0); 496 anniversaryButton->setPopupDelay(0);
497 497
498 deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), 498 deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
499 tr( "Delete" ), 499 tr( "Delete" ),
500 hBox, 0 ); 500 hBox, 0 );
501 gl->addWidget( hBox, counter , 1 ); 501 gl->addWidget( hBox, counter , 1 );
502 502
503 connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), 503 connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ),
504 this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); 504 this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) );
505 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); 505 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) );
506 506
507 ++counter; 507 ++counter;
508 508
509 // Gender 509 // Gender
510 l = new QLabel( tr("Gender"), container ); 510 l = new QLabel( tr("Gender"), container );
511 gl->addWidget( l, counter, 0 ); 511 gl->addWidget( l, counter, 0 );
512 cmbGender = new QComboBox( container ); 512 cmbGender = new QComboBox( container );
513 cmbGender->insertItem( "", 0 ); 513 cmbGender->insertItem( "", 0 );
514 cmbGender->insertItem( tr("Male"), 1); 514 cmbGender->insertItem( tr("Male"), 1);
515 cmbGender->insertItem( tr("Female"), 2); 515 cmbGender->insertItem( tr("Female"), 2);
516 gl->addWidget( cmbGender, counter, 1 ); 516 gl->addWidget( cmbGender, counter, 1 );
517 517
518 ++counter; 518 ++counter;
519 519
520 // Create Labels and lineedit fields for every dynamic entry 520 // Create Labels and lineedit fields for every dynamic entry
521 QStringList::ConstIterator it = slDynamicEntries.begin(); 521 QStringList::ConstIterator it = slDynamicEntries.begin();
522 QStringList::ConstIterator trit = trlDynamicEntries.begin(); 522 QStringList::ConstIterator trit = trlDynamicEntries.begin();
523 for (i = counter; it != slDynamicEntries.end(); i++, ++it, ++trit) { 523 for (i = counter; it != slDynamicEntries.end(); i++, ++it, ++trit) {
524 524
525 if (((*it) == "Anniversary") || 525 if (((*it) == "Anniversary") ||
526 ((*it) == "Birthday")|| ((*it) == "Gender")) continue; 526 ((*it) == "Birthday")|| ((*it) == "Gender")) continue;
527 527
528 l = new QLabel( (*it).utf8() , container ); 528 l = new QLabel( (*it).utf8() , container );
529 listName.append( l ); 529 listName.append( l );
530 gl->addWidget( l, i, 0 ); 530 gl->addWidget( l, i, 0 );
531 QLineEdit *e = new QLineEdit( container ); 531 QLineEdit *e = new QLineEdit( container );
532 listValue.append( e ); 532 listValue.append( e );
533 gl->addWidget( e, i, 1); 533 gl->addWidget( e, i, 1);
534 } 534 }
535 // Fill labels with names.. 535 // Fill labels with names..
536 //loadFields(); 536 //loadFields();
537 537
538 538
539 tabMain->insertTab( tabViewport, tr( "Details" ) ); 539 tabMain->insertTab( tabViewport, tr( "Details" ) );
540 540
541 dlgNote = new QDialog( this, "Note Dialog", TRUE ); 541 dlgNote = new QDialog( this, "Note Dialog", TRUE );
542 dlgNote->setCaption( tr("Enter Note") ); 542 dlgNote->setCaption( tr("Enter Note") );
543 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); 543 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote );
544 txtNote = new QMultiLineEdit( dlgNote ); 544 txtNote = new QMultiLineEdit( dlgNote );
545 vbNote->addWidget( txtNote ); 545 vbNote->addWidget( txtNote );
546 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); 546 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) );
547 547
548 dlgName = new QDialog( this, "Name Dialog", TRUE ); 548 dlgName = new QDialog( this, "Name Dialog", TRUE );
549 dlgName->setCaption( tr("Edit Name") ); 549 dlgName->setCaption( tr("Edit Name") );
550 gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); 550 gl = new QGridLayout( dlgName, 5, 2, 2, 3 );
551 551
552 l = new QLabel( tr("First Name"), dlgName ); 552 l = new QLabel( tr("First Name"), dlgName );
553 gl->addWidget( l, 0, 0 ); 553 gl->addWidget( l, 0, 0 );
554 txtFirstName = new QLineEdit( dlgName ); 554 txtFirstName = new QLineEdit( dlgName );
555 gl->addWidget( txtFirstName, 0, 1 ); 555 gl->addWidget( txtFirstName, 0, 1 );
556 556
557 l = new QLabel( tr("Middle Name"), dlgName ); 557 l = new QLabel( tr("Middle Name"), dlgName );
558 gl->addWidget( l, 1, 0 ); 558 gl->addWidget( l, 1, 0 );
559 txtMiddleName = new QLineEdit( dlgName ); 559 txtMiddleName = new QLineEdit( dlgName );
560 gl->addWidget( txtMiddleName, 1, 1 ); 560 gl->addWidget( txtMiddleName, 1, 1 );
561 561
562 l = new QLabel( tr("Last Name"), dlgName ); 562 l = new QLabel( tr("Last Name"), dlgName );
563 gl->addWidget( l, 2, 0 ); 563 gl->addWidget( l, 2, 0 );
564 txtLastName = new QLineEdit( dlgName ); 564 txtLastName = new QLineEdit( dlgName );
565 gl->addWidget( txtLastName, 2, 1 ); 565 gl->addWidget( txtLastName, 2, 1 );
566 566
567 l = new QLabel( tr("Suffix"), dlgName ); 567 l = new QLabel( tr("Suffix"), dlgName );
568 gl->addWidget( l, 3, 0 ); 568 gl->addWidget( l, 3, 0 );
569 txtSuffix = new QLineEdit( dlgName ); 569 txtSuffix = new QLineEdit( dlgName );
570 gl->addWidget( txtSuffix, 3, 1 ); 570 gl->addWidget( txtSuffix, 3, 1 );
571 space = new QSpacerItem(1,1, 571 space = new QSpacerItem(1,1,
572 QSizePolicy::Maximum, 572 QSizePolicy::Maximum,
573 QSizePolicy::MinimumExpanding ); 573 QSizePolicy::MinimumExpanding );
574 gl->addItem( space, 4, 0 ); 574 gl->addItem( space, 4, 0 );
575 575
576 cmbChooserField1->insertStringList( trlChooserNames ); 576 cmbChooserField1->insertStringList( trlChooserNames );
577 cmbChooserField2->insertStringList( trlChooserNames ); 577 cmbChooserField2->insertStringList( trlChooserNames );
578 cmbChooserField3->insertStringList( trlChooserNames ); 578 cmbChooserField3->insertStringList( trlChooserNames );
579 cmbChooserField4->insertStringList( trlChooserNames ); 579 cmbChooserField4->insertStringList( trlChooserNames );
580 580
581 cmbChooserField1->setCurrentItem( 0 ); 581 cmbChooserField1->setCurrentItem( 0 );
582 cmbChooserField2->setCurrentItem( 1 ); 582 cmbChooserField2->setCurrentItem( 1 );
583 cmbChooserField3->setCurrentItem( 2 ); 583 cmbChooserField3->setCurrentItem( 2 );
584 584
585 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 585 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
586 586
587 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); 587 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) );
588 588
589 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), 589 connect( txtChooserField1, SIGNAL(textChanged(const QString &)),
590 this, SLOT(slotChooser1Change(const QString &)) ); 590 this, SLOT(slotChooser1Change(const QString &)) );
591 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), 591 connect( txtChooserField2, SIGNAL(textChanged(const QString &)),
592 this, SLOT(slotChooser2Change(const QString &)) ); 592 this, SLOT(slotChooser2Change(const QString &)) );
593 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), 593 connect( txtChooserField3, SIGNAL(textChanged(const QString &)),
594 this, SLOT(slotChooser3Change(const QString &)) ); 594 this, SLOT(slotChooser3Change(const QString &)) );
595 connect( txtChooserField4, SIGNAL(textChanged(const QString &)), 595 connect( txtChooserField4, SIGNAL(textChanged(const QString &)),
596 this, SLOT(slotChooser4Change(const QString &)) ); 596 this, SLOT(slotChooser4Change(const QString &)) );
597 connect( txtAddress, SIGNAL(textChanged(const QString &)), 597 connect( txtAddress, SIGNAL(textChanged(const QString &)),
598 this, SLOT(slotAddressChange(const QString &)) ); 598 this, SLOT(slotAddressChange(const QString &)) );
599 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); 599 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) );
600 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); 600 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) );
601 connect( txtCity, SIGNAL(textChanged(const QString &)), 601 connect( txtCity, SIGNAL(textChanged(const QString &)),
602 this, SLOT(slotCityChange(const QString &)) ); 602 this, SLOT(slotCityChange(const QString &)) );
603 connect( txtState, SIGNAL(textChanged(const QString &)), 603 connect( txtState, SIGNAL(textChanged(const QString &)),
604 this, SLOT(slotStateChange(const QString &)) ); 604 this, SLOT(slotStateChange(const QString &)) );
605 connect( txtZip, SIGNAL(textChanged(const QString &)), 605 connect( txtZip, SIGNAL(textChanged(const QString &)),
606 this, SLOT(slotZipChange(const QString &)) ); 606 this, SLOT(slotZipChange(const QString &)) );
607 connect( cmbCountry, SIGNAL(textChanged(const QString &)), 607 connect( cmbCountry, SIGNAL(textChanged(const QString &)),
608 this, SLOT(slotCountryChange(const QString &)) ); 608 this, SLOT(slotCountryChange(const QString &)) );
609 connect( cmbCountry, SIGNAL(activated(const QString &)), 609 connect( cmbCountry, SIGNAL(activated(const QString &)),
610 this, SLOT(slotCountryChange(const QString &)) ); 610 this, SLOT(slotCountryChange(const QString &)) );
611 connect( cmbChooserField1, SIGNAL(activated(int)), 611 connect( cmbChooserField1, SIGNAL(activated(int)),
612 this, SLOT(slotCmbChooser1Change(int)) ); 612 this, SLOT(slotCmbChooser1Change(int)) );
613 connect( cmbChooserField2, SIGNAL(activated(int)), 613 connect( cmbChooserField2, SIGNAL(activated(int)),
614 this, SLOT(slotCmbChooser2Change(int)) ); 614 this, SLOT(slotCmbChooser2Change(int)) );
615 connect( cmbChooserField3, SIGNAL(activated(int)), 615 connect( cmbChooserField3, SIGNAL(activated(int)),
616 this, SLOT(slotCmbChooser3Change(int)) ); 616 this, SLOT(slotCmbChooser3Change(int)) );
617 connect( cmbChooserField4, SIGNAL(activated(int)), 617 connect( cmbChooserField4, SIGNAL(activated(int)),
618 this, SLOT(slotCmbChooser4Change(int)) ); 618 this, SLOT(slotCmbChooser4Change(int)) );
619 connect( cmbAddress, SIGNAL(activated(int)), 619 connect( cmbAddress, SIGNAL(activated(int)),
620 this, SLOT(slotAddressTypeChange(int)) ); 620 this, SLOT(slotAddressTypeChange(int)) );
621 621
622 new QPEDialogListener(this); 622 new QPEDialogListener(this);
623 623
624 setPersonalView ( m_personalView ); 624 setPersonalView ( m_personalView );
625} 625}
626 626
627void ContactEditor::defaultEmailChanged(int i){ 627void ContactEditor::defaultEmailChanged(int i){
628 qDebug("defaultEmailChanged"); 628 qDebug("defaultEmailChanged");
629 int index = cmbChooserField1->currentItem(); 629 int index = cmbChooserField1->currentItem();
630 slChooserValues[index] = cmbDefaultEmail->text(i); 630 slChooserValues[index] = cmbDefaultEmail->text(i);
631 631
632} 632}
633 633
634void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid ) { 634void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid, int widgetPos ) {
635 635
636 qDebug("defaultEmailChooserPosition %i, widgetPos %i ",defaultEmailChooserPosition,widgetPos);
636 if (slChooserNames[index] == "Default Email"){ 637 if (slChooserNames[index] == "Default Email"){
637 if (cmbDefaultEmail) delete cmbDefaultEmail; 638 if (cmbDefaultEmail) delete cmbDefaultEmail;
638 cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); 639 cmbDefaultEmail = new QComboBox(inputWid->parentWidget());
639 cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); 640 cmbDefaultEmail->setGeometry(inputWid->frameGeometry());
640 cmbDefaultEmail->insertStringList(ent.emailList()); 641 cmbDefaultEmail->insertStringList(ent.emailList());
641 connect(cmbDefaultEmail,SIGNAL(activated(int)), 642 connect(cmbDefaultEmail,SIGNAL(activated(int)),
642 SLOT(defaultEmailChanged(int))); 643 SLOT(defaultEmailChanged(int)));
643 QString demail = ent.defaultEmail(); 644 QString demail = ent.defaultEmail();
644 for ( int i = 0; i < cmbDefaultEmail->count(); i++) 645 for ( int i = 0; i < cmbDefaultEmail->count(); i++)
645 if ( cmbDefaultEmail->text( i ) == demail ) 646 if ( cmbDefaultEmail->text( i ) == demail )
646 cmbDefaultEmail->setCurrentItem( i ); 647 cmbDefaultEmail->setCurrentItem( i );
647 648
648 cmbDefaultEmail->show(); 649 cmbDefaultEmail->show();
649 } 650 defaultEmailChooserPosition = widgetPos;
651 }else if (defaultEmailChooserPosition == widgetPos){
652 qDebug("cmbDefaultEmail->hide()");
653 if (cmbDefaultEmail) cmbDefaultEmail->hide();
654 }
650 655
651 656
652 slChooserValues[index] = textChanged; 657 slChooserValues[index] = textChanged;
653 658
654} 659}
655 660
656void ContactEditor::slotChooser1Change( const QString &textChanged ) { 661void ContactEditor::slotChooser1Change( const QString &textChanged ) {
657 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1); 662 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1);
658} 663}
659 664
660void ContactEditor::slotChooser2Change( const QString &textChanged ) { 665void ContactEditor::slotChooser2Change( const QString &textChanged ) {
661 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2); 666 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2);
662 667
663} 668}
664 669
665void ContactEditor::slotChooser3Change( const QString &textChanged ) { 670void ContactEditor::slotChooser3Change( const QString &textChanged ) {
666 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3); 671 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3);
667} 672}
668 673
669void ContactEditor::slotChooser4Change( const QString &textChanged ) { 674void ContactEditor::slotChooser4Change( const QString &textChanged ) {
670 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4); 675 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4);
671} 676}
672 677
673void ContactEditor::slotAddressChange( const QString &textChanged ) { 678void ContactEditor::slotAddressChange( const QString &textChanged ) {
674 679
675 if ( cmbAddress->currentItem() == 0 ) { 680 if ( cmbAddress->currentItem() == 0 ) {
676 slBusinessAddress[0] = textChanged; 681 slBusinessAddress[0] = textChanged;
677 } else { 682 } else {
678 slHomeAddress[0] = textChanged; 683 slHomeAddress[0] = textChanged;
679 } 684 }
680} 685}
681 686
682void ContactEditor::slotAddress2Change( const QString &textChanged ) { 687void ContactEditor::slotAddress2Change( const QString &textChanged ) {
683 688
684 if ( cmbAddress->currentItem() == 0 ) { 689 if ( cmbAddress->currentItem() == 0 ) {
685 slBusinessAddress[1] = textChanged; 690 slBusinessAddress[1] = textChanged;
686 } else { 691 } else {
687 slHomeAddress[1] = textChanged; 692 slHomeAddress[1] = textChanged;
688 } 693 }
689} 694}
690 695
691void ContactEditor::slotPOBoxChange( const QString &textChanged ) { 696void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
692 697
693 if ( cmbAddress->currentItem() == 0 ) { 698 if ( cmbAddress->currentItem() == 0 ) {
694 slBusinessAddress[2] = textChanged; 699 slBusinessAddress[2] = textChanged;
695 } else { 700 } else {
696 slHomeAddress[2] = textChanged; 701 slHomeAddress[2] = textChanged;
697 } 702 }
698} 703}
699 704
700void ContactEditor::slotCityChange( const QString &textChanged ) { 705void ContactEditor::slotCityChange( const QString &textChanged ) {
701 706
702 if ( cmbAddress->currentItem() == 0 ) { 707 if ( cmbAddress->currentItem() == 0 ) {
703 slBusinessAddress[3] = textChanged; 708 slBusinessAddress[3] = textChanged;
704 } else { 709 } else {
705 slHomeAddress[3] = textChanged; 710 slHomeAddress[3] = textChanged;
706 } 711 }
707} 712}
708 713
709void ContactEditor::slotStateChange( const QString &textChanged ) { 714void ContactEditor::slotStateChange( const QString &textChanged ) {
710 715
711 716
712 if ( cmbAddress->currentItem() == 0 ) { 717 if ( cmbAddress->currentItem() == 0 ) {
713 slBusinessAddress[4] = textChanged; 718 slBusinessAddress[4] = textChanged;
714 } else { 719 } else {
715 slHomeAddress[4] = textChanged; 720 slHomeAddress[4] = textChanged;
716 } 721 }
717} 722}
718 723
719void ContactEditor::slotZipChange( const QString &textChanged ) { 724void ContactEditor::slotZipChange( const QString &textChanged ) {
720 725
721 if ( cmbAddress->currentItem() == 0 ) { 726 if ( cmbAddress->currentItem() == 0 ) {
722 slBusinessAddress[5] = textChanged; 727 slBusinessAddress[5] = textChanged;
723 } else { 728 } else {
724 slHomeAddress[5] = textChanged; 729 slHomeAddress[5] = textChanged;
725 } 730 }
726} 731}
727 732
728void ContactEditor::slotCountryChange( const QString &textChanged ) { 733void ContactEditor::slotCountryChange( const QString &textChanged ) {
729 734
730 if ( cmbAddress->currentItem() == 0 ) { 735 if ( cmbAddress->currentItem() == 0 ) {
731 slBusinessAddress[6] = textChanged; 736 slBusinessAddress[6] = textChanged;
732 } else { 737 } else {
733 slHomeAddress[6] = textChanged; 738 slHomeAddress[6] = textChanged;
734 } 739 }
735} 740}
736 741
737void ContactEditor::slotCmbChooser1Change( int index ) { 742void ContactEditor::slotCmbChooser1Change( int index ) {
738 743
739 txtChooserField1->setText( slChooserValues[index] ); 744 txtChooserField1->setText( slChooserValues[index] );
740 txtChooserField1->setFocus(); 745 txtChooserField1->setFocus();
741} 746}
742 747
743void ContactEditor::slotCmbChooser2Change( int index ) { 748void ContactEditor::slotCmbChooser2Change( int index ) {
744 749
745 txtChooserField2->setText( slChooserValues[index] ); 750 txtChooserField2->setText( slChooserValues[index] );
746 txtChooserField2->setFocus(); 751 txtChooserField2->setFocus();
747} 752}
748 753
749void ContactEditor::slotCmbChooser3Change( int index ) { 754void ContactEditor::slotCmbChooser3Change( int index ) {
750 755
751 txtChooserField3->setText( slChooserValues[index] ); 756 txtChooserField3->setText( slChooserValues[index] );
752 txtChooserField3->setFocus(); 757 txtChooserField3->setFocus();
753 758
754} 759}
755 760
756void ContactEditor::slotCmbChooser4Change( int index ) { 761void ContactEditor::slotCmbChooser4Change( int index ) {
757 762
758 txtChooserField4->setText( slChooserValues[index] ); 763 txtChooserField4->setText( slChooserValues[index] );
759 txtChooserField4->setFocus(); 764 txtChooserField4->setFocus();
760 765
761} 766}
762 767
763void ContactEditor::slotAddressTypeChange( int index ) { 768void ContactEditor::slotAddressTypeChange( int index ) {
764 769
765 if ( index == 0 ) { 770 if ( index == 0 ) {
766 771
767 txtAddress->setText( slBusinessAddress[0] ); 772 txtAddress->setText( slBusinessAddress[0] );
768 //txtAddress2->setText( (*slBusinessAddress)[1] ); 773 //txtAddress2->setText( (*slBusinessAddress)[1] );
769 //txtPOBox->setText( (*slBusinessAddress)[2] ); 774 //txtPOBox->setText( (*slBusinessAddress)[2] );
770 txtCity->setText( slBusinessAddress[3] ); 775 txtCity->setText( slBusinessAddress[3] );
771 txtState->setText( slBusinessAddress[4] ); 776 txtState->setText( slBusinessAddress[4] );
772 txtZip->setText( slBusinessAddress[5] ); 777 txtZip->setText( slBusinessAddress[5] );
773 QLineEdit *txtTmp = cmbCountry->lineEdit(); 778 QLineEdit *txtTmp = cmbCountry->lineEdit();
774 txtTmp->setText( slBusinessAddress[6] ); 779 txtTmp->setText( slBusinessAddress[6] );
775 780
776 } else { 781 } else {
777 782
778 txtAddress->setText( slHomeAddress[0] ); 783 txtAddress->setText( slHomeAddress[0] );
779 //txtAddress2->setText( (*slHomeAddress)[1] ); 784 //txtAddress2->setText( (*slHomeAddress)[1] );
780 //txtPOBox->setText( (*slHomeAddress)[2] ); 785 //txtPOBox->setText( (*slHomeAddress)[2] );
781 txtCity->setText( slHomeAddress[3] ); 786 txtCity->setText( slHomeAddress[3] );
782 txtState->setText( slHomeAddress[4] ); 787 txtState->setText( slHomeAddress[4] );
783 txtZip->setText( slHomeAddress[5] ); 788 txtZip->setText( slHomeAddress[5] );
784 QLineEdit *txtTmp = cmbCountry->lineEdit(); 789 QLineEdit *txtTmp = cmbCountry->lineEdit();
785 txtTmp->setText( slHomeAddress[6] ); 790 txtTmp->setText( slHomeAddress[6] );
786 791
787 } 792 }
788 793
789} 794}
790 795
791void ContactEditor::slotFullNameChange( const QString &textChanged ) { 796void ContactEditor::slotFullNameChange( const QString &textChanged ) {
792 797
793 int index = cmbFileAs->currentItem(); 798 int index = cmbFileAs->currentItem();
794 799
795 cmbFileAs->clear(); 800 cmbFileAs->clear();
796 801
797 cmbFileAs->insertItem( parseName( textChanged, 0 ) ); 802 cmbFileAs->insertItem( parseName( textChanged, 0 ) );
798 cmbFileAs->insertItem( parseName( textChanged, 1 ) ); 803 cmbFileAs->insertItem( parseName( textChanged, 1 ) );
799 cmbFileAs->insertItem( parseName( textChanged, 2 ) ); 804 cmbFileAs->insertItem( parseName( textChanged, 2 ) );
800 cmbFileAs->insertItem( parseName( textChanged, 3 ) ); 805 cmbFileAs->insertItem( parseName( textChanged, 3 ) );
801 806
802 cmbFileAs->setCurrentItem( index ); 807 cmbFileAs->setCurrentItem( index );
803 808
804 useFullName = true; 809 useFullName = true;
805 810
806} 811}
807 812
808void ContactEditor::accept() { 813void ContactEditor::accept() {
809 814
810 if ( isEmpty() ) { 815 if ( isEmpty() ) {
811 cleanupFields(); 816 cleanupFields();
812 reject(); 817 reject();
813 } else { 818 } else {
814 saveEntry(); 819 saveEntry();
815 cleanupFields(); 820 cleanupFields();
816 QDialog::accept(); 821 QDialog::accept();
817 } 822 }
818 823
819} 824}
820 825
821void ContactEditor::slotNote() { 826void ContactEditor::slotNote() {
822 827
823 dlgNote->showMaximized(); 828 dlgNote->showMaximized();
824 if ( !dlgNote->exec() ) { 829 if ( !dlgNote->exec() ) {
825 txtNote->setText( ent.notes() ); 830 txtNote->setText( ent.notes() );
826 } 831 }
827} 832}
828 833
829void ContactEditor::slotName() { 834void ContactEditor::slotName() {
830 835
831 QString tmpName; 836 QString tmpName;
832 if (useFullName) { 837 if (useFullName) {
833 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); 838 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) );
834 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); 839 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) );
835 txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); 840 txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
836 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); 841 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
837 } 842 }
838 dlgName->showMaximized(); 843 dlgName->showMaximized();
839 if ( dlgName->exec() ) { 844 if ( dlgName->exec() ) {
840 845
841 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); 846 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text();
842 txtFullName->setText( tmpName.simplifyWhiteSpace() ); 847 txtFullName->setText( tmpName.simplifyWhiteSpace() );
843 slotFullNameChange( txtFullName->text() ); 848 slotFullNameChange( txtFullName->text() );
844 useFullName = false; 849 useFullName = false;
845 } 850 }
846 851
847} 852}
848 853
849void ContactEditor::setNameFocus() { 854void ContactEditor::setNameFocus() {
850 855
851 txtFullName->setFocus(); 856 txtFullName->setFocus();
852 857
853} 858}
854 859
855bool ContactEditor::isEmpty() { 860bool ContactEditor::isEmpty() {
856 // Test and see if the record should be saved. 861 // Test and see if the record should be saved.
857 // More strict than the original qtopia, needs name or fileas to save 862 // More strict than the original qtopia, needs name or fileas to save
858 863
859 QString t = txtFullName->text(); 864 QString t = txtFullName->text();
860 if ( !t.isEmpty() && containsAlphaNum( t ) ) 865 if ( !t.isEmpty() && containsAlphaNum( t ) )
861 return false; 866 return false;
862 867
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h
index d4b7f27..63257f8 100644
--- a/core/pim/addressbook/contacteditor.h
+++ b/core/pim/addressbook/contacteditor.h
@@ -1,174 +1,175 @@
1/* 1/*
2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> 2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org>
3 * 3 *
4 * This file is an add-on for the OPIE Palmtop Environment 4 * This file is an add-on for the OPIE Palmtop Environment
5 * 5 *
6 * This file may be distributed and/or modified under the terms of the 6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software 7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging 8 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging
9 * of this file. 9 * of this file.
10 * 10 *
11 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 * 13 *
14 * 14 *
15 * This is a rewrite of the abeditor.h file, modified to provide a more 15 * This is a rewrite of the abeditor.h file, modified to provide a more
16 * intuitive interface to TrollTech's original Address Book editor. This 16 * intuitive interface to TrollTech's original Address Book editor. This
17 * is made to operate exactly in interface with the exception of name. 17 * is made to operate exactly in interface with the exception of name.
18 * 18 *
19 */ 19 */
20 20
21#ifndef CONTACTEDITOR_H 21#ifndef CONTACTEDITOR_H
22#define CONTACTEDITOR_H 22#define CONTACTEDITOR_H
23 23
24#include <opie/ocontact.h> 24#include <opie/ocontact.h>
25 25
26#include <qpe/datebookmonth.h> 26#include <qpe/datebookmonth.h>
27 27
28#include <qdialog.h> 28#include <qdialog.h>
29#include <qlist.h> 29#include <qlist.h>
30#include <qmap.h> 30#include <qmap.h>
31#include <qstringlist.h> 31#include <qstringlist.h>
32 32
33const int NAME_LF = 0; 33const int NAME_LF = 0;
34const int NAME_LFM = 1; 34const int NAME_LFM = 1;
35const int NAME_FL = 2; 35const int NAME_FL = 2;
36const int NAME_FMLS = 3; 36const int NAME_FMLS = 3;
37 37
38const int NAME_F = 4; 38const int NAME_F = 4;
39const int NAME_M = 5; 39const int NAME_M = 5;
40const int NAME_L = 6; 40const int NAME_L = 6;
41const int NAME_S = 7; 41const int NAME_S = 7;
42 42
43 43
44class QScrollView; 44class QScrollView;
45class QTabWidget; 45class QTabWidget;
46class QMultiLineEdit; 46class QMultiLineEdit;
47class QLineEdit; 47class QLineEdit;
48class QComboBox; 48class QComboBox;
49class QPushButton; 49class QPushButton;
50class CategorySelect; 50class CategorySelect;
51class QLabel; 51class QLabel;
52 52
53class ContactEditor : public QDialog { 53class ContactEditor : public QDialog {
54 Q_OBJECT 54 Q_OBJECT
55 55
56 public: 56 public:
57 ContactEditor(const OContact &entry, 57 ContactEditor(const OContact &entry,
58 QWidget *parent = 0, 58 QWidget *parent = 0,
59 const char *name = 0, 59 const char *name = 0,
60 WFlags fl = 0 ); 60 WFlags fl = 0 );
61 ~ContactEditor(); 61 ~ContactEditor();
62 void setNameFocus(); 62 void setNameFocus();
63 void setPersonalView( bool personal = true ); 63 void setPersonalView( bool personal = true );
64 OContact entry() const { return ent; } 64 OContact entry() const { return ent; }
65 65
66 public slots: 66 public slots:
67 void slotNote(); 67 void slotNote();
68 void slotName(); 68 void slotName();
69 void setEntry(const OContact &entry); 69 void setEntry(const OContact &entry);
70 70
71 protected slots: 71 protected slots:
72 void accept(); 72 void accept();
73 73
74 private: 74 private:
75 void init(); 75 void init();
76 void saveEntry(); 76 void saveEntry();
77 bool isEmpty(); 77 bool isEmpty();
78 void cleanupFields(); 78 void cleanupFields();
79 void updateDatePicker(); 79 void updateDatePicker();
80 QString parseName( QString fullName, int type ); 80 QString parseName( QString fullName, int type );
81 private slots: 81 private slots:
82 void slotChooser1Change( const QString &textChanged ); 82 void slotChooser1Change( const QString &textChanged );
83 void slotChooser2Change( const QString &textChanged ); 83 void slotChooser2Change( const QString &textChanged );
84 void slotChooser3Change( const QString &textChanged ); 84 void slotChooser3Change( const QString &textChanged );
85 void slotChooser4Change( const QString &textChanged ); 85 void slotChooser4Change( const QString &textChanged );
86 void slotCmbChooser1Change( int index ); 86 void slotCmbChooser1Change( int index );
87 void slotCmbChooser2Change( int index ); 87 void slotCmbChooser2Change( int index );
88 void slotCmbChooser3Change( int index ); 88 void slotCmbChooser3Change( int index );
89 void slotCmbChooser4Change( int index ); 89 void slotCmbChooser4Change( int index );
90 void slotAddressTypeChange( int index ); 90 void slotAddressTypeChange( int index );
91 void slotAddressChange( const QString &textChanged ); 91 void slotAddressChange( const QString &textChanged );
92 void slotAddress2Change( const QString &textChanged ); 92 void slotAddress2Change( const QString &textChanged );
93 void slotPOBoxChange( const QString &textChanged ); 93 void slotPOBoxChange( const QString &textChanged );
94 void slotCityChange( const QString &textChanged ); 94 void slotCityChange( const QString &textChanged );
95 void slotStateChange( const QString &textChanged ); 95 void slotStateChange( const QString &textChanged );
96 void slotZipChange( const QString &textChanged ); 96 void slotZipChange( const QString &textChanged );
97 void slotCountryChange( const QString &textChanged ); 97 void slotCountryChange( const QString &textChanged );
98 void slotFullNameChange( const QString &textChanged ); 98 void slotFullNameChange( const QString &textChanged );
99 void slotAnniversaryDateChanged( int year, int month, int day); 99 void slotAnniversaryDateChanged( int year, int month, int day);
100 void slotBirthdayDateChanged( int year, int month, int day); 100 void slotBirthdayDateChanged( int year, int month, int day);
101 void slotRemoveBirthday(); 101 void slotRemoveBirthday();
102 void slotRemoveAnniversary(); 102 void slotRemoveAnniversary();
103 void defaultEmailChanged(int); 103 void defaultEmailChanged(int);
104 104
105 private: 105 private:
106 void chooserChange( const QString&, int , QLineEdit* ); 106 int defaultEmailChooserPosition;
107 void chooserChange( const QString&, int , QLineEdit*, int );
107 bool useFullName; 108 bool useFullName;
108 109
109 OContact ent; 110 OContact ent;
110 111
111 QDialog *dlgNote; 112 QDialog *dlgNote;
112 QDialog *dlgName; 113 QDialog *dlgName;
113 114
114 QList<QLineEdit> listValue; 115 QList<QLineEdit> listValue;
115 QList<QLabel> listName; 116 QList<QLabel> listName;
116 117
117 QStringList slDynamicEntries; 118 QStringList slDynamicEntries;
118 QStringList trlDynamicEntries; 119 QStringList trlDynamicEntries;
119 120
120 bool m_personalView; 121 bool m_personalView;
121 122
122 QStringList slHomeAddress; 123 QStringList slHomeAddress;
123 QStringList slBusinessAddress; 124 QStringList slBusinessAddress;
124 QStringList slChooserNames; 125 QStringList slChooserNames;
125 QStringList slChooserValues; 126 QStringList slChooserValues;
126 127
127 QMultiLineEdit *txtNote; 128 QMultiLineEdit *txtNote;
128 QLabel *lblNote; 129 QLabel *lblNote;
129 130
130 //QLineEdit *txtTitle; 131 //QLineEdit *txtTitle;
131 QLineEdit *txtFirstName; 132 QLineEdit *txtFirstName;
132 QLineEdit *txtMiddleName; 133 QLineEdit *txtMiddleName;
133 QLineEdit *txtLastName; 134 QLineEdit *txtLastName;
134 QLineEdit *txtSuffix; 135 QLineEdit *txtSuffix;
135 136
136 QTabWidget *tabMain; 137 QTabWidget *tabMain;
137 QScrollView *svGeneral; 138 QScrollView *svGeneral;
138 QPushButton *btnFullName; 139 QPushButton *btnFullName;
139 QPushButton *btnNote; 140 QPushButton *btnNote;
140 QLineEdit *txtFullName; 141 QLineEdit *txtFullName;
141 QLineEdit *txtJobTitle; 142 QLineEdit *txtJobTitle;
142 QLineEdit *txtOrganization; 143 QLineEdit *txtOrganization;
143 QLineEdit *txtChooserField1; 144 QLineEdit *txtChooserField1;
144 QLineEdit *txtChooserField2; 145 QLineEdit *txtChooserField2;
145 QLineEdit *txtChooserField3; 146 QLineEdit *txtChooserField3;
146 QLineEdit *txtChooserField4; 147 QLineEdit *txtChooserField4;
147 QComboBox *cmbChooserField1; 148 QComboBox *cmbChooserField1;
148 QComboBox *cmbChooserField2; 149 QComboBox *cmbChooserField2;
149 QComboBox *cmbChooserField3; 150 QComboBox *cmbChooserField3;
150 QComboBox *cmbChooserField4; 151 QComboBox *cmbChooserField4;
151 QComboBox *cmbDefaultEmail; 152 QComboBox *cmbDefaultEmail;
152 QComboBox *cmbFileAs; 153 QComboBox *cmbFileAs;
153 CategorySelect *cmbCat; 154 CategorySelect *cmbCat;
154 QLabel *labCat; 155 QLabel *labCat;
155 156
156 QScrollView *svAddress; 157 QScrollView *svAddress;
157 QLineEdit *txtAddress; 158 QLineEdit *txtAddress;
158 //QLineEdit *txtAddress2; 159 //QLineEdit *txtAddress2;
159 //QLineEdit *txtPOBox; 160 //QLineEdit *txtPOBox;
160 QLineEdit *txtCity; 161 QLineEdit *txtCity;
161 QLineEdit *txtState; 162 QLineEdit *txtState;
162 QLineEdit *txtZip; 163 QLineEdit *txtZip;
163 QComboBox *cmbAddress; 164 QComboBox *cmbAddress;
164 QComboBox *cmbCountry; 165 QComboBox *cmbCountry;
165 166
166 QScrollView *svDetails; 167 QScrollView *svDetails;
167 QComboBox *cmbGender; 168 QComboBox *cmbGender;
168 DateBookMonth* birthdayPicker; 169 DateBookMonth* birthdayPicker;
169 QToolButton* birthdayButton; 170 QToolButton* birthdayButton;
170 DateBookMonth* anniversaryPicker; 171 DateBookMonth* anniversaryPicker;
171 QToolButton* anniversaryButton; 172 QToolButton* anniversaryButton;
172 }; 173 };
173 174
174#endif 175#endif