summaryrefslogtreecommitdiffabout
path: root/kaddressbook/features
Unidiff
Diffstat (limited to 'kaddressbook/features') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/features/distributionlistwidget.cpp39
-rw-r--r--kaddressbook/features/distributionlistwidget.h13
-rw-r--r--kaddressbook/features/mergewidget.cpp14
-rw-r--r--kaddressbook/features/mergewidget.h2
4 files changed, 41 insertions, 27 deletions
diff --git a/kaddressbook/features/distributionlistwidget.cpp b/kaddressbook/features/distributionlistwidget.cpp
index bfcb121..996177b 100644
--- a/kaddressbook/features/distributionlistwidget.cpp
+++ b/kaddressbook/features/distributionlistwidget.cpp
@@ -1,501 +1,508 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
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 <qbuttongroup.h> 24#include <q3buttongroup.h>
25#include <qcombobox.h> 25#include <qcombobox.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qlistview.h> 28#include <q3listview.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qradiobutton.h> 30#include <qradiobutton.h>
31//Added by qt3to4:
32#include <QDragMoveEvent>
33#include <QDropEvent>
34#include <Q3GridLayout>
35#include <Q3Frame>
36#include <Q3VBoxLayout>
37#include <QDragEnterEvent>
31 38
32#ifndef KAB_EMBEDDED 39#ifndef KAB_EMBEDDED
33#include <kaccelmanager.h> 40#include <kaccelmanager.h>
34#endif //KAB_EMBEDDED 41#endif //KAB_EMBEDDED
35 42
36 43
37#include <kdebug.h> 44#include <kdebug.h>
38#include <klineeditdlg.h> 45#include <klineeditdlg.h>
39#include <klocale.h> 46#include <klocale.h>
40#include <kglobal.h> 47#include <kglobal.h>
41#include <kmessagebox.h> 48#include <kmessagebox.h>
42 49
43#include <kabc/addressbook.h> 50#include <kabc/addressbook.h>
44#include <kabc/addresseedialog.h> 51#include <kabc/addresseedialog.h>
45#include <kabc/distributionlist.h> 52#include <kabc/distributionlist.h>
46#include <kabc/vcardconverter.h> 53#include <kabc/vcardconverter.h>
47 54
48#ifndef KAB_EMBEDDED 55#ifndef KAB_EMBEDDED
49#include <libkdepim/kvcarddrag.h> 56#include <libkdepim/kvcarddrag.h>
50#endif //KAB_EMBEDDED 57#endif //KAB_EMBEDDED
51 58
52#include "kabcore.h" 59#include "kabcore.h"
53 60
54#include "distributionlistwidget.h" 61#include "distributionlistwidget.h"
55 62
56#ifndef KAB_EMBEDDED 63#ifndef KAB_EMBEDDED
57 64
58class DistributionListFactory : public ExtensionFactory 65class DistributionListFactory : public ExtensionFactory
59{ 66{
60 public: 67 public:
61 ExtensionWidget *extension( KABCore *core, QWidget *parent, const char *name ) 68 ExtensionWidget *extension( KABCore *core, QWidget *parent, const char *name )
62 { 69 {
63 return new DistributionListWidget( core, parent, name ); 70 return new DistributionListWidget( core, parent, name );
64 } 71 }
65 72
66 QString identifier() const 73 QString identifier() const
67 { 74 {
68 return "distribution_list_editor"; 75 return "distribution_list_editor";
69 } 76 }
70}; 77};
71 78
72extern "C" { 79extern "C" {
73 void *init_libkaddrbk_distributionlist() 80 void *init_libkaddrbk_distributionlist()
74 { 81 {
75 return ( new DistributionListFactory ); 82 return ( new DistributionListFactory );
76 } 83 }
77} 84}
78#endif //KAB_EMBEDDED 85#endif //KAB_EMBEDDED
79 86
80class ContactItem : public QListViewItem 87class ContactItem : public Q3ListViewItem
81{ 88{
82 public: 89 public:
83 ContactItem( DistributionListView *parent, const KABC::Addressee &addressee, 90 ContactItem( DistributionListView *parent, const KABC::Addressee &addressee,
84 const QString &email = QString::null ) : 91 const QString &email = QString::null ) :
85 QListViewItem( parent ), 92 Q3ListViewItem( parent ),
86 mAddressee( addressee ), 93 mAddressee( addressee ),
87 mEmail( email ) 94 mEmail( email )
88 { 95 {
89 setText( 0, addressee.realName() ); 96 setText( 0, addressee.realName() );
90 if( email.isEmpty() ) { 97 if( email.isEmpty() ) {
91 setText( 1, addressee.preferredEmail() ); 98 setText( 1, addressee.preferredEmail() );
92 setText( 2, i18n( "Yes" ) ); 99 setText( 2, i18n( "Yes" ) );
93 } else { 100 } else {
94 setText( 1, email ); 101 setText( 1, email );
95 setText( 2, i18n( "No" ) ); 102 setText( 2, i18n( "No" ) );
96 } 103 }
97 } 104 }
98 105
99 KABC::Addressee addressee() const 106 KABC::Addressee addressee() const
100 { 107 {
101 return mAddressee; 108 return mAddressee;
102 } 109 }
103 110
104 QString email() const 111 QString email() const
105 { 112 {
106 return mEmail; 113 return mEmail;
107 } 114 }
108 115
109 protected: 116 protected:
110 bool acceptDrop( const QMimeSource* ) 117 bool acceptDrop( const QMimeSource* )
111 { 118 {
112 return true; 119 return true;
113 } 120 }
114 121
115 private: 122 private:
116 KABC::Addressee mAddressee; 123 KABC::Addressee mAddressee;
117 QString mEmail; 124 QString mEmail;
118}; 125};
119 126
120DistributionListWidget::DistributionListWidget( KABCore *core, QWidget *parent, 127DistributionListWidget::DistributionListWidget( KABCore *core, QWidget *parent,
121 const char *name ) 128 const char *name )
122 : ExtensionWidget( core, parent, name ), mManager( 0 ) 129 : ExtensionWidget( core, parent, name ), mManager( 0 )
123{ 130{
124 QGridLayout *topLayout = new QGridLayout( this, 3, 4, KDialog::marginHint(), 131 Q3GridLayout *topLayout = new Q3GridLayout( this, 3, 4, KDialog::marginHint(),
125 KDialog::spacingHint() ); 132 KDialog::spacingHint() );
126 133
127 if (KGlobal::getOrientation() == KGlobal::Portrait) 134 if (KGlobal::getOrientation() == KGlobal::Portrait)
128 { 135 {
129 mCreateListButton = new QPushButton( i18n( "New List" ), this ); 136 mCreateListButton = new QPushButton( i18n( "New List" ), this );
130 mEditListButton = new QPushButton( i18n( "Ren List" ), this ); 137 mEditListButton = new QPushButton( i18n( "Ren List" ), this );
131 mRemoveListButton = new QPushButton( i18n( "Del List" ), this ); 138 mRemoveListButton = new QPushButton( i18n( "Del List" ), this );
132 mAddContactButton = new QPushButton( i18n( "Add Cont." ), this ); 139 mAddContactButton = new QPushButton( i18n( "Add Cont." ), this );
133 mChangeEmailButton = new QPushButton( i18n( "Chge Email" ), this ); 140 mChangeEmailButton = new QPushButton( i18n( "Chge Email" ), this );
134 mRemoveContactButton = new QPushButton( i18n( "Del Cont." ), this ); 141 mRemoveContactButton = new QPushButton( i18n( "Del Cont." ), this );
135 } 142 }
136 else 143 else
137 { 144 {
138 mCreateListButton = new QPushButton( i18n( "New List..." ), this ); 145 mCreateListButton = new QPushButton( i18n( "New List..." ), this );
139 mEditListButton = new QPushButton( i18n( "Rename List..." ), this ); 146 mEditListButton = new QPushButton( i18n( "Rename List..." ), this );
140 mRemoveListButton = new QPushButton( i18n( "Remove List" ), this ); 147 mRemoveListButton = new QPushButton( i18n( "Remove List" ), this );
141 mAddContactButton = new QPushButton( i18n( "Add Contact" ), this ); 148 mAddContactButton = new QPushButton( i18n( "Add Contact" ), this );
142 mChangeEmailButton = new QPushButton( i18n( "Change Email..." ), this ); 149 mChangeEmailButton = new QPushButton( i18n( "Change Email..." ), this );
143 mRemoveContactButton = new QPushButton( i18n( "Remove Contact" ), this ); 150 mRemoveContactButton = new QPushButton( i18n( "Remove Contact" ), this );
144 } 151 }
145 mNameCombo = new QComboBox( this ); 152 mNameCombo = new QComboBox( this );
146 topLayout->addWidget( mNameCombo, 0, 0 ); 153 topLayout->addWidget( mNameCombo, 0, 0 );
147 connect( mNameCombo, SIGNAL( activated( int ) ), SLOT( updateContactView() ) ); 154 connect( mNameCombo, SIGNAL( activated( int ) ), SLOT( updateContactView() ) );
148 155
149 topLayout->addWidget( mCreateListButton, 0, 1 ); 156 topLayout->addWidget( mCreateListButton, 0, 1 );
150 connect( mCreateListButton, SIGNAL( clicked() ), SLOT( createList() ) ); 157 connect( mCreateListButton, SIGNAL( clicked() ), SLOT( createList() ) );
151 158
152 topLayout->addWidget( mEditListButton, 0, 2 ); 159 topLayout->addWidget( mEditListButton, 0, 2 );
153 connect( mEditListButton, SIGNAL( clicked() ), SLOT( editList() ) ); 160 connect( mEditListButton, SIGNAL( clicked() ), SLOT( editList() ) );
154 161
155 topLayout->addWidget( mRemoveListButton, 0, 3 ); 162 topLayout->addWidget( mRemoveListButton, 0, 3 );
156 connect( mRemoveListButton, SIGNAL( clicked() ), SLOT( removeList() ) ); 163 connect( mRemoveListButton, SIGNAL( clicked() ), SLOT( removeList() ) );
157 164
158 mContactView = new DistributionListView( this ); 165 mContactView = new DistributionListView( this );
159 mContactView->addColumn( i18n( "Name" ) ); 166 mContactView->addColumn( i18n( "Name" ) );
160 mContactView->addColumn( i18n( "Email" ) ); 167 mContactView->addColumn( i18n( "Email" ) );
161 mContactView->addColumn( i18n( "Use Preferred" ) ); 168 mContactView->addColumn( i18n( "Use Preferred" ) );
162 mContactView->setEnabled( false ); 169 mContactView->setEnabled( false );
163 mContactView->setAllColumnsShowFocus( true ); 170 mContactView->setAllColumnsShowFocus( true );
164 mContactView->setMinimumHeight( 30 ); 171 mContactView->setMinimumHeight( 30 );
165 172
166 topLayout->addMultiCellWidget( mContactView, 1, 1, 0, 3 ); 173 topLayout->addMultiCellWidget( mContactView, 1, 1, 0, 3 );
167 connect( mContactView, SIGNAL( selectionChanged() ), 174 connect( mContactView, SIGNAL( selectionChanged() ),
168 SLOT( selectionContactViewChanged() ) ); 175 SLOT( selectionContactViewChanged() ) );
169 connect( mContactView, SIGNAL( dropped( QDropEvent*, QListViewItem* ) ), 176 connect( mContactView, SIGNAL( dropped( QDropEvent*, Q3ListViewItem* ) ),
170 SLOT( dropped( QDropEvent*, QListViewItem* ) ) ); 177 SLOT( dropped( QDropEvent*, Q3ListViewItem* ) ) );
171 178
172 mAddContactButton->setEnabled( false ); 179 mAddContactButton->setEnabled( false );
173 topLayout->addWidget( mAddContactButton, 2, 0 ); 180 topLayout->addWidget( mAddContactButton, 2, 0 );
174 connect( mAddContactButton, SIGNAL( clicked() ), SLOT( addContact() ) ); 181 connect( mAddContactButton, SIGNAL( clicked() ), SLOT( addContact() ) );
175 182
176 topLayout->addWidget( mChangeEmailButton, 2, 2 ); 183 topLayout->addWidget( mChangeEmailButton, 2, 2 );
177 connect( mChangeEmailButton, SIGNAL( clicked() ), SLOT( changeEmail() ) ); 184 connect( mChangeEmailButton, SIGNAL( clicked() ), SLOT( changeEmail() ) );
178 185
179 topLayout->addWidget( mRemoveContactButton, 2, 3 ); 186 topLayout->addWidget( mRemoveContactButton, 2, 3 );
180 connect( mRemoveContactButton, SIGNAL( clicked() ), SLOT( removeContact() ) ); 187 connect( mRemoveContactButton, SIGNAL( clicked() ), SLOT( removeContact() ) );
181 188
182 mManager = new KABC::DistributionListManager( core->addressBook() ); 189 mManager = new KABC::DistributionListManager( core->addressBook() );
183 mManager->load(); 190 mManager->load();
184 191
185 updateNameCombo(); 192 updateNameCombo();
186 193
187#ifdef KAB_EMBEDDED 194#ifdef KAB_EMBEDDED
188// if (KGlobal::getOrientation() == KGlobal::Portrait) 195// if (KGlobal::getOrientation() == KGlobal::Portrait)
189// parent->setMaximumSize( KGlobal::getDesktopWidth() , 150); 196// parent->setMaximumSize( KGlobal::getDesktopWidth() , 150);
190#endif //KAB_EMBEDDED 197#endif //KAB_EMBEDDED
191 198
192#ifndef KAB_EMBEDDED 199#ifndef KAB_EMBEDDED
193 KAcceleratorManager::manage( this ); 200 KAcceleratorManager::manage( this );
194#endif //KAB_EMBEDDED 201#endif //KAB_EMBEDDED
195} 202}
196 203
197DistributionListWidget::~DistributionListWidget() 204DistributionListWidget::~DistributionListWidget()
198{ 205{
199 delete mManager; 206 delete mManager;
200} 207}
201 208
202void DistributionListWidget::save() 209void DistributionListWidget::save()
203{ 210{
204qDebug("DistributionListWidget::save"); 211qDebug("DistributionListWidget::save");
205 mManager->save(); 212 mManager->save();
206} 213}
207 214
208void DistributionListWidget::selectionContactViewChanged() 215void DistributionListWidget::selectionContactViewChanged()
209{ 216{
210 ContactItem *contactItem = 217 ContactItem *contactItem =
211 static_cast<ContactItem *>( mContactView->selectedItem() ); 218 static_cast<ContactItem *>( mContactView->selectedItem() );
212 bool state = contactItem; 219 bool state = contactItem;
213 220
214 mChangeEmailButton->setEnabled( state ); 221 mChangeEmailButton->setEnabled( state );
215 mRemoveContactButton->setEnabled( state ); 222 mRemoveContactButton->setEnabled( state );
216} 223}
217 224
218void DistributionListWidget::createList() 225void DistributionListWidget::createList()
219{ 226{
220 KLineEditDlg dlg( i18n( "Please enter name:" ), QString::null, this ); 227 KLineEditDlg dlg( i18n( "Please enter name:" ), QString::null, this );
221#ifdef KAB_EMBEDDED 228#ifdef KAB_EMBEDDED
222 dlg.setFixedSize(200, 50); 229 dlg.setFixedSize(200, 50);
223#endif //KAB_EMBEDDED 230#endif //KAB_EMBEDDED
224 dlg.setCaption( i18n( "New Distribution List" ) ); 231 dlg.setCaption( i18n( "New Distribution List" ) );
225 if ( !dlg.exec() ) 232 if ( !dlg.exec() )
226 return; 233 return;
227 234
228 new KABC::DistributionList( mManager, dlg.text() ); 235 new KABC::DistributionList( mManager, dlg.text() );
229 236
230 mNameCombo->clear(); 237 mNameCombo->clear();
231 mNameCombo->insertStringList( mManager->listNames() ); 238 mNameCombo->insertStringList( mManager->listNames() );
232 mNameCombo->setCurrentItem( mNameCombo->count() - 1 ); 239 mNameCombo->setCurrentItem( mNameCombo->count() - 1 );
233 240
234 updateContactView(); 241 updateContactView();
235 242
236 changed(); 243 changed();
237} 244}
238 245
239void DistributionListWidget::editList() 246void DistributionListWidget::editList()
240{ 247{
241 QString oldName = mNameCombo->currentText(); 248 QString oldName = mNameCombo->currentText();
242 249
243 KLineEditDlg dlg( i18n( "Please change name:" ), oldName, this ); 250 KLineEditDlg dlg( i18n( "Please change name:" ), oldName, this );
244#ifdef KAB_EMBEDDED 251#ifdef KAB_EMBEDDED
245 dlg.setFixedSize(200, 50); 252 dlg.setFixedSize(200, 50);
246#endif //KAB_EMBEDDED 253#endif //KAB_EMBEDDED
247 dlg.setCaption( i18n("Distribution List") ); 254 dlg.setCaption( i18n("Distribution List") );
248 if ( !dlg.exec() ) 255 if ( !dlg.exec() )
249 return; 256 return;
250 257
251 KABC::DistributionList *list = mManager->list( oldName ); 258 KABC::DistributionList *list = mManager->list( oldName );
252 list->setName( dlg.text() ); 259 list->setName( dlg.text() );
253 260
254 mNameCombo->clear(); 261 mNameCombo->clear();
255 mNameCombo->insertStringList( mManager->listNames() ); 262 mNameCombo->insertStringList( mManager->listNames() );
256 mNameCombo->setCurrentItem( mNameCombo->count() - 1 ); 263 mNameCombo->setCurrentItem( mNameCombo->count() - 1 );
257 264
258 updateContactView(); 265 updateContactView();
259 266
260 changed(); 267 changed();
261} 268}
262 269
263void DistributionListWidget::removeList() 270void DistributionListWidget::removeList()
264{ 271{
265 int result = KMessageBox::warningContinueCancel( this, 272 int result = KMessageBox::warningContinueCancel( this,
266 i18n( "<qt>Delete distribution list <b>%1</b>?</qt>" ) .arg( mNameCombo->currentText() ), 273 i18n( "<qt>Delete distribution list <b>%1</b>?</qt>" ) .arg( mNameCombo->currentText() ),
267 QString::null, i18n( "Delete" ) ); 274 QString::null, i18n( "Delete" ) );
268 275
269 if ( result != KMessageBox::Continue ) 276 if ( result != KMessageBox::Continue )
270 return; 277 return;
271 278
272 delete mManager->list( mNameCombo->currentText() ); 279 delete mManager->list( mNameCombo->currentText() );
273 mNameCombo->removeItem( mNameCombo->currentItem() ); 280 mNameCombo->removeItem( mNameCombo->currentItem() );
274 281
275 updateContactView(); 282 updateContactView();
276 283
277 changed(); 284 changed();
278} 285}
279 286
280void DistributionListWidget::addContact() 287void DistributionListWidget::addContact()
281{ 288{
282 KABC::DistributionList *list = mManager->list( mNameCombo->currentText() ); 289 KABC::DistributionList *list = mManager->list( mNameCombo->currentText() );
283 if ( !list ) 290 if ( !list )
284 return; 291 return;
285 292
286 KABC::Addressee::List addrList = selectedContacts(); 293 KABC::Addressee::List addrList = selectedContacts();
287 KABC::Addressee::List::Iterator it; 294 KABC::Addressee::List::Iterator it;
288 for ( it = addrList.begin(); it != addrList.end(); ++it ) 295 for ( it = addrList.begin(); it != addrList.end(); ++it )
289 list->insertEntry( *it ); 296 list->insertEntry( *it );
290 297
291 updateContactView(); 298 updateContactView();
292 299
293 changed(); 300 changed();
294} 301}
295 302
296void DistributionListWidget::removeContact() 303void DistributionListWidget::removeContact()
297{ 304{
298 KABC::DistributionList *list = mManager->list( mNameCombo->currentText() ); 305 KABC::DistributionList *list = mManager->list( mNameCombo->currentText() );
299 if ( !list ) 306 if ( !list )
300 return; 307 return;
301 308
302 ContactItem *contactItem = 309 ContactItem *contactItem =
303 static_cast<ContactItem *>( mContactView->selectedItem() ); 310 static_cast<ContactItem *>( mContactView->selectedItem() );
304 if ( !contactItem ) 311 if ( !contactItem )
305 return; 312 return;
306 313
307 list->removeEntry( contactItem->addressee(), contactItem->email() ); 314 list->removeEntry( contactItem->addressee(), contactItem->email() );
308 delete contactItem; 315 delete contactItem;
309 316
310 changed(); 317 changed();
311} 318}
312 319
313void DistributionListWidget::changeEmail() 320void DistributionListWidget::changeEmail()
314{ 321{
315 KABC::DistributionList *list = mManager->list( mNameCombo->currentText() ); 322 KABC::DistributionList *list = mManager->list( mNameCombo->currentText() );
316 if ( !list ) 323 if ( !list )
317 return; 324 return;
318 325
319 ContactItem *contactItem = 326 ContactItem *contactItem =
320 static_cast<ContactItem *>( mContactView->selectedItem() ); 327 static_cast<ContactItem *>( mContactView->selectedItem() );
321 if ( !contactItem ) 328 if ( !contactItem )
322 return; 329 return;
323 330
324 QString email = EmailSelector::getEmail( contactItem->addressee().emails(), 331 QString email = EmailSelector::getEmail( contactItem->addressee().emails(),
325 contactItem->email(), this ); 332 contactItem->email(), this );
326 list->removeEntry( contactItem->addressee(), contactItem->email() ); 333 list->removeEntry( contactItem->addressee(), contactItem->email() );
327 list->insertEntry( contactItem->addressee(), email ); 334 list->insertEntry( contactItem->addressee(), email );
328 335
329 updateContactView(); 336 updateContactView();
330 337
331 changed(); 338 changed();
332} 339}
333 340
334void DistributionListWidget::updateContactView() 341void DistributionListWidget::updateContactView()
335{ 342{
336 mContactView->clear(); 343 mContactView->clear();
337 344
338 KABC::DistributionList *list = mManager->list( mNameCombo->currentText() ); 345 KABC::DistributionList *list = mManager->list( mNameCombo->currentText() );
339 if ( !list ) { 346 if ( !list ) {
340 mEditListButton->setEnabled( false ); 347 mEditListButton->setEnabled( false );
341 mRemoveListButton->setEnabled( false ); 348 mRemoveListButton->setEnabled( false );
342 mChangeEmailButton->setEnabled( false ); 349 mChangeEmailButton->setEnabled( false );
343 mRemoveContactButton->setEnabled( false ); 350 mRemoveContactButton->setEnabled( false );
344 mContactView->setEnabled( false ); 351 mContactView->setEnabled( false );
345 return; 352 return;
346 } else { 353 } else {
347 mEditListButton->setEnabled( true ); 354 mEditListButton->setEnabled( true );
348 mRemoveListButton->setEnabled( true ); 355 mRemoveListButton->setEnabled( true );
349 mContactView->setEnabled( true ); 356 mContactView->setEnabled( true );
350 } 357 }
351 358
352 KABC::DistributionList::Entry::List entries = list->entries(); 359 KABC::DistributionList::Entry::List entries = list->entries();
353 KABC::DistributionList::Entry::List::ConstIterator it; 360 KABC::DistributionList::Entry::List::ConstIterator it;
354 for( it = entries.begin(); it != entries.end(); ++it ) 361 for( it = entries.begin(); it != entries.end(); ++it )
355 new ContactItem( mContactView, (*it).addressee, (*it).email ); 362 new ContactItem( mContactView, (*it).addressee, (*it).email );
356 363
357 ContactItem *contactItem = 364 ContactItem *contactItem =
358 static_cast<ContactItem *>( mContactView->selectedItem() ); 365 static_cast<ContactItem *>( mContactView->selectedItem() );
359 bool state = contactItem; 366 bool state = contactItem;
360 367
361 mChangeEmailButton->setEnabled( state ); 368 mChangeEmailButton->setEnabled( state );
362 mRemoveContactButton->setEnabled( state ); 369 mRemoveContactButton->setEnabled( state );
363} 370}
364 371
365void DistributionListWidget::updateNameCombo() 372void DistributionListWidget::updateNameCombo()
366{ 373{
367 mNameCombo->insertStringList( mManager->listNames() ); 374 mNameCombo->insertStringList( mManager->listNames() );
368 375
369 updateContactView(); 376 updateContactView();
370} 377}
371 378
372void DistributionListWidget::dropEvent( QDropEvent *e ) 379void DistributionListWidget::dropEvent( QDropEvent *e )
373{ 380{
374 KABC::DistributionList *distributionList = mManager->list( mNameCombo->currentText() ); 381 KABC::DistributionList *distributionList = mManager->list( mNameCombo->currentText() );
375 if ( !distributionList ) 382 if ( !distributionList )
376 return; 383 return;
377 384
378 QString vcards; 385 QString vcards;
379#ifndef KAB_EMBEDDED 386#ifndef KAB_EMBEDDED
380 if ( KVCardDrag::decode( e, vcards ) ) { 387 if ( KVCardDrag::decode( e, vcards ) ) {
381#endif //KAB_EMBEDDED 388#endif //KAB_EMBEDDED
382 QStringList list = QStringList::split( "\r\n\r\n", vcards ); 389 QStringList list = QStringList::split( "\r\n\r\n", vcards );
383 QStringList::Iterator it; 390 QStringList::Iterator it;
384 KABC::VCardConverter converter; 391 KABC::VCardConverter converter;
385 for ( it = list.begin(); it != list.end(); ++it ) { 392 for ( it = list.begin(); it != list.end(); ++it ) {
386 KABC::Addressee addr; 393 KABC::Addressee addr;
387 if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) 394 if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) )
388 distributionList->insertEntry( addr ); 395 distributionList->insertEntry( addr );
389 } 396 }
390 397
391 changed(); 398 changed();
392 updateContactView(); 399 updateContactView();
393#ifndef KAB_EMBEDDED 400#ifndef KAB_EMBEDDED
394 } 401 }
395#endif //KAB_EMBEDDED 402#endif //KAB_EMBEDDED
396} 403}
397 404
398void DistributionListWidget::contactsSelectionChanged() 405void DistributionListWidget::contactsSelectionChanged()
399{ 406{
400 mAddContactButton->setEnabled( contactsSelected() && mNameCombo->count() > 0 ); 407 mAddContactButton->setEnabled( contactsSelected() && mNameCombo->count() > 0 );
401} 408}
402 409
403QString DistributionListWidget::title() const 410QString DistributionListWidget::title() const
404{ 411{
405 return i18n( "Distribution List Editor" ); 412 return i18n( "Distribution List Editor" );
406} 413}
407 414
408QString DistributionListWidget::identifier() const 415QString DistributionListWidget::identifier() const
409{ 416{
410 return "distribution_list_editor"; 417 return "distribution_list_editor";
411} 418}
412 419
413void DistributionListWidget::dropped( QDropEvent *e, QListViewItem* ) 420void DistributionListWidget::dropped( QDropEvent *e, Q3ListViewItem* )
414{ 421{
415 dropEvent( e ); 422 dropEvent( e );
416} 423}
417 424
418void DistributionListWidget::changed() 425void DistributionListWidget::changed()
419{ 426{
420 save(); 427 save();
421} 428}
422 429
423 430
424DistributionListView::DistributionListView( QWidget *parent, const char* name ) 431DistributionListView::DistributionListView( QWidget *parent, const char* name )
425 : KListView( parent, name ) 432 : KListView( parent, name )
426{ 433{
427 setDragEnabled( true ); 434 setDragEnabled( true );
428 setAcceptDrops( true ); 435 setAcceptDrops( true );
429 setAllColumnsShowFocus( true ); 436 setAllColumnsShowFocus( true );
430} 437}
431 438
432void DistributionListView::dragEnterEvent( QDragEnterEvent* e ) 439void DistributionListView::dragEnterEvent( QDragEnterEvent* e )
433{ 440{
434#ifndef KAB_EMBEDDED 441#ifndef KAB_EMBEDDED
435 bool canDecode = QTextDrag::canDecode( e ); 442 bool canDecode = Q3TextDrag::canDecode( e );
436 e->accept( canDecode ); 443 e->accept( canDecode );
437#endif //KAB_EMBEDDED 444#endif //KAB_EMBEDDED
438} 445}
439 446
440void DistributionListView::viewportDragMoveEvent( QDragMoveEvent *e ) 447void DistributionListView::viewportDragMoveEvent( QDragMoveEvent *e )
441{ 448{
442#ifndef KAB_EMBEDDED 449#ifndef KAB_EMBEDDED
443 bool canDecode = QTextDrag::canDecode( e ); 450 bool canDecode = Q3TextDrag::canDecode( e );
444 e->accept( canDecode ); 451 e->accept( canDecode );
445#endif //KAB_EMBEDDED 452#endif //KAB_EMBEDDED
446} 453}
447 454
448void DistributionListView::viewportDropEvent( QDropEvent *e ) 455void DistributionListView::viewportDropEvent( QDropEvent *e )
449{ 456{
450 emit dropped( e, 0 ); 457 emit dropped( e, 0 );
451} 458}
452 459
453void DistributionListView::dropEvent( QDropEvent *e ) 460void DistributionListView::dropEvent( QDropEvent *e )
454{ 461{
455 emit dropped( e, 0 ); 462 emit dropped( e, 0 );
456} 463}
457 464
458 465
459EmailSelector::EmailSelector( const QStringList &emails, 466EmailSelector::EmailSelector( const QStringList &emails,
460 const QString &current, QWidget *parent ) 467 const QString &current, QWidget *parent )
461 : KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok, 468 : KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok,
462 parent ) 469 parent )
463{ 470{
464 QFrame *topFrame = plainPage(); 471 Q3Frame *topFrame = plainPage();
465 QBoxLayout *topLayout = new QVBoxLayout( topFrame ); 472 Q3BoxLayout *topLayout = new Q3VBoxLayout( topFrame );
466 473
467 mButtonGroup = new QButtonGroup( 1, Horizontal, i18n("Email Addresses"), 474 mButtonGroup = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Email Addresses"),
468 topFrame ); 475 topFrame );
469 topLayout->addWidget( mButtonGroup ); 476 topLayout->addWidget( mButtonGroup );
470 477
471 QStringList::ConstIterator it; 478 QStringList::ConstIterator it;
472 for( it = emails.begin(); it != emails.end(); ++it ) { 479 for( it = emails.begin(); it != emails.end(); ++it ) {
473 QRadioButton *button = new QRadioButton( *it, mButtonGroup ); 480 QRadioButton *button = new QRadioButton( *it, mButtonGroup );
474 if ( (*it) == current ) { 481 if ( (*it) == current ) {
475 button->setDown( true ); 482 button->setDown( true );
476 } 483 }
477 } 484 }
478} 485}
479 486
480QString EmailSelector::selected() 487QString EmailSelector::selected()
481{ 488{
482 QButton *button = mButtonGroup->selected(); 489 QAbstractButton *button = mButtonGroup->selected();
483 if ( button ) 490 if ( button )
484 return button->text(); 491 return button->text();
485 492
486 return QString::null; 493 return QString::null;
487} 494}
488 495
489QString EmailSelector::getEmail( const QStringList &emails, 496QString EmailSelector::getEmail( const QStringList &emails,
490 const QString &current, QWidget *parent ) 497 const QString &current, QWidget *parent )
491{ 498{
492 EmailSelector dlg( emails, current, parent ); 499 EmailSelector dlg( emails, current, parent );
493 dlg.exec(); 500 dlg.exec();
494 501
495 return dlg.selected(); 502 return dlg.selected();
496} 503}
497 504
498 505
499#ifndef KAB_EMBEDDED 506#ifndef KAB_EMBEDDED_
500#include "distributionlistwidget.moc" 507#include "moc_distributionlistwidget.cpp"
501#endif //KAB_EMBEDDED 508#endif //KAB_EMBEDDED
diff --git a/kaddressbook/features/distributionlistwidget.h b/kaddressbook/features/distributionlistwidget.h
index 82bac3d..f619389 100644
--- a/kaddressbook/features/distributionlistwidget.h
+++ b/kaddressbook/features/distributionlistwidget.h
@@ -1,143 +1,148 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
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 DISTRIBUTIONLISTWIDGET_H 24#ifndef DISTRIBUTIONLISTWIDGET_H
25#define DISTRIBUTIONLISTWIDGET_H 25#define DISTRIBUTIONLISTWIDGET_H
26 26
27#include <kdialogbase.h> 27#include <kdialogbase.h>
28#include <klistview.h> 28#include <klistview.h>
29 29
30#include "extensionwidget.h" 30#include "extensionwidget.h"
31//Added by qt3to4:
32#include <QDragEnterEvent>
33#include <QDropEvent>
34#include <QLabel>
35#include <QDragMoveEvent>
31 36
32class QButtonGroup; 37class Q3ButtonGroup;
33class QComboBox; 38class QComboBox;
34class QLabel; 39class QLabel;
35class QListView; 40class Q3ListView;
36 41
37class DistributionListView; 42class DistributionListView;
38class KABCore; 43class KABCore;
39 44
40namespace KABC { 45namespace KABC {
41class AddressBook; 46class AddressBook;
42class DistributionListManager; 47class DistributionListManager;
43} 48}
44 49
45class DistributionListWidget : public ExtensionWidget 50class DistributionListWidget : public ExtensionWidget
46{ 51{
47 Q_OBJECT 52 Q_OBJECT
48 53
49 public: 54 public:
50 DistributionListWidget( KABCore*, QWidget *parent, const char *name = 0 ); 55 DistributionListWidget( KABCore*, QWidget *parent, const char *name = 0 );
51 virtual ~DistributionListWidget(); 56 virtual ~DistributionListWidget();
52 57
53 void contactsSelectionChanged(); 58 void contactsSelectionChanged();
54 59
55 QString title() const; 60 QString title() const;
56 QString identifier() const; 61 QString identifier() const;
57 62
58 public slots: 63 public slots:
59 void save(); 64 void save();
60 void dropped( QDropEvent*, QListViewItem* ); 65 void dropped( QDropEvent*, Q3ListViewItem* );
61 66
62 private slots: 67 private slots:
63 void createList(); 68 void createList();
64 void editList(); 69 void editList();
65 void removeList(); 70 void removeList();
66 void addContact(); 71 void addContact();
67 void removeContact(); 72 void removeContact();
68 void changeEmail(); 73 void changeEmail();
69 void updateNameCombo(); 74 void updateNameCombo();
70 void updateContactView(); 75 void updateContactView();
71 void selectionContactViewChanged(); 76 void selectionContactViewChanged();
72 void changed(); 77 void changed();
73 78
74 protected: 79 protected:
75 void dropEvent( QDropEvent* ); 80 void dropEvent( QDropEvent* );
76 81
77 private: 82 private:
78 QComboBox *mNameCombo; 83 QComboBox *mNameCombo;
79 QLabel *mListLabel; 84 QLabel *mListLabel;
80 DistributionListView *mContactView; 85 DistributionListView *mContactView;
81 86
82 KABC::DistributionListManager *mManager; 87 KABC::DistributionListManager *mManager;
83 QPushButton *mCreateListButton; 88 QPushButton *mCreateListButton;
84 QPushButton *mEditListButton; 89 QPushButton *mEditListButton;
85 QPushButton *mRemoveListButton; 90 QPushButton *mRemoveListButton;
86 QPushButton *mChangeEmailButton; 91 QPushButton *mChangeEmailButton;
87 QPushButton *mAddContactButton; 92 QPushButton *mAddContactButton;
88 QPushButton *mRemoveContactButton; 93 QPushButton *mRemoveContactButton;
89}; 94};
90 95
91/** 96/**
92 @short Helper class 97 @short Helper class
93*/ 98*/
94class DistributionListView : public KListView 99class DistributionListView : public KListView
95{ 100{
96 Q_OBJECT 101 Q_OBJECT
97 102
98 public: 103 public:
99 DistributionListView( QWidget *parent, const char* name = 0 ); 104 DistributionListView( QWidget *parent, const char* name = 0 );
100 105
101 protected: 106 protected:
102 void dragEnterEvent( QDragEnterEvent *e ); 107 void dragEnterEvent( QDragEnterEvent *e );
103 void dropEvent( QDropEvent *e ); 108 void dropEvent( QDropEvent *e );
104 void viewportDragMoveEvent( QDragMoveEvent *e ); 109 void viewportDragMoveEvent( QDragMoveEvent *e );
105 void viewportDropEvent( QDropEvent *e ); 110 void viewportDropEvent( QDropEvent *e );
106}; 111};
107 112
108/** 113/**
109 @short Helper class 114 @short Helper class
110*/ 115*/
111class EmailSelector : public KDialogBase 116class EmailSelector : public KDialogBase
112{ 117{
113 public: 118 public:
114 EmailSelector( const QStringList &emails, const QString &current, 119 EmailSelector( const QStringList &emails, const QString &current,
115 QWidget *parent ); 120 QWidget *parent );
116 121
117 QString selected(); 122 QString selected();
118 123
119 static QString getEmail( const QStringList &emails, const QString &current, 124 static QString getEmail( const QStringList &emails, const QString &current,
120 QWidget *parent ); 125 QWidget *parent );
121 126
122 private: 127 private:
123 QButtonGroup *mButtonGroup; 128 Q3ButtonGroup *mButtonGroup;
124}; 129};
125 130
126 131
127#ifdef KAB_EMBEDDED 132#ifdef KAB_EMBEDDED
128class DistributionListFactory : public ExtensionFactory 133class DistributionListFactory : public ExtensionFactory
129{ 134{
130 public: 135 public:
131 ExtensionWidget *extension( KABCore *core, QWidget *parent, const char *name ) 136 ExtensionWidget *extension( KABCore *core, QWidget *parent, const char *name )
132 { 137 {
133 return new DistributionListWidget( core, parent, name ); 138 return new DistributionListWidget( core, parent, name );
134 } 139 }
135 140
136 QString identifier() const 141 QString identifier() const
137 { 142 {
138 return "distribution_list_editor"; 143 return "distribution_list_editor";
139 } 144 }
140}; 145};
141#endif //KAB_EMBEDDED 146#endif //KAB_EMBEDDED
142 147
143#endif 148#endif
diff --git a/kaddressbook/features/mergewidget.cpp b/kaddressbook/features/mergewidget.cpp
index 2476e42..1becc2f 100644
--- a/kaddressbook/features/mergewidget.cpp
+++ b/kaddressbook/features/mergewidget.cpp
@@ -1,374 +1,376 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
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 <qlayout.h> 24#include <qlayout.h>
25#include <qpushbutton.h> 25#include <qpushbutton.h>
26//Added by qt3to4:
27#include <Q3GridLayout>
26 28
27#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
28#include <kaccelmanager.h> 30#include <kaccelmanager.h>
29#endif //KAB_EMBEDDED 31#endif //KAB_EMBEDDED
30 32
31#include <kdebug.h> 33#include <kdebug.h>
32#include <klistview.h> 34#include <klistview.h>
33#include <klocale.h> 35#include <klocale.h>
34#include <kglobal.h> 36#include <kglobal.h>
35#include <kmessagebox.h> 37#include <kmessagebox.h>
36 38
37#include <kabc/addressbook.h> 39#include <kabc/addressbook.h>
38 40
39#include "kabcore.h" 41#include "kabcore.h"
40 42
41#include "mergewidget.h" 43#include "mergewidget.h"
42 44
43#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
44class MergeFactory : public ExtensionFactory 46class MergeFactory : public ExtensionFactory
45{ 47{
46 public: 48 public:
47 ExtensionWidget *extension( KABCore *core, QWidget *parent, const char *name ) 49 ExtensionWidget *extension( KABCore *core, QWidget *parent, const char *name )
48 { 50 {
49 return new MergeWidget( core, parent, name ); 51 return new MergeWidget( core, parent, name );
50 } 52 }
51 53
52 QString identifier() const 54 QString identifier() const
53 { 55 {
54 return "merge"; 56 return "merge";
55 } 57 }
56}; 58};
57 59
58extern "C" { 60extern "C" {
59 void *init_libkaddrbk_merge() 61 void *init_libkaddrbk_merge()
60 { 62 {
61 return ( new MergeFactory ); 63 return ( new MergeFactory );
62 } 64 }
63} 65}
64#endif //KAB_EMBEDDED 66#endif //KAB_EMBEDDED
65 67
66class ContactItem : public QListViewItem 68class ContactItem : public Q3ListViewItem
67{ 69{
68 public: 70 public:
69 ContactItem( KListView *parent, const KABC::Addressee &addressee ) 71 ContactItem( KListView *parent, const KABC::Addressee &addressee )
70 : QListViewItem( parent ), mAddressee( addressee ) 72 : Q3ListViewItem( parent ), mAddressee( addressee )
71 { 73 {
72 KABC::Field::List fieldList = KABC::Field::defaultFields(); 74 KABC::Field::List fieldList = KABC::Field::defaultFields();
73 KABC::Field::List::ConstIterator it; 75 KABC::Field::List::ConstIterator it;
74 76
75 int i = 0; 77 int i = 0;
76 for ( it = fieldList.begin(); it != fieldList.end(); ++it ) 78 for ( it = fieldList.begin(); it != fieldList.end(); ++it )
77 setText( i++, (*it)->value( mAddressee ) ); 79 setText( i++, (*it)->value( mAddressee ) );
78 } 80 }
79 81
80 KABC::Addressee addressee() const 82 KABC::Addressee addressee() const
81 { 83 {
82 return mAddressee; 84 return mAddressee;
83 } 85 }
84 86
85 private: 87 private:
86 KABC::Addressee mAddressee; 88 KABC::Addressee mAddressee;
87}; 89};
88 90
89MergeWidget::MergeWidget( KABCore *core, QWidget *parent, const char *name ) 91MergeWidget::MergeWidget( KABCore *core, QWidget *parent, const char *name )
90 : ExtensionWidget( core, parent, name ), mBlockUpdate( false ) 92 : ExtensionWidget( core, parent, name ), mBlockUpdate( false )
91{ 93{
92#ifdef KAB_EMBEDDED 94#ifdef KAB_EMBEDDED
93 if (KGlobal::getOrientation() == KGlobal::Portrait) 95 if (KGlobal::getOrientation() == KGlobal::Portrait)
94 parent->setMaximumSize( KGlobal::getDesktopWidth() , 180); 96 parent->setMaximumSize( KGlobal::getDesktopWidth() , 180);
95#endif //KAB_EMBEDDED 97#endif //KAB_EMBEDDED
96 98
97 QGridLayout *topLayout = new QGridLayout( this, 3, 2, KDialog::marginHint(), 99 Q3GridLayout *topLayout = new Q3GridLayout( this, 3, 2, KDialog::marginHint(),
98 KDialog::spacingHint() ); 100 KDialog::spacingHint() );
99 101
100 mContactView = new KListView( this ); 102 mContactView = new KListView( this );
101 KABC::Field::List fieldList = KABC::Field::defaultFields(); 103 KABC::Field::List fieldList = KABC::Field::defaultFields();
102 KABC::Field::List::ConstIterator it; 104 KABC::Field::List::ConstIterator it;
103 105
104 for ( it = fieldList.begin(); it != fieldList.end(); ++it ) 106 for ( it = fieldList.begin(); it != fieldList.end(); ++it )
105 mContactView->addColumn( (*it)->label() ); 107 mContactView->addColumn( (*it)->label() );
106 108
107 mContactView->setEnabled( false ); 109 mContactView->setEnabled( false );
108 mContactView->setAllColumnsShowFocus( true ); 110 mContactView->setAllColumnsShowFocus( true );
109 topLayout->addMultiCellWidget( mContactView, 0, 2, 0, 0 ); 111 topLayout->addMultiCellWidget( mContactView, 0, 2, 0, 0 );
110 112
111 connect( mContactView, SIGNAL( selectionChanged() ), 113 connect( mContactView, SIGNAL( selectionChanged() ),
112 SLOT( selectionContactViewChanged() ) ); 114 SLOT( selectionContactViewChanged() ) );
113 115
114 mMergeAndRemoveButton = new QPushButton( i18n( "Merge and Remove" ), this ); 116 mMergeAndRemoveButton = new QPushButton( i18n( "Merge and Remove" ), this );
115 mMergeAndRemoveButton->setEnabled( false ); 117 mMergeAndRemoveButton->setEnabled( false );
116 topLayout->addWidget( mMergeAndRemoveButton, 0, 1 ); 118 topLayout->addWidget( mMergeAndRemoveButton, 0, 1 );
117 connect( mMergeAndRemoveButton, SIGNAL( clicked() ), SLOT( mergeAndRemove() ) ); 119 connect( mMergeAndRemoveButton, SIGNAL( clicked() ), SLOT( mergeAndRemove() ) );
118 120
119 mMergeButton = new QPushButton( i18n( "Merge" ), this ); 121 mMergeButton = new QPushButton( i18n( "Merge" ), this );
120 mMergeButton->setEnabled( false ); 122 mMergeButton->setEnabled( false );
121 topLayout->addWidget( mMergeButton, 1, 1 ); 123 topLayout->addWidget( mMergeButton, 1, 1 );
122 connect( mMergeButton, SIGNAL( clicked() ), SLOT( merge() ) ); 124 connect( mMergeButton, SIGNAL( clicked() ), SLOT( merge() ) );
123 125
124#ifndef KAB_EMBEDDED 126#ifndef KAB_EMBEDDED
125 KAcceleratorManager::manage( this ); 127 KAcceleratorManager::manage( this );
126#endif //KAB_EMBEDDED 128#endif //KAB_EMBEDDED
127} 129}
128 130
129MergeWidget::~MergeWidget() 131MergeWidget::~MergeWidget()
130{ 132{
131} 133}
132 134
133void MergeWidget::selectionContactViewChanged() 135void MergeWidget::selectionContactViewChanged()
134{ 136{
135#ifndef KAB_EMBEDDED 137#ifndef KAB_EMBEDDED
136 ContactItem *contactItem = 138 ContactItem *contactItem =
137 dynamic_cast<ContactItem*>( mContactView->selectedItem() ); 139 dynamic_cast<ContactItem*>( mContactView->selectedItem() );
138#else //KAB_EMBEDDED 140#else //KAB_EMBEDDED
139 ContactItem *contactItem =(ContactItem*)( mContactView->selectedItem() ); 141 ContactItem *contactItem =(ContactItem*)( mContactView->selectedItem() );
140#endif //KAB_EMBEDDED 142#endif //KAB_EMBEDDED
141 143
142 bool state = (contactItem != 0); 144 bool state = (contactItem != 0);
143 145
144 mMergeAndRemoveButton->setEnabled( state ); 146 mMergeAndRemoveButton->setEnabled( state );
145 mMergeButton->setEnabled( state ); 147 mMergeButton->setEnabled( state );
146} 148}
147 149
148void MergeWidget::contactsSelectionChanged() 150void MergeWidget::contactsSelectionChanged()
149{ 151{
150 if ( mBlockUpdate ) 152 if ( mBlockUpdate )
151 return; 153 return;
152 154
153 if ( !contactsSelected() ) { 155 if ( !contactsSelected() ) {
154 mContactView->setEnabled( false ); 156 mContactView->setEnabled( false );
155 mContactView->clear(); 157 mContactView->clear();
156 mMergeAndRemoveButton->setEnabled( false ); 158 mMergeAndRemoveButton->setEnabled( false );
157 mMergeButton->setEnabled( false ); 159 mMergeButton->setEnabled( false );
158 } else { 160 } else {
159 KABC::Addressee::List list = selectedContacts(); 161 KABC::Addressee::List list = selectedContacts();
160 if ( list.count() > 1 ) { 162 if ( list.count() > 1 ) {
161 mContactView->setEnabled( false ); 163 mContactView->setEnabled( false );
162 mContactView->clear(); 164 mContactView->clear();
163 mMergeAndRemoveButton->setEnabled( false ); 165 mMergeAndRemoveButton->setEnabled( false );
164 mMergeButton->setEnabled( false ); 166 mMergeButton->setEnabled( false );
165 return; 167 return;
166 } else { 168 } else {
167 mContactView->setEnabled( true ); 169 mContactView->setEnabled( true );
168 mMasterAddressee = list[ 0 ]; 170 mMasterAddressee = list[ 0 ];
169 updateView(); 171 updateView();
170 } 172 }
171 } 173 }
172} 174}
173 175
174void MergeWidget::updateView() 176void MergeWidget::updateView()
175{ 177{
176 mContactView->clear(); 178 mContactView->clear();
177 179
178 KABC::AddressBook::Iterator it; 180 KABC::AddressBook::Iterator it;
179 KABC::AddressBook *ab = core()->addressBook(); 181 KABC::AddressBook *ab = core()->addressBook();
180 if ( !ab ) 182 if ( !ab )
181 return; 183 return;
182 184
183 for ( it = ab->begin(); it != ab->end(); ++it ) 185 for ( it = ab->begin(); it != ab->end(); ++it )
184 if ( (*it).uid() != mMasterAddressee.uid() ) 186 if ( (*it).uid() != mMasterAddressee.uid() )
185 new ContactItem( mContactView, *it ); 187 new ContactItem( mContactView, *it );
186} 188}
187 189
188QString MergeWidget::title() const 190QString MergeWidget::title() const
189{ 191{
190 return i18n( "Merge Contacts Editor" ); 192 return i18n( "Merge Contacts Editor" );
191} 193}
192 194
193QString MergeWidget::identifier() const 195QString MergeWidget::identifier() const
194{ 196{
195 return "merge"; 197 return "merge";
196} 198}
197 199
198void MergeWidget::mergeAndRemove() 200void MergeWidget::mergeAndRemove()
199{ 201{
200#ifndef KAB_EMBEDDED 202#ifndef KAB_EMBEDDED
201 ContactItem *item = dynamic_cast<ContactItem*>( mContactView->currentItem() ); 203 ContactItem *item = dynamic_cast<ContactItem*>( mContactView->currentItem() );
202#else //KAB_EMBEDDED 204#else //KAB_EMBEDDED
203 ContactItem *item = (ContactItem*)( mContactView->currentItem() ); 205 ContactItem *item = (ContactItem*)( mContactView->currentItem() );
204#endif //KAB_EMBEDDED 206#endif //KAB_EMBEDDED
205 if ( !item ) 207 if ( !item )
206 return; 208 return;
207 209
208 QString oldUID = item->addressee().uid(); 210 QString oldUID = item->addressee().uid();
209 211
210 doMerge( item->addressee() ); 212 doMerge( item->addressee() );
211 213
212 KABC::Addressee::List retval; 214 KABC::Addressee::List retval;
213 retval << mMasterAddressee; 215 retval << mMasterAddressee;
214 emit modified( retval ); 216 emit modified( retval );
215 217
216 mBlockUpdate = true; 218 mBlockUpdate = true;
217 core()->deleteContacts( oldUID ); 219 core()->deleteContacts( QStringList(oldUID) );
218 core()->setContactSelected( mMasterAddressee.uid() ); 220 core()->setContactSelected( mMasterAddressee.uid() );
219 mBlockUpdate = false; 221 mBlockUpdate = false;
220 222
221 updateView(); 223 updateView();
222} 224}
223 225
224void MergeWidget::merge() 226void MergeWidget::merge()
225{ 227{
226#ifndef KAB_EMBEDDED 228#ifndef KAB_EMBEDDED
227 ContactItem *item = dynamic_cast<ContactItem*>( mContactView->currentItem() ); 229 ContactItem *item = dynamic_cast<ContactItem*>( mContactView->currentItem() );
228#else //KAB_EMBEDDED 230#else //KAB_EMBEDDED
229 ContactItem *item = (ContactItem*)( mContactView->currentItem() ); 231 ContactItem *item = (ContactItem*)( mContactView->currentItem() );
230#endif //KAB_EMBEDDED 232#endif //KAB_EMBEDDED
231 if ( !item ) 233 if ( !item )
232 return; 234 return;
233 235
234 doMerge( item->addressee() ); 236 doMerge( item->addressee() );
235 237
236 KABC::Addressee::List retval; 238 KABC::Addressee::List retval;
237 retval << mMasterAddressee; 239 retval << mMasterAddressee;
238 emit modified( retval ); 240 emit modified( retval );
239 241
240 mBlockUpdate = true; 242 mBlockUpdate = true;
241 core()->setContactSelected( mMasterAddressee.uid() ); 243 core()->setContactSelected( mMasterAddressee.uid() );
242 mBlockUpdate = false; 244 mBlockUpdate = false;
243 245
244 updateView(); 246 updateView();
245} 247}
246 248
247void MergeWidget::doMerge( const KABC::Addressee &addr ) 249void MergeWidget::doMerge( const KABC::Addressee &addr )
248{ 250{
249 // ADR + LABEL 251 // ADR + LABEL
250 KABC::Address::List addresses = addr.addresses(); 252 KABC::Address::List addresses = addr.addresses();
251 KABC::Address::List masterAddresses = mMasterAddressee.addresses(); 253 KABC::Address::List masterAddresses = mMasterAddressee.addresses();
252 KABC::Address::List::Iterator addrIt ; 254 KABC::Address::List::Iterator addrIt ;
253 for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { 255 for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) {
254 if ( !masterAddresses.contains( *addrIt ) ) 256 if ( !masterAddresses.contains( *addrIt ) )
255 mMasterAddressee.insertAddress( *addrIt ); 257 mMasterAddressee.insertAddress( *addrIt );
256 } 258 }
257 259
258 if ( mMasterAddressee.birthday().isNull() && !addr.birthday().isNull() ) 260 if ( mMasterAddressee.birthday().isNull() && !addr.birthday().isNull() )
259 mMasterAddressee.setBirthday( addr.birthday() ); 261 mMasterAddressee.setBirthday( addr.birthday() );
260 262
261 263
262 // CATEGORIES 264 // CATEGORIES
263 QStringList::Iterator it; 265 QStringList::Iterator it;
264 QStringList categories = addr.categories(); 266 QStringList categories = addr.categories();
265 QStringList masterCategories = mMasterAddressee.categories(); 267 QStringList masterCategories = mMasterAddressee.categories();
266 QStringList newCategories( masterCategories ); 268 QStringList newCategories( masterCategories );
267 for ( it = categories.begin(); it != categories.end(); ++it ) 269 for ( it = categories.begin(); it != categories.end(); ++it )
268 if ( !masterCategories.contains( *it ) ) 270 if ( !masterCategories.contains( *it ) )
269 newCategories.append( *it ); 271 newCategories.append( *it );
270 mMasterAddressee.setCategories( newCategories ); 272 mMasterAddressee.setCategories( newCategories );
271 273
272 // CLASS 274 // CLASS
273 if ( !mMasterAddressee.secrecy().isValid() && addr.secrecy().isValid() ) 275 if ( !mMasterAddressee.secrecy().isValid() && addr.secrecy().isValid() )
274 mMasterAddressee.setSecrecy( addr.secrecy() ); 276 mMasterAddressee.setSecrecy( addr.secrecy() );
275 277
276 // EMAIL 278 // EMAIL
277 QStringList emails = addr.emails(); 279 QStringList emails = addr.emails();
278 QStringList masterEmails = mMasterAddressee.emails(); 280 QStringList masterEmails = mMasterAddressee.emails();
279 for ( it = emails.begin(); it != emails.end(); ++it ) 281 for ( it = emails.begin(); it != emails.end(); ++it )
280 if ( !masterEmails.contains( *it ) ) 282 if ( !masterEmails.contains( *it ) )
281 mMasterAddressee.insertEmail( *it, false ); 283 mMasterAddressee.insertEmail( *it, false );
282 284
283 // FN 285 // FN
284 if ( mMasterAddressee.formattedName().isEmpty() && !addr.formattedName().isEmpty() ) 286 if ( mMasterAddressee.formattedName().isEmpty() && !addr.formattedName().isEmpty() )
285 mMasterAddressee.setFormattedName( addr.formattedName() ); 287 mMasterAddressee.setFormattedName( addr.formattedName() );
286 288
287 // GEO 289 // GEO
288 if ( !mMasterAddressee.geo().isValid() && addr.geo().isValid() ) 290 if ( !mMasterAddressee.geo().isValid() && addr.geo().isValid() )
289 mMasterAddressee.setGeo( addr.geo() ); 291 mMasterAddressee.setGeo( addr.geo() );
290 292
291/* 293/*
292 // KEY 294 // KEY
293 // LOGO 295 // LOGO
294*/ 296*/
295 297
296 // MAILER 298 // MAILER
297 if ( mMasterAddressee.mailer().isEmpty() && !addr.mailer().isEmpty() ) 299 if ( mMasterAddressee.mailer().isEmpty() && !addr.mailer().isEmpty() )
298 mMasterAddressee.setMailer( addr.mailer() ); 300 mMasterAddressee.setMailer( addr.mailer() );
299 301
300 // N 302 // N
301 if ( mMasterAddressee.assembledName().isEmpty() && !addr.assembledName().isEmpty() ) 303 if ( mMasterAddressee.assembledName().isEmpty() && !addr.assembledName().isEmpty() )
302 mMasterAddressee.setNameFromString( addr.assembledName() ); 304 mMasterAddressee.setNameFromString( addr.assembledName() );
303 305
304 // NICKNAME 306 // NICKNAME
305 if ( mMasterAddressee.nickName().isEmpty() && !addr.nickName().isEmpty() ) 307 if ( mMasterAddressee.nickName().isEmpty() && !addr.nickName().isEmpty() )
306 mMasterAddressee.setNickName( addr.nickName() ); 308 mMasterAddressee.setNickName( addr.nickName() );
307 309
308 // NOTE 310 // NOTE
309 if ( mMasterAddressee.note().isEmpty() && !addr.note().isEmpty() ) 311 if ( mMasterAddressee.note().isEmpty() && !addr.note().isEmpty() )
310 mMasterAddressee.setNote( addr.note() ); 312 mMasterAddressee.setNote( addr.note() );
311 313
312 // ORG 314 // ORG
313 if ( mMasterAddressee.organization().isEmpty() && !addr.organization().isEmpty() ) 315 if ( mMasterAddressee.organization().isEmpty() && !addr.organization().isEmpty() )
314 mMasterAddressee.setOrganization( addr.organization() ); 316 mMasterAddressee.setOrganization( addr.organization() );
315 317
316/* 318/*
317 // PHOTO 319 // PHOTO
318*/ 320*/
319 321
320 // PROID 322 // PROID
321 if ( mMasterAddressee.productId().isEmpty() && !addr.productId().isEmpty() ) 323 if ( mMasterAddressee.productId().isEmpty() && !addr.productId().isEmpty() )
322 mMasterAddressee.setProductId( addr.productId() ); 324 mMasterAddressee.setProductId( addr.productId() );
323 325
324 // REV 326 // REV
325 if ( mMasterAddressee.revision().isNull() && !addr.revision().isNull() ) 327 if ( mMasterAddressee.revision().isNull() && !addr.revision().isNull() )
326 mMasterAddressee.setRevision( addr.revision() ); 328 mMasterAddressee.setRevision( addr.revision() );
327 329
328 // ROLE 330 // ROLE
329 if ( mMasterAddressee.role().isEmpty() && !addr.role().isEmpty() ) 331 if ( mMasterAddressee.role().isEmpty() && !addr.role().isEmpty() )
330 mMasterAddressee.setRole( addr.role() ); 332 mMasterAddressee.setRole( addr.role() );
331 333
332 // SORT-STRING 334 // SORT-STRING
333 if ( mMasterAddressee.sortString().isEmpty() && !addr.sortString().isEmpty() ) 335 if ( mMasterAddressee.sortString().isEmpty() && !addr.sortString().isEmpty() )
334 mMasterAddressee.setSortString( addr.sortString() ); 336 mMasterAddressee.setSortString( addr.sortString() );
335 337
336/* 338/*
337 // SOUND 339 // SOUND
338*/ 340*/
339 341
340 // TEL 342 // TEL
341 KABC::PhoneNumber::List phones = addr.phoneNumbers(); 343 KABC::PhoneNumber::List phones = addr.phoneNumbers();
342 KABC::PhoneNumber::List masterPhones = mMasterAddressee.phoneNumbers(); 344 KABC::PhoneNumber::List masterPhones = mMasterAddressee.phoneNumbers();
343 KABC::PhoneNumber::List::ConstIterator phoneIt; 345 KABC::PhoneNumber::List::ConstIterator phoneIt;
344 for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) 346 for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt )
345 if ( !masterPhones.contains( *it ) ) 347 if ( !masterPhones.contains( *it ) )
346 mMasterAddressee.insertPhoneNumber( *it ); 348 mMasterAddressee.insertPhoneNumber( *it );
347 349
348 // TITLE 350 // TITLE
349 if ( mMasterAddressee.title().isEmpty() && !addr.title().isEmpty() ) 351 if ( mMasterAddressee.title().isEmpty() && !addr.title().isEmpty() )
350 mMasterAddressee.setTitle( addr.title() ); 352 mMasterAddressee.setTitle( addr.title() );
351 353
352 // TZ 354 // TZ
353 if ( !mMasterAddressee.timeZone().isValid() && addr.timeZone().isValid() ) 355 if ( !mMasterAddressee.timeZone().isValid() && addr.timeZone().isValid() )
354 mMasterAddressee.setTimeZone( addr.timeZone() ); 356 mMasterAddressee.setTimeZone( addr.timeZone() );
355 357
356 // UID // ignore UID 358 // UID // ignore UID
357 359
358 // URL 360 // URL
359 if ( mMasterAddressee.url().isEmpty() && !addr.url().isEmpty() ) 361 if ( mMasterAddressee.url().isEmpty() && !addr.url().isEmpty() )
360 mMasterAddressee.setUrl( addr.url() ); 362 mMasterAddressee.setUrl( addr.url() );
361 363
362 // X- 364 // X-
363 QStringList customs = addr.customs(); 365 QStringList customs = addr.customs();
364 QStringList masterCustoms = mMasterAddressee.customs(); 366 QStringList masterCustoms = mMasterAddressee.customs();
365 QStringList newCustoms( masterCustoms ); 367 QStringList newCustoms( masterCustoms );
366 for ( it = customs.begin(); it != customs.end(); ++it ) 368 for ( it = customs.begin(); it != customs.end(); ++it )
367 if ( !masterCustoms.contains( *it ) ) 369 if ( !masterCustoms.contains( *it ) )
368 newCustoms.append( *it ); 370 newCustoms.append( *it );
369 mMasterAddressee.setCustoms( newCustoms ); 371 mMasterAddressee.setCustoms( newCustoms );
370} 372}
371 373
372#ifndef KAB_EMBEDDED 374#ifndef KAB_EMBEDDED_
373#include "mergewidget.moc" 375#include "moc_mergewidget.cpp"
374#endif //KAB_EMBEDDED 376#endif //KAB_EMBEDDED
diff --git a/kaddressbook/features/mergewidget.h b/kaddressbook/features/mergewidget.h
index 1063c80..bb16282 100644
--- a/kaddressbook/features/mergewidget.h
+++ b/kaddressbook/features/mergewidget.h
@@ -1,87 +1,87 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
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 MERGEWIDGET_H 24#ifndef MERGEWIDGET_H
25#define MERGEWIDGET_H 25#define MERGEWIDGET_H
26 26
27#include <kdialogbase.h> 27#include <kdialogbase.h>
28#include <klistview.h> 28#include <klistview.h>
29 29
30#include "extensionwidget.h" 30#include "extensionwidget.h"
31 31
32class QListView; 32class Q3ListView;
33 33
34class KABCore; 34class KABCore;
35 35
36namespace KABC { 36namespace KABC {
37class AddressBook; 37class AddressBook;
38} 38}
39 39
40class MergeWidget : public ExtensionWidget 40class MergeWidget : public ExtensionWidget
41{ 41{
42 Q_OBJECT 42 Q_OBJECT
43 43
44 public: 44 public:
45 MergeWidget( KABCore*, QWidget *parent, const char *name = 0 ); 45 MergeWidget( KABCore*, QWidget *parent, const char *name = 0 );
46 virtual ~MergeWidget(); 46 virtual ~MergeWidget();
47 47
48 void contactsSelectionChanged(); 48 void contactsSelectionChanged();
49 49
50 QString title() const; 50 QString title() const;
51 QString identifier() const; 51 QString identifier() const;
52 52
53 private slots: 53 private slots:
54 void mergeAndRemove(); 54 void mergeAndRemove();
55 void merge(); 55 void merge();
56 56
57 void selectionContactViewChanged(); 57 void selectionContactViewChanged();
58 58
59 private: 59 private:
60 void updateView(); 60 void updateView();
61 void doMerge( const KABC::Addressee &addr ); 61 void doMerge( const KABC::Addressee &addr );
62 62
63 KListView *mContactView; 63 KListView *mContactView;
64 QPushButton *mMergeAndRemoveButton; 64 QPushButton *mMergeAndRemoveButton;
65 QPushButton *mMergeButton; 65 QPushButton *mMergeButton;
66 66
67 KABC::Addressee mMasterAddressee; 67 KABC::Addressee mMasterAddressee;
68 bool mBlockUpdate; 68 bool mBlockUpdate;
69}; 69};
70 70
71#ifdef KAB_EMBEDDED 71#ifdef KAB_EMBEDDED
72class MergeFactory : public ExtensionFactory 72class MergeFactory : public ExtensionFactory
73{ 73{
74 public: 74 public:
75 ExtensionWidget *extension( KABCore *core, QWidget *parent, const char *name ) 75 ExtensionWidget *extension( KABCore *core, QWidget *parent, const char *name )
76 { 76 {
77 return new MergeWidget( core, parent, name ); 77 return new MergeWidget( core, parent, name );
78 } 78 }
79 79
80 QString identifier() const 80 QString identifier() const
81 { 81 {
82 return "merge"; 82 return "merge";
83 } 83 }
84}; 84};
85#endif //KAB_EMBEDDED 85#endif //KAB_EMBEDDED
86 86
87#endif 87#endif