Diffstat (limited to 'kaddressbook/features/distributionlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/features/distributionlistwidget.cpp | 39 |
1 files changed, 23 insertions, 16 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,202 +1,209 @@ | |||
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 | ||
58 | class DistributionListFactory : public ExtensionFactory | 65 | class 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 | ||
72 | extern "C" { | 79 | extern "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 | ||
80 | class ContactItem : public QListViewItem | 87 | class 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 | ||
120 | DistributionListWidget::DistributionListWidget( KABCore *core, QWidget *parent, | 127 | DistributionListWidget::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 | ||
197 | DistributionListWidget::~DistributionListWidget() | 204 | DistributionListWidget::~DistributionListWidget() |
198 | { | 205 | { |
199 | delete mManager; | 206 | delete mManager; |
200 | } | 207 | } |
201 | 208 | ||
202 | void DistributionListWidget::save() | 209 | void DistributionListWidget::save() |
@@ -381,121 +388,121 @@ void DistributionListWidget::dropEvent( QDropEvent *e ) | |||
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 | ||
398 | void DistributionListWidget::contactsSelectionChanged() | 405 | void DistributionListWidget::contactsSelectionChanged() |
399 | { | 406 | { |
400 | mAddContactButton->setEnabled( contactsSelected() && mNameCombo->count() > 0 ); | 407 | mAddContactButton->setEnabled( contactsSelected() && mNameCombo->count() > 0 ); |
401 | } | 408 | } |
402 | 409 | ||
403 | QString DistributionListWidget::title() const | 410 | QString DistributionListWidget::title() const |
404 | { | 411 | { |
405 | return i18n( "Distribution List Editor" ); | 412 | return i18n( "Distribution List Editor" ); |
406 | } | 413 | } |
407 | 414 | ||
408 | QString DistributionListWidget::identifier() const | 415 | QString DistributionListWidget::identifier() const |
409 | { | 416 | { |
410 | return "distribution_list_editor"; | 417 | return "distribution_list_editor"; |
411 | } | 418 | } |
412 | 419 | ||
413 | void DistributionListWidget::dropped( QDropEvent *e, QListViewItem* ) | 420 | void DistributionListWidget::dropped( QDropEvent *e, Q3ListViewItem* ) |
414 | { | 421 | { |
415 | dropEvent( e ); | 422 | dropEvent( e ); |
416 | } | 423 | } |
417 | 424 | ||
418 | void DistributionListWidget::changed() | 425 | void DistributionListWidget::changed() |
419 | { | 426 | { |
420 | save(); | 427 | save(); |
421 | } | 428 | } |
422 | 429 | ||
423 | 430 | ||
424 | DistributionListView::DistributionListView( QWidget *parent, const char* name ) | 431 | DistributionListView::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 | ||
432 | void DistributionListView::dragEnterEvent( QDragEnterEvent* e ) | 439 | void 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 | ||
440 | void DistributionListView::viewportDragMoveEvent( QDragMoveEvent *e ) | 447 | void 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 | ||
448 | void DistributionListView::viewportDropEvent( QDropEvent *e ) | 455 | void DistributionListView::viewportDropEvent( QDropEvent *e ) |
449 | { | 456 | { |
450 | emit dropped( e, 0 ); | 457 | emit dropped( e, 0 ); |
451 | } | 458 | } |
452 | 459 | ||
453 | void DistributionListView::dropEvent( QDropEvent *e ) | 460 | void DistributionListView::dropEvent( QDropEvent *e ) |
454 | { | 461 | { |
455 | emit dropped( e, 0 ); | 462 | emit dropped( e, 0 ); |
456 | } | 463 | } |
457 | 464 | ||
458 | 465 | ||
459 | EmailSelector::EmailSelector( const QStringList &emails, | 466 | EmailSelector::EmailSelector( const QStringList &emails, |
460 | const QString ¤t, QWidget *parent ) | 467 | const QString ¤t, 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 | ||
480 | QString EmailSelector::selected() | 487 | QString 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 | ||
489 | QString EmailSelector::getEmail( const QStringList &emails, | 496 | QString EmailSelector::getEmail( const QStringList &emails, |
490 | const QString ¤t, QWidget *parent ) | 497 | const QString ¤t, 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 |