summaryrefslogtreecommitdiffstats
path: root/kpilot/lib/kpilotdevicelink.cc
diff options
context:
space:
mode:
Diffstat (limited to 'kpilot/lib/kpilotdevicelink.cc')
-rw-r--r--kpilot/lib/kpilotdevicelink.cc120
1 files changed, 60 insertions, 60 deletions
diff --git a/kpilot/lib/kpilotdevicelink.cc b/kpilot/lib/kpilotdevicelink.cc
index 55027d76..5fed7961 100644
--- a/kpilot/lib/kpilotdevicelink.cc
+++ b/kpilot/lib/kpilotdevicelink.cc
@@ -45,11 +45,11 @@
#include <pi-file.h>
#include <pi-buffer.h>
-#include <qdir.h>
-#include <qtimer.h>
-#include <qdatetime.h>
-#include <qthread.h>
-#include <qsocketnotifier.h>
+#include <tqdir.h>
+#include <tqtimer.h>
+#include <tqdatetime.h>
+#include <tqthread.h>
+#include <tqsocketnotifier.h>
#include <kconfig.h>
#include <kmessagebox.h>
@@ -71,19 +71,19 @@
DeviceMap *DeviceMap::mThis = 0L;
-static inline void startOpenTimer(DeviceCommThread *dev, QTimer *&t)
+static inline void startOpenTimer(DeviceCommThread *dev, TQTimer *&t)
{
if ( !t)
{
- t = new QTimer(dev);
- QObject::connect(t, SIGNAL(timeout()), dev, SLOT(openDevice()));
+ t = new TQTimer(dev);
+ TQObject::connect(t, TQT_SIGNAL(timeout()), dev, TQT_SLOT(openDevice()));
}
// just a single-shot timer. we'll know when to start it again...
t->start(1000, true);
}
DeviceCommThread::DeviceCommThread(KPilotDeviceLink *d) :
- QThread(),
+ TQThread(),
fDone(true),
fHandle(d),
fOpenTimer(0L),
@@ -144,7 +144,7 @@ void DeviceCommThread::reset()
if (link()->fMessages->shouldPrint(Messages::OpenFailMessage))
{
- QApplication::postEvent(link(), new DeviceCommEvent(EventLogMessage,
+ TQApplication::postEvent(link(), new DeviceCommEvent(EventLogMessage,
i18n("Could not open device: %1 (will retry)")
.arg(link()->pilotPath() )));
}
@@ -163,7 +163,7 @@ void DeviceCommThread::reset()
* and then bind to it (in open()). If we're able to do those 2 things, then
* we do 2 things: we set a timeout timer (which will tell us that X amount of
* time has transpired before we get into the meat of the sync transaction), and
- * we also set up a QSocketNotifier, which will tell us when data is available
+ * we also set up a TQSocketNotifier, which will tell us when data is available
* to be read from the Palm socket. If we were unable to create a socket
* and/or bind to the Palm in this method, we'll start our timer again.
*/
@@ -183,7 +183,7 @@ void DeviceCommThread::openDevice()
if (link()->fMessages->shouldPrint(Messages::OpenMessage))
{
- QApplication::postEvent(link(), new DeviceCommEvent(EventLogMessage,
+ TQApplication::postEvent(link(), new DeviceCommEvent(EventLogMessage,
i18n("Trying to open device %1...")
.arg(link()->fPilotPath)));
}
@@ -219,13 +219,13 @@ void DeviceCommThread::openDevice()
}
}
-bool DeviceCommThread::open(const QString &device)
+bool DeviceCommThread::open(const TQString &device)
{
FUNCTIONSETUPL(2);
int ret;
int e = 0;
- QString msg;
+ TQString msg;
if (fTempSocket != -1)
{
@@ -246,7 +246,7 @@ bool DeviceCommThread::open(const QString &device)
link()->fLinkStatus = PilotLinkError;
- QApplication::postEvent(link(), new DeviceCommEvent(EventLogError, msg));
+ TQApplication::postEvent(link(), new DeviceCommEvent(EventLogError, msg));
return false;
}
@@ -265,7 +265,7 @@ bool DeviceCommThread::open(const QString &device)
link()->fLinkStatus = PilotLinkError;
- QApplication::postEvent(link(), new DeviceCommEvent(EventLogError, msg));
+ TQApplication::postEvent(link(), new DeviceCommEvent(EventLogError, msg));
return false;
}
@@ -277,7 +277,7 @@ bool DeviceCommThread::open(const QString &device)
DEBUGKPILOT << fname << ": Binding to path: ["
<< link()->fRealPilotPath << "]" << endl;
- ret = pi_bind(fTempSocket, QFile::encodeName(link()->fRealPilotPath));
+ ret = pi_bind(fTempSocket, TQFile::encodeName(link()->fRealPilotPath));
if (ret < 0)
{
@@ -295,7 +295,7 @@ bool DeviceCommThread::open(const QString &device)
if (link()->fMessages->shouldPrint(Messages::OpenFailMessage))
{
- QApplication::postEvent(link(), new DeviceCommEvent(EventLogError, msg));
+ TQApplication::postEvent(link(), new DeviceCommEvent(EventLogError, msg));
}
return false;
@@ -304,10 +304,10 @@ bool DeviceCommThread::open(const QString &device)
link()->fLinkStatus = DeviceOpen;
DeviceMap::self()->bindDevice(link()->fRealPilotPath);
- fSocketNotifier = new QSocketNotifier(fTempSocket,
- QSocketNotifier::Read, this);
- QObject::connect(fSocketNotifier, SIGNAL(activated(int)),
- this, SLOT(acceptDevice()));
+ fSocketNotifier = new TQSocketNotifier(fTempSocket,
+ TQSocketNotifier::Read, this);
+ TQObject::connect(fSocketNotifier, TQT_SIGNAL(activated(int)),
+ this, TQT_SLOT(acceptDevice()));
fSocketNotifierActive=true;
/**
@@ -322,15 +322,15 @@ bool DeviceCommThread::open(const QString &device)
timeout=5000;
}
- fWorkaroundUSBTimer = new QTimer(this);
- connect(fWorkaroundUSBTimer, SIGNAL(timeout()), this, SLOT(workaroundUSB()));
+ fWorkaroundUSBTimer = new TQTimer(this);
+ connect(fWorkaroundUSBTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(workaroundUSB()));
fWorkaroundUSBTimer->start(timeout, true);
return true;
}
/**
- * We've been notified by our QSocketNotifier that we have data available on the
+ * We've been notified by our TQSocketNotifier that we have data available on the
* socket. Try to go through the remaining steps of the connnection process.
* Note: If we return at all from this before the very end without a successful
* connection, we need to make sure we restart our connection open timer, otherwise
@@ -387,14 +387,14 @@ void DeviceCommThread::acceptDevice()
// Presumably, strerror() returns things in
// local8Bit and not latin1.
- QApplication::postEvent(link(), new DeviceCommEvent(EventLogError,
+ TQApplication::postEvent(link(), new DeviceCommEvent(EventLogError,
i18n("Cannot listen on Pilot socket (%1)").
- arg(QString::fromLocal8Bit(s))));
+ arg(TQString::fromLocal8Bit(s))));
reset();
return;
}
- QApplication::postEvent(link(), new DeviceCommEvent(EventLogProgress, QString::null, 10));
+ TQApplication::postEvent(link(), new DeviceCommEvent(EventLogProgress, TQString::null, 10));
DEBUGKPILOT << fname <<
": Listening to pilot. Now trying accept..." << endl;
@@ -408,8 +408,8 @@ void DeviceCommThread::acceptDevice()
WARNINGKPILOT << "pi_accept returned: [" << s << "]" << endl;
- QApplication::postEvent(link(), new DeviceCommEvent(EventLogError, i18n("Cannot accept Pilot (%1)")
- .arg(QString::fromLocal8Bit(s))));
+ TQApplication::postEvent(link(), new DeviceCommEvent(EventLogError, i18n("Cannot accept Pilot (%1)")
+ .arg(TQString::fromLocal8Bit(s))));
link()->fLinkStatus = PilotLinkError;
reset();
@@ -423,21 +423,21 @@ void DeviceCommThread::acceptDevice()
link()->fLinkStatus = PilotLinkError;
WARNINGKPILOT << "Already connected or unable to connect!" << endl;
- QApplication::postEvent(link(), new DeviceCommEvent(EventLogError, i18n("Cannot accept Pilot (%1)")
+ TQApplication::postEvent(link(), new DeviceCommEvent(EventLogError, i18n("Cannot accept Pilot (%1)")
.arg(i18n("already connected"))));
reset();
return;
}
- QApplication::postEvent(link(), new DeviceCommEvent(EventLogProgress, QString::null, 30));
+ TQApplication::postEvent(link(), new DeviceCommEvent(EventLogProgress, TQString::null, 30));
DEBUGKPILOT << fname << ": doing dlp_ReadSysInfo..." << endl;
struct SysInfo sys_info;
if (dlp_ReadSysInfo(fPilotSocket, &sys_info) < 0)
{
- QApplication::postEvent(link(), new DeviceCommEvent(EventLogError,
+ TQApplication::postEvent(link(), new DeviceCommEvent(EventLogError,
i18n("Unable to read system information from Pilot")));
link()->fLinkStatus=PilotLinkError;
@@ -461,7 +461,7 @@ void DeviceCommThread::acceptDevice()
fWorkaroundUSBTimer->stop();
KPILOT_DELETE(fWorkaroundUSBTimer);
- QApplication::postEvent(link(), new DeviceCommEvent(EventLogProgress, QString::null, 60));
+ TQApplication::postEvent(link(), new DeviceCommEvent(EventLogProgress, TQString::null, 60));
KPILOT_DELETE(link()->fPilotUser);
link()->fPilotUser = new KPilotUser;
@@ -471,11 +471,11 @@ void DeviceCommThread::acceptDevice()
/* Ask the pilot who it is. And see if it's who we think it is. */
dlp_ReadUserInfo(fPilotSocket, link()->fPilotUser->data());
- QString n = link()->getPilotUser().name();
+ TQString n = link()->getPilotUser().name();
DEBUGKPILOT << fname
<< ": Read user name: [" << n << "]" << endl;
- QApplication::postEvent(link(), new DeviceCommEvent(EventLogProgress, i18n("Checking last PC..."), 90));
+ TQApplication::postEvent(link(), new DeviceCommEvent(EventLogProgress, i18n("Checking last PC..."), 90));
/* Tell user (via Pilot) that we are starting things up */
if ((ret=dlp_OpenConduit(fPilotSocket)) < 0)
@@ -483,18 +483,18 @@ void DeviceCommThread::acceptDevice()
DEBUGKPILOT << fname
<< ": dlp_OpenConduit returned: [" << ret << "]" << endl;
- QApplication::postEvent(link(), new DeviceCommEvent(EventLogError,
+ TQApplication::postEvent(link(), new DeviceCommEvent(EventLogError,
i18n("Could not read user information from the Pilot. "
"Perhaps you have a password set on the device?")));
}
link()->fLinkStatus = AcceptedDevice;
- QApplication::postEvent(link(), new DeviceCommEvent(EventLogProgress, QString::null, 100));
+ TQApplication::postEvent(link(), new DeviceCommEvent(EventLogProgress, TQString::null, 100));
DeviceCommEvent * ev = new DeviceCommEvent(EventDeviceReady);
ev->setCurrentSocket(fPilotSocket);
- QApplication::postEvent(link(), ev);
+ TQApplication::postEvent(link(), ev);
}
@@ -516,19 +516,19 @@ void DeviceCommThread::run()
// keep the thread alive until we're supposed to be done
while (!fDone)
{
- QThread::sleep(sleepBetweenPoll);
+ TQThread::sleep(sleepBetweenPoll);
}
close();
// now sleep one last bit to make sure the pthread inside
// pilot-link (potentially, if it's libusb) is done before we exit
- QThread::sleep(1);
+ TQThread::sleep(1);
DEBUGKPILOT << fname << ": comm thread now done..." << endl;
}
-KPilotDeviceLink::KPilotDeviceLink(QObject * parent, const char *name,
- const QString &tempDevice) :
+KPilotDeviceLink::KPilotDeviceLink(TQObject * parent, const char *name,
+ const TQString &tempDevice) :
KPilotLink(parent, name), fLinkStatus(Init), fWorkaroundUSB(false),
fPilotSocket(-1), fTempDevice(tempDevice), fMessages(new Messages(this)), fDeviceCommThread(0L)
{
@@ -553,7 +553,7 @@ KPilotDeviceLink::~KPilotDeviceLink()
return fLinkStatus == AcceptedDevice;
}
-/* virtual */bool KPilotDeviceLink::event(QEvent *e)
+/* virtual */bool KPilotDeviceLink::event(TQEvent *e)
{
FUNCTIONSETUP;
@@ -636,7 +636,7 @@ void KPilotDeviceLink::close()
fPilotSocket = (-1);
}
-void KPilotDeviceLink::reset(const QString & dP)
+void KPilotDeviceLink::reset(const TQString & dP)
{
FUNCTIONSETUP;
@@ -645,7 +645,7 @@ void KPilotDeviceLink::reset(const QString & dP)
// Release all resources
//
close();
- fPilotPath = QString::null;
+ fPilotPath = TQString::null;
fPilotPath = dP;
if (fPilotPath.isEmpty())
@@ -667,7 +667,7 @@ void KPilotDeviceLink::startCommThread()
WARNINGKPILOT << "No point in trying empty device."
<< endl;
- QString msg = i18n("The Pilot device is not configured yet.");
+ TQString msg = i18n("The Pilot device is not configured yet.");
WARNINGKPILOT << msg << endl;
fLinkStatus = PilotLinkError;
@@ -699,7 +699,7 @@ void KPilotDeviceLink::checkDevice()
// If the device exists yet doesn't have the right
// permissions, complain and then continue anyway.
//
- QFileInfo fi(fPilotPath);
+ TQFileInfo fi(fPilotPath);
if (fi.exists())
{
// If it exists, it ought to be RW already.
@@ -725,7 +725,7 @@ void KPilotDeviceLink::checkDevice()
}
}
-void KPilotDeviceLink::setTempDevice(const QString &d)
+void KPilotDeviceLink::setTempDevice(const TQString &d)
{
fTempDevice = d;
DeviceMap::self()->bindDevice(fTempDevice);
@@ -738,24 +738,24 @@ void KPilotDeviceLink::setTempDevice(const QString &d)
return pi_tickle(pilotSocket()) >= 0;
}
-/* virtual */void KPilotDeviceLink::addSyncLogEntryImpl(const QString &entry)
+/* virtual */void KPilotDeviceLink::addSyncLogEntryImpl(const TQString &entry)
{
dlp_AddSyncLogEntry(fPilotSocket,
const_cast<char *>((const char *)Pilot::toPilot(entry)));
}
-bool KPilotDeviceLink::installFile(const QString & f, const bool deleteFile)
+bool KPilotDeviceLink::installFile(const TQString & f, const bool deleteFile)
{
FUNCTIONSETUP;
DEBUGKPILOT << fname << ": Installing file " << f << endl;
- if (!QFile::exists(f))
+ if (!TQFile::exists(f))
return false;
char buffer[PATH_MAX];
memset(buffer, 0, PATH_MAX);
- strlcpy(buffer, QFile::encodeName(f), PATH_MAX);
+ strlcpy(buffer, TQFile::encodeName(f), PATH_MAX);
struct pi_file *pf = pi_file_open(buffer);
if (!f)
@@ -778,7 +778,7 @@ bool KPilotDeviceLink::installFile(const QString & f, const bool deleteFile)
pi_file_close(pf);
if (deleteFile)
- QFile::remove(f);
+ TQFile::remove(f);
return true;
}
@@ -788,9 +788,9 @@ int KPilotDeviceLink::openConduit()
return dlp_OpenConduit(fPilotSocket);
}
-QString KPilotDeviceLink::statusString(LinkStatus l)
+TQString KPilotDeviceLink::statusString(LinkStatus l)
{
- QString s= CSL1("KPilotDeviceLink=");
+ TQString s= CSL1("KPilotDeviceLink=");
switch (l)
{
@@ -826,7 +826,7 @@ QString KPilotDeviceLink::statusString(LinkStatus l)
return s;
}
-QString KPilotDeviceLink::statusString() const
+TQString KPilotDeviceLink::statusString() const
{
return statusString(status() );
}
@@ -872,7 +872,7 @@ int KPilotDeviceLink::findDatabase(const char *name, struct DBInfo *dbinfo,
type, creator, dbinfo);
}
-bool KPilotDeviceLink::retrieveDatabase(const QString &fullBackupName,
+bool KPilotDeviceLink::retrieveDatabase(const TQString &fullBackupName,
DBInfo *info)
{
FUNCTIONSETUP;
@@ -886,7 +886,7 @@ bool KPilotDeviceLink::retrieveDatabase(const QString &fullBackupName,
DEBUGKPILOT << fname << ": Writing DB <" << info->name << "> "
<< " to " << fullBackupName << endl;
- QCString encodedName = QFile::encodeName(fullBackupName);
+ TQCString encodedName = TQFile::encodeName(fullBackupName);
struct pi_file *f = pi_file_create(encodedName, info);
if (!f)
@@ -954,7 +954,7 @@ const KPilotCard *KPilotDeviceLink::getCardInfo(int card)
return cardinfo;
}
-PilotDatabase *KPilotDeviceLink::database(const QString &name)
+PilotDatabase *KPilotDeviceLink::database(const TQString &name)
{
return new PilotSerialDatabase( this, name );
}