summaryrefslogtreecommitdiffabout
path: root/kaddressbook/viewconfigurefieldspage.cpp
Unidiff
Diffstat (limited to 'kaddressbook/viewconfigurefieldspage.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/viewconfigurefieldspage.cpp54
1 files changed, 29 insertions, 25 deletions
diff --git a/kaddressbook/viewconfigurefieldspage.cpp b/kaddressbook/viewconfigurefieldspage.cpp
index 5daae1a..7366a0b 100644
--- a/kaddressbook/viewconfigurefieldspage.cpp
+++ b/kaddressbook/viewconfigurefieldspage.cpp
@@ -36,20 +36,24 @@
36 36
37#include <qtoolbutton.h> 37#include <qtoolbutton.h>
38#include <qapplication.h> 38#include <qapplication.h>
39#include <QDesktopWidget>
39#include <qlabel.h> 40#include <qlabel.h>
40#include <qlistbox.h> 41#include <q3listbox.h>
41#include <qlayout.h> 42#include <qlayout.h>
43//Added by qt3to4:
44#include <Q3GridLayout>
45#include <Q3BoxLayout>
42 46
43#include "viewconfigurefieldspage.h" 47#include "viewconfigurefieldspage.h"
44 48
45class FieldItem : public QListBoxText 49class FieldItem : public Q3ListBoxText
46{ 50{
47 public: 51 public:
48 FieldItem( QListBox *parent, KABC::Field *field ) 52 FieldItem( Q3ListBox *parent, KABC::Field *field )
49 : QListBoxText( parent, field->label() ), mField( field ) {} 53 : Q3ListBoxText( parent, field->label() ), mField( field ) {}
50 54
51 FieldItem( QListBox *parent, KABC::Field *field, int index ) 55 FieldItem( Q3ListBox *parent, KABC::Field *field, int index )
52 : QListBoxText( parent, field->label(), parent->item( index ) ), 56 : Q3ListBoxText( parent, field->label(), parent->item( index ) ),
53 mField( field ) {} 57 mField( field ) {}
54 58
55 KABC::Field *field() { return mField; } 59 KABC::Field *field() { return mField; }
@@ -106,7 +110,7 @@ void ViewConfigureFieldsPage::slotShowFields( int index )
106 110
107 KABC::Field::List::ConstIterator it; 111 KABC::Field::List::ConstIterator it;
108 for ( it = allFields.begin(); it != allFields.end(); ++it ) { 112 for ( it = allFields.begin(); it != allFields.end(); ++it ) {
109 QListBoxItem *item = mSelectedBox->firstItem(); 113 Q3ListBoxItem *item = mSelectedBox->firstItem();
110 while( item ) { 114 while( item ) {
111 FieldItem *fieldItem = static_cast<FieldItem *>( item ); 115 FieldItem *fieldItem = static_cast<FieldItem *>( item );
112 if ( (*it)->equals( fieldItem->field() ) ) 116 if ( (*it)->equals( fieldItem->field() ) )
@@ -189,7 +193,7 @@ void ViewConfigureFieldsPage::slotMoveUp()
189{ 193{
190 int i = mSelectedBox->currentItem(); 194 int i = mSelectedBox->currentItem();
191 if ( i > 0 ) { 195 if ( i > 0 ) {
192 QListBoxItem *item = mSelectedBox->item( i ); 196 Q3ListBoxItem *item = mSelectedBox->item( i );
193 mSelectedBox->takeItem( item ); 197 mSelectedBox->takeItem( item );
194 mSelectedBox->insertItem( item, i - 1 ); 198 mSelectedBox->insertItem( item, i - 1 );
195 mSelectedBox->setCurrentItem( item ); 199 mSelectedBox->setCurrentItem( item );
@@ -201,7 +205,7 @@ void ViewConfigureFieldsPage::slotMoveDown()
201{ 205{
202 int i = mSelectedBox->currentItem(); 206 int i = mSelectedBox->currentItem();
203 if ( i > -1 && i < (int)mSelectedBox->count() - 1 ) { 207 if ( i > -1 && i < (int)mSelectedBox->count() - 1 ) {
204 QListBoxItem *item = mSelectedBox->item( i ); 208 Q3ListBoxItem *item = mSelectedBox->item( i );
205 mSelectedBox->takeItem( item ); 209 mSelectedBox->takeItem( item );
206 mSelectedBox->insertItem( item, i + 1 ); 210 mSelectedBox->insertItem( item, i + 1 );
207 mSelectedBox->setCurrentItem( item ); 211 mSelectedBox->setCurrentItem( item );
@@ -219,11 +223,11 @@ void ViewConfigureFieldsPage::initGUI()
219 223
220 setCaption( i18n("Select Fields to Display") ); 224 setCaption( i18n("Select Fields to Display") );
221 225
222 QGridLayout *gl = 0; 226 Q3GridLayout *gl = 0;
223 if (orientation == 0) 227 if (orientation == 0)
224 gl = new QGridLayout( this , 6, 4, 0, KDialog::spacingHint() ); 228 gl = new Q3GridLayout( this , 6, 4, 0, KDialog::spacingHint() );
225 else 229 else
226 gl = new QGridLayout( this , 4, 6, 0, KDialog::spacingHint() ); 230 gl = new Q3GridLayout( this , 4, 6, 0, KDialog::spacingHint() );
227 231
228 #ifndef KAB_EMBEDDED 232 #ifndef KAB_EMBEDDED
229 mCategoryCombo = new KComboBox( false, this ); 233 mCategoryCombo = new KComboBox( false, this );
@@ -249,20 +253,20 @@ void ViewConfigureFieldsPage::initGUI()
249 gl->addWidget( label, 2, 0 ); 253 gl->addWidget( label, 2, 0 );
250 254
251 255
252 mUnSelectedBox = new QListBox( this ); 256 mUnSelectedBox = new Q3ListBox( this );
253 mUnSelectedBox->setSelectionMode( QListBox::Extended ); 257 mUnSelectedBox->setSelectionMode( Q3ListBox::Extended );
254 mUnSelectedBox->setMinimumHeight( 80 ); 258 mUnSelectedBox->setMinimumHeight( 80 );
255 if (orientation == 0) 259 if (orientation == 0)
256 gl->addWidget( mUnSelectedBox, 1, 0 ); 260 gl->addWidget( mUnSelectedBox, 1, 0 );
257 else 261 else
258 gl->addWidget( mUnSelectedBox, 0, 1 ); 262 gl->addWidget( mUnSelectedBox, 0, 1 );
259 263
260 mSelectedBox = new QListBox( this ); 264 mSelectedBox = new Q3ListBox( this );
261 //if ( QApplication::desktop()->width() < 320 ) { 265 //if ( QApplication::desktop()->width() < 320 ) {
262 // mUnSelectedBox->setMaximumWidth( 134 ); 266 // mUnSelectedBox->setMaximumWidth( 134 );
263 // mSelectedBox->setMaximumWidth( 134 ); 267 // mSelectedBox->setMaximumWidth( 134 );
264 //} 268 //}
265 mSelectedBox->setSelectionMode( QListBox::Extended ); 269 mSelectedBox->setSelectionMode( Q3ListBox::Extended );
266 mSelectedBox->setMinimumHeight( 80 ); 270 mSelectedBox->setMinimumHeight( 80 );
267 label->setBuddy( mSelectedBox ); 271 label->setBuddy( mSelectedBox );
268 if (orientation == 0) 272 if (orientation == 0)
@@ -270,11 +274,11 @@ void ViewConfigureFieldsPage::initGUI()
270 else 274 else
271 gl->addWidget( mSelectedBox, 2, 1 ); 275 gl->addWidget( mSelectedBox, 2, 1 );
272 276
273 QBoxLayout *vb1 = 0; 277 Q3BoxLayout *vb1 = 0;
274 if (orientation == 0) 278 if (orientation == 0)
275 vb1 = new QBoxLayout( QBoxLayout::TopToBottom, KDialog::spacingHint() ); 279 vb1 = new Q3BoxLayout( Q3BoxLayout::TopToBottom, KDialog::spacingHint() );
276 else 280 else
277 vb1 = new QBoxLayout( QBoxLayout::LeftToRight, KDialog::spacingHint() ); 281 vb1 = new Q3BoxLayout( Q3BoxLayout::LeftToRight, KDialog::spacingHint() );
278 282
279 vb1->addStretch(); 283 vb1->addStretch();
280 284
@@ -301,11 +305,11 @@ void ViewConfigureFieldsPage::initGUI()
301 else 305 else
302 gl->addLayout( vb1, 1, 1 ); 306 gl->addLayout( vb1, 1, 1 );
303 307
304 QBoxLayout *vb2 = 0; 308 Q3BoxLayout *vb2 = 0;
305 if (orientation == 0) 309 if (orientation == 0)
306 vb2 = new QBoxLayout( QBoxLayout::TopToBottom, KDialog::spacingHint() ); 310 vb2 = new Q3BoxLayout( Q3BoxLayout::TopToBottom, KDialog::spacingHint() );
307 else 311 else
308 vb2 = new QBoxLayout( QBoxLayout::LeftToRight, KDialog::spacingHint() ); 312 vb2 = new Q3BoxLayout( Q3BoxLayout::LeftToRight, KDialog::spacingHint() );
309 313
310 vb2->addStretch(); 314 vb2->addStretch();
311 315
@@ -340,12 +344,12 @@ void ViewConfigureFieldsPage::initGUI()
340 344
341 connect( mUnSelectedBox, SIGNAL( selectionChanged() ), SLOT( slotButtonsEnabled() ) ); 345 connect( mUnSelectedBox, SIGNAL( selectionChanged() ), SLOT( slotButtonsEnabled() ) );
342 connect( mSelectedBox, SIGNAL( selectionChanged() ), SLOT( slotButtonsEnabled() ) ); 346 connect( mSelectedBox, SIGNAL( selectionChanged() ), SLOT( slotButtonsEnabled() ) );
343 connect( mSelectedBox, SIGNAL( currentChanged( QListBoxItem * ) ), SLOT( slotButtonsEnabled() ) ); 347 connect( mSelectedBox, SIGNAL( currentChanged( Q3ListBoxItem * ) ), SLOT( slotButtonsEnabled() ) );
344 348
345 slotButtonsEnabled(); 349 slotButtonsEnabled();
346} 350}
347 351
348 352
349#ifndef KAB_EMBEDDED 353#ifndef KAB_EMBEDDED_
350#include "viewconfigurefieldspage.moc" 354#include "moc_viewconfigurefieldspage.cpp"
351#endif //KAB_EMBEDDED 355#endif //KAB_EMBEDDED