diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
commit | 0a80cfd57d271dd44221467efb426675fa470356 (patch) | |
tree | 6f503a31aa078eaf8fa015cf1749808529d49fc9 /src/modules/url/libkviurl.cpp | |
parent | 3329e5a804e28ef3f5eb51d1e7affdd5a508e8f2 (diff) | |
download | kvirc-0a80cfd57d271dd44221467efb426675fa470356.tar.gz kvirc-0a80cfd57d271dd44221467efb426675fa470356.zip |
TQt4 port kvirc
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1238719 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/modules/url/libkviurl.cpp')
-rw-r--r-- | src/modules/url/libkviurl.cpp | 162 |
1 files changed, 81 insertions, 81 deletions
diff --git a/src/modules/url/libkviurl.cpp b/src/modules/url/libkviurl.cpp index 16430c67..abe3d79e 100644 --- a/src/modules/url/libkviurl.cpp +++ b/src/modules/url/libkviurl.cpp @@ -33,17 +33,17 @@ #include "kvi_taskbar.h" #include "icons.h" #include "kvi_pointerlist.h" -#include <qfiledialog.h> -#include <qmessagebox.h> -#include <qcursor.h> -#include <qdatetime.h> +#include <tqfiledialog.h> +#include <tqmessagebox.h> +#include <tqcursor.h> +#include <tqdatetime.h> #ifdef COMPILE_USE_QT4 - #include <q3textstream.h> - #include <QTextStream> + #include <tq3textstream.h> + #include <TQTextStream> #endif -static QPixmap * g_pUrlIconPixmap = 0; +static TQPixmap * g_pUrlIconPixmap = 0; static KviUrlAction * g_pUrlAction = 0; typedef struct _UrlDlgList @@ -80,7 +80,7 @@ static KviModuleExtension * url_extension_alloc(KviModuleExtensionAllocStruct * } -KviUrlAction::KviUrlAction(QObject * pParent) +KviUrlAction::KviUrlAction(TQObject * pParent) : KviKvsAction(pParent, "url.list", "url.list", @@ -88,8 +88,8 @@ KviUrlAction::KviUrlAction(QObject * pParent) __tr2qs("Shows the URL list window"), KviActionManager::categoryGeneric()) { - m_pBigIcon = new QPixmap(url_toolbar_xpm); - m_pSmallIcon = new QPixmap(url_icon_xpm); + m_pBigIcon = new TQPixmap(url_toolbar_xpm); + m_pSmallIcon = new TQPixmap(url_icon_xpm); } KviUrlAction::~KviUrlAction() @@ -98,12 +98,12 @@ KviUrlAction::~KviUrlAction() delete m_pSmallIcon; } -QPixmap * KviUrlAction::bigIcon() +TQPixmap * KviUrlAction::bigIcon() { return m_pBigIcon; } -QPixmap * KviUrlAction::smallIcon() +TQPixmap * KviUrlAction::smallIcon() { return m_pSmallIcon; } @@ -121,15 +121,15 @@ UrlDialog::UrlDialog(KviPointerList<KviUrl> *g_pList) KviTalPopupMenu *pop; pop = new KviTalPopupMenu(this); - pop->insertItem(__tr2qs("&Configure"),this,SLOT(config())); - pop->insertItem(__tr2qs("&Help"),this,SLOT(help())); - pop->insertItem(__tr2qs("Clo&se"),this,SLOT(close_slot())); + pop->insertItem(__tr2qs("&Configure"),this,TQT_SLOT(config())); + pop->insertItem(__tr2qs("&Help"),this,TQT_SLOT(help())); + pop->insertItem(__tr2qs("Clo&se"),this,TQT_SLOT(close_slot())); m_pMenuBar->insertItem(__tr2qs("&Module"),pop); pop = new KviTalPopupMenu(this); - pop->insertItem(__tr2qs("&Load"),this,SLOT(loadList())); - pop->insertItem(__tr2qs("&Save"),this,SLOT(saveList())); - pop->insertItem(__tr2qs("&Clear"),this,SLOT(clear())); + pop->insertItem(__tr2qs("&Load"),this,TQT_SLOT(loadList())); + pop->insertItem(__tr2qs("&Save"),this,TQT_SLOT(saveList())); + pop->insertItem(__tr2qs("&Clear"),this,TQT_SLOT(clear())); m_pMenuBar->insertItem(__tr2qs("&List"),pop); m_pUrlList->setShowSortIndicator(true); @@ -144,14 +144,14 @@ UrlDialog::UrlDialog(KviPointerList<KviUrl> *g_pList) m_pUrlList->setColumnWidth(2,cfg.readIntEntry("Count",70)); m_pUrlList->setColumnWidth(3,cfg.readIntEntry("Timestamp",70)); - connect(m_pUrlList,SIGNAL(doubleClicked(KviTalListViewItem *)),SLOT(dblclk_url(KviTalListViewItem *))); - connect(m_pUrlList,SIGNAL(rightButtonPressed(KviTalListViewItem *, const QPoint &, int)),SLOT(popup(KviTalListViewItem *, const QPoint &, int))); + connect(m_pUrlList,TQT_SIGNAL(doubleClicked(KviTalListViewItem *)),TQT_SLOT(dblclk_url(KviTalListViewItem *))); + connect(m_pUrlList,TQT_SIGNAL(rightButtonPressed(KviTalListViewItem *, const TQPoint &, int)),TQT_SLOT(popup(KviTalListViewItem *, const TQPoint &, int))); // setFocusHandlerNoChildren(m_pUrlList); #ifdef COMPILE_USE_QT4 - m_pUrlList->setFocusPolicy(Qt::StrongFocus); + m_pUrlList->setFocusPolicy(TTQ_StrongFocus); #else - m_pUrlList->setFocusPolicy(QWidget::StrongFocus); + m_pUrlList->setFocusPolicy(TQ_StrongFocus); #endif m_pUrlList->setFocus(); } @@ -213,7 +213,7 @@ void UrlDialog::close_slot() void UrlDialog::remove() { if (!m_pUrlList->currentItem()) { - QMessageBox::warning(0,__tr2qs("Warning - KVIrc"),__tr2qs("Select an URL."),QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + TQMessageBox::warning(0,__tr2qs("Warning - KVIrc"),__tr2qs("Select an URL."),TQMessageBox::Ok,TQMessageBox::NoButton,TQMessageBox::NoButton); return; } @@ -238,7 +238,7 @@ void UrlDialog::findtext() for(KviUrl *tmp=g_pList->first();tmp;tmp=g_pList->next()) { if (tmp->url == KviStr(m_pUrlList->currentItem()->text(0))) { - g_pList->find(tmp); + g_pList->tqfind(tmp); KviStr ft="findtext %"; ft.replaceAll('%',tmp->url.ptr()); KviWindow *wnd = m_pFrm->findWindow(tmp->window.ptr()); @@ -255,53 +255,53 @@ void UrlDialog::findtext() void UrlDialog::dblclk_url(KviTalListViewItem *item) { - QString cmd="openurl "; + TQString cmd="openurl "; cmd.append(item->text(0)); KviKvsScript::run(cmd,this); } -void UrlDialog::popup(KviTalListViewItem *item, const QPoint &point, int col) +void UrlDialog::popup(KviTalListViewItem *item, const TQPoint &point, int col) { if (col == 0) { m_szUrl = item->text(0); KviTalPopupMenu p(0,"menu"); - p.insertItem(__tr2qs("&Remove"),this,SLOT(remove())); - p.insertItem(__tr2qs("&Find Text"),this,SLOT(findtext())); + p.insertItem(__tr2qs("&Remove"),this,TQT_SLOT(remove())); + p.insertItem(__tr2qs("&Find Text"),this,TQT_SLOT(findtext())); p.insertSeparator(); m_pListPopup = new KviTalPopupMenu(0,"list"); int i=0; for(KviWindow *w=g_pFrame->windowList()->first();w;w=g_pFrame->windowList()->next()){ if ((w->type() <= 2) || (w->type() == 2) || (w->type() == 6)) { // values defined in kvi_define.h (console,channel,query,chat,uwindow) - m_pListPopup->insertItem(QString(w->plainTextCaption()),i); - m_pListPopup->connectItem(i,this,SLOT(sayToWin(int))); + m_pListPopup->insertItem(TQString(w->plainTextCaption()),i); + m_pListPopup->connectItem(i,this,TQT_SLOT(sayToWin(int))); i++; } } p.insertItem(__tr2qs("&Say to Window"),m_pListPopup); - p.exec(QCursor::pos()); + p.exec(TQCursor::pos()); } } void UrlDialog::sayToWin(int itemID) { KviWindow *wnd = g_pApp->findWindowByCaption(m_pListPopup->text(itemID).utf8().data()); - QString say=QString("PRIVMSG %1 %2").arg(wnd->windowName()).arg(m_szUrl.ptr()); + TQString say=TQString("PRIVMSG %1 %2").tqarg(wnd->windowName()).tqarg(m_szUrl.ptr()); if (wnd) { KviKvsScript::run(say,wnd); wnd->raise(); wnd->setActiveWindow(); wnd->setFocus(); - } else QMessageBox::warning(0,__tr2qs("Warning - KVIrc"),__tr2qs("Window not found."),QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + } else TQMessageBox::warning(0,__tr2qs("Warning - KVIrc"),__tr2qs("Window not found."),TQMessageBox::Ok,TQMessageBox::NoButton,TQMessageBox::NoButton); } -QPixmap *UrlDialog::myIconPtr() +TQPixmap *UrlDialog::myIconPtr() { - //QPixmap *icon = new QPixmap(url_icon_xpm); + //TQPixmap *icon = new TQPixmap(url_icon_xpm); //return icon; return g_pUrlIconPixmap; } -void UrlDialog::addUrl(QString url, QString window, QString count, QString timestamp) +void UrlDialog::addUrl(TQString url, TQString window, TQString count, TQString timestamp) { KviTalListViewItem *UrlItem = new KviTalListViewItem(m_pUrlList); @@ -311,7 +311,7 @@ void UrlDialog::addUrl(QString url, QString window, QString count, QString times UrlItem->setText(3, timestamp); } -void UrlDialog::resizeEvent(QResizeEvent *) +void UrlDialog::resizeEvent(TQResizeEvent *) { int hght = m_pMenuBar->heightForWidth(width()); m_pMenuBar->setGeometry(0,0,width(),hght); @@ -344,11 +344,11 @@ UrlDialog::~UrlDialog() // --------------------------- CLASS CONFIGDIALOG ----------------------begin // ConfigDialog::ConfigDialog() -:QDialog() +:TQDialog() { setCaption(__tr2qs("URL Module Configuration")); - QGridLayout *g = new QGridLayout(this,4,2,10,10); + TQGridLayout *g = new TQGridLayout(this,4,2,10,10); KviConfig *cfg = new KviConfig(szConfigPath.ptr(),KviConfig::Read); cfg->setGroup("ConfigDialog"); @@ -367,14 +367,14 @@ ConfigDialog::ConfigDialog() m_pBanFrame = new BanFrame(this,"banlist",tmp); g->addMultiCellWidget(m_pBanFrame,3,3,0,1); - QPushButton *b; + TQPushButton *b; // configure buttons - b = new QPushButton(__tr2qs("&Cancel"),this,"discard"); - connect(b,SIGNAL(clicked()),this,SLOT(discardbtn())); + b = new TQPushButton(__tr2qs("&Cancel"),this,"discard"); + connect(b,TQT_SIGNAL(clicked()),this,TQT_SLOT(discardbtn())); g->addWidget(b,4,0); - b = new QPushButton(__tr2qs("&OK"),this,"accept"); - connect(b,SIGNAL(clicked()),this,SLOT(acceptbtn())); + b = new TQPushButton(__tr2qs("&OK"),this,"accept"); + connect(b,TQT_SIGNAL(clicked()),this,TQT_SLOT(acceptbtn())); g->addWidget(b,4,1); show(); @@ -398,7 +398,7 @@ void ConfigDialog::acceptbtn() delete this; } -void ConfigDialog::closeEvent(QCloseEvent *) +void ConfigDialog::closeEvent(TQCloseEvent *) { delete this; } @@ -413,15 +413,15 @@ ConfigDialog::~ConfigDialog() // ---------------------------- CLASS BANFRAME ------------------------begin // -BanFrame::BanFrame(QWidget *parent, const char *name, bool banEnabled) -:QFrame(parent,name) +BanFrame::BanFrame(TQWidget *tqparent, const char *name, bool banEnabled) +:TQFrame(tqparent,name) { - setFrameStyle(QFrame::Panel | QFrame::Raised); + setFrameStyle(TQFrame::Panel | TQFrame::Raised); - QGridLayout *g = new QGridLayout(this,2,2,10,10); + TQGridLayout *g = new TQGridLayout(this,2,2,10,10); m_pEnable = new KviStyledCheckBox(__tr2qs("Enable URL ban list"),this); - connect(m_pEnable,SIGNAL(clicked()),this,SLOT(enableClicked())); + connect(m_pEnable,TQT_SIGNAL(clicked()),this,TQT_SLOT(enableClicked())); m_pEnable->setChecked(banEnabled); g->addMultiCellWidget(m_pEnable,0,0,0,1); @@ -432,13 +432,13 @@ BanFrame::BanFrame(QWidget *parent, const char *name, bool banEnabled) m_pBanList->setEnabled(m_pEnable->isChecked()); g->addMultiCellWidget(m_pBanList,1,1,0,1); - m_pAddBtn = new QPushButton(__tr2qs("&Add Ban"),this,"add"); - connect(m_pAddBtn,SIGNAL(clicked()),this,SLOT(addBan())); + m_pAddBtn = new TQPushButton(__tr2qs("&Add Ban"),this,"add"); + connect(m_pAddBtn,TQT_SIGNAL(clicked()),this,TQT_SLOT(addBan())); m_pAddBtn->setEnabled(m_pEnable->isChecked()); g->addWidget(m_pAddBtn,2,0); - m_pRemoveBtn = new QPushButton(__tr2qs("&Remove Selected"),this,"remove"); - connect(m_pRemoveBtn,SIGNAL(clicked()),this,SLOT(removeBan())); + m_pRemoveBtn = new TQPushButton(__tr2qs("&Remove Selected"),this,"remove"); + connect(m_pRemoveBtn,TQT_SIGNAL(clicked()),this,TQT_SLOT(removeBan())); m_pRemoveBtn->setEnabled(m_pEnable->isChecked()); g->addWidget(m_pRemoveBtn,2,1); } @@ -453,7 +453,7 @@ void BanFrame::enableClicked() void BanFrame::addBan() { bool ok = false; - KviStr *text = new KviStr(QInputDialog::getText(__tr2qs("URL Ban List"),__tr2qs("Add"),QLineEdit::Normal,QString::null,&ok,this)); + KviStr *text = new KviStr(TQInputDialog::getText(__tr2qs("URL Ban List"),__tr2qs("Add"),TQLineEdit::Normal,TQString(),&ok,this)); if (ok && !text->isEmpty()) { g_pBanList->append(text); m_pBanList->insertItem(text->ptr()); @@ -465,7 +465,7 @@ void BanFrame::removeBan() uint i = 0; while ((!m_pBanList->isSelected(i)) && (i < m_pBanList->count())) i++; if (!m_pBanList->isSelected(i)) { - QMessageBox::warning(0,__tr2qs("Warning - KVIrc"),__tr2qs("Select a ban."),QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + TQMessageBox::warning(0,__tr2qs("Warning - KVIrc"),__tr2qs("Select a ban."),TQMessageBox::Ok,TQMessageBox::NoButton,TQMessageBox::NoButton); return; } KviStr item(m_pBanList->text(i).utf8().data()); @@ -500,14 +500,14 @@ BanFrame::~BanFrame() void saveUrlList() { - QString urllist; + TQString urllist; g_pApp->getLocalKvircDirectory(urllist,KviApp::ConfigPlugins); urllist += g_pUrlListFilename; - QFile file; + TQFile file; file.setName(urllist); file.open(IO_WriteOnly); - QTextStream stream(&file); + TQTextStream stream(&file); stream << g_pList->count() << endl; @@ -527,13 +527,13 @@ void loadUrlList() KviStr urllist; g_pApp->getLocalKvircDirectory(urllist,KviApp::ConfigPlugins); urllist += g_pUrlListFilename; - QFile file; - file.setName(QString::fromUtf8(urllist.ptr())); + TQFile file; + file.setName(TQString::fromUtf8(urllist.ptr())); if (!file.open(IO_ReadOnly))return; #ifdef COMPILE_USE_QT4 Q3TextStream stream(&file); #else - QTextStream stream(&file); + TQTextStream stream(&file); #endif @@ -556,9 +556,9 @@ void loadUrlList() for (UrlDlgList *tmpitem=g_pUrlDlgList->first();tmpitem;tmpitem=g_pUrlDlgList->next()) { if (tmpitem->dlg) { - QString tmpCount; + TQString tmpCount; tmpCount.setNum(tmp->count); - tmpitem->dlg->addUrl(QString(tmp->url), QString(tmp->window), tmpCount, QString(tmp->timestamp)); + tmpitem->dlg->addUrl(TQString(tmp->url), TQString(tmp->window), tmpCount, TQString(tmp->timestamp)); } } i++; @@ -571,11 +571,11 @@ void saveBanList() KviStr banlist; g_pApp->getLocalKvircDirectory(banlist,KviApp::ConfigPlugins); banlist += g_pBanListFilename; - QFile file; - file.setName(QString::fromUtf8(banlist.ptr())); + TQFile file; + file.setName(TQString::fromUtf8(banlist.ptr())); file.open(IO_WriteOnly); - QTextStream stream(&file); + TQTextStream stream(&file); stream << g_pBanList->count() << endl; for(KviStr *tmp=g_pBanList->first();tmp;tmp=g_pBanList->next()) @@ -591,13 +591,13 @@ void loadBanList() KviStr banlist; g_pApp->getLocalKvircDirectory(banlist,KviApp::ConfigPlugins); banlist += g_pBanListFilename; - QFile file; - file.setName(QString::fromUtf8(banlist.ptr())); + TQFile file; + file.setName(TQString::fromUtf8(banlist.ptr())); if (!file.open(IO_ReadOnly))return; #ifdef COMPILE_USE_QT4 Q3TextStream stream(&file); #else - QTextStream stream(&file); + TQTextStream stream(&file); #endif g_pBanList->clear(); @@ -667,9 +667,9 @@ bool urllist() for(KviUrl *tmp=g_pList->first();tmp;tmp=g_pList->next()) { - QString tmpCount; + TQString tmpCount; tmpCount.setNum(tmp->count); - tmpitem->dlg->addUrl(QString(tmp->url), QString(tmp->window), tmpCount, QString(tmp->timestamp)); + tmpitem->dlg->addUrl(TQString(tmp->url), TQString(tmp->window), tmpCount, TQString(tmp->timestamp)); } return true; } @@ -704,13 +704,13 @@ static bool url_kvs_cmd_config(KviKvsModuleCommandCall * c) return true; } -int check_url(KviWindow *w,const QString &szUrl) // return 0 if no occurence of the url were found +int check_url(KviWindow *w,const TQString &szUrl) // return 0 if no occurence of the url were found { int tmp = 0; for(KviStr *tmpi=g_pBanList->first();tmpi;tmpi=g_pBanList->next()) { - if (szUrl.find(QString(tmpi->ptr())) != -1) tmp++; + if (szUrl.tqfind(TQString(tmpi->ptr())) != -1) tmp++; } if (tmp > 0) return tmp; @@ -731,7 +731,7 @@ int check_url(KviWindow *w,const QString &szUrl) // return 0 if no occurence of if (lvi.current()->text(0) == szUrl) { int tmpCount = lvi.current()->text(2).toInt(); tmpCount++; - QString tmpStr; + TQString tmpStr; tmpStr.setNum(tmpCount); lvi.current()->setText(2,tmpStr); lvi.current()->setText(1,w->plainTextCaption()); @@ -745,7 +745,7 @@ int check_url(KviWindow *w,const QString &szUrl) // return 0 if no occurence of bool urllist_module_event_onUrl(KviKvsModuleEventCall * c) { KviKvsVariant * vUrl = c->firstParam(); - QString szUrl; + TQString szUrl; if(vUrl)vUrl->asString(szUrl); if (check_url(c->window(),szUrl) == 0) @@ -753,10 +753,10 @@ bool urllist_module_event_onUrl(KviKvsModuleEventCall * c) KviUrl *tmp = new KviUrl; KviStr tmpTimestamp; - QDate d = QDate::currentDate(); + TQDate d = TQDate::tqcurrentDate(); KviStr date(KviStr::Format,"%d-%d%d-%d%d",d.year(),d.month() / 10,d.month() % 10,d.day() / 10,d.day() % 10); tmpTimestamp = "["+date+"]"+" ["; - tmpTimestamp += QTime::currentTime().toString()+"]"; + tmpTimestamp += TQTime::currentTime().toString()+"]"; tmp->url = szUrl; tmp->window = c->window()->plainTextCaption(); tmp->count = 1; @@ -765,9 +765,9 @@ bool urllist_module_event_onUrl(KviKvsModuleEventCall * c) g_pList->append(tmp); for (UrlDlgList *tmpitem=g_pUrlDlgList->first();tmpitem;tmpitem=g_pUrlDlgList->next()) { if (tmpitem->dlg) { - QString tmpCount; + TQString tmpCount; tmpCount.setNum(tmp->count); - tmpitem->dlg->addUrl(QString(tmp->url), QString(tmp->window), tmpCount, QString(tmp->timestamp)); + tmpitem->dlg->addUrl(TQString(tmp->url), TQString(tmp->window), tmpCount, TQString(tmp->timestamp)); tmpitem->dlg->taskBarItem()->highlight(false); } } @@ -807,7 +807,7 @@ static bool url_module_init(KviModule *m) g_pBanList = new KviPointerList<KviStr>; g_pBanList->setAutoDelete(true); - g_pUrlIconPixmap = new QPixmap(url_icon_xpm); + g_pUrlIconPixmap = new TQPixmap(url_icon_xpm); KVSM_REGISTER_SIMPLE_COMMAND(m,"list",url_kvs_cmd_list); KVSM_REGISTER_SIMPLE_COMMAND(m,"config",url_kvs_cmd_config); |