summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index dbbf7fe..50b6b6d 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -1,286 +1,287 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qcheckbox.h> 24#include <qcheckbox.h>
25#include <qhbox.h> 25#include <qhbox.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qlistbox.h> 28#include <qlistbox.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qtabwidget.h> 30#include <qtabwidget.h>
31#include <qapplication.h>
31 32
32#ifndef KAB_EMBEDDED 33#ifndef KAB_EMBEDDED
33#include <qtextedit.h> 34#include <qtextedit.h>
34 35
35#include <kaccelmanager.h> 36#include <kaccelmanager.h>
36#include "keywidget.h" 37#include "keywidget.h"
37#include "soundwidget.h" 38#include "soundwidget.h"
38 39
39#else //KAB_EMBEDDED 40#else //KAB_EMBEDDED
40#include <qmultilineedit.h> 41#include <qmultilineedit.h>
41#endif //KAB_EMBEDDED 42#endif //KAB_EMBEDDED
42 43
43 44
44#include "keywidget.h" 45#include "keywidget.h"
45#include "geowidget.h" 46#include "geowidget.h"
46#include "imagewidget.h" 47#include "imagewidget.h"
47#include "nameeditdialog.h" 48#include "nameeditdialog.h"
48#include "phoneeditwidget.h" 49#include "phoneeditwidget.h"
49#include "secrecywidget.h" 50#include "secrecywidget.h"
50 51
51 52
52#include <qtoolbutton.h> 53#include <qtoolbutton.h>
53#include <qtooltip.h> 54#include <qtooltip.h>
54 55
55#include <kapplication.h> 56#include <kapplication.h>
56#include <kconfig.h> 57#include <kconfig.h>
57#include <kcombobox.h> 58#include <kcombobox.h>
58#include <kdebug.h> 59#include <kdebug.h>
59#include <kdialogbase.h> 60#include <kdialogbase.h>
60#include <kglobal.h> 61#include <kglobal.h>
61#include <kiconloader.h> 62#include <kiconloader.h>
62#include <klineedit.h> 63#include <klineedit.h>
63#include <klocale.h> 64#include <klocale.h>
64#include <kmessagebox.h> 65#include <kmessagebox.h>
65#include <kseparator.h> 66#include <kseparator.h>
66#include <ksqueezedtextlabel.h> 67#include <ksqueezedtextlabel.h>
67 68
68#include <libkdepim/categoryeditdialog.h> 69#include <libkdepim/categoryeditdialog.h>
69#include <libkdepim/categoryselectdialog.h> 70#include <libkdepim/categoryselectdialog.h>
70 71
71#include <libkdepim/kdateedit.h> 72#include <libkdepim/kdateedit.h>
72 73
73#include "addresseditwidget.h" 74#include "addresseditwidget.h"
74#include "emaileditwidget.h" 75#include "emaileditwidget.h"
75#include "kabcore.h" 76#include "kabcore.h"
76#include "kabprefs.h" 77#include "kabprefs.h"
77 78
78#include "addresseeeditorwidget.h" 79#include "addresseeeditorwidget.h"
79 80
80 81
81 82
82AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension, 83AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension,
83 QWidget *parent, const char *name ) 84 QWidget *parent, const char *name )
84 : ExtensionWidget( core, parent, name ), mIsExtension( isExtension ), 85 : ExtensionWidget( core, parent, name ), mIsExtension( isExtension ),
85 mBlockSignals( false ) 86 mBlockSignals( false )
86{ 87{
87 88
88 mAConfig = AddresseeConfig::instance(); 89 mAConfig = AddresseeConfig::instance();
89 90
90 mFormattedNameType = NameEditDialog::CustomName; 91 mFormattedNameType = NameEditDialog::CustomName;
91 initGUI(); 92 initGUI();
92 mCategoryDialog = 0; 93 mCategoryDialog = 0;
93 mCategoryEditDialog = 0; 94 mCategoryEditDialog = 0;
94 95
95 // Load the empty addressee as defaults 96 // Load the empty addressee as defaults
96 load(); 97 load();
97 98
98 mDirty = false; 99 mDirty = false;
99} 100}
100 101
101AddresseeEditorWidget::~AddresseeEditorWidget() 102AddresseeEditorWidget::~AddresseeEditorWidget()
102{ 103{
103 kdDebug(5720) << "~AddresseeEditorWidget()" << endl; 104 kdDebug(5720) << "~AddresseeEditorWidget()" << endl;
104} 105}
105 106
106void AddresseeEditorWidget::contactsSelectionChanged() 107void AddresseeEditorWidget::contactsSelectionChanged()
107{ 108{
108 KABC::Addressee::List list = selectedContacts(); 109 KABC::Addressee::List list = selectedContacts();
109 110
110 mAddressee = list[ 0 ]; 111 mAddressee = list[ 0 ];
111 load(); 112 load();
112} 113}
113 114
114void AddresseeEditorWidget::setAddressee( const KABC::Addressee &addr ) 115void AddresseeEditorWidget::setAddressee( const KABC::Addressee &addr )
115{ 116{
116 mAddressee = addr; 117 mAddressee = addr;
117 load(); 118 load();
118} 119}
119 120
120const KABC::Addressee &AddresseeEditorWidget::addressee() 121const KABC::Addressee &AddresseeEditorWidget::addressee()
121{ 122{
122 return mAddressee; 123 return mAddressee;
123} 124}
124 125
125void AddresseeEditorWidget::textChanged( const QString& ) 126void AddresseeEditorWidget::textChanged( const QString& )
126{ 127{
127 emitModified(); 128 emitModified();
128} 129}
129 130
130void AddresseeEditorWidget::initGUI() 131void AddresseeEditorWidget::initGUI()
131{ 132{
132 QVBoxLayout *layout = new QVBoxLayout( this ); 133 QVBoxLayout *layout = new QVBoxLayout( this );
133 134
134 mTabWidget = new QTabWidget( this ); 135 mTabWidget = new QTabWidget( this );
135 layout->addWidget( mTabWidget ); 136 layout->addWidget( mTabWidget );
136 137
137 setupTab1(); 138 setupTab1();
138 setupTab1_1(); 139 setupTab1_1();
139 setupTab2(); 140 setupTab2();
140 setupTab2_1(); 141 setupTab2_1();
141 setupTab3(); 142 setupTab3();
142 setupTab3_1(); 143 setupTab3_1();
143 144
144 mNameEdit->setFocus(); 145 mNameEdit->setFocus();
145 146
146 connect( mTabWidget, SIGNAL( currentChanged(QWidget*) ), 147 connect( mTabWidget, SIGNAL( currentChanged(QWidget*) ),
147 SLOT( pageChanged(QWidget*) ) ); 148 SLOT( pageChanged(QWidget*) ) );
148} 149}
149 150
150void AddresseeEditorWidget::setupTab1() 151void AddresseeEditorWidget::setupTab1()
151{ 152{
152 // This is the General tab 153 // This is the General tab
153 QWidget *tab1 = new QWidget( mTabWidget ); 154 QWidget *tab1 = new QWidget( mTabWidget );
154 155
155//US QGridLayout *layout = new QGridLayout( tab1, 11, 7 ); 156//US QGridLayout *layout = new QGridLayout( tab1, 11, 7 );
156 QGridLayout *layout = new QGridLayout( tab1, 7, 1 ); 157 QGridLayout *layout = new QGridLayout( tab1, 7, 1 );
157 layout->setMargin( KDialogBase::marginHintSmall() ); 158 layout->setMargin( KDialogBase::marginHintSmall() );
158 layout->setSpacing( KDialogBase::spacingHintSmall() ); 159 layout->setSpacing( KDialogBase::spacingHintSmall() );
159 160
160 QLabel *label; 161 QLabel *label;
161 KSeparator* bar; 162 KSeparator* bar;
162 QPushButton *button; 163 QPushButton *button;
163 164
164 ////////////////////////////////// 165 //////////////////////////////////
165 // Upper left group (person info) 166 // Upper left group (person info)
166 167
167 // Person icon 168 // Person icon
168 /* LR 169 /* LR
169 label = new QLabel( tab1 ); 170 label = new QLabel( tab1 );
170//US ambiguous call. Add one more parameter 171//US ambiguous call. Add one more parameter
171//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 172//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
172 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 173 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
173 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 174 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
174 */ 175 */
175 // First name 176 // First name
176 button = new QPushButton( i18n( "Name..." ), tab1 ); 177 button = new QPushButton( i18n( "Name..." ), tab1 );
177//US QToolTip::add( button, i18n( "Edit the contact's name" ) ); 178//US QToolTip::add( button, i18n( "Edit the contact's name" ) );
178 mNameEdit = new KLineEdit( tab1, "mNameEdit" ); 179 mNameEdit = new KLineEdit( tab1, "mNameEdit" );
179 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), 180 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
180 SLOT( nameTextChanged( const QString& ) ) ); 181 SLOT( nameTextChanged( const QString& ) ) );
181 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); 182 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
182 183
183 mNameLabel = new KSqueezedTextLabel( tab1 ); 184 mNameLabel = new KSqueezedTextLabel( tab1 );
184 mNameLabel->hide(); 185 mNameLabel->hide();
185 186
186 layout->addWidget( button, 0, 0 ); 187 layout->addWidget( button, 0, 0 );
187 layout->addWidget( mNameEdit, 0, 1 ); 188 layout->addWidget( mNameEdit, 0, 1 );
188 layout->addWidget( mNameLabel, 0, 1 ); 189 layout->addWidget( mNameLabel, 0, 1 );
189 190
190 label = new QLabel( i18n( "Role:" ), tab1 ); 191 label = new QLabel( i18n( "Role:" ), tab1 );
191 mRoleEdit = new KLineEdit( tab1 ); 192 mRoleEdit = new KLineEdit( tab1 );
192 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), 193 connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ),
193 SLOT( textChanged( const QString& ) ) ); 194 SLOT( textChanged( const QString& ) ) );
194 label->setBuddy( mRoleEdit ); 195 label->setBuddy( mRoleEdit );
195 layout->addWidget( label, 1, 0 ); 196 layout->addWidget( label, 1, 0 );
196 layout->addWidget( mRoleEdit, 1, 1 ); 197 layout->addWidget( mRoleEdit, 1, 1 );
197 198
198 // Organization 199 // Organization
199 label = new QLabel( i18n( "Organization:" ), tab1 ); 200 label = new QLabel( i18n( "Organization:" ), tab1 );
200 mOrgEdit = new KLineEdit( tab1 ); 201 mOrgEdit = new KLineEdit( tab1 );
201 label->setBuddy( mOrgEdit ); 202 label->setBuddy( mOrgEdit );
202 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), 203 connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ),
203 SLOT( textChanged( const QString& ) ) ); 204 SLOT( textChanged( const QString& ) ) );
204 layout->addWidget( label, 2, 0 ); 205 layout->addWidget( label, 2, 0 );
205 layout->addWidget( mOrgEdit, 2, 1 ); 206 layout->addWidget( mOrgEdit, 2, 1 );
206 207
207 // File as (formatted name) 208 // File as (formatted name)
208 label = new QLabel( i18n( "Formatted name:" ), tab1 ); 209 label = new QLabel( i18n( "Formatted name:" ), tab1 );
209 mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); 210 mFormattedNameLabel = new KSqueezedTextLabel( tab1 );
210 layout->addWidget( label, 3, 0 ); 211 layout->addWidget( label, 3, 0 );
211 layout->addWidget( mFormattedNameLabel, 3, 1 ); 212 layout->addWidget( mFormattedNameLabel, 3, 1 );
212 /* LR 213 /* LR
213 // Left hand separator. This separator doesn't go all the way 214 // Left hand separator. This separator doesn't go all the way
214 // across so the dialog still flows from top to bottom 215 // across so the dialog still flows from top to bottom
215 bar = new KSeparator( KSeparator::HLine, tab1 ); 216 bar = new KSeparator( KSeparator::HLine, tab1 );
216 layout->addMultiCellWidget( bar, 4, 4, 0, 2 ); 217 layout->addMultiCellWidget( bar, 4, 4, 0, 2 );
217 */ 218 */
218 ////////////////////////////////////// 219 //////////////////////////////////////
219 220
220 /* LR 221 /* LR
221 // Phone numbers (upper right) 222 // Phone numbers (upper right)
222 label = new QLabel( tab1 ); 223 label = new QLabel( tab1 );
223//US loadIcon call is ambiguous. Add one more parameter 224//US loadIcon call is ambiguous. Add one more parameter
224//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); 225//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) );
225 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); 226 label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
226//US layout->addMultiCellWidget( label, 0, 1, 3, 3 ); 227//US layout->addMultiCellWidget( label, 0, 1, 3, 3 );
227 layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 228 layout->addMultiCellWidget( label, 5, 6, 0, 0 );
228 */ 229 */
229 mPhoneEditWidget = new PhoneEditWidget( tab1 ); 230 mPhoneEditWidget = new PhoneEditWidget( tab1 );
230 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 231 connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
231//US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); 232//US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 );
232 int iii; 233 int iii;
233#ifndef DESKTOP_VERSION 234#ifndef DESKTOP_VERSION
234 iii = 7; 235 iii = 7;
235#else 236#else
236 iii = 8; 237 iii = 8;
237#endif 238#endif
238 layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, 1 ); 239 layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, 1 );
239 ++iii; 240 ++iii;
240 /* LR 241 /* LR
241 bar = new KSeparator( KSeparator::HLine, tab1 ); 242 bar = new KSeparator( KSeparator::HLine, tab1 );
242//US layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); 243//US layout->addMultiCellWidget( bar, 4, 4, 3, 6 );
243 layout->addMultiCellWidget( bar, 9, 9, 0, 2 ); 244 layout->addMultiCellWidget( bar, 9, 9, 0, 2 );
244 */ 245 */
245/*US 246/*US
246 ////////////////////////////////////// 247 //////////////////////////////////////
247 // Addresses (lower left) 248 // Addresses (lower left)
248 label = new QLabel( tab1 ); 249 label = new QLabel( tab1 );
249//US loadIcon call is ambiguous. Add one more parameter 250//US loadIcon call is ambiguous. Add one more parameter
250//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) ); 251//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) );
251 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); 252 label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) );
252 layout->addMultiCellWidget( label, 5, 6, 0, 0 ); 253 layout->addMultiCellWidget( label, 5, 6, 0, 0 );
253 254
254 mAddressEditWidget = new AddressEditWidget( tab1 ); 255 mAddressEditWidget = new AddressEditWidget( tab1 );
255 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 256 connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
256 layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 ); 257 layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 );
257 258
258 ////////////////////////////////////// 259 //////////////////////////////////////
259 // Email / Web (lower right) 260 // Email / Web (lower right)
260 label = new QLabel( tab1 ); 261 label = new QLabel( tab1 );
261//US loadIcon call is ambiguous. Add one more parameter 262//US loadIcon call is ambiguous. Add one more parameter
262//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) ); 263//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) );
263 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) ); 264 label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) );
264 layout->addMultiCellWidget( label, 5, 6, 3, 3 ); 265 layout->addMultiCellWidget( label, 5, 6, 3, 3 );
265 266
266 mEmailWidget = new EmailEditWidget( tab1 ); 267 mEmailWidget = new EmailEditWidget( tab1 );
267 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); 268 connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
268 layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 ); 269 layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 );
269 270
270 // add the separator 271 // add the separator
271 bar = new KSeparator( KSeparator::HLine, tab1 ); 272 bar = new KSeparator( KSeparator::HLine, tab1 );
272 layout->addMultiCellWidget( bar, 7, 7, 3, 6 ); 273 layout->addMultiCellWidget( bar, 7, 7, 3, 6 );
273 274
274 label = new QLabel( tab1 ); 275 label = new QLabel( tab1 );
275//US loadIcon call is ambiguous. Add one more parameter 276//US loadIcon call is ambiguous. Add one more parameter
276//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) ); 277//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) );
277 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) ); 278 label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) );
278 layout->addMultiCellWidget( label, 8, 9, 3, 3 ); 279 layout->addMultiCellWidget( label, 8, 9, 3, 3 );
279 280
280 label = new QLabel( i18n( "URL:" ), tab1 ); 281 label = new QLabel( i18n( "URL:" ), tab1 );
281 mURLEdit = new KLineEdit( tab1 ); 282 mURLEdit = new KLineEdit( tab1 );
282 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ), 283 connect( mURLEdit, SIGNAL( textChanged( const QString& ) ),
283 SLOT( textChanged( const QString& ) ) ); 284 SLOT( textChanged( const QString& ) ) );
284 label->setBuddy( mURLEdit ); 285 label->setBuddy( mURLEdit );
285 layout->addWidget( label, 8, 4 ); 286 layout->addWidget( label, 8, 4 );
286 layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 ); 287 layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 );