diff options
| author | 2008-08-27 14:34:23 +0000 | |
|---|---|---|
| committer | 2008-08-27 14:34:23 +0000 | |
| commit | ac47dac49e56e3539a70dd74ae4c13aca75ef398 (patch) | |
| tree | 66b60e3dab89ccc3ee7d2f272c4afc546b61b380 /src/modules/url | |
| parent | clean (diff) | |
| download | KVIrc-ac47dac49e56e3539a70dd74ae4c13aca75ef398.tar.gz KVIrc-ac47dac49e56e3539a70dd74ae4c13aca75ef398.tar.bz2 KVIrc-ac47dac49e56e3539a70dd74ae4c13aca75ef398.zip | |
more qt4 porting
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@2320 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/url')
| -rw-r--r-- | src/modules/url/libkviurl.cpp | 17 | ||||
| -rw-r--r-- | src/modules/url/libkviurl.h | 9 |
2 files changed, 14 insertions, 12 deletions
diff --git a/src/modules/url/libkviurl.cpp b/src/modules/url/libkviurl.cpp index b2d8c1ce0..9ad5c54f5 100644 --- a/src/modules/url/libkviurl.cpp +++ b/src/modules/url/libkviurl.cpp @@ -417,10 +417,13 @@ BanFrame::BanFrame(QWidget *parent, const char *name, bool banEnabled) m_pEnable->setChecked(banEnabled); g->addMultiCellWidget(m_pEnable,0,0,0,1); - m_pBanList = new KviTalListBox(this); + m_pBanList = new QListWidget(this); m_pBanList->setMinimumHeight(100); loadBanList(); - for(KviStr *tmp=g_pBanList->first();tmp;tmp=g_pBanList->next()) m_pBanList->insertItem(tmp->ptr()); // load ban list into listbox + for(KviStr *tmp=g_pBanList->first();tmp;tmp=g_pBanList->next()) { + m_pBanList->addItem(tmp->ptr()); // load ban list into listbox + } + m_pBanList->setEnabled(m_pEnable->isChecked()); g->addMultiCellWidget(m_pBanList,1,1,0,1); @@ -448,19 +451,17 @@ void BanFrame::addBan() KviStr *text = new KviStr(QInputDialog::getText(__tr2qs("URL Ban List"),__tr2qs("Add"),QLineEdit::Normal,QString::null,&ok,this)); if (ok && !text->isEmpty()) { g_pBanList->append(text); - m_pBanList->insertItem(text->ptr()); + m_pBanList->addItem(text->ptr()); } } void BanFrame::removeBan() { - uint i = 0; - while ((!m_pBanList->isSelected(i)) && (i < m_pBanList->count())) i++; - if (!m_pBanList->isSelected(i)) { + if (!m_pBanList->currentItem()->isSelected()) { QMessageBox::warning(0,__tr2qs("Warning - KVIrc"),__tr2qs("Select a ban."),QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); return; } - KviStr item(m_pBanList->text(i).toUtf8().data()); + KviStr item(m_pBanList->currentItem()->text()); for(KviStr *tmp=g_pBanList->first();tmp;tmp=g_pBanList->next()) { if (*tmp == item) @@ -470,7 +471,7 @@ void BanFrame::removeBan() } } - m_pBanList->removeItem(i); + m_pBanList->removeItemWidget(m_pBanList->currentItem()); } diff --git a/src/modules/url/libkviurl.h b/src/modules/url/libkviurl.h index 3f69c534d..6a4300a06 100644 --- a/src/modules/url/libkviurl.h +++ b/src/modules/url/libkviurl.h @@ -40,6 +40,7 @@ #include <QIcon> #include <QPixmap> #include <QCheckBox> +#include <QListWidget> typedef struct _KviUrl { @@ -89,10 +90,10 @@ public: ~BanFrame(); void saveBans(); private: - QCheckBox *m_pEnable; - KviTalListBox *m_pBanList; - QPushButton *m_pAddBtn; - QPushButton *m_pRemoveBtn; + QCheckBox *m_pEnable; + QListWidget *m_pBanList; + QPushButton *m_pAddBtn; + QPushButton *m_pRemoveBtn; protected slots: void enableClicked(); void addBan(); |
