summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp50
-rw-r--r--kaddressbook/addresseeeditorwidget.h5
2 files changed, 47 insertions, 8 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index c4083a9..4313998 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -1,881 +1,917 @@
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 bool horLayout = false; 157 bool horLayout = false;
158 int maxCol = 1; 158 int maxCol = 1;
159 if ( QApplication::desktop()->width() == 640 || QApplication::desktop()->width() == 320 ) { 159 if ( QApplication::desktop()->width() == 640 || QApplication::desktop()->width() == 320 ) {
160 horLayout = true; 160 horLayout = true;
161 maxCol = 3; 161 maxCol = 3;
162 } 162 }
163 QGridLayout *layout = new QGridLayout( tab1, 7-maxCol, maxCol ); 163 QGridLayout *layout = new QGridLayout( tab1, 7-maxCol, maxCol );
164 164
165 layout->setMargin( KDialogBase::marginHintSmall() ); 165 layout->setMargin( KDialogBase::marginHintSmall() );
166 layout->setSpacing( KDialogBase::spacingHintSmall() ); 166 layout->setSpacing( KDialogBase::spacingHintSmall() );
167 167
168 QLabel *label; 168 QLabel *label;
169 KSeparator* bar; 169 KSeparator* bar;
170 QPushButton *button; 170 QPushButton *button;
171 171
172 ////////////////////////////////// 172 //////////////////////////////////
173 // Upper left group (person info) 173 // Upper left group (person info)
174 174
175 // Person icon 175 // Person icon
176 /* LR 176 /* LR
177 label = new QLabel( tab1 ); 177 label = new QLabel( tab1 );
178//US ambiguous call. Add one more parameter 178//US ambiguous call. Add one more parameter
179//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 179//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
180 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 180 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
181 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 181 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
182 */ 182 */
183 // First name 183 // First name
184 button = new QPushButton( i18n( "Name..." ), tab1 ); 184 button = new QPushButton( i18n( "Name..." ), tab1 );
185//US QToolTip::add( button, i18n( "Edit the contact's name" ) ); 185//US QToolTip::add( button, i18n( "Edit the contact's name" ) );
186 mNameEdit = new KLineEdit( tab1, "mNameEdit" ); 186 mNameEdit = new KLineEdit( tab1, "mNameEdit" );
187 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), 187 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
188 SLOT( nameTextChanged( const QString& ) ) ); 188 SLOT( nameTextChanged( const QString& ) ) );
189 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); 189 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
190 190
191 mNameLabel = new KSqueezedTextLabel( tab1 ); 191 mNameLabel = new KSqueezedTextLabel( tab1 );
192 mNameLabel->hide(); 192 mNameLabel->hide();
193 193
194 layout->addWidget( button, 0, 0 ); 194 layout->addWidget( button, 0, 0 );
195 layout->addWidget( mNameEdit, 0, 1 ); 195 layout->addWidget( mNameEdit, 0, 1 );
196 layout->addWidget( mNameLabel, 0, 1 ); 196 layout->addWidget( mNameLabel, 0, 1 );
197 197
198 button = new QPushButton( i18n( "Role:" ), tab1 ); 198 button = new QPushButton( i18n( "Role:" ), tab1 );
199 connect( button, SIGNAL( clicked() ), SLOT( setRole2FN() ) ); 199 connect( button, SIGNAL( clicked() ), SLOT( setRole2FN() ) );
200 //label = new QLabel( i18n( "Role:" ), tab1 ); 200 //label = new QLabel( i18n( "Role:" ), tab1 );
201 mRoleEdit = new KLineEdit( tab1 ); 201 mRoleEdit = new KLineEdit( tab1 );
202 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), 202 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ),
203 SLOT( textChanged( const QString& ) ) ); 203 SLOT( textChanged( const QString& ) ) );
204 //label->setBuddy( mRoleEdit ); 204 //label->setBuddy( mRoleEdit );
205 if ( horLayout ) { 205 if ( horLayout ) {
206 layout->addWidget( button, 0, 2 ); 206 layout->addWidget( button, 0, 2 );
207 layout->addWidget( mRoleEdit, 0, 3 ); 207 layout->addWidget( mRoleEdit, 0, 3 );
208 208
209 } else { 209 } else {
210 layout->addWidget( button, 1, 0 ); 210 layout->addWidget( button, 1, 0 );
211 layout->addWidget( mRoleEdit, 1, 1 ); 211 layout->addWidget( mRoleEdit, 1, 1 );
212 } 212 }
213 // Organization 213 // Organization
214 button = new QPushButton( i18n( "Organization:" ), tab1 ); 214 button = new QPushButton( i18n( "Organization:" ), tab1 );
215 connect( button, SIGNAL( clicked() ), SLOT( setCompany2FN() ) ); 215 connect( button, SIGNAL( clicked() ), SLOT( setCompany2FN() ) );
216 //label = new QLabel( i18n( "Organization:" ), tab1 ); 216 //label = new QLabel( i18n( "Organization:" ), tab1 );
217 mOrgEdit = new KLineEdit( tab1 ); 217 mOrgEdit = new KLineEdit( tab1 );
218 //label->setBuddy( mOrgEdit ); 218 //label->setBuddy( mOrgEdit );
219 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), 219 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ),
220 SLOT( textChanged( const QString& ) ) ); 220 SLOT( textChanged( const QString& ) ) );
221 if ( horLayout ) { 221 if ( horLayout ) {
222 layout->addWidget( button, 1, 2 ); 222 layout->addWidget( button, 1, 2 );
223 layout->addWidget( mOrgEdit, 1, 3 ); 223 layout->addWidget( mOrgEdit, 1, 3 );
224 224
225 } else { 225 } else {
226 layout->addWidget( button, 2, 0 ); 226 layout->addWidget( button, 2, 0 );
227 layout->addWidget( mOrgEdit, 2, 1 ); 227 layout->addWidget( mOrgEdit, 2, 1 );
228 } 228 }
229 229
230 // File as (formatted name) 230 // File as (formatted name)
231 label = new QLabel( i18n( "Format.n.:" ), tab1 ); 231 label = new QLabel( i18n( "Format.n.:" ), tab1 );
232 mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); 232 mFormattedNameLabel = new KSqueezedTextLabel( tab1 );
233 if ( horLayout ) { 233 if ( horLayout ) {
234 layout->addWidget( label, 1,0 ); 234 layout->addWidget( label, 1,0 );
235 layout->addWidget( mFormattedNameLabel, 1, 1 ); 235 layout->addWidget( mFormattedNameLabel, 1, 1 );
236 } else { 236 } else {
237 layout->addWidget( label, 3, 0 ); 237 layout->addWidget( label, 3, 0 );
238 layout->addWidget( mFormattedNameLabel, 3, 1 ); 238 layout->addWidget( mFormattedNameLabel, 3, 1 );
239 } 239 }
240 /* LR 240 /* LR
241 // Left hand separator. This separator doesn't go all the way 241 // Left hand separator. This separator doesn't go all the way
242 // across so the dialog still flows from top to bottom 242 // across so the dialog still flows from top to bottom
243 bar = new KSeparator( KSeparator::HLine, tab1 ); 243 bar = new KSeparator( KSeparator::HLine, tab1 );
244 layout->addMultiCellWidget( bar, 4, 4, 0, 2 ); 244 layout->addMultiCellWidget( bar, 4, 4, 0, 2 );
245 */ 245 */
246 ////////////////////////////////////// 246 //////////////////////////////////////
247 247
248 /* LR 248 /* LR
249 // Phone numbers (upper right) 249 // Phone numbers (upper right)
250 label = new QLabel( tab1 ); 250 label = new QLabel( tab1 );
251//US loadIcon call is ambiguous. Add one more parameter 251//US loadIcon call is ambiguous. Add one more parameter
252//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); 252//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) );
253 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); 253 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
254//US layout->addMultiCellWidget( label, 0, 1, 3, 3 ); 254//US layout->addMultiCellWidget( label, 0, 1, 3, 3 );
255 layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 255 layout->addMultiCellWidget( label, 5, 6, 0, 0 );
256 */ 256 */
257 mPhoneEditWidget = new PhoneEditWidget( tab1 ); 257 mPhoneEditWidget = new PhoneEditWidget( tab1 );
258 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 258 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
259//US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); 259//US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 );
260 int iii; 260 int iii;
261#ifndef DESKTOP_VERSION 261#ifndef DESKTOP_VERSION
262 iii = 7; 262 iii = 7;
263#else 263#else
264 iii = 8; 264 iii = 8;
265#endif 265#endif
266 layout->addMultiCellWidget( mPhoneEditWidget, 5-maxCol, 5-maxCol+4, 0, maxCol ); 266 layout->addMultiCellWidget( mPhoneEditWidget, 5-maxCol, 5-maxCol+4, 0, maxCol );
267 iii = 6-maxCol+4; 267 iii = 6-maxCol+4;
268 /* LR 268 /* LR
269 bar = new KSeparator( KSeparator::HLine, tab1 ); 269 bar = new KSeparator( KSeparator::HLine, tab1 );
270//US layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); 270//US layout->addMultiCellWidget( bar, 4, 4, 3, 6 );
271 layout->addMultiCellWidget( bar, 9, 9, 0, 2 ); 271 layout->addMultiCellWidget( bar, 9, 9, 0, 2 );
272 */ 272 */
273/*US 273/*US
274 ////////////////////////////////////// 274 //////////////////////////////////////
275 // Addresses (lower left) 275 // Addresses (lower left)
276 label = new QLabel( tab1 ); 276 label = new QLabel( tab1 );
277//US loadIcon call is ambiguous. Add one more parameter 277//US loadIcon call is ambiguous. Add one more parameter
278//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) ); 278//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) );
279 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); 279 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) );
280 layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 280 layout->addMultiCellWidget( label, 5, 6, 0, 0 );
281 281
282 mAddressEditWidget = new AddressEditWidget( tab1 ); 282 mAddressEditWidget = new AddressEditWidget( tab1 );
283 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 283 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
284 layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 ); 284 layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 );
285 285
286 ////////////////////////////////////// 286 //////////////////////////////////////
287 // Email / Web (lower right) 287 // Email / Web (lower right)
288 label = new QLabel( tab1 ); 288 label = new QLabel( tab1 );
289//US loadIcon call is ambiguous. Add one more parameter 289//US loadIcon call is ambiguous. Add one more parameter
290//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) ); 290//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) );
291 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) ); 291 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) );
292 layout->addMultiCellWidget( label, 5, 6, 3, 3 ); 292 layout->addMultiCellWidget( label, 5, 6, 3, 3 );
293 293
294 mEmailWidget = new EmailEditWidget( tab1 ); 294 mEmailWidget = new EmailEditWidget( tab1 );
295 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 295 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
296 layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 ); 296 layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 );
297 297
298 // add the separator 298 // add the separator
299 bar = new KSeparator( KSeparator::HLine, tab1 ); 299 bar = new KSeparator( KSeparator::HLine, tab1 );
300 layout->addMultiCellWidget( bar, 7, 7, 3, 6 ); 300 layout->addMultiCellWidget( bar, 7, 7, 3, 6 );
301 301
302 label = new QLabel( tab1 ); 302 label = new QLabel( tab1 );
303//US loadIcon call is ambiguous. Add one more parameter 303//US loadIcon call is ambiguous. Add one more parameter
304//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) ); 304//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) );
305 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) ); 305 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) );
306 layout->addMultiCellWidget( label, 8, 9, 3, 3 ); 306 layout->addMultiCellWidget( label, 8, 9, 3, 3 );
307 307
308 label = new QLabel( i18n( "URL:" ), tab1 ); 308 label = new QLabel( i18n( "URL:" ), tab1 );
309 mURLEdit = new KLineEdit( tab1 ); 309 mURLEdit = new KLineEdit( tab1 );
310 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ), 310 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ),
311 SLOT( textChanged( const QString& ) ) ); 311 SLOT( textChanged( const QString& ) ) );
312 label->setBuddy( mURLEdit ); 312 label->setBuddy( mURLEdit );
313 layout->addWidget( label, 8, 4 ); 313 layout->addWidget( label, 8, 4 );
314 layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 ); 314 layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 );
315 315
316 label = new QLabel( i18n( "&IM address:" ), tab1 ); 316 label = new QLabel( i18n( "&IM address:" ), tab1 );
317 mIMAddressEdit = new KLineEdit( tab1 ); 317 mIMAddressEdit = new KLineEdit( tab1 );
318 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ), 318 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ),
319 SLOT( textChanged( const QString& ) ) ); 319 SLOT( textChanged( const QString& ) ) );
320 label->setBuddy( mIMAddressEdit ); 320 label->setBuddy( mIMAddressEdit );
321 layout->addWidget( label, 9, 4 ); 321 layout->addWidget( label, 9, 4 );
322 layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 ); 322 layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 );
323 323
324 layout->addColSpacing( 6, 50 ); 324 layout->addColSpacing( 6, 50 );
325 325
326 bar = new KSeparator( KSeparator::HLine, tab1 ); 326 bar = new KSeparator( KSeparator::HLine, tab1 );
327 layout->addMultiCellWidget( bar, 10, 10, 0, 6 ); 327 layout->addMultiCellWidget( bar, 10, 10, 0, 6 );
328*/ 328*/
329 /////////////////////////////////////// 329 ///////////////////////////////////////
330 QHBox *categoryBox = new QHBox( tab1 ,"cato"); 330 QHBox *categoryBox = new QHBox( tab1 ,"cato");
331 categoryBox->setSpacing( KDialogBase::spacingHint() ); 331 categoryBox->setSpacing( KDialogBase::spacingHint() );
332 categoryBox->setMargin( KDialogBase::marginHintSmall() ); 332 categoryBox->setMargin( KDialogBase::marginHintSmall() );
333 333
334 // Categories 334 // Categories
335 button = new QPushButton( i18n( "Categories" ), categoryBox ); 335 button = new QPushButton( i18n( "Categories" )+":", categoryBox );
336 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); 336 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) );
337 337
338 mCategoryEdit = new KLineEdit( categoryBox ); 338 mCategoryEdit = new QPushButton ( categoryBox );
339 mCategoryEdit->setReadOnly( true ); 339 mCategoryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
340 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), 340 mCatPopup = new QPopupMenu ( categoryBox );
341 SLOT( textChanged( const QString& ) ) ); 341 mCategoryEdit->setPopup( mCatPopup );
342 connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup()));
343 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int )));
344 //connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
345 // SLOT( textChanged( const QString& ) ) );
342 346
343 mSecrecyWidget = new SecrecyWidget( categoryBox ); 347 mSecrecyWidget = new SecrecyWidget( categoryBox );
344 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 348 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
345 349
346//US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); 350//US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 );
347 layout->addMultiCellWidget( categoryBox, iii, iii, 0, maxCol ); 351 layout->addMultiCellWidget( categoryBox, iii, iii, 0, maxCol );
348 352
349 // Build the layout and add to the tab widget 353 // Build the layout and add to the tab widget
350 layout->activate(); // required 354 layout->activate(); // required
351 355
352 mTabWidget->addTab( tab1, i18n( "&General" ) ); 356 mTabWidget->addTab( tab1, i18n( "&General" ) );
353} 357}
354 358
359void AddresseeEditorWidget::showCatPopup()
360{
361 mCatPopup->clear();
362 QStringList checkedCategories = QStringList::split (",", mCategoryEdit->text());
363 int index = 0;
364 for (QStringList::Iterator it = KABPrefs::instance()->mCustomCategories.begin ();
365 it != KABPrefs::instance()->mCustomCategories.end ();
366 ++it) {
367 mCatPopup->insertItem (*it, index );
368 //mCategory[index] = *it;
369 if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true);
370 ++index;
371 }
372}
373void AddresseeEditorWidget::selectedCatPopup( int index )
374{
375 QStringList categories = QStringList::split (",", mCategoryEdit->text());
376 QString colcat = categories.first();
377 if (categories.find ( KABPrefs::instance()->mCustomCategories[index]) != categories.end ())
378 categories.remove (KABPrefs::instance()->mCustomCategories[index]);
379 else
380 categories.insert (categories.end(), KABPrefs::instance()->mCustomCategories[index]);
381 categories.sort ();
382 if ( !colcat.isEmpty() ) {
383 if ( categories.find ( colcat ) != categories.end () ) {
384 categories.remove( colcat );
385 categories.prepend( colcat );
386 }
387 }
388 mCategoryEdit->setText( categories.join(",") );
389 emitModified();
390}
355void AddresseeEditorWidget::setRole2FN() 391void AddresseeEditorWidget::setRole2FN()
356{ 392{
357 if ( mRoleEdit->text().isEmpty() ) return; 393 if ( mRoleEdit->text().isEmpty() ) return;
358 mFormattedNameType = NameEditDialog::CustomName; 394 mFormattedNameType = NameEditDialog::CustomName;
359 mAddressee.setFormattedName( mRoleEdit->text() ); 395 mAddressee.setFormattedName( mRoleEdit->text() );
360 mFormattedNameLabel->setText( mRoleEdit->text() ); 396 mFormattedNameLabel->setText( mRoleEdit->text() );
361 mDirty = true; 397 emitModified();
362} 398}
363void AddresseeEditorWidget::setCompany2FN() 399void AddresseeEditorWidget::setCompany2FN()
364{ 400{
365 if ( mOrgEdit->text().isEmpty() ) return; 401 if ( mOrgEdit->text().isEmpty() ) return;
366 mFormattedNameType = NameEditDialog::CustomName; 402 mFormattedNameType = NameEditDialog::CustomName;
367 mAddressee.setFormattedName( mOrgEdit->text() ); 403 mAddressee.setFormattedName( mOrgEdit->text() );
368 mFormattedNameLabel->setText( mOrgEdit->text() ); 404 mFormattedNameLabel->setText( mOrgEdit->text() );
369 mDirty = true; 405 emitModified();
370} 406}
371 407
372void AddresseeEditorWidget::setupTab1_1() 408void AddresseeEditorWidget::setupTab1_1()
373{ 409{
374 // This is the Address tab 410 // This is the Address tab
375 QWidget *tab1_1 = new QWidget( mTabWidget ); 411 QWidget *tab1_1 = new QWidget( mTabWidget );
376 412
377//US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 ); 413//US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 );
378 QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 ); 414 QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 );
379 layout->setMargin( KDialogBase::marginHintSmall() ); 415 layout->setMargin( KDialogBase::marginHintSmall() );
380 layout->setSpacing( KDialogBase::spacingHintSmall() ); 416 layout->setSpacing( KDialogBase::spacingHintSmall() );
381 417
382 QLabel *label; 418 QLabel *label;
383 KSeparator* bar; 419 KSeparator* bar;
384 QPushButton *button; 420 QPushButton *button;
385 421
386/*US 422/*US
387 ////////////////////////////////// 423 //////////////////////////////////
388 // Upper left group (person info) 424 // Upper left group (person info)
389 425
390 // Person icon 426 // Person icon
391 label = new QLabel( tab1 ); 427 label = new QLabel( tab1 );
392//US ambiguous call. Add one more parameter 428//US ambiguous call. Add one more parameter
393//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 429//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
394 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 430 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
395 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 431 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
396 432
397 // First name 433 // First name
398 button = new QPushButton( i18n( "Name..." ), tab1 ); 434 button = new QPushButton( i18n( "Name..." ), tab1 );
399 QToolTip::add( button, i18n( "Edit the contact's name" ) ); 435 QToolTip::add( button, i18n( "Edit the contact's name" ) );
400 mNameEdit = new KLineEdit( tab1, "mNameEdit" ); 436 mNameEdit = new KLineEdit( tab1, "mNameEdit" );
401 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), 437 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
402 SLOT( nameTextChanged( const QString& ) ) ); 438 SLOT( nameTextChanged( const QString& ) ) );
403 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); 439 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
404 440
405#ifndef KAB_EMBEDDED 441#ifndef KAB_EMBEDDED
406 mNameLabel = new KSqueezedTextLabel( tab1 ); 442 mNameLabel = new KSqueezedTextLabel( tab1 );
407 mNameLabel->hide(); 443 mNameLabel->hide();
408#else //KAB_EMBEDDED 444#else //KAB_EMBEDDED
409qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 445qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
410#endif //KAB_EMBEDDED 446#endif //KAB_EMBEDDED
411 447
412 layout->addWidget( button, 0, 1 ); 448 layout->addWidget( button, 0, 1 );
413 layout->addWidget( mNameEdit, 0, 2 ); 449 layout->addWidget( mNameEdit, 0, 2 );
414 450
415#ifndef KAB_EMBEDDED 451#ifndef KAB_EMBEDDED
416 layout->addWidget( mNameLabel, 0, 2 ); 452 layout->addWidget( mNameLabel, 0, 2 );
417#else //KAB_EMBEDDED 453#else //KAB_EMBEDDED
418qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 454qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
419#endif //KAB_EMBEDDED 455#endif //KAB_EMBEDDED
420 456
421 label = new QLabel( i18n( "Role:" ), tab1 ); 457 label = new QLabel( i18n( "Role:" ), tab1 );
422 mRoleEdit = new KLineEdit( tab1 ); 458 mRoleEdit = new KLineEdit( tab1 );
423 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), 459 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ),
424 SLOT( textChanged( const QString& ) ) ); 460 SLOT( textChanged( const QString& ) ) );
425 label->setBuddy( mRoleEdit ); 461 label->setBuddy( mRoleEdit );
426 layout->addWidget( label, 1, 1 ); 462 layout->addWidget( label, 1, 1 );
427 layout->addWidget( mRoleEdit, 1, 2 ); 463 layout->addWidget( mRoleEdit, 1, 2 );
428 464
429 // Organization 465 // Organization
430 label = new QLabel( i18n( "Organization:" ), tab1 ); 466 label = new QLabel( i18n( "Organization:" ), tab1 );
431 mOrgEdit = new KLineEdit( tab1 ); 467 mOrgEdit = new KLineEdit( tab1 );
432 label->setBuddy( mOrgEdit ); 468 label->setBuddy( mOrgEdit );
433 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), 469 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ),
434 SLOT( textChanged( const QString& ) ) ); 470 SLOT( textChanged( const QString& ) ) );
435 layout->addWidget( label, 2, 1 ); 471 layout->addWidget( label, 2, 1 );
436 layout->addWidget( mOrgEdit, 2, 2 ); 472 layout->addWidget( mOrgEdit, 2, 2 );
437 473
438 // File as (formatted name) 474 // File as (formatted name)
439 label = new QLabel( i18n( "Formatted name:" ), tab1 ); 475 label = new QLabel( i18n( "Formatted name:" ), tab1 );
440#ifndef KAB_EMBEDDED 476#ifndef KAB_EMBEDDED
441 mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); 477 mFormattedNameLabel = new KSqueezedTextLabel( tab1 );
442#else //KAB_EMBEDDED 478#else //KAB_EMBEDDED
443qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 479qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
444#endif //KAB_EMBEDDED 480#endif //KAB_EMBEDDED
445 layout->addWidget( label, 3, 1 ); 481 layout->addWidget( label, 3, 1 );
446#ifndef KAB_EMBEDDED 482#ifndef KAB_EMBEDDED
447 layout->addWidget( mFormattedNameLabel, 3, 2 ); 483 layout->addWidget( mFormattedNameLabel, 3, 2 );
448#else //KAB_EMBEDDED 484#else //KAB_EMBEDDED
449qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); 485qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
450#endif //KAB_EMBEDDED 486#endif //KAB_EMBEDDED
451 487
452 // Left hand separator. This separator doesn't go all the way 488 // Left hand separator. This separator doesn't go all the way
453 // across so the dialog still flows from top to bottom 489 // across so the dialog still flows from top to bottom
454 bar = new KSeparator( KSeparator::HLine, tab1 ); 490 bar = new KSeparator( KSeparator::HLine, tab1 );
455 layout->addMultiCellWidget( bar, 4, 4, 0, 2 ); 491 layout->addMultiCellWidget( bar, 4, 4, 0, 2 );
456 492
457 ////////////////////////////////////// 493 //////////////////////////////////////
458 // Phone numbers (upper right) 494 // Phone numbers (upper right)
459 label = new QLabel( tab1 ); 495 label = new QLabel( tab1 );
460//US loadIcon call is ambiguous. Add one more parameter 496//US loadIcon call is ambiguous. Add one more parameter
461//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); 497//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) );
462 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); 498 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
463 layout->addMultiCellWidget( label, 0, 1, 3, 3 ); 499 layout->addMultiCellWidget( label, 0, 1, 3, 3 );
464 500
465 mPhoneEditWidget = new PhoneEditWidget( tab1 ); 501 mPhoneEditWidget = new PhoneEditWidget( tab1 );
466 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 502 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
467 layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); 503 layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 );
468 504
469 bar = new KSeparator( KSeparator::HLine, tab1 ); 505 bar = new KSeparator( KSeparator::HLine, tab1 );
470 layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); 506 layout->addMultiCellWidget( bar, 4, 4, 3, 6 );
471*/ 507*/
472 ////////////////////////////////////// 508 //////////////////////////////////////
473 // Addresses (lower left) 509 // Addresses (lower left)
474 /* LR 510 /* LR
475 label = new QLabel( tab1_1 ); 511 label = new QLabel( tab1_1 );
476//US loadIcon call is ambiguous. Add one more parameter 512//US loadIcon call is ambiguous. Add one more parameter
477//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) ); 513//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) );
478 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); 514 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) );
479//US layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 515//US layout->addMultiCellWidget( label, 5, 6, 0, 0 );
480 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 516 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
481 */ 517 */
482 518
483 mAddressEditWidget = new AddressEditWidget( tab1_1 ); 519 mAddressEditWidget = new AddressEditWidget( tab1_1 );
484 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 520 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
485//US layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 ); 521//US layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 );
486 layout->addMultiCellWidget( mAddressEditWidget, 0, 4, 0, 1 ); 522 layout->addMultiCellWidget( mAddressEditWidget, 0, 4, 0, 1 );
487 523
488//US 524//US
489/* LR 525/* LR
490 bar = new KSeparator( KSeparator::HLine, tab1_1 ); 526 bar = new KSeparator( KSeparator::HLine, tab1_1 );
491 layout->addMultiCellWidget( bar, 5, 5, 0, 3 ); 527 layout->addMultiCellWidget( bar, 5, 5, 0, 3 );
492*/ 528*/
493 529
494 ////////////////////////////////////// 530 //////////////////////////////////////
495 // Email / Web (lower right) 531 // Email / Web (lower right)
496 /* LR 532 /* LR
497 label = new QLabel( tab1_1 ); 533 label = new QLabel( tab1_1 );
498//US loadIcon call is ambiguous. Add one more parameter 534//US loadIcon call is ambiguous. Add one more parameter
499//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) ); 535//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) );
500 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) ); 536 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) );
501//US layout->addMultiCellWidget( label, 5, 6, 3, 3 ); 537//US layout->addMultiCellWidget( label, 5, 6, 3, 3 );
502 layout->addMultiCellWidget( label, 6, 7, 0, 0 ); 538 layout->addMultiCellWidget( label, 6, 7, 0, 0 );
503 */ 539 */
504 mEmailWidget = new EmailEditWidget( tab1_1 ); 540 mEmailWidget = new EmailEditWidget( tab1_1 );
505 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 541 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
506//US layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 ); 542//US layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 );
507 layout->addMultiCellWidget( mEmailWidget, 5, 6, 0, 1 ); 543 layout->addMultiCellWidget( mEmailWidget, 5, 6, 0, 1 );
508 544
509 /* LR 545 /* LR
510 // add the separator 546 // add the separator
511 bar = new KSeparator( KSeparator::HLine, tab1_1 ); 547 bar = new KSeparator( KSeparator::HLine, tab1_1 );
512//US layout->addMultiCellWidget( bar, 7, 7, 3, 6 ); 548//US layout->addMultiCellWidget( bar, 7, 7, 3, 6 );
513 layout->addMultiCellWidget( bar, 8, 8, 0, 3 ); 549 layout->addMultiCellWidget( bar, 8, 8, 0, 3 );
514 550
515 label = new QLabel( tab1_1 ); 551 label = new QLabel( tab1_1 );
516//US loadIcon call is ambiguous. Add one more parameter 552//US loadIcon call is ambiguous. Add one more parameter
517//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) ); 553//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) );
518 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) ); 554 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) );
519//US layout->addMultiCellWidget( label, 8, 9, 3, 3 ); 555//US layout->addMultiCellWidget( label, 8, 9, 3, 3 );
520 layout->addMultiCellWidget( label, 9, 10, 0, 0 ); 556 layout->addMultiCellWidget( label, 9, 10, 0, 0 );
521 */ 557 */
522 label = new QLabel( i18n( "URL:" ), tab1_1 ); 558 label = new QLabel( i18n( "URL:" ), tab1_1 );
523 mURLEdit = new KLineEdit( tab1_1 ); 559 mURLEdit = new KLineEdit( tab1_1 );
524 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ), 560 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ),
525 SLOT( textChanged( const QString& ) ) ); 561 SLOT( textChanged( const QString& ) ) );
526 label->setBuddy( mURLEdit ); 562 label->setBuddy( mURLEdit );
527//US layout->addWidget( label, 8, 4 ); 563//US layout->addWidget( label, 8, 4 );
528 layout->addWidget( label, 7,0 ); 564 layout->addWidget( label, 7,0 );
529//US layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 ); 565//US layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 );
530 layout->addWidget( mURLEdit, 7, 1); 566 layout->addWidget( mURLEdit, 7, 1);
531 567
532 label = new QLabel( i18n( "&IM address:" ), tab1_1 ); 568 label = new QLabel( i18n( "&IM address:" ), tab1_1 );
533 mIMAddressEdit = new KLineEdit( tab1_1 ); 569 mIMAddressEdit = new KLineEdit( tab1_1 );
534 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ), 570 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ),
535 SLOT( textChanged( const QString& ) ) ); 571 SLOT( textChanged( const QString& ) ) );
536 label->setBuddy( mIMAddressEdit ); 572 label->setBuddy( mIMAddressEdit );
537//US layout->addWidget( label, 9, 4 ); 573//US layout->addWidget( label, 9, 4 );
538 layout->addWidget( label, 8, 0 ); 574 layout->addWidget( label, 8, 0 );
539//US layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 ); 575//US layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 );
540 layout->addWidget( mIMAddressEdit, 8,1 ); 576 layout->addWidget( mIMAddressEdit, 8,1 );
541 577
542//US layout->addColSpacing( 6, 50 ); 578//US layout->addColSpacing( 6, 50 );
543 579
544//US bar = new KSeparator( KSeparator::HLine, tab1_1 ); 580//US bar = new KSeparator( KSeparator::HLine, tab1_1 );
545//US layout->addMultiCellWidget( bar, 10, 10, 0, 6 ); 581//US layout->addMultiCellWidget( bar, 10, 10, 0, 6 );
546 582
547/*US 583/*US
548 /////////////////////////////////////// 584 ///////////////////////////////////////
549 QHBox *categoryBox = new QHBox( tab1 ); 585 QHBox *categoryBox = new QHBox( tab1 );
550 categoryBox->setSpacing( KDialogBase::spacingHintSmall() ); 586 categoryBox->setSpacing( KDialogBase::spacingHintSmall() );
551 587
552 // Categories 588 // Categories
553 button = new QPushButton( i18n( "Categories" ), categoryBox ); 589 button = new QPushButton( i18n( "Categories" ), categoryBox );
554 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); 590 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) );
555 591
556 mCategoryEdit = new KLineEdit( categoryBox ); 592 mCategoryEdit = new KLineEdit( categoryBox );
557 mCategoryEdit->setReadOnly( true ); 593 mCategoryEdit->setReadOnly( true );
558 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), 594 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
559 SLOT( textChanged( const QString& ) ) ); 595 SLOT( textChanged( const QString& ) ) );
560 596
561 mSecrecyWidget = new SecrecyWidget( categoryBox ); 597 mSecrecyWidget = new SecrecyWidget( categoryBox );
562 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 598 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
563 599
564 layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); 600 layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 );
565*/ 601*/
566 // Build the layout and add to the tab widget 602 // Build the layout and add to the tab widget
567 layout->activate(); // required 603 layout->activate(); // required
568 604
569 mTabWidget->addTab( tab1_1, i18n( "&Address" ) ); 605 mTabWidget->addTab( tab1_1, i18n( "&Address" ) );
570} 606}
571 607
572 608
573 609
574void AddresseeEditorWidget::setupTab2() 610void AddresseeEditorWidget::setupTab2()
575{ 611{
576 // This is the Details tab 612 // This is the Details tab
577 QWidget *tab2 = new QWidget( mTabWidget ); 613 QWidget *tab2 = new QWidget( mTabWidget );
578 614
579 QGridLayout *layout = new QGridLayout( tab2, 8, 3 ); 615 QGridLayout *layout = new QGridLayout( tab2, 8, 3 );
580 layout->setMargin( KDialogBase::marginHintSmall() ); 616 layout->setMargin( KDialogBase::marginHintSmall() );
581 layout->setSpacing( KDialogBase::spacingHintSmall() ); 617 layout->setSpacing( KDialogBase::spacingHintSmall() );
582 618
583 QLabel *label; 619 QLabel *label;
584 KSeparator* bar; 620 KSeparator* bar;
585 621
586 /////////////////////// 622 ///////////////////////
587 // Office info 623 // Office info
588 624
589 // Department 625 // Department
590 label = new QLabel( tab2 ); 626 label = new QLabel( tab2 );
591//US loadIcon call is ambiguous. Add one more parameter 627//US loadIcon call is ambiguous. Add one more parameter
592//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); 628//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) );
593 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); 629 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) );
594 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 630 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
595 631
596 label = new QLabel( i18n( "Department:" ), tab2 ); 632 label = new QLabel( i18n( "Department:" ), tab2 );
597 layout->addWidget( label, 0, 1 ); 633 layout->addWidget( label, 0, 1 );
598 mDepartmentEdit = new KLineEdit( tab2 ); 634 mDepartmentEdit = new KLineEdit( tab2 );
599 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), 635 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ),
600 SLOT( textChanged( const QString& ) ) ); 636 SLOT( textChanged( const QString& ) ) );
601 label->setBuddy( mDepartmentEdit ); 637 label->setBuddy( mDepartmentEdit );
602 layout->addWidget( mDepartmentEdit, 0, 2 ); 638 layout->addWidget( mDepartmentEdit, 0, 2 );
603 639
604 label = new QLabel( i18n( "Office:" ), tab2 ); 640 label = new QLabel( i18n( "Office:" ), tab2 );
605 layout->addWidget( label, 1, 1 ); 641 layout->addWidget( label, 1, 1 );
606 mOfficeEdit = new KLineEdit( tab2 ); 642 mOfficeEdit = new KLineEdit( tab2 );
607 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ), 643 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ),
608 SLOT( textChanged( const QString& ) ) ); 644 SLOT( textChanged( const QString& ) ) );
609 label->setBuddy( mOfficeEdit ); 645 label->setBuddy( mOfficeEdit );
610 layout->addWidget( mOfficeEdit, 1, 2 ); 646 layout->addWidget( mOfficeEdit, 1, 2 );
611 647
612 label = new QLabel( i18n( "Profession:" ), tab2 ); 648 label = new QLabel( i18n( "Profession:" ), tab2 );
613 layout->addWidget( label, 2, 1 ); 649 layout->addWidget( label, 2, 1 );
614 mProfessionEdit = new KLineEdit( tab2 ); 650 mProfessionEdit = new KLineEdit( tab2 );
615 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ), 651 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ),
616 SLOT( textChanged( const QString& ) ) ); 652 SLOT( textChanged( const QString& ) ) );
617 label->setBuddy( mProfessionEdit ); 653 label->setBuddy( mProfessionEdit );
618 layout->addWidget( mProfessionEdit, 2, 2 ); 654 layout->addWidget( mProfessionEdit, 2, 2 );
619 655
620 label = new QLabel( i18n( "Manager\'s name:" ), tab2 ); 656 label = new QLabel( i18n( "Manager\'s name:" ), tab2 );
621//US layout->addWidget( label, 0, 3 ); 657//US layout->addWidget( label, 0, 3 );
622 layout->addWidget( label, 3, 1 ); 658 layout->addWidget( label, 3, 1 );
623 mManagerEdit = new KLineEdit( tab2 ); 659 mManagerEdit = new KLineEdit( tab2 );
624 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ), 660 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ),
625 SLOT( textChanged( const QString& ) ) ); 661 SLOT( textChanged( const QString& ) ) );
626 label->setBuddy( mManagerEdit ); 662 label->setBuddy( mManagerEdit );
627//US layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 ); 663//US layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 );
628 layout->addWidget( mManagerEdit, 3, 2 ); 664 layout->addWidget( mManagerEdit, 3, 2 );
629 665
630 label = new QLabel( i18n( "Assistant's name:" ), tab2 ); 666 label = new QLabel( i18n( "Assistant's name:" ), tab2 );
631//US layout->addWidget( label, 1, 3 ); 667//US layout->addWidget( label, 1, 3 );
632 layout->addWidget( label, 4, 1 ); 668 layout->addWidget( label, 4, 1 );
633 mAssistantEdit = new KLineEdit( tab2 ); 669 mAssistantEdit = new KLineEdit( tab2 );
634 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ), 670 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ),
635 SLOT( textChanged( const QString& ) ) ); 671 SLOT( textChanged( const QString& ) ) );
636 label->setBuddy( mAssistantEdit ); 672 label->setBuddy( mAssistantEdit );
637//US layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 ); 673//US layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 );
638 layout->addWidget( mAssistantEdit, 4, 2 ); 674 layout->addWidget( mAssistantEdit, 4, 2 );
639 675
640 bar = new KSeparator( KSeparator::HLine, tab2 ); 676 bar = new KSeparator( KSeparator::HLine, tab2 );
641//US layout->addMultiCellWidget( bar, 3, 3, 0, 5 ); 677//US layout->addMultiCellWidget( bar, 3, 3, 0, 5 );
642 layout->addMultiCellWidget( bar, 5, 5, 0, 2 ); 678 layout->addMultiCellWidget( bar, 5, 5, 0, 2 );
643 679
644 ///////////////////////////////////////////////// 680 /////////////////////////////////////////////////
645 // Personal info 681 // Personal info
646 682
647 //label = new QLabel( tab2 ); 683 //label = new QLabel( tab2 );
648//US loadIcon call is ambiguous. Add one more parameter 684//US loadIcon call is ambiguous. Add one more parameter
649//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 685//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
650 //label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 686 //label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
651//US layout->addMultiCellWidget( label, 4, 5, 0, 0 ); 687//US layout->addMultiCellWidget( label, 4, 5, 0, 0 );
652 //layout->addMultiCellWidget( label, 6, 7, 0, 0 ); 688 //layout->addMultiCellWidget( label, 6, 7, 0, 0 );
653 689
654 690
655 int iii = 6; 691 int iii = 6;
656 692
657 if ( QApplication::desktop()->width() == 640 ) { 693 if ( QApplication::desktop()->width() == 640 ) {
658 QHBox * nbox = new QHBox ( tab2 ); 694 QHBox * nbox = new QHBox ( tab2 );
659 label = new QLabel( i18n( "Nick name:" )+" ", nbox ); 695 label = new QLabel( i18n( "Nick name:" )+" ", nbox );
660 mNicknameEdit = new KLineEdit( nbox ); 696 mNicknameEdit = new KLineEdit( nbox );
661 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 697 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
662 SLOT( textChanged( const QString& ) ) ); 698 SLOT( textChanged( const QString& ) ) );
663 label->setBuddy( mNicknameEdit ); 699 label->setBuddy( mNicknameEdit );
664 700
665 label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox ); 701 label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox );
666 mSpouseEdit = new KLineEdit( nbox ); 702 mSpouseEdit = new KLineEdit( nbox );
667 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 703 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
668 SLOT( textChanged( const QString& ) ) ); 704 SLOT( textChanged( const QString& ) ) );
669 label->setBuddy( mSpouseEdit ); 705 label->setBuddy( mSpouseEdit );
670 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 ); 706 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
671 ++iii; 707 ++iii;
672 708
673 } else { 709 } else {
674 label = new QLabel( i18n( "Nick name:" ), tab2 ); 710 label = new QLabel( i18n( "Nick name:" ), tab2 );
675 layout->addWidget( label, iii, 1 ); 711 layout->addWidget( label, iii, 1 );
676 mNicknameEdit = new KLineEdit( tab2 ); 712 mNicknameEdit = new KLineEdit( tab2 );
677 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 713 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
678 SLOT( textChanged( const QString& ) ) ); 714 SLOT( textChanged( const QString& ) ) );
679 label->setBuddy( mNicknameEdit ); 715 label->setBuddy( mNicknameEdit );
680 layout->addWidget( mNicknameEdit, iii, 2 ); 716 layout->addWidget( mNicknameEdit, iii, 2 );
681 ++iii; 717 ++iii;
682 718
683 label = new QLabel( i18n( "Spouse's name:" ), tab2 ); 719 label = new QLabel( i18n( "Spouse's name:" ), tab2 );
684 layout->addWidget( label, iii, 1 ); 720 layout->addWidget( label, iii, 1 );
685 mSpouseEdit = new KLineEdit( tab2 ); 721 mSpouseEdit = new KLineEdit( tab2 );
686 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 722 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
687 SLOT( textChanged( const QString& ) ) ); 723 SLOT( textChanged( const QString& ) ) );
688 label->setBuddy( mSpouseEdit ); 724 label->setBuddy( mSpouseEdit );
689 layout->addWidget( mSpouseEdit, iii, 2 ); 725 layout->addWidget( mSpouseEdit, iii, 2 );
690 ++iii; 726 ++iii;
691 } 727 }
692 728
693 label = new QLabel( i18n( "Children's names:" ), tab2 ); 729 label = new QLabel( i18n( "Children's names:" ), tab2 );
694 layout->addWidget( label, iii, 1 ); 730 layout->addWidget( label, iii, 1 );
695 mChildEdit = new KLineEdit( tab2 ); 731 mChildEdit = new KLineEdit( tab2 );
696 connect( mChildEdit, SIGNAL( textChanged( const QString& ) ), 732 connect( mChildEdit, SIGNAL( textChanged( const QString& ) ),
697 SLOT( textChanged( const QString& ) ) ); 733 SLOT( textChanged( const QString& ) ) );
698 label->setBuddy( mChildEdit ); 734 label->setBuddy( mChildEdit );
699 layout->addWidget( mChildEdit, iii, 2 ); 735 layout->addWidget( mChildEdit, iii, 2 );
700 ++iii; 736 ++iii;
701 if ( QApplication::desktop()->width() == 640 ) { 737 if ( QApplication::desktop()->width() == 640 ) {
702 QHBox * nbox = new QHBox ( tab2 ); 738 QHBox * nbox = new QHBox ( tab2 );
703 label = new QLabel( i18n( "Birthday:" )+" ", nbox ); 739 label = new QLabel( i18n( "Birthday:" )+" ", nbox );
704 mBirthdayPicker = new KDateEdit( nbox ); 740 mBirthdayPicker = new KDateEdit( nbox );
705 //mBirthdayPicker->toggleDateFormat(); 741 //mBirthdayPicker->toggleDateFormat();
706 mBirthdayPicker->setHandleInvalid( true ); 742 mBirthdayPicker->setHandleInvalid( true );
707 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 743 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
708 SLOT( dateChanged( QDate ) ) ); 744 SLOT( dateChanged( QDate ) ) );
709 745
710 label->setBuddy( mBirthdayPicker ); 746 label->setBuddy( mBirthdayPicker );
711 747
712 label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox ); 748 label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox );
713 mAnniversaryPicker = new KDateEdit( nbox ); 749 mAnniversaryPicker = new KDateEdit( nbox );
714 mAnniversaryPicker->setHandleInvalid( true ); 750 mAnniversaryPicker->setHandleInvalid( true );
715 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), 751 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
716 SLOT( dateChanged( QDate ) ) ); 752 SLOT( dateChanged( QDate ) ) );
717 753
718 label->setBuddy( mAnniversaryPicker ); 754 label->setBuddy( mAnniversaryPicker );
719 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 ); 755 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
720 ++iii; 756 ++iii;
721 757
722 } else { 758 } else {
723 759
724 label = new QLabel( i18n( "Birthday:" ), tab2 ); 760 label = new QLabel( i18n( "Birthday:" ), tab2 );
725 layout->addWidget( label, iii, 1 ); 761 layout->addWidget( label, iii, 1 );
726 mBirthdayPicker = new KDateEdit( tab2 ); 762 mBirthdayPicker = new KDateEdit( tab2 );
727 //mBirthdayPicker->toggleDateFormat(); 763 //mBirthdayPicker->toggleDateFormat();
728 mBirthdayPicker->setHandleInvalid( true ); 764 mBirthdayPicker->setHandleInvalid( true );
729 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 765 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
730 SLOT( dateChanged( QDate ) ) ); 766 SLOT( dateChanged( QDate ) ) );
731 767
732 label->setBuddy( mBirthdayPicker ); 768 label->setBuddy( mBirthdayPicker );
733 layout->addWidget( mBirthdayPicker, iii, 2 ); 769 layout->addWidget( mBirthdayPicker, iii, 2 );
734 ++iii; 770 ++iii;
735 771
736 label = new QLabel( i18n( "Anniversary:" ), tab2 ); 772 label = new QLabel( i18n( "Anniversary:" ), tab2 );
737 layout->addWidget( label, iii, 1 ); 773 layout->addWidget( label, iii, 1 );
738 mAnniversaryPicker = new KDateEdit( tab2 ); 774 mAnniversaryPicker = new KDateEdit( tab2 );
739 mAnniversaryPicker->setHandleInvalid( true ); 775 mAnniversaryPicker->setHandleInvalid( true );
740 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), 776 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
741 SLOT( dateChanged( QDate ) ) ); 777 SLOT( dateChanged( QDate ) ) );
742 778
743 label->setBuddy( mAnniversaryPicker ); 779 label->setBuddy( mAnniversaryPicker );
744 layout->addWidget( mAnniversaryPicker, iii, 2 ); 780 layout->addWidget( mAnniversaryPicker, iii, 2 );
745 ++iii; 781 ++iii;
746 782
747 } 783 }
748 784
749 label = new QLabel( i18n( "Gender:" ), tab2 ); 785 label = new QLabel( i18n( "Gender:" ), tab2 );
750 layout->addWidget( label, iii, 1 ); 786 layout->addWidget( label, iii, 1 );
751 mGenderBox = new QComboBox ( tab2 ); 787 mGenderBox = new QComboBox ( tab2 );
752 mGenderBox->insertItem ( i18n( "ALIEN (undefined)" )); 788 mGenderBox->insertItem ( i18n( "ALIEN (undefined)" ));
753 mGenderBox->insertItem ( i18n( "female" )); 789 mGenderBox->insertItem ( i18n( "female" ));
754 mGenderBox->insertItem ( i18n( "male" )); 790 mGenderBox->insertItem ( i18n( "male" ));
755 connect( mGenderBox, SIGNAL( activated ( const QString & ) ), 791 connect( mGenderBox, SIGNAL( activated ( const QString & ) ),
756 SLOT( textChanged( const QString& ) ) ); 792 SLOT( textChanged( const QString& ) ) );
757 label->setBuddy( mGenderBox ); 793 label->setBuddy( mGenderBox );
758 layout->addWidget( mGenderBox, iii, 2 ); 794 layout->addWidget( mGenderBox, iii, 2 );
759 ++iii; 795 ++iii;
760 // Build the layout and add to the tab widget 796 // Build the layout and add to the tab widget
761 layout->activate(); // required 797 layout->activate(); // required
762 798
763 mTabWidget->addTab( tab2, i18n( "&Details" ) ); 799 mTabWidget->addTab( tab2, i18n( "&Details" ) );
764} 800}
765 801
766void AddresseeEditorWidget::setupTab2_1() 802void AddresseeEditorWidget::setupTab2_1()
767{ 803{
768 // This is the Details tab 804 // This is the Details tab
769 QWidget *tab2_2 = new QWidget( mTabWidget ); 805 QWidget *tab2_2 = new QWidget( mTabWidget );
770 806
771 QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 ); 807 QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 );
772 layout->setMargin( KDialogBase::marginHintSmall() ); 808 layout->setMargin( KDialogBase::marginHintSmall() );
773 layout->setSpacing( KDialogBase::spacingHintSmall() ); 809 layout->setSpacing( KDialogBase::spacingHintSmall() );
774 810
775 QLabel *label; 811 QLabel *label;
776 KSeparator* bar; 812 KSeparator* bar;
777 813
778/*US 814/*US
779 /////////////////////// 815 ///////////////////////
780 // Office info 816 // Office info
781 817
782 // Department 818 // Department
783 label = new QLabel( tab2 ); 819 label = new QLabel( tab2 );
784//US loadIcon call is ambiguous. Add one more parameter 820//US loadIcon call is ambiguous. Add one more parameter
785//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); 821//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) );
786 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); 822 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) );
787 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 823 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
788 824
789 label = new QLabel( i18n( "Department:" ), tab2 ); 825 label = new QLabel( i18n( "Department:" ), tab2 );
790 layout->addWidget( label, 0, 1 ); 826 layout->addWidget( label, 0, 1 );
791 mDepartmentEdit = new KLineEdit( tab2 ); 827 mDepartmentEdit = new KLineEdit( tab2 );
792 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), 828 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ),
793 SLOT( textChanged( const QString& ) ) ); 829 SLOT( textChanged( const QString& ) ) );
794 label->setBuddy( mDepartmentEdit ); 830 label->setBuddy( mDepartmentEdit );
795 layout->addWidget( mDepartmentEdit, 0, 2 ); 831 layout->addWidget( mDepartmentEdit, 0, 2 );
796 832
797 label = new QLabel( i18n( "Office:" ), tab2 ); 833 label = new QLabel( i18n( "Office:" ), tab2 );
798 layout->addWidget( label, 1, 1 ); 834 layout->addWidget( label, 1, 1 );
799 mOfficeEdit = new KLineEdit( tab2 ); 835 mOfficeEdit = new KLineEdit( tab2 );
800 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ), 836 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ),
801 SLOT( textChanged( const QString& ) ) ); 837 SLOT( textChanged( const QString& ) ) );
802 label->setBuddy( mOfficeEdit ); 838 label->setBuddy( mOfficeEdit );
803 layout->addWidget( mOfficeEdit, 1, 2 ); 839 layout->addWidget( mOfficeEdit, 1, 2 );
804 840
805 label = new QLabel( i18n( "Profession:" ), tab2 ); 841 label = new QLabel( i18n( "Profession:" ), tab2 );
806 layout->addWidget( label, 2, 1 ); 842 layout->addWidget( label, 2, 1 );
807 mProfessionEdit = new KLineEdit( tab2 ); 843 mProfessionEdit = new KLineEdit( tab2 );
808 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ), 844 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ),
809 SLOT( textChanged( const QString& ) ) ); 845 SLOT( textChanged( const QString& ) ) );
810 label->setBuddy( mProfessionEdit ); 846 label->setBuddy( mProfessionEdit );
811 layout->addWidget( mProfessionEdit, 2, 2 ); 847 layout->addWidget( mProfessionEdit, 2, 2 );
812 848
813 label = new QLabel( i18n( "Manager\'s name:" ), tab2 ); 849 label = new QLabel( i18n( "Manager\'s name:" ), tab2 );
814 layout->addWidget( label, 0, 3 ); 850 layout->addWidget( label, 0, 3 );
815 mManagerEdit = new KLineEdit( tab2 ); 851 mManagerEdit = new KLineEdit( tab2 );
816 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ), 852 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ),
817 SLOT( textChanged( const QString& ) ) ); 853 SLOT( textChanged( const QString& ) ) );
818 label->setBuddy( mManagerEdit ); 854 label->setBuddy( mManagerEdit );
819 layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 ); 855 layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 );
820 856
821 label = new QLabel( i18n( "Assistant's name:" ), tab2 ); 857 label = new QLabel( i18n( "Assistant's name:" ), tab2 );
822 layout->addWidget( label, 1, 3 ); 858 layout->addWidget( label, 1, 3 );
823 mAssistantEdit = new KLineEdit( tab2 ); 859 mAssistantEdit = new KLineEdit( tab2 );
824 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ), 860 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ),
825 SLOT( textChanged( const QString& ) ) ); 861 SLOT( textChanged( const QString& ) ) );
826 label->setBuddy( mAssistantEdit ); 862 label->setBuddy( mAssistantEdit );
827 layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 ); 863 layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 );
828 864
829 bar = new KSeparator( KSeparator::HLine, tab2 ); 865 bar = new KSeparator( KSeparator::HLine, tab2 );
830 layout->addMultiCellWidget( bar, 3, 3, 0, 5 ); 866 layout->addMultiCellWidget( bar, 3, 3, 0, 5 );
831 867
832 ///////////////////////////////////////////////// 868 /////////////////////////////////////////////////
833 // Personal info 869 // Personal info
834 870
835 label = new QLabel( tab2 ); 871 label = new QLabel( tab2 );
836//US loadIcon call is ambiguous. Add one more parameter 872//US loadIcon call is ambiguous. Add one more parameter
837//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 873//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
838 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 874 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
839 layout->addMultiCellWidget( label, 4, 5, 0, 0 ); 875 layout->addMultiCellWidget( label, 4, 5, 0, 0 );
840 876
841 label = new QLabel( i18n( "Nick name:" ), tab2 ); 877 label = new QLabel( i18n( "Nick name:" ), tab2 );
842 layout->addWidget( label, 4, 1 ); 878 layout->addWidget( label, 4, 1 );
843 mNicknameEdit = new KLineEdit( tab2 ); 879 mNicknameEdit = new KLineEdit( tab2 );
844 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 880 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
845 SLOT( textChanged( const QString& ) ) ); 881 SLOT( textChanged( const QString& ) ) );
846 label->setBuddy( mNicknameEdit ); 882 label->setBuddy( mNicknameEdit );
847 layout->addWidget( mNicknameEdit, 4, 2 ); 883 layout->addWidget( mNicknameEdit, 4, 2 );
848 884
849 label = new QLabel( i18n( "Spouse's name:" ), tab2 ); 885 label = new QLabel( i18n( "Spouse's name:" ), tab2 );
850 layout->addWidget( label, 5, 1 ); 886 layout->addWidget( label, 5, 1 );
851 mSpouseEdit = new KLineEdit( tab2 ); 887 mSpouseEdit = new KLineEdit( tab2 );
852 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 888 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
853 SLOT( textChanged( const QString& ) ) ); 889 SLOT( textChanged( const QString& ) ) );
854 label->setBuddy( mSpouseEdit ); 890 label->setBuddy( mSpouseEdit );
855 layout->addWidget( mSpouseEdit, 5, 2 ); 891 layout->addWidget( mSpouseEdit, 5, 2 );
856 892
857 label = new QLabel( i18n( "Birthday:" ), tab2 ); 893 label = new QLabel( i18n( "Birthday:" ), tab2 );
858 layout->addWidget( label, 4, 3 ); 894 layout->addWidget( label, 4, 3 );
859 mBirthdayPicker = new KDateEdit( tab2 ); 895 mBirthdayPicker = new KDateEdit( tab2 );
860 mBirthdayPicker->setHandleInvalid( true ); 896 mBirthdayPicker->setHandleInvalid( true );
861 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 897 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
862 SLOT( dateChanged( QDate ) ) ); 898 SLOT( dateChanged( QDate ) ) );
863 connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ), 899 connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ),
864 SLOT( invalidDate() ) ); 900 SLOT( invalidDate() ) );
865 connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ), 901 connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ),
866 SLOT( emitModified() ) ); 902 SLOT( emitModified() ) );
867 label->setBuddy( mBirthdayPicker ); 903 label->setBuddy( mBirthdayPicker );
868 layout->addWidget( mBirthdayPicker, 4, 4 ); 904 layout->addWidget( mBirthdayPicker, 4, 4 );
869 905
870 label = new QLabel( i18n( "Anniversary:" ), tab2 ); 906 label = new QLabel( i18n( "Anniversary:" ), tab2 );
871 layout->addWidget( label, 5, 3 ); 907 layout->addWidget( label, 5, 3 );
872 mAnniversaryPicker = new KDateEdit( tab2 ); 908 mAnniversaryPicker = new KDateEdit( tab2 );
873 mAnniversaryPicker->setHandleInvalid( true ); 909 mAnniversaryPicker->setHandleInvalid( true );
874 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), 910 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
875 SLOT( dateChanged( QDate ) ) ); 911 SLOT( dateChanged( QDate ) ) );
876 connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ), 912 connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ),
877 SLOT( invalidDate() ) ); 913 SLOT( invalidDate() ) );
878 connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ), 914 connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ),
879 SLOT( emitModified() ) ); 915 SLOT( emitModified() ) );
880 label->setBuddy( mAnniversaryPicker ); 916 label->setBuddy( mAnniversaryPicker );
881 layout->addWidget( mAnniversaryPicker, 5, 4 ); 917 layout->addWidget( mAnniversaryPicker, 5, 4 );
diff --git a/kaddressbook/addresseeeditorwidget.h b/kaddressbook/addresseeeditorwidget.h
index eaf5b16..1703e2f 100644
--- a/kaddressbook/addresseeeditorwidget.h
+++ b/kaddressbook/addresseeeditorwidget.h
@@ -1,188 +1,191 @@
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 showCatPopup();
93 void selectedCatPopup( int );
92 void setRole2FN(); 94 void setRole2FN();
93 void setCompany2FN(); 95 void setCompany2FN();
94 void textChanged( const QString& ); 96 void textChanged( const QString& );
95 void pageChanged( QWidget *wdg ); 97 void pageChanged( QWidget *wdg );
96 98
97 /** 99 /**
98 Emits the modified signal and sets the dirty flag. Any slot 100 Emits the modified signal and sets the dirty flag. Any slot
99 that modifies data should use this method instead of calling emit 101 that modifies data should use this method instead of calling emit
100 modified() directly. 102 modified() directly.
101 */ 103 */
102 void emitModified(); 104 void emitModified();
103 105
104 void dateChanged( QDate ); 106 void dateChanged( QDate );
105 void invalidDate(); 107 void invalidDate();
106 void nameTextChanged( const QString& ); 108 void nameTextChanged( const QString& );
107 void nameBoxChanged(); 109 void nameBoxChanged();
108 void nameButtonClicked(); 110 void nameButtonClicked();
109 void categoryButtonClicked(); 111 void categoryButtonClicked();
110 112
111 /** 113 /**
112 Called whenever the categories change in the categories dialog. 114 Called whenever the categories change in the categories dialog.
113 */ 115 */
114 void categoriesSelected( const QStringList& ); 116 void categoriesSelected( const QStringList& );
115 117
116 /** 118 /**
117 Edits which categories are available in the CategorySelectDialog. 119 Edits which categories are available in the CategorySelectDialog.
118 */ 120 */
119 void editCategories(); 121 void editCategories();
120 122
121 private: 123 private:
122 AddresseeConfig * mAConfig; 124 AddresseeConfig * mAConfig;
123 void initGUI(); 125 void initGUI();
124 void setupTab1(); 126 void setupTab1();
125 void setupTab1_1(); 127 void setupTab1_1();
126 void setupTab2(); 128 void setupTab2();
127 void setupTab2_1(); 129 void setupTab2_1();
128 void setupTab3(); 130 void setupTab3();
129 void setupTab3_1(); 131 void setupTab3_1();
130 132
131 KABC::Addressee mAddressee; 133 KABC::Addressee mAddressee;
132 int mFormattedNameType; 134 int mFormattedNameType;
133 bool mDirty; 135 bool mDirty;
134 bool mIsExtension; 136 bool mIsExtension;
135 bool mBlockSignals; 137 bool mBlockSignals;
136 138
137 // GUI 139 // GUI
138 KPIM::CategorySelectDialog *mCategoryDialog; 140 KPIM::CategorySelectDialog *mCategoryDialog;
139 KPIM::CategoryEditDialog *mCategoryEditDialog; 141 KPIM::CategoryEditDialog *mCategoryEditDialog;
140 QTabWidget *mTabWidget; 142 QTabWidget *mTabWidget;
141 143
142 // Tab1 and Tab1_1 144 // Tab1 and Tab1_1
143 KLineEdit *mNameEdit; 145 KLineEdit *mNameEdit;
144 KLineEdit *mRoleEdit; 146 KLineEdit *mRoleEdit;
145 KLineEdit *mOrgEdit; 147 KLineEdit *mOrgEdit;
146 148
147 KSqueezedTextLabel *mFormattedNameLabel; 149 KSqueezedTextLabel *mFormattedNameLabel;
148 AddressEditWidget *mAddressEditWidget; 150 AddressEditWidget *mAddressEditWidget;
149 EmailEditWidget *mEmailWidget; 151 EmailEditWidget *mEmailWidget;
150 PhoneEditWidget *mPhoneEditWidget; 152 PhoneEditWidget *mPhoneEditWidget;
151 KLineEdit *mURLEdit; 153 KLineEdit *mURLEdit;
152 KLineEdit *mIMAddressEdit; 154 KLineEdit *mIMAddressEdit;
153 KLineEdit *mCategoryEdit; 155 QPushButton *mCategoryEdit;
156 QPopupMenu *mCatPopup;
154 SecrecyWidget *mSecrecyWidget; 157 SecrecyWidget *mSecrecyWidget;
155 KSqueezedTextLabel *mNameLabel; 158 KSqueezedTextLabel *mNameLabel;
156 159
157 // Tab2 and Tab2_2 160 // Tab2 and Tab2_2
158 KLineEdit *mDepartmentEdit; 161 KLineEdit *mDepartmentEdit;
159 KLineEdit *mOfficeEdit; 162 KLineEdit *mOfficeEdit;
160 KLineEdit *mProfessionEdit; 163 KLineEdit *mProfessionEdit;
161 KLineEdit *mManagerEdit; 164 KLineEdit *mManagerEdit;
162 KLineEdit *mAssistantEdit; 165 KLineEdit *mAssistantEdit;
163 KLineEdit *mNicknameEdit; 166 KLineEdit *mNicknameEdit;
164 KLineEdit *mSpouseEdit; 167 KLineEdit *mSpouseEdit;
165 KLineEdit *mChildEdit; 168 KLineEdit *mChildEdit;
166 QComboBox *mGenderBox; 169 QComboBox *mGenderBox;
167 KDateEdit *mBirthdayPicker; 170 KDateEdit *mBirthdayPicker;
168 KDateEdit *mAnniversaryPicker; 171 KDateEdit *mAnniversaryPicker;
169#ifndef KAB_EMBEDDED 172#ifndef KAB_EMBEDDED
170 QTextEdit *mNoteEdit; 173 QTextEdit *mNoteEdit;
171#else //KAB_EMBEDDED 174#else //KAB_EMBEDDED
172 QMultiLineEdit *mNoteEdit; 175 QMultiLineEdit *mNoteEdit;
173#endif //KAB_EMBEDDED 176#endif //KAB_EMBEDDED
174 177
175 QSpinBox *mTimeZoneSpin; 178 QSpinBox *mTimeZoneSpin;
176 QSpinBox *mGeoLat; 179 QSpinBox *mGeoLat;
177 QSpinBox *mGeoLon; 180 QSpinBox *mGeoLon;
178 181
179 // Tab3 182 // Tab3
180 GeoWidget *mGeoWidget; 183 GeoWidget *mGeoWidget;
181 ImageWidget *mImageWidget; 184 ImageWidget *mImageWidget;
182#ifndef KAB_EMBEDDED 185#ifndef KAB_EMBEDDED
183 SoundWidget *mSoundWidget; 186 SoundWidget *mSoundWidget;
184#endif //KAB_EMBEDDED 187#endif //KAB_EMBEDDED
185 KeyWidget *mKeyWidget; 188 KeyWidget *mKeyWidget;
186}; 189};
187 190
188#endif 191#endif