aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar Alexey Uzhva2008-08-27 14:34:23 +0000
committerGravatar Alexey Uzhva2008-08-27 14:34:23 +0000
commitac47dac49e56e3539a70dd74ae4c13aca75ef398 (patch)
tree66b60e3dab89ccc3ee7d2f272c4afc546b61b380 /src/modules
parentclean (diff)
downloadKVIrc-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')
-rw-r--r--src/modules/file/libkvifile.cpp2
-rw-r--r--src/modules/reguser/edituser.cpp57
-rw-r--r--src/modules/reguser/edituser.h10
-rw-r--r--src/modules/url/libkviurl.cpp17
-rw-r--r--src/modules/url/libkviurl.h9
5 files changed, 48 insertions, 47 deletions
diff --git a/src/modules/file/libkvifile.cpp b/src/modules/file/libkvifile.cpp
index d2b4c8231..3c6253c62 100644
--- a/src/modules/file/libkvifile.cpp
+++ b/src/modules/file/libkvifile.cpp
@@ -925,7 +925,7 @@ static bool file_kvs_cmd_writeLines(KviKvsModuleCommandCall * c)
{
QString szDat;
v->asString(szDat);
- dat = bLocal8Bit ? szDat.local8Bit() : szDat.utf8();
+ dat = bLocal8Bit ? szDat.toLocal8Bit() : szDat.toUtf8();
if(!bNoSeparator)
{
diff --git a/src/modules/reguser/edituser.cpp b/src/modules/reguser/edituser.cpp
index 933f7cb59..080bd3f9e 100644
--- a/src/modules/reguser/edituser.cpp
+++ b/src/modules/reguser/edituser.cpp
@@ -316,13 +316,13 @@ KviRegisteredUserEntryDialog::KviRegisteredUserEntryDialog(QWidget *p,KviRegiste
{
m_pUser = r;
m_pCustomColor = new QColor();
-
+
if(r)
{
QString col=r->getProperty("customColor");
KviStringConversion::fromString(col,(*m_pCustomColor));
}
-
+
m_pPropertyDict = new KviPointerHashTable<QString,QString>(17,false);
m_pPropertyDict->setAutoDelete(true);
@@ -343,7 +343,7 @@ KviRegisteredUserEntryDialog::KviRegisteredUserEntryDialog(QWidget *p,KviRegiste
l = new QLabel(__tr2qs("Comment:"),p1);
g->addWidget(l,1,0);
-
+
m_pCommentEdit = new QLineEdit(p1);
g->addWidget(m_pCommentEdit,1,1);
@@ -354,8 +354,8 @@ KviRegisteredUserEntryDialog::KviRegisteredUserEntryDialog(QWidget *p,KviRegiste
l = new QLabel(__tr2qs("Masks:"),p1);
g->addMultiCellWidget(l,3,3,0,1);
- m_pMaskListBox = new KviTalListBox(p1);
- connect(m_pMaskListBox,SIGNAL(currentChanged(KviTalListBoxItem *)),this,SLOT(maskCurrentChanged(KviTalListBoxItem *)));
+ m_pMaskListBox = new QListWidget(p1);
+ connect(m_pMaskListBox,SIGNAL(itemActivated(QListWidgetItem *)),this,SLOT(maskCurrentChanged(QListWidgetItem *)));
m_pMaskListBox->setMinimumSize(300,200);
g->addMultiCellWidget(m_pMaskListBox,4,4,0,1);
@@ -432,7 +432,7 @@ KviRegisteredUserEntryDialog::KviRegisteredUserEntryDialog(QWidget *p,KviRegiste
m_pCustomColorSelector = new KviColorSelector(p2,QString::null,m_pCustomColor,1);
g->addWidget(m_pCustomColorSelector,5,2);
-
+
QPushButton * pb = new QPushButton(__tr2qs("All Properties..."),p2);
connect(pb,SIGNAL(clicked()),this,SLOT(editAllPropertiesClicked()));
g->addWidget(pb,6,2);
@@ -450,9 +450,9 @@ KviRegisteredUserEntryDialog::KviRegisteredUserEntryDialog(QWidget *p,KviRegiste
QGroupBox * gb = new QGroupBox(__tr2qs("Ignore features"),vb);
connect(m_pIgnoreEnabled,SIGNAL(toggled(bool)),gb,SLOT(setEnabled(bool)));
-
+
QVBoxLayout * layout = new QVBoxLayout(gb,20,3);
-
+
m_pIgnoreQuery = new QCheckBox(__tr2qs("Ignore query-messages"),gb);
layout->addWidget(m_pIgnoreQuery);
@@ -492,7 +492,7 @@ KviRegisteredUserEntryDialog::KviRegisteredUserEntryDialog(QWidget *p,KviRegiste
mk += m->user();
mk += QChar('@');
mk += m->host();
- m_pMaskListBox->insertItem(mk);
+ m_pMaskListBox->addItem(mk);
}
QString szNotifyNicks = r->getProperty("notify");
@@ -502,7 +502,7 @@ KviRegisteredUserEntryDialog::KviRegisteredUserEntryDialog(QWidget *p,KviRegiste
m_pNotifyNick->setText(szNotifyNicks);
m_pNotifyNick->setEnabled(true);
}
-
+
if(r->propertyDict())
{
KviPointerHashTableIterator<QString,QString> it(*(r->propertyDict()));
@@ -516,7 +516,7 @@ KviRegisteredUserEntryDialog::KviRegisteredUserEntryDialog(QWidget *p,KviRegiste
m_pIgnoreEnabled->setChecked(r->ignoreEnagled());
gb->setEnabled(r->ignoreEnagled());
-
+
m_pIgnoreQuery->setChecked(r->ignoreFlags() & KviRegisteredUser::Query);
m_pIgnoreChannel->setChecked(r->ignoreFlags() & KviRegisteredUser::Channel);
m_pIgnoreNotice->setChecked(r->ignoreFlags() & KviRegisteredUser::Notice);
@@ -546,7 +546,7 @@ KviRegisteredUserEntryDialog::~KviRegisteredUserEntryDialog()
delete m_pCustomColor;
}
-void KviRegisteredUserEntryDialog::maskCurrentChanged(KviTalListBoxItem *it)
+void KviRegisteredUserEntryDialog::maskCurrentChanged(QListWidgetItem *it)
{
m_pDelMaskButton->setEnabled(it);
m_pEditMaskButton->setEnabled(it);
@@ -583,7 +583,7 @@ void KviRegisteredUserEntryDialog::okClicked()
u = g_pLocalRegisteredUserDataBase->addUser(szNameOk);
u->setGroup(szGroup);
-
+
if(!u)
{
// ops... no way
@@ -597,7 +597,7 @@ void KviRegisteredUserEntryDialog::okClicked()
idx = 0;
while(cnt > 0)
{
- QString mask = m_pMaskListBox->text(idx);
+ QString mask = m_pMaskListBox->item(idx)->text();
KviIrcMask * mk = new KviIrcMask(mask);
g_pLocalRegisteredUserDataBase->removeMask(*mk);
g_pLocalRegisteredUserDataBase->addMask(u,mk);
@@ -605,7 +605,7 @@ void KviRegisteredUserEntryDialog::okClicked()
idx++;
}
u->setProperty("comment",m_pCommentEdit->text());
-
+
m_pAvatarSelector->commit();
if(!m_pAvatar->isNull())
@@ -617,13 +617,13 @@ void KviRegisteredUserEntryDialog::okClicked()
if(m_pNotifyCheck->isChecked())
{
QString szNicks = m_pNotifyNick->text();
-
+
if(!szNicks.isEmpty())
{
u->setProperty("notify",szNicks);
}
}
-
+
m_pPropertyDict->remove("notify");
m_pPropertyDict->remove("avatar");
@@ -635,12 +635,12 @@ void KviRegisteredUserEntryDialog::okClicked()
}
u->setProperty("useCustomColor",m_pCustomColorCheck->isChecked());
-
+
QString col;
KviStringConversion::toString(m_pCustomColorSelector->getColor(),col);
u->setProperty("customColor",col);
-
+
int iIgnoreFlags=0;
u->setIgnoreEnabled(m_pIgnoreEnabled->isChecked());
if(m_pIgnoreQuery->isChecked())
@@ -672,26 +672,25 @@ void KviRegisteredUserEntryDialog::addMaskClicked()
m += mk.user();
m += QChar('@');
m += mk.host();
- m_pMaskListBox->insertItem(m);
+ m_pMaskListBox->addItem(m);
}
delete dlg;
}
void KviRegisteredUserEntryDialog::delMaskClicked()
{
- int idx = m_pMaskListBox->currentItem();
- if(idx == -1)return;
- m_pMaskListBox->removeItem(idx);
+ if(m_pMaskListBox->currentItem()) {
+ delete m_pMaskListBox->currentItem();
+ }
}
void KviRegisteredUserEntryDialog::editMaskClicked()
{
- int idx = m_pMaskListBox->currentItem();
- if(idx == -1)return;
- KviStr szM = m_pMaskListBox->text(idx);
+ if(!m_pMaskListBox->currentItem())return;
+ QString szM = m_pMaskListBox->currentItem()->text();
if(szM.isEmpty())return;
- KviIrcMask mk(szM.ptr());
+ KviIrcMask mk(szM);
KviReguserMaskDialog * dlg = new KviReguserMaskDialog(this,&mk);
if(dlg->exec() == QDialog::Accepted)
{
@@ -700,7 +699,7 @@ void KviRegisteredUserEntryDialog::editMaskClicked()
m += mk.user();
m += QChar('@');
m += mk.host();
- m_pMaskListBox->changeItem(m,idx);
+ m_pMaskListBox->currentItem()->setText(m);
}
delete dlg;
}
@@ -721,7 +720,7 @@ void KviRegisteredUserEntryDialog::editAllPropertiesClicked()
if(m_pNotifyCheck->isChecked())
{
QString szNicks = m_pNotifyNick->text();
-
+
if(!szNicks.isEmpty())
{
m_pPropertyDict->replace("notify",new QString(szNicks));
diff --git a/src/modules/reguser/edituser.h b/src/modules/reguser/edituser.h
index 67e25e4de..06354db47 100644
--- a/src/modules/reguser/edituser.h
+++ b/src/modules/reguser/edituser.h
@@ -29,10 +29,10 @@
#include "kvi_selectors.h"
#include "kvi_pointerhashtable.h"
#include "kvi_tal_listview.h"
-#include "kvi_tal_listbox.h"
#include "kvi_tal_popupmenu.h"
#include <kvi_tal_tabdialog.h>
+#include <QListWidget>
#include <QWidget>
#include <QLineEdit>
#include <QPushButton>
@@ -79,7 +79,7 @@ protected:
QLineEdit * m_pNickEdit;
QLineEdit * m_pUserEdit;
QLineEdit * m_pHostEdit;
-
+
virtual void closeEvent(QCloseEvent *);
protected slots:
void okClicked();
@@ -98,7 +98,7 @@ protected:
QLineEdit * m_pNameEdit;
QLineEdit * m_pCommentEdit;
- KviTalListBox * m_pMaskListBox;
+ QListWidget * m_pMaskListBox;
QPushButton * m_pDelMaskButton;
QPushButton * m_pEditMaskButton;
@@ -111,7 +111,7 @@ protected:
KviPixmapSelector * m_pAvatarSelector;
KviPointerHashTable<QString,QString> * m_pPropertyDict;
-
+
QCheckBox * m_pCustomColorCheck;
QColor * m_pCustomColor;
KviColorSelector * m_pCustomColorSelector;
@@ -132,7 +132,7 @@ protected slots:
void delMaskClicked();
void editMaskClicked();
void editAllPropertiesClicked();
- void maskCurrentChanged(KviTalListBoxItem *it);
+ void maskCurrentChanged(QListWidgetItem *it);
};
#endif //_EDITUSER_H_
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();