summaryrefslogtreecommitdiffabout
path: root/kaddressbook/emaileditwidget.cpp
Unidiff
Diffstat (limited to 'kaddressbook/emaileditwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/emaileditwidget.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/kaddressbook/emaileditwidget.cpp b/kaddressbook/emaileditwidget.cpp
index e72face..09df47f 100644
--- a/kaddressbook/emaileditwidget.cpp
+++ b/kaddressbook/emaileditwidget.cpp
@@ -19,52 +19,54 @@
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qcheckbox.h> 24#include <qcheckbox.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qpushbutton.h> 27#include <qpushbutton.h>
28#include <qstring.h> 28#include <qstring.h>
29#include <qtoolbutton.h> 29#include <qtoolbutton.h>
30#include <qtooltip.h> 30#include <qtooltip.h>
31#include <qlistbox.h> 31#include <q3listbox.h>
32//Added by qt3to4:
33#include <Q3GridLayout>
32 34
33#ifndef KAB_EMBEDDED 35#ifndef KAB_EMBEDDED
34#include <kaccelmanager.h> 36#include <kaccelmanager.h>
35#endif //KAB_EMBEDDED 37#endif //KAB_EMBEDDED
36#include <kconfig.h> 38#include <kconfig.h>
37#include <kcombobox.h> 39#include <kcombobox.h>
38#include <kdebug.h> 40#include <kdebug.h>
39#include <kglobal.h> 41#include <kglobal.h>
40#include <kdialog.h> 42#include <kdialog.h>
41#include <kiconloader.h> 43#include <kiconloader.h>
42#include <klineedit.h> 44#include <klineedit.h>
43#include <klocale.h> 45#include <klocale.h>
44#include <kmessagebox.h> 46#include <kmessagebox.h>
45 47
46#include "emaileditwidget.h" 48#include "emaileditwidget.h"
47 49
48EmailEditWidget::EmailEditWidget( QWidget *parent, const char *name ) 50EmailEditWidget::EmailEditWidget( QWidget *parent, const char *name )
49 : QWidget( parent, name ) 51 : QWidget( parent, name )
50{ 52{
51 QGridLayout *topLayout = new QGridLayout( this, 2, 2 ); 53 Q3GridLayout *topLayout = new Q3GridLayout( this, 2, 2 );
52 topLayout->setSpacing( KDialog::spacingHint() ); 54 topLayout->setSpacing( KDialog::spacingHint() );
53 QLabel* label = new QLabel( this ); 55 QLabel* label = new QLabel( this );
54 56
55 label->setPixmap( KGlobal::iconLoader()->loadIcon( "mail_send", KIcon::Desktop, 0) ); 57 label->setPixmap( KGlobal::iconLoader()->loadIcon( "mail_send", KIcon::Desktop, 0) );
56 58
57 topLayout->addWidget( label, 0, 0 ); 59 topLayout->addWidget( label, 0, 0 );
58 label->setAlignment( AlignCenter ); 60 label->setAlignment( Qt::AlignCenter );
59 QPushButton *editButton = new QPushButton( i18n( "Edit Email Addresses..." ), this); 61 QPushButton *editButton = new QPushButton( i18n( "Edit Email Addresses..." ), this);
60 topLayout->addWidget( editButton, 0, 1 ); 62 topLayout->addWidget( editButton, 0, 1 );
61 label = new QLabel( i18n( "Email:" ), this ); 63 label = new QLabel( i18n( "Email:" ), this );
62 topLayout->addWidget( label, 1, 0 ); 64 topLayout->addWidget( label, 1, 0 );
63 65
64 mEmailEdit = new KLineEdit( this ); 66 mEmailEdit = new KLineEdit( this );
65 connect( mEmailEdit, SIGNAL( textChanged( const QString& ) ), 67 connect( mEmailEdit, SIGNAL( textChanged( const QString& ) ),
66 SLOT( textChanged( const QString& ) ) ); 68 SLOT( textChanged( const QString& ) ) );
67 connect( mEmailEdit, SIGNAL( textChanged( const QString& ) ), 69 connect( mEmailEdit, SIGNAL( textChanged( const QString& ) ),
68 SIGNAL( modified() ) ); 70 SIGNAL( modified() ) );
69 label->setBuddy( mEmailEdit ); 71 label->setBuddy( mEmailEdit );
70 topLayout->addWidget( mEmailEdit, 1, 1 ); 72 topLayout->addWidget( mEmailEdit, 1, 1 );
@@ -128,42 +130,42 @@ void EmailEditWidget::textChanged( const QString &text )
128 mEmailList.prepend( text ); 130 mEmailList.prepend( text );
129} 131}
130 132
131 133
132EmailEditDialog::EmailEditDialog( const QStringList &list, QWidget *parent, 134EmailEditDialog::EmailEditDialog( const QStringList &list, QWidget *parent,
133 const char *name ) 135 const char *name )
134 : KDialogBase( KDialogBase::Plain, i18n( "Edit Email Addresses" ), 136 : KDialogBase( KDialogBase::Plain, i18n( "Edit Email Addresses" ),
135 KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, 137 KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok,
136 parent, name, true ) 138 parent, name, true )
137{ 139{
138 QWidget *page = plainPage(); 140 QWidget *page = plainPage();
139 141
140 QGridLayout *topLayout = new QGridLayout( page, 4, 3 ); 142 Q3GridLayout *topLayout = new Q3GridLayout( page, 4, 3 );
141 143
142 QLabel *label = new QLabel( i18n( "Email address:" ), page ); 144 QLabel *label = new QLabel( i18n( "Email address:" ), page );
143 topLayout->addWidget( label, 0, 0 ); 145 topLayout->addWidget( label, 0, 0 );
144 146
145 mEmailEdit = new KLineEdit( page ); 147 mEmailEdit = new KLineEdit( page );
146 label->setBuddy( mEmailEdit ); 148 label->setBuddy( mEmailEdit );
147 topLayout->addWidget( mEmailEdit, 0, 1 ); 149 topLayout->addWidget( mEmailEdit, 0, 1 );
148 connect( mEmailEdit, SIGNAL( returnPressed() ), SLOT( add() ) ); 150 connect( mEmailEdit, SIGNAL( returnPressed() ), SLOT( add() ) );
149 connect( mEmailEdit, SIGNAL( textChanged( const QString& ) ), 151 connect( mEmailEdit, SIGNAL( textChanged( const QString& ) ),
150 SLOT( emailChanged() ) ); 152 SLOT( emailChanged() ) );
151 153
152 mAddButton = new QPushButton( i18n( "Add" ), page ); 154 mAddButton = new QPushButton( i18n( "Add" ), page );
153 mAddButton->setEnabled( false ); 155 mAddButton->setEnabled( false );
154 connect( mAddButton, SIGNAL( clicked() ), SLOT( add() ) ); 156 connect( mAddButton, SIGNAL( clicked() ), SLOT( add() ) );
155 topLayout->addWidget( mAddButton, 0, 2 ); 157 topLayout->addWidget( mAddButton, 0, 2 );
156 158
157 mEmailListBox = new QListBox( page ); 159 mEmailListBox = new Q3ListBox( page );
158 160
159 // Make sure there is room for the scrollbar 161 // Make sure there is room for the scrollbar
160 mEmailListBox->setMinimumHeight( mEmailListBox->sizeHint().height() + 30 ); 162 mEmailListBox->setMinimumHeight( mEmailListBox->sizeHint().height() + 30 );
161 connect( mEmailListBox, SIGNAL( highlighted( int ) ), 163 connect( mEmailListBox, SIGNAL( highlighted( int ) ),
162 SLOT( selectionChanged( int ) ) ); 164 SLOT( selectionChanged( int ) ) );
163 topLayout->addMultiCellWidget( mEmailListBox, 1, 3, 0, 1 ); 165 topLayout->addMultiCellWidget( mEmailListBox, 1, 3, 0, 1 );
164 166
165 mEditButton = new QPushButton( i18n( "Change" ), page ); 167 mEditButton = new QPushButton( i18n( "Change" ), page );
166 connect( mEditButton, SIGNAL( clicked() ), SLOT( edit() ) ); 168 connect( mEditButton, SIGNAL( clicked() ), SLOT( edit() ) );
167 topLayout->addWidget( mEditButton, 1, 2 ); 169 topLayout->addWidget( mEditButton, 1, 2 );
168 170
169 mRemoveButton = new QPushButton( i18n( "Remove" ), page ); 171 mRemoveButton = new QPushButton( i18n( "Remove" ), page );
@@ -263,15 +265,15 @@ void EmailEditDialog::selectionChanged( int index )
263 bool value = ( index >= 0 ); // An item is selected 265 bool value = ( index >= 0 ); // An item is selected
264 266
265 mRemoveButton->setEnabled( value ); 267 mRemoveButton->setEnabled( value );
266 mEditButton->setEnabled( value ); 268 mEditButton->setEnabled( value );
267 mStandardButton->setEnabled( value ); 269 mStandardButton->setEnabled( value );
268} 270}
269 271
270void EmailEditDialog::emailChanged() 272void EmailEditDialog::emailChanged()
271{ 273{
272 mAddButton->setEnabled( !mEmailEdit->text().isEmpty() ); 274 mAddButton->setEnabled( !mEmailEdit->text().isEmpty() );
273} 275}
274 276
275#ifndef KAB_EMBEDDED 277#ifndef KAB_EMBEDDED_
276#include "emaileditwidget.moc" 278#include "moc_emaileditwidget.cpp"
277#endif //KAB_EMBEDDED 279#endif //KAB_EMBEDDED