summaryrefslogtreecommitdiffstats
path: root/kmobile/kmobiledevice.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
commit7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch)
tree8474f9b444b2756228600050f07a7ff25de532b2 /kmobile/kmobiledevice.cpp
parentf587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff)
downloadtdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz
tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmobile/kmobiledevice.cpp')
-rw-r--r--kmobile/kmobiledevice.cpp124
1 files changed, 62 insertions, 62 deletions
diff --git a/kmobile/kmobiledevice.cpp b/kmobile/kmobiledevice.cpp
index dc3039f2b..cfcbf6e88 100644
--- a/kmobile/kmobiledevice.cpp
+++ b/kmobile/kmobiledevice.cpp
@@ -26,9 +26,9 @@
#include <signal.h>
#include <fcntl.h>
-#include <qstring.h>
-#include <qstringlist.h>
-#include <qfile.h>
+#include <tqstring.h>
+#include <tqstringlist.h>
+#include <tqfile.h>
#include <klibloader.h>
#include <kstandarddirs.h>
@@ -47,7 +47,7 @@
* The base plugin class of all mobile device drivers.
*/
-KMobileDevice::KMobileDevice(QObject *obj, const char *name, const QStringList &args)
+KMobileDevice::KMobileDevice(TQObject *obj, const char *name, const TQStringList &args)
: KLibFactory(obj,name),
m_config(0L), d(0L)
{
@@ -63,7 +63,7 @@ KMobileDevice::KMobileDevice(QObject *obj, const char *name, const QStringList &
m_config = new KConfig();
else
m_config = new KConfig(m_configFileName);
- PRINT_DEBUG << QString("name of config file is %1\n").arg(m_configFileName);
+ PRINT_DEBUG << TQString("name of config file is %1\n").arg(m_configFileName);
}
KMobileDevice::~KMobileDevice()
@@ -78,18 +78,18 @@ bool KMobileDevice::connected()
}
// returns e.g. "Nokia mobile phone", "MP3 Player", "Handspring Organizer"
-QString KMobileDevice::deviceClassName() const
+TQString KMobileDevice::deviceClassName() const
{
return m_deviceClassName;
}
// returns real device name, e.g. "Nokia 6310" or "Rio MP3 Player"
-QString KMobileDevice::deviceName() const
+TQString KMobileDevice::deviceName() const
{
return m_deviceName;
}
-QString KMobileDevice::revision() const
+TQString KMobileDevice::revision() const
{
return m_deviceRevision;
}
@@ -104,7 +104,7 @@ bool KMobileDevice::isReadOnly() const
return false;
}
-bool KMobileDevice::configDialog( QWidget *parent )
+bool KMobileDevice::configDialog( TQWidget *parent )
{
KMessageBox::information( parent,
i18n("This device does not need any configuration."),
@@ -123,14 +123,14 @@ enum KMobileDevice::ClassType KMobileDevice::classType() const
return m_classType;
}
-QString KMobileDevice::iconFileName() const
+TQString KMobileDevice::iconFileName() const
{
return defaultIconFileName( classType() );
}
-QString KMobileDevice::defaultIconFileName( ClassType ct )
+TQString KMobileDevice::defaultIconFileName( ClassType ct )
{
- QString name;
+ TQString name;
switch (ct) {
case Phone: name = "mobile_phone"; break;
case Organizer: name = "mobile_organizer"; break;
@@ -142,9 +142,9 @@ QString KMobileDevice::defaultIconFileName( ClassType ct )
return name;
}
-QString KMobileDevice::defaultClassName( ClassType ct )
+TQString KMobileDevice::defaultClassName( ClassType ct )
{
- QString name;
+ TQString name;
switch (ct) {
case Phone: name = i18n("Cellular Mobile Phone"); break;
case Organizer: name = i18n("Organizer"); break;
@@ -166,7 +166,7 @@ int KMobileDevice::capabilities() const
return m_caps;
}
-const QString KMobileDevice::nameForCap(int cap) const
+const TQString KMobileDevice::nameForCap(int cap) const
{
switch (cap) {
case hasAddressBook: return i18n("Contacts");
@@ -178,7 +178,7 @@ const QString KMobileDevice::nameForCap(int cap) const
}
// returns an error string for the given error code
-QString KMobileDevice::buildErrorString(KIO::Error err, const QString &errorText) const
+TQString KMobileDevice::buildErrorString(KIO::Error err, const TQString &errorText) const
{
return KIO::buildErrorString( err, errorText);
}
@@ -227,12 +227,12 @@ int KMobileDevice::numNotes()
return 0;
}
-int KMobileDevice::readNote( int, QString & )
+int KMobileDevice::readNote( int, TQString & )
{
return KIO::ERR_UNSUPPORTED_ACTION;
}
-int KMobileDevice::storeNote( int, const QString & )
+int KMobileDevice::storeNote( int, const TQString & )
{
return KIO::ERR_UNSUPPORTED_ACTION;
}
@@ -243,7 +243,7 @@ int KMobileDevice::storeNote( int, const QString & )
*/
static
-void addAtom(KIO::UDSEntry& entry, unsigned int ID, long l, const QString& s = QString::null)
+void addAtom(KIO::UDSEntry& entry, unsigned int ID, long l, const TQString& s = TQString::null)
{
KIO::UDSAtom atom;
atom.m_uds = ID;
@@ -252,7 +252,7 @@ void addAtom(KIO::UDSEntry& entry, unsigned int ID, long l, const QString& s = Q
entry.append(atom);
}
-void KMobileDevice::createDirEntry(KIO::UDSEntry& entry, const QString& name, const QString& url, const QString& mime) const
+void KMobileDevice::createDirEntry(KIO::UDSEntry& entry, const TQString& name, const TQString& url, const TQString& mime) const
{
entry.clear();
addAtom(entry, KIO::UDS_NAME, 0, name);
@@ -260,12 +260,12 @@ void KMobileDevice::createDirEntry(KIO::UDSEntry& entry, const QString& name, co
addAtom(entry, KIO::UDS_ACCESS, 0500);
addAtom(entry, KIO::UDS_MIME_TYPE, 0, mime);
addAtom(entry, KIO::UDS_URL, 0, url);
- PRINT_DEBUG << QString("createDirEntry: File: %1 MIME: %2 URL: %3\n").arg(name).arg(mime).arg(url);
+ PRINT_DEBUG << TQString("createDirEntry: File: %1 MIME: %2 URL: %3\n").arg(name).arg(mime).arg(url);
// addAtom(entry, KIO::UDS_SIZE, 0);
addAtom(entry, KIO::UDS_GUESSED_MIME_TYPE, 0, mime);
}
-void KMobileDevice::createFileEntry(KIO::UDSEntry& entry, const QString& name, const QString& url, const QString& mime,
+void KMobileDevice::createFileEntry(KIO::UDSEntry& entry, const TQString& name, const TQString& url, const TQString& mime,
const unsigned long size) const
{
entry.clear();
@@ -276,63 +276,63 @@ void KMobileDevice::createFileEntry(KIO::UDSEntry& entry, const QString& name, c
addAtom(entry, KIO::UDS_MIME_TYPE, 0, mime);
if (size) addAtom(entry, KIO::UDS_SIZE, size);
addAtom(entry, KIO::UDS_GUESSED_MIME_TYPE, 0, mime);
- PRINT_DEBUG << QString("createFileEntry: File: %1, Size: %2, MIME: %3\n").arg(name).arg(size).arg(mime);
+ PRINT_DEBUG << TQString("createFileEntry: File: %1, Size: %2, MIME: %3\n").arg(name).arg(size).arg(mime);
}
-void KMobileDevice::listDir( const QString & )
+void KMobileDevice::listDir( const TQString & )
{
- emit error(KIO::ERR_CANNOT_ENTER_DIRECTORY,QString::null);
+ emit error(KIO::ERR_CANNOT_ENTER_DIRECTORY,TQString::null);
}
-void KMobileDevice::mkdir( const QString &, int )
+void KMobileDevice::mkdir( const TQString &, int )
{
- emit error(KIO::ERR_COULD_NOT_MKDIR, QString::null);
+ emit error(KIO::ERR_COULD_NOT_MKDIR, TQString::null);
}
-void KMobileDevice::rename( const QString &, const QString &, bool )
+void KMobileDevice::rename( const TQString &, const TQString &, bool )
{
- emit error(KIO::ERR_UNSUPPORTED_ACTION, QString::null);
+ emit error(KIO::ERR_UNSUPPORTED_ACTION, TQString::null);
}
-void KMobileDevice::symlink( const QString &, const QString &, bool )
+void KMobileDevice::symlink( const TQString &, const TQString &, bool )
{
- emit error(KIO::ERR_UNSUPPORTED_ACTION, QString::null);
+ emit error(KIO::ERR_UNSUPPORTED_ACTION, TQString::null);
}
-void KMobileDevice::del( const QString &, bool )
+void KMobileDevice::del( const TQString &, bool )
{
- emit error(KIO::ERR_UNSUPPORTED_ACTION, QString::null);
+ emit error(KIO::ERR_UNSUPPORTED_ACTION, TQString::null);
}
-void KMobileDevice::stat( const QString & )
+void KMobileDevice::stat( const TQString & )
{
- emit error(KIO::ERR_UNSUPPORTED_ACTION, QString::null);
+ emit error(KIO::ERR_UNSUPPORTED_ACTION, TQString::null);
}
-void KMobileDevice::chmod( const QString &, int )
+void KMobileDevice::chmod( const TQString &, int )
{
- emit error(KIO::ERR_UNSUPPORTED_ACTION, QString::null);
+ emit error(KIO::ERR_UNSUPPORTED_ACTION, TQString::null);
}
-void KMobileDevice::get( const QString & )
+void KMobileDevice::get( const TQString & )
{
- emit error(KIO::ERR_UNSUPPORTED_ACTION, QString::null);
+ emit error(KIO::ERR_UNSUPPORTED_ACTION, TQString::null);
}
-void KMobileDevice::put( const QString &, int, bool, bool )
+void KMobileDevice::put( const TQString &, int, bool, bool )
{
- emit error(KIO::ERR_UNSUPPORTED_ACTION, QString::null);
+ emit error(KIO::ERR_UNSUPPORTED_ACTION, TQString::null);
}
-void KMobileDevice::mimetype( const QString & )
+void KMobileDevice::mimetype( const TQString & )
{
- emit error(KIO::ERR_UNSUPPORTED_ACTION, QString::null);
+ emit error(KIO::ERR_UNSUPPORTED_ACTION, TQString::null);
}
-void KMobileDevice::special( const QByteArray & )
+void KMobileDevice::special( const TQByteArray & )
{
- emit error(KIO::ERR_UNSUPPORTED_ACTION, QString::null);
+ emit error(KIO::ERR_UNSUPPORTED_ACTION, TQString::null);
}
@@ -366,7 +366,7 @@ void KMobileDevice::special( const QByteArray & )
# include <sys/types.h>
# include <sys/stat.h>
# include <unistd.h>
-# include <qfile.h>
+# include <tqfile.h>
# include <signal.h>
# include <errno.h>
# endif
@@ -374,7 +374,7 @@ void KMobileDevice::special( const QByteArray & )
#define DEVICE_LOCK_PATH_PREFIX "/var/lock/LCK.."
-bool KMobileDevice::lockDevice(const QString &device, QString &err_reason)
+bool KMobileDevice::lockDevice(const TQString &device, TQString &err_reason)
{
#ifdef HAVE_BAUDBOY_H
return ttylock(device.local8bit()) == EXIT_SUCCESS;
@@ -383,13 +383,13 @@ bool KMobileDevice::lockDevice(const QString &device, QString &err_reason)
return !dev_lock(device.local8bit());
# else
int pid = -1;
- QStringList all = QStringList::split('/', device);
+ TQStringList all = TQStringList::split('/', device);
if (!all.count()) {
err_reason = i18n("Invalid device (%1)").arg(device);
return false;
}
- QString lockName = DEVICE_LOCK_PATH_PREFIX + all[all.count()-1];
- QFile file(lockName);
+ TQString lockName = DEVICE_LOCK_PATH_PREFIX + all[all.count()-1];
+ TQFile file(lockName);
if (file.exists() && file.open(IO_ReadOnly)) {
if (file.size() == 0) {
err_reason = i18n("Unable to read lockfile %s. Please check for reason and "
@@ -400,17 +400,17 @@ bool KMobileDevice::lockDevice(const QString &device, QString &err_reason)
if (file.size() == 4 && sizeof(int)==4) {
file.readLine((char *)(&pid), 4); /* Kermit-style lockfile */
} else {
- QTextStream ts(&file);
+ TQTextStream ts(&file);
ts >> pid; /* Ascii lockfile */
}
file.close();
if (pid > 0 && kill((pid_t)pid, 0) < 0 && errno == ESRCH) {
- PRINT_DEBUG << QString("Lockfile %1 is stale. Overriding it..\n").arg(lockName);
+ PRINT_DEBUG << TQString("Lockfile %1 is stale. Overriding it..\n").arg(lockName);
sleep(1);
if (!file.remove()) {
- PRINT_DEBUG << QString("Overriding failed, please check the permissions\n");
- PRINT_DEBUG << QString("Cannot lock device %1\n").arg(device);
+ PRINT_DEBUG << TQString("Overriding failed, please check the permissions\n");
+ PRINT_DEBUG << TQString("Cannot lock device %1\n").arg(device);
err_reason = i18n("Lockfile %1 is stale. Please check permissions.").arg(lockName);
return false;
}
@@ -433,22 +433,22 @@ bool KMobileDevice::lockDevice(const QString &device, QString &err_reason)
err_reason = i18n("Could not create lockfile %1. Error-Code is %2.").arg(lockName).arg(errno);
return false;
}
- QString lockText;
- lockText = QString("%1 kmobile\n").arg(getpid(),10);
+ TQString lockText;
+ lockText = TQString("%1 kmobile\n").arg(getpid(),10);
write(fd, lockText.utf8(), lockText.utf8().length());
close(fd);
- PRINT_DEBUG << QString("%1: Device %2 locked with lockfile %3.\n")
+ PRINT_DEBUG << TQString("%1: Device %2 locked with lockfile %3.\n")
.arg(deviceName()).arg(device).arg(lockName);
- err_reason = QString::null;
+ err_reason = TQString::null;
return true;
# endif
#endif
}
-bool KMobileDevice::unlockDevice(const QString &device)
+bool KMobileDevice::unlockDevice(const TQString &device)
{
#ifdef HAVE_BAUDBOY_H
return ttyunlock(device.local8bit()) == EXIT_SUCCESS;
@@ -456,10 +456,10 @@ bool KMobileDevice::unlockDevice(const QString &device)
# ifdef HAVE_LOCKDEV_H
return 0 <= dev_unlock(device.local8bit(), getpid());
# else
- QStringList all = QStringList::split('/', device);
+ TQStringList all = TQStringList::split('/', device);
if (!all.count()) return false;
- QString lockName = DEVICE_LOCK_PATH_PREFIX + all[all.count()-1];
- QFile file(lockName);
+ TQString lockName = DEVICE_LOCK_PATH_PREFIX + all[all.count()-1];
+ TQFile file(lockName);
if (!file.exists())
return true;
return file.remove();