Diffstat (limited to 'core/pim/addressbook/contacteditor.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index b078968..dec4c7c 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -22,25 +22,24 @@ | |||
22 | #include "contacteditor.h" | 22 | #include "contacteditor.h" |
23 | #include "namelineedit.h" | 23 | #include "namelineedit.h" |
24 | 24 | ||
25 | #include <opie2/odebug.h> | 25 | #include <opie2/odebug.h> |
26 | #include <opie2/opimcontact.h> | 26 | #include <opie2/opimcontact.h> |
27 | 27 | ||
28 | #include <qpe/categoryselect.h> | 28 | #include <qpe/categoryselect.h> |
29 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
30 | #include <qpe/qpedialog.h> | 30 | #include <qpe/qpedialog.h> |
31 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
32 | 32 | ||
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qtabwidget.h> | ||
35 | #include <qlayout.h> | 34 | #include <qlayout.h> |
36 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
37 | #include <qmultilineedit.h> | 36 | #include <qmultilineedit.h> |
38 | #include <qtoolbutton.h> | 37 | #include <qtoolbutton.h> |
39 | #include <qlistbox.h> | 38 | #include <qlistbox.h> |
40 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
41 | #include <qwhatsthis.h> | 40 | #include <qwhatsthis.h> |
42 | 41 | ||
43 | #include <assert.h> | 42 | #include <assert.h> |
44 | 43 | ||
45 | static inline bool containsAlphaNum( const QString &str ); | 44 | static inline bool containsAlphaNum( const QString &str ); |
46 | static inline bool constainsWhiteSpace( const QString &str ); | 45 | static inline bool constainsWhiteSpace( const QString &str ); |
@@ -49,25 +48,25 @@ static inline bool constainsWhiteSpace( const QString &str ); | |||
49 | // file format... | 48 | // file format... |
50 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 49 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
51 | QString &strAll ); | 50 | QString &strAll ); |
52 | 51 | ||
53 | // helper convert from file format to comma delimited... | 52 | // helper convert from file format to comma delimited... |
54 | void parseEmailTo( const QString &strDefaultEmail, | 53 | void parseEmailTo( const QString &strDefaultEmail, |
55 | const QString &strOtherEmail, QString &strBack ); | 54 | const QString &strOtherEmail, QString &strBack ); |
56 | 55 | ||
57 | ContactEditor::ContactEditor(const Opie::OPimContact &entry, | 56 | ContactEditor::ContactEditor(const Opie::OPimContact &entry, |
58 | QWidget *parent, | 57 | QWidget *parent, |
59 | const char *name, | 58 | const char *name, |
60 | WFlags ) | 59 | WFlags ) |
61 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), | 60 | : QDialog( parent, name, true, WStyle_ContextHelp ), |
62 | defaultEmailChooserPosition( -1 ), | 61 | defaultEmailChooserPosition( -1 ), |
63 | m_personalView ( false ), | 62 | m_personalView ( false ), |
64 | cmbDefaultEmail( 0 ), | 63 | cmbDefaultEmail( 0 ), |
65 | initializing ( false ) | 64 | initializing ( false ) |
66 | { | 65 | { |
67 | 66 | ||
68 | initializing = true; | 67 | initializing = true; |
69 | 68 | ||
70 | init(); | 69 | init(); |
71 | setEntry( entry ); | 70 | setEntry( entry ); |
72 | // cmbDefaultEmail = 0; | 71 | // cmbDefaultEmail = 0; |
73 | // defaultEmailChooserPosition = -1; | 72 | // defaultEmailChooserPosition = -1; |
@@ -110,43 +109,42 @@ void ContactEditor::init() { | |||
110 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); | 109 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); |
111 | 110 | ||
112 | // Last Check to be sure.. | 111 | // Last Check to be sure.. |
113 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); | 112 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); |
114 | assert( slChooserNames.count() == trlChooserNames.count() ); | 113 | assert( slChooserNames.count() == trlChooserNames.count() ); |
115 | 114 | ||
116 | for (i = 0; i < slChooserNames.count(); i++) | 115 | for (i = 0; i < slChooserNames.count(); i++) |
117 | slChooserValues.append(""); | 116 | slChooserValues.append(""); |
118 | 117 | ||
119 | 118 | ||
120 | QVBoxLayout *vb = new QVBoxLayout( this ); | 119 | QVBoxLayout *vb = new QVBoxLayout( this ); |
121 | 120 | ||
122 | tabMain = new QTabWidget( this ); | 121 | tabMain = new Opie::Ui::OTabWidget( this ); |
123 | vb->addWidget( tabMain ); | 122 | vb->addWidget( tabMain ); |
124 | 123 | ||
125 | QWidget *tabViewport = new QWidget ( tabMain ); | 124 | m_generalWidget = new QWidget ( tabMain ); |
126 | 125 | ||
127 | vb = new QVBoxLayout( tabViewport ); | 126 | vb = new QVBoxLayout( m_generalWidget ); |
128 | 127 | ||
129 | svGeneral = new QScrollView( tabViewport ); | 128 | svGeneral = new QScrollView( m_generalWidget ); |
130 | vb->addWidget( svGeneral, 0, 0 ); | 129 | vb->addWidget( svGeneral, 0, 0 ); |
131 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); | 130 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); |
132 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); | 131 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); |
133 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); | 132 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); |
134 | svGeneral->setFrameStyle( QFrame::NoFrame ); | 133 | svGeneral->setFrameStyle( QFrame::NoFrame ); |
135 | 134 | ||
136 | QWidget *container = new QWidget( svGeneral->viewport() ); | 135 | QWidget *container = new QWidget( svGeneral->viewport() ); |
137 | svGeneral->addChild( container ); | 136 | svGeneral->addChild( container ); |
138 | 137 | ||
139 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); | 138 | QGridLayout *gl = new QGridLayout( container, 10, 2, 2, 4 ); |
140 | gl->setResizeMode( QLayout::FreeResize ); | ||
141 | 139 | ||
142 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); | 140 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); |
143 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); | 141 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); |
144 | gl->addWidget( btnFullName, 0, 0 ); | 142 | gl->addWidget( btnFullName, 0, 0 ); |
145 | txtFullName = new ABOOK::NameLineEdit( container ); | 143 | txtFullName = new ABOOK::NameLineEdit( container ); |
146 | QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) ); | 144 | QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) ); |
147 | gl->addWidget( txtFullName, 0, 1 ); | 145 | gl->addWidget( txtFullName, 0, 1 ); |
148 | 146 | ||
149 | QLabel *l = new QLabel( tr( "Job Title" ), container ); | 147 | QLabel *l = new QLabel( tr( "Job Title" ), container ); |
150 | QWhatsThis::add( l, tr( "The jobtitle.." ) ); | 148 | QWhatsThis::add( l, tr( "The jobtitle.." ) ); |
151 | gl->addWidget( l, 1, 0 ); | 149 | gl->addWidget( l, 1, 0 ); |
152 | txtJobTitle = new QLineEdit( container ); | 150 | txtJobTitle = new QLineEdit( container ); |
@@ -159,95 +157,95 @@ void ContactEditor::init() { | |||
159 | txtSuffix = new QLineEdit( container ); | 157 | txtSuffix = new QLineEdit( container ); |
160 | QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); | 158 | QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); |
161 | gl->addWidget( txtSuffix, 2, 1 ); | 159 | gl->addWidget( txtSuffix, 2, 1 ); |
162 | 160 | ||
163 | l = new QLabel( tr( "Organization" ), container ); | 161 | l = new QLabel( tr( "Organization" ), container ); |
164 | QWhatsThis::add( l, tr( "The working place of the contact" ) ); | 162 | QWhatsThis::add( l, tr( "The working place of the contact" ) ); |
165 | gl->addWidget( l, 3, 0 ); | 163 | gl->addWidget( l, 3, 0 ); |
166 | txtOrganization = new QLineEdit( container ); | 164 | txtOrganization = new QLineEdit( container ); |
167 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); | 165 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); |
168 | gl->addWidget( txtOrganization, 3, 1 ); | 166 | gl->addWidget( txtOrganization, 3, 1 ); |
169 | 167 | ||
170 | // Chooser 1 | 168 | // Chooser 1 |
171 | cmbChooserField1 = new QComboBox( FALSE, container ); | 169 | cmbChooserField1 = new QComboBox( false, container ); |
172 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); | 170 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); |
173 | cmbChooserField1->setMaximumWidth( 90 ); | 171 | cmbChooserField1->setMaximumWidth( 90 ); |
174 | gl->addWidget( cmbChooserField1, 4, 0 ); | 172 | gl->addWidget( cmbChooserField1, 4, 0 ); |
175 | // Textfield for chooser 1. | 173 | // Textfield for chooser 1. |
176 | // Now use Widgetstack to contain the textfield and the default-email combo ! | 174 | // Now use Widgetstack to contain the textfield and the default-email combo ! |
177 | m_widgetStack1 = new QWidgetStack( container ); | 175 | m_widgetStack1 = new QWidgetStack( container ); |
178 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); | 176 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); |
179 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); | 177 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); |
180 | gl->addWidget( m_widgetStack1, 4, 1 ); | 178 | gl->addWidget( m_widgetStack1, 4, 1 ); |
181 | m_widgetStack1 -> raiseWidget( TextField ); | 179 | m_widgetStack1 -> raiseWidget( TextField ); |
182 | 180 | ||
183 | // Chooser 2 | 181 | // Chooser 2 |
184 | cmbChooserField2 = new QComboBox( FALSE, container ); | 182 | cmbChooserField2 = new QComboBox( false, container ); |
185 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); | 183 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); |
186 | cmbChooserField2->setMaximumWidth( 90 ); | 184 | cmbChooserField2->setMaximumWidth( 90 ); |
187 | gl->addWidget( cmbChooserField2, 5, 0 ); | 185 | gl->addWidget( cmbChooserField2, 5, 0 ); |
188 | // Textfield for chooser 2 | 186 | // Textfield for chooser 2 |
189 | // Now use WidgetStack to contain the textfield and the default-email combo! | 187 | // Now use WidgetStack to contain the textfield and the default-email combo! |
190 | m_widgetStack2 = new QWidgetStack( container ); | 188 | m_widgetStack2 = new QWidgetStack( container ); |
191 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); | 189 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); |
192 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); | 190 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); |
193 | gl->addWidget( m_widgetStack2, 5, 1 ); | 191 | gl->addWidget( m_widgetStack2, 5, 1 ); |
194 | m_widgetStack2 -> raiseWidget( TextField ); | 192 | m_widgetStack2 -> raiseWidget( TextField ); |
195 | 193 | ||
196 | // Chooser 3 | 194 | // Chooser 3 |
197 | cmbChooserField3 = new QComboBox( FALSE, container ); | 195 | cmbChooserField3 = new QComboBox( false, container ); |
198 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); | 196 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); |
199 | cmbChooserField3->setMaximumWidth( 90 ); | 197 | cmbChooserField3->setMaximumWidth( 90 ); |
200 | gl->addWidget( cmbChooserField3, 6, 0 ); | 198 | gl->addWidget( cmbChooserField3, 6, 0 ); |
201 | // Textfield for chooser 2 | 199 | // Textfield for chooser 2 |
202 | // Now use WidgetStack to contain the textfield and the default-email combo! | 200 | // Now use WidgetStack to contain the textfield and the default-email combo! |
203 | m_widgetStack3 = new QWidgetStack( container ); | 201 | m_widgetStack3 = new QWidgetStack( container ); |
204 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); | 202 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); |
205 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); | 203 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); |
206 | gl->addWidget( m_widgetStack3, 6, 1 ); | 204 | gl->addWidget( m_widgetStack3, 6, 1 ); |
207 | m_widgetStack3 -> raiseWidget( TextField ); | 205 | m_widgetStack3 -> raiseWidget( TextField ); |
208 | 206 | ||
209 | l = new QLabel( tr( "File As" ), container ); | 207 | l = new QLabel( tr( "File As" ), container ); |
210 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); | 208 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); |
211 | gl->addWidget( l, 7, 0 ); | 209 | gl->addWidget( l, 7, 0 ); |
212 | cmbFileAs = new QComboBox( TRUE, container ); | 210 | cmbFileAs = new QComboBox( true, container ); |
213 | gl->addWidget( cmbFileAs, 7, 1 ); | 211 | gl->addWidget( cmbFileAs, 7, 1 ); |
214 | 212 | ||
215 | labCat = new QLabel( tr( "Category" ), container ); | 213 | labCat = new QLabel( tr( "Category" ), container ); |
216 | gl->addWidget( labCat, 8, 0 ); | 214 | gl->addWidget( labCat, 8, 0 ); |
217 | cmbCat = new CategorySelect( container ); | 215 | cmbCat = new CategorySelect( container ); |
218 | gl->addWidget( cmbCat, 8, 1 ); | 216 | gl->addWidget( cmbCat, 8, 1 ); |
219 | labCat->show(); | 217 | labCat->show(); |
220 | cmbCat->show(); | 218 | cmbCat->show(); |
221 | 219 | ||
222 | btnNote = new QPushButton( tr( "Notes..." ), container ); | 220 | btnNote = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Notes..." ), container ); |
223 | gl->addWidget( btnNote, 9, 1 ); | 221 | gl->addWidget( btnNote, 9, 1 ); |
224 | 222 | ||
225 | tabMain->insertTab( tabViewport, tr( "General" ) ); | 223 | tabMain->addTab( m_generalWidget, "addressbook/AddressBookSmall", tr( "General" ) ); |
226 | 224 | ||
227 | tabViewport = new QWidget ( tabMain ); | 225 | QWidget *tabViewport = new QWidget ( tabMain ); |
228 | 226 | ||
229 | vb = new QVBoxLayout( tabViewport ); | 227 | vb = new QVBoxLayout( tabViewport ); |
230 | 228 | ||
231 | svAddress = new QScrollView( tabViewport ); | 229 | svAddress = new QScrollView( tabViewport ); |
232 | vb->addWidget( svAddress, 0, 0 ); | 230 | vb->addWidget( svAddress, 0, 0 ); |
233 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); | 231 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); |
234 | svAddress->setFrameStyle( QFrame::NoFrame ); | 232 | svAddress->setFrameStyle( QFrame::NoFrame ); |
235 | 233 | ||
236 | container = new QWidget( svAddress->viewport() ); | 234 | container = new QWidget( svAddress->viewport() ); |
237 | svAddress->addChild( container ); | 235 | svAddress->addChild( container ); |
238 | 236 | ||
239 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem | 237 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem |
240 | 238 | ||
241 | cmbAddress = new QComboBox( FALSE, container ); | 239 | cmbAddress = new QComboBox( false, container ); |
242 | cmbAddress->insertItem( tr( "Business" ) ); | 240 | cmbAddress->insertItem( tr( "Business" ) ); |
243 | cmbAddress->insertItem( tr( "Home" ) ); | 241 | cmbAddress->insertItem( tr( "Home" ) ); |
244 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 242 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
245 | 243 | ||
246 | l = new QLabel( tr( "Address" ), container ); | 244 | l = new QLabel( tr( "Address" ), container ); |
247 | gl->addWidget( l, 1, 0 ); | 245 | gl->addWidget( l, 1, 0 ); |
248 | txtAddress = new QLineEdit( container ); | 246 | txtAddress = new QLineEdit( container ); |
249 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); | 247 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); |
250 | 248 | ||
251 | l = new QLabel( tr( "City" ), container ); | 249 | l = new QLabel( tr( "City" ), container ); |
252 | gl->addWidget( l, 2, 0 ); | 250 | gl->addWidget( l, 2, 0 ); |
253 | txtCity = new QLineEdit( container ); | 251 | txtCity = new QLineEdit( container ); |
@@ -256,25 +254,25 @@ void ContactEditor::init() { | |||
256 | l = new QLabel( tr( "State" ), container ); | 254 | l = new QLabel( tr( "State" ), container ); |
257 | gl->addWidget( l, 3, 0 ); | 255 | gl->addWidget( l, 3, 0 ); |
258 | txtState = new QLineEdit( container ); | 256 | txtState = new QLineEdit( container ); |
259 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); | 257 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); |
260 | 258 | ||
261 | l = new QLabel( tr( "Zip Code" ), container ); | 259 | l = new QLabel( tr( "Zip Code" ), container ); |
262 | gl->addWidget( l, 4, 0 ); | 260 | gl->addWidget( l, 4, 0 ); |
263 | txtZip = new QLineEdit( container ); | 261 | txtZip = new QLineEdit( container ); |
264 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); | 262 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); |
265 | 263 | ||
266 | l = new QLabel( tr( "Country" ), container ); | 264 | l = new QLabel( tr( "Country" ), container ); |
267 | gl->addWidget( l, 5, 0 ); | 265 | gl->addWidget( l, 5, 0 ); |
268 | cmbCountry = new QComboBox( TRUE, container ); | 266 | cmbCountry = new QComboBox( true, container ); |
269 | cmbCountry->insertItem( "" ); | 267 | cmbCountry->insertItem( "" ); |
270 | cmbCountry->insertItem( tr ( "United States" ) ); | 268 | cmbCountry->insertItem( tr ( "United States" ) ); |
271 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); | 269 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); |
272 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); | 270 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); |
273 | cmbCountry->insertItem( tr ( "Albania" ) ); | 271 | cmbCountry->insertItem( tr ( "Albania" ) ); |
274 | cmbCountry->insertItem( tr ( "Algeria" ) ); | 272 | cmbCountry->insertItem( tr ( "Algeria" ) ); |
275 | cmbCountry->insertItem( tr ( "American Samoa" ) ); | 273 | cmbCountry->insertItem( tr ( "American Samoa" ) ); |
276 | cmbCountry->insertItem( tr ( "Andorra" ) ); | 274 | cmbCountry->insertItem( tr ( "Andorra" ) ); |
277 | cmbCountry->insertItem( tr ( "Angola" ) ); | 275 | cmbCountry->insertItem( tr ( "Angola" ) ); |
278 | cmbCountry->insertItem( tr ( "Anguilla" ) ); | 276 | cmbCountry->insertItem( tr ( "Anguilla" ) ); |
279 | cmbCountry->insertItem( tr ( "Antarctica" ) ); | 277 | cmbCountry->insertItem( tr ( "Antarctica" ) ); |
280 | cmbCountry->insertItem( tr ( "Argentina" ) ); | 278 | cmbCountry->insertItem( tr ( "Argentina" ) ); |
@@ -476,90 +474,90 @@ void ContactEditor::init() { | |||
476 | cmbCountry->insertItem( tr ( "Yemen" ) ); | 474 | cmbCountry->insertItem( tr ( "Yemen" ) ); |
477 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); | 475 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); |
478 | cmbCountry->insertItem( tr ( "Zambia" ) ); | 476 | cmbCountry->insertItem( tr ( "Zambia" ) ); |
479 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); | 477 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); |
480 | if (cmbCountry->listBox()!=0) | 478 | if (cmbCountry->listBox()!=0) |
481 | cmbCountry->listBox()->sort(); | 479 | cmbCountry->listBox()->sort(); |
482 | 480 | ||
483 | cmbCountry->setMaximumWidth( 135 ); | 481 | cmbCountry->setMaximumWidth( 135 ); |
484 | 482 | ||
485 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); | 483 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); |
486 | 484 | ||
487 | // Chooser 4 | 485 | // Chooser 4 |
488 | cmbChooserField4 = new QComboBox( FALSE, container ); | 486 | cmbChooserField4 = new QComboBox( false, container ); |
489 | cmbChooserField4->setMaximumWidth( 90 ); | 487 | cmbChooserField4->setMaximumWidth( 90 ); |
490 | gl->addWidget( cmbChooserField4, 6, 0 ); | 488 | gl->addWidget( cmbChooserField4, 6, 0 ); |
491 | // Textfield for chooser 2 | 489 | // Textfield for chooser 2 |
492 | // Now use WidgetStack to contain the textfield and the default-email combo! | 490 | // Now use WidgetStack to contain the textfield and the default-email combo! |
493 | m_widgetStack4 = new QWidgetStack( container ); | 491 | m_widgetStack4 = new QWidgetStack( container ); |
494 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); | 492 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); |
495 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); | 493 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); |
496 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); | 494 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); |
497 | m_widgetStack4 -> raiseWidget( TextField ); | 495 | m_widgetStack4 -> raiseWidget( TextField ); |
498 | 496 | ||
499 | QSpacerItem *space = new QSpacerItem(1,1, | 497 | QSpacerItem *space = new QSpacerItem(1,1, |
500 | QSizePolicy::Maximum, | 498 | QSizePolicy::Maximum, |
501 | QSizePolicy::MinimumExpanding ); | 499 | QSizePolicy::MinimumExpanding ); |
502 | gl->addItem( space, 7, 0 ); | 500 | gl->addItem( space, 7, 0 ); |
503 | 501 | ||
504 | tabMain->insertTab( tabViewport, tr( "Address" ) ); | 502 | tabMain->addTab( tabViewport, "home", tr( "Address" ) ); |
505 | 503 | ||
506 | tabViewport = new QWidget ( tabMain ); | 504 | tabViewport = new QWidget ( tabMain ); |
507 | 505 | ||
508 | vb = new QVBoxLayout( tabViewport ); | 506 | vb = new QVBoxLayout( tabViewport ); |
509 | 507 | ||
510 | svDetails = new QScrollView( tabViewport ); | 508 | svDetails = new QScrollView( tabViewport ); |
511 | vb->addWidget( svDetails, 0, 0 ); | 509 | vb->addWidget( svDetails, 0, 0 ); |
512 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); | 510 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); |
513 | svDetails->setFrameStyle( QFrame::NoFrame ); | 511 | svDetails->setFrameStyle( QFrame::NoFrame ); |
514 | 512 | ||
515 | container = new QWidget( svDetails->viewport() ); | 513 | container = new QWidget( svDetails->viewport() ); |
516 | svDetails->addChild( container ); | 514 | svDetails->addChild( container ); |
517 | 515 | ||
518 | gl = new QGridLayout( container, 1, 2, 2, 4 ); | 516 | gl = new QGridLayout( container, 1, 2, 2, 4 ); |
519 | 517 | ||
520 | int counter = 0; | 518 | int counter = 0; |
521 | 519 | ||
522 | // Birthday | 520 | // Birthday |
523 | QHBox* hBox = new QHBox( container ); | 521 | QHBox* hBox = new QHBox( container ); |
524 | l = new QLabel( tr("Birthday"), container ); | 522 | l = new QLabel( tr("Birthday"), container ); |
525 | gl->addWidget( l, counter, 0 ); | 523 | gl->addWidget( l, counter, 0 ); |
526 | 524 | ||
527 | QPopupMenu* m1 = new QPopupMenu( container ); | 525 | QPopupMenu* m1 = new QPopupMenu( container ); |
528 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); | 526 | birthdayPicker = new DateBookMonth( m1, 0, true ); |
529 | m1->insertItem( birthdayPicker ); | 527 | m1->insertItem( birthdayPicker ); |
530 | 528 | ||
531 | birthdayButton= new QToolButton( hBox, "buttonStart" ); | 529 | birthdayButton= new QToolButton( hBox, "buttonStart" ); |
532 | birthdayButton->setPopup( m1 ); | 530 | birthdayButton->setPopup( m1 ); |
533 | birthdayButton->setPopupDelay(0); | 531 | birthdayButton->setPopupDelay(0); |
534 | 532 | ||
535 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 533 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
536 | tr( "Delete" ), | 534 | tr( "Delete" ), |
537 | hBox, 0 ); | 535 | hBox, 0 ); |
538 | 536 | ||
539 | gl->addWidget( hBox, counter , 1 ); | 537 | gl->addWidget( hBox, counter , 1 ); |
540 | 538 | ||
541 | connect( birthdayPicker, SIGNAL( dateClicked(int,int,int) ), | 539 | connect( birthdayPicker, SIGNAL( dateClicked(int,int,int) ), |
542 | this, SLOT( slotBirthdayDateChanged(int,int,int) ) ); | 540 | this, SLOT( slotBirthdayDateChanged(int,int,int) ) ); |
543 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); | 541 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); |
544 | 542 | ||
545 | ++counter; | 543 | ++counter; |
546 | 544 | ||
547 | // Anniversary | 545 | // Anniversary |
548 | hBox = new QHBox( container ); | 546 | hBox = new QHBox( container ); |
549 | l = new QLabel( tr("Anniversary"), container ); | 547 | l = new QLabel( tr("Anniversary"), container ); |
550 | gl->addWidget( l, counter, 0 ); | 548 | gl->addWidget( l, counter, 0 ); |
551 | 549 | ||
552 | m1 = new QPopupMenu( container ); | 550 | m1 = new QPopupMenu( container ); |
553 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); | 551 | anniversaryPicker = new DateBookMonth( m1, 0, true ); |
554 | m1->insertItem( anniversaryPicker ); | 552 | m1->insertItem( anniversaryPicker ); |
555 | 553 | ||
556 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); | 554 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); |
557 | anniversaryButton->setPopup( m1 ); | 555 | anniversaryButton->setPopup( m1 ); |
558 | anniversaryButton->setPopupDelay(0); | 556 | anniversaryButton->setPopupDelay(0); |
559 | 557 | ||
560 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 558 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
561 | tr( "Delete" ), | 559 | tr( "Delete" ), |
562 | hBox, 0 ); | 560 | hBox, 0 ); |
563 | gl->addWidget( hBox, counter , 1 ); | 561 | gl->addWidget( hBox, counter , 1 ); |
564 | 562 | ||
565 | connect( anniversaryPicker, SIGNAL( dateClicked(int,int,int) ), | 563 | connect( anniversaryPicker, SIGNAL( dateClicked(int,int,int) ), |
@@ -590,34 +588,34 @@ void ContactEditor::init() { | |||
590 | 588 | ||
591 | l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); | 589 | l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); |
592 | listName.append( l ); | 590 | listName.append( l ); |
593 | gl->addWidget( l, i, 0 ); | 591 | gl->addWidget( l, i, 0 ); |
594 | QLineEdit *e = new QLineEdit( container ); | 592 | QLineEdit *e = new QLineEdit( container ); |
595 | listValue.append( e ); | 593 | listValue.append( e ); |
596 | gl->addWidget( e, i, 1); | 594 | gl->addWidget( e, i, 1); |
597 | } | 595 | } |
598 | // Fill labels with names.. | 596 | // Fill labels with names.. |
599 | //loadFields(); | 597 | //loadFields(); |
600 | 598 | ||
601 | 599 | ||
602 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 600 | tabMain->addTab( tabViewport, "UtilsIcon", tr( "Details" ) ); |
603 | 601 | ||
604 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 602 | dlgNote = new QDialog( this, "Note Dialog", true ); |
605 | dlgNote->setCaption( tr("Enter Note") ); | 603 | dlgNote->setCaption( tr("Enter Note") ); |
606 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 604 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
607 | txtNote = new QMultiLineEdit( dlgNote ); | 605 | txtNote = new QMultiLineEdit( dlgNote ); |
608 | vbNote->addWidget( txtNote ); | 606 | vbNote->addWidget( txtNote ); |
609 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 607 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
610 | 608 | ||
611 | dlgName = new QDialog( this, "Name Dialog", TRUE ); | 609 | dlgName = new QDialog( this, "Name Dialog", true ); |
612 | dlgName->setCaption( tr("Edit Name") ); | 610 | dlgName->setCaption( tr("Edit Name") ); |
613 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 611 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
614 | 612 | ||
615 | l = new QLabel( tr("First Name"), dlgName ); | 613 | l = new QLabel( tr("First Name"), dlgName ); |
616 | gl->addWidget( l, 0, 0 ); | 614 | gl->addWidget( l, 0, 0 ); |
617 | txtFirstName = new ABOOK::NameLineEdit( dlgName ); | 615 | txtFirstName = new ABOOK::NameLineEdit( dlgName ); |
618 | gl->addWidget( txtFirstName, 0, 1 ); | 616 | gl->addWidget( txtFirstName, 0, 1 ); |
619 | 617 | ||
620 | l = new QLabel( tr("Middle Name"), dlgName ); | 618 | l = new QLabel( tr("Middle Name"), dlgName ); |
621 | gl->addWidget( l, 1, 0 ); | 619 | gl->addWidget( l, 1, 0 ); |
622 | txtMiddleName = new ABOOK::NameLineEdit( dlgName ); | 620 | txtMiddleName = new ABOOK::NameLineEdit( dlgName ); |
623 | gl->addWidget( txtMiddleName, 1, 1 ); | 621 | gl->addWidget( txtMiddleName, 1, 1 ); |
@@ -1084,25 +1082,25 @@ void ContactEditor::slotNote() { | |||
1084 | } | 1082 | } |
1085 | 1083 | ||
1086 | void ContactEditor::slotName() { | 1084 | void ContactEditor::slotName() { |
1087 | 1085 | ||
1088 | QString tmpName; | 1086 | QString tmpName; |
1089 | 1087 | ||
1090 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1088 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
1091 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1089 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
1092 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1090 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1093 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1091 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1094 | 1092 | ||
1095 | if ( QPEApplication::execDialog( dlgName ) ) { | 1093 | if ( QPEApplication::execDialog( dlgName ) ) { |
1096 | if ( txtLastName->text().contains( ' ', TRUE ) ) | 1094 | if ( txtLastName->text().contains( ' ', true ) ) |
1097 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); | 1095 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); |
1098 | else | 1096 | else |
1099 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); | 1097 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); |
1100 | 1098 | ||
1101 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 1099 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
1102 | slotFullNameChange( txtFullName->text() ); | 1100 | slotFullNameChange( txtFullName->text() ); |
1103 | } | 1101 | } |
1104 | 1102 | ||
1105 | } | 1103 | } |
1106 | 1104 | ||
1107 | void ContactEditor::setNameFocus() { | 1105 | void ContactEditor::setNameFocus() { |
1108 | 1106 | ||
@@ -1129,25 +1127,25 @@ bool ContactEditor::isEmpty() { | |||
1129 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1127 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1130 | 1128 | ||
1131 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1129 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1132 | QString strFirstName; | 1130 | QString strFirstName; |
1133 | QString strMiddleName; | 1131 | QString strMiddleName; |
1134 | QString strLastName; | 1132 | QString strLastName; |
1135 | QString strTitle; | 1133 | QString strTitle; |
1136 | int commapos; | 1134 | int commapos; |
1137 | bool haveLastName = false; | 1135 | bool haveLastName = false; |
1138 | 1136 | ||
1139 | odebug << "Fullname: " << simplifiedName << oendl; | 1137 | odebug << "Fullname: " << simplifiedName << oendl; |
1140 | 1138 | ||
1141 | commapos = simplifiedName.find( ',', 0, TRUE); | 1139 | commapos = simplifiedName.find( ',', 0, true); |
1142 | if ( commapos >= 0 ) { | 1140 | if ( commapos >= 0 ) { |
1143 | odebug << " Commapos: " << commapos << oendl; | 1141 | odebug << " Commapos: " << commapos << oendl; |
1144 | 1142 | ||
1145 | // A comma (",") separates the lastname from one or | 1143 | // A comma (",") separates the lastname from one or |
1146 | // many first names. Thus, remove the lastname from the | 1144 | // many first names. Thus, remove the lastname from the |
1147 | // String and parse the firstnames. | 1145 | // String and parse the firstnames. |
1148 | 1146 | ||
1149 | strLastName = simplifiedName.left( commapos ); | 1147 | strLastName = simplifiedName.left( commapos ); |
1150 | simplifiedName= simplifiedName.mid( commapos + 1 ); | 1148 | simplifiedName= simplifiedName.mid( commapos + 1 ); |
1151 | haveLastName = true; | 1149 | haveLastName = true; |
1152 | odebug << "Fullname without ',': " << simplifiedName << oendl; | 1150 | odebug << "Fullname without ',': " << simplifiedName << oendl; |
1153 | 1151 | ||
@@ -1253,46 +1251,46 @@ void ContactEditor::cleanupFields() { | |||
1253 | txtTmp->setText(""); | 1251 | txtTmp->setText(""); |
1254 | txtTmp = cmbFileAs->lineEdit(); | 1252 | txtTmp = cmbFileAs->lineEdit(); |
1255 | txtTmp->setText(""); | 1253 | txtTmp->setText(""); |
1256 | 1254 | ||
1257 | } | 1255 | } |
1258 | 1256 | ||
1259 | void ContactEditor::setEntry( const Opie::OPimContact &entry ) { | 1257 | void ContactEditor::setEntry( const Opie::OPimContact &entry ) { |
1260 | 1258 | ||
1261 | initializing = true; | 1259 | initializing = true; |
1262 | 1260 | ||
1263 | // Cleanup and activate the general Page .. | 1261 | // Cleanup and activate the general Page .. |
1264 | cleanupFields(); | 1262 | cleanupFields(); |
1265 | tabMain->setCurrentPage( 0 ); | 1263 | tabMain->setCurrentTab( m_generalWidget ); |
1266 | 1264 | ||
1267 | ent = entry; | 1265 | ent = entry; |
1268 | 1266 | ||
1269 | emails = QStringList(ent.emailList()); | 1267 | emails = QStringList(ent.emailList()); |
1270 | defaultEmail = ent.defaultEmail(); | 1268 | defaultEmail = ent.defaultEmail(); |
1271 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; | 1269 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; |
1272 | odebug << "default email=" << defaultEmail << oendl; | 1270 | odebug << "default email=" << defaultEmail << oendl; |
1273 | 1271 | ||
1274 | txtFirstName->setText( ent.firstName() ); | 1272 | txtFirstName->setText( ent.firstName() ); |
1275 | txtMiddleName->setText( ent.middleName() ); | 1273 | txtMiddleName->setText( ent.middleName() ); |
1276 | txtLastName->setText( ent.lastName() ); | 1274 | txtLastName->setText( ent.lastName() ); |
1277 | txtSuffix->setText( ent.suffix() ); | 1275 | txtSuffix->setText( ent.suffix() ); |
1278 | 1276 | ||
1279 | // QString *tmpString = new QString; | 1277 | // QString *tmpString = new QString; |
1280 | // *tmpString = ent.firstName() + " " + ent.middleName() + | 1278 | // *tmpString = ent.firstName() + " " + ent.middleName() + |
1281 | // + " " + ent.lastName() + " " + ent.suffix(); | 1279 | // + " " + ent.lastName() + " " + ent.suffix(); |
1282 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1280 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1283 | 1281 | ||
1284 | if ( !ent.isEmpty() ){ | 1282 | if ( !ent.isEmpty() ){ |
1285 | // Lastnames with multiple words need to be protected by a comma ! | 1283 | // Lastnames with multiple words need to be protected by a comma ! |
1286 | if ( ent.lastName().contains( ' ', TRUE ) ) | 1284 | if ( ent.lastName().contains( ' ', true ) ) |
1287 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); | 1285 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); |
1288 | else | 1286 | else |
1289 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); | 1287 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); |
1290 | } | 1288 | } |
1291 | 1289 | ||
1292 | cmbFileAs->setEditText( ent.fileAs() ); | 1290 | cmbFileAs->setEditText( ent.fileAs() ); |
1293 | 1291 | ||
1294 | //if (hasTitle) | 1292 | //if (hasTitle) |
1295 | txtJobTitle->setText( ent.jobTitle() ); | 1293 | txtJobTitle->setText( ent.jobTitle() ); |
1296 | 1294 | ||
1297 | //if (hasCompany) | 1295 | //if (hasCompany) |
1298 | txtOrganization->setText( ent.company() ); | 1296 | txtOrganization->setText( ent.company() ); |
@@ -1678,36 +1676,36 @@ void parseEmailTo( const QString &strDefaultEmail, | |||
1678 | } else | 1676 | } else |
1679 | foundDefault = true; | 1677 | foundDefault = true; |
1680 | } | 1678 | } |
1681 | } | 1679 | } |
1682 | 1680 | ||
1683 | 1681 | ||
1684 | static inline bool containsAlphaNum( const QString &str ) | 1682 | static inline bool containsAlphaNum( const QString &str ) |
1685 | { | 1683 | { |
1686 | int i, | 1684 | int i, |
1687 | count = str.length(); | 1685 | count = str.length(); |
1688 | for ( i = 0; i < count; i++ ) | 1686 | for ( i = 0; i < count; i++ ) |
1689 | if ( !str[i].isSpace() ) | 1687 | if ( !str[i].isSpace() ) |
1690 | return TRUE; | 1688 | return true; |
1691 | return FALSE; | 1689 | return false; |
1692 | } | 1690 | } |
1693 | 1691 | ||
1694 | static inline bool constainsWhiteSpace( const QString &str ) | 1692 | static inline bool constainsWhiteSpace( const QString &str ) |
1695 | { | 1693 | { |
1696 | int i, | 1694 | int i, |
1697 | count = str.length(); | 1695 | count = str.length(); |
1698 | for (i = 0; i < count; i++ ) | 1696 | for (i = 0; i < count; i++ ) |
1699 | if ( str[i].isSpace() ) | 1697 | if ( str[i].isSpace() ) |
1700 | return TRUE; | 1698 | return true; |
1701 | return FALSE; | 1699 | return false; |
1702 | } | 1700 | } |
1703 | 1701 | ||
1704 | void ContactEditor::setPersonalView( bool personal ) | 1702 | void ContactEditor::setPersonalView( bool personal ) |
1705 | { | 1703 | { |
1706 | m_personalView = personal; | 1704 | m_personalView = personal; |
1707 | 1705 | ||
1708 | // Currently disbled due to the fact that | 1706 | // Currently disbled due to the fact that |
1709 | // show will not work... | 1707 | // show will not work... |
1710 | return; | 1708 | return; |
1711 | 1709 | ||
1712 | if ( personal ){ | 1710 | if ( personal ){ |
1713 | cmbCat->hide(); | 1711 | cmbCat->hide(); |