diff options
Diffstat (limited to 'kopete/protocols/winpopup/libwinpopup')
-rw-r--r-- | kopete/protocols/winpopup/libwinpopup/libwinpopup.cpp | 106 | ||||
-rw-r--r-- | kopete/protocols/winpopup/libwinpopup/libwinpopup.h | 46 |
2 files changed, 76 insertions, 76 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; diff --git a/kopete/protocols/winpopup/libwinpopup/libwinpopup.h b/kopete/protocols/winpopup/libwinpopup/libwinpopup.h index 77f8b8a6..0e594932 100644 --- a/kopete/protocols/winpopup/libwinpopup/libwinpopup.h +++ b/kopete/protocols/winpopup/libwinpopup/libwinpopup.h @@ -19,29 +19,29 @@ #define LIBWINPOPUP_H //QT includes -#include <qobject.h> -#include <qmap.h> -#include <qstringlist.h> -#include <qtimer.h> -#include <qdatetime.h> +#include <tqobject.h> +#include <tqmap.h> +#include <tqstringlist.h> +#include <tqtimer.h> +#include <tqdatetime.h> // KDE Includes #include <kprocio.h> #include <kfileitem.h> -const QString WP_POPUP_DIR = QString::fromLatin1("/var/lib/winpopup"); +const TQString WP_POPUP_DIR = TQString::fromLatin1("/var/lib/winpopup"); class KDirLister; -typedef QMap<QString, QString> stringMap; +typedef TQMap<TQString, TQString> stringMap; class WorkGroup { - QStringList groupHosts; + TQStringList groupHosts; public: - const QStringList &Hosts() { return groupHosts; } - void addHosts(const QStringList &newHosts) { groupHosts = newHosts; } + const TQStringList &Hosts() { return groupHosts; } + void addHosts(const TQStringList &newHosts) { groupHosts = newHosts; } }; class WinPopupLib : public QObject @@ -49,23 +49,23 @@ class WinPopupLib : public QObject Q_OBJECT public: - WinPopupLib(const QString &smbClient,int groupFreq); + WinPopupLib(const TQString &smbClient,int groupFreq); ~WinPopupLib(); - const QStringList getGroups(); - const QStringList getHosts(const QString &Group); - bool checkHost(const QString &Name); - void settingsChanged(const QString &smbClient, int groupFreq); - void sendMessage(const QString &Body, const QString &Destination); + const TQStringList getGroups(); + const TQStringList getHosts(const TQString &Group); + bool checkHost(const TQString &Name); + void settingsChanged(const TQString &smbClient, int groupFreq); + void sendMessage(const TQString &Body, const TQString &Destination); private: bool passedInitialHost; - QMap<QString, WorkGroup> theGroups, currentGroupsMap; - QString currentGroup, currentHost; - QStringList todo, done, currentHosts; + TQMap<TQString, WorkGroup> theGroups, currentGroupsMap; + TQString currentGroup, currentHost; + TQStringList todo, done, currentHosts; stringMap currentGroups; - QTimer updateGroupDataTimer; - QString smbClientBin; + TQTimer updateGroupDataTimer; + TQString smbClientBin; int groupCheckFreq; KDirLister *dirLister; @@ -74,7 +74,7 @@ private: private slots: void slotUpdateGroupData(); - void startReadProcess(const QString &Host); + void startReadProcess(const TQString &Host); void slotReadProcessReady(KProcIO *r); void slotReadProcessExited(KProcess *r); void slotSendProcessExited(KProcess *p); @@ -83,7 +83,7 @@ private slots: void slotNewMessages(const KFileItemList &items); signals: - void signalNewMessage(const QString &, const QDateTime &, const QString &); + void signalNewMessage(const TQString &, const TQDateTime &, const TQString &); }; #endif |