author | eilers <eilers> | 2003-03-05 09:27:33 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-03-05 09:27:33 (UTC) |
commit | a1b76d948b7d45e8813181396ed83c002587feb9 (patch) (unidiff) | |
tree | 95e4da6aa2c6b6b3b8d8d834dcff76e1fb42b42e | |
parent | caad9c7b3e7fc0c9046993f6a152cd37f91fdceb (diff) | |
download | opie-a1b76d948b7d45e8813181396ed83c002587feb9.zip opie-a1b76d948b7d45e8813181396ed83c002587feb9.tar.gz opie-a1b76d948b7d45e8813181396ed83c002587feb9.tar.bz2 |
Bugfix: Fullname Dialogbox had problems with lastnames out of multiple words
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 62 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 8 |
2 files changed, 29 insertions, 41 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 75dd2c1..7682399 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -1,349 +1,347 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> | 2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> |
3 | * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) | 3 | * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) |
4 | * | 4 | * |
5 | * This file is an add-on for the OPIE Palmtop Environment | 5 | * This file is an add-on for the OPIE Palmtop Environment |
6 | * | 6 | * |
7 | * This file may be distributed and/or modified under the terms of the | 7 | * This file may be distributed and/or modified under the terms of the |
8 | * GNU General Public License version 2 as published by the Free Software | 8 | * GNU General Public License version 2 as published by the Free Software |
9 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging | 9 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging |
10 | * of this file. | 10 | * of this file. |
11 | * | 11 | * |
12 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | * | 14 | * |
15 | * | 15 | * |
16 | * This is a rewrite of the abeditor.h file, modified to provide a more | 16 | * This is a rewrite of the abeditor.h file, modified to provide a more |
17 | * intuitive interface to TrollTech's original Address Book editor. This | 17 | * intuitive interface to TrollTech's original Address Book editor. This |
18 | * is made to operate exactly in interface with the exception of name. | 18 | * is made to operate exactly in interface with the exception of name. |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include "contacteditor.h" | 22 | #include "contacteditor.h" |
23 | #include "addresspicker.h" | 23 | #include "addresspicker.h" |
24 | #include "ocontactfields.h" | 24 | #include "ocontactfields.h" |
25 | 25 | ||
26 | #include <qpe/categoryselect.h> | 26 | #include <qpe/categoryselect.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qpe/qpedialog.h> | 28 | #include <qpe/qpedialog.h> |
29 | #include <qpe/timeconversion.h> | 29 | #include <qpe/timeconversion.h> |
30 | #include <opie/ocontact.h> | 30 | #include <opie/ocontact.h> |
31 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
32 | 32 | ||
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qlabel.h> | 34 | #include <qlabel.h> |
35 | #include <qtabwidget.h> | 35 | #include <qtabwidget.h> |
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qlineedit.h> | 37 | #include <qlineedit.h> |
38 | #include <qmultilineedit.h> | 38 | #include <qmultilineedit.h> |
39 | #include <qscrollview.h> | 39 | #include <qscrollview.h> |
40 | #include <qtoolbutton.h> | 40 | #include <qtoolbutton.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qmainwindow.h> | 42 | #include <qmainwindow.h> |
43 | #include <qvaluelist.h> | 43 | #include <qvaluelist.h> |
44 | #include <qpopupmenu.h> | 44 | #include <qpopupmenu.h> |
45 | #include <qlistbox.h> | 45 | #include <qlistbox.h> |
46 | #include <qhbox.h> | 46 | #include <qhbox.h> |
47 | #include <qaction.h> | 47 | #include <qaction.h> |
48 | #include <qiconset.h> | 48 | #include <qiconset.h> |
49 | #include <qmessagebox.h> | 49 | #include <qmessagebox.h> |
50 | 50 | ||
51 | #include <assert.h> | 51 | #include <assert.h> |
52 | 52 | ||
53 | static inline bool containsAlphaNum( const QString &str ); | 53 | static inline bool containsAlphaNum( const QString &str ); |
54 | static inline bool constainsWhiteSpace( const QString &str ); | 54 | static inline bool constainsWhiteSpace( const QString &str ); |
55 | 55 | ||
56 | // helper functions, convert our comma delimited list to proper | 56 | // helper functions, convert our comma delimited list to proper |
57 | // file format... | 57 | // file format... |
58 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 58 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
59 | QString &strAll ); | 59 | QString &strAll ); |
60 | 60 | ||
61 | // helper convert from file format to comma delimited... | 61 | // helper convert from file format to comma delimited... |
62 | void parseEmailTo( const QString &strDefaultEmail, | 62 | void parseEmailTo( const QString &strDefaultEmail, |
63 | const QString &strOtherEmail, QString &strBack ); | 63 | const QString &strOtherEmail, QString &strBack ); |
64 | 64 | ||
65 | ContactEditor::ContactEditor(const OContact &entry, | 65 | ContactEditor::ContactEditor(const OContact &entry, |
66 | QWidget *parent, | 66 | QWidget *parent, |
67 | const char *name, | 67 | const char *name, |
68 | WFlags fl ) | 68 | WFlags fl ) |
69 | : QDialog( parent, name, TRUE, fl ), | 69 | : QDialog( parent, name, TRUE, fl ), |
70 | defaultEmailChooserPosition( -1 ), | 70 | defaultEmailChooserPosition( -1 ), |
71 | m_personalView ( false ), | 71 | m_personalView ( false ), |
72 | cmbDefaultEmail( 0 ), | 72 | cmbDefaultEmail( 0 ), |
73 | initializing ( false ) | 73 | initializing ( false ) |
74 | { | 74 | { |
75 | 75 | ||
76 | initializing = true; | 76 | initializing = true; |
77 | 77 | ||
78 | init(); | 78 | init(); |
79 | setEntry( entry ); | 79 | setEntry( entry ); |
80 | // cmbDefaultEmail = 0; | 80 | // cmbDefaultEmail = 0; |
81 | // defaultEmailChooserPosition = -1; | 81 | // defaultEmailChooserPosition = -1; |
82 | 82 | ||
83 | initializing = false; | 83 | initializing = false; |
84 | } | 84 | } |
85 | 85 | ||
86 | ContactEditor::~ContactEditor() { | 86 | ContactEditor::~ContactEditor() { |
87 | } | 87 | } |
88 | 88 | ||
89 | void ContactEditor::init() { | 89 | void ContactEditor::init() { |
90 | qWarning("init() START"); | 90 | qWarning("init() START"); |
91 | 91 | ||
92 | useFullName = true; | ||
93 | |||
94 | uint i = 0; | 92 | uint i = 0; |
95 | 93 | ||
96 | QStringList trlChooserNames; | 94 | QStringList trlChooserNames; |
97 | 95 | ||
98 | for (i = 0; i <= 6; i++) { | 96 | for (i = 0; i <= 6; i++) { |
99 | slHomeAddress.append( "" ); | 97 | slHomeAddress.append( "" ); |
100 | slBusinessAddress.append( "" ); | 98 | slBusinessAddress.append( "" ); |
101 | } | 99 | } |
102 | 100 | ||
103 | trlChooserNames = OContactFields::trphonefields( false ); | 101 | trlChooserNames = OContactFields::trphonefields( false ); |
104 | slChooserNames = OContactFields::untrphonefields( false ); | 102 | slChooserNames = OContactFields::untrphonefields( false ); |
105 | slDynamicEntries = OContactFields::untrdetailsfields( false ); | 103 | slDynamicEntries = OContactFields::untrdetailsfields( false ); |
106 | trlDynamicEntries = OContactFields::trdetailsfields( false ); | 104 | trlDynamicEntries = OContactFields::trdetailsfields( false ); |
107 | 105 | ||
108 | // Ok, we have to remove elements from the list of dynamic entries | 106 | // Ok, we have to remove elements from the list of dynamic entries |
109 | // which are now stored in special (not dynamic) widgets.. | 107 | // which are now stored in special (not dynamic) widgets.. |
110 | // Otherwise we will get problems with field assignments! (se) | 108 | // Otherwise we will get problems with field assignments! (se) |
111 | slDynamicEntries.remove("Anniversary"); | 109 | slDynamicEntries.remove("Anniversary"); |
112 | slDynamicEntries.remove("Birthday"); | 110 | slDynamicEntries.remove("Birthday"); |
113 | slDynamicEntries.remove("Gender"); | 111 | slDynamicEntries.remove("Gender"); |
114 | 112 | ||
115 | // The same with translated fields.. But I will | 113 | // The same with translated fields.. But I will |
116 | // use the translation map to avoid mismatches.. | 114 | // use the translation map to avoid mismatches.. |
117 | QMap<int, QString> translMap = OContactFields::idToTrFields(); | 115 | QMap<int, QString> translMap = OContactFields::idToTrFields(); |
118 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); | 116 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); |
119 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); | 117 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); |
120 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); | 118 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); |
121 | 119 | ||
122 | // Last Check to be sure.. | 120 | // Last Check to be sure.. |
123 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); | 121 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); |
124 | assert( slChooserNames.count() == trlChooserNames.count() ); | 122 | assert( slChooserNames.count() == trlChooserNames.count() ); |
125 | 123 | ||
126 | for (i = 0; i < slChooserNames.count(); i++) | 124 | for (i = 0; i < slChooserNames.count(); i++) |
127 | slChooserValues.append(""); | 125 | slChooserValues.append(""); |
128 | 126 | ||
129 | 127 | ||
130 | QVBoxLayout *vb = new QVBoxLayout( this ); | 128 | QVBoxLayout *vb = new QVBoxLayout( this ); |
131 | 129 | ||
132 | tabMain = new QTabWidget( this ); | 130 | tabMain = new QTabWidget( this ); |
133 | vb->addWidget( tabMain ); | 131 | vb->addWidget( tabMain ); |
134 | 132 | ||
135 | QWidget *tabViewport = new QWidget ( tabMain ); | 133 | QWidget *tabViewport = new QWidget ( tabMain ); |
136 | 134 | ||
137 | vb = new QVBoxLayout( tabViewport ); | 135 | vb = new QVBoxLayout( tabViewport ); |
138 | 136 | ||
139 | svGeneral = new QScrollView( tabViewport ); | 137 | svGeneral = new QScrollView( tabViewport ); |
140 | vb->addWidget( svGeneral, 0, 0 ); | 138 | vb->addWidget( svGeneral, 0, 0 ); |
141 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); | 139 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); |
142 | svGeneral->setFrameStyle( QFrame::NoFrame ); | 140 | svGeneral->setFrameStyle( QFrame::NoFrame ); |
143 | 141 | ||
144 | QWidget *container = new QWidget( svGeneral->viewport() ); | 142 | QWidget *container = new QWidget( svGeneral->viewport() ); |
145 | svGeneral->addChild( container ); | 143 | svGeneral->addChild( container ); |
146 | 144 | ||
147 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); | 145 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); |
148 | gl->setResizeMode( QLayout::FreeResize ); | 146 | gl->setResizeMode( QLayout::FreeResize ); |
149 | 147 | ||
150 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); | 148 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); |
151 | gl->addWidget( btnFullName, 0, 0 ); | 149 | gl->addWidget( btnFullName, 0, 0 ); |
152 | txtFullName = new QLineEdit( container ); | 150 | txtFullName = new QLineEdit( container ); |
153 | gl->addWidget( txtFullName, 0, 1 ); | 151 | gl->addWidget( txtFullName, 0, 1 ); |
154 | 152 | ||
155 | QLabel *l = new QLabel( tr( "Job Title" ), container ); | 153 | QLabel *l = new QLabel( tr( "Job Title" ), container ); |
156 | gl->addWidget( l, 1, 0 ); | 154 | gl->addWidget( l, 1, 0 ); |
157 | txtJobTitle = new QLineEdit( container ); | 155 | txtJobTitle = new QLineEdit( container ); |
158 | gl->addWidget( txtJobTitle, 1, 1 ); | 156 | gl->addWidget( txtJobTitle, 1, 1 ); |
159 | 157 | ||
160 | l = new QLabel( tr("Suffix"), container ); | 158 | l = new QLabel( tr("Suffix"), container ); |
161 | gl->addWidget( l, 2, 0 ); | 159 | gl->addWidget( l, 2, 0 ); |
162 | txtSuffix = new QLineEdit( container ); | 160 | txtSuffix = new QLineEdit( container ); |
163 | gl->addWidget( txtSuffix, 2, 1 ); | 161 | gl->addWidget( txtSuffix, 2, 1 ); |
164 | 162 | ||
165 | l = new QLabel( tr( "Organization" ), container ); | 163 | l = new QLabel( tr( "Organization" ), container ); |
166 | gl->addWidget( l, 3, 0 ); | 164 | gl->addWidget( l, 3, 0 ); |
167 | txtOrganization = new QLineEdit( container ); | 165 | txtOrganization = new QLineEdit( container ); |
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 | cmbChooserField1->setMaximumWidth( 90 ); | 170 | cmbChooserField1->setMaximumWidth( 90 ); |
173 | gl->addWidget( cmbChooserField1, 4, 0 ); | 171 | gl->addWidget( cmbChooserField1, 4, 0 ); |
174 | // Textfield for chooser 1. | 172 | // Textfield for chooser 1. |
175 | // Now use Widgetstack to contain the textfield and the default-email combo ! | 173 | // Now use Widgetstack to contain the textfield and the default-email combo ! |
176 | m_widgetStack1 = new QWidgetStack( container ); | 174 | m_widgetStack1 = new QWidgetStack( container ); |
177 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); | 175 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); |
178 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); | 176 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); |
179 | gl->addWidget( m_widgetStack1, 4, 1 ); | 177 | gl->addWidget( m_widgetStack1, 4, 1 ); |
180 | m_widgetStack1 -> raiseWidget( TextField ); | 178 | m_widgetStack1 -> raiseWidget( TextField ); |
181 | 179 | ||
182 | // Chooser 2 | 180 | // Chooser 2 |
183 | cmbChooserField2 = new QComboBox( FALSE, container ); | 181 | cmbChooserField2 = new QComboBox( FALSE, container ); |
184 | cmbChooserField2->setMaximumWidth( 90 ); | 182 | cmbChooserField2->setMaximumWidth( 90 ); |
185 | gl->addWidget( cmbChooserField2, 5, 0 ); | 183 | gl->addWidget( cmbChooserField2, 5, 0 ); |
186 | // Textfield for chooser 2 | 184 | // Textfield for chooser 2 |
187 | // Now use WidgetStack to contain the textfield and the default-email combo! | 185 | // Now use WidgetStack to contain the textfield and the default-email combo! |
188 | m_widgetStack2 = new QWidgetStack( container ); | 186 | m_widgetStack2 = new QWidgetStack( container ); |
189 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); | 187 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); |
190 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); | 188 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); |
191 | gl->addWidget( m_widgetStack2, 5, 1 ); | 189 | gl->addWidget( m_widgetStack2, 5, 1 ); |
192 | m_widgetStack2 -> raiseWidget( TextField ); | 190 | m_widgetStack2 -> raiseWidget( TextField ); |
193 | 191 | ||
194 | // Chooser 3 | 192 | // Chooser 3 |
195 | cmbChooserField3 = new QComboBox( FALSE, container ); | 193 | cmbChooserField3 = new QComboBox( FALSE, container ); |
196 | cmbChooserField3->setMaximumWidth( 90 ); | 194 | cmbChooserField3->setMaximumWidth( 90 ); |
197 | gl->addWidget( cmbChooserField3, 6, 0 ); | 195 | gl->addWidget( cmbChooserField3, 6, 0 ); |
198 | // Textfield for chooser 2 | 196 | // Textfield for chooser 2 |
199 | // Now use WidgetStack to contain the textfield and the default-email combo! | 197 | // Now use WidgetStack to contain the textfield and the default-email combo! |
200 | m_widgetStack3 = new QWidgetStack( container ); | 198 | m_widgetStack3 = new QWidgetStack( container ); |
201 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); | 199 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); |
202 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); | 200 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); |
203 | gl->addWidget( m_widgetStack3, 6, 1 ); | 201 | gl->addWidget( m_widgetStack3, 6, 1 ); |
204 | m_widgetStack3 -> raiseWidget( TextField ); | 202 | m_widgetStack3 -> raiseWidget( TextField ); |
205 | 203 | ||
206 | l = new QLabel( tr( "File As" ), container ); | 204 | l = new QLabel( tr( "File As" ), container ); |
207 | gl->addWidget( l, 7, 0 ); | 205 | gl->addWidget( l, 7, 0 ); |
208 | cmbFileAs = new QComboBox( TRUE, container ); | 206 | cmbFileAs = new QComboBox( TRUE, container ); |
209 | gl->addWidget( cmbFileAs, 7, 1 ); | 207 | gl->addWidget( cmbFileAs, 7, 1 ); |
210 | 208 | ||
211 | labCat = new QLabel( tr( "Category" ), container ); | 209 | labCat = new QLabel( tr( "Category" ), container ); |
212 | gl->addWidget( labCat, 8, 0 ); | 210 | gl->addWidget( labCat, 8, 0 ); |
213 | cmbCat = new CategorySelect( container ); | 211 | cmbCat = new CategorySelect( container ); |
214 | gl->addWidget( cmbCat, 8, 1 ); | 212 | gl->addWidget( cmbCat, 8, 1 ); |
215 | labCat->show(); | 213 | labCat->show(); |
216 | cmbCat->show(); | 214 | cmbCat->show(); |
217 | 215 | ||
218 | btnNote = new QPushButton( tr( "Notes..." ), container ); | 216 | btnNote = new QPushButton( tr( "Notes..." ), container ); |
219 | gl->addWidget( btnNote, 9, 1 ); | 217 | gl->addWidget( btnNote, 9, 1 ); |
220 | 218 | ||
221 | tabMain->insertTab( tabViewport, tr( "General" ) ); | 219 | tabMain->insertTab( tabViewport, tr( "General" ) ); |
222 | 220 | ||
223 | tabViewport = new QWidget ( tabMain ); | 221 | tabViewport = new QWidget ( tabMain ); |
224 | 222 | ||
225 | vb = new QVBoxLayout( tabViewport ); | 223 | vb = new QVBoxLayout( tabViewport ); |
226 | 224 | ||
227 | svAddress = new QScrollView( tabViewport ); | 225 | svAddress = new QScrollView( tabViewport ); |
228 | vb->addWidget( svAddress, 0, 0 ); | 226 | vb->addWidget( svAddress, 0, 0 ); |
229 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); | 227 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); |
230 | svAddress->setFrameStyle( QFrame::NoFrame ); | 228 | svAddress->setFrameStyle( QFrame::NoFrame ); |
231 | 229 | ||
232 | container = new QWidget( svAddress->viewport() ); | 230 | container = new QWidget( svAddress->viewport() ); |
233 | svAddress->addChild( container ); | 231 | svAddress->addChild( container ); |
234 | 232 | ||
235 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem | 233 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem |
236 | 234 | ||
237 | cmbAddress = new QComboBox( FALSE, container ); | 235 | cmbAddress = new QComboBox( FALSE, container ); |
238 | cmbAddress->insertItem( tr( "Business" ) ); | 236 | cmbAddress->insertItem( tr( "Business" ) ); |
239 | cmbAddress->insertItem( tr( "Home" ) ); | 237 | cmbAddress->insertItem( tr( "Home" ) ); |
240 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 238 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
241 | 239 | ||
242 | l = new QLabel( tr( "Address" ), container ); | 240 | l = new QLabel( tr( "Address" ), container ); |
243 | gl->addWidget( l, 1, 0 ); | 241 | gl->addWidget( l, 1, 0 ); |
244 | txtAddress = new QLineEdit( container ); | 242 | txtAddress = new QLineEdit( container ); |
245 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); | 243 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); |
246 | 244 | ||
247 | l = new QLabel( tr( "City" ), container ); | 245 | l = new QLabel( tr( "City" ), container ); |
248 | gl->addWidget( l, 2, 0 ); | 246 | gl->addWidget( l, 2, 0 ); |
249 | txtCity = new QLineEdit( container ); | 247 | txtCity = new QLineEdit( container ); |
250 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); | 248 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); |
251 | 249 | ||
252 | l = new QLabel( tr( "State" ), container ); | 250 | l = new QLabel( tr( "State" ), container ); |
253 | gl->addWidget( l, 3, 0 ); | 251 | gl->addWidget( l, 3, 0 ); |
254 | txtState = new QLineEdit( container ); | 252 | txtState = new QLineEdit( container ); |
255 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); | 253 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); |
256 | 254 | ||
257 | l = new QLabel( tr( "Zip Code" ), container ); | 255 | l = new QLabel( tr( "Zip Code" ), container ); |
258 | gl->addWidget( l, 4, 0 ); | 256 | gl->addWidget( l, 4, 0 ); |
259 | txtZip = new QLineEdit( container ); | 257 | txtZip = new QLineEdit( container ); |
260 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); | 258 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); |
261 | 259 | ||
262 | l = new QLabel( tr( "Country" ), container ); | 260 | l = new QLabel( tr( "Country" ), container ); |
263 | gl->addWidget( l, 5, 0 ); | 261 | gl->addWidget( l, 5, 0 ); |
264 | cmbCountry = new QComboBox( TRUE, container ); | 262 | cmbCountry = new QComboBox( TRUE, container ); |
265 | cmbCountry->insertItem( tr( "" ) ); | 263 | cmbCountry->insertItem( tr( "" ) ); |
266 | cmbCountry->insertItem( tr ( "United States" ) ); | 264 | cmbCountry->insertItem( tr ( "United States" ) ); |
267 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); | 265 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); |
268 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); | 266 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); |
269 | cmbCountry->insertItem( tr ( "Albania" ) ); | 267 | cmbCountry->insertItem( tr ( "Albania" ) ); |
270 | cmbCountry->insertItem( tr ( "Algeria" ) ); | 268 | cmbCountry->insertItem( tr ( "Algeria" ) ); |
271 | cmbCountry->insertItem( tr ( "American Samoa" ) ); | 269 | cmbCountry->insertItem( tr ( "American Samoa" ) ); |
272 | cmbCountry->insertItem( tr ( "Andorra" ) ); | 270 | cmbCountry->insertItem( tr ( "Andorra" ) ); |
273 | cmbCountry->insertItem( tr ( "Angola" ) ); | 271 | cmbCountry->insertItem( tr ( "Angola" ) ); |
274 | cmbCountry->insertItem( tr ( "Anguilla" ) ); | 272 | cmbCountry->insertItem( tr ( "Anguilla" ) ); |
275 | cmbCountry->insertItem( tr ( "Antarctica" ) ); | 273 | cmbCountry->insertItem( tr ( "Antarctica" ) ); |
276 | cmbCountry->insertItem( tr ( "Argentina" ) ); | 274 | cmbCountry->insertItem( tr ( "Argentina" ) ); |
277 | cmbCountry->insertItem( tr ( "Armenia" ) ); | 275 | cmbCountry->insertItem( tr ( "Armenia" ) ); |
278 | cmbCountry->insertItem( tr ( "Aruba" ) ); | 276 | cmbCountry->insertItem( tr ( "Aruba" ) ); |
279 | cmbCountry->insertItem( tr ( "Australia" ) ); | 277 | cmbCountry->insertItem( tr ( "Australia" ) ); |
280 | cmbCountry->insertItem( tr ( "Austria" ) ); | 278 | cmbCountry->insertItem( tr ( "Austria" ) ); |
281 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); | 279 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); |
282 | cmbCountry->insertItem( tr ( "Bahamas" ) ); | 280 | cmbCountry->insertItem( tr ( "Bahamas" ) ); |
283 | cmbCountry->insertItem( tr ( "Bahrain" ) ); | 281 | cmbCountry->insertItem( tr ( "Bahrain" ) ); |
284 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); | 282 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); |
285 | cmbCountry->insertItem( tr ( "Barbados" ) ); | 283 | cmbCountry->insertItem( tr ( "Barbados" ) ); |
286 | cmbCountry->insertItem( tr ( "Belarus" ) ); | 284 | cmbCountry->insertItem( tr ( "Belarus" ) ); |
287 | cmbCountry->insertItem( tr ( "Belgium" ) ); | 285 | cmbCountry->insertItem( tr ( "Belgium" ) ); |
288 | cmbCountry->insertItem( tr ( "Belize" ) ); | 286 | cmbCountry->insertItem( tr ( "Belize" ) ); |
289 | cmbCountry->insertItem( tr ( "Benin" ) ); | 287 | cmbCountry->insertItem( tr ( "Benin" ) ); |
290 | cmbCountry->insertItem( tr ( "Bermuda" ) ); | 288 | cmbCountry->insertItem( tr ( "Bermuda" ) ); |
291 | cmbCountry->insertItem( tr ( "Bhutan" ) ); | 289 | cmbCountry->insertItem( tr ( "Bhutan" ) ); |
292 | cmbCountry->insertItem( tr ( "Bolivia" ) ); | 290 | cmbCountry->insertItem( tr ( "Bolivia" ) ); |
293 | cmbCountry->insertItem( tr ( "Botswana" ) ); | 291 | cmbCountry->insertItem( tr ( "Botswana" ) ); |
294 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); | 292 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); |
295 | cmbCountry->insertItem( tr ( "Brazil" ) ); | 293 | cmbCountry->insertItem( tr ( "Brazil" ) ); |
296 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); | 294 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); |
297 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); | 295 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); |
298 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); | 296 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); |
299 | cmbCountry->insertItem( tr ( "Burundi" ) ); | 297 | cmbCountry->insertItem( tr ( "Burundi" ) ); |
300 | cmbCountry->insertItem( tr ( "Cambodia" ) ); | 298 | cmbCountry->insertItem( tr ( "Cambodia" ) ); |
301 | cmbCountry->insertItem( tr ( "Cameroon" ) ); | 299 | cmbCountry->insertItem( tr ( "Cameroon" ) ); |
302 | cmbCountry->insertItem( tr ( "Canada" ) ); | 300 | cmbCountry->insertItem( tr ( "Canada" ) ); |
303 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); | 301 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); |
304 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); | 302 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); |
305 | cmbCountry->insertItem( tr ( "Chad" ) ); | 303 | cmbCountry->insertItem( tr ( "Chad" ) ); |
306 | cmbCountry->insertItem( tr ( "Chile" ) ); | 304 | cmbCountry->insertItem( tr ( "Chile" ) ); |
307 | cmbCountry->insertItem( tr ( "China" ) ); | 305 | cmbCountry->insertItem( tr ( "China" ) ); |
308 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); | 306 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); |
309 | cmbCountry->insertItem( tr ( "Colombia" ) ); | 307 | cmbCountry->insertItem( tr ( "Colombia" ) ); |
310 | cmbCountry->insertItem( tr ( "Comoros" ) ); | 308 | cmbCountry->insertItem( tr ( "Comoros" ) ); |
311 | cmbCountry->insertItem( tr ( "Congo" ) ); | 309 | cmbCountry->insertItem( tr ( "Congo" ) ); |
312 | cmbCountry->insertItem( tr ( "Cook Island" ) ); | 310 | cmbCountry->insertItem( tr ( "Cook Island" ) ); |
313 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); | 311 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); |
314 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); | 312 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); |
315 | cmbCountry->insertItem( tr ( "Croatia" ) ); | 313 | cmbCountry->insertItem( tr ( "Croatia" ) ); |
316 | cmbCountry->insertItem( tr ( "Cuba" ) ); | 314 | cmbCountry->insertItem( tr ( "Cuba" ) ); |
317 | cmbCountry->insertItem( tr ( "Cyprus" ) ); | 315 | cmbCountry->insertItem( tr ( "Cyprus" ) ); |
318 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); | 316 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); |
319 | cmbCountry->insertItem( tr ( "Denmark" ) ); | 317 | cmbCountry->insertItem( tr ( "Denmark" ) ); |
320 | cmbCountry->insertItem( tr ( "Djibouti" ) ); | 318 | cmbCountry->insertItem( tr ( "Djibouti" ) ); |
321 | cmbCountry->insertItem( tr ( "Dominica" ) ); | 319 | cmbCountry->insertItem( tr ( "Dominica" ) ); |
322 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); | 320 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); |
323 | cmbCountry->insertItem( tr ( "East Timor" ) ); | 321 | cmbCountry->insertItem( tr ( "East Timor" ) ); |
324 | cmbCountry->insertItem( tr ( "Ecuador" ) ); | 322 | cmbCountry->insertItem( tr ( "Ecuador" ) ); |
325 | cmbCountry->insertItem( tr ( "Egypt" ) ); | 323 | cmbCountry->insertItem( tr ( "Egypt" ) ); |
326 | cmbCountry->insertItem( tr ( "El Salvador" ) ); | 324 | cmbCountry->insertItem( tr ( "El Salvador" ) ); |
327 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); | 325 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); |
328 | cmbCountry->insertItem( tr ( "Eritrea" ) ); | 326 | cmbCountry->insertItem( tr ( "Eritrea" ) ); |
329 | cmbCountry->insertItem( tr ( "Estonia" ) ); | 327 | cmbCountry->insertItem( tr ( "Estonia" ) ); |
330 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); | 328 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); |
331 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); | 329 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); |
332 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); | 330 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); |
333 | cmbCountry->insertItem( tr ( "Fiji" ) ); | 331 | cmbCountry->insertItem( tr ( "Fiji" ) ); |
334 | cmbCountry->insertItem( tr ( "Finland" ) ); | 332 | cmbCountry->insertItem( tr ( "Finland" ) ); |
335 | cmbCountry->insertItem( tr ( "France" ) ); | 333 | cmbCountry->insertItem( tr ( "France" ) ); |
336 | cmbCountry->insertItem( tr ( "French Guiana" ) ); | 334 | cmbCountry->insertItem( tr ( "French Guiana" ) ); |
337 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); | 335 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); |
338 | cmbCountry->insertItem( tr ( "Gabon" ) ); | 336 | cmbCountry->insertItem( tr ( "Gabon" ) ); |
339 | cmbCountry->insertItem( tr ( "Gambia" ) ); | 337 | cmbCountry->insertItem( tr ( "Gambia" ) ); |
340 | cmbCountry->insertItem( tr ( "Georgia" ) ); | 338 | cmbCountry->insertItem( tr ( "Georgia" ) ); |
341 | cmbCountry->insertItem( tr ( "Germany" ) ); | 339 | cmbCountry->insertItem( tr ( "Germany" ) ); |
342 | cmbCountry->insertItem( tr ( "Ghana" ) ); | 340 | cmbCountry->insertItem( tr ( "Ghana" ) ); |
343 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); | 341 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); |
344 | cmbCountry->insertItem( tr ( "Greece" ) ); | 342 | cmbCountry->insertItem( tr ( "Greece" ) ); |
345 | cmbCountry->insertItem( tr ( "Greenland" ) ); | 343 | cmbCountry->insertItem( tr ( "Greenland" ) ); |
346 | cmbCountry->insertItem( tr ( "Grenada" ) ); | 344 | cmbCountry->insertItem( tr ( "Grenada" ) ); |
347 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); | 345 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); |
348 | cmbCountry->insertItem( tr ( "Guam" ) ); | 346 | cmbCountry->insertItem( tr ( "Guam" ) ); |
349 | cmbCountry->insertItem( tr ( "Guatemala" ) ); | 347 | cmbCountry->insertItem( tr ( "Guatemala" ) ); |
@@ -778,961 +776,953 @@ bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int w | |||
778 | defaultEmailChooserPosition = -1; | 776 | defaultEmailChooserPosition = -1; |
779 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 777 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
780 | if ( cmbo ){ | 778 | if ( cmbo ){ |
781 | inputStack->raiseWidget( TextField ); | 779 | inputStack->raiseWidget( TextField ); |
782 | inputStack -> removeWidget( cmbo ); | 780 | inputStack -> removeWidget( cmbo ); |
783 | cmbDefaultEmail = 0l; | 781 | cmbDefaultEmail = 0l; |
784 | delete cmbo; | 782 | delete cmbo; |
785 | } | 783 | } |
786 | 784 | ||
787 | } | 785 | } |
788 | 786 | ||
789 | // Caller should initialize the responsible textfield, therefore | 787 | // Caller should initialize the responsible textfield, therefore |
790 | // "false" is returned | 788 | // "false" is returned |
791 | return false; | 789 | return false; |
792 | } | 790 | } |
793 | 791 | ||
794 | // Everything is worked off .. | 792 | // Everything is worked off .. |
795 | return true; | 793 | return true; |
796 | 794 | ||
797 | } | 795 | } |
798 | 796 | ||
799 | // Currently accessed when we select default-email more than once ! | 797 | // Currently accessed when we select default-email more than once ! |
800 | void ContactEditor::chooserError( int index ) | 798 | void ContactEditor::chooserError( int index ) |
801 | { | 799 | { |
802 | qWarning("ContactEditor::chooserError( %d )", index); | 800 | qWarning("ContactEditor::chooserError( %d )", index); |
803 | QMessageBox::warning( this, "Chooser Error", | 801 | QMessageBox::warning( this, "Chooser Error", |
804 | "Multiple selection of this\n" | 802 | "Multiple selection of this\n" |
805 | "Item is not allowed !\n\n" | 803 | "Item is not allowed !\n\n" |
806 | "First deselect the previous one !", | 804 | "First deselect the previous one !", |
807 | "&OK", 0, 0, | 805 | "&OK", 0, 0, |
808 | 0, 0 ); | 806 | 0, 0 ); |
809 | 807 | ||
810 | // Reset the selected Chooser. Unfortunately the chooser | 808 | // Reset the selected Chooser. Unfortunately the chooser |
811 | // generates no signal, therfore we have to | 809 | // generates no signal, therfore we have to |
812 | // call the cmbChooserChange function manually.. | 810 | // call the cmbChooserChange function manually.. |
813 | switch( index ){ | 811 | switch( index ){ |
814 | case 1: | 812 | case 1: |
815 | cmbChooserField1 -> setCurrentItem( 0 ); | 813 | cmbChooserField1 -> setCurrentItem( 0 ); |
816 | slotCmbChooser1Change( 0 ); | 814 | slotCmbChooser1Change( 0 ); |
817 | break; | 815 | break; |
818 | case 2: | 816 | case 2: |
819 | cmbChooserField2 -> setCurrentItem( 0 ); | 817 | cmbChooserField2 -> setCurrentItem( 0 ); |
820 | slotCmbChooser2Change( 0 ); | 818 | slotCmbChooser2Change( 0 ); |
821 | break; | 819 | break; |
822 | case 3: | 820 | case 3: |
823 | cmbChooserField3 -> setCurrentItem( 0 ); | 821 | cmbChooserField3 -> setCurrentItem( 0 ); |
824 | slotCmbChooser3Change( 0 ); | 822 | slotCmbChooser3Change( 0 ); |
825 | break; | 823 | break; |
826 | case 4: | 824 | case 4: |
827 | cmbChooserField4 -> setCurrentItem( 0 ); | 825 | cmbChooserField4 -> setCurrentItem( 0 ); |
828 | slotCmbChooser4Change( 0 ); | 826 | slotCmbChooser4Change( 0 ); |
829 | break; | 827 | break; |
830 | } | 828 | } |
831 | } | 829 | } |
832 | 830 | ||
833 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) | 831 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) |
834 | void ContactEditor::chooserChange( const QString &textChanged, int index, | 832 | void ContactEditor::chooserChange( const QString &textChanged, int index, |
835 | QLineEdit* , int widgetPos ) { | 833 | QLineEdit* , int widgetPos ) { |
836 | 834 | ||
837 | QString type = slChooserNames[index]; // :SX | 835 | QString type = slChooserNames[index]; // :SX |
838 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", | 836 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", |
839 | type.latin1(),textChanged.latin1(), index, widgetPos ); | 837 | type.latin1(),textChanged.latin1(), index, widgetPos ); |
840 | 838 | ||
841 | if ( type == "Default Email"){ | 839 | if ( type == "Default Email"){ |
842 | qWarning ("??? Wozu??: %s", textChanged.latin1()); | 840 | qWarning ("??? Wozu??: %s", textChanged.latin1()); |
843 | defaultEmail = textChanged; | 841 | defaultEmail = textChanged; |
844 | 842 | ||
845 | populateDefaultEmailCmb(); | 843 | populateDefaultEmailCmb(); |
846 | 844 | ||
847 | }else if (type == "Emails"){ | 845 | }else if (type == "Emails"){ |
848 | qDebug("emails"); | 846 | qDebug("emails"); |
849 | 847 | ||
850 | QString de; | 848 | QString de; |
851 | emails = QStringList::split (",", textChanged ); | 849 | emails = QStringList::split (",", textChanged ); |
852 | 850 | ||
853 | populateDefaultEmailCmb(); | 851 | populateDefaultEmailCmb(); |
854 | } | 852 | } |
855 | 853 | ||
856 | slChooserValues[index] = textChanged; | 854 | slChooserValues[index] = textChanged; |
857 | 855 | ||
858 | } | 856 | } |
859 | 857 | ||
860 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 858 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
861 | qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); | 859 | qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); |
862 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); | 860 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); |
863 | } | 861 | } |
864 | 862 | ||
865 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 863 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
866 | qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); | 864 | qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); |
867 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); | 865 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); |
868 | 866 | ||
869 | } | 867 | } |
870 | 868 | ||
871 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 869 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
872 | qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); | 870 | qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); |
873 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); | 871 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); |
874 | } | 872 | } |
875 | 873 | ||
876 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 874 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
877 | qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); | 875 | qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); |
878 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); | 876 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); |
879 | } | 877 | } |
880 | 878 | ||
881 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 879 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
882 | 880 | ||
883 | if ( cmbAddress->currentItem() == 0 ) { | 881 | if ( cmbAddress->currentItem() == 0 ) { |
884 | slBusinessAddress[0] = textChanged; | 882 | slBusinessAddress[0] = textChanged; |
885 | } else { | 883 | } else { |
886 | slHomeAddress[0] = textChanged; | 884 | slHomeAddress[0] = textChanged; |
887 | } | 885 | } |
888 | } | 886 | } |
889 | 887 | ||
890 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 888 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
891 | 889 | ||
892 | if ( cmbAddress->currentItem() == 0 ) { | 890 | if ( cmbAddress->currentItem() == 0 ) { |
893 | slBusinessAddress[1] = textChanged; | 891 | slBusinessAddress[1] = textChanged; |
894 | } else { | 892 | } else { |
895 | slHomeAddress[1] = textChanged; | 893 | slHomeAddress[1] = textChanged; |
896 | } | 894 | } |
897 | } | 895 | } |
898 | 896 | ||
899 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 897 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
900 | 898 | ||
901 | if ( cmbAddress->currentItem() == 0 ) { | 899 | if ( cmbAddress->currentItem() == 0 ) { |
902 | slBusinessAddress[2] = textChanged; | 900 | slBusinessAddress[2] = textChanged; |
903 | } else { | 901 | } else { |
904 | slHomeAddress[2] = textChanged; | 902 | slHomeAddress[2] = textChanged; |
905 | } | 903 | } |
906 | } | 904 | } |
907 | 905 | ||
908 | void ContactEditor::slotCityChange( const QString &textChanged ) { | 906 | void ContactEditor::slotCityChange( const QString &textChanged ) { |
909 | 907 | ||
910 | if ( cmbAddress->currentItem() == 0 ) { | 908 | if ( cmbAddress->currentItem() == 0 ) { |
911 | slBusinessAddress[3] = textChanged; | 909 | slBusinessAddress[3] = textChanged; |
912 | } else { | 910 | } else { |
913 | slHomeAddress[3] = textChanged; | 911 | slHomeAddress[3] = textChanged; |
914 | } | 912 | } |
915 | } | 913 | } |
916 | 914 | ||
917 | void ContactEditor::slotStateChange( const QString &textChanged ) { | 915 | void ContactEditor::slotStateChange( const QString &textChanged ) { |
918 | 916 | ||
919 | 917 | ||
920 | if ( cmbAddress->currentItem() == 0 ) { | 918 | if ( cmbAddress->currentItem() == 0 ) { |
921 | slBusinessAddress[4] = textChanged; | 919 | slBusinessAddress[4] = textChanged; |
922 | } else { | 920 | } else { |
923 | slHomeAddress[4] = textChanged; | 921 | slHomeAddress[4] = textChanged; |
924 | } | 922 | } |
925 | } | 923 | } |
926 | 924 | ||
927 | void ContactEditor::slotZipChange( const QString &textChanged ) { | 925 | void ContactEditor::slotZipChange( const QString &textChanged ) { |
928 | 926 | ||
929 | if ( cmbAddress->currentItem() == 0 ) { | 927 | if ( cmbAddress->currentItem() == 0 ) { |
930 | slBusinessAddress[5] = textChanged; | 928 | slBusinessAddress[5] = textChanged; |
931 | } else { | 929 | } else { |
932 | slHomeAddress[5] = textChanged; | 930 | slHomeAddress[5] = textChanged; |
933 | } | 931 | } |
934 | } | 932 | } |
935 | 933 | ||
936 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 934 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
937 | 935 | ||
938 | if ( cmbAddress->currentItem() == 0 ) { | 936 | if ( cmbAddress->currentItem() == 0 ) { |
939 | slBusinessAddress[6] = textChanged; | 937 | slBusinessAddress[6] = textChanged; |
940 | } else { | 938 | } else { |
941 | slHomeAddress[6] = textChanged; | 939 | slHomeAddress[6] = textChanged; |
942 | } | 940 | } |
943 | } | 941 | } |
944 | 942 | ||
945 | 943 | ||
946 | void ContactEditor::slotCmbChooser1Change( int index ) { | 944 | void ContactEditor::slotCmbChooser1Change( int index ) { |
947 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); | 945 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); |
948 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ | 946 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ |
949 | 947 | ||
950 | txtChooserField1->setText( slChooserValues[index] ); | 948 | txtChooserField1->setText( slChooserValues[index] ); |
951 | txtChooserField1->setFocus(); | 949 | txtChooserField1->setFocus(); |
952 | 950 | ||
953 | } | 951 | } |
954 | 952 | ||
955 | } | 953 | } |
956 | 954 | ||
957 | void ContactEditor::slotCmbChooser2Change( int index ) { | 955 | void ContactEditor::slotCmbChooser2Change( int index ) { |
958 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); | 956 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); |
959 | 957 | ||
960 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ | 958 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ |
961 | 959 | ||
962 | txtChooserField2->setText( slChooserValues[index] ); | 960 | txtChooserField2->setText( slChooserValues[index] ); |
963 | txtChooserField2->setFocus(); | 961 | txtChooserField2->setFocus(); |
964 | 962 | ||
965 | } | 963 | } |
966 | } | 964 | } |
967 | 965 | ||
968 | void ContactEditor::slotCmbChooser3Change( int index ) { | 966 | void ContactEditor::slotCmbChooser3Change( int index ) { |
969 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); | 967 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); |
970 | 968 | ||
971 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ | 969 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ |
972 | 970 | ||
973 | txtChooserField3->setText( slChooserValues[index] ); | 971 | txtChooserField3->setText( slChooserValues[index] ); |
974 | txtChooserField3->setFocus(); | 972 | txtChooserField3->setFocus(); |
975 | 973 | ||
976 | } | 974 | } |
977 | } | 975 | } |
978 | 976 | ||
979 | void ContactEditor::slotCmbChooser4Change( int index ) { | 977 | void ContactEditor::slotCmbChooser4Change( int index ) { |
980 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); | 978 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); |
981 | 979 | ||
982 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ | 980 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ |
983 | 981 | ||
984 | txtChooserField4->setText( slChooserValues[index] ); | 982 | txtChooserField4->setText( slChooserValues[index] ); |
985 | txtChooserField4->setFocus(); | 983 | txtChooserField4->setFocus(); |
986 | 984 | ||
987 | } | 985 | } |
988 | } | 986 | } |
989 | 987 | ||
990 | void ContactEditor::slotAddressTypeChange( int index ) { | 988 | void ContactEditor::slotAddressTypeChange( int index ) { |
991 | 989 | ||
992 | 990 | ||
993 | if ( !initializing ) | 991 | if ( !initializing ) |
994 | contactfields.setFieldOrder( 4, index ); | 992 | contactfields.setFieldOrder( 4, index ); |
995 | 993 | ||
996 | 994 | ||
997 | if ( index == 0 ) { | 995 | if ( index == 0 ) { |
998 | 996 | ||
999 | txtAddress->setText( slBusinessAddress[0] ); | 997 | txtAddress->setText( slBusinessAddress[0] ); |
1000 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 998 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
1001 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 999 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
1002 | txtCity->setText( slBusinessAddress[3] ); | 1000 | txtCity->setText( slBusinessAddress[3] ); |
1003 | txtState->setText( slBusinessAddress[4] ); | 1001 | txtState->setText( slBusinessAddress[4] ); |
1004 | txtZip->setText( slBusinessAddress[5] ); | 1002 | txtZip->setText( slBusinessAddress[5] ); |
1005 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1003 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1006 | txtTmp->setText( slBusinessAddress[6] ); | 1004 | txtTmp->setText( slBusinessAddress[6] ); |
1007 | 1005 | ||
1008 | } else { | 1006 | } else { |
1009 | 1007 | ||
1010 | txtAddress->setText( slHomeAddress[0] ); | 1008 | txtAddress->setText( slHomeAddress[0] ); |
1011 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 1009 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
1012 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 1010 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
1013 | txtCity->setText( slHomeAddress[3] ); | 1011 | txtCity->setText( slHomeAddress[3] ); |
1014 | txtState->setText( slHomeAddress[4] ); | 1012 | txtState->setText( slHomeAddress[4] ); |
1015 | txtZip->setText( slHomeAddress[5] ); | 1013 | txtZip->setText( slHomeAddress[5] ); |
1016 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1014 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1017 | txtTmp->setText( slHomeAddress[6] ); | 1015 | txtTmp->setText( slHomeAddress[6] ); |
1018 | 1016 | ||
1019 | } | 1017 | } |
1020 | 1018 | ||
1021 | } | 1019 | } |
1022 | 1020 | ||
1023 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 1021 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
1024 | 1022 | ||
1025 | qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() ); | 1023 | qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() ); |
1026 | 1024 | ||
1027 | int index = cmbFileAs->currentItem(); | 1025 | int index = cmbFileAs->currentItem(); |
1028 | 1026 | ||
1029 | cmbFileAs->clear(); | 1027 | cmbFileAs->clear(); |
1030 | 1028 | ||
1031 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); | 1029 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); |
1032 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); | 1030 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); |
1033 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); | 1031 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); |
1034 | cmbFileAs->insertItem( parseName( textChanged, NAME_FMLS ) ); | 1032 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); |
1033 | if ( ! txtSuffix->text().isEmpty() ) | ||
1034 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); | ||
1035 | 1035 | ||
1036 | cmbFileAs->setCurrentItem( index ); | 1036 | cmbFileAs->setCurrentItem( index ); |
1037 | 1037 | ||
1038 | useFullName = true; | ||
1039 | 1038 | ||
1040 | } | 1039 | } |
1041 | 1040 | ||
1042 | void ContactEditor::slotSuffixChange( const QString& ) { | 1041 | void ContactEditor::slotSuffixChange( const QString& ) { |
1043 | // Just want to update the FileAs combo if the suffix was changed.. | 1042 | // Just want to update the FileAs combo if the suffix was changed.. |
1044 | slotFullNameChange( txtFullName->text() ); | 1043 | slotFullNameChange( txtFullName->text() ); |
1045 | } | 1044 | } |
1046 | 1045 | ||
1047 | void ContactEditor::accept() { | 1046 | void ContactEditor::accept() { |
1048 | 1047 | ||
1049 | if ( isEmpty() ) { | 1048 | if ( isEmpty() ) { |
1050 | cleanupFields(); | 1049 | cleanupFields(); |
1051 | reject(); | 1050 | reject(); |
1052 | } else { | 1051 | } else { |
1053 | saveEntry(); | 1052 | saveEntry(); |
1054 | cleanupFields(); | 1053 | cleanupFields(); |
1055 | QDialog::accept(); | 1054 | QDialog::accept(); |
1056 | } | 1055 | } |
1057 | 1056 | ||
1058 | } | 1057 | } |
1059 | 1058 | ||
1060 | void ContactEditor::slotNote() { | 1059 | void ContactEditor::slotNote() { |
1061 | 1060 | ||
1062 | dlgNote->showMaximized(); | 1061 | dlgNote->showMaximized(); |
1063 | if ( !dlgNote->exec() ) { | 1062 | if ( !dlgNote->exec() ) { |
1064 | txtNote->setText( ent.notes() ); | 1063 | txtNote->setText( ent.notes() ); |
1065 | } | 1064 | } |
1066 | } | 1065 | } |
1067 | 1066 | ||
1068 | void ContactEditor::slotName() { | 1067 | void ContactEditor::slotName() { |
1069 | 1068 | ||
1070 | QString tmpName; | 1069 | QString tmpName; |
1071 | if (useFullName) { | 1070 | |
1072 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1071 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
1073 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1072 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
1074 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1073 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1075 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1074 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1076 | } | 1075 | |
1077 | dlgName->showMaximized(); | 1076 | dlgName->showMaximized(); |
1078 | if ( dlgName->exec() ) { | 1077 | if ( dlgName->exec() ) { |
1078 | if ( txtLastName->text().contains( ' ', TRUE ) ) | ||
1079 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); | ||
1080 | else | ||
1081 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); | ||
1079 | 1082 | ||
1080 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); | ||
1081 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 1083 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
1082 | slotFullNameChange( txtFullName->text() ); | 1084 | slotFullNameChange( txtFullName->text() ); |
1083 | useFullName = false; | ||
1084 | } | 1085 | } |
1085 | 1086 | ||
1086 | } | 1087 | } |
1087 | 1088 | ||
1088 | void ContactEditor::setNameFocus() { | 1089 | void ContactEditor::setNameFocus() { |
1089 | 1090 | ||
1090 | txtFullName->setFocus(); | 1091 | txtFullName->setFocus(); |
1091 | 1092 | ||
1092 | } | 1093 | } |
1093 | 1094 | ||
1094 | bool ContactEditor::isEmpty() { | 1095 | bool ContactEditor::isEmpty() { |
1095 | // Test and see if the record should be saved. | 1096 | // Test and see if the record should be saved. |
1096 | // More strict than the original qtopia, needs name or fileas to save | 1097 | // More strict than the original qtopia, needs name or fileas to save |
1097 | 1098 | ||
1098 | QString t = txtFullName->text(); | 1099 | QString t = txtFullName->text(); |
1099 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1100 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1100 | return false; | 1101 | return false; |
1101 | 1102 | ||
1102 | t = cmbFileAs->currentText(); | 1103 | t = cmbFileAs->currentText(); |
1103 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1104 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1104 | return false; | 1105 | return false; |
1105 | 1106 | ||
1106 | return true; | 1107 | return true; |
1107 | 1108 | ||
1108 | } | 1109 | } |
1109 | 1110 | ||
1110 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1111 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1111 | 1112 | ||
1112 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1113 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1113 | QString strFirstName; | 1114 | QString strFirstName; |
1114 | QString strMiddleName; | 1115 | QString strMiddleName; |
1115 | QString strLastName; | 1116 | QString strLastName; |
1116 | QString strTitle; | 1117 | QString strTitle; |
1117 | int commapos; | 1118 | int commapos; |
1118 | bool haveLastName = false; | 1119 | bool haveLastName = false; |
1119 | 1120 | ||
1120 | qWarning("Fullname: %s", simplifiedName.latin1()); | 1121 | qWarning("Fullname: %s", simplifiedName.latin1()); |
1121 | 1122 | ||
1122 | commapos = simplifiedName.find( ',', 0, TRUE); | 1123 | commapos = simplifiedName.find( ',', 0, TRUE); |
1123 | if ( commapos >= 0 ) { | 1124 | if ( commapos >= 0 ) { |
1124 | qWarning(" Commapos: %d", commapos ); | 1125 | qWarning(" Commapos: %d", commapos ); |
1125 | 1126 | ||
1126 | // A comma (",") separates the lastname from one or | 1127 | // A comma (",") separates the lastname from one or |
1127 | // many first names. Thus, remove the lastname from the | 1128 | // many first names. Thus, remove the lastname from the |
1128 | // String and parse the firstnames. | 1129 | // String and parse the firstnames. |
1129 | 1130 | ||
1130 | strLastName = simplifiedName.left( commapos ); | 1131 | strLastName = simplifiedName.left( commapos ); |
1131 | simplifiedName= simplifiedName.mid( commapos + 1 ); | 1132 | simplifiedName= simplifiedName.mid( commapos + 1 ); |
1132 | haveLastName = true; | 1133 | haveLastName = true; |
1133 | qWarning("Fullname without ',': %s", simplifiedName.latin1()); | 1134 | qWarning("Fullname without ',': %s", simplifiedName.latin1()); |
1134 | 1135 | ||
1135 | // If we have any lastname, we should now split all first names. | 1136 | // If we have any lastname, we should now split all first names. |
1136 | // The first one will be the used as first, the rest as "middle names" | 1137 | // The first one will be the used as first, the rest as "middle names" |
1137 | 1138 | ||
1138 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); | 1139 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); |
1139 | QStringList::Iterator it = allFirstNames.begin(); | 1140 | QStringList::Iterator it = allFirstNames.begin(); |
1140 | strFirstName = *it++; | 1141 | strFirstName = *it++; |
1141 | QStringList allSecondNames; | 1142 | QStringList allSecondNames; |
1142 | for ( ; it != allFirstNames.end(); ++it ) | 1143 | for ( ; it != allFirstNames.end(); ++it ) |
1143 | allSecondNames.append( *it ); | 1144 | allSecondNames.append( *it ); |
1144 | 1145 | ||
1145 | strMiddleName = allSecondNames.join(" "); | 1146 | strMiddleName = allSecondNames.join(" "); |
1146 | 1147 | ||
1147 | } else { | 1148 | } else { |
1148 | 1149 | ||
1149 | // No comma separator used: We use the first word as firstname, the | 1150 | // No comma separator used: We use the first word as firstname, the |
1150 | // last as second/lastname and everything in the middle as middlename | 1151 | // last as second/lastname and everything in the middle as middlename |
1151 | 1152 | ||
1152 | QStringList allNames = QStringList::split(" ", simplifiedName); | 1153 | QStringList allNames = QStringList::split(" ", simplifiedName); |
1153 | QStringList::Iterator it = allNames.begin(); | 1154 | QStringList::Iterator it = allNames.begin(); |
1154 | strFirstName = *it++; | 1155 | strFirstName = *it++; |
1155 | QStringList allSecondNames; | 1156 | QStringList allSecondNames; |
1156 | for ( ; it != --allNames.end(); ++it ) | 1157 | for ( ; it != --allNames.end(); ++it ) |
1157 | allSecondNames.append( *it ); | 1158 | allSecondNames.append( *it ); |
1158 | 1159 | ||
1159 | strMiddleName = allSecondNames.join(" "); | 1160 | strMiddleName = allSecondNames.join(" "); |
1160 | strLastName = *(--allNames.end()); | 1161 | strLastName = *(--allNames.end()); |
1161 | 1162 | ||
1162 | } | 1163 | } |
1163 | 1164 | ||
1164 | if ( strFirstName == strLastName ) | 1165 | if ( strFirstName == strLastName ) |
1165 | strFirstName = ""; | 1166 | strFirstName = ""; |
1166 | 1167 | ||
1167 | qWarning(" strFirstName: %s", strFirstName.latin1()); | 1168 | qWarning(" strFirstName: %s", strFirstName.latin1()); |
1168 | qWarning(" strMiddleName: %s", strMiddleName.latin1()); | 1169 | qWarning(" strMiddleName: %s", strMiddleName.latin1()); |
1169 | qWarning(" strLastName: %s", strLastName.latin1()); | 1170 | qWarning(" strLastName: %s", strLastName.latin1()); |
1170 | qWarning(" strTitle: %s", strTitle.latin1()); | 1171 | qWarning(" strTitle: %s", strTitle.latin1()); |
1171 | 1172 | ||
1172 | switch (type) { | 1173 | switch (type) { |
1173 | case NAME_FL: | 1174 | case NAME_FL: |
1174 | return strFirstName + " " + strLastName; | 1175 | return strFirstName + " " + strLastName; |
1175 | 1176 | ||
1176 | case NAME_LF: | 1177 | case NAME_LF: |
1177 | return strLastName + ", " + strFirstName; | 1178 | return strLastName + ", " + strFirstName; |
1178 | 1179 | ||
1179 | case NAME_LFM: | 1180 | case NAME_LFM: |
1180 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 1181 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
1181 | 1182 | ||
1182 | case NAME_FMLS: | 1183 | case NAME_FML: |
1183 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + txtSuffix->text(); | 1184 | return strFirstName + " " + strMiddleName + " " + strLastName ; |
1184 | 1185 | ||
1185 | case NAME_F: | 1186 | case NAME_F: |
1186 | return strFirstName; | 1187 | return strFirstName; |
1187 | 1188 | ||
1188 | case NAME_M: | 1189 | case NAME_M: |
1189 | return strMiddleName; | 1190 | return strMiddleName; |
1190 | 1191 | ||
1191 | case NAME_L: | 1192 | case NAME_L: |
1192 | return strLastName; | 1193 | return strLastName; |
1193 | 1194 | ||
1194 | case NAME_S: | 1195 | case NAME_S: |
1195 | return txtSuffix->text(); | 1196 | return txtSuffix->text(); |
1196 | 1197 | ||
1197 | } | 1198 | } |
1198 | return QString::null; | 1199 | return QString::null; |
1199 | } | 1200 | } |
1200 | 1201 | ||
1201 | void ContactEditor::cleanupFields() { | 1202 | void ContactEditor::cleanupFields() { |
1202 | QStringList::Iterator it = slChooserValues.begin(); | 1203 | QStringList::Iterator it = slChooserValues.begin(); |
1203 | 1204 | ||
1204 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { | 1205 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { |
1205 | (*it) = ""; | 1206 | (*it) = ""; |
1206 | } | 1207 | } |
1207 | 1208 | ||
1208 | for ( int i = 0; i < 7; i++ ) { | 1209 | for ( int i = 0; i < 7; i++ ) { |
1209 | slHomeAddress[i] = ""; | 1210 | slHomeAddress[i] = ""; |
1210 | slBusinessAddress[i] = ""; | 1211 | slBusinessAddress[i] = ""; |
1211 | } | 1212 | } |
1212 | 1213 | ||
1213 | QListIterator<QLineEdit> itLV( listValue ); | 1214 | QListIterator<QLineEdit> itLV( listValue ); |
1214 | for ( ; itLV.current(); ++itLV ) { | 1215 | for ( ; itLV.current(); ++itLV ) { |
1215 | (*itLV)->setText( "" ); | 1216 | (*itLV)->setText( "" ); |
1216 | } | 1217 | } |
1217 | 1218 | ||
1218 | txtFirstName->setText(""); | 1219 | txtFirstName->setText(""); |
1219 | txtMiddleName->setText(""); | 1220 | txtMiddleName->setText(""); |
1220 | txtLastName->setText(""); | 1221 | txtLastName->setText(""); |
1221 | txtSuffix->setText(""); | 1222 | txtSuffix->setText(""); |
1222 | txtNote->setText(""); | 1223 | txtNote->setText(""); |
1223 | txtFullName->setText(""); | 1224 | txtFullName->setText(""); |
1224 | txtJobTitle->setText(""); | 1225 | txtJobTitle->setText(""); |
1225 | txtOrganization->setText(""); | 1226 | txtOrganization->setText(""); |
1226 | txtChooserField1->setText(""); | 1227 | txtChooserField1->setText(""); |
1227 | txtChooserField2->setText(""); | 1228 | txtChooserField2->setText(""); |
1228 | txtChooserField3->setText(""); | 1229 | txtChooserField3->setText(""); |
1229 | txtAddress->setText(""); | 1230 | txtAddress->setText(""); |
1230 | txtCity->setText(""); | 1231 | txtCity->setText(""); |
1231 | txtState->setText(""); | 1232 | txtState->setText(""); |
1232 | txtZip->setText(""); | 1233 | txtZip->setText(""); |
1233 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1234 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1234 | txtTmp->setText(""); | 1235 | txtTmp->setText(""); |
1235 | txtTmp = cmbFileAs->lineEdit(); | 1236 | txtTmp = cmbFileAs->lineEdit(); |
1236 | txtTmp->setText(""); | 1237 | txtTmp->setText(""); |
1237 | 1238 | ||
1238 | } | 1239 | } |
1239 | 1240 | ||
1240 | void ContactEditor::setEntry( const OContact &entry ) { | 1241 | void ContactEditor::setEntry( const OContact &entry ) { |
1241 | 1242 | ||
1242 | initializing = true; | 1243 | initializing = true; |
1243 | 1244 | ||
1244 | cleanupFields(); | 1245 | cleanupFields(); |
1245 | 1246 | ||
1246 | ent = entry; | 1247 | ent = entry; |
1247 | 1248 | ||
1248 | emails = QStringList(ent.emailList()); | 1249 | emails = QStringList(ent.emailList()); |
1249 | defaultEmail = ent.defaultEmail(); | 1250 | defaultEmail = ent.defaultEmail(); |
1250 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; | 1251 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; |
1251 | qDebug("default email=%s",defaultEmail.latin1()); | 1252 | qDebug("default email=%s",defaultEmail.latin1()); |
1252 | 1253 | ||
1253 | useFullName = false; | ||
1254 | txtFirstName->setText( ent.firstName() ); | 1254 | txtFirstName->setText( ent.firstName() ); |
1255 | txtMiddleName->setText( ent.middleName() ); | 1255 | txtMiddleName->setText( ent.middleName() ); |
1256 | txtLastName->setText( ent.lastName() ); | 1256 | txtLastName->setText( ent.lastName() ); |
1257 | txtSuffix->setText( ent.suffix() ); | 1257 | txtSuffix->setText( ent.suffix() ); |
1258 | 1258 | ||
1259 | // QString *tmpString = new QString; | 1259 | // QString *tmpString = new QString; |
1260 | // *tmpString = ent.firstName() + " " + ent.middleName() + | 1260 | // *tmpString = ent.firstName() + " " + ent.middleName() + |
1261 | // + " " + ent.lastName() + " " + ent.suffix(); | 1261 | // + " " + ent.lastName() + " " + ent.suffix(); |
1262 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1262 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1263 | 1263 | ||
1264 | // Lastnames with multiple words need to be protected by a comma ! | 1264 | if ( !ent.isEmpty() ){ |
1265 | if ( ent.lastName().contains( ' ', TRUE ) ) | 1265 | // Lastnames with multiple words need to be protected by a comma ! |
1266 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); | 1266 | if ( ent.lastName().contains( ' ', TRUE ) ) |
1267 | else | 1267 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); |
1268 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); | 1268 | else |
1269 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); | ||
1270 | } | ||
1269 | 1271 | ||
1270 | cmbFileAs->setEditText( ent.fileAs() ); | 1272 | cmbFileAs->setEditText( ent.fileAs() ); |
1271 | 1273 | ||
1272 | //if (hasTitle) | 1274 | //if (hasTitle) |
1273 | txtJobTitle->setText( ent.jobTitle() ); | 1275 | txtJobTitle->setText( ent.jobTitle() ); |
1274 | 1276 | ||
1275 | //if (hasCompany) | 1277 | //if (hasCompany) |
1276 | txtOrganization->setText( ent.company() ); | 1278 | txtOrganization->setText( ent.company() ); |
1277 | 1279 | ||
1278 | //if (hasNotes) | 1280 | //if (hasNotes) |
1279 | txtNote->setText( ent.notes() ); | 1281 | txtNote->setText( ent.notes() ); |
1280 | 1282 | ||
1281 | //if (hasStreet) { | 1283 | //if (hasStreet) { |
1282 | slHomeAddress[0] = ent.homeStreet(); | 1284 | slHomeAddress[0] = ent.homeStreet(); |
1283 | slBusinessAddress[0] = ent.businessStreet(); | 1285 | slBusinessAddress[0] = ent.businessStreet(); |
1284 | //} | 1286 | //} |
1285 | 1287 | ||
1286 | //if (hasCity) { | 1288 | //if (hasCity) { |
1287 | slHomeAddress[3] = ent.homeCity(); | 1289 | slHomeAddress[3] = ent.homeCity(); |
1288 | slBusinessAddress[3] = ent.businessCity(); | 1290 | slBusinessAddress[3] = ent.businessCity(); |
1289 | //} | 1291 | //} |
1290 | 1292 | ||
1291 | //if (hasState) { | 1293 | //if (hasState) { |
1292 | slHomeAddress[4] = ent.homeState(); | 1294 | slHomeAddress[4] = ent.homeState(); |
1293 | slBusinessAddress[4] = ent.businessState(); | 1295 | slBusinessAddress[4] = ent.businessState(); |
1294 | //} | 1296 | //} |
1295 | 1297 | ||
1296 | //if (hasZip) { | 1298 | //if (hasZip) { |
1297 | slHomeAddress[5] = ent.homeZip(); | 1299 | slHomeAddress[5] = ent.homeZip(); |
1298 | slBusinessAddress[5] = ent.businessZip(); | 1300 | slBusinessAddress[5] = ent.businessZip(); |
1299 | //} | 1301 | //} |
1300 | 1302 | ||
1301 | //if (hasCountry) { | 1303 | //if (hasCountry) { |
1302 | slHomeAddress[6] = ent.homeCountry(); | 1304 | slHomeAddress[6] = ent.homeCountry(); |
1303 | slBusinessAddress[6] = ent.businessCountry(); | 1305 | slBusinessAddress[6] = ent.businessCountry(); |
1304 | //} | 1306 | //} |
1305 | 1307 | ||
1306 | QStringList::ConstIterator it; | 1308 | QStringList::ConstIterator it; |
1307 | QListIterator<QLineEdit> itLE( listValue ); | 1309 | QListIterator<QLineEdit> itLE( listValue ); |
1308 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { | 1310 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { |
1309 | 1311 | ||
1310 | qWarning(" Filling dynamic Field: %s", (*it).latin1() ); | 1312 | qWarning(" Filling dynamic Field: %s", (*it).latin1() ); |
1311 | 1313 | ||
1312 | if ( *it == "Department" ) | 1314 | if ( *it == "Department" ) |
1313 | (*itLE)->setText( ent.department() ); | 1315 | (*itLE)->setText( ent.department() ); |
1314 | 1316 | ||
1315 | if ( *it == "Company" ) | 1317 | if ( *it == "Company" ) |
1316 | (*itLE)->setText( ent.company() ); | 1318 | (*itLE)->setText( ent.company() ); |
1317 | 1319 | ||
1318 | if ( *it == "Office" ) | 1320 | if ( *it == "Office" ) |
1319 | (*itLE)->setText( ent.office() ); | 1321 | (*itLE)->setText( ent.office() ); |
1320 | 1322 | ||
1321 | if ( *it == "Profession" ) | 1323 | if ( *it == "Profession" ) |
1322 | (*itLE)->setText( ent.profession() ); | 1324 | (*itLE)->setText( ent.profession() ); |
1323 | 1325 | ||
1324 | if ( *it == "Assistant" ) | 1326 | if ( *it == "Assistant" ) |
1325 | (*itLE)->setText( ent.assistant() ); | 1327 | (*itLE)->setText( ent.assistant() ); |
1326 | 1328 | ||
1327 | if ( *it == "Manager" ) | 1329 | if ( *it == "Manager" ) |
1328 | (*itLE)->setText( ent.manager() ); | 1330 | (*itLE)->setText( ent.manager() ); |
1329 | 1331 | ||
1330 | if ( *it == "Spouse" ) | 1332 | if ( *it == "Spouse" ) |
1331 | (*itLE)->setText( ent.spouse() ); | 1333 | (*itLE)->setText( ent.spouse() ); |
1332 | 1334 | ||
1333 | if ( *it == "Nickname" ){ | 1335 | if ( *it == "Nickname" ){ |
1334 | qWarning("**** Nichname: %s", ent.nickname().latin1() ); | 1336 | qWarning("**** Nichname: %s", ent.nickname().latin1() ); |
1335 | (*itLE)->setText( ent.nickname() ); | 1337 | (*itLE)->setText( ent.nickname() ); |
1336 | } | 1338 | } |
1337 | 1339 | ||
1338 | if ( *it == "Children" ) | 1340 | if ( *it == "Children" ) |
1339 | (*itLE)->setText( ent.children() ); | 1341 | (*itLE)->setText( ent.children() ); |
1340 | 1342 | ||
1341 | } | 1343 | } |
1342 | 1344 | ||
1343 | QStringList::Iterator itV; | 1345 | QStringList::Iterator itV; |
1344 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1346 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1345 | 1347 | ||
1346 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) | 1348 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) |
1347 | *itV = ent.businessPhone(); | 1349 | *itV = ent.businessPhone(); |
1348 | /* | 1350 | /* |
1349 | if ( *it == "Business 2 Phone" ) | 1351 | if ( *it == "Business 2 Phone" ) |
1350 | *itV = ent.business2Phone(); | 1352 | *itV = ent.business2Phone(); |
1351 | */ | 1353 | */ |
1352 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) | 1354 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) |
1353 | *itV = ent.businessFax(); | 1355 | *itV = ent.businessFax(); |
1354 | 1356 | ||
1355 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) | 1357 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) |
1356 | *itV = ent.businessMobile(); | 1358 | *itV = ent.businessMobile(); |
1357 | /* | 1359 | /* |
1358 | if ( *it == "Company Phone" ) | 1360 | if ( *it == "Company Phone" ) |
1359 | *itV = ent.companyPhone(); | 1361 | *itV = ent.companyPhone(); |
1360 | */ | 1362 | */ |
1361 | if ( *it == "Default Email" ) | 1363 | if ( *it == "Default Email" ) |
1362 | *itV = ent.defaultEmail(); | 1364 | *itV = ent.defaultEmail(); |
1363 | 1365 | ||
1364 | if ( *it == "Emails" ) | 1366 | if ( *it == "Emails" ) |
1365 | *itV = ent.emailList().join(", "); // :SX | 1367 | *itV = ent.emailList().join(", "); // :SX |
1366 | 1368 | ||
1367 | if ( *it == "Home Phone" ) | 1369 | if ( *it == "Home Phone" ) |
1368 | *itV = ent.homePhone(); | 1370 | *itV = ent.homePhone(); |
1369 | /* | 1371 | /* |
1370 | if ( *it == "Home 2 Phone" ) | 1372 | if ( *it == "Home 2 Phone" ) |
1371 | *itV = ent.home2Phone(); | 1373 | *itV = ent.home2Phone(); |
1372 | */ | 1374 | */ |
1373 | if ( *it == "Home Fax" ) | 1375 | if ( *it == "Home Fax" ) |
1374 | *itV = ent.homeFax(); | 1376 | *itV = ent.homeFax(); |
1375 | 1377 | ||
1376 | if ( *it == "Home Mobile" ) | 1378 | if ( *it == "Home Mobile" ) |
1377 | *itV = ent.homeMobile(); | 1379 | *itV = ent.homeMobile(); |
1378 | /* | 1380 | /* |
1379 | if ( *it == "Car Phone" ) | 1381 | if ( *it == "Car Phone" ) |
1380 | *itV = ent.carPhone(); | 1382 | *itV = ent.carPhone(); |
1381 | 1383 | ||
1382 | if ( *it == "ISDN Phone" ) | 1384 | if ( *it == "ISDN Phone" ) |
1383 | *itV = ent.ISDNPhone(); | 1385 | *itV = ent.ISDNPhone(); |
1384 | 1386 | ||
1385 | if ( *it == "Other Phone" ) | 1387 | if ( *it == "Other Phone" ) |
1386 | *itV = ent.otherPhone(); | 1388 | *itV = ent.otherPhone(); |
1387 | */ | 1389 | */ |
1388 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1390 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1389 | *itV = ent.businessPager(); | 1391 | *itV = ent.businessPager(); |
1390 | /* | 1392 | /* |
1391 | if ( *it == "Home Pager") | 1393 | if ( *it == "Home Pager") |
1392 | *itV = ent.homePager(); | 1394 | *itV = ent.homePager(); |
1393 | 1395 | ||
1394 | if ( *it == "AIM IM" ) | 1396 | if ( *it == "AIM IM" ) |
1395 | *itV = ent.AIMIM(); | 1397 | *itV = ent.AIMIM(); |
1396 | 1398 | ||
1397 | if ( *it == "ICQ IM" ) | 1399 | if ( *it == "ICQ IM" ) |
1398 | *itV = ent.ICQIM(); | 1400 | *itV = ent.ICQIM(); |
1399 | 1401 | ||
1400 | if ( *it == "Jabber IM" ) | 1402 | if ( *it == "Jabber IM" ) |
1401 | *itV = ent.jabberIM(); | 1403 | *itV = ent.jabberIM(); |
1402 | 1404 | ||
1403 | if ( *it == "MSN IM" ) | 1405 | if ( *it == "MSN IM" ) |
1404 | *itV = ent.MSNIM(); | 1406 | *itV = ent.MSNIM(); |
1405 | 1407 | ||
1406 | if ( *it == "Yahoo IM" ) | 1408 | if ( *it == "Yahoo IM" ) |
1407 | *itV = ent.yahooIM(); | 1409 | *itV = ent.yahooIM(); |
1408 | */ | 1410 | */ |
1409 | if ( *it == "Home Web Page" ) | 1411 | if ( *it == "Home Web Page" ) |
1410 | *itV = ent.homeWebpage(); | 1412 | *itV = ent.homeWebpage(); |
1411 | 1413 | ||
1412 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1414 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1413 | *itV = ent.businessWebpage(); | 1415 | *itV = ent.businessWebpage(); |
1414 | 1416 | ||
1415 | 1417 | ||
1416 | } | 1418 | } |
1417 | 1419 | ||
1418 | 1420 | ||
1419 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1421 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1420 | 1422 | ||
1421 | QString gender = ent.gender(); | 1423 | QString gender = ent.gender(); |
1422 | cmbGender->setCurrentItem( gender.toInt() ); | 1424 | cmbGender->setCurrentItem( gender.toInt() ); |
1423 | 1425 | ||
1424 | txtNote->setText( ent.notes() ); | 1426 | txtNote->setText( ent.notes() ); |
1425 | 1427 | ||
1426 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1428 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1427 | 1429 | ||
1428 | // Calling "show()" to arrange all widgets. Otherwise we will get | ||
1429 | // a wrong position of the textfields and are unable to put our | ||
1430 | // default-email combo over it.. This is very ugly ! | ||
1431 | // Does anybody has a better solution ? | ||
1432 | // Basically we should rethink the strategy to hide | ||
1433 | // a textfield with overwriting.. (se) | ||
1434 | show(); | ||
1435 | |||
1436 | // Get combo-settings from contact and set preset.. | 1430 | // Get combo-settings from contact and set preset.. |
1437 | contactfields.loadFromRecord( ent ); | 1431 | contactfields.loadFromRecord( ent ); |
1438 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); | 1432 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); |
1439 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); | 1433 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); |
1440 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); | 1434 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); |
1441 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); | 1435 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); |
1442 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); | 1436 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); |
1443 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1437 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
1444 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1438 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1445 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1439 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1446 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); | 1440 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); |
1447 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1441 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1448 | 1442 | ||
1449 | updateDatePicker(); | 1443 | updateDatePicker(); |
1450 | 1444 | ||
1451 | initializing = false; | 1445 | initializing = false; |
1452 | } | 1446 | } |
1453 | void ContactEditor::updateDatePicker() | 1447 | void ContactEditor::updateDatePicker() |
1454 | { | 1448 | { |
1455 | // Set DatePicker | 1449 | // Set DatePicker |
1456 | if ( !ent.birthday().isNull() ){ | 1450 | if ( !ent.birthday().isNull() ){ |
1457 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); | 1451 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); |
1458 | birthdayPicker->setDate( ent.birthday() ); | 1452 | birthdayPicker->setDate( ent.birthday() ); |
1459 | } else | 1453 | } else |
1460 | birthdayButton->setText( tr ("Unknown") ); | 1454 | birthdayButton->setText( tr ("Unknown") ); |
1461 | 1455 | ||
1462 | if ( !ent.anniversary().isNull() ){ | 1456 | if ( !ent.anniversary().isNull() ){ |
1463 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); | 1457 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); |
1464 | anniversaryPicker->setDate( ent.anniversary() ); | 1458 | anniversaryPicker->setDate( ent.anniversary() ); |
1465 | } else | 1459 | } else |
1466 | anniversaryButton->setText( tr ("Unknown") ); | 1460 | anniversaryButton->setText( tr ("Unknown") ); |
1467 | 1461 | ||
1468 | } | 1462 | } |
1469 | 1463 | ||
1470 | void ContactEditor::saveEntry() { | 1464 | void ContactEditor::saveEntry() { |
1471 | 1465 | ||
1472 | // Store current combo into contact | 1466 | // Store current combo into contact |
1473 | contactfields.saveToRecord( ent ); | 1467 | contactfields.saveToRecord( ent ); |
1474 | 1468 | ||
1475 | if ( useFullName ) { | 1469 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); |
1476 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); | 1470 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); |
1477 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); | 1471 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); |
1478 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); | 1472 | // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); |
1479 | // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); | ||
1480 | |||
1481 | useFullName = false; | ||
1482 | } | ||
1483 | 1473 | ||
1484 | ent.setFirstName( txtFirstName->text() ); | 1474 | ent.setFirstName( txtFirstName->text() ); |
1485 | ent.setLastName( txtLastName->text() ); | 1475 | ent.setLastName( txtLastName->text() ); |
1486 | ent.setMiddleName( txtMiddleName->text() ); | 1476 | ent.setMiddleName( txtMiddleName->text() ); |
1487 | ent.setSuffix( txtSuffix->text() ); | 1477 | ent.setSuffix( txtSuffix->text() ); |
1488 | 1478 | ||
1489 | ent.setFileAs( cmbFileAs->currentText() ); | 1479 | ent.setFileAs( cmbFileAs->currentText() ); |
1490 | 1480 | ||
1491 | ent.setCategories( cmbCat->currentCategories() ); | 1481 | ent.setCategories( cmbCat->currentCategories() ); |
1492 | 1482 | ||
1493 | 1483 | ||
1494 | //if (hasTitle) | 1484 | //if (hasTitle) |
1495 | ent.setJobTitle( txtJobTitle->text() ); | 1485 | ent.setJobTitle( txtJobTitle->text() ); |
1496 | 1486 | ||
1497 | //if (hasCompany) | 1487 | //if (hasCompany) |
1498 | ent.setCompany( txtOrganization->text() ); | 1488 | ent.setCompany( txtOrganization->text() ); |
1499 | 1489 | ||
1500 | //if (hasNotes) | 1490 | //if (hasNotes) |
1501 | ent.setNotes( txtNote->text() ); | 1491 | ent.setNotes( txtNote->text() ); |
1502 | 1492 | ||
1503 | //if (hasStreet) { | 1493 | //if (hasStreet) { |
1504 | ent.setHomeStreet( slHomeAddress[0] ); | 1494 | ent.setHomeStreet( slHomeAddress[0] ); |
1505 | ent.setBusinessStreet( slBusinessAddress[0] ); | 1495 | ent.setBusinessStreet( slBusinessAddress[0] ); |
1506 | //} | 1496 | //} |
1507 | 1497 | ||
1508 | //if (hasCity) { | 1498 | //if (hasCity) { |
1509 | ent.setHomeCity( slHomeAddress[3] ); | 1499 | ent.setHomeCity( slHomeAddress[3] ); |
1510 | ent.setBusinessCity( slBusinessAddress[3] ); | 1500 | ent.setBusinessCity( slBusinessAddress[3] ); |
1511 | //} | 1501 | //} |
1512 | 1502 | ||
1513 | //if (hasState) { | 1503 | //if (hasState) { |
1514 | ent.setHomeState( slHomeAddress[4] ); | 1504 | ent.setHomeState( slHomeAddress[4] ); |
1515 | ent.setBusinessState( slBusinessAddress[4] ); | 1505 | ent.setBusinessState( slBusinessAddress[4] ); |
1516 | //} | 1506 | //} |
1517 | 1507 | ||
1518 | //if (hasZip) { | 1508 | //if (hasZip) { |
1519 | ent.setHomeZip( slHomeAddress[5] ); | 1509 | ent.setHomeZip( slHomeAddress[5] ); |
1520 | ent.setBusinessZip( slBusinessAddress[5] ); | 1510 | ent.setBusinessZip( slBusinessAddress[5] ); |
1521 | //} | 1511 | //} |
1522 | 1512 | ||
1523 | //if (hasCountry) { | 1513 | //if (hasCountry) { |
1524 | ent.setHomeCountry( slHomeAddress[6] ); | 1514 | ent.setHomeCountry( slHomeAddress[6] ); |
1525 | ent.setBusinessCountry( slBusinessAddress[6] ); | 1515 | ent.setBusinessCountry( slBusinessAddress[6] ); |
1526 | //} | 1516 | //} |
1527 | 1517 | ||
1528 | QStringList::ConstIterator it; | 1518 | QStringList::ConstIterator it; |
1529 | QListIterator<QLineEdit> itLE( listValue ); | 1519 | QListIterator<QLineEdit> itLE( listValue ); |
1530 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { | 1520 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { |
1531 | 1521 | ||
1532 | if ( *it == "Department" ) | 1522 | if ( *it == "Department" ) |
1533 | ent.setDepartment( (*itLE)->text() ); | 1523 | ent.setDepartment( (*itLE)->text() ); |
1534 | 1524 | ||
1535 | if ( *it == "Company" ) | 1525 | if ( *it == "Company" ) |
1536 | ent.setCompany( (*itLE)->text() ); | 1526 | ent.setCompany( (*itLE)->text() ); |
1537 | 1527 | ||
1538 | if ( *it == "Office" ) | 1528 | if ( *it == "Office" ) |
1539 | ent.setOffice( (*itLE)->text() ); | 1529 | ent.setOffice( (*itLE)->text() ); |
1540 | 1530 | ||
1541 | if ( *it == "Profession" ) | 1531 | if ( *it == "Profession" ) |
1542 | ent.setProfession( (*itLE)->text() ); | 1532 | ent.setProfession( (*itLE)->text() ); |
1543 | 1533 | ||
1544 | if ( *it == "Assistant" ) | 1534 | if ( *it == "Assistant" ) |
1545 | ent.setAssistant( (*itLE)->text() ); | 1535 | ent.setAssistant( (*itLE)->text() ); |
1546 | 1536 | ||
1547 | if ( *it == "Manager" ) | 1537 | if ( *it == "Manager" ) |
1548 | ent.setManager( (*itLE)->text() ); | 1538 | ent.setManager( (*itLE)->text() ); |
1549 | 1539 | ||
1550 | if ( *it == "Spouse" ) | 1540 | if ( *it == "Spouse" ) |
1551 | ent.setSpouse( (*itLE)->text() ); | 1541 | ent.setSpouse( (*itLE)->text() ); |
1552 | 1542 | ||
1553 | if ( *it == "Nickname" ) | 1543 | if ( *it == "Nickname" ) |
1554 | ent.setNickname( (*itLE)->text() ); | 1544 | ent.setNickname( (*itLE)->text() ); |
1555 | 1545 | ||
1556 | if ( *it == "Children" ) | 1546 | if ( *it == "Children" ) |
1557 | ent.setChildren( (*itLE)->text() ); | 1547 | ent.setChildren( (*itLE)->text() ); |
1558 | 1548 | ||
1559 | } | 1549 | } |
1560 | 1550 | ||
1561 | 1551 | ||
1562 | QStringList::ConstIterator itV; | 1552 | QStringList::ConstIterator itV; |
1563 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1553 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1564 | 1554 | ||
1565 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) | 1555 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) |
1566 | ent.setBusinessPhone( *itV ); | 1556 | ent.setBusinessPhone( *itV ); |
1567 | 1557 | ||
1568 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) | 1558 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) |
1569 | ent.setBusinessFax( *itV ); | 1559 | ent.setBusinessFax( *itV ); |
1570 | 1560 | ||
1571 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) | 1561 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) |
1572 | ent.setBusinessMobile( *itV ); | 1562 | ent.setBusinessMobile( *itV ); |
1573 | 1563 | ||
1574 | if ( *it == "Emails" ){ | 1564 | if ( *it == "Emails" ){ |
1575 | QString allemail; | 1565 | QString allemail; |
1576 | QString defaultmail; | 1566 | QString defaultmail; |
1577 | parseEmailFrom( emails.join(","), defaultmail, allemail ); | 1567 | parseEmailFrom( emails.join(","), defaultmail, allemail ); |
1578 | if ( defaultEmail.isEmpty() ){ | 1568 | if ( defaultEmail.isEmpty() ){ |
1579 | qWarning("Default email was not set by user!"); | 1569 | qWarning("Default email was not set by user!"); |
1580 | qWarning("Using first email in list: %s", defaultmail.latin1()); | 1570 | qWarning("Using first email in list: %s", defaultmail.latin1()); |
1581 | ent.setDefaultEmail( defaultmail ); | 1571 | ent.setDefaultEmail( defaultmail ); |
1582 | } | 1572 | } |
1583 | ent.setEmails( allemail ); | 1573 | ent.setEmails( allemail ); |
1584 | } | 1574 | } |
1585 | 1575 | ||
1586 | if ( *it == "Default Email") | 1576 | if ( *it == "Default Email") |
1587 | ent.setDefaultEmail( defaultEmail /* *itV */ ); | 1577 | ent.setDefaultEmail( defaultEmail /* *itV */ ); |
1588 | 1578 | ||
1589 | if ( *it == "Home Phone" ) | 1579 | if ( *it == "Home Phone" ) |
1590 | ent.setHomePhone( *itV ); | 1580 | ent.setHomePhone( *itV ); |
1591 | 1581 | ||
1592 | if ( *it == "Home Fax" ) | 1582 | if ( *it == "Home Fax" ) |
1593 | ent.setHomeFax( *itV ); | 1583 | ent.setHomeFax( *itV ); |
1594 | 1584 | ||
1595 | if ( *it == "Home Mobile" ) | 1585 | if ( *it == "Home Mobile" ) |
1596 | ent.setHomeMobile( *itV ); | 1586 | ent.setHomeMobile( *itV ); |
1597 | 1587 | ||
1598 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1588 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1599 | ent.setBusinessPager( *itV ); | 1589 | ent.setBusinessPager( *itV ); |
1600 | 1590 | ||
1601 | if ( *it == "Home Web Page" ) | 1591 | if ( *it == "Home Web Page" ) |
1602 | ent.setHomeWebpage( *itV ); | 1592 | ent.setHomeWebpage( *itV ); |
1603 | 1593 | ||
1604 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1594 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1605 | ent.setBusinessWebpage( *itV ); | 1595 | ent.setBusinessWebpage( *itV ); |
1606 | 1596 | ||
1607 | 1597 | ||
1608 | } | 1598 | } |
1609 | 1599 | ||
1610 | int gender = cmbGender->currentItem(); | 1600 | int gender = cmbGender->currentItem(); |
1611 | ent.setGender( QString::number( gender ) ); | 1601 | ent.setGender( QString::number( gender ) ); |
1612 | 1602 | ||
1613 | QString str = txtNote->text(); | 1603 | QString str = txtNote->text(); |
1614 | if ( !str.isNull() ) | 1604 | if ( !str.isNull() ) |
1615 | ent.setNotes( str ); | 1605 | ent.setNotes( str ); |
1616 | 1606 | ||
1617 | } | 1607 | } |
1618 | 1608 | ||
1619 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 1609 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
1620 | QString &strAll ) | 1610 | QString &strAll ) |
1621 | { | 1611 | { |
1622 | int where, | 1612 | int where, |
1623 | start; | 1613 | start; |
1624 | if ( txt.isEmpty() ) | 1614 | if ( txt.isEmpty() ) |
1625 | return; | 1615 | return; |
1626 | // find the first | 1616 | // find the first |
1627 | where = txt.find( ',' ); | 1617 | where = txt.find( ',' ); |
1628 | if ( where < 0 ) { | 1618 | if ( where < 0 ) { |
1629 | strDefaultEmail = txt; | 1619 | strDefaultEmail = txt; |
1630 | strAll = txt; | 1620 | strAll = txt; |
1631 | } else { | 1621 | } else { |
1632 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); | 1622 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); |
1633 | strAll = strDefaultEmail; | 1623 | strAll = strDefaultEmail; |
1634 | while ( where > -1 ) { | 1624 | while ( where > -1 ) { |
1635 | strAll.append(" "); | 1625 | strAll.append(" "); |
1636 | start = where; | 1626 | start = where; |
1637 | where = txt.find( ',', where + 1 ); | 1627 | where = txt.find( ',', where + 1 ); |
1638 | if ( where > - 1 ) | 1628 | if ( where > - 1 ) |
1639 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); | 1629 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); |
1640 | else // grab until the end... | 1630 | else // grab until the end... |
1641 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); | 1631 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); |
1642 | } | 1632 | } |
1643 | } | 1633 | } |
1644 | } | 1634 | } |
1645 | 1635 | ||
1646 | void parseEmailTo( const QString &strDefaultEmail, | 1636 | void parseEmailTo( const QString &strDefaultEmail, |
1647 | const QString &strOtherEmail, QString &strBack ) | 1637 | const QString &strOtherEmail, QString &strBack ) |
1648 | { | 1638 | { |
1649 | // create a comma dilimeted set of emails... | 1639 | // create a comma dilimeted set of emails... |
1650 | // use the power of short circuiting... | 1640 | // use the power of short circuiting... |
1651 | bool foundDefault = false; | 1641 | bool foundDefault = false; |
1652 | QString strTmp; | 1642 | QString strTmp; |
1653 | int start = 0; | 1643 | int start = 0; |
1654 | int where; | 1644 | int where; |
1655 | // start at the beginng. | 1645 | // start at the beginng. |
1656 | strBack = strDefaultEmail; | 1646 | strBack = strDefaultEmail; |
1657 | where = 0; | 1647 | where = 0; |
1658 | while ( where > -1 ) { | 1648 | while ( where > -1 ) { |
1659 | start = where; | 1649 | start = where; |
1660 | where = strOtherEmail.find( ' ', where + 1 ); | 1650 | where = strOtherEmail.find( ' ', where + 1 ); |
1661 | if ( where > 0 ) { | 1651 | if ( where > 0 ) { |
1662 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); | 1652 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); |
1663 | } else | 1653 | } else |
1664 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); | 1654 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); |
1665 | if ( foundDefault || strTmp != strDefaultEmail ) { | 1655 | if ( foundDefault || strTmp != strDefaultEmail ) { |
1666 | strBack.append( ", " ); | 1656 | strBack.append( ", " ); |
1667 | strBack.append( strTmp ); | 1657 | strBack.append( strTmp ); |
1668 | } else | 1658 | } else |
1669 | foundDefault = true; | 1659 | foundDefault = true; |
1670 | } | 1660 | } |
1671 | } | 1661 | } |
1672 | 1662 | ||
1673 | 1663 | ||
1674 | static inline bool containsAlphaNum( const QString &str ) | 1664 | static inline bool containsAlphaNum( const QString &str ) |
1675 | { | 1665 | { |
1676 | int i, | 1666 | int i, |
1677 | count = str.length(); | 1667 | count = str.length(); |
1678 | for ( i = 0; i < count; i++ ) | 1668 | for ( i = 0; i < count; i++ ) |
1679 | if ( !str[i].isSpace() ) | 1669 | if ( !str[i].isSpace() ) |
1680 | return TRUE; | 1670 | return TRUE; |
1681 | return FALSE; | 1671 | return FALSE; |
1682 | } | 1672 | } |
1683 | 1673 | ||
1684 | static inline bool constainsWhiteSpace( const QString &str ) | 1674 | static inline bool constainsWhiteSpace( const QString &str ) |
1685 | { | 1675 | { |
1686 | int i, | 1676 | int i, |
1687 | count = str.length(); | 1677 | count = str.length(); |
1688 | for (i = 0; i < count; i++ ) | 1678 | for (i = 0; i < count; i++ ) |
1689 | if ( str[i].isSpace() ) | 1679 | if ( str[i].isSpace() ) |
1690 | return TRUE; | 1680 | return TRUE; |
1691 | return FALSE; | 1681 | return FALSE; |
1692 | } | 1682 | } |
1693 | 1683 | ||
1694 | void ContactEditor::setPersonalView( bool personal ) | 1684 | void ContactEditor::setPersonalView( bool personal ) |
1695 | { | 1685 | { |
1696 | m_personalView = personal; | 1686 | m_personalView = personal; |
1697 | 1687 | ||
1698 | // Currently disbled due to the fact that | 1688 | // Currently disbled due to the fact that |
1699 | // show will not work... | 1689 | // show will not work... |
1700 | return; | 1690 | return; |
1701 | 1691 | ||
1702 | if ( personal ){ | 1692 | if ( personal ){ |
1703 | cmbCat->hide(); | 1693 | cmbCat->hide(); |
1704 | labCat->hide(); | 1694 | labCat->hide(); |
1705 | 1695 | ||
1706 | } else{ | 1696 | } else{ |
1707 | cmbCat->show(); | 1697 | cmbCat->show(); |
1708 | labCat->show(); | 1698 | labCat->show(); |
1709 | } | 1699 | } |
1710 | } | 1700 | } |
1711 | 1701 | ||
1712 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) | 1702 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) |
1713 | { | 1703 | { |
1714 | QDate date; | 1704 | QDate date; |
1715 | date.setYMD( year, month, day ); | 1705 | date.setYMD( year, month, day ); |
1716 | QString dateString = TimeString::numberDateString( date ); | 1706 | QString dateString = TimeString::numberDateString( date ); |
1717 | anniversaryButton->setText( dateString ); | 1707 | anniversaryButton->setText( dateString ); |
1718 | ent.setAnniversary ( date ); | 1708 | ent.setAnniversary ( date ); |
1719 | } | 1709 | } |
1720 | 1710 | ||
1721 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) | 1711 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) |
1722 | { | 1712 | { |
1723 | QDate date; | 1713 | QDate date; |
1724 | date.setYMD( year, month, day ); | 1714 | date.setYMD( year, month, day ); |
1725 | QString dateString = TimeString::numberDateString( date ); | 1715 | QString dateString = TimeString::numberDateString( date ); |
1726 | birthdayButton->setText( dateString ); | 1716 | birthdayButton->setText( dateString ); |
1727 | ent.setBirthday ( date ); | 1717 | ent.setBirthday ( date ); |
1728 | } | 1718 | } |
1729 | 1719 | ||
1730 | void ContactEditor::slotRemoveBirthday() | 1720 | void ContactEditor::slotRemoveBirthday() |
1731 | { | 1721 | { |
1732 | qWarning("void ContactEditor::slotRemoveBirthday()"); | 1722 | qWarning("void ContactEditor::slotRemoveBirthday()"); |
1733 | ent.setBirthday( QDate() ); | 1723 | ent.setBirthday( QDate() ); |
1734 | updateDatePicker(); | 1724 | updateDatePicker(); |
1735 | } | 1725 | } |
1736 | 1726 | ||
1737 | void ContactEditor::slotRemoveAnniversary() | 1727 | void ContactEditor::slotRemoveAnniversary() |
1738 | { | 1728 | { |
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index 954c77e..c6fa48f 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h | |||
@@ -1,193 +1,191 @@ | |||
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 | #include <qwidgetstack.h> | 32 | #include <qwidgetstack.h> |
33 | 33 | ||
34 | #include "ocontactfields.h" | 34 | #include "ocontactfields.h" |
35 | 35 | ||
36 | const int NAME_LF = 0; | 36 | const int NAME_LF = 0; |
37 | const int NAME_LFM = 1; | 37 | const int NAME_LFM = 1; |
38 | const int NAME_FL = 2; | 38 | const int NAME_FL = 2; |
39 | const int NAME_FMLS = 3; | 39 | const int NAME_FML = 3; |
40 | 40 | ||
41 | const int NAME_F = 4; | 41 | const int NAME_F = 4; |
42 | const int NAME_M = 5; | 42 | const int NAME_M = 5; |
43 | const int NAME_L = 6; | 43 | const int NAME_L = 6; |
44 | const int NAME_S = 7; | 44 | const int NAME_S = 7; |
45 | 45 | ||
46 | 46 | ||
47 | class QScrollView; | 47 | class QScrollView; |
48 | class QTabWidget; | 48 | class QTabWidget; |
49 | class QMultiLineEdit; | 49 | class QMultiLineEdit; |
50 | class QLineEdit; | 50 | class QLineEdit; |
51 | class QComboBox; | 51 | class QComboBox; |
52 | class QPushButton; | 52 | class QPushButton; |
53 | class CategorySelect; | 53 | class CategorySelect; |
54 | class QLabel; | 54 | class QLabel; |
55 | 55 | ||
56 | class ContactEditor : public QDialog { | 56 | class ContactEditor : public QDialog { |
57 | Q_OBJECT | 57 | Q_OBJECT |
58 | 58 | ||
59 | public: | 59 | public: |
60 | ContactEditor(const OContact &entry, | 60 | ContactEditor(const OContact &entry, |
61 | QWidget *parent = 0, | 61 | QWidget *parent = 0, |
62 | const char *name = 0, | 62 | const char *name = 0, |
63 | WFlags fl = 0 ); | 63 | WFlags fl = 0 ); |
64 | ~ContactEditor(); | 64 | ~ContactEditor(); |
65 | void setNameFocus(); | 65 | void setNameFocus(); |
66 | void setPersonalView( bool personal = true ); | 66 | void setPersonalView( bool personal = true ); |
67 | OContact entry() const { return ent; } | 67 | OContact entry() const { return ent; } |
68 | 68 | ||
69 | public slots: | 69 | public slots: |
70 | void slotNote(); | 70 | void slotNote(); |
71 | void slotName(); | 71 | void slotName(); |
72 | void setEntry(const OContact &entry); | 72 | void setEntry(const OContact &entry); |
73 | 73 | ||
74 | protected slots: | 74 | protected slots: |
75 | void accept(); | 75 | void accept(); |
76 | 76 | ||
77 | private: | 77 | private: |
78 | void init(); | 78 | void init(); |
79 | void saveEntry(); | 79 | void saveEntry(); |
80 | bool isEmpty(); | 80 | bool isEmpty(); |
81 | void cleanupFields(); | 81 | void cleanupFields(); |
82 | void updateDatePicker(); | 82 | void updateDatePicker(); |
83 | QString parseName( QString fullName, int type ); | 83 | QString parseName( QString fullName, int type ); |
84 | void chooserError( int index ); | 84 | void chooserError( int index ); |
85 | private slots: | 85 | private slots: |
86 | void slotChooser1Change( const QString &textChanged ); | 86 | void slotChooser1Change( const QString &textChanged ); |
87 | void slotChooser2Change( const QString &textChanged ); | 87 | void slotChooser2Change( const QString &textChanged ); |
88 | void slotChooser3Change( const QString &textChanged ); | 88 | void slotChooser3Change( const QString &textChanged ); |
89 | void slotChooser4Change( const QString &textChanged ); | 89 | void slotChooser4Change( const QString &textChanged ); |
90 | void slotCmbChooser1Change( int index ); | 90 | void slotCmbChooser1Change( int index ); |
91 | void slotCmbChooser2Change( int index ); | 91 | void slotCmbChooser2Change( int index ); |
92 | void slotCmbChooser3Change( int index ); | 92 | void slotCmbChooser3Change( int index ); |
93 | void slotCmbChooser4Change( int index ); | 93 | void slotCmbChooser4Change( int index ); |
94 | void slotAddressTypeChange( int index ); | 94 | void slotAddressTypeChange( int index ); |
95 | void slotAddressChange( const QString &textChanged ); | 95 | void slotAddressChange( const QString &textChanged ); |
96 | void slotAddress2Change( const QString &textChanged ); | 96 | void slotAddress2Change( const QString &textChanged ); |
97 | void slotPOBoxChange( const QString &textChanged ); | 97 | void slotPOBoxChange( const QString &textChanged ); |
98 | void slotCityChange( const QString &textChanged ); | 98 | void slotCityChange( const QString &textChanged ); |
99 | void slotStateChange( const QString &textChanged ); | 99 | void slotStateChange( const QString &textChanged ); |
100 | void slotZipChange( const QString &textChanged ); | 100 | void slotZipChange( const QString &textChanged ); |
101 | void slotCountryChange( const QString &textChanged ); | 101 | void slotCountryChange( const QString &textChanged ); |
102 | void slotFullNameChange( const QString &textChanged ); | 102 | void slotFullNameChange( const QString &textChanged ); |
103 | void slotSuffixChange( const QString &textChanged ); | 103 | void slotSuffixChange( const QString &textChanged ); |
104 | void slotAnniversaryDateChanged( int year, int month, int day); | 104 | void slotAnniversaryDateChanged( int year, int month, int day); |
105 | void slotBirthdayDateChanged( int year, int month, int day); | 105 | void slotBirthdayDateChanged( int year, int month, int day); |
106 | void slotRemoveBirthday(); | 106 | void slotRemoveBirthday(); |
107 | void slotRemoveAnniversary(); | 107 | void slotRemoveAnniversary(); |
108 | void defaultEmailChanged(int); | 108 | void defaultEmailChanged(int); |
109 | 109 | ||
110 | private: | 110 | private: |
111 | enum StackWidgets { TextField = 1, Combo }; | 111 | enum StackWidgets { TextField = 1, Combo }; |
112 | int defaultEmailChooserPosition; | 112 | int defaultEmailChooserPosition; |
113 | void populateDefaultEmailCmb(); | 113 | void populateDefaultEmailCmb(); |
114 | void chooserChange( const QString&, int , QLineEdit*, int ); | 114 | void chooserChange( const QString&, int , QLineEdit*, int ); |
115 | bool cmbChooserChange( int , QWidgetStack*, int ); | 115 | bool cmbChooserChange( int , QWidgetStack*, int ); |
116 | OContactFields contactfields; | 116 | OContactFields contactfields; |
117 | 117 | ||
118 | bool useFullName; | ||
119 | |||
120 | OContact ent; | 118 | OContact ent; |
121 | 119 | ||
122 | QDialog *dlgNote; | 120 | QDialog *dlgNote; |
123 | QDialog *dlgName; | 121 | QDialog *dlgName; |
124 | 122 | ||
125 | QList<QLineEdit> listValue; | 123 | QList<QLineEdit> listValue; |
126 | QList<QLabel> listName; | 124 | QList<QLabel> listName; |
127 | 125 | ||
128 | QStringList slDynamicEntries; | 126 | QStringList slDynamicEntries; |
129 | QStringList trlDynamicEntries; | 127 | QStringList trlDynamicEntries; |
130 | 128 | ||
131 | bool m_personalView; | 129 | bool m_personalView; |
132 | 130 | ||
133 | QStringList slHomeAddress; | 131 | QStringList slHomeAddress; |
134 | QStringList slBusinessAddress; | 132 | QStringList slBusinessAddress; |
135 | QStringList slChooserNames; | 133 | QStringList slChooserNames; |
136 | QStringList slChooserValues; | 134 | QStringList slChooserValues; |
137 | QStringList emails; | 135 | QStringList emails; |
138 | QString defaultEmail; | 136 | QString defaultEmail; |
139 | 137 | ||
140 | QMultiLineEdit *txtNote; | 138 | QMultiLineEdit *txtNote; |
141 | QLabel *lblNote; | 139 | QLabel *lblNote; |
142 | 140 | ||
143 | //QLineEdit *txtTitle; | 141 | //QLineEdit *txtTitle; |
144 | QLineEdit *txtFirstName; | 142 | QLineEdit *txtFirstName; |
145 | QLineEdit *txtMiddleName; | 143 | QLineEdit *txtMiddleName; |
146 | QLineEdit *txtLastName; | 144 | QLineEdit *txtLastName; |
147 | QLineEdit *txtSuffix; | 145 | QLineEdit *txtSuffix; |
148 | 146 | ||
149 | QTabWidget *tabMain; | 147 | QTabWidget *tabMain; |
150 | QScrollView *svGeneral; | 148 | QScrollView *svGeneral; |
151 | QPushButton *btnFullName; | 149 | QPushButton *btnFullName; |
152 | QPushButton *btnNote; | 150 | QPushButton *btnNote; |
153 | QLineEdit *txtFullName; | 151 | QLineEdit *txtFullName; |
154 | QLineEdit *txtJobTitle; | 152 | QLineEdit *txtJobTitle; |
155 | QLineEdit *txtOrganization; | 153 | QLineEdit *txtOrganization; |
156 | QLineEdit *txtChooserField1; | 154 | QLineEdit *txtChooserField1; |
157 | QLineEdit *txtChooserField2; | 155 | QLineEdit *txtChooserField2; |
158 | QLineEdit *txtChooserField3; | 156 | QLineEdit *txtChooserField3; |
159 | QLineEdit *txtChooserField4; | 157 | QLineEdit *txtChooserField4; |
160 | QWidgetStack* m_widgetStack1; | 158 | QWidgetStack* m_widgetStack1; |
161 | QWidgetStack* m_widgetStack2; | 159 | QWidgetStack* m_widgetStack2; |
162 | QWidgetStack* m_widgetStack3; | 160 | QWidgetStack* m_widgetStack3; |
163 | QWidgetStack* m_widgetStack4; | 161 | QWidgetStack* m_widgetStack4; |
164 | QComboBox *cmbChooserField1; | 162 | QComboBox *cmbChooserField1; |
165 | QComboBox *cmbChooserField2; | 163 | QComboBox *cmbChooserField2; |
166 | QComboBox *cmbChooserField3; | 164 | QComboBox *cmbChooserField3; |
167 | QComboBox *cmbChooserField4; | 165 | QComboBox *cmbChooserField4; |
168 | QComboBox *cmbDefaultEmail; | 166 | QComboBox *cmbDefaultEmail; |
169 | QComboBox *cmbFileAs; | 167 | QComboBox *cmbFileAs; |
170 | CategorySelect *cmbCat; | 168 | CategorySelect *cmbCat; |
171 | QLabel *labCat; | 169 | QLabel *labCat; |
172 | 170 | ||
173 | QScrollView *svAddress; | 171 | QScrollView *svAddress; |
174 | QLineEdit *txtAddress; | 172 | QLineEdit *txtAddress; |
175 | //QLineEdit *txtAddress2; | 173 | //QLineEdit *txtAddress2; |
176 | //QLineEdit *txtPOBox; | 174 | //QLineEdit *txtPOBox; |
177 | QLineEdit *txtCity; | 175 | QLineEdit *txtCity; |
178 | QLineEdit *txtState; | 176 | QLineEdit *txtState; |
179 | QLineEdit *txtZip; | 177 | QLineEdit *txtZip; |
180 | QComboBox *cmbAddress; | 178 | QComboBox *cmbAddress; |
181 | QComboBox *cmbCountry; | 179 | QComboBox *cmbCountry; |
182 | 180 | ||
183 | QScrollView *svDetails; | 181 | QScrollView *svDetails; |
184 | QComboBox *cmbGender; | 182 | QComboBox *cmbGender; |
185 | DateBookMonth* birthdayPicker; | 183 | DateBookMonth* birthdayPicker; |
186 | QToolButton* birthdayButton; | 184 | QToolButton* birthdayButton; |
187 | DateBookMonth* anniversaryPicker; | 185 | DateBookMonth* anniversaryPicker; |
188 | QToolButton* anniversaryButton; | 186 | QToolButton* anniversaryButton; |
189 | 187 | ||
190 | bool initializing; | 188 | bool initializing; |
191 | }; | 189 | }; |
192 | 190 | ||
193 | #endif | 191 | #endif |