summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kcmconfigs/addresseewidget.cpp
Unidiff
Diffstat (limited to 'kaddressbook/kcmconfigs/addresseewidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kcmconfigs/addresseewidget.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/kaddressbook/kcmconfigs/addresseewidget.cpp b/kaddressbook/kcmconfigs/addresseewidget.cpp
index 168d39e..8055085 100644
--- a/kaddressbook/kcmconfigs/addresseewidget.cpp
+++ b/kaddressbook/kcmconfigs/addresseewidget.cpp
@@ -18,18 +18,22 @@
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 <qgroupbox.h> 24#include <q3groupbox.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlistbox.h> 27#include <q3listbox.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qapplication.h> 29#include <qapplication.h>
30#include <QDesktopWidget>
31//Added by qt3to4:
32#include <Q3GridLayout>
33#include <Q3HBoxLayout>
30 34
31#include <kbuttonbox.h> 35#include <kbuttonbox.h>
32#include <kcombobox.h> 36#include <kcombobox.h>
33#include <kconfig.h> 37#include <kconfig.h>
34#include <kdialog.h> 38#include <kdialog.h>
35#include <klocale.h> 39#include <klocale.h>
@@ -42,19 +46,19 @@
42NamePartWidget::NamePartWidget( const QString &title, QWidget *parent, 46NamePartWidget::NamePartWidget( const QString &title, QWidget *parent,
43 const char *name ) 47 const char *name )
44 : QWidget( parent, name ) 48 : QWidget( parent, name )
45{ 49{
46 if (KGlobal::getOrientation() == KGlobal::Portrait) 50 if (KGlobal::getOrientation() == KGlobal::Portrait)
47 { 51 {
48 QGridLayout* layout = new QGridLayout( this, 1, 1, KDialog::marginHintSmall(), 52 Q3GridLayout* layout = new Q3GridLayout( this, 1, 1, KDialog::marginHintSmall(),
49 KDialog::spacingHintSmall() ); 53 KDialog::spacingHintSmall() );
50 54
51 QLabel *label = new QLabel( i18n( title ), this ); 55 QLabel *label = new QLabel( i18n( title ), this );
52 layout->addWidget( label, 0, 1 ); 56 layout->addWidget( label, 0, 1 );
53 57
54 mBox = new QListBox( this ); 58 mBox = new Q3ListBox( this );
55 mBox->setMaximumSize(70, 70); 59 mBox->setMaximumSize(70, 70);
56 layout->addMultiCellWidget( mBox, 0, 1, 0, 0 ); 60 layout->addMultiCellWidget( mBox, 0, 1, 0, 0 );
57 61
58 KButtonBox *bbox = new KButtonBox( this, Qt::Vertical ); 62 KButtonBox *bbox = new KButtonBox( this, Qt::Vertical );
59 mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) ); 63 mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) );
60 mRemoveButton = bbox->addButton( i18n( "Rem" ), this, SLOT( remove() ) ); 64 mRemoveButton = bbox->addButton( i18n( "Rem" ), this, SLOT( remove() ) );
@@ -67,19 +71,19 @@ NamePartWidget::NamePartWidget( const QString &title, QWidget *parent,
67 71
68// layout->addWidget( group ); 72// layout->addWidget( group );
69 73
70 } 74 }
71 else 75 else
72 { 76 {
73 QHBoxLayout *layout = new QHBoxLayout( this ); 77 Q3HBoxLayout *layout = new Q3HBoxLayout( this );
74 78
75 QGroupBox *group = new QGroupBox( 0, Qt::Vertical, title, this ); 79 Q3GroupBox *group = new Q3GroupBox( 0, Qt::Vertical, title, this );
76 QGridLayout *groupLayout = new QGridLayout( group->layout(), 2, 2, 80 Q3GridLayout *groupLayout = new Q3GridLayout( group->layout(), 2, 2,
77 KDialog::spacingHint() ); 81 KDialog::spacingHint() );
78 82
79 mBox = new QListBox( group ); 83 mBox = new Q3ListBox( group );
80 84
81 groupLayout->addWidget( mBox, 0, 0 ); 85 groupLayout->addWidget( mBox, 0, 0 );
82 86
83 KButtonBox *bbox = new KButtonBox( group, Qt::Vertical ); 87 KButtonBox *bbox = new KButtonBox( group, Qt::Vertical );
84 mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) ); 88 mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) );
85 mRemoveButton = bbox->addButton( i18n( "Remove" ), this, SLOT( remove() ) ); 89 mRemoveButton = bbox->addButton( i18n( "Remove" ), this, SLOT( remove() ) );
@@ -94,14 +98,14 @@ NamePartWidget::NamePartWidget( const QString &title, QWidget *parent,
94 } 98 }
95 99
96 mAddButton->setEnabled( false ); 100 mAddButton->setEnabled( false );
97 mRemoveButton->setEnabled( false ); 101 mRemoveButton->setEnabled( false );
98 102
99 103
100 connect( mBox, SIGNAL( selectionChanged( QListBoxItem* ) ), 104 connect( mBox, SIGNAL( selectionChanged( Q3ListBoxItem* ) ),
101 SLOT( selectionChanged( QListBoxItem* ) ) ); 105 SLOT( selectionChanged( Q3ListBoxItem* ) ) );
102 connect( mEdit, SIGNAL( textChanged( const QString& ) ), 106 connect( mEdit, SIGNAL( textChanged( const QString& ) ),
103 SLOT( textChanged( const QString& ) ) ); 107 SLOT( textChanged( const QString& ) ) );
104 connect( mEdit, SIGNAL( returnPressed() ), SLOT( add() ) ); 108 connect( mEdit, SIGNAL( returnPressed() ), SLOT( add() ) );
105 109
106} 110}
107 111
@@ -140,13 +144,13 @@ void NamePartWidget::remove()
140 if ( mBox->count() == 0 ) 144 if ( mBox->count() == 0 )
141 selectionChanged( 0 ); 145 selectionChanged( 0 );
142 146
143 emit modified(); 147 emit modified();
144} 148}
145 149
146void NamePartWidget::selectionChanged( QListBoxItem *item ) 150void NamePartWidget::selectionChanged( Q3ListBoxItem *item )
147{ 151{
148 mRemoveButton->setEnabled( item != 0 ); 152 mRemoveButton->setEnabled( item != 0 );
149} 153}
150 154
151void NamePartWidget::textChanged( const QString& text ) 155void NamePartWidget::textChanged( const QString& text )
152{ 156{
@@ -154,13 +158,13 @@ void NamePartWidget::textChanged( const QString& text )
154} 158}
155 159
156 160
157AddresseeWidget::AddresseeWidget( QWidget *parent, const char *name ) 161AddresseeWidget::AddresseeWidget( QWidget *parent, const char *name )
158 : QWidget( parent, name ) 162 : QWidget( parent, name )
159{ 163{
160 QGridLayout *layout; 164 Q3GridLayout *layout;
161 165
162 mPrefix = new NamePartWidget( i18n( "Prefixes" ), this ); 166 mPrefix = new NamePartWidget( i18n( "Prefixes" ), this );
163 mInclusion = new NamePartWidget( i18n( "Inclusions" ), this ); 167 mInclusion = new NamePartWidget( i18n( "Inclusions" ), this );
164 mSuffix = new NamePartWidget( i18n( "Suffixes" ), this ); 168 mSuffix = new NamePartWidget( i18n( "Suffixes" ), this );
165 QString dfn; 169 QString dfn;
166 if (QApplication::desktop()->width() > 320 ) 170 if (QApplication::desktop()->width() > 320 )
@@ -175,25 +179,25 @@ AddresseeWidget::AddresseeWidget( QWidget *parent, const char *name )
175 mFormattedNameCombo->insertItem( i18n( "Simple Name" ) ); 179 mFormattedNameCombo->insertItem( i18n( "Simple Name" ) );
176 mFormattedNameCombo->insertItem( i18n( "Full Name" ) ); 180 mFormattedNameCombo->insertItem( i18n( "Full Name" ) );
177 mFormattedNameCombo->insertItem( i18n( "Reverse Name" ) ); 181 mFormattedNameCombo->insertItem( i18n( "Reverse Name" ) );
178 182
179 if (KGlobal::getOrientation() == KGlobal::Portrait) 183 if (KGlobal::getOrientation() == KGlobal::Portrait)
180 { 184 {
181 layout = new QGridLayout( this, 4, 2, KDialog::marginHintSmall(), 185 layout = new Q3GridLayout( this, 4, 2, KDialog::marginHintSmall(),
182 KDialog::spacingHintSmall() ); 186 KDialog::spacingHintSmall() );
183 187
184 layout->addMultiCellWidget( mPrefix, 0, 0, 0, 1 ); 188 layout->addMultiCellWidget( mPrefix, 0, 0, 0, 1 );
185 layout->addMultiCellWidget( mInclusion, 1, 1, 0, 1 ); 189 layout->addMultiCellWidget( mInclusion, 1, 1, 0, 1 );
186 layout->addMultiCellWidget( mSuffix, 2, 2, 0, 1 ); 190 layout->addMultiCellWidget( mSuffix, 2, 2, 0, 1 );
187 layout->addWidget( label, 3, 0 ); 191 layout->addWidget( label, 3, 0 );
188 layout->addWidget( mFormattedNameCombo, 3, 1 ); 192 layout->addWidget( mFormattedNameCombo, 3, 1 );
189 193
190 } 194 }
191 else 195 else
192 { 196 {
193 layout = new QGridLayout( this, 2, 3, KDialog::marginHint(), 197 layout = new Q3GridLayout( this, 2, 3, KDialog::marginHint(),
194 KDialog::spacingHint() ); 198 KDialog::spacingHint() );
195 199
196 layout->addWidget( mPrefix, 0, 0 ); 200 layout->addWidget( mPrefix, 0, 0 );
197 layout->addWidget( mInclusion, 0, 1 ); 201 layout->addWidget( mInclusion, 0, 1 );
198 layout->addWidget( mSuffix, 0, 2 ); 202 layout->addWidget( mSuffix, 0, 2 );
199 layout->addWidget( label, 1, 0 ); 203 layout->addWidget( label, 1, 0 );
@@ -230,9 +234,9 @@ void AddresseeWidget::saveSettings()
230 config.writeEntry( "Prefixes", mPrefix->nameParts() ); 234 config.writeEntry( "Prefixes", mPrefix->nameParts() );
231 config.writeEntry( "Inclusions", mInclusion->nameParts() ); 235 config.writeEntry( "Inclusions", mInclusion->nameParts() );
232 config.writeEntry( "Suffixes", mSuffix->nameParts() ); 236 config.writeEntry( "Suffixes", mSuffix->nameParts() );
233 config.writeEntry( "FormattedNameType", mFormattedNameCombo->currentItem() ); 237 config.writeEntry( "FormattedNameType", mFormattedNameCombo->currentItem() );
234} 238}
235 239
236#ifndef KAB_EMBEDDED 240#ifndef KAB_EMBEDDED_
237#include "addresseewidget.moc" 241#include "moc_addresseewidget.cpp"
238#endif //KAB_EMBEDDED 242#endif //KAB_EMBEDDED