-rw-r--r-- | microkde/keditlistbox.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/microkde/keditlistbox.cpp b/microkde/keditlistbox.cpp index 55b7784..257a44a 100644 --- a/microkde/keditlistbox.cpp +++ b/microkde/keditlistbox.cpp @@ -18,16 +18,19 @@ Boston, MA 02111-1307, USA. */ #include <qstringlist.h> #include <qpushbutton.h> #include <qlayout.h> -#include <qgroupbox.h> -#include <qlistbox.h> -#include <qwhatsthis.h> +#include <q3groupbox.h> +#include <q3listbox.h> +#include <q3whatsthis.h> #include <qlabel.h> +//Added by qt3to4: +#include <Q3GridLayout> +#include <Q3StrList> #include <kcombobox.h> #include <kdebug.h> #include <kdialog.h> #include <klineedit.h> #include <klocale.h> @@ -44,28 +47,28 @@ public: bool m_checkAtEntering; int buttons; }; KEditListBox::KEditListBox(QWidget *parent, const char *name, bool checkAtEntering, int buttons ) - :QGroupBox(parent, name ) + :Q3GroupBox(parent, name ) { init( checkAtEntering, buttons ); } KEditListBox::KEditListBox(const QString& title, QWidget *parent, const char *name, bool checkAtEntering, int buttons) - :QGroupBox(title, parent, name ) + :Q3GroupBox(title, parent, name ) { init( checkAtEntering, buttons ); } KEditListBox::KEditListBox(const QString& title, const CustomEditor& custom, QWidget *parent, const char *name, bool checkAtEntering, int buttons) - :QGroupBox(title, parent, name ) + :Q3GroupBox(title, parent, name ) { m_lineEdit = custom.lineEdit(); init( checkAtEntering, buttons, custom.representationWidget() ); } KEditListBox::~KEditListBox() @@ -92,13 +95,13 @@ void KEditListBox::init( bool checkAtEntering, int buttons, servNewButton = servRemoveButton = servUpButton = servDownButton = 0L; setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); QWidget * gb = this; - QGridLayout * grid = new QGridLayout(gb, 7 - lostButtons, 2, + Q3GridLayout * grid = new Q3GridLayout(gb, 7 - lostButtons, 2, KDialog::marginHint(), KDialog::spacingHint()); grid->addRowSpacing(0, fontMetrics().lineSpacing()); for ( int i = 1; i < 7 - lostButtons; i++ ) grid->setRowStretch(i, 1); @@ -106,13 +109,13 @@ void KEditListBox::init( bool checkAtEntering, int buttons, if ( representationWidget ) representationWidget->reparent( gb, QPoint(0,0) ); else m_lineEdit=new KLineEdit(gb); - m_listBox = new QListBox(gb); + m_listBox = new Q3ListBox(gb); QWidget *editingWidget = representationWidget ? representationWidget : m_lineEdit; grid->addMultiCellWidget(editingWidget,1,1,0,1); grid->addMultiCellWidget(m_listBox, 2, 6 - lostButtons, 0, 0); int row = 2; @@ -201,13 +204,13 @@ void KEditListBox::moveItemUp() if (selIndex == 0) { KNotifyClient::beep(); return; } - QListBoxItem *selItem = m_listBox->item(selIndex); + Q3ListBoxItem *selItem = m_listBox->item(selIndex); m_listBox->takeItem(selItem); m_listBox->insertItem(selItem, selIndex-1); m_listBox->setCurrentItem(selIndex - 1); emit changed(); } @@ -224,13 +227,13 @@ void KEditListBox::moveItemDown() if (selIndex == m_listBox->count() - 1) { KNotifyClient::beep(); return; } - QListBoxItem *selItem = m_listBox->item(selIndex); + Q3ListBoxItem *selItem = m_listBox->item(selIndex); m_listBox->takeItem(selItem); m_listBox->insertItem(selItem, selIndex+1); m_listBox->setCurrentItem(selIndex + 1); emit changed(); } @@ -346,20 +349,22 @@ void KEditListBox::clear() void KEditListBox::insertStringList(const QStringList& list, int index) { m_listBox->insertStringList(list,index); } -void KEditListBox::insertStrList(const QStrList* list, int index) +void KEditListBox::insertStrList(const Q3StrList* list, int index) { - m_listBox->insertStrList(list,index); + for(Q3StrList::const_iterator i=list->begin();i!=list->end();++i) + m_listBox->insertItem(*i,index++); } -void KEditListBox::insertStrList(const QStrList& list, int index) +void KEditListBox::insertStrList(const Q3StrList& list, int index) { - m_listBox->insertStrList(list,index); + for(Q3StrList::const_iterator i=list.begin();i!=list.end();++i) + m_listBox->insertItem(*i,index++); } void KEditListBox::insertStrList(const char ** list, int numStrings, int index) { m_listBox->insertStrList(list,numStrings,index); } |