author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kaddressbook/emaileditwidget.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'kaddressbook/emaileditwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/emaileditwidget.cpp | 16 |
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 | |||
@@ -15,60 +15,62 @@ | |||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <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 | ||
48 | EmailEditWidget::EmailEditWidget( QWidget *parent, const char *name ) | 50 | EmailEditWidget::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 ); |
71 | 73 | ||
72 | 74 | ||
73 | connect( editButton, SIGNAL( clicked() ), SLOT( edit() ) ); | 75 | connect( editButton, SIGNAL( clicked() ), SLOT( edit() ) ); |
74 | 76 | ||
@@ -124,50 +126,50 @@ void EmailEditWidget::textChanged( const QString &text ) | |||
124 | { | 126 | { |
125 | if ( mEmailList.count() > 0 ) | 127 | if ( mEmailList.count() > 0 ) |
126 | mEmailList.remove( mEmailList.begin() ); | 128 | mEmailList.remove( mEmailList.begin() ); |
127 | 129 | ||
128 | mEmailList.prepend( text ); | 130 | mEmailList.prepend( text ); |
129 | } | 131 | } |
130 | 132 | ||
131 | 133 | ||
132 | EmailEditDialog::EmailEditDialog( const QStringList &list, QWidget *parent, | 134 | EmailEditDialog::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 ); |
170 | connect( mRemoveButton, SIGNAL( clicked() ), SLOT( remove() ) ); | 172 | connect( mRemoveButton, SIGNAL( clicked() ), SLOT( remove() ) ); |
171 | topLayout->addWidget( mRemoveButton, 2, 2 ); | 173 | topLayout->addWidget( mRemoveButton, 2, 2 ); |
172 | 174 | ||
173 | mStandardButton = new QPushButton( i18n( "Set Standard" ), page ); | 175 | mStandardButton = new QPushButton( i18n( "Set Standard" ), page ); |
@@ -259,19 +261,19 @@ void EmailEditDialog::standard() | |||
259 | } | 261 | } |
260 | 262 | ||
261 | void EmailEditDialog::selectionChanged( int index ) | 263 | void EmailEditDialog::selectionChanged( int index ) |
262 | { | 264 | { |
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 | ||
270 | void EmailEditDialog::emailChanged() | 272 | void 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 |