Diffstat (limited to 'kaddressbook/viewconfigurefieldspage.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | kaddressbook/viewconfigurefieldspage.cpp | 54 |
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 @@ -33,26 +33,30 @@ #include <kiconloader.h> #include <kdialog.h> #include <klocale.h> #include <qtoolbutton.h> #include <qapplication.h> +#include <QDesktopWidget> #include <qlabel.h> -#include <qlistbox.h> +#include <q3listbox.h> #include <qlayout.h> +//Added by qt3to4: +#include <Q3GridLayout> +#include <Q3BoxLayout> #include "viewconfigurefieldspage.h" -class FieldItem : public QListBoxText +class FieldItem : public Q3ListBoxText { public: - FieldItem( QListBox *parent, KABC::Field *field ) - : QListBoxText( parent, field->label() ), mField( field ) {} + FieldItem( Q3ListBox *parent, KABC::Field *field ) + : Q3ListBoxText( parent, field->label() ), mField( field ) {} - FieldItem( QListBox *parent, KABC::Field *field, int index ) - : QListBoxText( parent, field->label(), parent->item( index ) ), + FieldItem( Q3ListBox *parent, KABC::Field *field, int index ) + : Q3ListBoxText( parent, field->label(), parent->item( index ) ), mField( field ) {} KABC::Field *field() { return mField; } private: KABC::Field *mField; @@ -103,13 +107,13 @@ void ViewConfigureFieldsPage::slotShowFields( int index ) else category = 1 << ( index - 1 ); KABC::Field::List allFields = mAddressBook->fields( category ); KABC::Field::List::ConstIterator it; for ( it = allFields.begin(); it != allFields.end(); ++it ) { - QListBoxItem *item = mSelectedBox->firstItem(); + Q3ListBoxItem *item = mSelectedBox->firstItem(); while( item ) { FieldItem *fieldItem = static_cast<FieldItem *>( item ); if ( (*it)->equals( fieldItem->field() ) ) break; item = item->next(); } @@ -186,25 +190,25 @@ void ViewConfigureFieldsPage::slotButtonsEnabled() } void ViewConfigureFieldsPage::slotMoveUp() { int i = mSelectedBox->currentItem(); if ( i > 0 ) { - QListBoxItem *item = mSelectedBox->item( i ); + Q3ListBoxItem *item = mSelectedBox->item( i ); mSelectedBox->takeItem( item ); mSelectedBox->insertItem( item, i - 1 ); mSelectedBox->setCurrentItem( item ); mSelectedBox->setSelected( i - 1, true ); } } void ViewConfigureFieldsPage::slotMoveDown() { int i = mSelectedBox->currentItem(); if ( i > -1 && i < (int)mSelectedBox->count() - 1 ) { - QListBoxItem *item = mSelectedBox->item( i ); + Q3ListBoxItem *item = mSelectedBox->item( i ); mSelectedBox->takeItem( item ); mSelectedBox->insertItem( item, i + 1 ); mSelectedBox->setCurrentItem( item ); mSelectedBox->setSelected( i + 1, true ); } } @@ -216,17 +220,17 @@ void ViewConfigureFieldsPage::initGUI() // 0 = 640x480 ; 1 = 240x320 bool orientation = 1; setCaption( i18n("Select Fields to Display") ); - QGridLayout *gl = 0; + Q3GridLayout *gl = 0; if (orientation == 0) - gl = new QGridLayout( this , 6, 4, 0, KDialog::spacingHint() ); + gl = new Q3GridLayout( this , 6, 4, 0, KDialog::spacingHint() ); else - gl = new QGridLayout( this , 4, 6, 0, KDialog::spacingHint() ); + gl = new Q3GridLayout( this , 4, 6, 0, KDialog::spacingHint() ); #ifndef KAB_EMBEDDED mCategoryCombo = new KComboBox( false, this ); #else //KAB_EMBEDDED mCategoryCombo = new QComboBox( false, this ); #endif //KAB_EMBEDDED @@ -246,38 +250,38 @@ void ViewConfigureFieldsPage::initGUI() if (orientation == 0) gl->addWidget( label, 0, 2 ); else gl->addWidget( label, 2, 0 ); - mUnSelectedBox = new QListBox( this ); - mUnSelectedBox->setSelectionMode( QListBox::Extended ); + mUnSelectedBox = new Q3ListBox( this ); + mUnSelectedBox->setSelectionMode( Q3ListBox::Extended ); mUnSelectedBox->setMinimumHeight( 80 ); if (orientation == 0) gl->addWidget( mUnSelectedBox, 1, 0 ); else gl->addWidget( mUnSelectedBox, 0, 1 ); - mSelectedBox = new QListBox( this ); + mSelectedBox = new Q3ListBox( this ); //if ( QApplication::desktop()->width() < 320 ) { // mUnSelectedBox->setMaximumWidth( 134 ); // mSelectedBox->setMaximumWidth( 134 ); //} - mSelectedBox->setSelectionMode( QListBox::Extended ); + mSelectedBox->setSelectionMode( Q3ListBox::Extended ); mSelectedBox->setMinimumHeight( 80 ); label->setBuddy( mSelectedBox ); if (orientation == 0) gl->addWidget( mSelectedBox, 1, 2 ); else gl->addWidget( mSelectedBox, 2, 1 ); - QBoxLayout *vb1 = 0; + Q3BoxLayout *vb1 = 0; if (orientation == 0) - vb1 = new QBoxLayout( QBoxLayout::TopToBottom, KDialog::spacingHint() ); + vb1 = new Q3BoxLayout( Q3BoxLayout::TopToBottom, KDialog::spacingHint() ); else - vb1 = new QBoxLayout( QBoxLayout::LeftToRight, KDialog::spacingHint() ); + vb1 = new Q3BoxLayout( Q3BoxLayout::LeftToRight, KDialog::spacingHint() ); vb1->addStretch(); mAddButton = new QToolButton( this ); if (orientation == 0) mAddButton->setIconSet( SmallIconSet( "1rightarrow" ) ); @@ -298,17 +302,17 @@ void ViewConfigureFieldsPage::initGUI() vb1->addStretch(); if (orientation == 0) gl->addLayout( vb1, 1, 1 ); else gl->addLayout( vb1, 1, 1 ); - QBoxLayout *vb2 = 0; + Q3BoxLayout *vb2 = 0; if (orientation == 0) - vb2 = new QBoxLayout( QBoxLayout::TopToBottom, KDialog::spacingHint() ); + vb2 = new Q3BoxLayout( Q3BoxLayout::TopToBottom, KDialog::spacingHint() ); else - vb2 = new QBoxLayout( QBoxLayout::LeftToRight, KDialog::spacingHint() ); + vb2 = new Q3BoxLayout( Q3BoxLayout::LeftToRight, KDialog::spacingHint() ); vb2->addStretch(); mUpButton = new QToolButton( this ); mUpButton->setIconSet( SmallIconSet( "1uparrow" ) ); connect( mUpButton, SIGNAL( clicked() ), SLOT( slotMoveUp() ) ); @@ -337,15 +341,15 @@ void ViewConfigureFieldsPage::initGUI() //mSelectedBox->setMinimumSize( sizeHint ); gl->activate(); connect( mUnSelectedBox, SIGNAL( selectionChanged() ), SLOT( slotButtonsEnabled() ) ); connect( mSelectedBox, SIGNAL( selectionChanged() ), SLOT( slotButtonsEnabled() ) ); - connect( mSelectedBox, SIGNAL( currentChanged( QListBoxItem * ) ), SLOT( slotButtonsEnabled() ) ); + connect( mSelectedBox, SIGNAL( currentChanged( Q3ListBoxItem * ) ), SLOT( slotButtonsEnabled() ) ); slotButtonsEnabled(); } -#ifndef KAB_EMBEDDED -#include "viewconfigurefieldspage.moc" +#ifndef KAB_EMBEDDED_ +#include "moc_viewconfigurefieldspage.cpp" #endif //KAB_EMBEDDED |