summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp34
-rw-r--r--kaddressbook/phoneeditwidget.h79
2 files changed, 103 insertions, 10 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 310d628..9814cd5 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -1,836 +1,854 @@
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 bool horLayout = false;
158 int maxCol = 1;
159 if ( QApplication::desktop()->width() == 640 || QApplication::desktop()->width() == 320 ) {
160 horLayout = true;
161 maxCol = 3;
162 }
163 QGridLayout *layout = new QGridLayout( tab1, 8-maxCol, maxCol );
164
158 layout->setMargin( KDialogBase::marginHintSmall() ); 165 layout->setMargin( KDialogBase::marginHintSmall() );
159 layout->setSpacing( KDialogBase::spacingHintSmall() ); 166 layout->setSpacing( KDialogBase::spacingHintSmall() );
160 167
161 QLabel *label; 168 QLabel *label;
162 KSeparator* bar; 169 KSeparator* bar;
163 QPushButton *button; 170 QPushButton *button;
164 171
165 ////////////////////////////////// 172 //////////////////////////////////
166 // Upper left group (person info) 173 // Upper left group (person info)
167 174
168 // Person icon 175 // Person icon
169 /* LR 176 /* LR
170 label = new QLabel( tab1 ); 177 label = new QLabel( tab1 );
171//US ambiguous call. Add one more parameter 178//US ambiguous call. Add one more parameter
172//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 179//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
173 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 180 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
174 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 181 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
175 */ 182 */
176 // First name 183 // First name
177 button = new QPushButton( i18n( "Name..." ), tab1 ); 184 button = new QPushButton( i18n( "Name..." ), tab1 );
178//US QToolTip::add( button, i18n( "Edit the contact's name" ) ); 185//US QToolTip::add( button, i18n( "Edit the contact's name" ) );
179 mNameEdit = new KLineEdit( tab1, "mNameEdit" ); 186 mNameEdit = new KLineEdit( tab1, "mNameEdit" );
180 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), 187 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
181 SLOT( nameTextChanged( const QString& ) ) ); 188 SLOT( nameTextChanged( const QString& ) ) );
182 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); 189 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
183 190
184 mNameLabel = new KSqueezedTextLabel( tab1 ); 191 mNameLabel = new KSqueezedTextLabel( tab1 );
185 mNameLabel->hide(); 192 mNameLabel->hide();
186 193
187 layout->addWidget( button, 0, 0 ); 194 layout->addWidget( button, 0, 0 );
188 layout->addWidget( mNameEdit, 0, 1 ); 195 layout->addWidget( mNameEdit, 0, 1 );
189 layout->addWidget( mNameLabel, 0, 1 ); 196 layout->addWidget( mNameLabel, 0, 1 );
190 197
191 button = new QPushButton( i18n( "Role:" ), tab1 ); 198 button = new QPushButton( i18n( "Role:" ), tab1 );
192 connect( button, SIGNAL( clicked() ), SLOT( setRole2FN() ) ); 199 connect( button, SIGNAL( clicked() ), SLOT( setRole2FN() ) );
193 //label = new QLabel( i18n( "Role:" ), tab1 ); 200 //label = new QLabel( i18n( "Role:" ), tab1 );
194 mRoleEdit = new KLineEdit( tab1 ); 201 mRoleEdit = new KLineEdit( tab1 );
195 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), 202 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ),
196 SLOT( textChanged( const QString& ) ) ); 203 SLOT( textChanged( const QString& ) ) );
197 //label->setBuddy( mRoleEdit ); 204 //label->setBuddy( mRoleEdit );
198 layout->addWidget( button, 1, 0 ); 205 layout->addWidget( button, 1, 0 );
199 layout->addWidget( mRoleEdit, 1, 1 ); 206 layout->addWidget( mRoleEdit, 1, 1 );
200 207
201 // Organization 208 // Organization
202 button = new QPushButton( i18n( "Organization:" ), tab1 ); 209 button = new QPushButton( i18n( "Organization:" ), tab1 );
203 connect( button, SIGNAL( clicked() ), SLOT( setCompany2FN() ) ); 210 connect( button, SIGNAL( clicked() ), SLOT( setCompany2FN() ) );
204 //label = new QLabel( i18n( "Organization:" ), tab1 ); 211 //label = new QLabel( i18n( "Organization:" ), tab1 );
205 mOrgEdit = new KLineEdit( tab1 ); 212 mOrgEdit = new KLineEdit( tab1 );
206 //label->setBuddy( mOrgEdit ); 213 //label->setBuddy( mOrgEdit );
207 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), 214 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ),
208 SLOT( textChanged( const QString& ) ) ); 215 SLOT( textChanged( const QString& ) ) );
209 layout->addWidget( button, 2, 0 ); 216 if ( horLayout ) {
210 layout->addWidget( mOrgEdit, 2, 1 ); 217 layout->addWidget( button, 1, 2 );
218 layout->addWidget( mOrgEdit, 1, 3 );
219
220 } else {
221 layout->addWidget( button, 2, 0 );
222 layout->addWidget( mOrgEdit, 2, 1 );
223 }
211 224
212 // File as (formatted name) 225 // File as (formatted name)
213 label = new QLabel( i18n( "Formatted name:" ), tab1 ); 226 label = new QLabel( i18n( "Format.n.:" ), tab1 );
214 mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); 227 mFormattedNameLabel = new KSqueezedTextLabel( tab1 );
215 layout->addWidget( label, 3, 0 ); 228 if ( horLayout ) {
216 layout->addWidget( mFormattedNameLabel, 3, 1 ); 229 layout->addWidget( label, 0,2 );
230 layout->addWidget( mFormattedNameLabel, 0, 3 );
231 } else {
232 layout->addWidget( label, 3, 0 );
233 layout->addWidget( mFormattedNameLabel, 3, 1 );
234 }
217 /* LR 235 /* LR
218 // Left hand separator. This separator doesn't go all the way 236 // Left hand separator. This separator doesn't go all the way
219 // across so the dialog still flows from top to bottom 237 // across so the dialog still flows from top to bottom
220 bar = new KSeparator( KSeparator::HLine, tab1 ); 238 bar = new KSeparator( KSeparator::HLine, tab1 );
221 layout->addMultiCellWidget( bar, 4, 4, 0, 2 ); 239 layout->addMultiCellWidget( bar, 4, 4, 0, 2 );
222 */ 240 */
223 ////////////////////////////////////// 241 //////////////////////////////////////
224 242
225 /* LR 243 /* LR
226 // Phone numbers (upper right) 244 // Phone numbers (upper right)
227 label = new QLabel( tab1 ); 245 label = new QLabel( tab1 );
228//US loadIcon call is ambiguous. Add one more parameter 246//US loadIcon call is ambiguous. Add one more parameter
229//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); 247//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) );
230 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); 248 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
231//US layout->addMultiCellWidget( label, 0, 1, 3, 3 ); 249//US layout->addMultiCellWidget( label, 0, 1, 3, 3 );
232 layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 250 layout->addMultiCellWidget( label, 5, 6, 0, 0 );
233 */ 251 */
234 mPhoneEditWidget = new PhoneEditWidget( tab1 ); 252 mPhoneEditWidget = new PhoneEditWidget( tab1 );
235 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 253 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
236//US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); 254//US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 );
237 int iii; 255 int iii;
238#ifndef DESKTOP_VERSION 256#ifndef DESKTOP_VERSION
239 iii = 7; 257 iii = 7;
240#else 258#else
241 iii = 8; 259 iii = 8;
242#endif 260#endif
243 layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, 1 ); 261 layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, maxCol );
244 ++iii; 262 ++iii;
245 /* LR 263 /* LR
246 bar = new KSeparator( KSeparator::HLine, tab1 ); 264 bar = new KSeparator( KSeparator::HLine, tab1 );
247//US layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); 265//US layout->addMultiCellWidget( bar, 4, 4, 3, 6 );
248 layout->addMultiCellWidget( bar, 9, 9, 0, 2 ); 266 layout->addMultiCellWidget( bar, 9, 9, 0, 2 );
249 */ 267 */
250/*US 268/*US
251 ////////////////////////////////////// 269 //////////////////////////////////////
252 // Addresses (lower left) 270 // Addresses (lower left)
253 label = new QLabel( tab1 ); 271 label = new QLabel( tab1 );
254//US loadIcon call is ambiguous. Add one more parameter 272//US loadIcon call is ambiguous. Add one more parameter
255//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) ); 273//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) );
256 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); 274 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) );
257 layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 275 layout->addMultiCellWidget( label, 5, 6, 0, 0 );
258 276
259 mAddressEditWidget = new AddressEditWidget( tab1 ); 277 mAddressEditWidget = new AddressEditWidget( tab1 );
260 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 278 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
261 layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 ); 279 layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 );
262 280
263 ////////////////////////////////////// 281 //////////////////////////////////////
264 // Email / Web (lower right) 282 // Email / Web (lower right)
265 label = new QLabel( tab1 ); 283 label = new QLabel( tab1 );
266//US loadIcon call is ambiguous. Add one more parameter 284//US loadIcon call is ambiguous. Add one more parameter
267//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) ); 285//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) );
268 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) ); 286 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) );
269 layout->addMultiCellWidget( label, 5, 6, 3, 3 ); 287 layout->addMultiCellWidget( label, 5, 6, 3, 3 );
270 288
271 mEmailWidget = new EmailEditWidget( tab1 ); 289 mEmailWidget = new EmailEditWidget( tab1 );
272 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 290 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
273 layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 ); 291 layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 );
274 292
275 // add the separator 293 // add the separator
276 bar = new KSeparator( KSeparator::HLine, tab1 ); 294 bar = new KSeparator( KSeparator::HLine, tab1 );
277 layout->addMultiCellWidget( bar, 7, 7, 3, 6 ); 295 layout->addMultiCellWidget( bar, 7, 7, 3, 6 );
278 296
279 label = new QLabel( tab1 ); 297 label = new QLabel( tab1 );
280//US loadIcon call is ambiguous. Add one more parameter 298//US loadIcon call is ambiguous. Add one more parameter
281//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) ); 299//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) );
282 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) ); 300 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) );
283 layout->addMultiCellWidget( label, 8, 9, 3, 3 ); 301 layout->addMultiCellWidget( label, 8, 9, 3, 3 );
284 302
285 label = new QLabel( i18n( "URL:" ), tab1 ); 303 label = new QLabel( i18n( "URL:" ), tab1 );
286 mURLEdit = new KLineEdit( tab1 ); 304 mURLEdit = new KLineEdit( tab1 );
287 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ), 305 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ),
288 SLOT( textChanged( const QString& ) ) ); 306 SLOT( textChanged( const QString& ) ) );
289 label->setBuddy( mURLEdit ); 307 label->setBuddy( mURLEdit );
290 layout->addWidget( label, 8, 4 ); 308 layout->addWidget( label, 8, 4 );
291 layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 ); 309 layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 );
292 310
293 label = new QLabel( i18n( "&IM address:" ), tab1 ); 311 label = new QLabel( i18n( "&IM address:" ), tab1 );
294 mIMAddressEdit = new KLineEdit( tab1 ); 312 mIMAddressEdit = new KLineEdit( tab1 );
295 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ), 313 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ),
296 SLOT( textChanged( const QString& ) ) ); 314 SLOT( textChanged( const QString& ) ) );
297 label->setBuddy( mIMAddressEdit ); 315 label->setBuddy( mIMAddressEdit );
298 layout->addWidget( label, 9, 4 ); 316 layout->addWidget( label, 9, 4 );
299 layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 ); 317 layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 );
300 318
301 layout->addColSpacing( 6, 50 ); 319 layout->addColSpacing( 6, 50 );
302 320
303 bar = new KSeparator( KSeparator::HLine, tab1 ); 321 bar = new KSeparator( KSeparator::HLine, tab1 );
304 layout->addMultiCellWidget( bar, 10, 10, 0, 6 ); 322 layout->addMultiCellWidget( bar, 10, 10, 0, 6 );
305*/ 323*/
306 /////////////////////////////////////// 324 ///////////////////////////////////////
307 QHBox *categoryBox = new QHBox( tab1 ,"cato"); 325 QHBox *categoryBox = new QHBox( tab1 ,"cato");
308 categoryBox->setSpacing( KDialogBase::spacingHint() ); 326 categoryBox->setSpacing( KDialogBase::spacingHint() );
309 categoryBox->setMargin( KDialogBase::marginHintSmall() ); 327 categoryBox->setMargin( KDialogBase::marginHintSmall() );
310 328
311 // Categories 329 // Categories
312 button = new QPushButton( i18n( "Categories" ), categoryBox ); 330 button = new QPushButton( i18n( "Categories" ), categoryBox );
313 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); 331 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) );
314 332
315 mCategoryEdit = new KLineEdit( categoryBox ); 333 mCategoryEdit = new KLineEdit( categoryBox );
316 mCategoryEdit->setReadOnly( true ); 334 mCategoryEdit->setReadOnly( true );
317 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), 335 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
318 SLOT( textChanged( const QString& ) ) ); 336 SLOT( textChanged( const QString& ) ) );
319 337
320 mSecrecyWidget = new SecrecyWidget( categoryBox ); 338 mSecrecyWidget = new SecrecyWidget( categoryBox );
321 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 339 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
322 340
323//US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); 341//US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 );
324 layout->addMultiCellWidget( categoryBox, iii, iii, 0, 1 ); 342 layout->addMultiCellWidget( categoryBox, iii, iii, 0, maxCol );
325 343
326 // Build the layout and add to the tab widget 344 // Build the layout and add to the tab widget
327 layout->activate(); // required 345 layout->activate(); // required
328 346
329 mTabWidget->addTab( tab1, i18n( "&General" ) ); 347 mTabWidget->addTab( tab1, i18n( "&General" ) );
330} 348}
331 349
332void AddresseeEditorWidget::setRole2FN() 350void AddresseeEditorWidget::setRole2FN()
333{ 351{
334 if ( mRoleEdit->text().isEmpty() ) return; 352 if ( mRoleEdit->text().isEmpty() ) return;
335 mFormattedNameType = NameEditDialog::CustomName; 353 mFormattedNameType = NameEditDialog::CustomName;
336 mAddressee.setFormattedName( mRoleEdit->text() ); 354 mAddressee.setFormattedName( mRoleEdit->text() );
337 mFormattedNameLabel->setText( mRoleEdit->text() ); 355 mFormattedNameLabel->setText( mRoleEdit->text() );
338 mDirty = true; 356 mDirty = true;
339} 357}
340void AddresseeEditorWidget::setCompany2FN() 358void AddresseeEditorWidget::setCompany2FN()
341{ 359{
342 if ( mOrgEdit->text().isEmpty() ) return; 360 if ( mOrgEdit->text().isEmpty() ) return;
343 mFormattedNameType = NameEditDialog::CustomName; 361 mFormattedNameType = NameEditDialog::CustomName;
344 mAddressee.setFormattedName( mOrgEdit->text() ); 362 mAddressee.setFormattedName( mOrgEdit->text() );
345 mFormattedNameLabel->setText( mOrgEdit->text() ); 363 mFormattedNameLabel->setText( mOrgEdit->text() );
346 mDirty = true; 364 mDirty = true;
347} 365}
348 366
349void AddresseeEditorWidget::setupTab1_1() 367void AddresseeEditorWidget::setupTab1_1()
350{ 368{
351 // This is the Address tab 369 // This is the Address tab
352 QWidget *tab1_1 = new QWidget( mTabWidget ); 370 QWidget *tab1_1 = new QWidget( mTabWidget );
353 371
354//US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 ); 372//US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 );
355 QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 ); 373 QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 );
356 layout->setMargin( KDialogBase::marginHintSmall() ); 374 layout->setMargin( KDialogBase::marginHintSmall() );
357 layout->setSpacing( KDialogBase::spacingHintSmall() ); 375 layout->setSpacing( KDialogBase::spacingHintSmall() );
358 376
359 QLabel *label; 377 QLabel *label;
360 KSeparator* bar; 378 KSeparator* bar;
361 QPushButton *button; 379 QPushButton *button;
362 380
363/*US 381/*US
364 ////////////////////////////////// 382 //////////////////////////////////
365 // Upper left group (person info) 383 // Upper left group (person info)
366 384
367 // Person icon 385 // Person icon
368 label = new QLabel( tab1 ); 386 label = new QLabel( tab1 );
369//US ambiguous call. Add one more parameter 387//US ambiguous call. Add one more parameter
370//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 388//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
371 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 389 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
372 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 390 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
373 391
374 // First name 392 // First name
375 button = new QPushButton( i18n( "Name..." ), tab1 ); 393 button = new QPushButton( i18n( "Name..." ), tab1 );
376 QToolTip::add( button, i18n( "Edit the contact's name" ) ); 394 QToolTip::add( button, i18n( "Edit the contact's name" ) );
377 mNameEdit = new KLineEdit( tab1, "mNameEdit" ); 395 mNameEdit = new KLineEdit( tab1, "mNameEdit" );
378 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), 396 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
379 SLOT( nameTextChanged( const QString& ) ) ); 397 SLOT( nameTextChanged( const QString& ) ) );
380 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); 398 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
381 399
382#ifndef KAB_EMBEDDED 400#ifndef KAB_EMBEDDED
383 mNameLabel = new KSqueezedTextLabel( tab1 ); 401 mNameLabel = new KSqueezedTextLabel( tab1 );
384 mNameLabel->hide(); 402 mNameLabel->hide();
385#else //KAB_EMBEDDED 403#else //KAB_EMBEDDED
386qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 404qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
387#endif //KAB_EMBEDDED 405#endif //KAB_EMBEDDED
388 406
389 layout->addWidget( button, 0, 1 ); 407 layout->addWidget( button, 0, 1 );
390 layout->addWidget( mNameEdit, 0, 2 ); 408 layout->addWidget( mNameEdit, 0, 2 );
391 409
392#ifndef KAB_EMBEDDED 410#ifndef KAB_EMBEDDED
393 layout->addWidget( mNameLabel, 0, 2 ); 411 layout->addWidget( mNameLabel, 0, 2 );
394#else //KAB_EMBEDDED 412#else //KAB_EMBEDDED
395qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 413qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
396#endif //KAB_EMBEDDED 414#endif //KAB_EMBEDDED
397 415
398 label = new QLabel( i18n( "Role:" ), tab1 ); 416 label = new QLabel( i18n( "Role:" ), tab1 );
399 mRoleEdit = new KLineEdit( tab1 ); 417 mRoleEdit = new KLineEdit( tab1 );
400 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), 418 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ),
401 SLOT( textChanged( const QString& ) ) ); 419 SLOT( textChanged( const QString& ) ) );
402 label->setBuddy( mRoleEdit ); 420 label->setBuddy( mRoleEdit );
403 layout->addWidget( label, 1, 1 ); 421 layout->addWidget( label, 1, 1 );
404 layout->addWidget( mRoleEdit, 1, 2 ); 422 layout->addWidget( mRoleEdit, 1, 2 );
405 423
406 // Organization 424 // Organization
407 label = new QLabel( i18n( "Organization:" ), tab1 ); 425 label = new QLabel( i18n( "Organization:" ), tab1 );
408 mOrgEdit = new KLineEdit( tab1 ); 426 mOrgEdit = new KLineEdit( tab1 );
409 label->setBuddy( mOrgEdit ); 427 label->setBuddy( mOrgEdit );
410 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), 428 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ),
411 SLOT( textChanged( const QString& ) ) ); 429 SLOT( textChanged( const QString& ) ) );
412 layout->addWidget( label, 2, 1 ); 430 layout->addWidget( label, 2, 1 );
413 layout->addWidget( mOrgEdit, 2, 2 ); 431 layout->addWidget( mOrgEdit, 2, 2 );
414 432
415 // File as (formatted name) 433 // File as (formatted name)
416 label = new QLabel( i18n( "Formatted name:" ), tab1 ); 434 label = new QLabel( i18n( "Formatted name:" ), tab1 );
417#ifndef KAB_EMBEDDED 435#ifndef KAB_EMBEDDED
418 mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); 436 mFormattedNameLabel = new KSqueezedTextLabel( tab1 );
419#else //KAB_EMBEDDED 437#else //KAB_EMBEDDED
420qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 438qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
421#endif //KAB_EMBEDDED 439#endif //KAB_EMBEDDED
422 layout->addWidget( label, 3, 1 ); 440 layout->addWidget( label, 3, 1 );
423#ifndef KAB_EMBEDDED 441#ifndef KAB_EMBEDDED
424 layout->addWidget( mFormattedNameLabel, 3, 2 ); 442 layout->addWidget( mFormattedNameLabel, 3, 2 );
425#else //KAB_EMBEDDED 443#else //KAB_EMBEDDED
426qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 444qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
427#endif //KAB_EMBEDDED 445#endif //KAB_EMBEDDED
428 446
429 // Left hand separator. This separator doesn't go all the way 447 // Left hand separator. This separator doesn't go all the way
430 // across so the dialog still flows from top to bottom 448 // across so the dialog still flows from top to bottom
431 bar = new KSeparator( KSeparator::HLine, tab1 ); 449 bar = new KSeparator( KSeparator::HLine, tab1 );
432 layout->addMultiCellWidget( bar, 4, 4, 0, 2 ); 450 layout->addMultiCellWidget( bar, 4, 4, 0, 2 );
433 451
434 ////////////////////////////////////// 452 //////////////////////////////////////
435 // Phone numbers (upper right) 453 // Phone numbers (upper right)
436 label = new QLabel( tab1 ); 454 label = new QLabel( tab1 );
437//US loadIcon call is ambiguous. Add one more parameter 455//US loadIcon call is ambiguous. Add one more parameter
438//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); 456//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) );
439 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); 457 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
440 layout->addMultiCellWidget( label, 0, 1, 3, 3 ); 458 layout->addMultiCellWidget( label, 0, 1, 3, 3 );
441 459
442 mPhoneEditWidget = new PhoneEditWidget( tab1 ); 460 mPhoneEditWidget = new PhoneEditWidget( tab1 );
443 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 461 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
444 layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); 462 layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 );
445 463
446 bar = new KSeparator( KSeparator::HLine, tab1 ); 464 bar = new KSeparator( KSeparator::HLine, tab1 );
447 layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); 465 layout->addMultiCellWidget( bar, 4, 4, 3, 6 );
448*/ 466*/
449 ////////////////////////////////////// 467 //////////////////////////////////////
450 // Addresses (lower left) 468 // Addresses (lower left)
451 /* LR 469 /* LR
452 label = new QLabel( tab1_1 ); 470 label = new QLabel( tab1_1 );
453//US loadIcon call is ambiguous. Add one more parameter 471//US loadIcon call is ambiguous. Add one more parameter
454//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) ); 472//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) );
455 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); 473 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) );
456//US layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 474//US layout->addMultiCellWidget( label, 5, 6, 0, 0 );
457 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 475 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
458 */ 476 */
459 477
460 mAddressEditWidget = new AddressEditWidget( tab1_1 ); 478 mAddressEditWidget = new AddressEditWidget( tab1_1 );
461 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 479 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
462//US layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 ); 480//US layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 );
463 layout->addMultiCellWidget( mAddressEditWidget, 0, 4, 0, 1 ); 481 layout->addMultiCellWidget( mAddressEditWidget, 0, 4, 0, 1 );
464 482
465//US 483//US
466/* LR 484/* LR
467 bar = new KSeparator( KSeparator::HLine, tab1_1 ); 485 bar = new KSeparator( KSeparator::HLine, tab1_1 );
468 layout->addMultiCellWidget( bar, 5, 5, 0, 3 ); 486 layout->addMultiCellWidget( bar, 5, 5, 0, 3 );
469*/ 487*/
470 488
471 ////////////////////////////////////// 489 //////////////////////////////////////
472 // Email / Web (lower right) 490 // Email / Web (lower right)
473 /* LR 491 /* LR
474 label = new QLabel( tab1_1 ); 492 label = new QLabel( tab1_1 );
475//US loadIcon call is ambiguous. Add one more parameter 493//US loadIcon call is ambiguous. Add one more parameter
476//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) ); 494//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) );
477 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) ); 495 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) );
478//US layout->addMultiCellWidget( label, 5, 6, 3, 3 ); 496//US layout->addMultiCellWidget( label, 5, 6, 3, 3 );
479 layout->addMultiCellWidget( label, 6, 7, 0, 0 ); 497 layout->addMultiCellWidget( label, 6, 7, 0, 0 );
480 */ 498 */
481 mEmailWidget = new EmailEditWidget( tab1_1 ); 499 mEmailWidget = new EmailEditWidget( tab1_1 );
482 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 500 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
483//US layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 ); 501//US layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 );
484 layout->addMultiCellWidget( mEmailWidget, 5, 6, 0, 1 ); 502 layout->addMultiCellWidget( mEmailWidget, 5, 6, 0, 1 );
485 503
486 /* LR 504 /* LR
487 // add the separator 505 // add the separator
488 bar = new KSeparator( KSeparator::HLine, tab1_1 ); 506 bar = new KSeparator( KSeparator::HLine, tab1_1 );
489//US layout->addMultiCellWidget( bar, 7, 7, 3, 6 ); 507//US layout->addMultiCellWidget( bar, 7, 7, 3, 6 );
490 layout->addMultiCellWidget( bar, 8, 8, 0, 3 ); 508 layout->addMultiCellWidget( bar, 8, 8, 0, 3 );
491 509
492 label = new QLabel( tab1_1 ); 510 label = new QLabel( tab1_1 );
493//US loadIcon call is ambiguous. Add one more parameter 511//US loadIcon call is ambiguous. Add one more parameter
494//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) ); 512//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) );
495 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) ); 513 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) );
496//US layout->addMultiCellWidget( label, 8, 9, 3, 3 ); 514//US layout->addMultiCellWidget( label, 8, 9, 3, 3 );
497 layout->addMultiCellWidget( label, 9, 10, 0, 0 ); 515 layout->addMultiCellWidget( label, 9, 10, 0, 0 );
498 */ 516 */
499 label = new QLabel( i18n( "URL:" ), tab1_1 ); 517 label = new QLabel( i18n( "URL:" ), tab1_1 );
500 mURLEdit = new KLineEdit( tab1_1 ); 518 mURLEdit = new KLineEdit( tab1_1 );
501 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ), 519 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ),
502 SLOT( textChanged( const QString& ) ) ); 520 SLOT( textChanged( const QString& ) ) );
503 label->setBuddy( mURLEdit ); 521 label->setBuddy( mURLEdit );
504//US layout->addWidget( label, 8, 4 ); 522//US layout->addWidget( label, 8, 4 );
505 layout->addWidget( label, 7,0 ); 523 layout->addWidget( label, 7,0 );
506//US layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 ); 524//US layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 );
507 layout->addWidget( mURLEdit, 7, 1); 525 layout->addWidget( mURLEdit, 7, 1);
508 526
509 label = new QLabel( i18n( "&IM address:" ), tab1_1 ); 527 label = new QLabel( i18n( "&IM address:" ), tab1_1 );
510 mIMAddressEdit = new KLineEdit( tab1_1 ); 528 mIMAddressEdit = new KLineEdit( tab1_1 );
511 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ), 529 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ),
512 SLOT( textChanged( const QString& ) ) ); 530 SLOT( textChanged( const QString& ) ) );
513 label->setBuddy( mIMAddressEdit ); 531 label->setBuddy( mIMAddressEdit );
514//US layout->addWidget( label, 9, 4 ); 532//US layout->addWidget( label, 9, 4 );
515 layout->addWidget( label, 8, 0 ); 533 layout->addWidget( label, 8, 0 );
516//US layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 ); 534//US layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 );
517 layout->addWidget( mIMAddressEdit, 8,1 ); 535 layout->addWidget( mIMAddressEdit, 8,1 );
518 536
519//US layout->addColSpacing( 6, 50 ); 537//US layout->addColSpacing( 6, 50 );
520 538
521//US bar = new KSeparator( KSeparator::HLine, tab1_1 ); 539//US bar = new KSeparator( KSeparator::HLine, tab1_1 );
522//US layout->addMultiCellWidget( bar, 10, 10, 0, 6 ); 540//US layout->addMultiCellWidget( bar, 10, 10, 0, 6 );
523 541
524/*US 542/*US
525 /////////////////////////////////////// 543 ///////////////////////////////////////
526 QHBox *categoryBox = new QHBox( tab1 ); 544 QHBox *categoryBox = new QHBox( tab1 );
527 categoryBox->setSpacing( KDialogBase::spacingHintSmall() ); 545 categoryBox->setSpacing( KDialogBase::spacingHintSmall() );
528 546
529 // Categories 547 // Categories
530 button = new QPushButton( i18n( "Categories" ), categoryBox ); 548 button = new QPushButton( i18n( "Categories" ), categoryBox );
531 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); 549 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) );
532 550
533 mCategoryEdit = new KLineEdit( categoryBox ); 551 mCategoryEdit = new KLineEdit( categoryBox );
534 mCategoryEdit->setReadOnly( true ); 552 mCategoryEdit->setReadOnly( true );
535 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), 553 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
536 SLOT( textChanged( const QString& ) ) ); 554 SLOT( textChanged( const QString& ) ) );
537 555
538 mSecrecyWidget = new SecrecyWidget( categoryBox ); 556 mSecrecyWidget = new SecrecyWidget( categoryBox );
539 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 557 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
540 558
541 layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); 559 layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 );
542*/ 560*/
543 // Build the layout and add to the tab widget 561 // Build the layout and add to the tab widget
544 layout->activate(); // required 562 layout->activate(); // required
545 563
546 mTabWidget->addTab( tab1_1, i18n( "&Address" ) ); 564 mTabWidget->addTab( tab1_1, i18n( "&Address" ) );
547} 565}
548 566
549 567
550 568
551void AddresseeEditorWidget::setupTab2() 569void AddresseeEditorWidget::setupTab2()
552{ 570{
553 // This is the Details tab 571 // This is the Details tab
554 QWidget *tab2 = new QWidget( mTabWidget ); 572 QWidget *tab2 = new QWidget( mTabWidget );
555 573
556 QGridLayout *layout = new QGridLayout( tab2, 8, 3 ); 574 QGridLayout *layout = new QGridLayout( tab2, 8, 3 );
557 layout->setMargin( KDialogBase::marginHintSmall() ); 575 layout->setMargin( KDialogBase::marginHintSmall() );
558 layout->setSpacing( KDialogBase::spacingHintSmall() ); 576 layout->setSpacing( KDialogBase::spacingHintSmall() );
559 577
560 QLabel *label; 578 QLabel *label;
561 KSeparator* bar; 579 KSeparator* bar;
562 580
563 /////////////////////// 581 ///////////////////////
564 // Office info 582 // Office info
565 583
566 // Department 584 // Department
567 label = new QLabel( tab2 ); 585 label = new QLabel( tab2 );
568//US loadIcon call is ambiguous. Add one more parameter 586//US loadIcon call is ambiguous. Add one more parameter
569//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); 587//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) );
570 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); 588 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) );
571 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 589 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
572 590
573 label = new QLabel( i18n( "Department:" ), tab2 ); 591 label = new QLabel( i18n( "Department:" ), tab2 );
574 layout->addWidget( label, 0, 1 ); 592 layout->addWidget( label, 0, 1 );
575 mDepartmentEdit = new KLineEdit( tab2 ); 593 mDepartmentEdit = new KLineEdit( tab2 );
576 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), 594 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ),
577 SLOT( textChanged( const QString& ) ) ); 595 SLOT( textChanged( const QString& ) ) );
578 label->setBuddy( mDepartmentEdit ); 596 label->setBuddy( mDepartmentEdit );
579 layout->addWidget( mDepartmentEdit, 0, 2 ); 597 layout->addWidget( mDepartmentEdit, 0, 2 );
580 598
581 label = new QLabel( i18n( "Office:" ), tab2 ); 599 label = new QLabel( i18n( "Office:" ), tab2 );
582 layout->addWidget( label, 1, 1 ); 600 layout->addWidget( label, 1, 1 );
583 mOfficeEdit = new KLineEdit( tab2 ); 601 mOfficeEdit = new KLineEdit( tab2 );
584 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ), 602 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ),
585 SLOT( textChanged( const QString& ) ) ); 603 SLOT( textChanged( const QString& ) ) );
586 label->setBuddy( mOfficeEdit ); 604 label->setBuddy( mOfficeEdit );
587 layout->addWidget( mOfficeEdit, 1, 2 ); 605 layout->addWidget( mOfficeEdit, 1, 2 );
588 606
589 label = new QLabel( i18n( "Profession:" ), tab2 ); 607 label = new QLabel( i18n( "Profession:" ), tab2 );
590 layout->addWidget( label, 2, 1 ); 608 layout->addWidget( label, 2, 1 );
591 mProfessionEdit = new KLineEdit( tab2 ); 609 mProfessionEdit = new KLineEdit( tab2 );
592 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ), 610 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ),
593 SLOT( textChanged( const QString& ) ) ); 611 SLOT( textChanged( const QString& ) ) );
594 label->setBuddy( mProfessionEdit ); 612 label->setBuddy( mProfessionEdit );
595 layout->addWidget( mProfessionEdit, 2, 2 ); 613 layout->addWidget( mProfessionEdit, 2, 2 );
596 614
597 label = new QLabel( i18n( "Manager\'s name:" ), tab2 ); 615 label = new QLabel( i18n( "Manager\'s name:" ), tab2 );
598//US layout->addWidget( label, 0, 3 ); 616//US layout->addWidget( label, 0, 3 );
599 layout->addWidget( label, 3, 1 ); 617 layout->addWidget( label, 3, 1 );
600 mManagerEdit = new KLineEdit( tab2 ); 618 mManagerEdit = new KLineEdit( tab2 );
601 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ), 619 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ),
602 SLOT( textChanged( const QString& ) ) ); 620 SLOT( textChanged( const QString& ) ) );
603 label->setBuddy( mManagerEdit ); 621 label->setBuddy( mManagerEdit );
604//US layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 ); 622//US layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 );
605 layout->addWidget( mManagerEdit, 3, 2 ); 623 layout->addWidget( mManagerEdit, 3, 2 );
606 624
607 label = new QLabel( i18n( "Assistant's name:" ), tab2 ); 625 label = new QLabel( i18n( "Assistant's name:" ), tab2 );
608//US layout->addWidget( label, 1, 3 ); 626//US layout->addWidget( label, 1, 3 );
609 layout->addWidget( label, 4, 1 ); 627 layout->addWidget( label, 4, 1 );
610 mAssistantEdit = new KLineEdit( tab2 ); 628 mAssistantEdit = new KLineEdit( tab2 );
611 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ), 629 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ),
612 SLOT( textChanged( const QString& ) ) ); 630 SLOT( textChanged( const QString& ) ) );
613 label->setBuddy( mAssistantEdit ); 631 label->setBuddy( mAssistantEdit );
614//US layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 ); 632//US layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 );
615 layout->addWidget( mAssistantEdit, 4, 2 ); 633 layout->addWidget( mAssistantEdit, 4, 2 );
616 634
617 bar = new KSeparator( KSeparator::HLine, tab2 ); 635 bar = new KSeparator( KSeparator::HLine, tab2 );
618//US layout->addMultiCellWidget( bar, 3, 3, 0, 5 ); 636//US layout->addMultiCellWidget( bar, 3, 3, 0, 5 );
619 layout->addMultiCellWidget( bar, 5, 5, 0, 2 ); 637 layout->addMultiCellWidget( bar, 5, 5, 0, 2 );
620 638
621 ///////////////////////////////////////////////// 639 /////////////////////////////////////////////////
622 // Personal info 640 // Personal info
623 641
624 //label = new QLabel( tab2 ); 642 //label = new QLabel( tab2 );
625//US loadIcon call is ambiguous. Add one more parameter 643//US loadIcon call is ambiguous. Add one more parameter
626//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 644//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
627 //label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 645 //label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
628//US layout->addMultiCellWidget( label, 4, 5, 0, 0 ); 646//US layout->addMultiCellWidget( label, 4, 5, 0, 0 );
629 //layout->addMultiCellWidget( label, 6, 7, 0, 0 ); 647 //layout->addMultiCellWidget( label, 6, 7, 0, 0 );
630 648
631 649
632 int iii = 6; 650 int iii = 6;
633 651
634 if ( QApplication::desktop()->width() == 640 ) { 652 if ( QApplication::desktop()->width() == 640 ) {
635 QHBox * nbox = new QHBox ( tab2 ); 653 QHBox * nbox = new QHBox ( tab2 );
636 label = new QLabel( i18n( "Nick name:" )+" ", nbox ); 654 label = new QLabel( i18n( "Nick name:" )+" ", nbox );
637 mNicknameEdit = new KLineEdit( nbox ); 655 mNicknameEdit = new KLineEdit( nbox );
638 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 656 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
639 SLOT( textChanged( const QString& ) ) ); 657 SLOT( textChanged( const QString& ) ) );
640 label->setBuddy( mNicknameEdit ); 658 label->setBuddy( mNicknameEdit );
641 659
642 label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox ); 660 label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox );
643 mSpouseEdit = new KLineEdit( nbox ); 661 mSpouseEdit = new KLineEdit( nbox );
644 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 662 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
645 SLOT( textChanged( const QString& ) ) ); 663 SLOT( textChanged( const QString& ) ) );
646 label->setBuddy( mSpouseEdit ); 664 label->setBuddy( mSpouseEdit );
647 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 ); 665 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
648 ++iii; 666 ++iii;
649 667
650 } else { 668 } else {
651 label = new QLabel( i18n( "Nick name:" ), tab2 ); 669 label = new QLabel( i18n( "Nick name:" ), tab2 );
652 layout->addWidget( label, iii, 1 ); 670 layout->addWidget( label, iii, 1 );
653 mNicknameEdit = new KLineEdit( tab2 ); 671 mNicknameEdit = new KLineEdit( tab2 );
654 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 672 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
655 SLOT( textChanged( const QString& ) ) ); 673 SLOT( textChanged( const QString& ) ) );
656 label->setBuddy( mNicknameEdit ); 674 label->setBuddy( mNicknameEdit );
657 layout->addWidget( mNicknameEdit, iii, 2 ); 675 layout->addWidget( mNicknameEdit, iii, 2 );
658 ++iii; 676 ++iii;
659 677
660 label = new QLabel( i18n( "Spouse's name:" ), tab2 ); 678 label = new QLabel( i18n( "Spouse's name:" ), tab2 );
661 layout->addWidget( label, iii, 1 ); 679 layout->addWidget( label, iii, 1 );
662 mSpouseEdit = new KLineEdit( tab2 ); 680 mSpouseEdit = new KLineEdit( tab2 );
663 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 681 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
664 SLOT( textChanged( const QString& ) ) ); 682 SLOT( textChanged( const QString& ) ) );
665 label->setBuddy( mSpouseEdit ); 683 label->setBuddy( mSpouseEdit );
666 layout->addWidget( mSpouseEdit, iii, 2 ); 684 layout->addWidget( mSpouseEdit, iii, 2 );
667 ++iii; 685 ++iii;
668 } 686 }
669 687
670 label = new QLabel( i18n( "Children's names:" ), tab2 ); 688 label = new QLabel( i18n( "Children's names:" ), tab2 );
671 layout->addWidget( label, iii, 1 ); 689 layout->addWidget( label, iii, 1 );
672 mChildEdit = new KLineEdit( tab2 ); 690 mChildEdit = new KLineEdit( tab2 );
673 connect( mChildEdit, SIGNAL( textChanged( const QString& ) ), 691 connect( mChildEdit, SIGNAL( textChanged( const QString& ) ),
674 SLOT( textChanged( const QString& ) ) ); 692 SLOT( textChanged( const QString& ) ) );
675 label->setBuddy( mChildEdit ); 693 label->setBuddy( mChildEdit );
676 layout->addWidget( mChildEdit, iii, 2 ); 694 layout->addWidget( mChildEdit, iii, 2 );
677 ++iii; 695 ++iii;
678 if ( QApplication::desktop()->width() == 640 ) { 696 if ( QApplication::desktop()->width() == 640 ) {
679 QHBox * nbox = new QHBox ( tab2 ); 697 QHBox * nbox = new QHBox ( tab2 );
680 label = new QLabel( i18n( "Birthday:" )+" ", nbox ); 698 label = new QLabel( i18n( "Birthday:" )+" ", nbox );
681 mBirthdayPicker = new KDateEdit( nbox ); 699 mBirthdayPicker = new KDateEdit( nbox );
682 //mBirthdayPicker->toggleDateFormat(); 700 //mBirthdayPicker->toggleDateFormat();
683 mBirthdayPicker->setHandleInvalid( true ); 701 mBirthdayPicker->setHandleInvalid( true );
684 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 702 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
685 SLOT( dateChanged( QDate ) ) ); 703 SLOT( dateChanged( QDate ) ) );
686 704
687 label->setBuddy( mBirthdayPicker ); 705 label->setBuddy( mBirthdayPicker );
688 706
689 label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox ); 707 label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox );
690 mAnniversaryPicker = new KDateEdit( nbox ); 708 mAnniversaryPicker = new KDateEdit( nbox );
691 mAnniversaryPicker->setHandleInvalid( true ); 709 mAnniversaryPicker->setHandleInvalid( true );
692 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), 710 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
693 SLOT( dateChanged( QDate ) ) ); 711 SLOT( dateChanged( QDate ) ) );
694 712
695 label->setBuddy( mAnniversaryPicker ); 713 label->setBuddy( mAnniversaryPicker );
696 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 ); 714 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
697 ++iii; 715 ++iii;
698 716
699 } else { 717 } else {
700 718
701 label = new QLabel( i18n( "Birthday:" ), tab2 ); 719 label = new QLabel( i18n( "Birthday:" ), tab2 );
702 layout->addWidget( label, iii, 1 ); 720 layout->addWidget( label, iii, 1 );
703 mBirthdayPicker = new KDateEdit( tab2 ); 721 mBirthdayPicker = new KDateEdit( tab2 );
704 //mBirthdayPicker->toggleDateFormat(); 722 //mBirthdayPicker->toggleDateFormat();
705 mBirthdayPicker->setHandleInvalid( true ); 723 mBirthdayPicker->setHandleInvalid( true );
706 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 724 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
707 SLOT( dateChanged( QDate ) ) ); 725 SLOT( dateChanged( QDate ) ) );
708 726
709 label->setBuddy( mBirthdayPicker ); 727 label->setBuddy( mBirthdayPicker );
710 layout->addWidget( mBirthdayPicker, iii, 2 ); 728 layout->addWidget( mBirthdayPicker, iii, 2 );
711 ++iii; 729 ++iii;
712 730
713 label = new QLabel( i18n( "Anniversary:" ), tab2 ); 731 label = new QLabel( i18n( "Anniversary:" ), tab2 );
714 layout->addWidget( label, iii, 1 ); 732 layout->addWidget( label, iii, 1 );
715 mAnniversaryPicker = new KDateEdit( tab2 ); 733 mAnniversaryPicker = new KDateEdit( tab2 );
716 mAnniversaryPicker->setHandleInvalid( true ); 734 mAnniversaryPicker->setHandleInvalid( true );
717 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), 735 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
718 SLOT( dateChanged( QDate ) ) ); 736 SLOT( dateChanged( QDate ) ) );
719 737
720 label->setBuddy( mAnniversaryPicker ); 738 label->setBuddy( mAnniversaryPicker );
721 layout->addWidget( mAnniversaryPicker, iii, 2 ); 739 layout->addWidget( mAnniversaryPicker, iii, 2 );
722 ++iii; 740 ++iii;
723 741
724 } 742 }
725 743
726 label = new QLabel( i18n( "Gender:" ), tab2 ); 744 label = new QLabel( i18n( "Gender:" ), tab2 );
727 layout->addWidget( label, iii, 1 ); 745 layout->addWidget( label, iii, 1 );
728 mGenderBox = new QComboBox ( tab2 ); 746 mGenderBox = new QComboBox ( tab2 );
729 mGenderBox->insertItem ( i18n( "ALIEN (undefined)" )); 747 mGenderBox->insertItem ( i18n( "ALIEN (undefined)" ));
730 mGenderBox->insertItem ( i18n( "female" )); 748 mGenderBox->insertItem ( i18n( "female" ));
731 mGenderBox->insertItem ( i18n( "male" )); 749 mGenderBox->insertItem ( i18n( "male" ));
732 connect( mGenderBox, SIGNAL( activated ( const QString & ) ), 750 connect( mGenderBox, SIGNAL( activated ( const QString & ) ),
733 SLOT( textChanged( const QString& ) ) ); 751 SLOT( textChanged( const QString& ) ) );
734 label->setBuddy( mGenderBox ); 752 label->setBuddy( mGenderBox );
735 layout->addWidget( mGenderBox, iii, 2 ); 753 layout->addWidget( mGenderBox, iii, 2 );
736 ++iii; 754 ++iii;
737 // Build the layout and add to the tab widget 755 // Build the layout and add to the tab widget
738 layout->activate(); // required 756 layout->activate(); // required
739 757
740 mTabWidget->addTab( tab2, i18n( "&Details" ) ); 758 mTabWidget->addTab( tab2, i18n( "&Details" ) );
741} 759}
742 760
743void AddresseeEditorWidget::setupTab2_1() 761void AddresseeEditorWidget::setupTab2_1()
744{ 762{
745 // This is the Details tab 763 // This is the Details tab
746 QWidget *tab2_2 = new QWidget( mTabWidget ); 764 QWidget *tab2_2 = new QWidget( mTabWidget );
747 765
748 QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 ); 766 QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 );
749 layout->setMargin( KDialogBase::marginHintSmall() ); 767 layout->setMargin( KDialogBase::marginHintSmall() );
750 layout->setSpacing( KDialogBase::spacingHintSmall() ); 768 layout->setSpacing( KDialogBase::spacingHintSmall() );
751 769
752 QLabel *label; 770 QLabel *label;
753 KSeparator* bar; 771 KSeparator* bar;
754 772
755/*US 773/*US
756 /////////////////////// 774 ///////////////////////
757 // Office info 775 // Office info
758 776
759 // Department 777 // Department
760 label = new QLabel( tab2 ); 778 label = new QLabel( tab2 );
761//US loadIcon call is ambiguous. Add one more parameter 779//US loadIcon call is ambiguous. Add one more parameter
762//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); 780//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) );
763 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); 781 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) );
764 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 782 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
765 783
766 label = new QLabel( i18n( "Department:" ), tab2 ); 784 label = new QLabel( i18n( "Department:" ), tab2 );
767 layout->addWidget( label, 0, 1 ); 785 layout->addWidget( label, 0, 1 );
768 mDepartmentEdit = new KLineEdit( tab2 ); 786 mDepartmentEdit = new KLineEdit( tab2 );
769 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), 787 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ),
770 SLOT( textChanged( const QString& ) ) ); 788 SLOT( textChanged( const QString& ) ) );
771 label->setBuddy( mDepartmentEdit ); 789 label->setBuddy( mDepartmentEdit );
772 layout->addWidget( mDepartmentEdit, 0, 2 ); 790 layout->addWidget( mDepartmentEdit, 0, 2 );
773 791
774 label = new QLabel( i18n( "Office:" ), tab2 ); 792 label = new QLabel( i18n( "Office:" ), tab2 );
775 layout->addWidget( label, 1, 1 ); 793 layout->addWidget( label, 1, 1 );
776 mOfficeEdit = new KLineEdit( tab2 ); 794 mOfficeEdit = new KLineEdit( tab2 );
777 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ), 795 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ),
778 SLOT( textChanged( const QString& ) ) ); 796 SLOT( textChanged( const QString& ) ) );
779 label->setBuddy( mOfficeEdit ); 797 label->setBuddy( mOfficeEdit );
780 layout->addWidget( mOfficeEdit, 1, 2 ); 798 layout->addWidget( mOfficeEdit, 1, 2 );
781 799
782 label = new QLabel( i18n( "Profession:" ), tab2 ); 800 label = new QLabel( i18n( "Profession:" ), tab2 );
783 layout->addWidget( label, 2, 1 ); 801 layout->addWidget( label, 2, 1 );
784 mProfessionEdit = new KLineEdit( tab2 ); 802 mProfessionEdit = new KLineEdit( tab2 );
785 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ), 803 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ),
786 SLOT( textChanged( const QString& ) ) ); 804 SLOT( textChanged( const QString& ) ) );
787 label->setBuddy( mProfessionEdit ); 805 label->setBuddy( mProfessionEdit );
788 layout->addWidget( mProfessionEdit, 2, 2 ); 806 layout->addWidget( mProfessionEdit, 2, 2 );
789 807
790 label = new QLabel( i18n( "Manager\'s name:" ), tab2 ); 808 label = new QLabel( i18n( "Manager\'s name:" ), tab2 );
791 layout->addWidget( label, 0, 3 ); 809 layout->addWidget( label, 0, 3 );
792 mManagerEdit = new KLineEdit( tab2 ); 810 mManagerEdit = new KLineEdit( tab2 );
793 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ), 811 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ),
794 SLOT( textChanged( const QString& ) ) ); 812 SLOT( textChanged( const QString& ) ) );
795 label->setBuddy( mManagerEdit ); 813 label->setBuddy( mManagerEdit );
796 layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 ); 814 layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 );
797 815
798 label = new QLabel( i18n( "Assistant's name:" ), tab2 ); 816 label = new QLabel( i18n( "Assistant's name:" ), tab2 );
799 layout->addWidget( label, 1, 3 ); 817 layout->addWidget( label, 1, 3 );
800 mAssistantEdit = new KLineEdit( tab2 ); 818 mAssistantEdit = new KLineEdit( tab2 );
801 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ), 819 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ),
802 SLOT( textChanged( const QString& ) ) ); 820 SLOT( textChanged( const QString& ) ) );
803 label->setBuddy( mAssistantEdit ); 821 label->setBuddy( mAssistantEdit );
804 layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 ); 822 layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 );
805 823
806 bar = new KSeparator( KSeparator::HLine, tab2 ); 824 bar = new KSeparator( KSeparator::HLine, tab2 );
807 layout->addMultiCellWidget( bar, 3, 3, 0, 5 ); 825 layout->addMultiCellWidget( bar, 3, 3, 0, 5 );
808 826
809 ///////////////////////////////////////////////// 827 /////////////////////////////////////////////////
810 // Personal info 828 // Personal info
811 829
812 label = new QLabel( tab2 ); 830 label = new QLabel( tab2 );
813//US loadIcon call is ambiguous. Add one more parameter 831//US loadIcon call is ambiguous. Add one more parameter
814//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 832//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
815 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 833 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
816 layout->addMultiCellWidget( label, 4, 5, 0, 0 ); 834 layout->addMultiCellWidget( label, 4, 5, 0, 0 );
817 835
818 label = new QLabel( i18n( "Nick name:" ), tab2 ); 836 label = new QLabel( i18n( "Nick name:" ), tab2 );
819 layout->addWidget( label, 4, 1 ); 837 layout->addWidget( label, 4, 1 );
820 mNicknameEdit = new KLineEdit( tab2 ); 838 mNicknameEdit = new KLineEdit( tab2 );
821 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 839 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
822 SLOT( textChanged( const QString& ) ) ); 840 SLOT( textChanged( const QString& ) ) );
823 label->setBuddy( mNicknameEdit ); 841 label->setBuddy( mNicknameEdit );
824 layout->addWidget( mNicknameEdit, 4, 2 ); 842 layout->addWidget( mNicknameEdit, 4, 2 );
825 843
826 label = new QLabel( i18n( "Spouse's name:" ), tab2 ); 844 label = new QLabel( i18n( "Spouse's name:" ), tab2 );
827 layout->addWidget( label, 5, 1 ); 845 layout->addWidget( label, 5, 1 );
828 mSpouseEdit = new KLineEdit( tab2 ); 846 mSpouseEdit = new KLineEdit( tab2 );
829 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 847 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
830 SLOT( textChanged( const QString& ) ) ); 848 SLOT( textChanged( const QString& ) ) );
831 label->setBuddy( mSpouseEdit ); 849 label->setBuddy( mSpouseEdit );
832 layout->addWidget( mSpouseEdit, 5, 2 ); 850 layout->addWidget( mSpouseEdit, 5, 2 );
833 851
834 label = new QLabel( i18n( "Birthday:" ), tab2 ); 852 label = new QLabel( i18n( "Birthday:" ), tab2 );
835 layout->addWidget( label, 4, 3 ); 853 layout->addWidget( label, 4, 3 );
836 mBirthdayPicker = new KDateEdit( tab2 ); 854 mBirthdayPicker = new KDateEdit( tab2 );
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h
index 7fe4bc0..0241cf0 100644
--- a/kaddressbook/phoneeditwidget.h
+++ b/kaddressbook/phoneeditwidget.h
@@ -1,147 +1,222 @@
1#ifndef PHONEEDITWIDGET_H 1#ifndef PHONEEDITWIDGET_H
2#define PHONEEDITWIDGET_H 2#define PHONEEDITWIDGET_H
3/* 3/*
4 This file is part of KAddressBook. 4 This file is part of KAddressBook.
5 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 5 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 20
21 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
24*/ 24*/
25 25
26#include <kdialogbase.h> 26#include <kdialogbase.h>
27#include <kiconloader.h>
28#include <qpushbutton.h>
29#include <qlayout.h>
30
27 31
28#include "addresseeconfig.h" 32#include "addresseeconfig.h"
29#include "typecombo.h" 33#include "typecombo.h"
30 34
31class QButtonGroup; 35class QButtonGroup;
32class QCheckBox; 36class QCheckBox;
33 37
38#include <klineedit.h>
39#include <kcombobox.h>
34class KListView; 40class KListView;
35class KLineEdit;
36class KComboBox;
37 41
38typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo; 42typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo;
39 43
40/** 44/**
41 Widget for editing phone numbers. 45 Widget for editing phone numbers.
42*/ 46*/
43class PhoneEditWidget : public QWidget 47class PhoneEditWidget : public QWidget
44{ 48{
45 Q_OBJECT 49 Q_OBJECT
46 50
47 public: 51 public:
48 PhoneEditWidget( QWidget *parent, const char *name = 0 ); 52 PhoneEditWidget( QWidget *parent, const char *name = 0 );
49 ~PhoneEditWidget(); 53 ~PhoneEditWidget();
50 54
51 void setPhoneNumbers( const KABC::PhoneNumber::List &list ); 55 void setPhoneNumbers( const KABC::PhoneNumber::List &list );
52 KABC::PhoneNumber::List phoneNumbers(); 56 KABC::PhoneNumber::List phoneNumbers();
53 57
54 void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* ); 58 void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* );
55 KABC::PhoneNumber currentPhoneNumber( KComboBox*, int ); 59 KABC::PhoneNumber currentPhoneNumber( KComboBox*, int );
56 60
57 signals: 61 signals:
58 void modified(); 62 void modified();
59 63
60 private slots: 64 private slots:
61 void edit(); 65 void edit();
62 66
63 void updatePrefEdit(); 67 void updatePrefEdit();
64 void updateSecondEdit(); 68 void updateSecondEdit();
65 void updateThirdEdit(); 69 void updateThirdEdit();
66 void updateFourthEdit(); 70 void updateFourthEdit();
67 71
68 void slotPrefEditChanged(); 72 void slotPrefEditChanged();
69 void slotSecondEditChanged(); 73 void slotSecondEditChanged();
70 void slotThirdEditChanged(); 74 void slotThirdEditChanged();
71 void slotFourthEditChanged(); 75 void slotFourthEditChanged();
72 76
73 protected: 77 protected:
74 void updateLineEdits(); 78 void updateLineEdits();
75 void updateCombos(); 79 void updateCombos();
76 80
77 private: 81 private:
78 void updateEdit( PhoneTypeCombo *combo ); 82 void updateEdit( PhoneTypeCombo *combo );
79 void updatePhoneNumber( PhoneTypeCombo *combo ); 83 void updatePhoneNumber( PhoneTypeCombo *combo );
80 void updateOtherEdit( PhoneTypeCombo *combo, PhoneTypeCombo *otherCombo ); 84 void updateOtherEdit( PhoneTypeCombo *combo, PhoneTypeCombo *otherCombo );
81 85
82 PhoneTypeCombo *mPrefCombo; 86 PhoneTypeCombo *mPrefCombo;
83 PhoneTypeCombo *mSecondCombo; 87 PhoneTypeCombo *mSecondCombo;
84 PhoneTypeCombo *mThirdCombo; 88 PhoneTypeCombo *mThirdCombo;
85 PhoneTypeCombo *mFourthCombo; 89 PhoneTypeCombo *mFourthCombo;
86 90
87 KLineEdit *mPrefEdit; 91 KLineEdit *mPrefEdit;
88 KLineEdit *mSecondEdit; 92 KLineEdit *mSecondEdit;
89 KLineEdit *mThirdEdit; 93 KLineEdit *mThirdEdit;
90 KLineEdit *mFourthEdit; 94 KLineEdit *mFourthEdit;
91 95
92 KABC::PhoneNumber::List mPhoneList; 96 KABC::PhoneNumber::List mPhoneList;
93}; 97};
94 98
95/** 99/**
96 Dialog for editing lists of phonenumbers. 100 Dialog for editing lists of phonenumbers.
97*/ 101*/
98class PhoneEditDialog : public KDialogBase 102class PhoneEditDialog : public KDialogBase
99{ 103{
100 Q_OBJECT 104 Q_OBJECT
101 105
102 public: 106 public:
103 PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name = 0 ); 107 PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name = 0 );
104 ~PhoneEditDialog(); 108 ~PhoneEditDialog();
105 109
106 const KABC::PhoneNumber::List &phoneNumbers(); 110 const KABC::PhoneNumber::List &phoneNumbers();
107 bool changed() const; 111 bool changed() const;
108 112
109 protected slots: 113 protected slots:
110 void slotAddPhoneNumber(); 114 void slotAddPhoneNumber();
111 void slotRemovePhoneNumber(); 115 void slotRemovePhoneNumber();
112 void slotEditPhoneNumber(); 116 void slotEditPhoneNumber();
113 void slotSelectionChanged(); 117 void slotSelectionChanged();
114 118
115 private: 119 private:
116 KABC::PhoneNumber::List mPhoneNumberList; 120 KABC::PhoneNumber::List mPhoneNumberList;
117 KABC::PhoneNumber::TypeList mTypeList; 121 KABC::PhoneNumber::TypeList mTypeList;
118 KComboBox *mTypeBox; 122 KComboBox *mTypeBox;
119 KListView *mListView; 123 KListView *mListView;
120 124
121 QPushButton *mRemoveButton; 125 QPushButton *mRemoveButton;
122 QPushButton *mEditButton; 126 QPushButton *mEditButton;
123 127
124 bool mChanged; 128 bool mChanged;
125}; 129};
126 130
127/** 131/**
128 Dialog for editing phone number types. 132 Dialog for editing phone number types.
129*/ 133*/
130class PhoneTypeDialog : public KDialogBase 134class PhoneTypeDialog : public KDialogBase
131{ 135{
132 Q_OBJECT 136 Q_OBJECT
133public: 137public:
134 PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, QWidget *parent, const char *name = 0 ); 138 PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, QWidget *parent, const char *name = 0 );
135 139
136 KABC::PhoneNumber phoneNumber(); 140 KABC::PhoneNumber phoneNumber();
137 141
138private: 142private:
139 KABC::PhoneNumber mPhoneNumber; 143 KABC::PhoneNumber mPhoneNumber;
140 KABC::PhoneNumber::TypeList mTypeList; 144 KABC::PhoneNumber::TypeList mTypeList;
141 145
142 QButtonGroup *mGroup; 146 QButtonGroup *mGroup;
143 QCheckBox *mPreferredBox; 147 QCheckBox *mPreferredBox;
144 KLineEdit *mNumber; 148 KLineEdit *mNumber;
145}; 149};
150class PhoneTypeNumberEdit : public QWidget
151{
152 Q_OBJECT
153public:
154 PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 )
155 {
156 QHBoxLayout * lay = new QHBoxLayout( this );
157 lay->setSpacing( KDialogBase::spacingHintSmall() );
158 lay->setMargin( KDialogBase::marginHintSmall() );
159 mMinusButton = new QPushButton ( this );
160 mMinusButton->setPixmap ( SmallIcon("minus"));
161 mCombo = new KComboBox( this );
162 mNumber = new KLineEdit( this );
163 lay->addWidget( mMinusButton );
164 lay->addWidget( mCombo );
165 lay->addWidget( mNumber );
166 connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) );
167 connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) );
168 mCombo->insertStringList( PhoneNumber::supportedTypeListNames() );
169 }
170
171 void setPhoneNumber( const KABC::PhoneNumber &phoneNumber )
172 {
173 mPhoneNumber = phoneNumber;
174 int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() );
175 mCombo->setCurrentItem( index );
176 mNumber->setText( mPhoneNumber.number() );
177 show();
178
179 }
180 KABC::PhoneNumber phoneNumber()
181 {
182 mPhoneNumber.setNumber( mNumber->text() );
183 int index = mCombo->currentItem();
184 mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] );
185 return mPhoneNumber;
186
187 }
188 private slots:
189 void typeExternalChanged( int oldType, int newType )
190 {
191 if ( mPhoneNumber.type() == newType ) {
192 mPhoneNumber.setType(oldType);
193 int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() );
194 mCombo->setCurrentItem( index );
195 }
196
197 }
198 void deleteNumber()
199 {
200 hide();
201 }
202 void comboTypeChange( int index )
203 {
204 int old = mPhoneNumber.type();
205 int newT = PhoneNumber::supportedTypeList()[index];
206 if ( old != newT ) {
207 mPhoneNumber.setType(newT );
208 emit typeChange ( old, newT );
209 }
210
211 }
212 signals:
213void typeChange( int oldType, int newType );
214
215private:
216 KABC::PhoneNumber mPhoneNumber;
217 QPushButton* mMinusButton;
218 KComboBox *mCombo;
219 KLineEdit *mNumber;
220};
146 221
147#endif 222#endif