diff options
Diffstat (limited to 'src/common/gui/editlistbox.cpp')
-rw-r--r-- | src/common/gui/editlistbox.cpp | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/src/common/gui/editlistbox.cpp b/src/common/gui/editlistbox.cpp index 1d2916d..2e40b8a 100644 --- a/src/common/gui/editlistbox.cpp +++ b/src/common/gui/editlistbox.cpp @@ -19,9 +19,9 @@ */ #include "editlistbox.h" -#include <qstringlist.h> -#include <qlabel.h> -#include <qheader.h> +#include <tqstringlist.h> +#include <tqlabel.h> +#include <tqheader.h> #include <kdialog.h> #include <klocale.h> @@ -30,22 +30,22 @@ #include <kiconloader.h> #include <kstdguiitem.h> -EditListBox::EditListBox(uint nbColumns, QWidget *parent, const char *name, Mode mode, Buttons buttons) - : QFrame(parent, name), _mode(mode), _buttons(buttons) +EditListBox::EditListBox(uint nbColumns, TQWidget *tqparent, const char *name, Mode mode, Buttons buttons) + : TQFrame(tqparent, name), _mode(mode), _buttons(buttons) { m_lineEdit = new KLineEdit; init(nbColumns, m_lineEdit); } -EditListBox::EditListBox(uint nbColumns, QWidget *view, KLineEdit *lineEdit, QWidget *parent, const char *name, +EditListBox::EditListBox(uint nbColumns, TQWidget *view, KLineEdit *lineEdit, TQWidget *tqparent, const char *name, Mode mode, Buttons buttons) - : QFrame(parent, name), _mode(mode), _buttons(buttons) + : TQFrame(tqparent, name), _mode(mode), _buttons(buttons) { m_lineEdit = lineEdit; init(nbColumns, view); } -void EditListBox::init(uint nbColumns, QWidget *view) +void EditListBox::init(uint nbColumns, TQWidget *view) { _addButton = 0; _removeButton = 0; @@ -53,48 +53,48 @@ void EditListBox::init(uint nbColumns, QWidget *view) _moveDownButton = 0; _removeAllButton = 0; _resetButton = 0; - setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); + tqsetSizePolicy(TQSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding)); - QGridLayout *grid = new QGridLayout(this, 1, 1, 0, KDialog::spacingHint()); + TQGridLayout *grid = new TQGridLayout(this, 1, 1, 0, KDialog::spacingHint()); uint row = 0; if (view) { - QHBoxLayout *hbox = new QHBoxLayout(KDialog::spacingHint()); + TQHBoxLayout *hbox = new TQHBoxLayout(KDialog::spacingHint()); grid->addMultiCellLayout(hbox, row,row, 0,1); if (m_lineEdit) { KIconLoader loader; - QIconSet iconset = loader.loadIcon("locationbar_erase", KIcon::Toolbar); - KPushButton *button = new KPushButton(iconset, QString::null, this); - connect(button, SIGNAL(clicked()), SLOT(clearEdit())); + TQIconSet iconset = loader.loadIcon("locationbar_erase", KIcon::Toolbar); + KPushButton *button = new KPushButton(iconset, TQString(), this); + connect(button, TQT_SIGNAL(clicked()), TQT_SLOT(clearEdit())); hbox->addWidget(button); } - view->reparent( this, QPoint(0,0) ); + view->reparent( this, TQPoint(0,0) ); hbox->addWidget(view); row++; } _listView= new KListView(this); - for (uint i=0; i<nbColumns; i++) _listView->addColumn(QString::null); + for (uint i=0; i<nbColumns; i++) _listView->addColumn(TQString()); _listView->header()->hide(); _listView->setSorting(-1); _listView->setResizeMode(KListView::LastColumn); _listView->setColumnWidthMode(nbColumns-1, KListView::Maximum); grid->addWidget(_listView, row, 0); - QVBoxLayout *vbox = new QVBoxLayout(10); + TQVBoxLayout *vbox = new TQVBoxLayout(10); grid->addLayout(vbox, row, 1); - _buttonsLayout = new QVBoxLayout(10); + _buttonsLayout = new TQVBoxLayout(10); vbox->addLayout(_buttonsLayout); vbox->addStretch(1); setButtons(_buttons); if (m_lineEdit) { - connect(m_lineEdit,SIGNAL(textChanged(const QString&)),this,SLOT(typedSomething(const QString&))); + connect(m_lineEdit,TQT_SIGNAL(textChanged(const TQString&)),this,TQT_SLOT(typedSomething(const TQString&))); m_lineEdit->setTrapReturnKey(true); - connect(m_lineEdit,SIGNAL(returnPressed()),this,SLOT(addItem())); + connect(m_lineEdit,TQT_SIGNAL(returnPressed()),this,TQT_SLOT(addItem())); } - connect(_listView, SIGNAL(selectionChanged()), SLOT(selectionChanged())); + connect(_listView, TQT_SIGNAL(selectionChanged()), TQT_SLOT(selectionChanged())); // maybe supplied lineedit has some text already - typedSomething(m_lineEdit ? m_lineEdit->text() : QString::null); + typedSomething(m_lineEdit ? m_lineEdit->text() : TQString()); } void EditListBox::setButtons(Buttons buttons) @@ -111,7 +111,7 @@ void EditListBox::setButtons(Buttons buttons) #endif _addButton->setEnabled(false); _addButton->show(); - connect(_addButton, SIGNAL(clicked()), SLOT(addItem())); + connect(_addButton, TQT_SIGNAL(clicked()), TQT_SLOT(addItem())); _buttonsLayout->addWidget(_addButton); } @@ -121,7 +121,7 @@ void EditListBox::setButtons(Buttons buttons) _removeButton = new KPushButton(KGuiItem(i18n("Remove"), "clear"), this); _removeButton->setEnabled(false); _removeButton->show(); - connect(_removeButton, SIGNAL(clicked()), SLOT(removeItem())); + connect(_removeButton, TQT_SIGNAL(clicked()), TQT_SLOT(removeItem())); _buttonsLayout->addWidget(_removeButton); } @@ -130,7 +130,7 @@ void EditListBox::setButtons(Buttons buttons) if ( buttons & RemoveAll ) { _removeAllButton = new KPushButton(KGuiItem(i18n("Remove All"), "delete"), this); _removeAllButton->show(); - connect(_removeAllButton, SIGNAL(clicked()), SLOT(clear())); + connect(_removeAllButton, TQT_SIGNAL(clicked()), TQT_SLOT(clear())); _buttonsLayout->addWidget(_removeAllButton); } @@ -142,12 +142,12 @@ void EditListBox::setButtons(Buttons buttons) _moveUpButton = new KPushButton(KGuiItem(i18n("Move &Up"), "up"), this); _moveUpButton->setEnabled(false); _moveUpButton->show(); - connect(_moveUpButton, SIGNAL(clicked()), SLOT(moveItemUp())); + connect(_moveUpButton, TQT_SIGNAL(clicked()), TQT_SLOT(moveItemUp())); _buttonsLayout->addWidget(_moveUpButton); _moveDownButton = new KPushButton(KGuiItem(i18n("Move &Down"), "down"), this); _moveDownButton->setEnabled(false); _moveDownButton->show(); - connect(_moveDownButton, SIGNAL(clicked()), SLOT(moveItemDown())); + connect(_moveDownButton, TQT_SIGNAL(clicked()), TQT_SLOT(moveItemDown())); _buttonsLayout->addWidget(_moveDownButton); } @@ -156,14 +156,14 @@ void EditListBox::setButtons(Buttons buttons) if ( buttons & Reset ) { _resetButton = new KPushButton(KStdGuiItem::reset(), this); _resetButton->show(); - connect(_resetButton, SIGNAL(clicked()), SIGNAL(reset())); + connect(_resetButton, TQT_SIGNAL(clicked()), TQT_SIGNAL(reset())); _buttonsLayout->addWidget(_resetButton); } } -void EditListBox::typedSomething(const QString& text) +void EditListBox::typedSomething(const TQString& text) { - QListViewItem *item = _listView->selectedItem(); + TQListViewItem *item = _listView->selectedItem(); if (item) { if( selectedText()!=text ) { item->setText(textColumn(), text); @@ -175,7 +175,7 @@ void EditListBox::typedSomething(const QString& text) void EditListBox::moveItemUp() { - QListViewItem *item = _listView->selectedItem(); + TQListViewItem *item = _listView->selectedItem(); if ( item==0 || item->itemAbove()==0 ) return; item->itemAbove()->moveItem(item); updateButtons(); @@ -184,7 +184,7 @@ void EditListBox::moveItemUp() void EditListBox::moveItemDown() { - QListViewItem *item = _listView->selectedItem(); + TQListViewItem *item = _listView->selectedItem(); if ( item==0 || item->itemBelow()==0 ) return; item->moveItem(item->itemBelow()); updateButtons(); @@ -201,11 +201,11 @@ void EditListBox::addItem() addItem(m_lineEdit->text()); } -void EditListBox::addItem(const QString &text) +void EditListBox::addItem(const TQString &text) { bool alreadyInList(false); //if we didn't check for dupes at the inserting we have to do it now - if ( _mode==DuplicatesDisallowed ) alreadyInList = _listView->findItem(text, textColumn()); + if ( _mode==DuplicatesDisallowed ) alreadyInList = _listView->tqfindItem(text, textColumn()); if (m_lineEdit) { bool block = m_lineEdit->signalsBlocked(); @@ -216,7 +216,7 @@ void EditListBox::addItem(const QString &text) _listView->clearSelection(); if (!alreadyInList) { - QListViewItem *item = createItem(); + TQListViewItem *item = createItem(); item->setText(textColumn(), text); if ( _listView->lastItem() ) item->moveItem(_listView->lastItem()); emit changed(); @@ -237,9 +237,9 @@ void EditListBox::clearEdit() void EditListBox::removeItem() { - QListViewItem *item = _listView->selectedItem(); + TQListViewItem *item = _listView->selectedItem(); if (item) { - QString text = item->text(textColumn()); + TQString text = item->text(textColumn()); delete item; emit changed(); emit removed(text); @@ -267,15 +267,15 @@ void EditListBox::clear() uint EditListBox::count() const { uint nb = 0; - QListViewItemIterator it(_listView); + TQListViewItemIterator it(_listView); for (; it.current(); ++it) nb++; return nb; } -const QListViewItem *EditListBox::item(uint i) const +const TQListViewItem *EditListBox::item(uint i) const { uint k = 0; - QListViewItemIterator it(_listView); + TQListViewItemIterator it(_listView); for (; it.current(); ++it) { if ( k==i ) return it.current(); k++; @@ -283,19 +283,19 @@ const QListViewItem *EditListBox::item(uint i) const return 0; } -QStringList EditListBox::texts() const +TQStringList EditListBox::texts() const { - QStringList list; - QListViewItemIterator it(_listView); + TQStringList list; + TQListViewItemIterator it(_listView); for (; it.current(); ++it) list.append(it.current()->text(textColumn())); return list; } -void EditListBox::setTexts(const QStringList& items) +void EditListBox::setTexts(const TQStringList& items) { _listView->clear(); for (int i=items.count()-1; i>=0; i--) { - QListViewItem *item = createItem(); + TQListViewItem *item = createItem(); item->setText(textColumn(), items[i]); } if (m_lineEdit) m_lineEdit->clear(); @@ -304,14 +304,14 @@ void EditListBox::setTexts(const QStringList& items) void EditListBox::updateButtons() { - QListViewItem *item = _listView->selectedItem(); + TQListViewItem *item = _listView->selectedItem(); if (_addButton) { if ( m_lineEdit==0 ) _addButton->setEnabled(true); else { - QString text = m_lineEdit->text(); + TQString text = m_lineEdit->text(); if ( _mode!=DuplicatesCheckedAtEntering ) _addButton->setEnabled(!text.isEmpty()); else if ( text.isEmpty() ) _addButton->setEnabled(false); - else _addButton->setEnabled(!_listView->findItem(text, textColumn())); + else _addButton->setEnabled(!_listView->tqfindItem(text, textColumn())); } } if (_removeButton) _removeButton->setEnabled(item); @@ -320,21 +320,21 @@ void EditListBox::updateButtons() if (_removeAllButton) _removeAllButton->setEnabled(_listView->firstChild()); } -void EditListBox::setEditText(const QString &text) +void EditListBox::setEditText(const TQString &text) { _listView->clearSelection(); if (m_lineEdit) m_lineEdit->setText(text); updateButtons(); } -QListViewItem *EditListBox::createItem() +TQListViewItem *EditListBox::createItem() { return new KListViewItem(_listView); } -QString EditListBox::selectedText() const +TQString EditListBox::selectedText() const { - QListViewItem *item = _listView->selectedItem(); - if ( item==0 ) return QString::null; + TQListViewItem *item = _listView->selectedItem(); + if ( item==0 ) return TQString(); return item->text(textColumn()); } |