summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp32
-rw-r--r--kaddressbook/addresseeeditorwidget.h2
2 files changed, 28 insertions, 6 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 29abd6f..310d628 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -1,1356 +1,1376 @@
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#include <qapplication.h> 31#include <qapplication.h>
32 32
33#ifndef KAB_EMBEDDED 33#ifndef KAB_EMBEDDED
34#include <qtextedit.h> 34#include <qtextedit.h>
35 35
36#include <kaccelmanager.h> 36#include <kaccelmanager.h>
37#include "keywidget.h" 37#include "keywidget.h"
38#include "soundwidget.h" 38#include "soundwidget.h"
39 39
40#else //KAB_EMBEDDED 40#else //KAB_EMBEDDED
41#include <qmultilineedit.h> 41#include <qmultilineedit.h>
42#endif //KAB_EMBEDDED 42#endif //KAB_EMBEDDED
43 43
44 44
45#include "keywidget.h" 45#include "keywidget.h"
46#include "geowidget.h" 46#include "geowidget.h"
47#include "imagewidget.h" 47#include "imagewidget.h"
48#include "nameeditdialog.h" 48#include "nameeditdialog.h"
49#include "phoneeditwidget.h" 49#include "phoneeditwidget.h"
50#include "secrecywidget.h" 50#include "secrecywidget.h"
51 51
52 52
53#include <qtoolbutton.h> 53#include <qtoolbutton.h>
54#include <qtooltip.h> 54#include <qtooltip.h>
55 55
56#include <kapplication.h> 56#include <kapplication.h>
57#include <kconfig.h> 57#include <kconfig.h>
58#include <kcombobox.h> 58#include <kcombobox.h>
59#include <kdebug.h> 59#include <kdebug.h>
60#include <kdialogbase.h> 60#include <kdialogbase.h>
61#include <kglobal.h> 61#include <kglobal.h>
62#include <kiconloader.h> 62#include <kiconloader.h>
63#include <klineedit.h> 63#include <klineedit.h>
64#include <klocale.h> 64#include <klocale.h>
65#include <kmessagebox.h> 65#include <kmessagebox.h>
66#include <kseparator.h> 66#include <kseparator.h>
67#include <ksqueezedtextlabel.h> 67#include <ksqueezedtextlabel.h>
68 68
69#include <libkdepim/categoryeditdialog.h> 69#include <libkdepim/categoryeditdialog.h>
70#include <libkdepim/categoryselectdialog.h> 70#include <libkdepim/categoryselectdialog.h>
71 71
72#include <libkdepim/kdateedit.h> 72#include <libkdepim/kdateedit.h>
73 73
74#include "addresseditwidget.h" 74#include "addresseditwidget.h"
75#include "emaileditwidget.h" 75#include "emaileditwidget.h"
76#include "kabcore.h" 76#include "kabcore.h"
77#include "kabprefs.h" 77#include "kabprefs.h"
78 78
79#include "addresseeeditorwidget.h" 79#include "addresseeeditorwidget.h"
80 80
81 81
82 82
83AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension, 83AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension,
84 QWidget *parent, const char *name ) 84 QWidget *parent, const char *name )
85 : ExtensionWidget( core, parent, name ), mIsExtension( isExtension ), 85 : ExtensionWidget( core, parent, name ), mIsExtension( isExtension ),
86 mBlockSignals( false ) 86 mBlockSignals( false )
87{ 87{
88 88
89 mAConfig = AddresseeConfig::instance(); 89 mAConfig = AddresseeConfig::instance();
90 90
91 mFormattedNameType = NameEditDialog::CustomName; 91 mFormattedNameType = NameEditDialog::CustomName;
92 initGUI(); 92 initGUI();
93 mCategoryDialog = 0; 93 mCategoryDialog = 0;
94 mCategoryEditDialog = 0; 94 mCategoryEditDialog = 0;
95 95
96 // Load the empty addressee as defaults 96 // Load the empty addressee as defaults
97 load(); 97 load();
98 98
99 mDirty = false; 99 mDirty = false;
100} 100}
101 101
102AddresseeEditorWidget::~AddresseeEditorWidget() 102AddresseeEditorWidget::~AddresseeEditorWidget()
103{ 103{
104 kdDebug(5720) << "~AddresseeEditorWidget()" << endl; 104 kdDebug(5720) << "~AddresseeEditorWidget()" << endl;
105} 105}
106 106
107void AddresseeEditorWidget::contactsSelectionChanged() 107void AddresseeEditorWidget::contactsSelectionChanged()
108{ 108{
109 KABC::Addressee::List list = selectedContacts(); 109 KABC::Addressee::List list = selectedContacts();
110 110
111 mAddressee = list[ 0 ]; 111 mAddressee = list[ 0 ];
112 load(); 112 load();
113} 113}
114 114
115void AddresseeEditorWidget::setAddressee( const KABC::Addressee &addr ) 115void AddresseeEditorWidget::setAddressee( const KABC::Addressee &addr )
116{ 116{
117 mAddressee = addr; 117 mAddressee = addr;
118 load(); 118 load();
119} 119}
120 120
121const KABC::Addressee &AddresseeEditorWidget::addressee() 121const KABC::Addressee &AddresseeEditorWidget::addressee()
122{ 122{
123 return mAddressee; 123 return mAddressee;
124} 124}
125 125
126void AddresseeEditorWidget::textChanged( const QString& ) 126void AddresseeEditorWidget::textChanged( const QString& )
127{ 127{
128 emitModified(); 128 emitModified();
129} 129}
130 130
131void AddresseeEditorWidget::initGUI() 131void AddresseeEditorWidget::initGUI()
132{ 132{
133 QVBoxLayout *layout = new QVBoxLayout( this ); 133 QVBoxLayout *layout = new QVBoxLayout( this );
134 134
135 mTabWidget = new QTabWidget( this ); 135 mTabWidget = new QTabWidget( this );
136 layout->addWidget( mTabWidget ); 136 layout->addWidget( mTabWidget );
137 137
138 setupTab1(); 138 setupTab1();
139 setupTab1_1(); 139 setupTab1_1();
140 setupTab2(); 140 setupTab2();
141 setupTab2_1(); 141 setupTab2_1();
142 setupTab3(); 142 setupTab3();
143 setupTab3_1(); 143 setupTab3_1();
144 144
145 mNameEdit->setFocus(); 145 mNameEdit->setFocus();
146 146
147 connect( mTabWidget, SIGNAL( currentChanged(QWidget*) ), 147 connect( mTabWidget, SIGNAL( currentChanged(QWidget*) ),
148 SLOT( pageChanged(QWidget*) ) ); 148 SLOT( pageChanged(QWidget*) ) );
149} 149}
150 150
151void AddresseeEditorWidget::setupTab1() 151void AddresseeEditorWidget::setupTab1()
152{ 152{
153 // This is the General tab 153 // This is the General tab
154 QWidget *tab1 = new QWidget( mTabWidget ); 154 QWidget *tab1 = new QWidget( mTabWidget );
155 155
156//US QGridLayout *layout = new QGridLayout( tab1, 11, 7 ); 156//US QGridLayout *layout = new QGridLayout( tab1, 11, 7 );
157 QGridLayout *layout = new QGridLayout( tab1, 7, 1 ); 157 QGridLayout *layout = new QGridLayout( tab1, 7, 1 );
158 layout->setMargin( KDialogBase::marginHintSmall() ); 158 layout->setMargin( KDialogBase::marginHintSmall() );
159 layout->setSpacing( KDialogBase::spacingHintSmall() ); 159 layout->setSpacing( KDialogBase::spacingHintSmall() );
160 160
161 QLabel *label; 161 QLabel *label;
162 KSeparator* bar; 162 KSeparator* bar;
163 QPushButton *button; 163 QPushButton *button;
164 164
165 ////////////////////////////////// 165 //////////////////////////////////
166 // Upper left group (person info) 166 // Upper left group (person info)
167 167
168 // Person icon 168 // Person icon
169 /* LR 169 /* LR
170 label = new QLabel( tab1 ); 170 label = new QLabel( tab1 );
171//US ambiguous call. Add one more parameter 171//US ambiguous call. Add one more parameter
172//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 172//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
173 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 173 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
174 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 174 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
175 */ 175 */
176 // First name 176 // First name
177 button = new QPushButton( i18n( "Name..." ), tab1 ); 177 button = new QPushButton( i18n( "Name..." ), tab1 );
178//US QToolTip::add( button, i18n( "Edit the contact's name" ) ); 178//US QToolTip::add( button, i18n( "Edit the contact's name" ) );
179 mNameEdit = new KLineEdit( tab1, "mNameEdit" ); 179 mNameEdit = new KLineEdit( tab1, "mNameEdit" );
180 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), 180 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
181 SLOT( nameTextChanged( const QString& ) ) ); 181 SLOT( nameTextChanged( const QString& ) ) );
182 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); 182 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
183 183
184 mNameLabel = new KSqueezedTextLabel( tab1 ); 184 mNameLabel = new KSqueezedTextLabel( tab1 );
185 mNameLabel->hide(); 185 mNameLabel->hide();
186 186
187 layout->addWidget( button, 0, 0 ); 187 layout->addWidget( button, 0, 0 );
188 layout->addWidget( mNameEdit, 0, 1 ); 188 layout->addWidget( mNameEdit, 0, 1 );
189 layout->addWidget( mNameLabel, 0, 1 ); 189 layout->addWidget( mNameLabel, 0, 1 );
190 190
191 label = new QLabel( i18n( "Role:" ), tab1 ); 191 button = new QPushButton( i18n( "Role:" ), tab1 );
192 connect( button, SIGNAL( clicked() ), SLOT( setRole2FN() ) );
193 //label = new QLabel( i18n( "Role:" ), tab1 );
192 mRoleEdit = new KLineEdit( tab1 ); 194 mRoleEdit = new KLineEdit( tab1 );
193 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), 195 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ),
194 SLOT( textChanged( const QString& ) ) ); 196 SLOT( textChanged( const QString& ) ) );
195 label->setBuddy( mRoleEdit ); 197 //label->setBuddy( mRoleEdit );
196 layout->addWidget( label, 1, 0 ); 198 layout->addWidget( button, 1, 0 );
197 layout->addWidget( mRoleEdit, 1, 1 ); 199 layout->addWidget( mRoleEdit, 1, 1 );
198 200
199 // Organization 201 // Organization
200 label = new QLabel( i18n( "Organization:" ), tab1 ); 202 button = new QPushButton( i18n( "Organization:" ), tab1 );
203 connect( button, SIGNAL( clicked() ), SLOT( setCompany2FN() ) );
204 //label = new QLabel( i18n( "Organization:" ), tab1 );
201 mOrgEdit = new KLineEdit( tab1 ); 205 mOrgEdit = new KLineEdit( tab1 );
202 label->setBuddy( mOrgEdit ); 206 //label->setBuddy( mOrgEdit );
203 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), 207 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ),
204 SLOT( textChanged( const QString& ) ) ); 208 SLOT( textChanged( const QString& ) ) );
205 layout->addWidget( label, 2, 0 ); 209 layout->addWidget( button, 2, 0 );
206 layout->addWidget( mOrgEdit, 2, 1 ); 210 layout->addWidget( mOrgEdit, 2, 1 );
207 211
208 // File as (formatted name) 212 // File as (formatted name)
209 label = new QLabel( i18n( "Formatted name:" ), tab1 ); 213 label = new QLabel( i18n( "Formatted name:" ), tab1 );
210 mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); 214 mFormattedNameLabel = new KSqueezedTextLabel( tab1 );
211 layout->addWidget( label, 3, 0 ); 215 layout->addWidget( label, 3, 0 );
212 layout->addWidget( mFormattedNameLabel, 3, 1 ); 216 layout->addWidget( mFormattedNameLabel, 3, 1 );
213 /* LR 217 /* LR
214 // Left hand separator. This separator doesn't go all the way 218 // Left hand separator. This separator doesn't go all the way
215 // across so the dialog still flows from top to bottom 219 // across so the dialog still flows from top to bottom
216 bar = new KSeparator( KSeparator::HLine, tab1 ); 220 bar = new KSeparator( KSeparator::HLine, tab1 );
217 layout->addMultiCellWidget( bar, 4, 4, 0, 2 ); 221 layout->addMultiCellWidget( bar, 4, 4, 0, 2 );
218 */ 222 */
219 ////////////////////////////////////// 223 //////////////////////////////////////
220 224
221 /* LR 225 /* LR
222 // Phone numbers (upper right) 226 // Phone numbers (upper right)
223 label = new QLabel( tab1 ); 227 label = new QLabel( tab1 );
224//US loadIcon call is ambiguous. Add one more parameter 228//US loadIcon call is ambiguous. Add one more parameter
225//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); 229//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) );
226 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); 230 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
227//US layout->addMultiCellWidget( label, 0, 1, 3, 3 ); 231//US layout->addMultiCellWidget( label, 0, 1, 3, 3 );
228 layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 232 layout->addMultiCellWidget( label, 5, 6, 0, 0 );
229 */ 233 */
230 mPhoneEditWidget = new PhoneEditWidget( tab1 ); 234 mPhoneEditWidget = new PhoneEditWidget( tab1 );
231 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 235 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
232//US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); 236//US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 );
233 int iii; 237 int iii;
234#ifndef DESKTOP_VERSION 238#ifndef DESKTOP_VERSION
235 iii = 7; 239 iii = 7;
236#else 240#else
237 iii = 8; 241 iii = 8;
238#endif 242#endif
239 layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, 1 ); 243 layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, 1 );
240 ++iii; 244 ++iii;
241 /* LR 245 /* LR
242 bar = new KSeparator( KSeparator::HLine, tab1 ); 246 bar = new KSeparator( KSeparator::HLine, tab1 );
243//US layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); 247//US layout->addMultiCellWidget( bar, 4, 4, 3, 6 );
244 layout->addMultiCellWidget( bar, 9, 9, 0, 2 ); 248 layout->addMultiCellWidget( bar, 9, 9, 0, 2 );
245 */ 249 */
246/*US 250/*US
247 ////////////////////////////////////// 251 //////////////////////////////////////
248 // Addresses (lower left) 252 // Addresses (lower left)
249 label = new QLabel( tab1 ); 253 label = new QLabel( tab1 );
250//US loadIcon call is ambiguous. Add one more parameter 254//US loadIcon call is ambiguous. Add one more parameter
251//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) ); 255//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) );
252 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); 256 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) );
253 layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 257 layout->addMultiCellWidget( label, 5, 6, 0, 0 );
254 258
255 mAddressEditWidget = new AddressEditWidget( tab1 ); 259 mAddressEditWidget = new AddressEditWidget( tab1 );
256 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 260 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
257 layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 ); 261 layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 );
258 262
259 ////////////////////////////////////// 263 //////////////////////////////////////
260 // Email / Web (lower right) 264 // Email / Web (lower right)
261 label = new QLabel( tab1 ); 265 label = new QLabel( tab1 );
262//US loadIcon call is ambiguous. Add one more parameter 266//US loadIcon call is ambiguous. Add one more parameter
263//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) ); 267//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) );
264 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) ); 268 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) );
265 layout->addMultiCellWidget( label, 5, 6, 3, 3 ); 269 layout->addMultiCellWidget( label, 5, 6, 3, 3 );
266 270
267 mEmailWidget = new EmailEditWidget( tab1 ); 271 mEmailWidget = new EmailEditWidget( tab1 );
268 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 272 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
269 layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 ); 273 layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 );
270 274
271 // add the separator 275 // add the separator
272 bar = new KSeparator( KSeparator::HLine, tab1 ); 276 bar = new KSeparator( KSeparator::HLine, tab1 );
273 layout->addMultiCellWidget( bar, 7, 7, 3, 6 ); 277 layout->addMultiCellWidget( bar, 7, 7, 3, 6 );
274 278
275 label = new QLabel( tab1 ); 279 label = new QLabel( tab1 );
276//US loadIcon call is ambiguous. Add one more parameter 280//US loadIcon call is ambiguous. Add one more parameter
277//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) ); 281//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) );
278 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) ); 282 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) );
279 layout->addMultiCellWidget( label, 8, 9, 3, 3 ); 283 layout->addMultiCellWidget( label, 8, 9, 3, 3 );
280 284
281 label = new QLabel( i18n( "URL:" ), tab1 ); 285 label = new QLabel( i18n( "URL:" ), tab1 );
282 mURLEdit = new KLineEdit( tab1 ); 286 mURLEdit = new KLineEdit( tab1 );
283 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ), 287 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ),
284 SLOT( textChanged( const QString& ) ) ); 288 SLOT( textChanged( const QString& ) ) );
285 label->setBuddy( mURLEdit ); 289 label->setBuddy( mURLEdit );
286 layout->addWidget( label, 8, 4 ); 290 layout->addWidget( label, 8, 4 );
287 layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 ); 291 layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 );
288 292
289 label = new QLabel( i18n( "&IM address:" ), tab1 ); 293 label = new QLabel( i18n( "&IM address:" ), tab1 );
290 mIMAddressEdit = new KLineEdit( tab1 ); 294 mIMAddressEdit = new KLineEdit( tab1 );
291 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ), 295 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ),
292 SLOT( textChanged( const QString& ) ) ); 296 SLOT( textChanged( const QString& ) ) );
293 label->setBuddy( mIMAddressEdit ); 297 label->setBuddy( mIMAddressEdit );
294 layout->addWidget( label, 9, 4 ); 298 layout->addWidget( label, 9, 4 );
295 layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 ); 299 layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 );
296 300
297 layout->addColSpacing( 6, 50 ); 301 layout->addColSpacing( 6, 50 );
298 302
299 bar = new KSeparator( KSeparator::HLine, tab1 ); 303 bar = new KSeparator( KSeparator::HLine, tab1 );
300 layout->addMultiCellWidget( bar, 10, 10, 0, 6 ); 304 layout->addMultiCellWidget( bar, 10, 10, 0, 6 );
301*/ 305*/
302 /////////////////////////////////////// 306 ///////////////////////////////////////
303 QHBox *categoryBox = new QHBox( tab1 ,"cato"); 307 QHBox *categoryBox = new QHBox( tab1 ,"cato");
304 categoryBox->setSpacing( KDialogBase::spacingHint() ); 308 categoryBox->setSpacing( KDialogBase::spacingHint() );
305 categoryBox->setMargin( KDialogBase::marginHintSmall() ); 309 categoryBox->setMargin( KDialogBase::marginHintSmall() );
306 310
307 // Categories 311 // Categories
308 button = new QPushButton( i18n( "Categories" ), categoryBox ); 312 button = new QPushButton( i18n( "Categories" ), categoryBox );
309 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); 313 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) );
310 314
311 mCategoryEdit = new KLineEdit( categoryBox ); 315 mCategoryEdit = new KLineEdit( categoryBox );
312 mCategoryEdit->setReadOnly( true ); 316 mCategoryEdit->setReadOnly( true );
313 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), 317 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
314 SLOT( textChanged( const QString& ) ) ); 318 SLOT( textChanged( const QString& ) ) );
315 319
316 mSecrecyWidget = new SecrecyWidget( categoryBox ); 320 mSecrecyWidget = new SecrecyWidget( categoryBox );
317 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 321 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
318 322
319//US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); 323//US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 );
320 layout->addMultiCellWidget( categoryBox, iii, iii, 0, 1 ); 324 layout->addMultiCellWidget( categoryBox, iii, iii, 0, 1 );
321 325
322 // Build the layout and add to the tab widget 326 // Build the layout and add to the tab widget
323 layout->activate(); // required 327 layout->activate(); // required
324 328
325 mTabWidget->addTab( tab1, i18n( "&General" ) ); 329 mTabWidget->addTab( tab1, i18n( "&General" ) );
326} 330}
327 331
332void AddresseeEditorWidget::setRole2FN()
333{
334 if ( mRoleEdit->text().isEmpty() ) return;
335 mFormattedNameType = NameEditDialog::CustomName;
336 mAddressee.setFormattedName( mRoleEdit->text() );
337 mFormattedNameLabel->setText( mRoleEdit->text() );
338 mDirty = true;
339}
340void AddresseeEditorWidget::setCompany2FN()
341{
342 if ( mOrgEdit->text().isEmpty() ) return;
343 mFormattedNameType = NameEditDialog::CustomName;
344 mAddressee.setFormattedName( mOrgEdit->text() );
345 mFormattedNameLabel->setText( mOrgEdit->text() );
346 mDirty = true;
347}
328 348
329void AddresseeEditorWidget::setupTab1_1() 349void AddresseeEditorWidget::setupTab1_1()
330{ 350{
331 // This is the Address tab 351 // This is the Address tab
332 QWidget *tab1_1 = new QWidget( mTabWidget ); 352 QWidget *tab1_1 = new QWidget( mTabWidget );
333 353
334//US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 ); 354//US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 );
335 QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 ); 355 QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 );
336 layout->setMargin( KDialogBase::marginHintSmall() ); 356 layout->setMargin( KDialogBase::marginHintSmall() );
337 layout->setSpacing( KDialogBase::spacingHintSmall() ); 357 layout->setSpacing( KDialogBase::spacingHintSmall() );
338 358
339 QLabel *label; 359 QLabel *label;
340 KSeparator* bar; 360 KSeparator* bar;
341 QPushButton *button; 361 QPushButton *button;
342 362
343/*US 363/*US
344 ////////////////////////////////// 364 //////////////////////////////////
345 // Upper left group (person info) 365 // Upper left group (person info)
346 366
347 // Person icon 367 // Person icon
348 label = new QLabel( tab1 ); 368 label = new QLabel( tab1 );
349//US ambiguous call. Add one more parameter 369//US ambiguous call. Add one more parameter
350//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 370//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
351 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 371 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
352 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 372 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
353 373
354 // First name 374 // First name
355 button = new QPushButton( i18n( "Name..." ), tab1 ); 375 button = new QPushButton( i18n( "Name..." ), tab1 );
356 QToolTip::add( button, i18n( "Edit the contact's name" ) ); 376 QToolTip::add( button, i18n( "Edit the contact's name" ) );
357 mNameEdit = new KLineEdit( tab1, "mNameEdit" ); 377 mNameEdit = new KLineEdit( tab1, "mNameEdit" );
358 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), 378 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
359 SLOT( nameTextChanged( const QString& ) ) ); 379 SLOT( nameTextChanged( const QString& ) ) );
360 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); 380 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
361 381
362#ifndef KAB_EMBEDDED 382#ifndef KAB_EMBEDDED
363 mNameLabel = new KSqueezedTextLabel( tab1 ); 383 mNameLabel = new KSqueezedTextLabel( tab1 );
364 mNameLabel->hide(); 384 mNameLabel->hide();
365#else //KAB_EMBEDDED 385#else //KAB_EMBEDDED
366qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 386qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
367#endif //KAB_EMBEDDED 387#endif //KAB_EMBEDDED
368 388
369 layout->addWidget( button, 0, 1 ); 389 layout->addWidget( button, 0, 1 );
370 layout->addWidget( mNameEdit, 0, 2 ); 390 layout->addWidget( mNameEdit, 0, 2 );
371 391
372#ifndef KAB_EMBEDDED 392#ifndef KAB_EMBEDDED
373 layout->addWidget( mNameLabel, 0, 2 ); 393 layout->addWidget( mNameLabel, 0, 2 );
374#else //KAB_EMBEDDED 394#else //KAB_EMBEDDED
375qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 395qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
376#endif //KAB_EMBEDDED 396#endif //KAB_EMBEDDED
377 397
378 label = new QLabel( i18n( "Role:" ), tab1 ); 398 label = new QLabel( i18n( "Role:" ), tab1 );
379 mRoleEdit = new KLineEdit( tab1 ); 399 mRoleEdit = new KLineEdit( tab1 );
380 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), 400 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ),
381 SLOT( textChanged( const QString& ) ) ); 401 SLOT( textChanged( const QString& ) ) );
382 label->setBuddy( mRoleEdit ); 402 label->setBuddy( mRoleEdit );
383 layout->addWidget( label, 1, 1 ); 403 layout->addWidget( label, 1, 1 );
384 layout->addWidget( mRoleEdit, 1, 2 ); 404 layout->addWidget( mRoleEdit, 1, 2 );
385 405
386 // Organization 406 // Organization
387 label = new QLabel( i18n( "Organization:" ), tab1 ); 407 label = new QLabel( i18n( "Organization:" ), tab1 );
388 mOrgEdit = new KLineEdit( tab1 ); 408 mOrgEdit = new KLineEdit( tab1 );
389 label->setBuddy( mOrgEdit ); 409 label->setBuddy( mOrgEdit );
390 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), 410 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ),
391 SLOT( textChanged( const QString& ) ) ); 411 SLOT( textChanged( const QString& ) ) );
392 layout->addWidget( label, 2, 1 ); 412 layout->addWidget( label, 2, 1 );
393 layout->addWidget( mOrgEdit, 2, 2 ); 413 layout->addWidget( mOrgEdit, 2, 2 );
394 414
395 // File as (formatted name) 415 // File as (formatted name)
396 label = new QLabel( i18n( "Formatted name:" ), tab1 ); 416 label = new QLabel( i18n( "Formatted name:" ), tab1 );
397#ifndef KAB_EMBEDDED 417#ifndef KAB_EMBEDDED
398 mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); 418 mFormattedNameLabel = new KSqueezedTextLabel( tab1 );
399#else //KAB_EMBEDDED 419#else //KAB_EMBEDDED
400qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 420qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
401#endif //KAB_EMBEDDED 421#endif //KAB_EMBEDDED
402 layout->addWidget( label, 3, 1 ); 422 layout->addWidget( label, 3, 1 );
403#ifndef KAB_EMBEDDED 423#ifndef KAB_EMBEDDED
404 layout->addWidget( mFormattedNameLabel, 3, 2 ); 424 layout->addWidget( mFormattedNameLabel, 3, 2 );
405#else //KAB_EMBEDDED 425#else //KAB_EMBEDDED
406qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 426qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
407#endif //KAB_EMBEDDED 427#endif //KAB_EMBEDDED
408 428
409 // Left hand separator. This separator doesn't go all the way 429 // Left hand separator. This separator doesn't go all the way
410 // across so the dialog still flows from top to bottom 430 // across so the dialog still flows from top to bottom
411 bar = new KSeparator( KSeparator::HLine, tab1 ); 431 bar = new KSeparator( KSeparator::HLine, tab1 );
412 layout->addMultiCellWidget( bar, 4, 4, 0, 2 ); 432 layout->addMultiCellWidget( bar, 4, 4, 0, 2 );
413 433
414 ////////////////////////////////////// 434 //////////////////////////////////////
415 // Phone numbers (upper right) 435 // Phone numbers (upper right)
416 label = new QLabel( tab1 ); 436 label = new QLabel( tab1 );
417//US loadIcon call is ambiguous. Add one more parameter 437//US loadIcon call is ambiguous. Add one more parameter
418//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); 438//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) );
419 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); 439 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
420 layout->addMultiCellWidget( label, 0, 1, 3, 3 ); 440 layout->addMultiCellWidget( label, 0, 1, 3, 3 );
421 441
422 mPhoneEditWidget = new PhoneEditWidget( tab1 ); 442 mPhoneEditWidget = new PhoneEditWidget( tab1 );
423 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 443 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
424 layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); 444 layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 );
425 445
426 bar = new KSeparator( KSeparator::HLine, tab1 ); 446 bar = new KSeparator( KSeparator::HLine, tab1 );
427 layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); 447 layout->addMultiCellWidget( bar, 4, 4, 3, 6 );
428*/ 448*/
429 ////////////////////////////////////// 449 //////////////////////////////////////
430 // Addresses (lower left) 450 // Addresses (lower left)
431 /* LR 451 /* LR
432 label = new QLabel( tab1_1 ); 452 label = new QLabel( tab1_1 );
433//US loadIcon call is ambiguous. Add one more parameter 453//US loadIcon call is ambiguous. Add one more parameter
434//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) ); 454//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) );
435 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); 455 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) );
436//US layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 456//US layout->addMultiCellWidget( label, 5, 6, 0, 0 );
437 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 457 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
438 */ 458 */
439 459
440 mAddressEditWidget = new AddressEditWidget( tab1_1 ); 460 mAddressEditWidget = new AddressEditWidget( tab1_1 );
441 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 461 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
442//US layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 ); 462//US layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 );
443 layout->addMultiCellWidget( mAddressEditWidget, 0, 4, 0, 1 ); 463 layout->addMultiCellWidget( mAddressEditWidget, 0, 4, 0, 1 );
444 464
445//US 465//US
446/* LR 466/* LR
447 bar = new KSeparator( KSeparator::HLine, tab1_1 ); 467 bar = new KSeparator( KSeparator::HLine, tab1_1 );
448 layout->addMultiCellWidget( bar, 5, 5, 0, 3 ); 468 layout->addMultiCellWidget( bar, 5, 5, 0, 3 );
449*/ 469*/
450 470
451 ////////////////////////////////////// 471 //////////////////////////////////////
452 // Email / Web (lower right) 472 // Email / Web (lower right)
453 /* LR 473 /* LR
454 label = new QLabel( tab1_1 ); 474 label = new QLabel( tab1_1 );
455//US loadIcon call is ambiguous. Add one more parameter 475//US loadIcon call is ambiguous. Add one more parameter
456//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) ); 476//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) );
457 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) ); 477 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) );
458//US layout->addMultiCellWidget( label, 5, 6, 3, 3 ); 478//US layout->addMultiCellWidget( label, 5, 6, 3, 3 );
459 layout->addMultiCellWidget( label, 6, 7, 0, 0 ); 479 layout->addMultiCellWidget( label, 6, 7, 0, 0 );
460 */ 480 */
461 mEmailWidget = new EmailEditWidget( tab1_1 ); 481 mEmailWidget = new EmailEditWidget( tab1_1 );
462 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 482 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
463//US layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 ); 483//US layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 );
464 layout->addMultiCellWidget( mEmailWidget, 5, 6, 0, 1 ); 484 layout->addMultiCellWidget( mEmailWidget, 5, 6, 0, 1 );
465 485
466 /* LR 486 /* LR
467 // add the separator 487 // add the separator
468 bar = new KSeparator( KSeparator::HLine, tab1_1 ); 488 bar = new KSeparator( KSeparator::HLine, tab1_1 );
469//US layout->addMultiCellWidget( bar, 7, 7, 3, 6 ); 489//US layout->addMultiCellWidget( bar, 7, 7, 3, 6 );
470 layout->addMultiCellWidget( bar, 8, 8, 0, 3 ); 490 layout->addMultiCellWidget( bar, 8, 8, 0, 3 );
471 491
472 label = new QLabel( tab1_1 ); 492 label = new QLabel( tab1_1 );
473//US loadIcon call is ambiguous. Add one more parameter 493//US loadIcon call is ambiguous. Add one more parameter
474//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) ); 494//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) );
475 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) ); 495 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) );
476//US layout->addMultiCellWidget( label, 8, 9, 3, 3 ); 496//US layout->addMultiCellWidget( label, 8, 9, 3, 3 );
477 layout->addMultiCellWidget( label, 9, 10, 0, 0 ); 497 layout->addMultiCellWidget( label, 9, 10, 0, 0 );
478 */ 498 */
479 label = new QLabel( i18n( "URL:" ), tab1_1 ); 499 label = new QLabel( i18n( "URL:" ), tab1_1 );
480 mURLEdit = new KLineEdit( tab1_1 ); 500 mURLEdit = new KLineEdit( tab1_1 );
481 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ), 501 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ),
482 SLOT( textChanged( const QString& ) ) ); 502 SLOT( textChanged( const QString& ) ) );
483 label->setBuddy( mURLEdit ); 503 label->setBuddy( mURLEdit );
484//US layout->addWidget( label, 8, 4 ); 504//US layout->addWidget( label, 8, 4 );
485 layout->addWidget( label, 7,0 ); 505 layout->addWidget( label, 7,0 );
486//US layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 ); 506//US layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 );
487 layout->addWidget( mURLEdit, 7, 1); 507 layout->addWidget( mURLEdit, 7, 1);
488 508
489 label = new QLabel( i18n( "&IM address:" ), tab1_1 ); 509 label = new QLabel( i18n( "&IM address:" ), tab1_1 );
490 mIMAddressEdit = new KLineEdit( tab1_1 ); 510 mIMAddressEdit = new KLineEdit( tab1_1 );
491 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ), 511 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ),
492 SLOT( textChanged( const QString& ) ) ); 512 SLOT( textChanged( const QString& ) ) );
493 label->setBuddy( mIMAddressEdit ); 513 label->setBuddy( mIMAddressEdit );
494//US layout->addWidget( label, 9, 4 ); 514//US layout->addWidget( label, 9, 4 );
495 layout->addWidget( label, 8, 0 ); 515 layout->addWidget( label, 8, 0 );
496//US layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 ); 516//US layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 );
497 layout->addWidget( mIMAddressEdit, 8,1 ); 517 layout->addWidget( mIMAddressEdit, 8,1 );
498 518
499//US layout->addColSpacing( 6, 50 ); 519//US layout->addColSpacing( 6, 50 );
500 520
501//US bar = new KSeparator( KSeparator::HLine, tab1_1 ); 521//US bar = new KSeparator( KSeparator::HLine, tab1_1 );
502//US layout->addMultiCellWidget( bar, 10, 10, 0, 6 ); 522//US layout->addMultiCellWidget( bar, 10, 10, 0, 6 );
503 523
504/*US 524/*US
505 /////////////////////////////////////// 525 ///////////////////////////////////////
506 QHBox *categoryBox = new QHBox( tab1 ); 526 QHBox *categoryBox = new QHBox( tab1 );
507 categoryBox->setSpacing( KDialogBase::spacingHintSmall() ); 527 categoryBox->setSpacing( KDialogBase::spacingHintSmall() );
508 528
509 // Categories 529 // Categories
510 button = new QPushButton( i18n( "Categories" ), categoryBox ); 530 button = new QPushButton( i18n( "Categories" ), categoryBox );
511 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); 531 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) );
512 532
513 mCategoryEdit = new KLineEdit( categoryBox ); 533 mCategoryEdit = new KLineEdit( categoryBox );
514 mCategoryEdit->setReadOnly( true ); 534 mCategoryEdit->setReadOnly( true );
515 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), 535 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
516 SLOT( textChanged( const QString& ) ) ); 536 SLOT( textChanged( const QString& ) ) );
517 537
518 mSecrecyWidget = new SecrecyWidget( categoryBox ); 538 mSecrecyWidget = new SecrecyWidget( categoryBox );
519 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 539 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
520 540
521 layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); 541 layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 );
522*/ 542*/
523 // Build the layout and add to the tab widget 543 // Build the layout and add to the tab widget
524 layout->activate(); // required 544 layout->activate(); // required
525 545
526 mTabWidget->addTab( tab1_1, i18n( "&Address" ) ); 546 mTabWidget->addTab( tab1_1, i18n( "&Address" ) );
527} 547}
528 548
529 549
530 550
531void AddresseeEditorWidget::setupTab2() 551void AddresseeEditorWidget::setupTab2()
532{ 552{
533 // This is the Details tab 553 // This is the Details tab
534 QWidget *tab2 = new QWidget( mTabWidget ); 554 QWidget *tab2 = new QWidget( mTabWidget );
535 555
536 QGridLayout *layout = new QGridLayout( tab2, 8, 3 ); 556 QGridLayout *layout = new QGridLayout( tab2, 8, 3 );
537 layout->setMargin( KDialogBase::marginHintSmall() ); 557 layout->setMargin( KDialogBase::marginHintSmall() );
538 layout->setSpacing( KDialogBase::spacingHintSmall() ); 558 layout->setSpacing( KDialogBase::spacingHintSmall() );
539 559
540 QLabel *label; 560 QLabel *label;
541 KSeparator* bar; 561 KSeparator* bar;
542 562
543 /////////////////////// 563 ///////////////////////
544 // Office info 564 // Office info
545 565
546 // Department 566 // Department
547 label = new QLabel( tab2 ); 567 label = new QLabel( tab2 );
548//US loadIcon call is ambiguous. Add one more parameter 568//US loadIcon call is ambiguous. Add one more parameter
549//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); 569//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) );
550 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); 570 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) );
551 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 571 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
552 572
553 label = new QLabel( i18n( "Department:" ), tab2 ); 573 label = new QLabel( i18n( "Department:" ), tab2 );
554 layout->addWidget( label, 0, 1 ); 574 layout->addWidget( label, 0, 1 );
555 mDepartmentEdit = new KLineEdit( tab2 ); 575 mDepartmentEdit = new KLineEdit( tab2 );
556 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), 576 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ),
557 SLOT( textChanged( const QString& ) ) ); 577 SLOT( textChanged( const QString& ) ) );
558 label->setBuddy( mDepartmentEdit ); 578 label->setBuddy( mDepartmentEdit );
559 layout->addWidget( mDepartmentEdit, 0, 2 ); 579 layout->addWidget( mDepartmentEdit, 0, 2 );
560 580
561 label = new QLabel( i18n( "Office:" ), tab2 ); 581 label = new QLabel( i18n( "Office:" ), tab2 );
562 layout->addWidget( label, 1, 1 ); 582 layout->addWidget( label, 1, 1 );
563 mOfficeEdit = new KLineEdit( tab2 ); 583 mOfficeEdit = new KLineEdit( tab2 );
564 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ), 584 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ),
565 SLOT( textChanged( const QString& ) ) ); 585 SLOT( textChanged( const QString& ) ) );
566 label->setBuddy( mOfficeEdit ); 586 label->setBuddy( mOfficeEdit );
567 layout->addWidget( mOfficeEdit, 1, 2 ); 587 layout->addWidget( mOfficeEdit, 1, 2 );
568 588
569 label = new QLabel( i18n( "Profession:" ), tab2 ); 589 label = new QLabel( i18n( "Profession:" ), tab2 );
570 layout->addWidget( label, 2, 1 ); 590 layout->addWidget( label, 2, 1 );
571 mProfessionEdit = new KLineEdit( tab2 ); 591 mProfessionEdit = new KLineEdit( tab2 );
572 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ), 592 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ),
573 SLOT( textChanged( const QString& ) ) ); 593 SLOT( textChanged( const QString& ) ) );
574 label->setBuddy( mProfessionEdit ); 594 label->setBuddy( mProfessionEdit );
575 layout->addWidget( mProfessionEdit, 2, 2 ); 595 layout->addWidget( mProfessionEdit, 2, 2 );
576 596
577 label = new QLabel( i18n( "Manager\'s name:" ), tab2 ); 597 label = new QLabel( i18n( "Manager\'s name:" ), tab2 );
578//US layout->addWidget( label, 0, 3 ); 598//US layout->addWidget( label, 0, 3 );
579 layout->addWidget( label, 3, 1 ); 599 layout->addWidget( label, 3, 1 );
580 mManagerEdit = new KLineEdit( tab2 ); 600 mManagerEdit = new KLineEdit( tab2 );
581 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ), 601 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ),
582 SLOT( textChanged( const QString& ) ) ); 602 SLOT( textChanged( const QString& ) ) );
583 label->setBuddy( mManagerEdit ); 603 label->setBuddy( mManagerEdit );
584//US layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 ); 604//US layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 );
585 layout->addWidget( mManagerEdit, 3, 2 ); 605 layout->addWidget( mManagerEdit, 3, 2 );
586 606
587 label = new QLabel( i18n( "Assistant's name:" ), tab2 ); 607 label = new QLabel( i18n( "Assistant's name:" ), tab2 );
588//US layout->addWidget( label, 1, 3 ); 608//US layout->addWidget( label, 1, 3 );
589 layout->addWidget( label, 4, 1 ); 609 layout->addWidget( label, 4, 1 );
590 mAssistantEdit = new KLineEdit( tab2 ); 610 mAssistantEdit = new KLineEdit( tab2 );
591 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ), 611 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ),
592 SLOT( textChanged( const QString& ) ) ); 612 SLOT( textChanged( const QString& ) ) );
593 label->setBuddy( mAssistantEdit ); 613 label->setBuddy( mAssistantEdit );
594//US layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 ); 614//US layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 );
595 layout->addWidget( mAssistantEdit, 4, 2 ); 615 layout->addWidget( mAssistantEdit, 4, 2 );
596 616
597 bar = new KSeparator( KSeparator::HLine, tab2 ); 617 bar = new KSeparator( KSeparator::HLine, tab2 );
598//US layout->addMultiCellWidget( bar, 3, 3, 0, 5 ); 618//US layout->addMultiCellWidget( bar, 3, 3, 0, 5 );
599 layout->addMultiCellWidget( bar, 5, 5, 0, 2 ); 619 layout->addMultiCellWidget( bar, 5, 5, 0, 2 );
600 620
601 ///////////////////////////////////////////////// 621 /////////////////////////////////////////////////
602 // Personal info 622 // Personal info
603 623
604 //label = new QLabel( tab2 ); 624 //label = new QLabel( tab2 );
605//US loadIcon call is ambiguous. Add one more parameter 625//US loadIcon call is ambiguous. Add one more parameter
606//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 626//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
607 //label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 627 //label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
608//US layout->addMultiCellWidget( label, 4, 5, 0, 0 ); 628//US layout->addMultiCellWidget( label, 4, 5, 0, 0 );
609 //layout->addMultiCellWidget( label, 6, 7, 0, 0 ); 629 //layout->addMultiCellWidget( label, 6, 7, 0, 0 );
610 630
611 631
612 int iii = 6; 632 int iii = 6;
613 633
614 if ( QApplication::desktop()->width() == 640 ) { 634 if ( QApplication::desktop()->width() == 640 ) {
615 QHBox * nbox = new QHBox ( tab2 ); 635 QHBox * nbox = new QHBox ( tab2 );
616 label = new QLabel( i18n( "Nick name:" )+" ", nbox ); 636 label = new QLabel( i18n( "Nick name:" )+" ", nbox );
617 mNicknameEdit = new KLineEdit( nbox ); 637 mNicknameEdit = new KLineEdit( nbox );
618 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 638 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
619 SLOT( textChanged( const QString& ) ) ); 639 SLOT( textChanged( const QString& ) ) );
620 label->setBuddy( mNicknameEdit ); 640 label->setBuddy( mNicknameEdit );
621 641
622 label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox ); 642 label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox );
623 mSpouseEdit = new KLineEdit( nbox ); 643 mSpouseEdit = new KLineEdit( nbox );
624 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 644 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
625 SLOT( textChanged( const QString& ) ) ); 645 SLOT( textChanged( const QString& ) ) );
626 label->setBuddy( mSpouseEdit ); 646 label->setBuddy( mSpouseEdit );
627 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 ); 647 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
628 ++iii; 648 ++iii;
629 649
630 } else { 650 } else {
631 label = new QLabel( i18n( "Nick name:" ), tab2 ); 651 label = new QLabel( i18n( "Nick name:" ), tab2 );
632 layout->addWidget( label, iii, 1 ); 652 layout->addWidget( label, iii, 1 );
633 mNicknameEdit = new KLineEdit( tab2 ); 653 mNicknameEdit = new KLineEdit( tab2 );
634 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 654 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
635 SLOT( textChanged( const QString& ) ) ); 655 SLOT( textChanged( const QString& ) ) );
636 label->setBuddy( mNicknameEdit ); 656 label->setBuddy( mNicknameEdit );
637 layout->addWidget( mNicknameEdit, iii, 2 ); 657 layout->addWidget( mNicknameEdit, iii, 2 );
638 ++iii; 658 ++iii;
639 659
640 label = new QLabel( i18n( "Spouse's name:" ), tab2 ); 660 label = new QLabel( i18n( "Spouse's name:" ), tab2 );
641 layout->addWidget( label, iii, 1 ); 661 layout->addWidget( label, iii, 1 );
642 mSpouseEdit = new KLineEdit( tab2 ); 662 mSpouseEdit = new KLineEdit( tab2 );
643 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 663 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
644 SLOT( textChanged( const QString& ) ) ); 664 SLOT( textChanged( const QString& ) ) );
645 label->setBuddy( mSpouseEdit ); 665 label->setBuddy( mSpouseEdit );
646 layout->addWidget( mSpouseEdit, iii, 2 ); 666 layout->addWidget( mSpouseEdit, iii, 2 );
647 ++iii; 667 ++iii;
648 } 668 }
649 669
650 label = new QLabel( i18n( "Children's names:" ), tab2 ); 670 label = new QLabel( i18n( "Children's names:" ), tab2 );
651 layout->addWidget( label, iii, 1 ); 671 layout->addWidget( label, iii, 1 );
652 mChildEdit = new KLineEdit( tab2 ); 672 mChildEdit = new KLineEdit( tab2 );
653 connect( mChildEdit, SIGNAL( textChanged( const QString& ) ), 673 connect( mChildEdit, SIGNAL( textChanged( const QString& ) ),
654 SLOT( textChanged( const QString& ) ) ); 674 SLOT( textChanged( const QString& ) ) );
655 label->setBuddy( mChildEdit ); 675 label->setBuddy( mChildEdit );
656 layout->addWidget( mChildEdit, iii, 2 ); 676 layout->addWidget( mChildEdit, iii, 2 );
657 ++iii; 677 ++iii;
658 if ( QApplication::desktop()->width() == 640 ) { 678 if ( QApplication::desktop()->width() == 640 ) {
659 QHBox * nbox = new QHBox ( tab2 ); 679 QHBox * nbox = new QHBox ( tab2 );
660 label = new QLabel( i18n( "Birthday:" )+" ", nbox ); 680 label = new QLabel( i18n( "Birthday:" )+" ", nbox );
661 mBirthdayPicker = new KDateEdit( nbox ); 681 mBirthdayPicker = new KDateEdit( nbox );
662 //mBirthdayPicker->toggleDateFormat(); 682 //mBirthdayPicker->toggleDateFormat();
663 mBirthdayPicker->setHandleInvalid( true ); 683 mBirthdayPicker->setHandleInvalid( true );
664 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 684 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
665 SLOT( dateChanged( QDate ) ) ); 685 SLOT( dateChanged( QDate ) ) );
666 686
667 label->setBuddy( mBirthdayPicker ); 687 label->setBuddy( mBirthdayPicker );
668 688
669 label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox ); 689 label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox );
670 mAnniversaryPicker = new KDateEdit( nbox ); 690 mAnniversaryPicker = new KDateEdit( nbox );
671 mAnniversaryPicker->setHandleInvalid( true ); 691 mAnniversaryPicker->setHandleInvalid( true );
672 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), 692 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
673 SLOT( dateChanged( QDate ) ) ); 693 SLOT( dateChanged( QDate ) ) );
674 694
675 label->setBuddy( mAnniversaryPicker ); 695 label->setBuddy( mAnniversaryPicker );
676 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 ); 696 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
677 ++iii; 697 ++iii;
678 698
679 } else { 699 } else {
680 700
681 label = new QLabel( i18n( "Birthday:" ), tab2 ); 701 label = new QLabel( i18n( "Birthday:" ), tab2 );
682 layout->addWidget( label, iii, 1 ); 702 layout->addWidget( label, iii, 1 );
683 mBirthdayPicker = new KDateEdit( tab2 ); 703 mBirthdayPicker = new KDateEdit( tab2 );
684 //mBirthdayPicker->toggleDateFormat(); 704 //mBirthdayPicker->toggleDateFormat();
685 mBirthdayPicker->setHandleInvalid( true ); 705 mBirthdayPicker->setHandleInvalid( true );
686 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 706 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
687 SLOT( dateChanged( QDate ) ) ); 707 SLOT( dateChanged( QDate ) ) );
688 708
689 label->setBuddy( mBirthdayPicker ); 709 label->setBuddy( mBirthdayPicker );
690 layout->addWidget( mBirthdayPicker, iii, 2 ); 710 layout->addWidget( mBirthdayPicker, iii, 2 );
691 ++iii; 711 ++iii;
692 712
693 label = new QLabel( i18n( "Anniversary:" ), tab2 ); 713 label = new QLabel( i18n( "Anniversary:" ), tab2 );
694 layout->addWidget( label, iii, 1 ); 714 layout->addWidget( label, iii, 1 );
695 mAnniversaryPicker = new KDateEdit( tab2 ); 715 mAnniversaryPicker = new KDateEdit( tab2 );
696 mAnniversaryPicker->setHandleInvalid( true ); 716 mAnniversaryPicker->setHandleInvalid( true );
697 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), 717 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
698 SLOT( dateChanged( QDate ) ) ); 718 SLOT( dateChanged( QDate ) ) );
699 719
700 label->setBuddy( mAnniversaryPicker ); 720 label->setBuddy( mAnniversaryPicker );
701 layout->addWidget( mAnniversaryPicker, iii, 2 ); 721 layout->addWidget( mAnniversaryPicker, iii, 2 );
702 ++iii; 722 ++iii;
703 723
704 } 724 }
705 725
706 label = new QLabel( i18n( "Gender:" ), tab2 ); 726 label = new QLabel( i18n( "Gender:" ), tab2 );
707 layout->addWidget( label, iii, 1 ); 727 layout->addWidget( label, iii, 1 );
708 mGenderBox = new QComboBox ( tab2 ); 728 mGenderBox = new QComboBox ( tab2 );
709 mGenderBox->insertItem ( i18n( "ALIEN (undefined)" )); 729 mGenderBox->insertItem ( i18n( "ALIEN (undefined)" ));
710 mGenderBox->insertItem ( i18n( "female" )); 730 mGenderBox->insertItem ( i18n( "female" ));
711 mGenderBox->insertItem ( i18n( "male" )); 731 mGenderBox->insertItem ( i18n( "male" ));
712 connect( mGenderBox, SIGNAL( activated ( const QString & ) ), 732 connect( mGenderBox, SIGNAL( activated ( const QString & ) ),
713 SLOT( textChanged( const QString& ) ) ); 733 SLOT( textChanged( const QString& ) ) );
714 label->setBuddy( mGenderBox ); 734 label->setBuddy( mGenderBox );
715 layout->addWidget( mGenderBox, iii, 2 ); 735 layout->addWidget( mGenderBox, iii, 2 );
716 ++iii; 736 ++iii;
717 // Build the layout and add to the tab widget 737 // Build the layout and add to the tab widget
718 layout->activate(); // required 738 layout->activate(); // required
719 739
720 mTabWidget->addTab( tab2, i18n( "&Details" ) ); 740 mTabWidget->addTab( tab2, i18n( "&Details" ) );
721} 741}
722 742
723void AddresseeEditorWidget::setupTab2_1() 743void AddresseeEditorWidget::setupTab2_1()
724{ 744{
725 // This is the Details tab 745 // This is the Details tab
726 QWidget *tab2_2 = new QWidget( mTabWidget ); 746 QWidget *tab2_2 = new QWidget( mTabWidget );
727 747
728 QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 ); 748 QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 );
729 layout->setMargin( KDialogBase::marginHintSmall() ); 749 layout->setMargin( KDialogBase::marginHintSmall() );
730 layout->setSpacing( KDialogBase::spacingHintSmall() ); 750 layout->setSpacing( KDialogBase::spacingHintSmall() );
731 751
732 QLabel *label; 752 QLabel *label;
733 KSeparator* bar; 753 KSeparator* bar;
734 754
735/*US 755/*US
736 /////////////////////// 756 ///////////////////////
737 // Office info 757 // Office info
738 758
739 // Department 759 // Department
740 label = new QLabel( tab2 ); 760 label = new QLabel( tab2 );
741//US loadIcon call is ambiguous. Add one more parameter 761//US loadIcon call is ambiguous. Add one more parameter
742//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); 762//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) );
743 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); 763 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) );
744 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 764 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
745 765
746 label = new QLabel( i18n( "Department:" ), tab2 ); 766 label = new QLabel( i18n( "Department:" ), tab2 );
747 layout->addWidget( label, 0, 1 ); 767 layout->addWidget( label, 0, 1 );
748 mDepartmentEdit = new KLineEdit( tab2 ); 768 mDepartmentEdit = new KLineEdit( tab2 );
749 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), 769 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ),
750 SLOT( textChanged( const QString& ) ) ); 770 SLOT( textChanged( const QString& ) ) );
751 label->setBuddy( mDepartmentEdit ); 771 label->setBuddy( mDepartmentEdit );
752 layout->addWidget( mDepartmentEdit, 0, 2 ); 772 layout->addWidget( mDepartmentEdit, 0, 2 );
753 773
754 label = new QLabel( i18n( "Office:" ), tab2 ); 774 label = new QLabel( i18n( "Office:" ), tab2 );
755 layout->addWidget( label, 1, 1 ); 775 layout->addWidget( label, 1, 1 );
756 mOfficeEdit = new KLineEdit( tab2 ); 776 mOfficeEdit = new KLineEdit( tab2 );
757 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ), 777 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ),
758 SLOT( textChanged( const QString& ) ) ); 778 SLOT( textChanged( const QString& ) ) );
759 label->setBuddy( mOfficeEdit ); 779 label->setBuddy( mOfficeEdit );
760 layout->addWidget( mOfficeEdit, 1, 2 ); 780 layout->addWidget( mOfficeEdit, 1, 2 );
761 781
762 label = new QLabel( i18n( "Profession:" ), tab2 ); 782 label = new QLabel( i18n( "Profession:" ), tab2 );
763 layout->addWidget( label, 2, 1 ); 783 layout->addWidget( label, 2, 1 );
764 mProfessionEdit = new KLineEdit( tab2 ); 784 mProfessionEdit = new KLineEdit( tab2 );
765 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ), 785 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ),
766 SLOT( textChanged( const QString& ) ) ); 786 SLOT( textChanged( const QString& ) ) );
767 label->setBuddy( mProfessionEdit ); 787 label->setBuddy( mProfessionEdit );
768 layout->addWidget( mProfessionEdit, 2, 2 ); 788 layout->addWidget( mProfessionEdit, 2, 2 );
769 789
770 label = new QLabel( i18n( "Manager\'s name:" ), tab2 ); 790 label = new QLabel( i18n( "Manager\'s name:" ), tab2 );
771 layout->addWidget( label, 0, 3 ); 791 layout->addWidget( label, 0, 3 );
772 mManagerEdit = new KLineEdit( tab2 ); 792 mManagerEdit = new KLineEdit( tab2 );
773 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ), 793 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ),
774 SLOT( textChanged( const QString& ) ) ); 794 SLOT( textChanged( const QString& ) ) );
775 label->setBuddy( mManagerEdit ); 795 label->setBuddy( mManagerEdit );
776 layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 ); 796 layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 );
777 797
778 label = new QLabel( i18n( "Assistant's name:" ), tab2 ); 798 label = new QLabel( i18n( "Assistant's name:" ), tab2 );
779 layout->addWidget( label, 1, 3 ); 799 layout->addWidget( label, 1, 3 );
780 mAssistantEdit = new KLineEdit( tab2 ); 800 mAssistantEdit = new KLineEdit( tab2 );
781 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ), 801 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ),
782 SLOT( textChanged( const QString& ) ) ); 802 SLOT( textChanged( const QString& ) ) );
783 label->setBuddy( mAssistantEdit ); 803 label->setBuddy( mAssistantEdit );
784 layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 ); 804 layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 );
785 805
786 bar = new KSeparator( KSeparator::HLine, tab2 ); 806 bar = new KSeparator( KSeparator::HLine, tab2 );
787 layout->addMultiCellWidget( bar, 3, 3, 0, 5 ); 807 layout->addMultiCellWidget( bar, 3, 3, 0, 5 );
788 808
789 ///////////////////////////////////////////////// 809 /////////////////////////////////////////////////
790 // Personal info 810 // Personal info
791 811
792 label = new QLabel( tab2 ); 812 label = new QLabel( tab2 );
793//US loadIcon call is ambiguous. Add one more parameter 813//US loadIcon call is ambiguous. Add one more parameter
794//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 814//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
795 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 815 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
796 layout->addMultiCellWidget( label, 4, 5, 0, 0 ); 816 layout->addMultiCellWidget( label, 4, 5, 0, 0 );
797 817
798 label = new QLabel( i18n( "Nick name:" ), tab2 ); 818 label = new QLabel( i18n( "Nick name:" ), tab2 );
799 layout->addWidget( label, 4, 1 ); 819 layout->addWidget( label, 4, 1 );
800 mNicknameEdit = new KLineEdit( tab2 ); 820 mNicknameEdit = new KLineEdit( tab2 );
801 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 821 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
802 SLOT( textChanged( const QString& ) ) ); 822 SLOT( textChanged( const QString& ) ) );
803 label->setBuddy( mNicknameEdit ); 823 label->setBuddy( mNicknameEdit );
804 layout->addWidget( mNicknameEdit, 4, 2 ); 824 layout->addWidget( mNicknameEdit, 4, 2 );
805 825
806 label = new QLabel( i18n( "Spouse's name:" ), tab2 ); 826 label = new QLabel( i18n( "Spouse's name:" ), tab2 );
807 layout->addWidget( label, 5, 1 ); 827 layout->addWidget( label, 5, 1 );
808 mSpouseEdit = new KLineEdit( tab2 ); 828 mSpouseEdit = new KLineEdit( tab2 );
809 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 829 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
810 SLOT( textChanged( const QString& ) ) ); 830 SLOT( textChanged( const QString& ) ) );
811 label->setBuddy( mSpouseEdit ); 831 label->setBuddy( mSpouseEdit );
812 layout->addWidget( mSpouseEdit, 5, 2 ); 832 layout->addWidget( mSpouseEdit, 5, 2 );
813 833
814 label = new QLabel( i18n( "Birthday:" ), tab2 ); 834 label = new QLabel( i18n( "Birthday:" ), tab2 );
815 layout->addWidget( label, 4, 3 ); 835 layout->addWidget( label, 4, 3 );
816 mBirthdayPicker = new KDateEdit( tab2 ); 836 mBirthdayPicker = new KDateEdit( tab2 );
817 mBirthdayPicker->setHandleInvalid( true ); 837 mBirthdayPicker->setHandleInvalid( true );
818 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 838 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
819 SLOT( dateChanged( QDate ) ) ); 839 SLOT( dateChanged( QDate ) ) );
820 connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ), 840 connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ),
821 SLOT( invalidDate() ) ); 841 SLOT( invalidDate() ) );
822 connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ), 842 connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ),
823 SLOT( emitModified() ) ); 843 SLOT( emitModified() ) );
824 label->setBuddy( mBirthdayPicker ); 844 label->setBuddy( mBirthdayPicker );
825 layout->addWidget( mBirthdayPicker, 4, 4 ); 845 layout->addWidget( mBirthdayPicker, 4, 4 );
826 846
827 label = new QLabel( i18n( "Anniversary:" ), tab2 ); 847 label = new QLabel( i18n( "Anniversary:" ), tab2 );
828 layout->addWidget( label, 5, 3 ); 848 layout->addWidget( label, 5, 3 );
829 mAnniversaryPicker = new KDateEdit( tab2 ); 849 mAnniversaryPicker = new KDateEdit( tab2 );
830 mAnniversaryPicker->setHandleInvalid( true ); 850 mAnniversaryPicker->setHandleInvalid( true );
831 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), 851 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
832 SLOT( dateChanged( QDate ) ) ); 852 SLOT( dateChanged( QDate ) ) );
833 connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ), 853 connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ),
834 SLOT( invalidDate() ) ); 854 SLOT( invalidDate() ) );
835 connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ), 855 connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ),
836 SLOT( emitModified() ) ); 856 SLOT( emitModified() ) );
837 label->setBuddy( mAnniversaryPicker ); 857 label->setBuddy( mAnniversaryPicker );
838 layout->addWidget( mAnniversaryPicker, 5, 4 ); 858 layout->addWidget( mAnniversaryPicker, 5, 4 );
839 859
840 bar = new KSeparator( KSeparator::HLine, tab2 ); 860 bar = new KSeparator( KSeparator::HLine, tab2 );
841 layout->addMultiCellWidget( bar, 6, 6, 0, 5 ); 861 layout->addMultiCellWidget( bar, 6, 6, 0, 5 );
842*/ 862*/
843 ////////////////////////////////////// 863 //////////////////////////////////////
844 // Notes 864 // Notes
845 label = new QLabel( i18n( "Note:" ), tab2_2 ); 865 label = new QLabel( i18n( "Note:" ), tab2_2 );
846 label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); 866 label->setAlignment( Qt::AlignTop | Qt::AlignLeft );
847//US layout->addWidget( label, 7, 0 ); 867//US layout->addWidget( label, 7, 0 );
848 layout->addWidget( label, 0, 0 ); 868 layout->addWidget( label, 0, 0 );
849#ifndef KAB_EMBEDDED 869#ifndef KAB_EMBEDDED
850 mNoteEdit = new QTextEdit( tab2_2 ); 870 mNoteEdit = new QTextEdit( tab2_2 );
851 mNoteEdit->setWordWrap( QTextEdit::WidgetWidth ); 871 mNoteEdit->setWordWrap( QTextEdit::WidgetWidth );
852 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); 872 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
853#else //KAB_EMBEDDED 873#else //KAB_EMBEDDED
854 mNoteEdit = new QMultiLineEdit( tab2_2 ); 874 mNoteEdit = new QMultiLineEdit( tab2_2 );
855 mNoteEdit->setWordWrap( QMultiLineEdit::WidgetWidth ); 875 mNoteEdit->setWordWrap( QMultiLineEdit::WidgetWidth );
856 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); 876 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
857#endif //KAB_EMBEDDED 877#endif //KAB_EMBEDDED
858 878
859 connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) ); 879 connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) );
860 label->setBuddy( mNoteEdit ); 880 label->setBuddy( mNoteEdit );
861//US layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 ); 881//US layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 );
862 layout->addWidget( mNoteEdit, 1, 0); 882 layout->addWidget( mNoteEdit, 1, 0);
863 883
864 // Build the layout and add to the tab widget 884 // Build the layout and add to the tab widget
865 layout->activate(); // required 885 layout->activate(); // required
866 886
867 mTabWidget->addTab( tab2_2, i18n( "&Notes" ) ); 887 mTabWidget->addTab( tab2_2, i18n( "&Notes" ) );
868} 888}
869 889
870 890
871 891
872void AddresseeEditorWidget::setupTab3() 892void AddresseeEditorWidget::setupTab3()
873{ 893{
874 // This is the Misc tab 894 // This is the Misc tab
875 QWidget *tab3 = new QWidget( mTabWidget ); 895 QWidget *tab3 = new QWidget( mTabWidget );
876 896
877 QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); 897 QGridLayout *layout = new QGridLayout( tab3, 1, 1 );
878 layout->setMargin( KDialogBase::marginHintSmall() ); 898 layout->setMargin( KDialogBase::marginHintSmall() );
879 layout->setSpacing( KDialogBase::spacingHintSmall() ); 899 layout->setSpacing( KDialogBase::spacingHintSmall() );
880//US layout->setColStretch( 2, 1 ); 900//US layout->setColStretch( 2, 1 );
881 901
882 ////////////////////////////////////// 902 //////////////////////////////////////
883 // Geo 903 // Geo
884 mGeoWidget = new GeoWidget( tab3 ); 904 mGeoWidget = new GeoWidget( tab3 );
885 // mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); 905 // mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() );
886 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 906 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
887 layout->addWidget( mGeoWidget, 0, 0 ); 907 layout->addWidget( mGeoWidget, 0, 0 );
888/*US 908/*US
889 ////////////////////////////////////// 909 //////////////////////////////////////
890 // Sound 910 // Sound
891#ifndef KAB_EMBEDDED 911#ifndef KAB_EMBEDDED
892 mSoundWidget = new SoundWidget( tab3 ); 912 mSoundWidget = new SoundWidget( tab3 );
893 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); 913 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() );
894 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 914 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
895 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); 915 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop );
896#else //KAB_EMBEDDED 916#else //KAB_EMBEDDED
897qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); 917qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed");
898#endif //KAB_EMBEDDED 918#endif //KAB_EMBEDDED
899 919
900 ////////////////////////////////////// 920 //////////////////////////////////////
901 // Images 921 // Images
902 mImageWidget = new ImageWidget( tab3 ); 922 mImageWidget = new ImageWidget( tab3 );
903 mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); 923 mImageWidget->setMinimumSize( mImageWidget->sizeHint() );
904 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 924 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
905 layout->addWidget( mImageWidget, 1, 0, Qt::AlignTop ); 925 layout->addWidget( mImageWidget, 1, 0, Qt::AlignTop );
906*/ 926*/
907//US 927//US
908/* 928/*
909 KSeparator* bar = new KSeparator( KSeparator::HLine, tab3 ); 929 KSeparator* bar = new KSeparator( KSeparator::HLine, tab3 );
910 layout->addMultiCellWidget( bar, 1, 1, 0, 0 ); 930 layout->addMultiCellWidget( bar, 1, 1, 0, 0 );
911*/ 931*/
912 ////////////////////////////////////// 932 //////////////////////////////////////
913 // Keys 933 // Keys
914 mKeyWidget = new KeyWidget( tab3 ); 934 mKeyWidget = new KeyWidget( tab3 );
915 //mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); 935 //mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() );
916 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 936 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
917//US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); 937//US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop );
918 layout->addWidget( mKeyWidget, 1, 0 ); 938 layout->addWidget( mKeyWidget, 1, 0 );
919 939
920 mTabWidget->addTab( tab3, i18n( "&Misc" ) ); 940 mTabWidget->addTab( tab3, i18n( "&Misc" ) );
921} 941}
922 942
923void AddresseeEditorWidget::setupTab3_1() 943void AddresseeEditorWidget::setupTab3_1()
924{ 944{
925 // This is the Misc tab 945 // This is the Misc tab
926 QWidget *tab3 = new QWidget( mTabWidget ); 946 QWidget *tab3 = new QWidget( mTabWidget );
927 947
928//US QGridLayout *layout = new QGridLayout( tab3, 2, 3 ); 948//US QGridLayout *layout = new QGridLayout( tab3, 2, 3 );
929 QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); 949 QGridLayout *layout = new QGridLayout( tab3, 1, 1 );
930 layout->setMargin( KDialogBase::marginHint() ); 950 layout->setMargin( KDialogBase::marginHint() );
931 layout->setSpacing( KDialogBase::spacingHint() ); 951 layout->setSpacing( KDialogBase::spacingHint() );
932//US layout->setColStretch( 2, 1 ); 952//US layout->setColStretch( 2, 1 );
933 953
934/*US 954/*US
935 ////////////////////////////////////// 955 //////////////////////////////////////
936 // Geo 956 // Geo
937 mGeoWidget = new GeoWidget( tab3 ); 957 mGeoWidget = new GeoWidget( tab3 );
938 mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); 958 mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() );
939 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 959 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
940 layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop ); 960 layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop );
941*/ 961*/
942 ////////////////////////////////////// 962 //////////////////////////////////////
943 // Sound 963 // Sound
944#ifndef KAB_EMBEDDED 964#ifndef KAB_EMBEDDED
945 mSoundWidget = new SoundWidget( tab3 ); 965 mSoundWidget = new SoundWidget( tab3 );
946 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); 966 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() );
947 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 967 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
948 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); 968 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop );
949#else //KAB_EMBEDDED 969#else //KAB_EMBEDDED
950//US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); 970//US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed");
951#endif //KAB_EMBEDDED 971#endif //KAB_EMBEDDED
952 972
953 ////////////////////////////////////// 973 //////////////////////////////////////
954 // Images 974 // Images
955 mImageWidget = new ImageWidget( tab3 ); 975 mImageWidget = new ImageWidget( tab3 );
956 mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); 976 mImageWidget->setMinimumSize( mImageWidget->sizeHint() );
957 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 977 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
958 layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop ); 978 layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop );
959/*US 979/*US
960 ////////////////////////////////////// 980 //////////////////////////////////////
961 // Keys 981 // Keys
962 mKeyWidget = new KeyWidget( tab3 ); 982 mKeyWidget = new KeyWidget( tab3 );
963 mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); 983 mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() );
964 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 984 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
965 layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); 985 layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop );
966*/ 986*/
967 mTabWidget->addTab( tab3, i18n( "&Images" ) ); 987 mTabWidget->addTab( tab3, i18n( "&Images" ) );
968} 988}
969 989
970 990
971void AddresseeEditorWidget::load() 991void AddresseeEditorWidget::load()
972{ 992{
973 993
974 // Block signals in case anything tries to emit modified 994 // Block signals in case anything tries to emit modified
975 // CS: This doesn't seem to work. 995 // CS: This doesn't seem to work.
976 bool block = signalsBlocked(); 996 bool block = signalsBlocked();
977 blockSignals( true ); 997 blockSignals( true );
978 mBlockSignals = true; // used for internal signal blocking 998 mBlockSignals = true; // used for internal signal blocking
979 999
980 mNameEdit->setText( mAddressee.assembledName() ); 1000 mNameEdit->setText( mAddressee.assembledName() );
981 1001
982 if ( mAddressee.formattedName().isEmpty() ) { 1002 if ( mAddressee.formattedName().isEmpty() ) {
983//US KConfig config( "kaddressbookrc" ); 1003//US KConfig config( "kaddressbookrc" );
984 KConfig config( locateLocal("config", "kabcrc") ); 1004 KConfig config( locateLocal("config", "kabcrc") );
985 config.setGroup( "General" ); 1005 config.setGroup( "General" );
986 mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 ); 1006 mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 );
987 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 1007 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
988 } else {; 1008 } else {;
989 if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) ) 1009 if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) )
990 mFormattedNameType = NameEditDialog::SimpleName; 1010 mFormattedNameType = NameEditDialog::SimpleName;
991 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) ) 1011 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) )
992 mFormattedNameType = NameEditDialog::FullName; 1012 mFormattedNameType = NameEditDialog::FullName;
993 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) ) 1013 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) )
994 mFormattedNameType = NameEditDialog::ReverseName; 1014 mFormattedNameType = NameEditDialog::ReverseName;
995 else 1015 else
996 mFormattedNameType = NameEditDialog::CustomName; 1016 mFormattedNameType = NameEditDialog::CustomName;
997 } 1017 }
998 1018
999 mFormattedNameLabel->setText( mAddressee.formattedName() ); 1019 mFormattedNameLabel->setText( mAddressee.formattedName() );
1000 1020
1001 mAConfig->setUid( mAddressee.uid() ); 1021 mAConfig->setUid( mAddressee.uid() );
1002 if ( mAConfig->automaticNameParsing() ) { 1022 if ( mAConfig->automaticNameParsing() ) {
1003 mNameLabel->hide(); 1023 mNameLabel->hide();
1004 mNameEdit->show(); 1024 mNameEdit->show();
1005 } else { 1025 } else {
1006 mNameEdit->hide(); 1026 mNameEdit->hide();
1007 mNameLabel->setText( mNameEdit->text() ); 1027 mNameLabel->setText( mNameEdit->text() );
1008 mNameLabel->show(); 1028 mNameLabel->show();
1009 } 1029 }
1010 1030
1011 mRoleEdit->setText( mAddressee.role() ); 1031 mRoleEdit->setText( mAddressee.role() );
1012 mOrgEdit->setText( mAddressee.organization() ); 1032 mOrgEdit->setText( mAddressee.organization() );
1013 1033
1014//US mURLEdit->setURL( mAddressee.url().url() ); 1034//US mURLEdit->setURL( mAddressee.url().url() );
1015 mURLEdit->setText( mAddressee.url().prettyURL() ); 1035 mURLEdit->setText( mAddressee.url().prettyURL() );
1016//US?? mURLEdit->home( false ); 1036//US?? mURLEdit->home( false );
1017 1037
1018 // mNoteEdit->setText( mAddressee.note() ); 1038 // mNoteEdit->setText( mAddressee.note() );
1019 mNoteEdit->setText( mAddressee.note() ); 1039 mNoteEdit->setText( mAddressee.note() );
1020 mEmailWidget->setEmails( mAddressee.emails() ); 1040 mEmailWidget->setEmails( mAddressee.emails() );
1021 mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() ); 1041 mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() );
1022 mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() ); 1042 mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() );
1023 mBirthdayPicker->setDate( mAddressee.birthday().date() ); 1043 mBirthdayPicker->setDate( mAddressee.birthday().date() );
1024 1044
1025//US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom( 1045//US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom(
1026//US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) ); 1046//US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) );
1027 QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), 1047 QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
1028 "%Y-%m-%d"); // = Qt::ISODate 1048 "%Y-%m-%d"); // = Qt::ISODate
1029 mAnniversaryPicker->setDate( dt ); 1049 mAnniversaryPicker->setDate( dt );
1030 1050
1031 1051
1032 mNicknameEdit->setText( mAddressee.nickName() ); 1052 mNicknameEdit->setText( mAddressee.nickName() );
1033 mCategoryEdit->setText( mAddressee.categories().join( "," ) ); 1053 mCategoryEdit->setText( mAddressee.categories().join( "," ) );
1034 1054
1035 mGeoWidget->setGeo( mAddressee.geo() ); 1055 mGeoWidget->setGeo( mAddressee.geo() );
1036 mImageWidget->setPhoto( mAddressee.photo() ); 1056 mImageWidget->setPhoto( mAddressee.photo() );
1037 mImageWidget->setLogo( mAddressee.logo() ); 1057 mImageWidget->setLogo( mAddressee.logo() );
1038 mKeyWidget->setKeys( mAddressee.keys() ); 1058 mKeyWidget->setKeys( mAddressee.keys() );
1039 mSecrecyWidget->setSecrecy( mAddressee.secrecy() ); 1059 mSecrecyWidget->setSecrecy( mAddressee.secrecy() );
1040#ifndef KAB_EMBEDDED 1060#ifndef KAB_EMBEDDED
1041 mSoundWidget->setSound( mAddressee.sound() ); 1061 mSoundWidget->setSound( mAddressee.sound() );
1042#else //KAB_EMBEDDED 1062#else //KAB_EMBEDDED
1043//US qDebug("AddresseeEditorWidget::load has to be changed 2"); 1063//US qDebug("AddresseeEditorWidget::load has to be changed 2");
1044#endif //KAB_EMBEDDED 1064#endif //KAB_EMBEDDED
1045 1065
1046 // Load customs 1066 // Load customs
1047 mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) ); 1067 mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) );
1048 mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) ); 1068 mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) );
1049 mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) ); 1069 mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) );
1050 mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) ); 1070 mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) );
1051 mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) ); 1071 mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) );
1052 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) ); 1072 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) );
1053 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) ); 1073 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) );
1054 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) ); 1074 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) );
1055 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); 1075 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
1056 if ( gen == "female" ) 1076 if ( gen == "female" )
1057 mGenderBox->setCurrentItem ( 1 ); 1077 mGenderBox->setCurrentItem ( 1 );
1058 else if ( gen == "male" ) 1078 else if ( gen == "male" )
1059 mGenderBox->setCurrentItem ( 2 ); 1079 mGenderBox->setCurrentItem ( 2 );
1060 else 1080 else
1061 mGenderBox->setCurrentItem ( 0 ); 1081 mGenderBox->setCurrentItem ( 0 );
1062 blockSignals( block ); 1082 blockSignals( block );
1063 mBlockSignals = false; 1083 mBlockSignals = false;
1064 1084
1065 mDirty = false; 1085 mDirty = false;
1066} 1086}
1067 1087
1068void AddresseeEditorWidget::save() 1088void AddresseeEditorWidget::save()
1069{ 1089{
1070 if ( !dirty() ) { 1090 if ( !dirty() ) {
1071 return; 1091 return;
1072 } 1092 }
1073 1093
1074 mAddressee.setRevision( QDateTime::currentDateTime() ); 1094 mAddressee.setRevision( QDateTime::currentDateTime() );
1075 1095
1076 mAddressee.setRole( mRoleEdit->text() ); 1096 mAddressee.setRole( mRoleEdit->text() );
1077 mAddressee.setOrganization( mOrgEdit->text() ); 1097 mAddressee.setOrganization( mOrgEdit->text() );
1078 mAddressee.setUrl( KURL( mURLEdit->text() ) ); 1098 mAddressee.setUrl( KURL( mURLEdit->text() ) );
1079 mAddressee.setNote( mNoteEdit->text() ); 1099 mAddressee.setNote( mNoteEdit->text() );
1080 if ( mBirthdayPicker->inputIsValid() ) { 1100 if ( mBirthdayPicker->inputIsValid() ) {
1081 QDate da = mBirthdayPicker->date(); 1101 QDate da = mBirthdayPicker->date();
1082 mAddressee.setBirthday( QDateTime( da ) ); 1102 mAddressee.setBirthday( QDateTime( da ) );
1083 //qDebug("bday %s ",da.toString().latin1()); 1103 //qDebug("bday %s ",da.toString().latin1());
1084 } 1104 }
1085 else { 1105 else {
1086 mAddressee.setBirthday( QDateTime() ); 1106 mAddressee.setBirthday( QDateTime() );
1087 mBirthdayPicker->clear(); 1107 mBirthdayPicker->clear();
1088 } 1108 }
1089 mAddressee.setNickName( mNicknameEdit->text() ); 1109 mAddressee.setNickName( mNicknameEdit->text() );
1090 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); 1110 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) );
1091 1111
1092 mAddressee.setGeo( mGeoWidget->geo() ); 1112 mAddressee.setGeo( mGeoWidget->geo() );
1093 mAddressee.setPhoto( mImageWidget->photo() ); 1113 mAddressee.setPhoto( mImageWidget->photo() );
1094 mAddressee.setLogo( mImageWidget->logo() ); 1114 mAddressee.setLogo( mImageWidget->logo() );
1095 mAddressee.setKeys( mKeyWidget->keys() ); 1115 mAddressee.setKeys( mKeyWidget->keys() );
1096#ifndef KAB_EMBEDDED 1116#ifndef KAB_EMBEDDED
1097 mAddressee.setSound( mSoundWidget->sound() ); 1117 mAddressee.setSound( mSoundWidget->sound() );
1098#else //KAB_EMBEDDED 1118#else //KAB_EMBEDDED
1099//US qDebug("AddresseeEditorWidget::save sound not supported"); 1119//US qDebug("AddresseeEditorWidget::save sound not supported");
1100#endif //KAB_EMBEDDED 1120#endif //KAB_EMBEDDED
1101 mAddressee.setSecrecy( mSecrecyWidget->secrecy() ); 1121 mAddressee.setSecrecy( mSecrecyWidget->secrecy() );
1102 1122
1103 // save custom fields 1123 // save custom fields
1104 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); 1124 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() );
1105 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); 1125 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() );
1106 mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() ); 1126 mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() );
1107 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); 1127 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() );
1108 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); 1128 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() );
1109 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); 1129 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() );
1110 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); 1130 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() );
1111 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); 1131 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() );
1112 if ( mAnniversaryPicker->inputIsValid() ) { 1132 if ( mAnniversaryPicker->inputIsValid() ) {
1113 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); 1133 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate);
1114 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); 1134 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
1115 } 1135 }
1116 else { 1136 else {
1117 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); 1137 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" );
1118 mAnniversaryPicker->clear(); 1138 mAnniversaryPicker->clear();
1119 } 1139 }
1120 int gen = mGenderBox->currentItem (); 1140 int gen = mGenderBox->currentItem ();
1121 if ( gen == 1 ) 1141 if ( gen == 1 )
1122 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); 1142 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female");
1123 else if ( gen == 2 ) 1143 else if ( gen == 2 )
1124 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); 1144 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male");
1125 else 1145 else
1126 mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" ); 1146 mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" );
1127 1147
1128 // Save the email addresses 1148 // Save the email addresses
1129 QStringList emails = mAddressee.emails(); 1149 QStringList emails = mAddressee.emails();
1130 QStringList::Iterator iter; 1150 QStringList::Iterator iter;
1131 for ( iter = emails.begin(); iter != emails.end(); ++iter ) 1151 for ( iter = emails.begin(); iter != emails.end(); ++iter )
1132 mAddressee.removeEmail( *iter ); 1152 mAddressee.removeEmail( *iter );
1133 1153
1134 emails = mEmailWidget->emails(); 1154 emails = mEmailWidget->emails();
1135 bool first = true; 1155 bool first = true;
1136 for ( iter = emails.begin(); iter != emails.end(); ++iter ) { 1156 for ( iter = emails.begin(); iter != emails.end(); ++iter ) {
1137 mAddressee.insertEmail( *iter, first ); 1157 mAddressee.insertEmail( *iter, first );
1138 first = false; 1158 first = false;
1139 } 1159 }
1140 1160
1141 // Save the phone numbers 1161 // Save the phone numbers
1142 KABC::PhoneNumber::List phoneNumbers; 1162 KABC::PhoneNumber::List phoneNumbers;
1143 KABC::PhoneNumber::List::Iterator phoneIter; 1163 KABC::PhoneNumber::List::Iterator phoneIter;
1144 phoneNumbers = mAddressee.phoneNumbers(); 1164 phoneNumbers = mAddressee.phoneNumbers();
1145 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); 1165 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end();
1146 ++phoneIter ) 1166 ++phoneIter )
1147 mAddressee.removePhoneNumber( *phoneIter ); 1167 mAddressee.removePhoneNumber( *phoneIter );
1148 1168
1149 phoneNumbers = mPhoneEditWidget->phoneNumbers(); 1169 phoneNumbers = mPhoneEditWidget->phoneNumbers();
1150 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); 1170 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end();
1151 ++phoneIter ) 1171 ++phoneIter )
1152 mAddressee.insertPhoneNumber( *phoneIter ); 1172 mAddressee.insertPhoneNumber( *phoneIter );
1153 1173
1154 // Save the addresses 1174 // Save the addresses
1155 KABC::Address::List addresses; 1175 KABC::Address::List addresses;
1156 KABC::Address::List::Iterator addressIter; 1176 KABC::Address::List::Iterator addressIter;
1157 addresses = mAddressee.addresses(); 1177 addresses = mAddressee.addresses();
1158 for ( addressIter = addresses.begin(); addressIter != addresses.end(); 1178 for ( addressIter = addresses.begin(); addressIter != addresses.end();
1159 ++addressIter ) 1179 ++addressIter )
1160 mAddressee.removeAddress( *addressIter ); 1180 mAddressee.removeAddress( *addressIter );
1161 1181
1162 addresses = mAddressEditWidget->addresses(); 1182 addresses = mAddressEditWidget->addresses();
1163 for ( addressIter = addresses.begin(); addressIter != addresses.end(); 1183 for ( addressIter = addresses.begin(); addressIter != addresses.end();
1164 ++addressIter ) 1184 ++addressIter )
1165 mAddressee.insertAddress( *addressIter ); 1185 mAddressee.insertAddress( *addressIter );
1166 mDirty = false; 1186 mDirty = false;
1167} 1187}
1168 1188
1169bool AddresseeEditorWidget::dirty() 1189bool AddresseeEditorWidget::dirty()
1170{ 1190{
1171 1191
1172 if ( ! mDirty ) { 1192 if ( ! mDirty ) {
1173 if ( mBirthdayPicker->inputIsValid() ) { 1193 if ( mBirthdayPicker->inputIsValid() ) {
1174 QDate da = mBirthdayPicker->date(); 1194 QDate da = mBirthdayPicker->date();
1175 if ( !(da == mAddressee.birthday().date())) 1195 if ( !(da == mAddressee.birthday().date()))
1176 mDirty = true; 1196 mDirty = true;
1177 } 1197 }
1178 else { 1198 else {
1179 mBirthdayPicker->clear(); 1199 mBirthdayPicker->clear();
1180 } 1200 }
1181 if ( mAnniversaryPicker->inputIsValid() ) { 1201 if ( mAnniversaryPicker->inputIsValid() ) {
1182 QDate da = mAnniversaryPicker->date(); 1202 QDate da = mAnniversaryPicker->date();
1183 if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), 1203 if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
1184 "%Y-%m-%d")) 1204 "%Y-%m-%d"))
1185 mDirty = true; 1205 mDirty = true;
1186 } 1206 }
1187 else { 1207 else {
1188 mAnniversaryPicker->clear(); 1208 mAnniversaryPicker->clear();
1189 } 1209 }
1190 } 1210 }
1191 return mDirty; 1211 return mDirty;
1192} 1212}
1193 1213
1194void AddresseeEditorWidget::nameTextChanged( const QString &text ) 1214void AddresseeEditorWidget::nameTextChanged( const QString &text )
1195{ 1215{
1196 if ( mBlockSignals ) 1216 if ( mBlockSignals )
1197 return; 1217 return;
1198 // use the addressee class to parse the name for us 1218 // use the addressee class to parse the name for us
1199 mAConfig->setUid( mAddressee.uid() ); 1219 mAConfig->setUid( mAddressee.uid() );
1200 if ( mAConfig->automaticNameParsing() ) { 1220 if ( mAConfig->automaticNameParsing() ) {
1201 if ( !mAddressee.formattedName().isEmpty() ) { 1221 if ( !mAddressee.formattedName().isEmpty() ) {
1202 QString fn = mAddressee.formattedName(); 1222 QString fn = mAddressee.formattedName();
1203 mAddressee.setNameFromString( text ); 1223 mAddressee.setNameFromString( text );
1204 mAddressee.setFormattedName( fn ); 1224 mAddressee.setFormattedName( fn );
1205 } else { 1225 } else {
1206 // use extra addressee to avoid a formatted name assignment 1226 // use extra addressee to avoid a formatted name assignment
1207 Addressee addr; 1227 Addressee addr;
1208 addr.setNameFromString( text ); 1228 addr.setNameFromString( text );
1209 mAddressee.setPrefix( addr.prefix() ); 1229 mAddressee.setPrefix( addr.prefix() );
1210 mAddressee.setGivenName( addr.givenName() ); 1230 mAddressee.setGivenName( addr.givenName() );
1211 mAddressee.setAdditionalName( addr.additionalName() ); 1231 mAddressee.setAdditionalName( addr.additionalName() );
1212 mAddressee.setFamilyName( addr.familyName() ); 1232 mAddressee.setFamilyName( addr.familyName() );
1213 mAddressee.setSuffix( addr.suffix() ); 1233 mAddressee.setSuffix( addr.suffix() );
1214 } 1234 }
1215 } 1235 }
1216 nameBoxChanged(); 1236 nameBoxChanged();
1217 1237
1218 1238
1219 emitModified(); 1239 emitModified();
1220} 1240}
1221 1241
1222void AddresseeEditorWidget::nameBoxChanged() 1242void AddresseeEditorWidget::nameBoxChanged()
1223{ 1243{
1224 KABC::Addressee addr; 1244 KABC::Addressee addr;
1225 mAConfig->setUid( mAddressee.uid() ); 1245 mAConfig->setUid( mAddressee.uid() );
1226 if ( mAConfig->automaticNameParsing() ) { 1246 if ( mAConfig->automaticNameParsing() ) {
1227 addr.setNameFromString( mNameEdit->text() ); 1247 addr.setNameFromString( mNameEdit->text() );
1228 mNameLabel->hide(); 1248 mNameLabel->hide();
1229 mNameEdit->show(); 1249 mNameEdit->show();
1230 } else { 1250 } else {
1231 addr = mAddressee; 1251 addr = mAddressee;
1232 mNameEdit->hide(); 1252 mNameEdit->hide();
1233 mNameLabel->setText( mNameEdit->text() ); 1253 mNameLabel->setText( mNameEdit->text() );
1234 mNameLabel->show(); 1254 mNameLabel->show();
1235 } 1255 }
1236 1256
1237 if ( mFormattedNameType != NameEditDialog::CustomName ) { 1257 if ( mFormattedNameType != NameEditDialog::CustomName ) {
1238 mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 1258 mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
1239 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 1259 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
1240 } 1260 }
1241} 1261}
1242 1262
1243void AddresseeEditorWidget::nameButtonClicked() 1263void AddresseeEditorWidget::nameButtonClicked()
1244{ 1264{
1245 // show the name dialog. 1265 // show the name dialog.
1246 NameEditDialog dialog( mAddressee, mFormattedNameType, this ); 1266 NameEditDialog dialog( mAddressee, mFormattedNameType, this );
1247 1267
1248 if ( KApplication::execDialog( &dialog) ) { 1268 if ( KApplication::execDialog( &dialog) ) {
1249 if ( dialog.changed() ) { 1269 if ( dialog.changed() ) {
1250 mAddressee.setFamilyName( dialog.familyName() ); 1270 mAddressee.setFamilyName( dialog.familyName() );
1251 mAddressee.setGivenName( dialog.givenName() ); 1271 mAddressee.setGivenName( dialog.givenName() );
1252 mAddressee.setPrefix( dialog.prefix() ); 1272 mAddressee.setPrefix( dialog.prefix() );
1253 mAddressee.setSuffix( dialog.suffix() ); 1273 mAddressee.setSuffix( dialog.suffix() );
1254 mAddressee.setAdditionalName( dialog.additionalName() ); 1274 mAddressee.setAdditionalName( dialog.additionalName() );
1255 mFormattedNameType = dialog.formattedNameType(); 1275 mFormattedNameType = dialog.formattedNameType();
1256 if ( mFormattedNameType == NameEditDialog::CustomName ) { 1276 if ( mFormattedNameType == NameEditDialog::CustomName ) {
1257 mFormattedNameLabel->setText( dialog.customFormattedName() ); 1277 mFormattedNameLabel->setText( dialog.customFormattedName() );
1258 mAddressee.setFormattedName( dialog.customFormattedName() ); 1278 mAddressee.setFormattedName( dialog.customFormattedName() );
1259 } 1279 }
1260 // Update the name edit. 1280 // Update the name edit.
1261 bool block = mNameEdit->signalsBlocked(); 1281 bool block = mNameEdit->signalsBlocked();
1262 mNameEdit->blockSignals( true ); 1282 mNameEdit->blockSignals( true );
1263 mNameEdit->setText( mAddressee.assembledName() ); 1283 mNameEdit->setText( mAddressee.assembledName() );
1264 mNameEdit->blockSignals( block ); 1284 mNameEdit->blockSignals( block );
1265 1285
1266 // Update the combo box. 1286 // Update the combo box.
1267 nameBoxChanged(); 1287 nameBoxChanged();
1268 1288
1269 emitModified(); 1289 emitModified();
1270 } 1290 }
1271 } 1291 }
1272} 1292}
1273 1293
1274void AddresseeEditorWidget::categoryButtonClicked() 1294void AddresseeEditorWidget::categoryButtonClicked()
1275{ 1295{
1276 // Show the category dialog 1296 // Show the category dialog
1277 if ( mCategoryDialog == 0 ) { 1297 if ( mCategoryDialog == 0 ) {
1278 mCategoryDialog = new KPIM::CategorySelectDialog( KABPrefs::instance(), this ); 1298 mCategoryDialog = new KPIM::CategorySelectDialog( KABPrefs::instance(), this );
1279 connect( mCategoryDialog, SIGNAL( categoriesSelected( const QStringList& ) ), 1299 connect( mCategoryDialog, SIGNAL( categoriesSelected( const QStringList& ) ),
1280 SLOT(categoriesSelected( const QStringList& ) ) ); 1300 SLOT(categoriesSelected( const QStringList& ) ) );
1281 connect( mCategoryDialog, SIGNAL( editCategories() ), SLOT( editCategories() ) ); 1301 connect( mCategoryDialog, SIGNAL( editCategories() ), SLOT( editCategories() ) );
1282 } 1302 }
1283 1303
1284 mCategoryDialog->setCategories(); 1304 mCategoryDialog->setCategories();
1285 mCategoryDialog->setSelected( QStringList::split( ",", mCategoryEdit->text() ) ); 1305 mCategoryDialog->setSelected( QStringList::split( ",", mCategoryEdit->text() ) );
1286 mCategoryDialog->show(); 1306 mCategoryDialog->show();
1287 mCategoryDialog->raise(); 1307 mCategoryDialog->raise();
1288} 1308}
1289 1309
1290void AddresseeEditorWidget::categoriesSelected( const QStringList &list ) 1310void AddresseeEditorWidget::categoriesSelected( const QStringList &list )
1291{ 1311{
1292 mCategoryEdit->setText( list.join( "," ) ); 1312 mCategoryEdit->setText( list.join( "," ) );
1293} 1313}
1294 1314
1295void AddresseeEditorWidget::editCategories() 1315void AddresseeEditorWidget::editCategories()
1296{ 1316{
1297 if ( mCategoryEditDialog == 0 ) { 1317 if ( mCategoryEditDialog == 0 ) {
1298 mCategoryEditDialog = new KPIM::CategoryEditDialog( KABPrefs::instance(), this ); 1318 mCategoryEditDialog = new KPIM::CategoryEditDialog( KABPrefs::instance(), this );
1299 connect( mCategoryEditDialog, SIGNAL( categoryConfigChanged() ), 1319 connect( mCategoryEditDialog, SIGNAL( categoryConfigChanged() ),
1300 SLOT( categoryButtonClicked() ) ); 1320 SLOT( categoryButtonClicked() ) );
1301 } 1321 }
1302 1322
1303 mCategoryEditDialog->show(); 1323 mCategoryEditDialog->show();
1304 mCategoryEditDialog->raise(); 1324 mCategoryEditDialog->raise();
1305} 1325}
1306 1326
1307void AddresseeEditorWidget::emitModified() 1327void AddresseeEditorWidget::emitModified()
1308{ 1328{
1309 mDirty = true; 1329 mDirty = true;
1310 1330
1311 KABC::Addressee::List list; 1331 KABC::Addressee::List list;
1312 1332
1313 if ( mIsExtension && !mBlockSignals ) { 1333 if ( mIsExtension && !mBlockSignals ) {
1314 save(); 1334 save();
1315 list.append( mAddressee ); 1335 list.append( mAddressee );
1316 } 1336 }
1317 1337
1318 emit modified( list ); 1338 emit modified( list );
1319} 1339}
1320 1340
1321void AddresseeEditorWidget::dateChanged( QDate ) 1341void AddresseeEditorWidget::dateChanged( QDate )
1322{ 1342{
1323 emitModified(); 1343 emitModified();
1324} 1344}
1325 1345
1326//US invalid dates are handdled by the KDateEdit widget itself 1346//US invalid dates are handdled by the KDateEdit widget itself
1327void AddresseeEditorWidget::invalidDate() 1347void AddresseeEditorWidget::invalidDate()
1328{ 1348{
1329 KMessageBox::sorry( this, i18n( "You must specify a valid date" ) ); 1349 KMessageBox::sorry( this, i18n( "You must specify a valid date" ) );
1330} 1350}
1331 1351
1332 1352
1333void AddresseeEditorWidget::pageChanged( QWidget *wdg ) 1353void AddresseeEditorWidget::pageChanged( QWidget *wdg )
1334{ 1354{
1335#ifndef KAB_EMBEDDED 1355#ifndef KAB_EMBEDDED
1336 if ( wdg ) 1356 if ( wdg )
1337 KAcceleratorManager::manage( wdg ); 1357 KAcceleratorManager::manage( wdg );
1338#else //KAB_EMBEDDED 1358#else //KAB_EMBEDDED
1339//US 1359//US
1340#endif //KAB_EMBEDDED 1360#endif //KAB_EMBEDDED
1341 1361
1342} 1362}
1343 1363
1344QString AddresseeEditorWidget::title() const 1364QString AddresseeEditorWidget::title() const
1345{ 1365{
1346 return i18n( "Contact Editor" ); 1366 return i18n( "Contact Editor" );
1347} 1367}
1348 1368
1349QString AddresseeEditorWidget::identifier() const 1369QString AddresseeEditorWidget::identifier() const
1350{ 1370{
1351 return i18n( "contact_editor" ); 1371 return i18n( "contact_editor" );
1352} 1372}
1353 1373
1354#ifndef KAB_EMBEDDED 1374#ifndef KAB_EMBEDDED
1355#include "addresseeeditorwidget.moc" 1375#include "addresseeeditorwidget.moc"
1356#endif //KAB_EMBEDDED 1376#endif //KAB_EMBEDDED
diff --git a/kaddressbook/addresseeeditorwidget.h b/kaddressbook/addresseeeditorwidget.h
index 995f30e..eaf5b16 100644
--- a/kaddressbook/addresseeeditorwidget.h
+++ b/kaddressbook/addresseeeditorwidget.h
@@ -1,186 +1,188 @@
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#ifndef ADDRESSEEEDITORWIDGET_H 24#ifndef ADDRESSEEEDITORWIDGET_H
25#define ADDRESSEEEDITORWIDGET_H 25#define ADDRESSEEEDITORWIDGET_H
26 26
27#include <qdatetime.h> 27#include <qdatetime.h>
28 28
29#include <kabc/addressee.h> 29#include <kabc/addressee.h>
30#include <kdialogbase.h> 30#include <kdialogbase.h>
31#include <kjanuswidget.h> 31#include <kjanuswidget.h>
32 32
33#include "extensionwidget.h" 33#include "extensionwidget.h"
34 34
35class AddresseeConfig; 35class AddresseeConfig;
36class QCheckBox; 36class QCheckBox;
37class QSpinBox; 37class QSpinBox;
38class QTabWidget; 38class QTabWidget;
39 39
40#ifndef KAB_EMBEDDED 40#ifndef KAB_EMBEDDED
41class QTextEdit; 41class QTextEdit;
42#else //KAB_EMBEDDED 42#else //KAB_EMBEDDED
43class QMultiLineEdit; 43class QMultiLineEdit;
44#endif //KAB_EMBEDDED 44#endif //KAB_EMBEDDED
45 45
46class KComboBox; 46class KComboBox;
47class KDateEdit; 47class KDateEdit;
48class KLineEdit; 48class KLineEdit;
49class KSqueezedTextLabel; 49class KSqueezedTextLabel;
50 50
51class AddressEditWidget; 51class AddressEditWidget;
52class EmailEditWidget; 52class EmailEditWidget;
53class GeoWidget; 53class GeoWidget;
54class ImageWidget; 54class ImageWidget;
55class KABCore; 55class KABCore;
56class KeyWidget; 56class KeyWidget;
57class PhoneEditWidget; 57class PhoneEditWidget;
58class SecrecyWidget; 58class SecrecyWidget;
59class SoundWidget; 59class SoundWidget;
60 60
61namespace KPIM 61namespace KPIM
62{ 62{
63 class CategorySelectDialog; 63 class CategorySelectDialog;
64 class CategoryEditDialog; 64 class CategoryEditDialog;
65} 65}
66 66
67namespace KABC { class AddressBook; } 67namespace KABC { class AddressBook; }
68 68
69class AddresseeEditorWidget : public ExtensionWidget 69class AddresseeEditorWidget : public ExtensionWidget
70{ 70{
71 Q_OBJECT 71 Q_OBJECT
72 72
73 public: 73 public:
74 AddresseeEditorWidget( KABCore *core, bool isExtension, 74 AddresseeEditorWidget( KABCore *core, bool isExtension,
75 QWidget *parent, const char *name = 0 ); 75 QWidget *parent, const char *name = 0 );
76 ~AddresseeEditorWidget(); 76 ~AddresseeEditorWidget();
77 77
78 void setAddressee( const KABC::Addressee& ); 78 void setAddressee( const KABC::Addressee& );
79 const KABC::Addressee &addressee(); 79 const KABC::Addressee &addressee();
80 80
81 void contactsSelectionChanged(); 81 void contactsSelectionChanged();
82 82
83 void load(); 83 void load();
84 void save(); 84 void save();
85 85
86 bool dirty(); 86 bool dirty();
87 87
88 QString title() const; 88 QString title() const;
89 QString identifier() const; 89 QString identifier() const;
90 90
91 protected slots: 91 protected slots:
92 void setRole2FN();
93 void setCompany2FN();
92 void textChanged( const QString& ); 94 void textChanged( const QString& );
93 void pageChanged( QWidget *wdg ); 95 void pageChanged( QWidget *wdg );
94 96
95 /** 97 /**
96 Emits the modified signal and sets the dirty flag. Any slot 98 Emits the modified signal and sets the dirty flag. Any slot
97 that modifies data should use this method instead of calling emit 99 that modifies data should use this method instead of calling emit
98 modified() directly. 100 modified() directly.
99 */ 101 */
100 void emitModified(); 102 void emitModified();
101 103
102 void dateChanged( QDate ); 104 void dateChanged( QDate );
103 void invalidDate(); 105 void invalidDate();
104 void nameTextChanged( const QString& ); 106 void nameTextChanged( const QString& );
105 void nameBoxChanged(); 107 void nameBoxChanged();
106 void nameButtonClicked(); 108 void nameButtonClicked();
107 void categoryButtonClicked(); 109 void categoryButtonClicked();
108 110
109 /** 111 /**
110 Called whenever the categories change in the categories dialog. 112 Called whenever the categories change in the categories dialog.
111 */ 113 */
112 void categoriesSelected( const QStringList& ); 114 void categoriesSelected( const QStringList& );
113 115
114 /** 116 /**
115 Edits which categories are available in the CategorySelectDialog. 117 Edits which categories are available in the CategorySelectDialog.
116 */ 118 */
117 void editCategories(); 119 void editCategories();
118 120
119 private: 121 private:
120 AddresseeConfig * mAConfig; 122 AddresseeConfig * mAConfig;
121 void initGUI(); 123 void initGUI();
122 void setupTab1(); 124 void setupTab1();
123 void setupTab1_1(); 125 void setupTab1_1();
124 void setupTab2(); 126 void setupTab2();
125 void setupTab2_1(); 127 void setupTab2_1();
126 void setupTab3(); 128 void setupTab3();
127 void setupTab3_1(); 129 void setupTab3_1();
128 130
129 KABC::Addressee mAddressee; 131 KABC::Addressee mAddressee;
130 int mFormattedNameType; 132 int mFormattedNameType;
131 bool mDirty; 133 bool mDirty;
132 bool mIsExtension; 134 bool mIsExtension;
133 bool mBlockSignals; 135 bool mBlockSignals;
134 136
135 // GUI 137 // GUI
136 KPIM::CategorySelectDialog *mCategoryDialog; 138 KPIM::CategorySelectDialog *mCategoryDialog;
137 KPIM::CategoryEditDialog *mCategoryEditDialog; 139 KPIM::CategoryEditDialog *mCategoryEditDialog;
138 QTabWidget *mTabWidget; 140 QTabWidget *mTabWidget;
139 141
140 // Tab1 and Tab1_1 142 // Tab1 and Tab1_1
141 KLineEdit *mNameEdit; 143 KLineEdit *mNameEdit;
142 KLineEdit *mRoleEdit; 144 KLineEdit *mRoleEdit;
143 KLineEdit *mOrgEdit; 145 KLineEdit *mOrgEdit;
144 146
145 KSqueezedTextLabel *mFormattedNameLabel; 147 KSqueezedTextLabel *mFormattedNameLabel;
146 AddressEditWidget *mAddressEditWidget; 148 AddressEditWidget *mAddressEditWidget;
147 EmailEditWidget *mEmailWidget; 149 EmailEditWidget *mEmailWidget;
148 PhoneEditWidget *mPhoneEditWidget; 150 PhoneEditWidget *mPhoneEditWidget;
149 KLineEdit *mURLEdit; 151 KLineEdit *mURLEdit;
150 KLineEdit *mIMAddressEdit; 152 KLineEdit *mIMAddressEdit;
151 KLineEdit *mCategoryEdit; 153 KLineEdit *mCategoryEdit;
152 SecrecyWidget *mSecrecyWidget; 154 SecrecyWidget *mSecrecyWidget;
153 KSqueezedTextLabel *mNameLabel; 155 KSqueezedTextLabel *mNameLabel;
154 156
155 // Tab2 and Tab2_2 157 // Tab2 and Tab2_2
156 KLineEdit *mDepartmentEdit; 158 KLineEdit *mDepartmentEdit;
157 KLineEdit *mOfficeEdit; 159 KLineEdit *mOfficeEdit;
158 KLineEdit *mProfessionEdit; 160 KLineEdit *mProfessionEdit;
159 KLineEdit *mManagerEdit; 161 KLineEdit *mManagerEdit;
160 KLineEdit *mAssistantEdit; 162 KLineEdit *mAssistantEdit;
161 KLineEdit *mNicknameEdit; 163 KLineEdit *mNicknameEdit;
162 KLineEdit *mSpouseEdit; 164 KLineEdit *mSpouseEdit;
163 KLineEdit *mChildEdit; 165 KLineEdit *mChildEdit;
164 QComboBox *mGenderBox; 166 QComboBox *mGenderBox;
165 KDateEdit *mBirthdayPicker; 167 KDateEdit *mBirthdayPicker;
166 KDateEdit *mAnniversaryPicker; 168 KDateEdit *mAnniversaryPicker;
167#ifndef KAB_EMBEDDED 169#ifndef KAB_EMBEDDED
168 QTextEdit *mNoteEdit; 170 QTextEdit *mNoteEdit;
169#else //KAB_EMBEDDED 171#else //KAB_EMBEDDED
170 QMultiLineEdit *mNoteEdit; 172 QMultiLineEdit *mNoteEdit;
171#endif //KAB_EMBEDDED 173#endif //KAB_EMBEDDED
172 174
173 QSpinBox *mTimeZoneSpin; 175 QSpinBox *mTimeZoneSpin;
174 QSpinBox *mGeoLat; 176 QSpinBox *mGeoLat;
175 QSpinBox *mGeoLon; 177 QSpinBox *mGeoLon;
176 178
177 // Tab3 179 // Tab3
178 GeoWidget *mGeoWidget; 180 GeoWidget *mGeoWidget;
179 ImageWidget *mImageWidget; 181 ImageWidget *mImageWidget;
180#ifndef KAB_EMBEDDED 182#ifndef KAB_EMBEDDED
181 SoundWidget *mSoundWidget; 183 SoundWidget *mSoundWidget;
182#endif //KAB_EMBEDDED 184#endif //KAB_EMBEDDED
183 KeyWidget *mKeyWidget; 185 KeyWidget *mKeyWidget;
184}; 186};
185 187
186#endif 188#endif