summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-11-13 12:51:35 (UTC)
committer zautrix <zautrix>2005-11-13 12:51:35 (UTC)
commit59a3afa458bfb17314017d39c44b102bebb82fa7 (patch) (unidiff)
tree689b1ef7a32d526067c7dddf4a59d19872129b68
parent4145dc4a513d5899d8a2b9e4573d8140d871b386 (diff)
downloadkdepimpi-59a3afa458bfb17314017d39c44b102bebb82fa7.zip
kdepimpi-59a3afa458bfb17314017d39c44b102bebb82fa7.tar.gz
kdepimpi-59a3afa458bfb17314017d39c44b102bebb82fa7.tar.bz2
fix
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,1399 +1,1435 @@
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 );
882 918
883 bar = new KSeparator( KSeparator::HLine, tab2 ); 919 bar = new KSeparator( KSeparator::HLine, tab2 );
884 layout->addMultiCellWidget( bar, 6, 6, 0, 5 ); 920 layout->addMultiCellWidget( bar, 6, 6, 0, 5 );
885*/ 921*/
886 ////////////////////////////////////// 922 //////////////////////////////////////
887 // Notes 923 // Notes
888 label = new QLabel( i18n( "Note:" ), tab2_2 ); 924 label = new QLabel( i18n( "Note:" ), tab2_2 );
889 label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); 925 label->setAlignment( Qt::AlignTop | Qt::AlignLeft );
890//US layout->addWidget( label, 7, 0 ); 926//US layout->addWidget( label, 7, 0 );
891 layout->addWidget( label, 0, 0 ); 927 layout->addWidget( label, 0, 0 );
892#ifndef KAB_EMBEDDED 928#ifndef KAB_EMBEDDED
893 mNoteEdit = new QTextEdit( tab2_2 ); 929 mNoteEdit = new QTextEdit( tab2_2 );
894 mNoteEdit->setWordWrap( QTextEdit::WidgetWidth ); 930 mNoteEdit->setWordWrap( QTextEdit::WidgetWidth );
895 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); 931 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
896#else //KAB_EMBEDDED 932#else //KAB_EMBEDDED
897 mNoteEdit = new QMultiLineEdit( tab2_2 ); 933 mNoteEdit = new QMultiLineEdit( tab2_2 );
898 mNoteEdit->setWordWrap( QMultiLineEdit::WidgetWidth ); 934 mNoteEdit->setWordWrap( QMultiLineEdit::WidgetWidth );
899 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); 935 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
900#endif //KAB_EMBEDDED 936#endif //KAB_EMBEDDED
901 937
902 connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) ); 938 connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) );
903 label->setBuddy( mNoteEdit ); 939 label->setBuddy( mNoteEdit );
904//US layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 ); 940//US layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 );
905 layout->addWidget( mNoteEdit, 1, 0); 941 layout->addWidget( mNoteEdit, 1, 0);
906 942
907 // Build the layout and add to the tab widget 943 // Build the layout and add to the tab widget
908 layout->activate(); // required 944 layout->activate(); // required
909 945
910 mTabWidget->addTab( tab2_2, i18n( "&Notes" ) ); 946 mTabWidget->addTab( tab2_2, i18n( "&Notes" ) );
911} 947}
912 948
913 949
914 950
915void AddresseeEditorWidget::setupTab3() 951void AddresseeEditorWidget::setupTab3()
916{ 952{
917 // This is the Misc tab 953 // This is the Misc tab
918 QWidget *tab3 = new QWidget( mTabWidget ); 954 QWidget *tab3 = new QWidget( mTabWidget );
919 955
920 QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); 956 QGridLayout *layout = new QGridLayout( tab3, 1, 1 );
921 layout->setMargin( KDialogBase::marginHintSmall() ); 957 layout->setMargin( KDialogBase::marginHintSmall() );
922 layout->setSpacing( KDialogBase::spacingHintSmall() ); 958 layout->setSpacing( KDialogBase::spacingHintSmall() );
923//US layout->setColStretch( 2, 1 ); 959//US layout->setColStretch( 2, 1 );
924 960
925 ////////////////////////////////////// 961 //////////////////////////////////////
926 // Geo 962 // Geo
927 mGeoWidget = new GeoWidget( tab3 ); 963 mGeoWidget = new GeoWidget( tab3 );
928 // mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); 964 // mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() );
929 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 965 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
930 layout->addWidget( mGeoWidget, 0, 0 ); 966 layout->addWidget( mGeoWidget, 0, 0 );
931/*US 967/*US
932 ////////////////////////////////////// 968 //////////////////////////////////////
933 // Sound 969 // Sound
934#ifndef KAB_EMBEDDED 970#ifndef KAB_EMBEDDED
935 mSoundWidget = new SoundWidget( tab3 ); 971 mSoundWidget = new SoundWidget( tab3 );
936 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); 972 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() );
937 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 973 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
938 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); 974 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop );
939#else //KAB_EMBEDDED 975#else //KAB_EMBEDDED
940qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); 976qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed");
941#endif //KAB_EMBEDDED 977#endif //KAB_EMBEDDED
942 978
943 ////////////////////////////////////// 979 //////////////////////////////////////
944 // Images 980 // Images
945 mImageWidget = new ImageWidget( tab3 ); 981 mImageWidget = new ImageWidget( tab3 );
946 mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); 982 mImageWidget->setMinimumSize( mImageWidget->sizeHint() );
947 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 983 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
948 layout->addWidget( mImageWidget, 1, 0, Qt::AlignTop ); 984 layout->addWidget( mImageWidget, 1, 0, Qt::AlignTop );
949*/ 985*/
950//US 986//US
951/* 987/*
952 KSeparator* bar = new KSeparator( KSeparator::HLine, tab3 ); 988 KSeparator* bar = new KSeparator( KSeparator::HLine, tab3 );
953 layout->addMultiCellWidget( bar, 1, 1, 0, 0 ); 989 layout->addMultiCellWidget( bar, 1, 1, 0, 0 );
954*/ 990*/
955 ////////////////////////////////////// 991 //////////////////////////////////////
956 // Keys 992 // Keys
957 mKeyWidget = new KeyWidget( tab3 ); 993 mKeyWidget = new KeyWidget( tab3 );
958 //mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); 994 //mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() );
959 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 995 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
960//US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); 996//US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop );
961 layout->addWidget( mKeyWidget, 1, 0 ); 997 layout->addWidget( mKeyWidget, 1, 0 );
962 998
963 mTabWidget->addTab( tab3, i18n( "&Misc" ) ); 999 mTabWidget->addTab( tab3, i18n( "&Misc" ) );
964} 1000}
965 1001
966void AddresseeEditorWidget::setupTab3_1() 1002void AddresseeEditorWidget::setupTab3_1()
967{ 1003{
968 // This is the Misc tab 1004 // This is the Misc tab
969 QWidget *tab3 = new QWidget( mTabWidget ); 1005 QWidget *tab3 = new QWidget( mTabWidget );
970 1006
971//US QGridLayout *layout = new QGridLayout( tab3, 2, 3 ); 1007//US QGridLayout *layout = new QGridLayout( tab3, 2, 3 );
972 QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); 1008 QGridLayout *layout = new QGridLayout( tab3, 1, 1 );
973 layout->setMargin( KDialogBase::marginHint() ); 1009 layout->setMargin( KDialogBase::marginHint() );
974 layout->setSpacing( KDialogBase::spacingHint() ); 1010 layout->setSpacing( KDialogBase::spacingHint() );
975//US layout->setColStretch( 2, 1 ); 1011//US layout->setColStretch( 2, 1 );
976 1012
977/*US 1013/*US
978 ////////////////////////////////////// 1014 //////////////////////////////////////
979 // Geo 1015 // Geo
980 mGeoWidget = new GeoWidget( tab3 ); 1016 mGeoWidget = new GeoWidget( tab3 );
981 mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); 1017 mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() );
982 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 1018 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
983 layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop ); 1019 layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop );
984*/ 1020*/
985 ////////////////////////////////////// 1021 //////////////////////////////////////
986 // Sound 1022 // Sound
987#ifndef KAB_EMBEDDED 1023#ifndef KAB_EMBEDDED
988 mSoundWidget = new SoundWidget( tab3 ); 1024 mSoundWidget = new SoundWidget( tab3 );
989 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); 1025 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() );
990 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 1026 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
991 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); 1027 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop );
992#else //KAB_EMBEDDED 1028#else //KAB_EMBEDDED
993//US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); 1029//US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed");
994#endif //KAB_EMBEDDED 1030#endif //KAB_EMBEDDED
995 1031
996 ////////////////////////////////////// 1032 //////////////////////////////////////
997 // Images 1033 // Images
998 mImageWidget = new ImageWidget( tab3 ); 1034 mImageWidget = new ImageWidget( tab3 );
999 mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); 1035 mImageWidget->setMinimumSize( mImageWidget->sizeHint() );
1000 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 1036 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
1001 layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop ); 1037 layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop );
1002/*US 1038/*US
1003 ////////////////////////////////////// 1039 //////////////////////////////////////
1004 // Keys 1040 // Keys
1005 mKeyWidget = new KeyWidget( tab3 ); 1041 mKeyWidget = new KeyWidget( tab3 );
1006 mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); 1042 mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() );
1007 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 1043 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
1008 layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); 1044 layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop );
1009*/ 1045*/
1010 mTabWidget->addTab( tab3, i18n( "&Images" ) ); 1046 mTabWidget->addTab( tab3, i18n( "&Images" ) );
1011} 1047}
1012 1048
1013 1049
1014void AddresseeEditorWidget::load() 1050void AddresseeEditorWidget::load()
1015{ 1051{
1016 1052
1017 // Block signals in case anything tries to emit modified 1053 // Block signals in case anything tries to emit modified
1018 // CS: This doesn't seem to work. 1054 // CS: This doesn't seem to work.
1019 bool block = signalsBlocked(); 1055 bool block = signalsBlocked();
1020 blockSignals( true ); 1056 blockSignals( true );
1021 mBlockSignals = true; // used for internal signal blocking 1057 mBlockSignals = true; // used for internal signal blocking
1022 1058
1023 mNameEdit->setText( mAddressee.assembledName() ); 1059 mNameEdit->setText( mAddressee.assembledName() );
1024 1060
1025 if ( mAddressee.formattedName().isEmpty() ) { 1061 if ( mAddressee.formattedName().isEmpty() ) {
1026//US KConfig config( "kaddressbookrc" ); 1062//US KConfig config( "kaddressbookrc" );
1027 KConfig config( locateLocal("config", "kabcrc") ); 1063 KConfig config( locateLocal("config", "kabcrc") );
1028 config.setGroup( "General" ); 1064 config.setGroup( "General" );
1029 mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 ); 1065 mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 );
1030 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 1066 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
1031 } else {; 1067 } else {;
1032 if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) ) 1068 if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) )
1033 mFormattedNameType = NameEditDialog::SimpleName; 1069 mFormattedNameType = NameEditDialog::SimpleName;
1034 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) ) 1070 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) )
1035 mFormattedNameType = NameEditDialog::FullName; 1071 mFormattedNameType = NameEditDialog::FullName;
1036 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) ) 1072 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) )
1037 mFormattedNameType = NameEditDialog::ReverseName; 1073 mFormattedNameType = NameEditDialog::ReverseName;
1038 else 1074 else
1039 mFormattedNameType = NameEditDialog::CustomName; 1075 mFormattedNameType = NameEditDialog::CustomName;
1040 } 1076 }
1041 1077
1042 mFormattedNameLabel->setText( mAddressee.formattedName() ); 1078 mFormattedNameLabel->setText( mAddressee.formattedName() );
1043 1079
1044 mAConfig->setUid( mAddressee.uid() ); 1080 mAConfig->setUid( mAddressee.uid() );
1045 if ( mAConfig->automaticNameParsing() ) { 1081 if ( mAConfig->automaticNameParsing() ) {
1046 mNameLabel->hide(); 1082 mNameLabel->hide();
1047 mNameEdit->show(); 1083 mNameEdit->show();
1048 } else { 1084 } else {
1049 mNameEdit->hide(); 1085 mNameEdit->hide();
1050 mNameLabel->setText( mNameEdit->text() ); 1086 mNameLabel->setText( mNameEdit->text() );
1051 mNameLabel->show(); 1087 mNameLabel->show();
1052 } 1088 }
1053 1089
1054 mRoleEdit->setText( mAddressee.role() ); 1090 mRoleEdit->setText( mAddressee.role() );
1055 mOrgEdit->setText( mAddressee.organization() ); 1091 mOrgEdit->setText( mAddressee.organization() );
1056 1092
1057//US mURLEdit->setURL( mAddressee.url().url() ); 1093//US mURLEdit->setURL( mAddressee.url().url() );
1058 mURLEdit->setText( mAddressee.url().prettyURL() ); 1094 mURLEdit->setText( mAddressee.url().prettyURL() );
1059//US?? mURLEdit->home( false ); 1095//US?? mURLEdit->home( false );
1060 1096
1061 // mNoteEdit->setText( mAddressee.note() ); 1097 // mNoteEdit->setText( mAddressee.note() );
1062 mNoteEdit->setText( mAddressee.note() ); 1098 mNoteEdit->setText( mAddressee.note() );
1063 mEmailWidget->setEmails( mAddressee.emails() ); 1099 mEmailWidget->setEmails( mAddressee.emails() );
1064 mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() ); 1100 mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() );
1065 mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() ); 1101 mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() );
1066 mBirthdayPicker->setDate( mAddressee.birthday().date() ); 1102 mBirthdayPicker->setDate( mAddressee.birthday().date() );
1067 1103
1068//US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom( 1104//US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom(
1069//US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) ); 1105//US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) );
1070 QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), 1106 QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
1071 "%Y-%m-%d"); // = Qt::ISODate 1107 "%Y-%m-%d"); // = Qt::ISODate
1072 mAnniversaryPicker->setDate( dt ); 1108 mAnniversaryPicker->setDate( dt );
1073 1109
1074 1110
1075 mNicknameEdit->setText( mAddressee.nickName() ); 1111 mNicknameEdit->setText( mAddressee.nickName() );
1076 mCategoryEdit->setText( mAddressee.categories().join( "," ) ); 1112 mCategoryEdit->setText( mAddressee.categories().join( "," ) );
1077 1113
1078 mGeoWidget->setGeo( mAddressee.geo() ); 1114 mGeoWidget->setGeo( mAddressee.geo() );
1079 mImageWidget->setPhoto( mAddressee.photo() ); 1115 mImageWidget->setPhoto( mAddressee.photo() );
1080 mImageWidget->setLogo( mAddressee.logo() ); 1116 mImageWidget->setLogo( mAddressee.logo() );
1081 mKeyWidget->setKeys( mAddressee.keys() ); 1117 mKeyWidget->setKeys( mAddressee.keys() );
1082 mSecrecyWidget->setSecrecy( mAddressee.secrecy() ); 1118 mSecrecyWidget->setSecrecy( mAddressee.secrecy() );
1083#ifndef KAB_EMBEDDED 1119#ifndef KAB_EMBEDDED
1084 mSoundWidget->setSound( mAddressee.sound() ); 1120 mSoundWidget->setSound( mAddressee.sound() );
1085#else //KAB_EMBEDDED 1121#else //KAB_EMBEDDED
1086//US qDebug("AddresseeEditorWidget::load has to be changed 2"); 1122//US qDebug("AddresseeEditorWidget::load has to be changed 2");
1087#endif //KAB_EMBEDDED 1123#endif //KAB_EMBEDDED
1088 1124
1089 // Load customs 1125 // Load customs
1090 mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) ); 1126 mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) );
1091 mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) ); 1127 mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) );
1092 mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) ); 1128 mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) );
1093 mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) ); 1129 mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) );
1094 mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) ); 1130 mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) );
1095 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) ); 1131 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) );
1096 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) ); 1132 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) );
1097 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) ); 1133 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) );
1098 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); 1134 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
1099 if ( gen == "female" ) 1135 if ( gen == "female" )
1100 mGenderBox->setCurrentItem ( 1 ); 1136 mGenderBox->setCurrentItem ( 1 );
1101 else if ( gen == "male" ) 1137 else if ( gen == "male" )
1102 mGenderBox->setCurrentItem ( 2 ); 1138 mGenderBox->setCurrentItem ( 2 );
1103 else 1139 else
1104 mGenderBox->setCurrentItem ( 0 ); 1140 mGenderBox->setCurrentItem ( 0 );
1105 blockSignals( block ); 1141 blockSignals( block );
1106 mBlockSignals = false; 1142 mBlockSignals = false;
1107 1143
1108 mDirty = false; 1144 mDirty = false;
1109} 1145}
1110 1146
1111void AddresseeEditorWidget::save() 1147void AddresseeEditorWidget::save()
1112{ 1148{
1113 if ( !dirty() ) { 1149 if ( !dirty() ) {
1114 return; 1150 return;
1115 } 1151 }
1116 1152
1117 mAddressee.setRevision( QDateTime::currentDateTime() ); 1153 mAddressee.setRevision( QDateTime::currentDateTime() );
1118 1154
1119 mAddressee.setRole( mRoleEdit->text() ); 1155 mAddressee.setRole( mRoleEdit->text() );
1120 mAddressee.setOrganization( mOrgEdit->text() ); 1156 mAddressee.setOrganization( mOrgEdit->text() );
1121 mAddressee.setUrl( KURL( mURLEdit->text() ) ); 1157 mAddressee.setUrl( KURL( mURLEdit->text() ) );
1122 mAddressee.setNote( mNoteEdit->text() ); 1158 mAddressee.setNote( mNoteEdit->text() );
1123 if ( mBirthdayPicker->inputIsValid() ) { 1159 if ( mBirthdayPicker->inputIsValid() ) {
1124 QDate da = mBirthdayPicker->date(); 1160 QDate da = mBirthdayPicker->date();
1125 mAddressee.setBirthday( QDateTime( da ) ); 1161 mAddressee.setBirthday( QDateTime( da ) );
1126 //qDebug("bday %s ",da.toString().latin1()); 1162 //qDebug("bday %s ",da.toString().latin1());
1127 } 1163 }
1128 else { 1164 else {
1129 mAddressee.setBirthday( QDateTime() ); 1165 mAddressee.setBirthday( QDateTime() );
1130 mBirthdayPicker->clear(); 1166 mBirthdayPicker->clear();
1131 } 1167 }
1132 mAddressee.setNickName( mNicknameEdit->text() ); 1168 mAddressee.setNickName( mNicknameEdit->text() );
1133 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); 1169 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) );
1134 1170
1135 mAddressee.setGeo( mGeoWidget->geo() ); 1171 mAddressee.setGeo( mGeoWidget->geo() );
1136 mAddressee.setPhoto( mImageWidget->photo() ); 1172 mAddressee.setPhoto( mImageWidget->photo() );
1137 mAddressee.setLogo( mImageWidget->logo() ); 1173 mAddressee.setLogo( mImageWidget->logo() );
1138 mAddressee.setKeys( mKeyWidget->keys() ); 1174 mAddressee.setKeys( mKeyWidget->keys() );
1139#ifndef KAB_EMBEDDED 1175#ifndef KAB_EMBEDDED
1140 mAddressee.setSound( mSoundWidget->sound() ); 1176 mAddressee.setSound( mSoundWidget->sound() );
1141#else //KAB_EMBEDDED 1177#else //KAB_EMBEDDED
1142//US qDebug("AddresseeEditorWidget::save sound not supported"); 1178//US qDebug("AddresseeEditorWidget::save sound not supported");
1143#endif //KAB_EMBEDDED 1179#endif //KAB_EMBEDDED
1144 mAddressee.setSecrecy( mSecrecyWidget->secrecy() ); 1180 mAddressee.setSecrecy( mSecrecyWidget->secrecy() );
1145 1181
1146 // save custom fields 1182 // save custom fields
1147 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); 1183 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() );
1148 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); 1184 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() );
1149 mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() ); 1185 mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() );
1150 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); 1186 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() );
1151 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); 1187 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() );
1152 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); 1188 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() );
1153 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); 1189 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() );
1154 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); 1190 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() );
1155 if ( mAnniversaryPicker->inputIsValid() ) { 1191 if ( mAnniversaryPicker->inputIsValid() ) {
1156 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); 1192 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate);
1157 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); 1193 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
1158 } 1194 }
1159 else { 1195 else {
1160 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); 1196 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" );
1161 mAnniversaryPicker->clear(); 1197 mAnniversaryPicker->clear();
1162 } 1198 }
1163 int gen = mGenderBox->currentItem (); 1199 int gen = mGenderBox->currentItem ();
1164 if ( gen == 1 ) 1200 if ( gen == 1 )
1165 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); 1201 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female");
1166 else if ( gen == 2 ) 1202 else if ( gen == 2 )
1167 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); 1203 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male");
1168 else 1204 else
1169 mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" ); 1205 mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" );
1170 1206
1171 // Save the email addresses 1207 // Save the email addresses
1172 QStringList emails = mAddressee.emails(); 1208 QStringList emails = mAddressee.emails();
1173 QStringList::Iterator iter; 1209 QStringList::Iterator iter;
1174 for ( iter = emails.begin(); iter != emails.end(); ++iter ) 1210 for ( iter = emails.begin(); iter != emails.end(); ++iter )
1175 mAddressee.removeEmail( *iter ); 1211 mAddressee.removeEmail( *iter );
1176 1212
1177 emails = mEmailWidget->emails(); 1213 emails = mEmailWidget->emails();
1178 bool first = true; 1214 bool first = true;
1179 for ( iter = emails.begin(); iter != emails.end(); ++iter ) { 1215 for ( iter = emails.begin(); iter != emails.end(); ++iter ) {
1180 mAddressee.insertEmail( *iter, first ); 1216 mAddressee.insertEmail( *iter, first );
1181 first = false; 1217 first = false;
1182 } 1218 }
1183 1219
1184 // Save the phone numbers 1220 // Save the phone numbers
1185 KABC::PhoneNumber::List phoneNumbers; 1221 KABC::PhoneNumber::List phoneNumbers;
1186 KABC::PhoneNumber::List::Iterator phoneIter; 1222 KABC::PhoneNumber::List::Iterator phoneIter;
1187 phoneNumbers = mAddressee.phoneNumbers(); 1223 phoneNumbers = mAddressee.phoneNumbers();
1188 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); 1224 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end();
1189 ++phoneIter ) 1225 ++phoneIter )
1190 mAddressee.removePhoneNumber( *phoneIter ); 1226 mAddressee.removePhoneNumber( *phoneIter );
1191 1227
1192 phoneNumbers = mPhoneEditWidget->phoneNumbers(); 1228 phoneNumbers = mPhoneEditWidget->phoneNumbers();
1193 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); 1229 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end();
1194 ++phoneIter ) 1230 ++phoneIter )
1195 mAddressee.insertPhoneNumber( *phoneIter ); 1231 mAddressee.insertPhoneNumber( *phoneIter );
1196 mAddressee.makePhoneNumbersOLcompatible(); 1232 mAddressee.makePhoneNumbersOLcompatible();
1197 // Save the addresses 1233 // Save the addresses
1198 KABC::Address::List addresses; 1234 KABC::Address::List addresses;
1199 KABC::Address::List::Iterator addressIter; 1235 KABC::Address::List::Iterator addressIter;
1200 addresses = mAddressee.addresses(); 1236 addresses = mAddressee.addresses();
1201 for ( addressIter = addresses.begin(); addressIter != addresses.end(); 1237 for ( addressIter = addresses.begin(); addressIter != addresses.end();
1202 ++addressIter ) 1238 ++addressIter )
1203 mAddressee.removeAddress( *addressIter ); 1239 mAddressee.removeAddress( *addressIter );
1204 1240
1205 addresses = mAddressEditWidget->addresses(); 1241 addresses = mAddressEditWidget->addresses();
1206 for ( addressIter = addresses.begin(); addressIter != addresses.end(); 1242 for ( addressIter = addresses.begin(); addressIter != addresses.end();
1207 ++addressIter ) 1243 ++addressIter )
1208 mAddressee.insertAddress( *addressIter ); 1244 mAddressee.insertAddress( *addressIter );
1209 mDirty = false; 1245 mDirty = false;
1210} 1246}
1211 1247
1212bool AddresseeEditorWidget::dirty() 1248bool AddresseeEditorWidget::dirty()
1213{ 1249{
1214 1250
1215 if ( ! mDirty ) { 1251 if ( ! mDirty ) {
1216 if ( mBirthdayPicker->inputIsValid() ) { 1252 if ( mBirthdayPicker->inputIsValid() ) {
1217 QDate da = mBirthdayPicker->date(); 1253 QDate da = mBirthdayPicker->date();
1218 if ( !(da == mAddressee.birthday().date())) 1254 if ( !(da == mAddressee.birthday().date()))
1219 mDirty = true; 1255 mDirty = true;
1220 } 1256 }
1221 else { 1257 else {
1222 mBirthdayPicker->clear(); 1258 mBirthdayPicker->clear();
1223 } 1259 }
1224 if ( mAnniversaryPicker->inputIsValid() ) { 1260 if ( mAnniversaryPicker->inputIsValid() ) {
1225 QDate da = mAnniversaryPicker->date(); 1261 QDate da = mAnniversaryPicker->date();
1226 if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), 1262 if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
1227 "%Y-%m-%d")) 1263 "%Y-%m-%d"))
1228 mDirty = true; 1264 mDirty = true;
1229 } 1265 }
1230 else { 1266 else {
1231 mAnniversaryPicker->clear(); 1267 mAnniversaryPicker->clear();
1232 } 1268 }
1233 } 1269 }
1234 return mDirty; 1270 return mDirty;
1235} 1271}
1236 1272
1237void AddresseeEditorWidget::nameTextChanged( const QString &text ) 1273void AddresseeEditorWidget::nameTextChanged( const QString &text )
1238{ 1274{
1239 if ( mBlockSignals ) 1275 if ( mBlockSignals )
1240 return; 1276 return;
1241 // use the addressee class to parse the name for us 1277 // use the addressee class to parse the name for us
1242 mAConfig->setUid( mAddressee.uid() ); 1278 mAConfig->setUid( mAddressee.uid() );
1243 if ( mAConfig->automaticNameParsing() ) { 1279 if ( mAConfig->automaticNameParsing() ) {
1244 if ( !mAddressee.formattedName().isEmpty() ) { 1280 if ( !mAddressee.formattedName().isEmpty() ) {
1245 QString fn = mAddressee.formattedName(); 1281 QString fn = mAddressee.formattedName();
1246 mAddressee.setNameFromString( text ); 1282 mAddressee.setNameFromString( text );
1247 mAddressee.setFormattedName( fn ); 1283 mAddressee.setFormattedName( fn );
1248 } else { 1284 } else {
1249 // use extra addressee to avoid a formatted name assignment 1285 // use extra addressee to avoid a formatted name assignment
1250 Addressee addr; 1286 Addressee addr;
1251 addr.setNameFromString( text ); 1287 addr.setNameFromString( text );
1252 mAddressee.setPrefix( addr.prefix() ); 1288 mAddressee.setPrefix( addr.prefix() );
1253 mAddressee.setGivenName( addr.givenName() ); 1289 mAddressee.setGivenName( addr.givenName() );
1254 mAddressee.setAdditionalName( addr.additionalName() ); 1290 mAddressee.setAdditionalName( addr.additionalName() );
1255 mAddressee.setFamilyName( addr.familyName() ); 1291 mAddressee.setFamilyName( addr.familyName() );
1256 mAddressee.setSuffix( addr.suffix() ); 1292 mAddressee.setSuffix( addr.suffix() );
1257 } 1293 }
1258 } 1294 }
1259 nameBoxChanged(); 1295 nameBoxChanged();
1260 1296
1261 1297
1262 emitModified(); 1298 emitModified();
1263} 1299}
1264 1300
1265void AddresseeEditorWidget::nameBoxChanged() 1301void AddresseeEditorWidget::nameBoxChanged()
1266{ 1302{
1267 KABC::Addressee addr; 1303 KABC::Addressee addr;
1268 mAConfig->setUid( mAddressee.uid() ); 1304 mAConfig->setUid( mAddressee.uid() );
1269 if ( mAConfig->automaticNameParsing() ) { 1305 if ( mAConfig->automaticNameParsing() ) {
1270 addr.setNameFromString( mNameEdit->text() ); 1306 addr.setNameFromString( mNameEdit->text() );
1271 mNameLabel->hide(); 1307 mNameLabel->hide();
1272 mNameEdit->show(); 1308 mNameEdit->show();
1273 } else { 1309 } else {
1274 addr = mAddressee; 1310 addr = mAddressee;
1275 mNameEdit->hide(); 1311 mNameEdit->hide();
1276 mNameLabel->setText( mNameEdit->text() ); 1312 mNameLabel->setText( mNameEdit->text() );
1277 mNameLabel->show(); 1313 mNameLabel->show();
1278 } 1314 }
1279 1315
1280 if ( mFormattedNameType != NameEditDialog::CustomName ) { 1316 if ( mFormattedNameType != NameEditDialog::CustomName ) {
1281 mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 1317 mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
1282 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 1318 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
1283 } 1319 }
1284} 1320}
1285 1321
1286void AddresseeEditorWidget::nameButtonClicked() 1322void AddresseeEditorWidget::nameButtonClicked()
1287{ 1323{
1288 // show the name dialog. 1324 // show the name dialog.
1289 NameEditDialog dialog( mAddressee, mFormattedNameType, this ); 1325 NameEditDialog dialog( mAddressee, mFormattedNameType, this );
1290 1326
1291 if ( KApplication::execDialog( &dialog) ) { 1327 if ( KApplication::execDialog( &dialog) ) {
1292 if ( dialog.changed() ) { 1328 if ( dialog.changed() ) {
1293 mAddressee.setFamilyName( dialog.familyName() ); 1329 mAddressee.setFamilyName( dialog.familyName() );
1294 mAddressee.setGivenName( dialog.givenName() ); 1330 mAddressee.setGivenName( dialog.givenName() );
1295 mAddressee.setPrefix( dialog.prefix() ); 1331 mAddressee.setPrefix( dialog.prefix() );
1296 mAddressee.setSuffix( dialog.suffix() ); 1332 mAddressee.setSuffix( dialog.suffix() );
1297 mAddressee.setAdditionalName( dialog.additionalName() ); 1333 mAddressee.setAdditionalName( dialog.additionalName() );
1298 mFormattedNameType = dialog.formattedNameType(); 1334 mFormattedNameType = dialog.formattedNameType();
1299 if ( mFormattedNameType == NameEditDialog::CustomName ) { 1335 if ( mFormattedNameType == NameEditDialog::CustomName ) {
1300 mFormattedNameLabel->setText( dialog.customFormattedName() ); 1336 mFormattedNameLabel->setText( dialog.customFormattedName() );
1301 mAddressee.setFormattedName( dialog.customFormattedName() ); 1337 mAddressee.setFormattedName( dialog.customFormattedName() );
1302 } 1338 }
1303 // Update the name edit. 1339 // Update the name edit.
1304 bool block = mNameEdit->signalsBlocked(); 1340 bool block = mNameEdit->signalsBlocked();
1305 mNameEdit->blockSignals( true ); 1341 mNameEdit->blockSignals( true );
1306 mNameEdit->setText( mAddressee.assembledName() ); 1342 mNameEdit->setText( mAddressee.assembledName() );
1307 mNameEdit->blockSignals( block ); 1343 mNameEdit->blockSignals( block );
1308 1344
1309 // Update the combo box. 1345 // Update the combo box.
1310 nameBoxChanged(); 1346 nameBoxChanged();
1311 1347
1312 emitModified(); 1348 emitModified();
1313 } 1349 }
1314 } 1350 }
1315} 1351}
1316 1352
1317void AddresseeEditorWidget::categoryButtonClicked() 1353void AddresseeEditorWidget::categoryButtonClicked()
1318{ 1354{
1319 // Show the category dialog 1355 // Show the category dialog
1320 if ( mCategoryDialog == 0 ) { 1356 if ( mCategoryDialog == 0 ) {
1321 mCategoryDialog = new KPIM::CategorySelectDialog( KABPrefs::instance(), this ); 1357 mCategoryDialog = new KPIM::CategorySelectDialog( KABPrefs::instance(), this );
1322 connect( mCategoryDialog, SIGNAL( categoriesSelected( const QStringList& ) ), 1358 connect( mCategoryDialog, SIGNAL( categoriesSelected( const QStringList& ) ),
1323 SLOT(categoriesSelected( const QStringList& ) ) ); 1359 SLOT(categoriesSelected( const QStringList& ) ) );
1324 connect( mCategoryDialog, SIGNAL( editCategories() ), SLOT( editCategories() ) ); 1360 connect( mCategoryDialog, SIGNAL( editCategories() ), SLOT( editCategories() ) );
1325 } 1361 }
1326 1362
1327 mCategoryDialog->setCategories(); 1363 mCategoryDialog->setCategories();
1328 mCategoryDialog->setSelected( QStringList::split( ",", mCategoryEdit->text() ) ); 1364 mCategoryDialog->setSelected( QStringList::split( ",", mCategoryEdit->text() ) );
1329 mCategoryDialog->show(); 1365 mCategoryDialog->show();
1330 mCategoryDialog->raise(); 1366 mCategoryDialog->raise();
1331} 1367}
1332 1368
1333void AddresseeEditorWidget::categoriesSelected( const QStringList &list ) 1369void AddresseeEditorWidget::categoriesSelected( const QStringList &list )
1334{ 1370{
1335 mCategoryEdit->setText( list.join( "," ) ); 1371 mCategoryEdit->setText( list.join( "," ) );
1336} 1372}
1337 1373
1338void AddresseeEditorWidget::editCategories() 1374void AddresseeEditorWidget::editCategories()
1339{ 1375{
1340 if ( mCategoryEditDialog == 0 ) { 1376 if ( mCategoryEditDialog == 0 ) {
1341 mCategoryEditDialog = new KPIM::CategoryEditDialog( KABPrefs::instance(), this ); 1377 mCategoryEditDialog = new KPIM::CategoryEditDialog( KABPrefs::instance(), this );
1342 connect( mCategoryEditDialog, SIGNAL( categoryConfigChanged() ), 1378 connect( mCategoryEditDialog, SIGNAL( categoryConfigChanged() ),
1343 SLOT( categoryButtonClicked() ) ); 1379 SLOT( categoryButtonClicked() ) );
1344 } 1380 }
1345 1381
1346 mCategoryEditDialog->show(); 1382 mCategoryEditDialog->show();
1347 mCategoryEditDialog->raise(); 1383 mCategoryEditDialog->raise();
1348} 1384}
1349 1385
1350void AddresseeEditorWidget::emitModified() 1386void AddresseeEditorWidget::emitModified()
1351{ 1387{
1352 mDirty = true; 1388 mDirty = true;
1353 1389
1354 KABC::Addressee::List list; 1390 KABC::Addressee::List list;
1355 1391
1356 if ( mIsExtension && !mBlockSignals ) { 1392 if ( mIsExtension && !mBlockSignals ) {
1357 save(); 1393 save();
1358 list.append( mAddressee ); 1394 list.append( mAddressee );
1359 } 1395 }
1360 1396
1361 emit modified( list ); 1397 emit modified( list );
1362} 1398}
1363 1399
1364void AddresseeEditorWidget::dateChanged( QDate ) 1400void AddresseeEditorWidget::dateChanged( QDate )
1365{ 1401{
1366 emitModified(); 1402 emitModified();
1367} 1403}
1368 1404
1369//US invalid dates are handdled by the KDateEdit widget itself 1405//US invalid dates are handdled by the KDateEdit widget itself
1370void AddresseeEditorWidget::invalidDate() 1406void AddresseeEditorWidget::invalidDate()
1371{ 1407{
1372 KMessageBox::sorry( this, i18n( "You must specify a valid date" ) ); 1408 KMessageBox::sorry( this, i18n( "You must specify a valid date" ) );
1373} 1409}
1374 1410
1375 1411
1376void AddresseeEditorWidget::pageChanged( QWidget *wdg ) 1412void AddresseeEditorWidget::pageChanged( QWidget *wdg )
1377{ 1413{
1378#ifndef KAB_EMBEDDED 1414#ifndef KAB_EMBEDDED
1379 if ( wdg ) 1415 if ( wdg )
1380 KAcceleratorManager::manage( wdg ); 1416 KAcceleratorManager::manage( wdg );
1381#else //KAB_EMBEDDED 1417#else //KAB_EMBEDDED
1382//US 1418//US
1383#endif //KAB_EMBEDDED 1419#endif //KAB_EMBEDDED
1384 1420
1385} 1421}
1386 1422
1387QString AddresseeEditorWidget::title() const 1423QString AddresseeEditorWidget::title() const
1388{ 1424{
1389 return i18n( "Contact Editor" ); 1425 return i18n( "Contact Editor" );
1390} 1426}
1391 1427
1392QString AddresseeEditorWidget::identifier() const 1428QString AddresseeEditorWidget::identifier() const
1393{ 1429{
1394 return i18n( "contact_editor" ); 1430 return i18n( "contact_editor" );
1395} 1431}
1396 1432
1397#ifndef KAB_EMBEDDED 1433#ifndef KAB_EMBEDDED
1398#include "addresseeeditorwidget.moc" 1434#include "addresseeeditorwidget.moc"
1399#endif //KAB_EMBEDDED 1435#endif //KAB_EMBEDDED
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