summaryrefslogtreecommitdiffabout
path: root/kaddressbook/features/distributionlistwidget.cpp
Unidiff
Diffstat (limited to 'kaddressbook/features/distributionlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/features/distributionlistwidget.cpp39
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
@@ -18,19 +18,26 @@
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
@@ -74,18 +81,18 @@ extern "C" {
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() );
@@ -118,13 +125,13 @@ class ContactItem : public QListViewItem
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 );
@@ -163,14 +170,14 @@ DistributionListWidget::DistributionListWidget( KABCore *core, QWidget *parent,
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 );
@@ -407,13 +414,13 @@ QString DistributionListWidget::title() const
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{
@@ -429,21 +436,21 @@ DistributionListView::DistributionListView( QWidget *parent, const char* name )
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{
@@ -458,16 +465,16 @@ void DistributionListView::dropEvent( QDropEvent *e )
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 );
@@ -476,13 +483,13 @@ EmailSelector::EmailSelector( const QStringList &emails,
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
@@ -493,9 +500,9 @@ QString EmailSelector::getEmail( const QStringList &emails,
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