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