summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/winpopup/libwinpopup/libwinpopup.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
commit47c8a359c5276062c4bc17f0e82410f29081b502 (patch)
tree2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/protocols/winpopup/libwinpopup/libwinpopup.cpp
parent6f82532777a35e0e60bbd2b290b2e93e646f349b (diff)
downloadtdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz
tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/winpopup/libwinpopup/libwinpopup.cpp')
-rw-r--r--kopete/protocols/winpopup/libwinpopup/libwinpopup.cpp106
1 files changed, 53 insertions, 53 deletions
diff --git a/kopete/protocols/winpopup/libwinpopup/libwinpopup.cpp b/kopete/protocols/winpopup/libwinpopup/libwinpopup.cpp
index d26e461c..9bdbee27 100644
--- a/kopete/protocols/winpopup/libwinpopup/libwinpopup.cpp
+++ b/kopete/protocols/winpopup/libwinpopup/libwinpopup.cpp
@@ -16,9 +16,9 @@
***************************************************************************/
// QT Includes
-#include <qdir.h>
-#include <qfileinfo.h>
-#include <qregexp.h>
+#include <tqdir.h>
+#include <tqfileinfo.h>
+#include <tqregexp.h>
// KDE Includes
#include <kapplication.h>
@@ -33,13 +33,13 @@
// Local Includes
#include "libwinpopup.h"
-WinPopupLib::WinPopupLib(const QString &smbClient,int groupFreq)
+WinPopupLib::WinPopupLib(const TQString &smbClient,int groupFreq)
: smbClientBin(smbClient), groupCheckFreq(groupFreq)
{
- connect(&updateGroupDataTimer, SIGNAL(timeout()), this, SLOT(slotUpdateGroupData()));
+ connect(&updateGroupDataTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotUpdateGroupData()));
updateGroupDataTimer.start(1, true);
- QTimer::singleShot(1, this, SLOT(slotStartDirLister()));
+ TQTimer::singleShot(1, this, TQT_SLOT(slotStartDirLister()));
}
WinPopupLib::~WinPopupLib()
@@ -51,8 +51,8 @@ void WinPopupLib::slotStartDirLister()
if (checkMessageDir()) {
dirLister = new KDirLister();
dirLister->setAutoUpdate(true);
- connect(dirLister, SIGNAL(newItems(const KFileItemList &)), this, SLOT(slotNewMessages(const KFileItemList &)));
- connect(dirLister, SIGNAL(completed()), this, SLOT(slotListCompleted()));
+ connect(dirLister, TQT_SIGNAL(newItems(const KFileItemList &)), this, TQT_SLOT(slotNewMessages(const KFileItemList &)));
+ connect(dirLister, TQT_SIGNAL(completed()), this, TQT_SLOT(slotListCompleted()));
dirLister->openURL(KURL::fromPathOrURL(WP_POPUP_DIR));
}
}
@@ -60,11 +60,11 @@ void WinPopupLib::slotStartDirLister()
/**
* return the group list
*/
-const QStringList WinPopupLib::getGroups()
+const TQStringList WinPopupLib::getGroups()
{
- QStringList ret;
- QMap<QString, WorkGroup>::ConstIterator end = theGroups.end();
- for(QMap<QString, WorkGroup>::ConstIterator i = theGroups.begin(); i != end; i++)
+ TQStringList ret;
+ TQMap<TQString, WorkGroup>::ConstIterator end = theGroups.end();
+ for(TQMap<TQString, WorkGroup>::ConstIterator i = theGroups.begin(); i != end; i++)
ret += i.key();
return ret;
@@ -73,7 +73,7 @@ const QStringList WinPopupLib::getGroups()
/**
* return the host list
*/
-const QStringList WinPopupLib::getHosts(const QString &Group)
+const TQStringList WinPopupLib::getHosts(const TQString &Group)
{
return theGroups[Group].Hosts();
}
@@ -81,13 +81,13 @@ const QStringList WinPopupLib::getHosts(const QString &Group)
/**
* return if a host is in the host list
*/
-bool WinPopupLib::checkHost(const QString &Name)
+bool WinPopupLib::checkHost(const TQString &Name)
{
// kdDebug() << "WP checkHost: " << Name << endl;
bool ret = false;
- QMap<QString, WorkGroup>::Iterator end = theGroups.end();
- for(QMap<QString, WorkGroup>::Iterator i = theGroups.begin(); i != end && !ret; i++) {
+ TQMap<TQString, WorkGroup>::Iterator end = theGroups.end();
+ for(TQMap<TQString, WorkGroup>::Iterator i = theGroups.begin(); i != end && !ret; i++) {
if ((*i).Hosts().contains(Name.upper())) {
ret = true;
break;
@@ -100,7 +100,7 @@ bool WinPopupLib::checkHost(const QString &Name)
bool WinPopupLib::checkMessageDir()
{
- QDir dir(WP_POPUP_DIR);
+ TQDir dir(WP_POPUP_DIR);
if (! dir.exists()) {
int tmpYesNo = KMessageBox::warningYesNo(Kopete::UI::Global::mainWidget(),
i18n("Working directory %1 does not exist.\n"
@@ -108,9 +108,9 @@ bool WinPopupLib::checkMessageDir()
"Install Into Samba (Configure... -> Account -> Edit) information\n"
"on how to do this.\n"
"Should the directory be created? (May need root password)").arg(WP_POPUP_DIR),
- QString::fromLatin1("Winpopup"), i18n("Create Directory"), i18n("Do Not Create"));
+ TQString::fromLatin1("Winpopup"), i18n("Create Directory"), i18n("Do Not Create"));
if (tmpYesNo == KMessageBox::Yes) {
- QStringList kdesuArgs = QStringList(QString("-c mkdir -p -m 0777 " + WP_POPUP_DIR));
+ TQStringList kdesuArgs = TQStringList(TQString("-c mkdir -p -m 0777 " + WP_POPUP_DIR));
if (KApplication::kdeinitExecWait("kdesu", kdesuArgs) == 0) return true;
}
} else {
@@ -127,9 +127,9 @@ bool WinPopupLib::checkMessageDir()
"You will not receive messages if you say no.\n"
"You can also correct it manually (chmod 0777 %1) and restart kopete.\n"
"Fix? (May need root password)").arg(WP_POPUP_DIR),
- QString::fromLatin1("Winpopup"), i18n("Fix"), i18n("Do Not Fix"));
+ TQString::fromLatin1("Winpopup"), i18n("Fix"), i18n("Do Not Fix"));
if (tmpYesNo == KMessageBox::Yes) {
- QStringList kdesuArgs = QStringList(QString("-c chmod 0777 " + WP_POPUP_DIR));
+ TQStringList kdesuArgs = TQStringList(TQString("-c chmod 0777 " + WP_POPUP_DIR));
if (KApplication::kdeinitExecWait("kdesu", kdesuArgs) == 0) return true;
}
} else {
@@ -148,22 +148,22 @@ void WinPopupLib::slotUpdateGroupData()
passedInitialHost = false;
todo.clear();
currentGroupsMap.clear();
- currentHost = QString::fromLatin1("LOCALHOST");
+ currentHost = TQString::fromLatin1("LOCALHOST");
startReadProcess(currentHost);
}
-void WinPopupLib::startReadProcess(const QString &Host)
+void WinPopupLib::startReadProcess(const TQString &Host)
{
currentHosts.clear();
currentGroups.clear();
- currentGroup = QString();
+ currentGroup = TQString();
// for Samba 3
KProcIO *reader = new KProcIO;
*reader << smbClientBin << "-N" << "-E" << "-g" << "-L" << Host << "-";
- connect(reader, SIGNAL(readReady(KProcIO *)), this, SLOT(slotReadProcessReady(KProcIO *)));
- connect(reader, SIGNAL(processExited(KProcess *)), this, SLOT(slotReadProcessExited(KProcess *)));
+ connect(reader, TQT_SIGNAL(readReady(KProcIO *)), this, TQT_SLOT(slotReadProcessReady(KProcIO *)));
+ connect(reader, TQT_SIGNAL(processExited(KProcess *)), this, TQT_SLOT(slotReadProcessExited(KProcess *)));
if (!reader->start(KProcess::NotifyOnExit, true)) {
// still to come
@@ -173,8 +173,8 @@ void WinPopupLib::startReadProcess(const QString &Host)
void WinPopupLib::slotReadProcessReady(KProcIO *r)
{
- QString tmpLine = QString::null;
- QRegExp group("^Workgroup\\|(.*)\\|(.*)$"), host("^Server\\|(.*)\\|(.*)$"),
+ TQString tmpLine = TQString::null;
+ TQRegExp group("^Workgroup\\|(.*)\\|(.*)$"), host("^Server\\|(.*)\\|(.*)$"),
info("^Domain=\\[([^\\]]+)\\] OS=\\[([^\\]]+)\\] Server=\\[([^\\]]+)\\]"),
error("Connection.*failed");
@@ -184,7 +184,7 @@ void WinPopupLib::slotReadProcessReady(KProcIO *r)
if (group.search(tmpLine) != -1) currentGroups[group.cap(1)] = group.cap(2);
if (error.search(tmpLine) != -1) {
kdDebug(14170) << "Connection to " << currentHost << " failed!" << endl;
- if (currentHost == QString::fromLatin1("LOCALHOST")) currentHost = QString::fromLatin1("failed"); // to be sure
+ if (currentHost == TQString::fromLatin1("LOCALHOST")) currentHost = TQString::fromLatin1("failed"); // to be sure
}
}
}
@@ -203,11 +203,11 @@ void WinPopupLib::slotReadProcessExited(KProcess *r)
done += currentHost;
if (!currentGroups.isEmpty()) {
- QMap<QString, WorkGroup> newGroups;
+ TQMap<TQString, WorkGroup> newGroups;
//loop through the read groups and check for new ones
- QMap<QString, QString>::ConstIterator end = currentGroups.end();
- for (QMap<QString, QString>::ConstIterator i = currentGroups.begin(); i != end; i++) {
- QString groupMaster = i.data();
+ TQMap<TQString, TQString>::ConstIterator end = currentGroups.end();
+ for (TQMap<TQString, TQString>::ConstIterator i = currentGroups.begin(); i != end; i++) {
+ TQString groupMaster = i.data();
if (!done.contains(groupMaster)) todo += groupMaster;
}
}
@@ -223,17 +223,17 @@ void WinPopupLib::slotReadProcessExited(KProcess *r)
} else {
passedInitialHost = true;
if (!currentGroups.isEmpty()) {
- QMap<QString, QString>::ConstIterator end = currentGroups.end();
- for (QMap<QString, QString>::ConstIterator i = currentGroups.begin(); i != end; i++) {
- QString groupMaster = i.data();
+ TQMap<TQString, TQString>::ConstIterator end = currentGroups.end();
+ for (TQMap<TQString, TQString>::ConstIterator i = currentGroups.begin(); i != end; i++) {
+ TQString groupMaster = i.data();
todo += groupMaster;
}
} else {
- if (currentHost == QString::fromLatin1("failed"))
+ if (currentHost == TQString::fromLatin1("failed"))
KMessageBox::error(Kopete::UI::Global::mainWidget(),
i18n("Connection to localhost failed!\n"
"Is your samba server running?"),
- QString::fromLatin1("Winpopup"));
+ TQString::fromLatin1("Winpopup"));
}
}
@@ -250,7 +250,7 @@ void WinPopupLib::slotReadProcessExited(KProcess *r)
void WinPopupLib::slotListCompleted()
{
/// only to check received messages during start up, then we use newItems. GF
- disconnect(dirLister, SIGNAL(completed()), this, SLOT(slotListCompleted()));
+ disconnect(dirLister, TQT_SIGNAL(completed()), this, TQT_SLOT(slotListCompleted()));
readMessages(dirLister->items());
}
@@ -264,25 +264,25 @@ void WinPopupLib::slotNewMessages(const KFileItemList &items)
*/
void WinPopupLib::readMessages(const KFileItemList &items)
{
- QPtrListIterator<KFileItem> it(items);
+ TQPtrListIterator<KFileItem> it(items);
KFileItem *tmpItem;
while ((tmpItem = it.current()) != 0) {
if (tmpItem->isFile()) {
- QFile messageFile(tmpItem->url().path());
+ TQFile messageFile(tmpItem->url().path());
if (messageFile.open(IO_ReadOnly)) {
- QTextStream stream(&messageFile);
- QString sender;
- QDateTime time;
- QString text;
+ TQTextStream stream(&messageFile);
+ TQString sender;
+ TQDateTime time;
+ TQString text;
// first line is sender, can this really be empty? GF
sender = stream.readLine();
sender = sender.upper();
// second line is time
- QString tmpTime = stream.readLine();
- time = QDateTime::fromString(tmpTime, Qt::ISODate);
+ TQString tmpTime = stream.readLine();
+ time = TQDateTime::fromString(tmpTime, Qt::ISODate);
while (!stream.atEnd()) {
text.append(stream.readLine());
@@ -296,16 +296,16 @@ void WinPopupLib::readMessages(const KFileItemList &items)
// delete file
if (!messageFile.remove()) {
- // QFile::remove() seems to be very persistent, it removes even files with 0444 owned by root
+ // TQFile::remove() seems to be very persistent, it removes even files with 0444 owned by root
// if the directory permissions are 0777 - so this is just for safety. GF
kdDebug(14170) << "Message file not removed - how that?" << endl;
int tmpYesNo = KMessageBox::warningYesNo(Kopete::UI::Global::mainWidget(),
i18n("A message file could not be removed; "
"maybe the permissions are wrong.\n"
"Fix? (May need root password)"),
- QString::fromLatin1("Winpopup"), i18n("Fix"), i18n("Do Not Fix"));
+ TQString::fromLatin1("Winpopup"), i18n("Fix"), i18n("Do Not Fix"));
if (tmpYesNo == KMessageBox::Yes) {
- QStringList kdesuArgs = QStringList(QString("-c chmod 0666 " + tmpItem->url().path()));
+ TQStringList kdesuArgs = TQStringList(TQString("-c chmod 0666 " + tmpItem->url().path()));
if (KApplication::kdeinitExecWait("kdesu", kdesuArgs) == 0) {
if (!messageFile.remove())
KMessageBox::error(Kopete::UI::Global::mainWidget(), i18n("Still cannot remove it; please fix manually."));
@@ -325,13 +325,13 @@ void WinPopupLib::readMessages(const KFileItemList &items)
/**
* send a message
*/
-void WinPopupLib::sendMessage(const QString &Body, const QString &Destination)
+void WinPopupLib::sendMessage(const TQString &Body, const TQString &Destination)
{
KProcess *sender = new KProcess(this);
*sender << smbClientBin << "-M" << Destination;
*sender << "-N" << "-";
- connect(sender, SIGNAL(processExited(KProcess *)), this, SLOT(slotSendProcessExited(KProcess *)));
+ connect(sender, TQT_SIGNAL(processExited(KProcess *)), this, TQT_SLOT(slotSendProcessExited(KProcess *)));
if (sender->start(KProcess::NotifyOnExit, KProcess::Stdin)) {
sender->writeStdin(Body.local8Bit(), Body.local8Bit().length());
@@ -349,7 +349,7 @@ void WinPopupLib::slotSendProcessExited(KProcess *p)
delete p;
}
-void WinPopupLib::settingsChanged(const QString &smbClient, int groupFreq)
+void WinPopupLib::settingsChanged(const TQString &smbClient, int groupFreq)
{
smbClientBin = smbClient;
groupCheckFreq = groupFreq;