summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp56
-rw-r--r--kaddressbook/mainembedded.cpp15
-rw-r--r--kaddressbook/nameeditdialog.cpp7
3 files changed, 58 insertions, 20 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 3cfc1f2..826c69b 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -1,1280 +1,1306 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qcheckbox.h> 24#include <qcheckbox.h>
25#include <qhbox.h> 25#include <qhbox.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qlistbox.h> 28#include <qlistbox.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qtabwidget.h> 30#include <qtabwidget.h>
31 31
32#ifndef KAB_EMBEDDED 32#ifndef KAB_EMBEDDED
33#include <qtextedit.h> 33#include <qtextedit.h>
34 34
35#include <kaccelmanager.h> 35#include <kaccelmanager.h>
36#include "keywidget.h" 36#include "keywidget.h"
37#include "soundwidget.h" 37#include "soundwidget.h"
38 38
39#else //KAB_EMBEDDED 39#else //KAB_EMBEDDED
40#include <qmultilineedit.h> 40#include <qmultilineedit.h>
41#endif //KAB_EMBEDDED 41#endif //KAB_EMBEDDED
42 42
43 43
44#include "keywidget.h" 44#include "keywidget.h"
45#include "geowidget.h" 45#include "geowidget.h"
46#include "imagewidget.h" 46#include "imagewidget.h"
47#include "nameeditdialog.h" 47#include "nameeditdialog.h"
48#include "phoneeditwidget.h" 48#include "phoneeditwidget.h"
49#include "secrecywidget.h" 49#include "secrecywidget.h"
50 50
51 51
52#include <qtoolbutton.h> 52#include <qtoolbutton.h>
53#include <qtooltip.h> 53#include <qtooltip.h>
54 54
55#include <kapplication.h> 55#include <kapplication.h>
56#include <kconfig.h> 56#include <kconfig.h>
57#include <kcombobox.h> 57#include <kcombobox.h>
58#include <kdebug.h> 58#include <kdebug.h>
59#include <kdialogbase.h> 59#include <kdialogbase.h>
60#include <kglobal.h> 60#include <kglobal.h>
61#include <kiconloader.h> 61#include <kiconloader.h>
62#include <klineedit.h> 62#include <klineedit.h>
63#include <klocale.h> 63#include <klocale.h>
64#include <kmessagebox.h> 64#include <kmessagebox.h>
65#include <kseparator.h> 65#include <kseparator.h>
66#include <ksqueezedtextlabel.h> 66#include <ksqueezedtextlabel.h>
67 67
68#include <libkdepim/categoryeditdialog.h> 68#include <libkdepim/categoryeditdialog.h>
69#include <libkdepim/categoryselectdialog.h> 69#include <libkdepim/categoryselectdialog.h>
70 70
71#include <libkdepim/kdateedit.h> 71#include <libkdepim/kdateedit.h>
72 72
73#include "addresseditwidget.h" 73#include "addresseditwidget.h"
74#include "emaileditwidget.h" 74#include "emaileditwidget.h"
75#include "kabcore.h" 75#include "kabcore.h"
76#include "kabprefs.h" 76#include "kabprefs.h"
77 77
78#include "addresseeeditorwidget.h" 78#include "addresseeeditorwidget.h"
79 79
80 80
81 81
82AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension, 82AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension,
83 QWidget *parent, const char *name ) 83 QWidget *parent, const char *name )
84 : ExtensionWidget( core, parent, name ), mIsExtension( isExtension ), 84 : ExtensionWidget( core, parent, name ), mIsExtension( isExtension ),
85 mBlockSignals( false ) 85 mBlockSignals( false )
86{ 86{
87 87
88 mAConfig = AddresseeConfig::instance(); 88 mAConfig = AddresseeConfig::instance();
89 89
90 kdDebug(5720) << "AddresseeEditorWidget()" << endl;
91 mFormattedNameType = NameEditDialog::CustomName; 90 mFormattedNameType = NameEditDialog::CustomName;
92 initGUI(); 91 initGUI();
93 mCategoryDialog = 0; 92 mCategoryDialog = 0;
94 mCategoryEditDialog = 0; 93 mCategoryEditDialog = 0;
95 94
96 // Load the empty addressee as defaults 95 // Load the empty addressee as defaults
97 load(); 96 load();
98 97
99 mDirty = false; 98 mDirty = false;
100} 99}
101 100
102AddresseeEditorWidget::~AddresseeEditorWidget() 101AddresseeEditorWidget::~AddresseeEditorWidget()
103{ 102{
104 kdDebug(5720) << "~AddresseeEditorWidget()" << endl; 103 kdDebug(5720) << "~AddresseeEditorWidget()" << endl;
105} 104}
106 105
107void AddresseeEditorWidget::contactsSelectionChanged() 106void AddresseeEditorWidget::contactsSelectionChanged()
108{ 107{
109 KABC::Addressee::List list = selectedContacts(); 108 KABC::Addressee::List list = selectedContacts();
110 109
111 mAddressee = list[ 0 ]; 110 mAddressee = list[ 0 ];
112 load(); 111 load();
113} 112}
114 113
115void AddresseeEditorWidget::setAddressee( const KABC::Addressee &addr ) 114void AddresseeEditorWidget::setAddressee( const KABC::Addressee &addr )
116{ 115{
117 mAddressee = addr; 116 mAddressee = addr;
118 load(); 117 load();
119} 118}
120 119
121const KABC::Addressee &AddresseeEditorWidget::addressee() 120const KABC::Addressee &AddresseeEditorWidget::addressee()
122{ 121{
123 return mAddressee; 122 return mAddressee;
124} 123}
125 124
126void AddresseeEditorWidget::textChanged( const QString& ) 125void AddresseeEditorWidget::textChanged( const QString& )
127{ 126{
128 emitModified(); 127 emitModified();
129} 128}
130 129
131void AddresseeEditorWidget::initGUI() 130void AddresseeEditorWidget::initGUI()
132{ 131{
133 QVBoxLayout *layout = new QVBoxLayout( this ); 132 QVBoxLayout *layout = new QVBoxLayout( this );
134 133
135 mTabWidget = new QTabWidget( this ); 134 mTabWidget = new QTabWidget( this );
136 layout->addWidget( mTabWidget ); 135 layout->addWidget( mTabWidget );
137 136
138 setupTab1(); 137 setupTab1();
139 setupTab1_1(); 138 setupTab1_1();
140 setupTab2(); 139 setupTab2();
141 setupTab2_1(); 140 setupTab2_1();
142 setupTab3(); 141 setupTab3();
143 setupTab3_1(); 142 setupTab3_1();
144 143
145 mNameEdit->setFocus(); 144 mNameEdit->setFocus();
146 145
147 connect( mTabWidget, SIGNAL( currentChanged(QWidget*) ), 146 connect( mTabWidget, SIGNAL( currentChanged(QWidget*) ),
148 SLOT( pageChanged(QWidget*) ) ); 147 SLOT( pageChanged(QWidget*) ) );
149} 148}
150 149
151void AddresseeEditorWidget::setupTab1() 150void AddresseeEditorWidget::setupTab1()
152{ 151{
153 // This is the General tab 152 // This is the General tab
154 QWidget *tab1 = new QWidget( mTabWidget ); 153 QWidget *tab1 = new QWidget( mTabWidget );
155 154
156//US QGridLayout *layout = new QGridLayout( tab1, 11, 7 ); 155//US QGridLayout *layout = new QGridLayout( tab1, 11, 7 );
157 QGridLayout *layout = new QGridLayout( tab1, 7, 1 ); 156 QGridLayout *layout = new QGridLayout( tab1, 7, 1 );
158 layout->setMargin( KDialogBase::marginHintSmall() ); 157 layout->setMargin( KDialogBase::marginHintSmall() );
159 layout->setSpacing( KDialogBase::spacingHintSmall() ); 158 layout->setSpacing( KDialogBase::spacingHintSmall() );
160 159
161 QLabel *label; 160 QLabel *label;
162 KSeparator* bar; 161 KSeparator* bar;
163 QPushButton *button; 162 QPushButton *button;
164 163
165 ////////////////////////////////// 164 //////////////////////////////////
166 // Upper left group (person info) 165 // Upper left group (person info)
167 166
168 // Person icon 167 // Person icon
169 /* LR 168 /* LR
170 label = new QLabel( tab1 ); 169 label = new QLabel( tab1 );
171//US ambiguous call. Add one more parameter 170//US ambiguous call. Add one more parameter
172//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 171//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
173 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 172 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
174 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 173 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
175 */ 174 */
176 // First name 175 // First name
177 button = new QPushButton( i18n( "Name..." ), tab1 ); 176 button = new QPushButton( i18n( "Name..." ), tab1 );
178//US QToolTip::add( button, i18n( "Edit the contact's name" ) ); 177//US QToolTip::add( button, i18n( "Edit the contact's name" ) );
179 mNameEdit = new KLineEdit( tab1, "mNameEdit" ); 178 mNameEdit = new KLineEdit( tab1, "mNameEdit" );
180 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), 179 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
181 SLOT( nameTextChanged( const QString& ) ) ); 180 SLOT( nameTextChanged( const QString& ) ) );
182 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); 181 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
183 182
184 mNameLabel = new KSqueezedTextLabel( tab1 ); 183 mNameLabel = new KSqueezedTextLabel( tab1 );
185 mNameLabel->hide(); 184 mNameLabel->hide();
186 185
187 layout->addWidget( button, 0, 0 ); 186 layout->addWidget( button, 0, 0 );
188 layout->addWidget( mNameEdit, 0, 1 ); 187 layout->addWidget( mNameEdit, 0, 1 );
189 layout->addWidget( mNameLabel, 0, 1 ); 188 layout->addWidget( mNameLabel, 0, 1 );
190 189
191 label = new QLabel( i18n( "Role:" ), tab1 ); 190 label = new QLabel( i18n( "Role:" ), tab1 );
192 mRoleEdit = new KLineEdit( tab1 ); 191 mRoleEdit = new KLineEdit( tab1 );
193 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), 192 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ),
194 SLOT( textChanged( const QString& ) ) ); 193 SLOT( textChanged( const QString& ) ) );
195 label->setBuddy( mRoleEdit ); 194 label->setBuddy( mRoleEdit );
196 layout->addWidget( label, 1, 0 ); 195 layout->addWidget( label, 1, 0 );
197 layout->addWidget( mRoleEdit, 1, 1 ); 196 layout->addWidget( mRoleEdit, 1, 1 );
198 197
199 // Organization 198 // Organization
200 label = new QLabel( i18n( "Organization:" ), tab1 ); 199 label = new QLabel( i18n( "Organization:" ), tab1 );
201 mOrgEdit = new KLineEdit( tab1 ); 200 mOrgEdit = new KLineEdit( tab1 );
202 label->setBuddy( mOrgEdit ); 201 label->setBuddy( mOrgEdit );
203 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), 202 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ),
204 SLOT( textChanged( const QString& ) ) ); 203 SLOT( textChanged( const QString& ) ) );
205 layout->addWidget( label, 2, 0 ); 204 layout->addWidget( label, 2, 0 );
206 layout->addWidget( mOrgEdit, 2, 1 ); 205 layout->addWidget( mOrgEdit, 2, 1 );
207 206
208 // File as (formatted name) 207 // File as (formatted name)
209 label = new QLabel( i18n( "Formatted name:" ), tab1 ); 208 label = new QLabel( i18n( "Formatted name:" ), tab1 );
210 mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); 209 mFormattedNameLabel = new KSqueezedTextLabel( tab1 );
211 layout->addWidget( label, 3, 0 ); 210 layout->addWidget( label, 3, 0 );
212 layout->addWidget( mFormattedNameLabel, 3, 1 ); 211 layout->addWidget( mFormattedNameLabel, 3, 1 );
213 /* LR 212 /* LR
214 // Left hand separator. This separator doesn't go all the way 213 // Left hand separator. This separator doesn't go all the way
215 // across so the dialog still flows from top to bottom 214 // across so the dialog still flows from top to bottom
216 bar = new KSeparator( KSeparator::HLine, tab1 ); 215 bar = new KSeparator( KSeparator::HLine, tab1 );
217 layout->addMultiCellWidget( bar, 4, 4, 0, 2 ); 216 layout->addMultiCellWidget( bar, 4, 4, 0, 2 );
218 */ 217 */
219 ////////////////////////////////////// 218 //////////////////////////////////////
220 219
221 /* LR 220 /* LR
222 // Phone numbers (upper right) 221 // Phone numbers (upper right)
223 label = new QLabel( tab1 ); 222 label = new QLabel( tab1 );
224//US loadIcon call is ambiguous. Add one more parameter 223//US loadIcon call is ambiguous. Add one more parameter
225//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); 224//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) );
226 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); 225 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
227//US layout->addMultiCellWidget( label, 0, 1, 3, 3 ); 226//US layout->addMultiCellWidget( label, 0, 1, 3, 3 );
228 layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 227 layout->addMultiCellWidget( label, 5, 6, 0, 0 );
229 */ 228 */
230 mPhoneEditWidget = new PhoneEditWidget( tab1 ); 229 mPhoneEditWidget = new PhoneEditWidget( tab1 );
231 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 230 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
232//US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); 231//US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 );
233 int iii; 232 int iii;
234#ifndef DESKTOP_VERSION 233#ifndef DESKTOP_VERSION
235 iii = 7; 234 iii = 7;
236#else 235#else
237 iii = 8; 236 iii = 8;
238#endif 237#endif
239 layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, 1 ); 238 layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, 1 );
240 ++iii; 239 ++iii;
241 /* LR 240 /* LR
242 bar = new KSeparator( KSeparator::HLine, tab1 ); 241 bar = new KSeparator( KSeparator::HLine, tab1 );
243//US layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); 242//US layout->addMultiCellWidget( bar, 4, 4, 3, 6 );
244 layout->addMultiCellWidget( bar, 9, 9, 0, 2 ); 243 layout->addMultiCellWidget( bar, 9, 9, 0, 2 );
245 */ 244 */
246/*US 245/*US
247 ////////////////////////////////////// 246 //////////////////////////////////////
248 // Addresses (lower left) 247 // Addresses (lower left)
249 label = new QLabel( tab1 ); 248 label = new QLabel( tab1 );
250//US loadIcon call is ambiguous. Add one more parameter 249//US loadIcon call is ambiguous. Add one more parameter
251//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) ); 250//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) );
252 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); 251 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) );
253 layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 252 layout->addMultiCellWidget( label, 5, 6, 0, 0 );
254 253
255 mAddressEditWidget = new AddressEditWidget( tab1 ); 254 mAddressEditWidget = new AddressEditWidget( tab1 );
256 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 255 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
257 layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 ); 256 layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 );
258 257
259 ////////////////////////////////////// 258 //////////////////////////////////////
260 // Email / Web (lower right) 259 // Email / Web (lower right)
261 label = new QLabel( tab1 ); 260 label = new QLabel( tab1 );
262//US loadIcon call is ambiguous. Add one more parameter 261//US loadIcon call is ambiguous. Add one more parameter
263//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) ); 262//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) );
264 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) ); 263 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) );
265 layout->addMultiCellWidget( label, 5, 6, 3, 3 ); 264 layout->addMultiCellWidget( label, 5, 6, 3, 3 );
266 265
267 mEmailWidget = new EmailEditWidget( tab1 ); 266 mEmailWidget = new EmailEditWidget( tab1 );
268 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 267 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
269 layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 ); 268 layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 );
270 269
271 // add the separator 270 // add the separator
272 bar = new KSeparator( KSeparator::HLine, tab1 ); 271 bar = new KSeparator( KSeparator::HLine, tab1 );
273 layout->addMultiCellWidget( bar, 7, 7, 3, 6 ); 272 layout->addMultiCellWidget( bar, 7, 7, 3, 6 );
274 273
275 label = new QLabel( tab1 ); 274 label = new QLabel( tab1 );
276//US loadIcon call is ambiguous. Add one more parameter 275//US loadIcon call is ambiguous. Add one more parameter
277//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) ); 276//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) );
278 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) ); 277 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) );
279 layout->addMultiCellWidget( label, 8, 9, 3, 3 ); 278 layout->addMultiCellWidget( label, 8, 9, 3, 3 );
280 279
281 label = new QLabel( i18n( "URL:" ), tab1 ); 280 label = new QLabel( i18n( "URL:" ), tab1 );
282 mURLEdit = new KLineEdit( tab1 ); 281 mURLEdit = new KLineEdit( tab1 );
283 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ), 282 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ),
284 SLOT( textChanged( const QString& ) ) ); 283 SLOT( textChanged( const QString& ) ) );
285 label->setBuddy( mURLEdit ); 284 label->setBuddy( mURLEdit );
286 layout->addWidget( label, 8, 4 ); 285 layout->addWidget( label, 8, 4 );
287 layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 ); 286 layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 );
288 287
289 label = new QLabel( i18n( "&IM address:" ), tab1 ); 288 label = new QLabel( i18n( "&IM address:" ), tab1 );
290 mIMAddressEdit = new KLineEdit( tab1 ); 289 mIMAddressEdit = new KLineEdit( tab1 );
291 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ), 290 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ),
292 SLOT( textChanged( const QString& ) ) ); 291 SLOT( textChanged( const QString& ) ) );
293 label->setBuddy( mIMAddressEdit ); 292 label->setBuddy( mIMAddressEdit );
294 layout->addWidget( label, 9, 4 ); 293 layout->addWidget( label, 9, 4 );
295 layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 ); 294 layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 );
296 295
297 layout->addColSpacing( 6, 50 ); 296 layout->addColSpacing( 6, 50 );
298 297
299 bar = new KSeparator( KSeparator::HLine, tab1 ); 298 bar = new KSeparator( KSeparator::HLine, tab1 );
300 layout->addMultiCellWidget( bar, 10, 10, 0, 6 ); 299 layout->addMultiCellWidget( bar, 10, 10, 0, 6 );
301*/ 300*/
302 /////////////////////////////////////// 301 ///////////////////////////////////////
303 QHBox *categoryBox = new QHBox( tab1 ); 302 QHBox *categoryBox = new QHBox( tab1 );
304 categoryBox->setSpacing( KDialogBase::spacingHint() ); 303 categoryBox->setSpacing( KDialogBase::spacingHint() );
305 categoryBox->setMargin( KDialogBase::marginHintSmall() ); 304 categoryBox->setMargin( KDialogBase::marginHintSmall() );
306 305
307 // Categories 306 // Categories
308 button = new QPushButton( i18n( "Categories" ), categoryBox ); 307 button = new QPushButton( i18n( "Categories" ), categoryBox );
309 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); 308 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) );
310 309
311 mCategoryEdit = new KLineEdit( categoryBox ); 310 mCategoryEdit = new KLineEdit( categoryBox );
312 mCategoryEdit->setReadOnly( true ); 311 mCategoryEdit->setReadOnly( true );
313 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), 312 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
314 SLOT( textChanged( const QString& ) ) ); 313 SLOT( textChanged( const QString& ) ) );
315 314
316 mSecrecyWidget = new SecrecyWidget( categoryBox ); 315 mSecrecyWidget = new SecrecyWidget( categoryBox );
317 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 316 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
318 317
319//US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); 318//US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 );
320 layout->addMultiCellWidget( categoryBox, iii, iii, 0, 1 ); 319 layout->addMultiCellWidget( categoryBox, iii, iii, 0, 1 );
321 320
322 // Build the layout and add to the tab widget 321 // Build the layout and add to the tab widget
323 layout->activate(); // required 322 layout->activate(); // required
324 323
325 mTabWidget->addTab( tab1, i18n( "&General" ) ); 324 mTabWidget->addTab( tab1, i18n( "&General" ) );
326} 325}
327 326
328 327
329void AddresseeEditorWidget::setupTab1_1() 328void AddresseeEditorWidget::setupTab1_1()
330{ 329{
331 // This is the Address tab 330 // This is the Address tab
332 QWidget *tab1_1 = new QWidget( mTabWidget ); 331 QWidget *tab1_1 = new QWidget( mTabWidget );
333 332
334//US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 ); 333//US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 );
335 QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 ); 334 QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 );
336 layout->setMargin( KDialogBase::marginHintSmall() ); 335 layout->setMargin( KDialogBase::marginHintSmall() );
337 layout->setSpacing( KDialogBase::spacingHintSmall() ); 336 layout->setSpacing( KDialogBase::spacingHintSmall() );
338 337
339 QLabel *label; 338 QLabel *label;
340 KSeparator* bar; 339 KSeparator* bar;
341 QPushButton *button; 340 QPushButton *button;
342 341
343/*US 342/*US
344 ////////////////////////////////// 343 //////////////////////////////////
345 // Upper left group (person info) 344 // Upper left group (person info)
346 345
347 // Person icon 346 // Person icon
348 label = new QLabel( tab1 ); 347 label = new QLabel( tab1 );
349//US ambiguous call. Add one more parameter 348//US ambiguous call. Add one more parameter
350//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 349//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
351 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 350 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
352 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 351 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
353 352
354 // First name 353 // First name
355 button = new QPushButton( i18n( "Name..." ), tab1 ); 354 button = new QPushButton( i18n( "Name..." ), tab1 );
356 QToolTip::add( button, i18n( "Edit the contact's name" ) ); 355 QToolTip::add( button, i18n( "Edit the contact's name" ) );
357 mNameEdit = new KLineEdit( tab1, "mNameEdit" ); 356 mNameEdit = new KLineEdit( tab1, "mNameEdit" );
358 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), 357 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
359 SLOT( nameTextChanged( const QString& ) ) ); 358 SLOT( nameTextChanged( const QString& ) ) );
360 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); 359 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
361 360
362#ifndef KAB_EMBEDDED 361#ifndef KAB_EMBEDDED
363 mNameLabel = new KSqueezedTextLabel( tab1 ); 362 mNameLabel = new KSqueezedTextLabel( tab1 );
364 mNameLabel->hide(); 363 mNameLabel->hide();
365#else //KAB_EMBEDDED 364#else //KAB_EMBEDDED
366qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 365qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
367#endif //KAB_EMBEDDED 366#endif //KAB_EMBEDDED
368 367
369 layout->addWidget( button, 0, 1 ); 368 layout->addWidget( button, 0, 1 );
370 layout->addWidget( mNameEdit, 0, 2 ); 369 layout->addWidget( mNameEdit, 0, 2 );
371 370
372#ifndef KAB_EMBEDDED 371#ifndef KAB_EMBEDDED
373 layout->addWidget( mNameLabel, 0, 2 ); 372 layout->addWidget( mNameLabel, 0, 2 );
374#else //KAB_EMBEDDED 373#else //KAB_EMBEDDED
375qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 374qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
376#endif //KAB_EMBEDDED 375#endif //KAB_EMBEDDED
377 376
378 label = new QLabel( i18n( "Role:" ), tab1 ); 377 label = new QLabel( i18n( "Role:" ), tab1 );
379 mRoleEdit = new KLineEdit( tab1 ); 378 mRoleEdit = new KLineEdit( tab1 );
380 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), 379 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ),
381 SLOT( textChanged( const QString& ) ) ); 380 SLOT( textChanged( const QString& ) ) );
382 label->setBuddy( mRoleEdit ); 381 label->setBuddy( mRoleEdit );
383 layout->addWidget( label, 1, 1 ); 382 layout->addWidget( label, 1, 1 );
384 layout->addWidget( mRoleEdit, 1, 2 ); 383 layout->addWidget( mRoleEdit, 1, 2 );
385 384
386 // Organization 385 // Organization
387 label = new QLabel( i18n( "Organization:" ), tab1 ); 386 label = new QLabel( i18n( "Organization:" ), tab1 );
388 mOrgEdit = new KLineEdit( tab1 ); 387 mOrgEdit = new KLineEdit( tab1 );
389 label->setBuddy( mOrgEdit ); 388 label->setBuddy( mOrgEdit );
390 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), 389 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ),
391 SLOT( textChanged( const QString& ) ) ); 390 SLOT( textChanged( const QString& ) ) );
392 layout->addWidget( label, 2, 1 ); 391 layout->addWidget( label, 2, 1 );
393 layout->addWidget( mOrgEdit, 2, 2 ); 392 layout->addWidget( mOrgEdit, 2, 2 );
394 393
395 // File as (formatted name) 394 // File as (formatted name)
396 label = new QLabel( i18n( "Formatted name:" ), tab1 ); 395 label = new QLabel( i18n( "Formatted name:" ), tab1 );
397#ifndef KAB_EMBEDDED 396#ifndef KAB_EMBEDDED
398 mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); 397 mFormattedNameLabel = new KSqueezedTextLabel( tab1 );
399#else //KAB_EMBEDDED 398#else //KAB_EMBEDDED
400qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 399qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
401#endif //KAB_EMBEDDED 400#endif //KAB_EMBEDDED
402 layout->addWidget( label, 3, 1 ); 401 layout->addWidget( label, 3, 1 );
403#ifndef KAB_EMBEDDED 402#ifndef KAB_EMBEDDED
404 layout->addWidget( mFormattedNameLabel, 3, 2 ); 403 layout->addWidget( mFormattedNameLabel, 3, 2 );
405#else //KAB_EMBEDDED 404#else //KAB_EMBEDDED
406qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 405qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
407#endif //KAB_EMBEDDED 406#endif //KAB_EMBEDDED
408 407
409 // Left hand separator. This separator doesn't go all the way 408 // Left hand separator. This separator doesn't go all the way
410 // across so the dialog still flows from top to bottom 409 // across so the dialog still flows from top to bottom
411 bar = new KSeparator( KSeparator::HLine, tab1 ); 410 bar = new KSeparator( KSeparator::HLine, tab1 );
412 layout->addMultiCellWidget( bar, 4, 4, 0, 2 ); 411 layout->addMultiCellWidget( bar, 4, 4, 0, 2 );
413 412
414 ////////////////////////////////////// 413 //////////////////////////////////////
415 // Phone numbers (upper right) 414 // Phone numbers (upper right)
416 label = new QLabel( tab1 ); 415 label = new QLabel( tab1 );
417//US loadIcon call is ambiguous. Add one more parameter 416//US loadIcon call is ambiguous. Add one more parameter
418//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); 417//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) );
419 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); 418 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
420 layout->addMultiCellWidget( label, 0, 1, 3, 3 ); 419 layout->addMultiCellWidget( label, 0, 1, 3, 3 );
421 420
422 mPhoneEditWidget = new PhoneEditWidget( tab1 ); 421 mPhoneEditWidget = new PhoneEditWidget( tab1 );
423 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 422 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
424 layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); 423 layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 );
425 424
426 bar = new KSeparator( KSeparator::HLine, tab1 ); 425 bar = new KSeparator( KSeparator::HLine, tab1 );
427 layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); 426 layout->addMultiCellWidget( bar, 4, 4, 3, 6 );
428*/ 427*/
429 ////////////////////////////////////// 428 //////////////////////////////////////
430 // Addresses (lower left) 429 // Addresses (lower left)
431 /* LR 430 /* LR
432 label = new QLabel( tab1_1 ); 431 label = new QLabel( tab1_1 );
433//US loadIcon call is ambiguous. Add one more parameter 432//US loadIcon call is ambiguous. Add one more parameter
434//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) ); 433//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) );
435 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); 434 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) );
436//US layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 435//US layout->addMultiCellWidget( label, 5, 6, 0, 0 );
437 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 436 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
438 */ 437 */
439 438
440 mAddressEditWidget = new AddressEditWidget( tab1_1 ); 439 mAddressEditWidget = new AddressEditWidget( tab1_1 );
441 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 440 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
442//US layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 ); 441//US layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 );
443 layout->addMultiCellWidget( mAddressEditWidget, 0, 4, 0, 1 ); 442 layout->addMultiCellWidget( mAddressEditWidget, 0, 4, 0, 1 );
444 443
445//US 444//US
446/* LR 445/* LR
447 bar = new KSeparator( KSeparator::HLine, tab1_1 ); 446 bar = new KSeparator( KSeparator::HLine, tab1_1 );
448 layout->addMultiCellWidget( bar, 5, 5, 0, 3 ); 447 layout->addMultiCellWidget( bar, 5, 5, 0, 3 );
449*/ 448*/
450 449
451 ////////////////////////////////////// 450 //////////////////////////////////////
452 // Email / Web (lower right) 451 // Email / Web (lower right)
453 /* LR 452 /* LR
454 label = new QLabel( tab1_1 ); 453 label = new QLabel( tab1_1 );
455//US loadIcon call is ambiguous. Add one more parameter 454//US loadIcon call is ambiguous. Add one more parameter
456//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) ); 455//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) );
457 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) ); 456 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) );
458//US layout->addMultiCellWidget( label, 5, 6, 3, 3 ); 457//US layout->addMultiCellWidget( label, 5, 6, 3, 3 );
459 layout->addMultiCellWidget( label, 6, 7, 0, 0 ); 458 layout->addMultiCellWidget( label, 6, 7, 0, 0 );
460 */ 459 */
461 mEmailWidget = new EmailEditWidget( tab1_1 ); 460 mEmailWidget = new EmailEditWidget( tab1_1 );
462 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 461 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
463//US layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 ); 462//US layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 );
464 layout->addMultiCellWidget( mEmailWidget, 5, 6, 0, 1 ); 463 layout->addMultiCellWidget( mEmailWidget, 5, 6, 0, 1 );
465 464
466 /* LR 465 /* LR
467 // add the separator 466 // add the separator
468 bar = new KSeparator( KSeparator::HLine, tab1_1 ); 467 bar = new KSeparator( KSeparator::HLine, tab1_1 );
469//US layout->addMultiCellWidget( bar, 7, 7, 3, 6 ); 468//US layout->addMultiCellWidget( bar, 7, 7, 3, 6 );
470 layout->addMultiCellWidget( bar, 8, 8, 0, 3 ); 469 layout->addMultiCellWidget( bar, 8, 8, 0, 3 );
471 470
472 label = new QLabel( tab1_1 ); 471 label = new QLabel( tab1_1 );
473//US loadIcon call is ambiguous. Add one more parameter 472//US loadIcon call is ambiguous. Add one more parameter
474//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) ); 473//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) );
475 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) ); 474 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) );
476//US layout->addMultiCellWidget( label, 8, 9, 3, 3 ); 475//US layout->addMultiCellWidget( label, 8, 9, 3, 3 );
477 layout->addMultiCellWidget( label, 9, 10, 0, 0 ); 476 layout->addMultiCellWidget( label, 9, 10, 0, 0 );
478 */ 477 */
479 label = new QLabel( i18n( "URL:" ), tab1_1 ); 478 label = new QLabel( i18n( "URL:" ), tab1_1 );
480 mURLEdit = new KLineEdit( tab1_1 ); 479 mURLEdit = new KLineEdit( tab1_1 );
481 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ), 480 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ),
482 SLOT( textChanged( const QString& ) ) ); 481 SLOT( textChanged( const QString& ) ) );
483 label->setBuddy( mURLEdit ); 482 label->setBuddy( mURLEdit );
484//US layout->addWidget( label, 8, 4 ); 483//US layout->addWidget( label, 8, 4 );
485 layout->addWidget( label, 7,0 ); 484 layout->addWidget( label, 7,0 );
486//US layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 ); 485//US layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 );
487 layout->addWidget( mURLEdit, 7, 1); 486 layout->addWidget( mURLEdit, 7, 1);
488 487
489 label = new QLabel( i18n( "&IM address:" ), tab1_1 ); 488 label = new QLabel( i18n( "&IM address:" ), tab1_1 );
490 mIMAddressEdit = new KLineEdit( tab1_1 ); 489 mIMAddressEdit = new KLineEdit( tab1_1 );
491 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ), 490 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ),
492 SLOT( textChanged( const QString& ) ) ); 491 SLOT( textChanged( const QString& ) ) );
493 label->setBuddy( mIMAddressEdit ); 492 label->setBuddy( mIMAddressEdit );
494//US layout->addWidget( label, 9, 4 ); 493//US layout->addWidget( label, 9, 4 );
495 layout->addWidget( label, 8, 0 ); 494 layout->addWidget( label, 8, 0 );
496//US layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 ); 495//US layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 );
497 layout->addWidget( mIMAddressEdit, 8,1 ); 496 layout->addWidget( mIMAddressEdit, 8,1 );
498 497
499//US layout->addColSpacing( 6, 50 ); 498//US layout->addColSpacing( 6, 50 );
500 499
501//US bar = new KSeparator( KSeparator::HLine, tab1_1 ); 500//US bar = new KSeparator( KSeparator::HLine, tab1_1 );
502//US layout->addMultiCellWidget( bar, 10, 10, 0, 6 ); 501//US layout->addMultiCellWidget( bar, 10, 10, 0, 6 );
503 502
504/*US 503/*US
505 /////////////////////////////////////// 504 ///////////////////////////////////////
506 QHBox *categoryBox = new QHBox( tab1 ); 505 QHBox *categoryBox = new QHBox( tab1 );
507 categoryBox->setSpacing( KDialogBase::spacingHintSmall() ); 506 categoryBox->setSpacing( KDialogBase::spacingHintSmall() );
508 507
509 // Categories 508 // Categories
510 button = new QPushButton( i18n( "Categories" ), categoryBox ); 509 button = new QPushButton( i18n( "Categories" ), categoryBox );
511 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); 510 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) );
512 511
513 mCategoryEdit = new KLineEdit( categoryBox ); 512 mCategoryEdit = new KLineEdit( categoryBox );
514 mCategoryEdit->setReadOnly( true ); 513 mCategoryEdit->setReadOnly( true );
515 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), 514 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
516 SLOT( textChanged( const QString& ) ) ); 515 SLOT( textChanged( const QString& ) ) );
517 516
518 mSecrecyWidget = new SecrecyWidget( categoryBox ); 517 mSecrecyWidget = new SecrecyWidget( categoryBox );
519 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 518 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
520 519
521 layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); 520 layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 );
522*/ 521*/
523 // Build the layout and add to the tab widget 522 // Build the layout and add to the tab widget
524 layout->activate(); // required 523 layout->activate(); // required
525 524
526 mTabWidget->addTab( tab1_1, i18n( "&Address" ) ); 525 mTabWidget->addTab( tab1_1, i18n( "&Address" ) );
527} 526}
528 527
529 528
530 529
531void AddresseeEditorWidget::setupTab2() 530void AddresseeEditorWidget::setupTab2()
532{ 531{
533 // This is the Details tab 532 // This is the Details tab
534 QWidget *tab2 = new QWidget( mTabWidget ); 533 QWidget *tab2 = new QWidget( mTabWidget );
535 534
536 QGridLayout *layout = new QGridLayout( tab2, 8, 3 ); 535 QGridLayout *layout = new QGridLayout( tab2, 8, 3 );
537 layout->setMargin( KDialogBase::marginHintSmall() ); 536 layout->setMargin( KDialogBase::marginHintSmall() );
538 layout->setSpacing( KDialogBase::spacingHintSmall() ); 537 layout->setSpacing( KDialogBase::spacingHintSmall() );
539 538
540 QLabel *label; 539 QLabel *label;
541 KSeparator* bar; 540 KSeparator* bar;
542 541
543 /////////////////////// 542 ///////////////////////
544 // Office info 543 // Office info
545 544
546 // Department 545 // Department
547 label = new QLabel( tab2 ); 546 label = new QLabel( tab2 );
548//US loadIcon call is ambiguous. Add one more parameter 547//US loadIcon call is ambiguous. Add one more parameter
549//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); 548//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) );
550 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); 549 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) );
551 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 550 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
552 551
553 label = new QLabel( i18n( "Department:" ), tab2 ); 552 label = new QLabel( i18n( "Department:" ), tab2 );
554 layout->addWidget( label, 0, 1 ); 553 layout->addWidget( label, 0, 1 );
555 mDepartmentEdit = new KLineEdit( tab2 ); 554 mDepartmentEdit = new KLineEdit( tab2 );
556 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), 555 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ),
557 SLOT( textChanged( const QString& ) ) ); 556 SLOT( textChanged( const QString& ) ) );
558 label->setBuddy( mDepartmentEdit ); 557 label->setBuddy( mDepartmentEdit );
559 layout->addWidget( mDepartmentEdit, 0, 2 ); 558 layout->addWidget( mDepartmentEdit, 0, 2 );
560 559
561 label = new QLabel( i18n( "Office:" ), tab2 ); 560 label = new QLabel( i18n( "Office:" ), tab2 );
562 layout->addWidget( label, 1, 1 ); 561 layout->addWidget( label, 1, 1 );
563 mOfficeEdit = new KLineEdit( tab2 ); 562 mOfficeEdit = new KLineEdit( tab2 );
564 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ), 563 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ),
565 SLOT( textChanged( const QString& ) ) ); 564 SLOT( textChanged( const QString& ) ) );
566 label->setBuddy( mOfficeEdit ); 565 label->setBuddy( mOfficeEdit );
567 layout->addWidget( mOfficeEdit, 1, 2 ); 566 layout->addWidget( mOfficeEdit, 1, 2 );
568 567
569 label = new QLabel( i18n( "Profession:" ), tab2 ); 568 label = new QLabel( i18n( "Profession:" ), tab2 );
570 layout->addWidget( label, 2, 1 ); 569 layout->addWidget( label, 2, 1 );
571 mProfessionEdit = new KLineEdit( tab2 ); 570 mProfessionEdit = new KLineEdit( tab2 );
572 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ), 571 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ),
573 SLOT( textChanged( const QString& ) ) ); 572 SLOT( textChanged( const QString& ) ) );
574 label->setBuddy( mProfessionEdit ); 573 label->setBuddy( mProfessionEdit );
575 layout->addWidget( mProfessionEdit, 2, 2 ); 574 layout->addWidget( mProfessionEdit, 2, 2 );
576 575
577 label = new QLabel( i18n( "Manager\'s name:" ), tab2 ); 576 label = new QLabel( i18n( "Manager\'s name:" ), tab2 );
578//US layout->addWidget( label, 0, 3 ); 577//US layout->addWidget( label, 0, 3 );
579 layout->addWidget( label, 3, 1 ); 578 layout->addWidget( label, 3, 1 );
580 mManagerEdit = new KLineEdit( tab2 ); 579 mManagerEdit = new KLineEdit( tab2 );
581 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ), 580 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ),
582 SLOT( textChanged( const QString& ) ) ); 581 SLOT( textChanged( const QString& ) ) );
583 label->setBuddy( mManagerEdit ); 582 label->setBuddy( mManagerEdit );
584//US layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 ); 583//US layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 );
585 layout->addWidget( mManagerEdit, 3, 2 ); 584 layout->addWidget( mManagerEdit, 3, 2 );
586 585
587 label = new QLabel( i18n( "Assistant's name:" ), tab2 ); 586 label = new QLabel( i18n( "Assistant's name:" ), tab2 );
588//US layout->addWidget( label, 1, 3 ); 587//US layout->addWidget( label, 1, 3 );
589 layout->addWidget( label, 4, 1 ); 588 layout->addWidget( label, 4, 1 );
590 mAssistantEdit = new KLineEdit( tab2 ); 589 mAssistantEdit = new KLineEdit( tab2 );
591 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ), 590 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ),
592 SLOT( textChanged( const QString& ) ) ); 591 SLOT( textChanged( const QString& ) ) );
593 label->setBuddy( mAssistantEdit ); 592 label->setBuddy( mAssistantEdit );
594//US layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 ); 593//US layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 );
595 layout->addWidget( mAssistantEdit, 4, 2 ); 594 layout->addWidget( mAssistantEdit, 4, 2 );
596 595
597 bar = new KSeparator( KSeparator::HLine, tab2 ); 596 bar = new KSeparator( KSeparator::HLine, tab2 );
598//US layout->addMultiCellWidget( bar, 3, 3, 0, 5 ); 597//US layout->addMultiCellWidget( bar, 3, 3, 0, 5 );
599 layout->addMultiCellWidget( bar, 5, 5, 0, 2 ); 598 layout->addMultiCellWidget( bar, 5, 5, 0, 2 );
600 599
601 ///////////////////////////////////////////////// 600 /////////////////////////////////////////////////
602 // Personal info 601 // Personal info
603 602
604 label = new QLabel( tab2 ); 603 label = new QLabel( tab2 );
605//US loadIcon call is ambiguous. Add one more parameter 604//US loadIcon call is ambiguous. Add one more parameter
606//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 605//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
607 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 606 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
608//US layout->addMultiCellWidget( label, 4, 5, 0, 0 ); 607//US layout->addMultiCellWidget( label, 4, 5, 0, 0 );
609 layout->addMultiCellWidget( label, 6, 7, 0, 0 ); 608 layout->addMultiCellWidget( label, 6, 7, 0, 0 );
610 609
611 label = new QLabel( i18n( "Nick name:" ), tab2 ); 610 label = new QLabel( i18n( "Nick name:" ), tab2 );
612//US layout->addWidget( label, 4, 1 ); 611//US layout->addWidget( label, 4, 1 );
613 layout->addWidget( label, 6, 1 ); 612 layout->addWidget( label, 6, 1 );
614 mNicknameEdit = new KLineEdit( tab2 ); 613 mNicknameEdit = new KLineEdit( tab2 );
615 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 614 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
616 SLOT( textChanged( const QString& ) ) ); 615 SLOT( textChanged( const QString& ) ) );
617 label->setBuddy( mNicknameEdit ); 616 label->setBuddy( mNicknameEdit );
618//US layout->addWidget( mNicknameEdit, 4, 2 ); 617//US layout->addWidget( mNicknameEdit, 4, 2 );
619 layout->addWidget( mNicknameEdit, 6, 2 ); 618 layout->addWidget( mNicknameEdit, 6, 2 );
620 619
621 label = new QLabel( i18n( "Spouse's name:" ), tab2 ); 620 label = new QLabel( i18n( "Spouse's name:" ), tab2 );
622//US layout->addWidget( label, 5, 1 ); 621//US layout->addWidget( label, 5, 1 );
623 layout->addWidget( label, 7, 1 ); 622 layout->addWidget( label, 7, 1 );
624 mSpouseEdit = new KLineEdit( tab2 ); 623 mSpouseEdit = new KLineEdit( tab2 );
625 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 624 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
626 SLOT( textChanged( const QString& ) ) ); 625 SLOT( textChanged( const QString& ) ) );
627 label->setBuddy( mSpouseEdit ); 626 label->setBuddy( mSpouseEdit );
628//US layout->addWidget( mSpouseEdit, 5, 2 ); 627//US layout->addWidget( mSpouseEdit, 5, 2 );
629 layout->addWidget( mSpouseEdit, 7, 2 ); 628 layout->addWidget( mSpouseEdit, 7, 2 );
630 629
631 label = new QLabel( i18n( "Birthday:" ), tab2 ); 630 label = new QLabel( i18n( "Birthday:" ), tab2 );
632//US layout->addWidget( label, 4, 3 ); 631//US layout->addWidget( label, 4, 3 );
633 layout->addWidget( label, 8, 1 ); 632 layout->addWidget( label, 8, 1 );
634 mBirthdayPicker = new KDateEdit( tab2 ); 633 mBirthdayPicker = new KDateEdit( tab2 );
634 mBirthdayPicker->toggleDateFormat();
635 mBirthdayPicker->setHandleInvalid( true ); 635 mBirthdayPicker->setHandleInvalid( true );
636 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 636 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
637 SLOT( dateChanged( QDate ) ) ); 637 SLOT( dateChanged( QDate ) ) );
638 638
639 639
640#ifndef KAB_EMBEDDED 640#ifndef KAB_EMBEDDED
641 //US invalid dates are handdled by the KDateEdit widget itself 641 //US invalid dates are handdled by the KDateEdit widget itself
642 connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ), 642 connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ),
643 SLOT( invalidDate() ) ); 643 SLOT( invalidDate() ) );
644 connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ), 644 connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ),
645 SLOT( emitModified() ) ); 645 SLOT( emitModified() ) );
646#endif //KAB_EMBEDDED 646#endif //KAB_EMBEDDED
647 647
648 label->setBuddy( mBirthdayPicker ); 648 label->setBuddy( mBirthdayPicker );
649//US layout->addWidget( mBirthdayPicker, 4, 4 ); 649//US layout->addWidget( mBirthdayPicker, 4, 4 );
650 layout->addWidget( mBirthdayPicker, 8, 2 ); 650 layout->addWidget( mBirthdayPicker, 8, 2 );
651 651
652 label = new QLabel( i18n( "Anniversary:" ), tab2 ); 652 label = new QLabel( i18n( "Anniversary:" ), tab2 );
653//US layout->addWidget( label, 5, 3 ); 653//US layout->addWidget( label, 5, 3 );
654 layout->addWidget( label, 9, 1 ); 654 layout->addWidget( label, 9, 1 );
655 mAnniversaryPicker = new KDateEdit( tab2 ); 655 mAnniversaryPicker = new KDateEdit( tab2 );
656 mAnniversaryPicker->setHandleInvalid( true ); 656 mAnniversaryPicker->setHandleInvalid( true );
657 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), 657 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
658 SLOT( dateChanged( QDate ) ) ); 658 SLOT( dateChanged( QDate ) ) );
659#ifndef KAB_EMBEDDED 659#ifndef KAB_EMBEDDED
660 //US invalid dates are handled by the KDateEdit widget itself 660 //US invalid dates are handled by the KDateEdit widget itself
661 connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ), 661 connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ),
662 SLOT( invalidDate() ) ); 662 SLOT( invalidDate() ) );
663 connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ), 663 connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ),
664 SLOT( emitModified() ) ); 664 SLOT( emitModified() ) );
665#endif //KAB_EMBEDDED 665#endif //KAB_EMBEDDED
666 666
667 label->setBuddy( mAnniversaryPicker ); 667 label->setBuddy( mAnniversaryPicker );
668//US layout->addWidget( mAnniversaryPicker, 5, 4 ); 668//US layout->addWidget( mAnniversaryPicker, 5, 4 );
669 layout->addWidget( mAnniversaryPicker, 9, 2 ); 669 layout->addWidget( mAnniversaryPicker, 9, 2 );
670 670
671/*US 671/*US
672 bar = new KSeparator( KSeparator::HLine, tab2 ); 672 bar = new KSeparator( KSeparator::HLine, tab2 );
673 layout->addMultiCellWidget( bar, 6, 6, 0, 5 ); 673 layout->addMultiCellWidget( bar, 6, 6, 0, 5 );
674 674
675 ////////////////////////////////////// 675 //////////////////////////////////////
676 // Notes 676 // Notes
677 label = new QLabel( i18n( "Note:" ), tab2 ); 677 label = new QLabel( i18n( "Note:" ), tab2 );
678 label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); 678 label->setAlignment( Qt::AlignTop | Qt::AlignLeft );
679 layout->addWidget( label, 7, 0 ); 679 layout->addWidget( label, 7, 0 );
680#ifndef KAB_EMBEDDED 680#ifndef KAB_EMBEDDED
681 mNoteEdit = new QTextEdit( tab2 ); 681 mNoteEdit = new QTextEdit( tab2 );
682 mNoteEdit->setWordWrap( QTextEdit::WidgetWidth ); 682 mNoteEdit->setWordWrap( QTextEdit::WidgetWidth );
683 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); 683 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
684#else //KAB_EMBEDDED 684#else //KAB_EMBEDDED
685 mNoteEdit = new QMultiLineEdit( tab2 ); 685 mNoteEdit = new QMultiLineEdit( tab2 );
686//US mNoteEdit->setWordWrap( QTextEdit::WidgetWidth ); 686//US mNoteEdit->setWordWrap( QTextEdit::WidgetWidth );
687//US mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); 687//US mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
688qDebug("AddresseeEditorWidget::setupTab2 has to be changed"); 688qDebug("AddresseeEditorWidget::setupTab2 has to be changed");
689#endif //KAB_EMBEDDED 689#endif //KAB_EMBEDDED
690 connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) ); 690 connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) );
691 label->setBuddy( mNoteEdit ); 691 label->setBuddy( mNoteEdit );
692 layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 ); 692 layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 );
693*/ 693*/
694 // Build the layout and add to the tab widget 694 // Build the layout and add to the tab widget
695 layout->activate(); // required 695 layout->activate(); // required
696 696
697 mTabWidget->addTab( tab2, i18n( "&Details" ) ); 697 mTabWidget->addTab( tab2, i18n( "&Details" ) );
698} 698}
699 699
700void AddresseeEditorWidget::setupTab2_1() 700void AddresseeEditorWidget::setupTab2_1()
701{ 701{
702 // This is the Details tab 702 // This is the Details tab
703 QWidget *tab2_2 = new QWidget( mTabWidget ); 703 QWidget *tab2_2 = new QWidget( mTabWidget );
704 704
705 QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 ); 705 QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 );
706 layout->setMargin( KDialogBase::marginHintSmall() ); 706 layout->setMargin( KDialogBase::marginHintSmall() );
707 layout->setSpacing( KDialogBase::spacingHintSmall() ); 707 layout->setSpacing( KDialogBase::spacingHintSmall() );
708 708
709 QLabel *label; 709 QLabel *label;
710 KSeparator* bar; 710 KSeparator* bar;
711 711
712/*US 712/*US
713 /////////////////////// 713 ///////////////////////
714 // Office info 714 // Office info
715 715
716 // Department 716 // Department
717 label = new QLabel( tab2 ); 717 label = new QLabel( tab2 );
718//US loadIcon call is ambiguous. Add one more parameter 718//US loadIcon call is ambiguous. Add one more parameter
719//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); 719//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) );
720 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); 720 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) );
721 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 721 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
722 722
723 label = new QLabel( i18n( "Department:" ), tab2 ); 723 label = new QLabel( i18n( "Department:" ), tab2 );
724 layout->addWidget( label, 0, 1 ); 724 layout->addWidget( label, 0, 1 );
725 mDepartmentEdit = new KLineEdit( tab2 ); 725 mDepartmentEdit = new KLineEdit( tab2 );
726 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), 726 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ),
727 SLOT( textChanged( const QString& ) ) ); 727 SLOT( textChanged( const QString& ) ) );
728 label->setBuddy( mDepartmentEdit ); 728 label->setBuddy( mDepartmentEdit );
729 layout->addWidget( mDepartmentEdit, 0, 2 ); 729 layout->addWidget( mDepartmentEdit, 0, 2 );
730 730
731 label = new QLabel( i18n( "Office:" ), tab2 ); 731 label = new QLabel( i18n( "Office:" ), tab2 );
732 layout->addWidget( label, 1, 1 ); 732 layout->addWidget( label, 1, 1 );
733 mOfficeEdit = new KLineEdit( tab2 ); 733 mOfficeEdit = new KLineEdit( tab2 );
734 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ), 734 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ),
735 SLOT( textChanged( const QString& ) ) ); 735 SLOT( textChanged( const QString& ) ) );
736 label->setBuddy( mOfficeEdit ); 736 label->setBuddy( mOfficeEdit );
737 layout->addWidget( mOfficeEdit, 1, 2 ); 737 layout->addWidget( mOfficeEdit, 1, 2 );
738 738
739 label = new QLabel( i18n( "Profession:" ), tab2 ); 739 label = new QLabel( i18n( "Profession:" ), tab2 );
740 layout->addWidget( label, 2, 1 ); 740 layout->addWidget( label, 2, 1 );
741 mProfessionEdit = new KLineEdit( tab2 ); 741 mProfessionEdit = new KLineEdit( tab2 );
742 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ), 742 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ),
743 SLOT( textChanged( const QString& ) ) ); 743 SLOT( textChanged( const QString& ) ) );
744 label->setBuddy( mProfessionEdit ); 744 label->setBuddy( mProfessionEdit );
745 layout->addWidget( mProfessionEdit, 2, 2 ); 745 layout->addWidget( mProfessionEdit, 2, 2 );
746 746
747 label = new QLabel( i18n( "Manager\'s name:" ), tab2 ); 747 label = new QLabel( i18n( "Manager\'s name:" ), tab2 );
748 layout->addWidget( label, 0, 3 ); 748 layout->addWidget( label, 0, 3 );
749 mManagerEdit = new KLineEdit( tab2 ); 749 mManagerEdit = new KLineEdit( tab2 );
750 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ), 750 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ),
751 SLOT( textChanged( const QString& ) ) ); 751 SLOT( textChanged( const QString& ) ) );
752 label->setBuddy( mManagerEdit ); 752 label->setBuddy( mManagerEdit );
753 layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 ); 753 layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 );
754 754
755 label = new QLabel( i18n( "Assistant's name:" ), tab2 ); 755 label = new QLabel( i18n( "Assistant's name:" ), tab2 );
756 layout->addWidget( label, 1, 3 ); 756 layout->addWidget( label, 1, 3 );
757 mAssistantEdit = new KLineEdit( tab2 ); 757 mAssistantEdit = new KLineEdit( tab2 );
758 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ), 758 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ),
759 SLOT( textChanged( const QString& ) ) ); 759 SLOT( textChanged( const QString& ) ) );
760 label->setBuddy( mAssistantEdit ); 760 label->setBuddy( mAssistantEdit );
761 layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 ); 761 layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 );
762 762
763 bar = new KSeparator( KSeparator::HLine, tab2 ); 763 bar = new KSeparator( KSeparator::HLine, tab2 );
764 layout->addMultiCellWidget( bar, 3, 3, 0, 5 ); 764 layout->addMultiCellWidget( bar, 3, 3, 0, 5 );
765 765
766 ///////////////////////////////////////////////// 766 /////////////////////////////////////////////////
767 // Personal info 767 // Personal info
768 768
769 label = new QLabel( tab2 ); 769 label = new QLabel( tab2 );
770//US loadIcon call is ambiguous. Add one more parameter 770//US loadIcon call is ambiguous. Add one more parameter
771//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 771//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
772 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 772 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
773 layout->addMultiCellWidget( label, 4, 5, 0, 0 ); 773 layout->addMultiCellWidget( label, 4, 5, 0, 0 );
774 774
775 label = new QLabel( i18n( "Nick name:" ), tab2 ); 775 label = new QLabel( i18n( "Nick name:" ), tab2 );
776 layout->addWidget( label, 4, 1 ); 776 layout->addWidget( label, 4, 1 );
777 mNicknameEdit = new KLineEdit( tab2 ); 777 mNicknameEdit = new KLineEdit( tab2 );
778 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 778 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
779 SLOT( textChanged( const QString& ) ) ); 779 SLOT( textChanged( const QString& ) ) );
780 label->setBuddy( mNicknameEdit ); 780 label->setBuddy( mNicknameEdit );
781 layout->addWidget( mNicknameEdit, 4, 2 ); 781 layout->addWidget( mNicknameEdit, 4, 2 );
782 782
783 label = new QLabel( i18n( "Spouse's name:" ), tab2 ); 783 label = new QLabel( i18n( "Spouse's name:" ), tab2 );
784 layout->addWidget( label, 5, 1 ); 784 layout->addWidget( label, 5, 1 );
785 mSpouseEdit = new KLineEdit( tab2 ); 785 mSpouseEdit = new KLineEdit( tab2 );
786 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 786 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
787 SLOT( textChanged( const QString& ) ) ); 787 SLOT( textChanged( const QString& ) ) );
788 label->setBuddy( mSpouseEdit ); 788 label->setBuddy( mSpouseEdit );
789 layout->addWidget( mSpouseEdit, 5, 2 ); 789 layout->addWidget( mSpouseEdit, 5, 2 );
790 790
791 label = new QLabel( i18n( "Birthday:" ), tab2 ); 791 label = new QLabel( i18n( "Birthday:" ), tab2 );
792 layout->addWidget( label, 4, 3 ); 792 layout->addWidget( label, 4, 3 );
793 mBirthdayPicker = new KDateEdit( tab2 ); 793 mBirthdayPicker = new KDateEdit( tab2 );
794 mBirthdayPicker->setHandleInvalid( true ); 794 mBirthdayPicker->setHandleInvalid( true );
795 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 795 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
796 SLOT( dateChanged( QDate ) ) ); 796 SLOT( dateChanged( QDate ) ) );
797 connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ), 797 connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ),
798 SLOT( invalidDate() ) ); 798 SLOT( invalidDate() ) );
799 connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ), 799 connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ),
800 SLOT( emitModified() ) ); 800 SLOT( emitModified() ) );
801 label->setBuddy( mBirthdayPicker ); 801 label->setBuddy( mBirthdayPicker );
802 layout->addWidget( mBirthdayPicker, 4, 4 ); 802 layout->addWidget( mBirthdayPicker, 4, 4 );
803 803
804 label = new QLabel( i18n( "Anniversary:" ), tab2 ); 804 label = new QLabel( i18n( "Anniversary:" ), tab2 );
805 layout->addWidget( label, 5, 3 ); 805 layout->addWidget( label, 5, 3 );
806 mAnniversaryPicker = new KDateEdit( tab2 ); 806 mAnniversaryPicker = new KDateEdit( tab2 );
807 mAnniversaryPicker->setHandleInvalid( true ); 807 mAnniversaryPicker->setHandleInvalid( true );
808 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), 808 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
809 SLOT( dateChanged( QDate ) ) ); 809 SLOT( dateChanged( QDate ) ) );
810 connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ), 810 connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ),
811 SLOT( invalidDate() ) ); 811 SLOT( invalidDate() ) );
812 connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ), 812 connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ),
813 SLOT( emitModified() ) ); 813 SLOT( emitModified() ) );
814 label->setBuddy( mAnniversaryPicker ); 814 label->setBuddy( mAnniversaryPicker );
815 layout->addWidget( mAnniversaryPicker, 5, 4 ); 815 layout->addWidget( mAnniversaryPicker, 5, 4 );
816 816
817 bar = new KSeparator( KSeparator::HLine, tab2 ); 817 bar = new KSeparator( KSeparator::HLine, tab2 );
818 layout->addMultiCellWidget( bar, 6, 6, 0, 5 ); 818 layout->addMultiCellWidget( bar, 6, 6, 0, 5 );
819*/ 819*/
820 ////////////////////////////////////// 820 //////////////////////////////////////
821 // Notes 821 // Notes
822 label = new QLabel( i18n( "Note:" ), tab2_2 ); 822 label = new QLabel( i18n( "Note:" ), tab2_2 );
823 label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); 823 label->setAlignment( Qt::AlignTop | Qt::AlignLeft );
824//US layout->addWidget( label, 7, 0 ); 824//US layout->addWidget( label, 7, 0 );
825 layout->addWidget( label, 0, 0 ); 825 layout->addWidget( label, 0, 0 );
826#ifndef KAB_EMBEDDED 826#ifndef KAB_EMBEDDED
827 mNoteEdit = new QTextEdit( tab2_2 ); 827 mNoteEdit = new QTextEdit( tab2_2 );
828 mNoteEdit->setWordWrap( QTextEdit::WidgetWidth ); 828 mNoteEdit->setWordWrap( QTextEdit::WidgetWidth );
829 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); 829 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
830#else //KAB_EMBEDDED 830#else //KAB_EMBEDDED
831 mNoteEdit = new QMultiLineEdit( tab2_2 ); 831 mNoteEdit = new QMultiLineEdit( tab2_2 );
832 mNoteEdit->setWordWrap( QMultiLineEdit::WidgetWidth ); 832 mNoteEdit->setWordWrap( QMultiLineEdit::WidgetWidth );
833 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); 833 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
834#endif //KAB_EMBEDDED 834#endif //KAB_EMBEDDED
835 835
836 connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) ); 836 connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) );
837 label->setBuddy( mNoteEdit ); 837 label->setBuddy( mNoteEdit );
838//US layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 ); 838//US layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 );
839 layout->addWidget( mNoteEdit, 1, 0); 839 layout->addWidget( mNoteEdit, 1, 0);
840 840
841 // Build the layout and add to the tab widget 841 // Build the layout and add to the tab widget
842 layout->activate(); // required 842 layout->activate(); // required
843 843
844 mTabWidget->addTab( tab2_2, i18n( "&Notes" ) ); 844 mTabWidget->addTab( tab2_2, i18n( "&Notes" ) );
845} 845}
846 846
847 847
848 848
849void AddresseeEditorWidget::setupTab3() 849void AddresseeEditorWidget::setupTab3()
850{ 850{
851 // This is the Misc tab 851 // This is the Misc tab
852 QWidget *tab3 = new QWidget( mTabWidget ); 852 QWidget *tab3 = new QWidget( mTabWidget );
853 853
854 QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); 854 QGridLayout *layout = new QGridLayout( tab3, 1, 1 );
855 layout->setMargin( KDialogBase::marginHintSmall() ); 855 layout->setMargin( KDialogBase::marginHintSmall() );
856 layout->setSpacing( KDialogBase::spacingHintSmall() ); 856 layout->setSpacing( KDialogBase::spacingHintSmall() );
857//US layout->setColStretch( 2, 1 ); 857//US layout->setColStretch( 2, 1 );
858 858
859 ////////////////////////////////////// 859 //////////////////////////////////////
860 // Geo 860 // Geo
861 mGeoWidget = new GeoWidget( tab3 ); 861 mGeoWidget = new GeoWidget( tab3 );
862 // mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); 862 // mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() );
863 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 863 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
864 layout->addWidget( mGeoWidget, 0, 0 ); 864 layout->addWidget( mGeoWidget, 0, 0 );
865/*US 865/*US
866 ////////////////////////////////////// 866 //////////////////////////////////////
867 // Sound 867 // Sound
868#ifndef KAB_EMBEDDED 868#ifndef KAB_EMBEDDED
869 mSoundWidget = new SoundWidget( tab3 ); 869 mSoundWidget = new SoundWidget( tab3 );
870 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); 870 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() );
871 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 871 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
872 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); 872 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop );
873#else //KAB_EMBEDDED 873#else //KAB_EMBEDDED
874qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); 874qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed");
875#endif //KAB_EMBEDDED 875#endif //KAB_EMBEDDED
876 876
877 ////////////////////////////////////// 877 //////////////////////////////////////
878 // Images 878 // Images
879 mImageWidget = new ImageWidget( tab3 ); 879 mImageWidget = new ImageWidget( tab3 );
880 mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); 880 mImageWidget->setMinimumSize( mImageWidget->sizeHint() );
881 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 881 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
882 layout->addWidget( mImageWidget, 1, 0, Qt::AlignTop ); 882 layout->addWidget( mImageWidget, 1, 0, Qt::AlignTop );
883*/ 883*/
884//US 884//US
885/* 885/*
886 KSeparator* bar = new KSeparator( KSeparator::HLine, tab3 ); 886 KSeparator* bar = new KSeparator( KSeparator::HLine, tab3 );
887 layout->addMultiCellWidget( bar, 1, 1, 0, 0 ); 887 layout->addMultiCellWidget( bar, 1, 1, 0, 0 );
888*/ 888*/
889 ////////////////////////////////////// 889 //////////////////////////////////////
890 // Keys 890 // Keys
891 mKeyWidget = new KeyWidget( tab3 ); 891 mKeyWidget = new KeyWidget( tab3 );
892 //mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); 892 //mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() );
893 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 893 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
894//US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); 894//US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop );
895 layout->addWidget( mKeyWidget, 1, 0 ); 895 layout->addWidget( mKeyWidget, 1, 0 );
896 896
897 mTabWidget->addTab( tab3, i18n( "&Misc" ) ); 897 mTabWidget->addTab( tab3, i18n( "&Misc" ) );
898} 898}
899 899
900void AddresseeEditorWidget::setupTab3_1() 900void AddresseeEditorWidget::setupTab3_1()
901{ 901{
902 // This is the Misc tab 902 // This is the Misc tab
903 QWidget *tab3 = new QWidget( mTabWidget ); 903 QWidget *tab3 = new QWidget( mTabWidget );
904 904
905//US QGridLayout *layout = new QGridLayout( tab3, 2, 3 ); 905//US QGridLayout *layout = new QGridLayout( tab3, 2, 3 );
906 QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); 906 QGridLayout *layout = new QGridLayout( tab3, 1, 1 );
907 layout->setMargin( KDialogBase::marginHint() ); 907 layout->setMargin( KDialogBase::marginHint() );
908 layout->setSpacing( KDialogBase::spacingHint() ); 908 layout->setSpacing( KDialogBase::spacingHint() );
909//US layout->setColStretch( 2, 1 ); 909//US layout->setColStretch( 2, 1 );
910 910
911/*US 911/*US
912 ////////////////////////////////////// 912 //////////////////////////////////////
913 // Geo 913 // Geo
914 mGeoWidget = new GeoWidget( tab3 ); 914 mGeoWidget = new GeoWidget( tab3 );
915 mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); 915 mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() );
916 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 916 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
917 layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop ); 917 layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop );
918*/ 918*/
919 ////////////////////////////////////// 919 //////////////////////////////////////
920 // Sound 920 // Sound
921#ifndef KAB_EMBEDDED 921#ifndef KAB_EMBEDDED
922 mSoundWidget = new SoundWidget( tab3 ); 922 mSoundWidget = new SoundWidget( tab3 );
923 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); 923 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() );
924 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 924 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
925 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); 925 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop );
926#else //KAB_EMBEDDED 926#else //KAB_EMBEDDED
927//US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); 927//US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed");
928#endif //KAB_EMBEDDED 928#endif //KAB_EMBEDDED
929 929
930 ////////////////////////////////////// 930 //////////////////////////////////////
931 // Images 931 // Images
932 mImageWidget = new ImageWidget( tab3 ); 932 mImageWidget = new ImageWidget( tab3 );
933 mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); 933 mImageWidget->setMinimumSize( mImageWidget->sizeHint() );
934 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 934 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
935 layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop ); 935 layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop );
936/*US 936/*US
937 ////////////////////////////////////// 937 //////////////////////////////////////
938 // Keys 938 // Keys
939 mKeyWidget = new KeyWidget( tab3 ); 939 mKeyWidget = new KeyWidget( tab3 );
940 mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); 940 mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() );
941 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 941 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
942 layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); 942 layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop );
943*/ 943*/
944 mTabWidget->addTab( tab3, i18n( "&Images" ) ); 944 mTabWidget->addTab( tab3, i18n( "&Images" ) );
945} 945}
946 946
947 947
948void AddresseeEditorWidget::load() 948void AddresseeEditorWidget::load()
949{ 949{
950 kdDebug(5720) << "AddresseeEditorWidget::load()" << endl;
951 950
952 // Block signals in case anything tries to emit modified 951 // Block signals in case anything tries to emit modified
953 // CS: This doesn't seem to work. 952 // CS: This doesn't seem to work.
954 bool block = signalsBlocked(); 953 bool block = signalsBlocked();
955 blockSignals( true ); 954 blockSignals( true );
956 mBlockSignals = true; // used for internal signal blocking 955 mBlockSignals = true; // used for internal signal blocking
957 956
958 mNameEdit->setText( mAddressee.assembledName() ); 957 mNameEdit->setText( mAddressee.assembledName() );
959 958
960 if ( mAddressee.formattedName().isEmpty() ) { 959 if ( mAddressee.formattedName().isEmpty() ) {
961//US KConfig config( "kaddressbookrc" ); 960//US KConfig config( "kaddressbookrc" );
962 KConfig config( locateLocal("config", "kaddressbookrc") ); 961 KConfig config( locateLocal("config", "kaddressbookrc") );
963 config.setGroup( "General" ); 962 config.setGroup( "General" );
964 mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 ); 963 mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 );
965 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 964 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
966 } else { 965 } else {
967 if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) ) 966 if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) )
968 mFormattedNameType = NameEditDialog::SimpleName; 967 mFormattedNameType = NameEditDialog::SimpleName;
969 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) ) 968 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) )
970 mFormattedNameType = NameEditDialog::FullName; 969 mFormattedNameType = NameEditDialog::FullName;
971 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) ) 970 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) )
972 mFormattedNameType = NameEditDialog::ReverseName; 971 mFormattedNameType = NameEditDialog::ReverseName;
973 else 972 else
974 mFormattedNameType = NameEditDialog::CustomName; 973 mFormattedNameType = NameEditDialog::CustomName;
975 } 974 }
976 975
977 mFormattedNameLabel->setText( mAddressee.formattedName() ); 976 mFormattedNameLabel->setText( mAddressee.formattedName() );
978 977
979 mRoleEdit->setText( mAddressee.role() ); 978 mRoleEdit->setText( mAddressee.role() );
980 mOrgEdit->setText( mAddressee.organization() ); 979 mOrgEdit->setText( mAddressee.organization() );
981 980
982//US mURLEdit->setURL( mAddressee.url().url() ); 981//US mURLEdit->setURL( mAddressee.url().url() );
983 mURLEdit->setText( mAddressee.url().prettyURL() ); 982 mURLEdit->setText( mAddressee.url().prettyURL() );
984//US?? mURLEdit->home( false ); 983//US?? mURLEdit->home( false );
985 984
986 // mNoteEdit->setText( mAddressee.note() ); 985 // mNoteEdit->setText( mAddressee.note() );
987 mNoteEdit->setText( mAddressee.note() ); 986 mNoteEdit->setText( mAddressee.note() );
988 mEmailWidget->setEmails( mAddressee.emails() ); 987 mEmailWidget->setEmails( mAddressee.emails() );
989 mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() ); 988 mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() );
990 mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() ); 989 mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() );
991 mBirthdayPicker->setDate( mAddressee.birthday().date() ); 990 mBirthdayPicker->setDate( mAddressee.birthday().date() );
992 991
993//US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom( 992//US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom(
994//US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) ); 993//US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) );
995 QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), 994 QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
996 "%Y-%m-%d"); // = Qt::ISODate 995 "%Y-%m-%d"); // = Qt::ISODate
997 mAnniversaryPicker->setDate( dt ); 996 mAnniversaryPicker->setDate( dt );
998 997
999 998
1000 mNicknameEdit->setText( mAddressee.nickName() ); 999 mNicknameEdit->setText( mAddressee.nickName() );
1001 mCategoryEdit->setText( mAddressee.categories().join( "," ) ); 1000 mCategoryEdit->setText( mAddressee.categories().join( "," ) );
1002 1001
1003 mGeoWidget->setGeo( mAddressee.geo() ); 1002 mGeoWidget->setGeo( mAddressee.geo() );
1004 mImageWidget->setPhoto( mAddressee.photo() ); 1003 mImageWidget->setPhoto( mAddressee.photo() );
1005 mImageWidget->setLogo( mAddressee.logo() ); 1004 mImageWidget->setLogo( mAddressee.logo() );
1006 mKeyWidget->setKeys( mAddressee.keys() ); 1005 mKeyWidget->setKeys( mAddressee.keys() );
1007 mSecrecyWidget->setSecrecy( mAddressee.secrecy() ); 1006 mSecrecyWidget->setSecrecy( mAddressee.secrecy() );
1008#ifndef KAB_EMBEDDED 1007#ifndef KAB_EMBEDDED
1009 mSoundWidget->setSound( mAddressee.sound() ); 1008 mSoundWidget->setSound( mAddressee.sound() );
1010#else //KAB_EMBEDDED 1009#else //KAB_EMBEDDED
1011//US qDebug("AddresseeEditorWidget::load has to be changed 2"); 1010//US qDebug("AddresseeEditorWidget::load has to be changed 2");
1012#endif //KAB_EMBEDDED 1011#endif //KAB_EMBEDDED
1013 1012
1014 // Load customs 1013 // Load customs
1015 mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) ); 1014 mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) );
1016 mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) ); 1015 mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) );
1017 mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) ); 1016 mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) );
1018 mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) ); 1017 mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) );
1019 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) ); 1018 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) );
1020 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) ); 1019 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) );
1021 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) ); 1020 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) );
1022 1021
1023 blockSignals( block ); 1022 blockSignals( block );
1024 mBlockSignals = false; 1023 mBlockSignals = false;
1025 1024
1026 mDirty = false; 1025 mDirty = false;
1027} 1026}
1028 1027
1029void AddresseeEditorWidget::save() 1028void AddresseeEditorWidget::save()
1030{ 1029{
1031 if ( !mDirty ) return; 1030 if ( !dirty() ) {
1031 return;
1032 }
1032 1033
1033 mAddressee.setRole( mRoleEdit->text() ); 1034 mAddressee.setRole( mRoleEdit->text() );
1034 mAddressee.setOrganization( mOrgEdit->text() ); 1035 mAddressee.setOrganization( mOrgEdit->text() );
1035 mAddressee.setUrl( KURL( mURLEdit->text() ) ); 1036 mAddressee.setUrl( KURL( mURLEdit->text() ) );
1036 mAddressee.setNote( mNoteEdit->text() ); 1037 mAddressee.setNote( mNoteEdit->text() );
1037 if ( mBirthdayPicker->inputIsValid() ) 1038 if ( mBirthdayPicker->inputIsValid() ) {
1038 mAddressee.setBirthday( QDateTime( mBirthdayPicker->date() ) ); 1039 QDate da = mBirthdayPicker->date();
1039 else 1040 if ( da > QDate::currentDate() )
1041 da.setYMD(da.year()-100, da.month(), da.day() );
1042 mAddressee.setBirthday( QDateTime( da ) );
1043 qDebug("bday %s ",da.toString().latin1());
1044 }
1045 else {
1040 mAddressee.setBirthday( QDateTime() ); 1046 mAddressee.setBirthday( QDateTime() );
1041 1047 mBirthdayPicker->clear();
1048 }
1042 mAddressee.setNickName( mNicknameEdit->text() ); 1049 mAddressee.setNickName( mNicknameEdit->text() );
1043 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); 1050 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) );
1044 1051
1045 mAddressee.setGeo( mGeoWidget->geo() ); 1052 mAddressee.setGeo( mGeoWidget->geo() );
1046 mAddressee.setPhoto( mImageWidget->photo() ); 1053 mAddressee.setPhoto( mImageWidget->photo() );
1047 mAddressee.setLogo( mImageWidget->logo() ); 1054 mAddressee.setLogo( mImageWidget->logo() );
1048 mAddressee.setKeys( mKeyWidget->keys() ); 1055 mAddressee.setKeys( mKeyWidget->keys() );
1049#ifndef KAB_EMBEDDED 1056#ifndef KAB_EMBEDDED
1050 mAddressee.setSound( mSoundWidget->sound() ); 1057 mAddressee.setSound( mSoundWidget->sound() );
1051#else //KAB_EMBEDDED 1058#else //KAB_EMBEDDED
1052//US qDebug("AddresseeEditorWidget::save sound not supported"); 1059//US qDebug("AddresseeEditorWidget::save sound not supported");
1053#endif //KAB_EMBEDDED 1060#endif //KAB_EMBEDDED
1054 mAddressee.setSecrecy( mSecrecyWidget->secrecy() ); 1061 mAddressee.setSecrecy( mSecrecyWidget->secrecy() );
1055 1062
1056 // save custom fields 1063 // save custom fields
1057 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); 1064 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() );
1058 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); 1065 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() );
1059 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); 1066 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() );
1060 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); 1067 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() );
1061 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); 1068 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() );
1062 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); 1069 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() );
1063 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); 1070 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() );
1064 if ( mAnniversaryPicker->inputIsValid() ) { 1071 if ( mAnniversaryPicker->inputIsValid() ) {
1065
1066//US mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary",
1067//US mAnniversaryPicker->date().toString( Qt::ISODate ) );
1068 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); 1072 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate);
1069 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); 1073 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
1070 } 1074 }
1071 else 1075 else {
1072 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); 1076 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" );
1077 mAnniversaryPicker->clear();
1078 }
1073 1079
1074 // Save the email addresses 1080 // Save the email addresses
1075 QStringList emails = mAddressee.emails(); 1081 QStringList emails = mAddressee.emails();
1076 QStringList::Iterator iter; 1082 QStringList::Iterator iter;
1077 for ( iter = emails.begin(); iter != emails.end(); ++iter ) 1083 for ( iter = emails.begin(); iter != emails.end(); ++iter )
1078 mAddressee.removeEmail( *iter ); 1084 mAddressee.removeEmail( *iter );
1079 1085
1080 emails = mEmailWidget->emails(); 1086 emails = mEmailWidget->emails();
1081 bool first = true; 1087 bool first = true;
1082 for ( iter = emails.begin(); iter != emails.end(); ++iter ) { 1088 for ( iter = emails.begin(); iter != emails.end(); ++iter ) {
1083 mAddressee.insertEmail( *iter, first ); 1089 mAddressee.insertEmail( *iter, first );
1084 first = false; 1090 first = false;
1085 } 1091 }
1086 1092
1087 // Save the phone numbers 1093 // Save the phone numbers
1088 KABC::PhoneNumber::List phoneNumbers; 1094 KABC::PhoneNumber::List phoneNumbers;
1089 KABC::PhoneNumber::List::Iterator phoneIter; 1095 KABC::PhoneNumber::List::Iterator phoneIter;
1090 phoneNumbers = mAddressee.phoneNumbers(); 1096 phoneNumbers = mAddressee.phoneNumbers();
1091 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); 1097 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end();
1092 ++phoneIter ) 1098 ++phoneIter )
1093 mAddressee.removePhoneNumber( *phoneIter ); 1099 mAddressee.removePhoneNumber( *phoneIter );
1094 1100
1095 phoneNumbers = mPhoneEditWidget->phoneNumbers(); 1101 phoneNumbers = mPhoneEditWidget->phoneNumbers();
1096 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); 1102 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end();
1097 ++phoneIter ) 1103 ++phoneIter )
1098 mAddressee.insertPhoneNumber( *phoneIter ); 1104 mAddressee.insertPhoneNumber( *phoneIter );
1099 1105
1100 // Save the addresses 1106 // Save the addresses
1101 KABC::Address::List addresses; 1107 KABC::Address::List addresses;
1102 KABC::Address::List::Iterator addressIter; 1108 KABC::Address::List::Iterator addressIter;
1103 addresses = mAddressee.addresses(); 1109 addresses = mAddressee.addresses();
1104 for ( addressIter = addresses.begin(); addressIter != addresses.end(); 1110 for ( addressIter = addresses.begin(); addressIter != addresses.end();
1105 ++addressIter ) 1111 ++addressIter )
1106 mAddressee.removeAddress( *addressIter ); 1112 mAddressee.removeAddress( *addressIter );
1107 1113
1108 addresses = mAddressEditWidget->addresses(); 1114 addresses = mAddressEditWidget->addresses();
1109 for ( addressIter = addresses.begin(); addressIter != addresses.end(); 1115 for ( addressIter = addresses.begin(); addressIter != addresses.end();
1110 ++addressIter ) 1116 ++addressIter )
1111 mAddressee.insertAddress( *addressIter ); 1117 mAddressee.insertAddress( *addressIter );
1112 mDirty = false; 1118 mDirty = false;
1113} 1119}
1114 1120
1115bool AddresseeEditorWidget::dirty() 1121bool AddresseeEditorWidget::dirty()
1116{ 1122{
1123
1124 if ( ! mDirty ) {
1125 if ( mBirthdayPicker->inputIsValid() ) {
1126 QDate da = mBirthdayPicker->date();
1127 if ( !(da == mAddressee.birthday().date()))
1128 mDirty = true;
1129 }
1130 else {
1131 mBirthdayPicker->clear();
1132 }
1133 if ( mAnniversaryPicker->inputIsValid() ) {
1134 QDate da = mAnniversaryPicker->date();
1135 if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
1136 "%Y-%m-%d"))
1137 mDirty = true;
1138 }
1139 else {
1140 mAnniversaryPicker->clear();
1141 }
1142 }
1117 return mDirty; 1143 return mDirty;
1118} 1144}
1119 1145
1120void AddresseeEditorWidget::nameTextChanged( const QString &text ) 1146void AddresseeEditorWidget::nameTextChanged( const QString &text )
1121{ 1147{
1122 // use the addressee class to parse the name for us 1148 // use the addressee class to parse the name for us
1123 mAConfig->setUid( mAddressee.uid() ); 1149 mAConfig->setUid( mAddressee.uid() );
1124 if ( mAConfig->automaticNameParsing() ) { 1150 if ( mAConfig->automaticNameParsing() ) {
1125 if ( !mAddressee.formattedName().isEmpty() ) { 1151 if ( !mAddressee.formattedName().isEmpty() ) {
1126 QString fn = mAddressee.formattedName(); 1152 QString fn = mAddressee.formattedName();
1127 mAddressee.setNameFromString( text ); 1153 mAddressee.setNameFromString( text );
1128 mAddressee.setFormattedName( fn ); 1154 mAddressee.setFormattedName( fn );
1129 } else { 1155 } else {
1130 // use extra addressee to avoid a formatted name assignment 1156 // use extra addressee to avoid a formatted name assignment
1131 Addressee addr; 1157 Addressee addr;
1132 addr.setNameFromString( text ); 1158 addr.setNameFromString( text );
1133 mAddressee.setPrefix( addr.prefix() ); 1159 mAddressee.setPrefix( addr.prefix() );
1134 mAddressee.setGivenName( addr.givenName() ); 1160 mAddressee.setGivenName( addr.givenName() );
1135 mAddressee.setAdditionalName( addr.additionalName() ); 1161 mAddressee.setAdditionalName( addr.additionalName() );
1136 mAddressee.setFamilyName( addr.familyName() ); 1162 mAddressee.setFamilyName( addr.familyName() );
1137 mAddressee.setSuffix( addr.suffix() ); 1163 mAddressee.setSuffix( addr.suffix() );
1138 } 1164 }
1139 } 1165 }
1140 1166
1141 nameBoxChanged(); 1167 nameBoxChanged();
1142 1168
1143 emitModified(); 1169 emitModified();
1144} 1170}
1145 1171
1146void AddresseeEditorWidget::nameBoxChanged() 1172void AddresseeEditorWidget::nameBoxChanged()
1147{ 1173{
1148 KABC::Addressee addr; 1174 KABC::Addressee addr;
1149 mAConfig->setUid( mAddressee.uid() ); 1175 mAConfig->setUid( mAddressee.uid() );
1150 if ( mAConfig->automaticNameParsing() ) { 1176 if ( mAConfig->automaticNameParsing() ) {
1151 addr.setNameFromString( mNameEdit->text() ); 1177 addr.setNameFromString( mNameEdit->text() );
1152 mNameLabel->hide(); 1178 mNameLabel->hide();
1153 mNameEdit->show(); 1179 mNameEdit->show();
1154 } else { 1180 } else {
1155 addr = mAddressee; 1181 addr = mAddressee;
1156 mNameEdit->hide(); 1182 mNameEdit->hide();
1157 mNameLabel->setText( mNameEdit->text() ); 1183 mNameLabel->setText( mNameEdit->text() );
1158 mNameLabel->show(); 1184 mNameLabel->show();
1159 } 1185 }
1160 1186
1161 if ( mFormattedNameType != NameEditDialog::CustomName ) { 1187 if ( mFormattedNameType != NameEditDialog::CustomName ) {
1162 mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 1188 mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
1163 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 1189 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
1164 } 1190 }
1165} 1191}
1166 1192
1167void AddresseeEditorWidget::nameButtonClicked() 1193void AddresseeEditorWidget::nameButtonClicked()
1168{ 1194{
1169 // show the name dialog. 1195 // show the name dialog.
1170 NameEditDialog dialog( mAddressee, mFormattedNameType, this ); 1196 NameEditDialog dialog( mAddressee, mFormattedNameType, this );
1171 1197
1172 if ( dialog.exec() ) { 1198 if ( KApplication::execDialog( &dialog) ) {
1173 if ( dialog.changed() ) { 1199 if ( dialog.changed() ) {
1174 mAddressee.setFamilyName( dialog.familyName() ); 1200 mAddressee.setFamilyName( dialog.familyName() );
1175 mAddressee.setGivenName( dialog.givenName() ); 1201 mAddressee.setGivenName( dialog.givenName() );
1176 mAddressee.setPrefix( dialog.prefix() ); 1202 mAddressee.setPrefix( dialog.prefix() );
1177 mAddressee.setSuffix( dialog.suffix() ); 1203 mAddressee.setSuffix( dialog.suffix() );
1178 mAddressee.setAdditionalName( dialog.additionalName() ); 1204 mAddressee.setAdditionalName( dialog.additionalName() );
1179 mFormattedNameType = dialog.formattedNameType(); 1205 mFormattedNameType = dialog.formattedNameType();
1180 if ( mFormattedNameType == NameEditDialog::CustomName ) { 1206 if ( mFormattedNameType == NameEditDialog::CustomName ) {
1181 mFormattedNameLabel->setText( dialog.customFormattedName() ); 1207 mFormattedNameLabel->setText( dialog.customFormattedName() );
1182 mAddressee.setFormattedName( dialog.customFormattedName() ); 1208 mAddressee.setFormattedName( dialog.customFormattedName() );
1183 } 1209 }
1184 // Update the name edit. 1210 // Update the name edit.
1185 bool block = mNameEdit->signalsBlocked(); 1211 bool block = mNameEdit->signalsBlocked();
1186 mNameEdit->blockSignals( true ); 1212 mNameEdit->blockSignals( true );
1187 mNameEdit->setText( mAddressee.assembledName() ); 1213 mNameEdit->setText( mAddressee.assembledName() );
1188 mNameEdit->blockSignals( block ); 1214 mNameEdit->blockSignals( block );
1189 1215
1190 // Update the combo box. 1216 // Update the combo box.
1191 nameBoxChanged(); 1217 nameBoxChanged();
1192 1218
1193 emitModified(); 1219 emitModified();
1194 } 1220 }
1195 } 1221 }
1196} 1222}
1197 1223
1198void AddresseeEditorWidget::categoryButtonClicked() 1224void AddresseeEditorWidget::categoryButtonClicked()
1199{ 1225{
1200 // Show the category dialog 1226 // Show the category dialog
1201 if ( mCategoryDialog == 0 ) { 1227 if ( mCategoryDialog == 0 ) {
1202 mCategoryDialog = new KPIM::CategorySelectDialog( KABPrefs::instance(), this ); 1228 mCategoryDialog = new KPIM::CategorySelectDialog( KABPrefs::instance(), this );
1203 connect( mCategoryDialog, SIGNAL( categoriesSelected( const QStringList& ) ), 1229 connect( mCategoryDialog, SIGNAL( categoriesSelected( const QStringList& ) ),
1204 SLOT(categoriesSelected( const QStringList& ) ) ); 1230 SLOT(categoriesSelected( const QStringList& ) ) );
1205 connect( mCategoryDialog, SIGNAL( editCategories() ), SLOT( editCategories() ) ); 1231 connect( mCategoryDialog, SIGNAL( editCategories() ), SLOT( editCategories() ) );
1206 } 1232 }
1207 1233
1208 mCategoryDialog->setCategories(); 1234 mCategoryDialog->setCategories();
1209 mCategoryDialog->setSelected( QStringList::split( ",", mCategoryEdit->text() ) ); 1235 mCategoryDialog->setSelected( QStringList::split( ",", mCategoryEdit->text() ) );
1210 mCategoryDialog->show(); 1236 mCategoryDialog->show();
1211 mCategoryDialog->raise(); 1237 mCategoryDialog->raise();
1212} 1238}
1213 1239
1214void AddresseeEditorWidget::categoriesSelected( const QStringList &list ) 1240void AddresseeEditorWidget::categoriesSelected( const QStringList &list )
1215{ 1241{
1216 mCategoryEdit->setText( list.join( "," ) ); 1242 mCategoryEdit->setText( list.join( "," ) );
1217} 1243}
1218 1244
1219void AddresseeEditorWidget::editCategories() 1245void AddresseeEditorWidget::editCategories()
1220{ 1246{
1221 if ( mCategoryEditDialog == 0 ) { 1247 if ( mCategoryEditDialog == 0 ) {
1222 mCategoryEditDialog = new KPIM::CategoryEditDialog( KABPrefs::instance(), this ); 1248 mCategoryEditDialog = new KPIM::CategoryEditDialog( KABPrefs::instance(), this );
1223 connect( mCategoryEditDialog, SIGNAL( categoryConfigChanged() ), 1249 connect( mCategoryEditDialog, SIGNAL( categoryConfigChanged() ),
1224 SLOT( categoryButtonClicked() ) ); 1250 SLOT( categoryButtonClicked() ) );
1225 } 1251 }
1226 1252
1227 mCategoryEditDialog->show(); 1253 mCategoryEditDialog->show();
1228 mCategoryEditDialog->raise(); 1254 mCategoryEditDialog->raise();
1229} 1255}
1230 1256
1231void AddresseeEditorWidget::emitModified() 1257void AddresseeEditorWidget::emitModified()
1232{ 1258{
1233 mDirty = true; 1259 mDirty = true;
1234 1260
1235 KABC::Addressee::List list; 1261 KABC::Addressee::List list;
1236 1262
1237 if ( mIsExtension && !mBlockSignals ) { 1263 if ( mIsExtension && !mBlockSignals ) {
1238 save(); 1264 save();
1239 list.append( mAddressee ); 1265 list.append( mAddressee );
1240 } 1266 }
1241 1267
1242 emit modified( list ); 1268 emit modified( list );
1243} 1269}
1244 1270
1245void AddresseeEditorWidget::dateChanged( QDate ) 1271void AddresseeEditorWidget::dateChanged( QDate )
1246{ 1272{
1247 emitModified(); 1273 emitModified();
1248} 1274}
1249 1275
1250//US invalid dates are handdled by the KDateEdit widget itself 1276//US invalid dates are handdled by the KDateEdit widget itself
1251void AddresseeEditorWidget::invalidDate() 1277void AddresseeEditorWidget::invalidDate()
1252{ 1278{
1253 KMessageBox::sorry( this, i18n( "You must specify a valid date" ) ); 1279 KMessageBox::sorry( this, i18n( "You must specify a valid date" ) );
1254} 1280}
1255 1281
1256 1282
1257void AddresseeEditorWidget::pageChanged( QWidget *wdg ) 1283void AddresseeEditorWidget::pageChanged( QWidget *wdg )
1258{ 1284{
1259#ifndef KAB_EMBEDDED 1285#ifndef KAB_EMBEDDED
1260 if ( wdg ) 1286 if ( wdg )
1261 KAcceleratorManager::manage( wdg ); 1287 KAcceleratorManager::manage( wdg );
1262#else //KAB_EMBEDDED 1288#else //KAB_EMBEDDED
1263//US 1289//US
1264#endif //KAB_EMBEDDED 1290#endif //KAB_EMBEDDED
1265 1291
1266} 1292}
1267 1293
1268QString AddresseeEditorWidget::title() const 1294QString AddresseeEditorWidget::title() const
1269{ 1295{
1270 return i18n( "Contact Editor" ); 1296 return i18n( "Contact Editor" );
1271} 1297}
1272 1298
1273QString AddresseeEditorWidget::identifier() const 1299QString AddresseeEditorWidget::identifier() const
1274{ 1300{
1275 return i18n( "contact_editor" ); 1301 return i18n( "contact_editor" );
1276} 1302}
1277 1303
1278#ifndef KAB_EMBEDDED 1304#ifndef KAB_EMBEDDED
1279#include "addresseeeditorwidget.moc" 1305#include "addresseeeditorwidget.moc"
1280#endif //KAB_EMBEDDED 1306#endif //KAB_EMBEDDED
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index d781f67..4230c07 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -1,207 +1,222 @@
1#ifndef DESKTOP_VERSION 1#ifndef DESKTOP_VERSION
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include <stdlib.h> 3#include <stdlib.h>
4#else 4#else
5#include <qapplication.h> 5#include <qapplication.h>
6#include <qwindowsstyle.h> 6#include <qwindowsstyle.h>
7#include <qplatinumstyle.h> 7#include <qplatinumstyle.h>
8#include <qmainwindow.h> 8#include <qmainwindow.h>
9#endif 9#endif
10 10
11#include <kstandarddirs.h> 11#include <kstandarddirs.h>
12#include <kglobal.h> 12#include <kglobal.h>
13#include <stdio.h> 13#include <stdio.h>
14#include <qdir.h> 14#include <qdir.h>
15#include "kaddressbookmain.h" 15#include "kaddressbookmain.h"
16#include "externalapphandler.h" 16#include "externalapphandler.h"
17 17
18int main( int argc, char **argv ) 18int main( int argc, char **argv )
19{ 19{
20#ifndef DESKTOP_VERSION 20#ifndef DESKTOP_VERSION
21 QPEApplication a( argc, argv ); 21 QPEApplication a( argc, argv );
22 a.setKeepRunning (); 22 a.setKeepRunning ();
23#else 23#else
24 QApplication a( argc, argv ); 24 QApplication a( argc, argv );
25 QApplication::setStyle( new QPlatinumStyle ()); 25 QApplication::setStyle( new QPlatinumStyle ());
26 QString hdir = QDir::homeDirPath(); 26 QString hdir = QDir::homeDirPath();
27 // there is a bug when creating dirs for WIN 98 27 // there is a bug when creating dirs for WIN 98
28 // it is difficult to fix, because we have no WIN 98 runnung 28 // it is difficult to fix, because we have no WIN 98 runnung
29 // such that we try it to create the dirs at startup here 29 // such that we try it to create the dirs at startup here
30 if ( hdir == "C:\\" ) { // win 98 or ME 30 if ( hdir == "C:\\" ) { // win 98 or ME
31 QDir app_dir; 31 QDir app_dir;
32 if ( !app_dir.exists("C:\\kdepim") ) 32 if ( !app_dir.exists("C:\\kdepim") )
33 app_dir.mkdir ("C:\\kdepim"); 33 app_dir.mkdir ("C:\\kdepim");
34 if ( !app_dir.exists("C:\\kdepim\\apps") ) 34 if ( !app_dir.exists("C:\\kdepim\\apps") )
35 app_dir.mkdir ("C:\\kdepim\\apps"); 35 app_dir.mkdir ("C:\\kdepim\\apps");
36 if ( !app_dir.exists("C:\\kdepim\\config") ) 36 if ( !app_dir.exists("C:\\kdepim\\config") )
37 app_dir.mkdir ("C:\\kdepim\\config"); 37 app_dir.mkdir ("C:\\kdepim\\config");
38 if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) 38 if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") )
39 app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); 39 app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook");
40 } 40 }
41#endif 41#endif
42 42
43 bool exitHelp = false; 43 bool exitHelp = false;
44 if ( argc > 1 ) { 44 if ( argc > 1 ) {
45 QString command = argv[1]; 45 QString command = argv[1];
46 if ( command == "-help" ){ 46 if ( command == "-help" ){
47 printf("KA/E command line commands:\n"); 47 printf("KA/E command line commands:\n");
48 printf(" no command: Start KA/E in usual way\n"); 48 printf(" no command: Start KA/E in usual way\n");
49 printf(" -help: This output\n"); 49 printf(" -help: This output\n");
50 printf(" KA/E is exiting now. Bye!\n"); 50 printf(" KA/E is exiting now. Bye!\n");
51 exitHelp = true; 51 exitHelp = true;
52 } 52 }
53 } 53 }
54 if ( ! exitHelp ) { 54 if ( ! exitHelp ) {
55 55
56 KGlobal::setAppName( "kaddressbook" ); 56 KGlobal::setAppName( "kaddressbook" );
57#ifndef DESKTOP_VERSION 57#ifndef DESKTOP_VERSION
58 if ( QApplication::desktop()->width() > 320 ) 58 if ( QApplication::desktop()->width() > 320 )
59 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); 59 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/");
60 else 60 else
61 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); 61 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/");
62#else 62#else
63 QString fileName ; 63 QString fileName ;
64 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; 64 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/";
65 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 65 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
66 QApplication::addLibraryPath ( qApp->applicationDirPath () ); 66 QApplication::addLibraryPath ( qApp->applicationDirPath () );
67 67
68#endif 68#endif
69 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); 69 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
70 KAddressBookMain m ; 70 KAddressBookMain m ;
71//US MainWindow m; 71//US MainWindow m;
72 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 72 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
73 73
74 {
75 KConfig kon ( locateLocal( "config", "korganizerrc" ) );
76 kon.setGroup("Locale");
77 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) );
78 QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( "");
79 KGlobal::locale()->setHore24Format( !kon.readBoolEntry( "PreferredTime",0 ) );
80 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
81 dummy = kon.readEntry( "UserDateFormatLong","%A %d %b %y" );
82 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
83 kon.setGroup("Time & Date");
84 KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ),
85 kon.readNumEntry( "DaylightsavingStart", 90),
86 kon.readNumEntry( "DaylightsavingEnd",304) );
87 KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") );
88 }
74#ifndef DESKTOP_VERSION 89#ifndef DESKTOP_VERSION
75 a.showMainWidget( &m ); 90 a.showMainWidget( &m );
76#else 91#else
77 a.setMainWidget( &m ); 92 a.setMainWidget( &m );
78 m.resize (640, 480 ); 93 m.resize (640, 480 );
79 m.show(); 94 m.show();
80#endif 95#endif
81 a.exec(); 96 a.exec();
82 97
83 } 98 }
84 qDebug("KA: Bye! "); 99 qDebug("KA: Bye! ");
85} 100}
86 101
87/* 102/*
88#include <stdlib.h> 103#include <stdlib.h>
89 104
90#include <qstring.h> 105#include <qstring.h>
91 106
92#include <kabc/stdaddressbook.h> 107#include <kabc/stdaddressbook.h>
93#include <kaboutdata.h> 108#include <kaboutdata.h>
94#include <kcmdlineargs.h> 109#include <kcmdlineargs.h>
95#include <kcrash.h> 110#include <kcrash.h>
96#include <kdebug.h> 111#include <kdebug.h>
97#include <klocale.h> 112#include <klocale.h>
98#include <kstartupinfo.h> 113#include <kstartupinfo.h>
99#include <kuniqueapplication.h> 114#include <kuniqueapplication.h>
100#include <kwin.h> 115#include <kwin.h>
101 116
102#include "kaddressbookmain.h" 117#include "kaddressbookmain.h"
103#include "kabcore.h" 118#include "kabcore.h"
104 119
105extern "C" { 120extern "C" {
106 121
107void crashHandler( int ) 122void crashHandler( int )
108{ 123{
109 KABC::StdAddressBook::handleCrash(); 124 KABC::StdAddressBook::handleCrash();
110 ::exit( 0 ); 125 ::exit( 0 );
111} 126}
112 127
113} 128}
114 129
115class KAddressBookApp : public KUniqueApplication { 130class KAddressBookApp : public KUniqueApplication {
116 public: 131 public:
117 KAddressBookApp() : mMainWin( 0 ) {} 132 KAddressBookApp() : mMainWin( 0 ) {}
118 ~KAddressBookApp() {} 133 ~KAddressBookApp() {}
119 134
120 int newInstance(); 135 int newInstance();
121 136
122 private: 137 private:
123 KAddressBookMain *mMainWin; 138 KAddressBookMain *mMainWin;
124}; 139};
125 140
126int KAddressBookApp::newInstance() 141int KAddressBookApp::newInstance()
127{ 142{
128 if ( isRestored() ) { 143 if ( isRestored() ) {
129 // There can only be one main window 144 // There can only be one main window
130 if ( KMainWindow::canBeRestored( 1 ) ) { 145 if ( KMainWindow::canBeRestored( 1 ) ) {
131 mMainWin = new KAddressBookMain; 146 mMainWin = new KAddressBookMain;
132 mMainWin->show(); 147 mMainWin->show();
133 mMainWin->restore( 1 ); 148 mMainWin->restore( 1 );
134 } 149 }
135 } else { 150 } else {
136 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 151 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
137 152
138 QCString addrStr = args->getOption( "addr" ); 153 QCString addrStr = args->getOption( "addr" );
139 QCString uidStr = args->getOption( "uid" ); 154 QCString uidStr = args->getOption( "uid" );
140 QString addr; 155 QString addr;
141 QString uid; 156 QString uid;
142 if ( !addrStr.isEmpty() ) 157 if ( !addrStr.isEmpty() )
143 addr = QString::fromLocal8Bit( addrStr ); 158 addr = QString::fromLocal8Bit( addrStr );
144 if ( !uidStr.isEmpty() ) 159 if ( !uidStr.isEmpty() )
145 uid = QString::fromLocal8Bit( uidStr ); 160 uid = QString::fromLocal8Bit( uidStr );
146 161
147 162
148 if ( args->isSet( "editor-only" ) ) { 163 if ( args->isSet( "editor-only" ) ) {
149 if ( !mMainWin ) 164 if ( !mMainWin )
150 mMainWin = new KAddressBookMain; 165 mMainWin = new KAddressBookMain;
151 KStartupInfo::appStarted(); 166 KStartupInfo::appStarted();
152 mMainWin->hide(); 167 mMainWin->hide();
153 } else { 168 } else {
154 if ( mMainWin ) { 169 if ( mMainWin ) {
155 mMainWin->show(); 170 mMainWin->show();
156 KWin::setActiveWindow( mMainWin->winId() ); 171 KWin::setActiveWindow( mMainWin->winId() );
157 } else { 172 } else {
158 mMainWin = new KAddressBookMain; 173 mMainWin = new KAddressBookMain;
159 mMainWin->show(); 174 mMainWin->show();
160 } 175 }
161 } 176 }
162 // Can not see why anyone would pass both a uid and an email address, so I'll leave it that two contact editors will show if they do 177 // Can not see why anyone would pass both a uid and an email address, so I'll leave it that two contact editors will show if they do
163 if ( !addr.isEmpty() ) 178 if ( !addr.isEmpty() )
164 mMainWin->addEmail( addr ); 179 mMainWin->addEmail( addr );
165 180
166 if ( !uid.isEmpty() ) 181 if ( !uid.isEmpty() )
167 mMainWin->showContactEditor( uid ); 182 mMainWin->showContactEditor( uid );
168 if ( args->isSet( "new-contact" ) ) { 183 if ( args->isSet( "new-contact" ) ) {
169 mMainWin->newContact(); 184 mMainWin->newContact();
170 } 185 }
171 } 186 }
172 187
173 KCrash::setEmergencySaveFunction( crashHandler ); 188 KCrash::setEmergencySaveFunction( crashHandler );
174 189
175 return 0; 190 return 0;
176} 191}
177 192
178// the dummy argument is required, because KMail apparently sends an empty 193// the dummy argument is required, because KMail apparently sends an empty
179// argument. 194// argument.
180static KCmdLineOptions kmoptions[] = 195static KCmdLineOptions kmoptions[] =
181{ 196{
182 { "a", 0 , 0 }, 197 { "a", 0 , 0 },
183 { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 }, 198 { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 },
184 { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 }, 199 { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 },
185 { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 }, 200 { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 },
186 { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 }, 201 { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 },
187 { "+[argument]", I18N_NOOP( "dummy argument" ), 0}, 202 { "+[argument]", I18N_NOOP( "dummy argument" ), 0},
188 { 0, 0, 0} 203 { 0, 0, 0}
189}; 204};
190 205
191int main( int argc, char *argv[] ) 206int main( int argc, char *argv[] )
192{ 207{
193 KLocale::setMainCatalogue( "kaddressbook" ); 208 KLocale::setMainCatalogue( "kaddressbook" );
194 209
195 KCmdLineArgs::init( argc, argv, KABCore::createAboutData() ); 210 KCmdLineArgs::init( argc, argv, KABCore::createAboutData() );
196 KCmdLineArgs::addCmdLineOptions( kmoptions ); 211 KCmdLineArgs::addCmdLineOptions( kmoptions );
197 KUniqueApplication::addCmdLineOptions(); 212 KUniqueApplication::addCmdLineOptions();
198 213
199 if ( !KAddressBookApp::start() ) 214 if ( !KAddressBookApp::start() )
200 exit( 0 ); 215 exit( 0 );
201 216
202 KAddressBookApp app; 217 KAddressBookApp app;
203 KGlobal::locale()->insertCatalogue( "libkdepim" ); 218 KGlobal::locale()->insertCatalogue( "libkdepim" );
204 219
205 return app.exec(); 220 return app.exec();
206} 221}
207*/ 222*/
diff --git a/kaddressbook/nameeditdialog.cpp b/kaddressbook/nameeditdialog.cpp
index fb7eb22..8213c2b 100644
--- a/kaddressbook/nameeditdialog.cpp
+++ b/kaddressbook/nameeditdialog.cpp
@@ -1,296 +1,293 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qlistbox.h> 26#include <qlistbox.h>
27#include <qlistview.h> 27#include <qlistview.h>
28#include <qtooltip.h> 28#include <qtooltip.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qcheckbox.h> 30#include <qcheckbox.h>
31#include <qstring.h> 31#include <qstring.h>
32 32
33#ifndef KAB_EMBEDDED 33#ifndef KAB_EMBEDDED
34#include <kaccelmanager.h> 34#include <kaccelmanager.h>
35#else //KAB_EMBEDDED 35#else //KAB_EMBEDDED
36#include <kstandarddirs.h> 36#include <kstandarddirs.h>
37#endif //KAB_EMBEDDED 37#endif //KAB_EMBEDDED
38 38
39#include <kapplication.h> 39#include <kapplication.h>
40#include <kbuttonbox.h> 40#include <kbuttonbox.h>
41#include <kconfig.h> 41#include <kconfig.h>
42#include <klineedit.h> 42#include <klineedit.h>
43#include <klistview.h> 43#include <klistview.h>
44#include <kcombobox.h> 44#include <kcombobox.h>
45#include <klocale.h> 45#include <klocale.h>
46#include <kglobal.h> 46#include <kglobal.h>
47#include <kdebug.h> 47#include <kdebug.h>
48#include <kiconloader.h> 48#include <kiconloader.h>
49#include <kmessagebox.h> 49#include <kmessagebox.h>
50 50
51#include "nameeditdialog.h" 51#include "nameeditdialog.h"
52 52
53NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type, 53NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type,
54 QWidget *parent, const char *name ) 54 QWidget *parent, const char *name )
55 : KDialogBase( Plain, i18n( "Edit Contact Name" ), Help | Ok | Cancel, 55 : KDialogBase( Plain, i18n( "Edit Contact Name" ), Help | Ok | Cancel,
56 Ok, parent, name, true ) 56 Ok, parent, name, true )
57{ 57{
58 58
59 QWidget *page = plainPage(); 59 QWidget *page = plainPage();
60 QGridLayout *layout = new QGridLayout( page, 5, 3 ); 60 QGridLayout *layout = new QGridLayout( page, 5, 3 );
61 layout->setSpacing( spacingHint() ); 61 layout->setSpacing( spacingHint() );
62 layout->addColSpacing( 2, 100 ); 62 layout->addColSpacing( 2, 100 );
63 QLabel *label; 63 QLabel *label;
64 64
65 label = new QLabel( i18n( "Honorific prefixes:" ), page ); 65 label = new QLabel( i18n( "Honorific prefixes:" ), page );
66 layout->addWidget( label, 0, 0 ); 66 layout->addWidget( label, 0, 0 );
67 mPrefixCombo = new KComboBox( page ); 67 mPrefixCombo = new KComboBox( page );
68 mPrefixCombo->setDuplicatesEnabled( false ); 68 mPrefixCombo->setDuplicatesEnabled( false );
69 mPrefixCombo->setEditable( true ); 69 mPrefixCombo->setEditable( true );
70 label->setBuddy( mPrefixCombo ); 70 label->setBuddy( mPrefixCombo );
71 layout->addMultiCellWidget( mPrefixCombo, 0, 0, 1, 2 ); 71 layout->addMultiCellWidget( mPrefixCombo, 0, 0, 1, 2 );
72 72
73 label = new QLabel( i18n( "Given name:" ), page ); 73 label = new QLabel( i18n( "Given name:" ), page );
74 layout->addWidget( label, 1, 0 ); 74 layout->addWidget( label, 1, 0 );
75 mGivenNameEdit = new KLineEdit( page ); 75 mGivenNameEdit = new KLineEdit( page );
76 label->setBuddy( mGivenNameEdit ); 76 label->setBuddy( mGivenNameEdit );
77 layout->addMultiCellWidget( mGivenNameEdit, 1, 1, 1, 2 ); 77 layout->addMultiCellWidget( mGivenNameEdit, 1, 1, 1, 2 );
78 78
79 label = new QLabel( i18n( "Additional names:" ), page ); 79 label = new QLabel( i18n( "Additional names:" ), page );
80 layout->addWidget( label, 2, 0 ); 80 layout->addWidget( label, 2, 0 );
81 mAdditionalNameEdit = new KLineEdit( page ); 81 mAdditionalNameEdit = new KLineEdit( page );
82 label->setBuddy( mAdditionalNameEdit ); 82 label->setBuddy( mAdditionalNameEdit );
83 layout->addMultiCellWidget( mAdditionalNameEdit, 2, 2, 1, 2 ); 83 layout->addMultiCellWidget( mAdditionalNameEdit, 2, 2, 1, 2 );
84 84
85 label = new QLabel( i18n( "Family names:" ), page ); 85 label = new QLabel( i18n( "Family names:" ), page );
86 layout->addWidget( label, 3, 0 ); 86 layout->addWidget( label, 3, 0 );
87 mFamilyNameEdit = new KLineEdit( page ); 87 mFamilyNameEdit = new KLineEdit( page );
88 label->setBuddy( mFamilyNameEdit ); 88 label->setBuddy( mFamilyNameEdit );
89 layout->addMultiCellWidget( mFamilyNameEdit, 3, 3, 1, 2 ); 89 layout->addMultiCellWidget( mFamilyNameEdit, 3, 3, 1, 2 );
90 90
91 label = new QLabel( i18n( "Honorific suffixes:" ), page ); 91 label = new QLabel( i18n( "Honorific suffixes:" ), page );
92 layout->addWidget( label, 4, 0 ); 92 layout->addWidget( label, 4, 0 );
93 mSuffixCombo = new KComboBox( page ); 93 mSuffixCombo = new KComboBox( page );
94 mSuffixCombo->setDuplicatesEnabled( false ); 94 mSuffixCombo->setDuplicatesEnabled( false );
95 mSuffixCombo->setEditable( true ); 95 mSuffixCombo->setEditable( true );
96 label->setBuddy( mSuffixCombo ); 96 label->setBuddy( mSuffixCombo );
97 layout->addMultiCellWidget( mSuffixCombo, 4, 4, 1, 2 ); 97 layout->addMultiCellWidget( mSuffixCombo, 4, 4, 1, 2 );
98 98
99 mFormattedNameCombo = new KComboBox( page ); 99 mFormattedNameCombo = new KComboBox( page );
100 mFormattedNameCombo->setMaximumWidth(100); 100 mFormattedNameCombo->setMaximumWidth(100);
101 101
102 layout->addMultiCellWidget( mFormattedNameCombo, 5, 5, 0, 0 ); 102 layout->addMultiCellWidget( mFormattedNameCombo, 5, 5, 0, 0 );
103 connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( typeChanged( int ) ) ); 103 connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( typeChanged( int ) ) );
104 104
105 mFormattedNameEdit = new KLineEdit( page ); 105 mFormattedNameEdit = new KLineEdit( page );
106 mFormattedNameEdit->setEnabled( type == CustomName ); 106 mFormattedNameEdit->setEnabled( type == CustomName );
107 layout->addMultiCellWidget( mFormattedNameEdit, 5, 5, 1, 2 ); 107 layout->addMultiCellWidget( mFormattedNameEdit, 5, 5, 1, 2 );
108 108
109 mParseBox = new QCheckBox( i18n( "Parse name automatically" ), page ); 109 mParseBox = new QCheckBox( i18n( "Parse name automatically" ), page );
110 connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( parseBoxChanged(bool) ) ); 110 connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( parseBoxChanged(bool) ) );
111 connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( modified() ) ); 111 connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( modified() ) );
112 layout->addMultiCellWidget( mParseBox, 6, 6, 0, 1 ); 112 layout->addMultiCellWidget( mParseBox, 6, 6, 0, 2 );
113 113
114 // Fill in the values 114 // Fill in the values
115 mFamilyNameEdit->setText( addr.familyName() ); 115 mFamilyNameEdit->setText( addr.familyName() );
116 mGivenNameEdit->setText( addr.givenName() ); 116 mGivenNameEdit->setText( addr.givenName() );
117 mAdditionalNameEdit->setText( addr.additionalName() ); 117 mAdditionalNameEdit->setText( addr.additionalName() );
118 mFormattedNameEdit->setText( addr.formattedName() ); 118 mFormattedNameEdit->setText( addr.formattedName() );
119 119
120 // Prefix and suffix combos 120 // Prefix and suffix combos
121//US KConfig config( "kabcrc" ); 121//US KConfig config( "kabcrc" );
122 KConfig config( locateLocal("config", "kabcrc") ); 122 KConfig config( locateLocal("config", "kabcrc") );
123 config.setGroup( "General" ); 123 config.setGroup( "General" );
124 124
125 QStringList sTitle; 125 QStringList sTitle;
126 sTitle += i18n( "Dr." ); 126 sTitle += i18n( "Dr." );
127 sTitle += i18n( "Miss" ); 127 sTitle += i18n( "Miss" );
128 sTitle += i18n( "Mr." ); 128 sTitle += i18n( "Mr." );
129 sTitle += i18n( "Mrs." ); 129 sTitle += i18n( "Mrs." );
130 sTitle += i18n( "Ms." ); 130 sTitle += i18n( "Ms." );
131 sTitle += i18n( "Prof." ); 131 sTitle += i18n( "Prof." );
132 sTitle += config.readListEntry( "Prefixes" ); 132 sTitle += config.readListEntry( "Prefixes" );
133 sTitle.sort(); 133 sTitle.sort();
134 134
135 QStringList sSuffix; 135 QStringList sSuffix;
136 sSuffix += i18n( "I" ); 136 sSuffix += i18n( "I" );
137 sSuffix += i18n( "II" ); 137 sSuffix += i18n( "II" );
138 sSuffix += i18n( "III" ); 138 sSuffix += i18n( "III" );
139 sSuffix += i18n( "Jr." ); 139 sSuffix += i18n( "Jr." );
140 sSuffix += i18n( "Sr." ); 140 sSuffix += i18n( "Sr." );
141 sSuffix += config.readListEntry( "Suffixes" ); 141 sSuffix += config.readListEntry( "Suffixes" );
142 sSuffix.sort(); 142 sSuffix.sort();
143 143
144 mPrefixCombo->insertStringList( sTitle ); 144 mPrefixCombo->insertStringList( sTitle );
145 mSuffixCombo->insertStringList( sSuffix ); 145 mSuffixCombo->insertStringList( sSuffix );
146 146
147#ifndef KAB_EMBEDDED 147#ifndef KAB_EMBEDDED
148 mPrefixCombo->setCurrentText( addr.prefix() ); 148 mPrefixCombo->setCurrentText( addr.prefix() );
149 mSuffixCombo->setCurrentText( addr.suffix() ); 149 mSuffixCombo->setCurrentText( addr.suffix() );
150#else //KAB_EMBEDDED 150#else //KAB_EMBEDDED
151 mPrefixCombo->setEditText( addr.prefix() ); 151 mPrefixCombo->setEditText( addr.prefix() );
152 mSuffixCombo->setEditText( addr.suffix() ); 152 mSuffixCombo->setEditText( addr.suffix() );
153#endif //KAB_EMBEDDED 153#endif //KAB_EMBEDDED
154 154
155 AddresseeConfig::instance()->setUid( addr.uid() ); 155 AddresseeConfig::instance()->setUid( addr.uid() );
156 mParseBox->setChecked( AddresseeConfig::instance()->automaticNameParsing() ); 156 mParseBox->setChecked( AddresseeConfig::instance()->automaticNameParsing() );
157 157
158#ifndef KAB_EMBEDDED 158#ifndef KAB_EMBEDDED
159 KAcceleratorManager::manage( this ); 159 KAcceleratorManager::manage( this );
160#endif //KAB_EMBEDDED 160#endif //KAB_EMBEDDED
161 161
162 connect( mPrefixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 162 connect( mPrefixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
163 connect( mPrefixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); 163 connect( mPrefixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
164 connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 164 connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
165 connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); 165 connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
166 connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 166 connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
167 connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); 167 connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
168 connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 168 connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
169 connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); 169 connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
170 connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 170 connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
171 connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); 171 connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
172 connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( modified() ) ); 172 connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( modified() ) );
173 connect( mFormattedNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 173 connect( mFormattedNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
174 174
175 updateTypeCombo(); 175 updateTypeCombo();
176 mFormattedNameCombo->setCurrentItem( type ); 176 mFormattedNameCombo->setCurrentItem( type );
177 177
178#ifdef KAB_EMBEDDED 178
179 resize( KMIN(KGlobal::getDesktopWidth()-10, 490), KMIN(KGlobal::getDesktopHeight()-50, 300));
180#endif //KAB_EMBEDDED
181
182 mChanged = false; 179 mChanged = false;
183} 180}
184 181
185NameEditDialog::~NameEditDialog() 182NameEditDialog::~NameEditDialog()
186{ 183{
187} 184}
188 185
189QString NameEditDialog::familyName() const 186QString NameEditDialog::familyName() const
190{ 187{
191 return mFamilyNameEdit->text(); 188 return mFamilyNameEdit->text();
192} 189}
193 190
194QString NameEditDialog::givenName() const 191QString NameEditDialog::givenName() const
195{ 192{
196 return mGivenNameEdit->text(); 193 return mGivenNameEdit->text();
197} 194}
198 195
199QString NameEditDialog::prefix() const 196QString NameEditDialog::prefix() const
200{ 197{
201 return mPrefixCombo->currentText(); 198 return mPrefixCombo->currentText();
202} 199}
203 200
204QString NameEditDialog::suffix() const 201QString NameEditDialog::suffix() const
205{ 202{
206 return mSuffixCombo->currentText(); 203 return mSuffixCombo->currentText();
207} 204}
208 205
209QString NameEditDialog::additionalName() const 206QString NameEditDialog::additionalName() const
210{ 207{
211 return mAdditionalNameEdit->text(); 208 return mAdditionalNameEdit->text();
212} 209}
213 210
214QString NameEditDialog::customFormattedName() const 211QString NameEditDialog::customFormattedName() const
215{ 212{
216 return mFormattedNameEdit->text(); 213 return mFormattedNameEdit->text();
217} 214}
218 215
219int NameEditDialog::formattedNameType() const 216int NameEditDialog::formattedNameType() const
220{ 217{
221 return mFormattedNameCombo->currentItem(); 218 return mFormattedNameCombo->currentItem();
222} 219}
223 220
224bool NameEditDialog::changed() const 221bool NameEditDialog::changed() const
225{ 222{
226 return mChanged; 223 return mChanged;
227} 224}
228 225
229QString NameEditDialog::formattedName( const KABC::Addressee &addr, int type ) 226QString NameEditDialog::formattedName( const KABC::Addressee &addr, int type )
230{ 227{
231 switch ( type ) { 228 switch ( type ) {
232 case SimpleName: 229 case SimpleName:
233 return addr.givenName() + " " + addr.familyName(); 230 return addr.givenName() + " " + addr.familyName();
234 break; 231 break;
235 case FullName: 232 case FullName:
236 return addr.prefix() + " " + addr.givenName() + " " + 233 return addr.prefix() + " " + addr.givenName() + " " +
237 addr.additionalName() + " " + addr.familyName() + " " + 234 addr.additionalName() + " " + addr.familyName() + " " +
238 addr.suffix(); 235 addr.suffix();
239 break; 236 break;
240 case ReverseName: 237 case ReverseName:
241 return addr.familyName() + ", " + addr.givenName(); 238 return addr.familyName() + ", " + addr.givenName();
242 break; 239 break;
243 default: 240 default:
244 return ""; 241 return "";
245 break; 242 break;
246 } 243 }
247} 244}
248 245
249void NameEditDialog::parseBoxChanged( bool value ) 246void NameEditDialog::parseBoxChanged( bool value )
250{ 247{
251 //AddresseeConfig::instance()->setUid( addr.uid() ); 248 //AddresseeConfig::instance()->setUid( addr.uid() );
252 AddresseeConfig::instance()->setAutomaticNameParsing( value ); 249 AddresseeConfig::instance()->setAutomaticNameParsing( value );
253} 250}
254 251
255void NameEditDialog::typeChanged( int pos ) 252void NameEditDialog::typeChanged( int pos )
256{ 253{
257 mFormattedNameEdit->setEnabled( pos == 0 ); 254 mFormattedNameEdit->setEnabled( pos == 0 );
258} 255}
259 256
260void NameEditDialog::modified() 257void NameEditDialog::modified()
261{ 258{
262 mChanged = true; 259 mChanged = true;
263} 260}
264 261
265void NameEditDialog::updateTypeCombo() 262void NameEditDialog::updateTypeCombo()
266{ 263{
267 KABC::Addressee addr; 264 KABC::Addressee addr;
268 addr.setPrefix( mPrefixCombo->currentText() ); 265 addr.setPrefix( mPrefixCombo->currentText() );
269 addr.setGivenName( mGivenNameEdit->text() ); 266 addr.setGivenName( mGivenNameEdit->text() );
270 addr.setAdditionalName( mAdditionalNameEdit->text() ); 267 addr.setAdditionalName( mAdditionalNameEdit->text() );
271 addr.setFamilyName( mFamilyNameEdit->text() ); 268 addr.setFamilyName( mFamilyNameEdit->text() );
272 addr.setSuffix( mSuffixCombo->currentText() ); 269 addr.setSuffix( mSuffixCombo->currentText() );
273 270
274 int pos = mFormattedNameCombo->currentItem(); 271 int pos = mFormattedNameCombo->currentItem();
275 272
276 mFormattedNameCombo->clear(); 273 mFormattedNameCombo->clear();
277 mFormattedNameCombo->insertItem( i18n( "Custom" ) ); 274 mFormattedNameCombo->insertItem( i18n( "Custom" ) );
278 mFormattedNameCombo->insertItem( formattedName( addr, SimpleName ) ); 275 mFormattedNameCombo->insertItem( formattedName( addr, SimpleName ) );
279 mFormattedNameCombo->insertItem( formattedName( addr, FullName ) ); 276 mFormattedNameCombo->insertItem( formattedName( addr, FullName ) );
280 mFormattedNameCombo->insertItem( formattedName( addr, ReverseName ) ); 277 mFormattedNameCombo->insertItem( formattedName( addr, ReverseName ) );
281 278
282 mFormattedNameCombo->setCurrentItem( pos ); 279 mFormattedNameCombo->setCurrentItem( pos );
283} 280}
284 281
285void NameEditDialog::slotHelp() 282void NameEditDialog::slotHelp()
286{ 283{
287#ifndef KAB_EMBEDDED 284#ifndef KAB_EMBEDDED
288 kapp->invokeHelp( "managing-contacts-automatic-nameparsing" ); 285 kapp->invokeHelp( "managing-contacts-automatic-nameparsing" );
289#else //KAB_EMBEDDED 286#else //KAB_EMBEDDED
290qDebug("NameEditDialog::slotHelp Help is not supported yet"); 287qDebug("NameEditDialog::slotHelp Help is not supported yet");
291#endif //KAB_EMBEDDED 288#endif //KAB_EMBEDDED
292} 289}
293 290
294#ifndef KAB_EMBEDDED 291#ifndef KAB_EMBEDDED
295#include "nameeditdialog.moc" 292#include "nameeditdialog.moc"
296#endif //KAB_EMBEDDED 293#endif //KAB_EMBEDDED