summaryrefslogtreecommitdiffstats
path: root/src/modules/avatar/libkviavatar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/avatar/libkviavatar.cpp')
-rw-r--r--src/modules/avatar/libkviavatar.cpp120
1 files changed, 60 insertions, 60 deletions
diff --git a/src/modules/avatar/libkviavatar.cpp b/src/modules/avatar/libkviavatar.cpp
index e97b1f67..a7098eb4 100644
--- a/src/modules/avatar/libkviavatar.cpp
+++ b/src/modules/avatar/libkviavatar.cpp
@@ -46,19 +46,19 @@
#include "kvi_ircmask.h"
#include "kvi_qcstring.h"
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qmessagebox.h>
-#include <qtimer.h>
-#include <qlabel.h>
+#include <tqlineedit.h>
+#include <tqpushbutton.h>
+#include <tqmessagebox.h>
+#include <tqtimer.h>
+#include <tqlabel.h>
#include "kvi_tal_hbox.h"
-#include <qlayout.h>
+#include <tqlayout.h>
static KviPointerList<KviAsyncAvatarSelectionDialog> * g_pAvatarSelectionDialogList = 0;
extern KVIRC_API KviSharedFilesManager * g_pSharedFilesManager;
-KviAsyncAvatarSelectionDialog::KviAsyncAvatarSelectionDialog(QWidget * par,const QString &szInitialPath,KviIrcConnection * c)
-: QDialog(par,0,false,Qt::WType_Dialog | Qt::WStyle_DialogBorder | Qt::WStyle_StaysOnTop)
+KviAsyncAvatarSelectionDialog::KviAsyncAvatarSelectionDialog(TQWidget * par,const TQString &szInitialPath,KviIrcConnection * c)
+: TQDialog(par,0,false,TQt::WType_Dialog | TQt::WStyle_DialogBorder | TQt::WStyle_StaysOnTop)
{
g_pAvatarSelectionDialogList->append(this);
@@ -66,9 +66,9 @@ KviAsyncAvatarSelectionDialog::KviAsyncAvatarSelectionDialog(QWidget * par,const
setCaption(__tr2qs("Choose Avatar - KVIrc"));
- QGridLayout * g = new QGridLayout(this,3,3,4,8);
+ TQGridLayout * g = new TQGridLayout(this,3,3,4,8);
- QString msg = "<center>";
+ TQString msg = "<center>";
msg += __tr2qs("Please select an avatar image. " \
"The full path to a local file or an image on the Web can be used.<br>" \
"If you wish to use a local image file, click the \"<b>Browse</b>\"" \
@@ -76,29 +76,29 @@ KviAsyncAvatarSelectionDialog::KviAsyncAvatarSelectionDialog(QWidget * par,const
"The full URL for an image (including <b>http://</b>) can be entered manually.");
msg += "</center><br>";
- QLabel * l = new QLabel(msg,this);
+ TQLabel * l = new TQLabel(msg,this);
l->setMinimumWidth(250);
g->addMultiCellWidget(l,0,0,0,2);
- m_pLineEdit = new QLineEdit(this);
+ m_pLineEdit = new TQLineEdit(this);
m_pLineEdit->setText(szInitialPath);
m_pLineEdit->setMinimumWidth(180);
g->addMultiCellWidget(m_pLineEdit,1,1,0,1);
- QPushButton * b = new QPushButton(__tr2qs("&Browse..."),this);
- connect(b,SIGNAL(clicked()),this,SLOT(chooseFileClicked()));
+ TQPushButton * b = new TQPushButton(__tr2qs("&Browse..."),this);
+ connect(b,TQT_SIGNAL(clicked()),this,TQT_SLOT(chooseFileClicked()));
g->addWidget(b,1,2);
KviTalHBox * h = new KviTalHBox(this);h->setSpacing(8);g->addMultiCellWidget(h,2,2,1,2);
- b = new QPushButton(__tr2qs("&OK"),h);
+ b = new TQPushButton(__tr2qs("&OK"),h);
b->setMinimumWidth(80);
b->setDefault(true);
- connect(b,SIGNAL(clicked()),this,SLOT(okClicked()));
+ connect(b,TQT_SIGNAL(clicked()),this,TQT_SLOT(okClicked()));
- b = new QPushButton(__tr2qs("Cancel"),h);
+ b = new TQPushButton(__tr2qs("Cancel"),h);
b->setMinimumWidth(80);
- connect(b,SIGNAL(clicked()),this,SLOT(cancelClicked()));
+ connect(b,TQT_SIGNAL(clicked()),this,TQT_SLOT(cancelClicked()));
g->setRowStretch(0,1);
g->setColStretch(0,1);
@@ -117,9 +117,9 @@ void KviAsyncAvatarSelectionDialog::okClicked()
if(!m_szAvatarName.isEmpty())
{
- QString tmp = m_szAvatarName;
- tmp.replace("\\","\\\\");
- QString szBuffer=QString("avatar.set \"%1\"").arg(tmp);
+ TQString tmp = m_szAvatarName;
+ tmp.tqreplace("\\","\\\\");
+ TQString szBuffer=TQString("avatar.set \"%1\"").tqarg(tmp);
KviKvsScript::run(szBuffer,m_pConnection->console());
}
@@ -135,14 +135,14 @@ void KviAsyncAvatarSelectionDialog::cancelClicked()
void KviAsyncAvatarSelectionDialog::chooseFileClicked()
{
- QString tmp;
+ TQString tmp;
if(KviFileDialog::askForOpenFileName(tmp,__tr2qs("Choose an Image File - KVIrc")))
{
m_pLineEdit->setText(tmp);
}
}
-void KviAsyncAvatarSelectionDialog::closeEvent(QCloseEvent * e)
+void KviAsyncAvatarSelectionDialog::closeEvent(TQCloseEvent * e)
{
e->ignore();
reject();
@@ -181,32 +181,32 @@ void KviAsyncAvatarSelectionDialog::closeEvent(QCloseEvent * e)
static bool avatar_kvs_cmd_set(KviKvsModuleCommandCall * c)
{
- QString szAvatar;
+ TQString szAvatar;
KVSM_PARAMETERS_BEGIN(c)
KVSM_PARAMETER("avatar",KVS_PT_NONEMPTYSTRING,KVS_PF_OPTIONAL,szAvatar)
KVSM_PARAMETERS_END(c)
- KVSM_REQUIRE_CONNECTION(c)
+ KVSM_RETQUIRE_CONNECTION(c)
- QString absPath;
+ TQString absPath;
if(szAvatar.isEmpty())
{
- KviAsyncAvatarSelectionDialog * d = new KviAsyncAvatarSelectionDialog(g_pFrame,QString::null,c->window()->connection());
+ KviAsyncAvatarSelectionDialog * d = new KviAsyncAvatarSelectionDialog(g_pFrame,TQString(),c->window()->connection());
d->show();
return true;
}
// new avatar specified...try to load it
- KviIrcUserEntry * e = c->window()->connection()->userDataBase()->find(c->window()->connection()->currentNickName());
+ KviIrcUserEntry * e = c->window()->connection()->userDataBase()->tqfind(c->window()->connection()->currentNickName());
if(!e)
{
c->warning(__tr2qs("Internal error: I'm not in the user database ?"));
return true;
}
- KviAvatar * av = g_pIconManager->getAvatar(QString::null,szAvatar);
+ KviAvatar * av = g_pIconManager->getAvatar(TQString(),szAvatar);
if(av)
{
// Ok...got it...
@@ -215,21 +215,21 @@ static bool avatar_kvs_cmd_set(KviKvsModuleCommandCall * c)
c->window()->connection()->userInfo()->nickName(),
c->window()->connection()->userInfo()->userName(),
c->window()->connection()->userInfo()->hostName(),
- QString::null);
+ TQString());
} else {
- bool bIsUrl = KviQString::equalCIN(szAvatar,"http://",7) && (szAvatar.length() > 7);
+ bool bIsUrl = KviTQString::equalCIN(szAvatar,"http://",7) && (szAvatar.length() > 7);
if(bIsUrl)
{
// This is an url, and we don't have a cached copy for now
- QString szLocalFilePath;
- QString szLocalFile = szAvatar;
+ TQString szLocalFilePath;
+ TQString szLocalFile = szAvatar;
g_pIconManager->urlToCachedFileName(szLocalFile);
g_pApp->getLocalKvircDirectory(szLocalFilePath,KviApp::Avatars,szLocalFile);
- szLocalFilePath.replace("\\","\\\\");
+ szLocalFilePath.tqreplace("\\","\\\\");
- QString szCommand = "http.get -w=nm ";
+ TQString szCommand = "http.get -w=nm ";
szCommand += szAvatar;
szCommand += " ";
szCommand += szLocalFilePath;
@@ -275,9 +275,9 @@ static bool avatar_kvs_cmd_set(KviKvsModuleCommandCall * c)
static bool avatar_kvs_cmd_unset(KviKvsModuleCommandCall * c)
{
- KVSM_REQUIRE_CONNECTION(c)
+ KVSM_RETQUIRE_CONNECTION(c)
- KviIrcUserEntry * e = c->window()->connection()->userDataBase()->find(c->window()->connection()->currentNickName());
+ KviIrcUserEntry * e = c->window()->connection()->userDataBase()->tqfind(c->window()->connection()->currentNickName());
if(!e)
{
c->warning(__tr2qs("Internal error: I'm not in the user database ?"));
@@ -289,7 +289,7 @@ static bool avatar_kvs_cmd_unset(KviKvsModuleCommandCall * c)
c->window()->connection()->userInfo()->nickName(),
c->window()->connection()->userInfo()->userName(),
c->window()->connection()->userInfo()->hostName(),
- QString::null);
+ TQString());
return true;
}
@@ -335,31 +335,31 @@ static bool avatar_kvs_cmd_unset(KviKvsModuleCommandCall * c)
static bool avatar_kvs_cmd_notify(KviKvsModuleCommandCall * c)
{
- QString szTarget;
+ TQString szTarget;
KVSM_PARAMETERS_BEGIN(c)
KVSM_PARAMETER("target",KVS_PT_NONEMPTYSTRING,0,szTarget)
KVSM_PARAMETERS_END(c)
- KVSM_REQUIRE_CONNECTION(c)
+ KVSM_RETQUIRE_CONNECTION(c)
kvs_int_t iTimeout = (kvs_int_t)KVI_OPTION_UINT(KviOption_uintAvatarOfferTimeoutInSecs);
- if(KviKvsVariant * pTimeout = c->switches()->find('t',"timeout"))
+ if(KviKvsVariant * pTimeout = c->switches()->tqfind('t',"timeout"))
{
if(!pTimeout->asInteger(iTimeout))
{
- if(!c->switches()->find('q',"quiet"))
+ if(!c->switches()->tqfind('q',"quiet"))
c->warning(__tr2qs("Invalid timeout specified, using default"));
}
}
- KviIrcUserEntry * e = c->window()->connection()->userDataBase()->find(c->window()->connection()->currentNickName());
+ KviIrcUserEntry * e = c->window()->connection()->userDataBase()->tqfind(c->window()->connection()->currentNickName());
if(!e)
{
c->warning(__tr2qs("Internal error: I'm not in the user database ?"));
return true;
}
- QString absPath,avatar;
+ TQString absPath,avatar;
if(e->avatar())
{
@@ -370,7 +370,7 @@ static bool avatar_kvs_cmd_notify(KviKvsModuleCommandCall * c)
KviSharedFile * o = 0;
if((!absPath.isEmpty()) && (!avatar.isEmpty()))
{
- bool bTargetIsChan = (szTarget.contains('#') || szTarget.contains('&') || szTarget.contains('!'));
+ bool bTargetIsChan = (szTarget.tqcontains('#') || szTarget.tqcontains('&') || szTarget.tqcontains('!'));
if(bTargetIsChan)o = g_pSharedFilesManager->lookupSharedFile(avatar,0);
else {
KviIrcMask u(szTarget);
@@ -379,34 +379,34 @@ static bool avatar_kvs_cmd_notify(KviKvsModuleCommandCall * c)
if(!o)
{
// FIXME: #warning "OPTION FOR PERMANENT OR TIMEDOUT OFFER...TIMEDOUT WOULD ALSO NEED TO EXTEND EXISTING OFFERS LIFETIME"
- QString szUserMask = bTargetIsChan ? QString("*") : szTarget;
+ TQString szUserMask = bTargetIsChan ? TQString("*") : szTarget;
szUserMask += "!*@*";
o = g_pSharedFilesManager->addSharedFile(avatar,absPath,szUserMask,iTimeout);
if(!o)
{
// Don't delete o...it has been already deleted by g_pFileTrader
- if(!c->switches()->find('q',"quiet"))
+ if(!c->switches()->tqfind('q',"quiet"))
c->warning(__tr2qs("Can't add a file offer for file %Q (huh ? file not readable ?)"),&absPath);
return true;
}
if(_OUTPUT_VERBOSE)
{
- if(!c->switches()->find('q',"quiet"))
+ if(!c->switches()->tqfind('q',"quiet"))
c->window()->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Added %d secs file offer for file %Q (%Q) and receiver %Q"),
iTimeout,&(o->absFilePath()),&avatar,&(o->userMask()));
}
}
}
- if(!c->switches()->find('q',"quiet"))
+ if(!c->switches()->tqfind('q',"quiet"))
c->window()->output(KVI_OUT_AVATAR,__tr2qs("Notifying avatar '%Q' to %Q"),&avatar,&szTarget);
- KviQCString encodedTarget = c->window()->connection()->encodeText(szTarget);
+ KviTQCString encodedTarget = c->window()->connection()->encodeText(szTarget);
if(!avatar.isEmpty())
{
- KviQCString encodedAvatar = c->window()->connection()->encodeText(avatar);
+ KviTQCString encodedAvatar = c->window()->connection()->encodeText(avatar);
if(o)
{
@@ -445,16 +445,16 @@ static bool avatar_kvs_cmd_notify(KviKvsModuleCommandCall * c)
static bool avatar_kvs_fnc_name(KviKvsModuleFunctionCall * c)
{
- QString szNick;
+ TQString szNick;
KVSM_PARAMETERS_BEGIN(c)
KVSM_PARAMETER("nick",KVS_PT_STRING,KVS_PF_OPTIONAL,szNick)
KVSM_PARAMETERS_END(c)
- KVSM_REQUIRE_CONNECTION(c)
+ KVSM_RETQUIRE_CONNECTION(c)
if(szNick.isEmpty())szNick = c->window()->connection()->currentNickName();
- KviIrcUserEntry * e = c->window()->connection()->userDataBase()->find(szNick);
+ KviIrcUserEntry * e = c->window()->connection()->userDataBase()->tqfind(szNick);
if(e)
{
if(e->avatar())
@@ -489,16 +489,16 @@ static bool avatar_kvs_fnc_name(KviKvsModuleFunctionCall * c)
static bool avatar_kvs_fnc_path(KviKvsModuleFunctionCall * c)
{
- QString szNick;
+ TQString szNick;
KVSM_PARAMETERS_BEGIN(c)
KVSM_PARAMETER("path",KVS_PT_STRING,KVS_PF_OPTIONAL,szNick)
KVSM_PARAMETERS_END(c)
- KVSM_REQUIRE_CONNECTION(c)
+ KVSM_RETQUIRE_CONNECTION(c)
if(szNick.isEmpty())szNick = c->window()->connection()->currentNickName();
- KviIrcUserEntry * e = c->window()->connection()->userDataBase()->find(szNick);
+ KviIrcUserEntry * e = c->window()->connection()->userDataBase()->tqfind(szNick);
if(e)
{
if(e->avatar())
@@ -531,14 +531,14 @@ static bool avatar_kvs_fnc_path(KviKvsModuleFunctionCall * c)
static bool avatar_kvs_cmd_query(KviKvsModuleCommandCall * c)
{
- QString szName;
+ TQString szName;
KVSM_PARAMETERS_BEGIN(c)
KVSM_PARAMETER("target",KVS_PT_NONEMPTYSTRING,0,szName)
KVSM_PARAMETERS_END(c)
- KVSM_REQUIRE_CONNECTION(c)
+ KVSM_RETQUIRE_CONNECTION(c)
- KviQCString target = c->window()->connection()->encodeText(szName);
+ KviTQCString target = c->window()->connection()->encodeText(szName);
c->window()->connection()->sendFmtData("PRIVMSG %s :%cAVATAR%c",target.data(),0x01,0x01);
return true;