summaryrefslogtreecommitdiffstats
path: root/kmobile/kioslave/kio_mobile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmobile/kioslave/kio_mobile.cpp')
-rw-r--r--kmobile/kioslave/kio_mobile.cpp154
1 files changed, 77 insertions, 77 deletions
diff --git a/kmobile/kioslave/kio_mobile.cpp b/kmobile/kioslave/kio_mobile.cpp
index ec987fb06..d32c11cb4 100644
--- a/kmobile/kioslave/kio_mobile.cpp
+++ b/kmobile/kioslave/kio_mobile.cpp
@@ -24,7 +24,7 @@
#include <unistd.h>
#include <time.h>
-#include <qregexp.h>
+#include <tqregexp.h>
#include <kdebug.h>
#include <klocale.h>
@@ -68,7 +68,7 @@ int kdemain(int argc, char **argv)
/**
* Initialize the mobile slave
*/
-KMobileProtocol::KMobileProtocol(const QCString &pool, const QCString &app)
+KMobileProtocol::KMobileProtocol(const TQCString &pool, const TQCString &app)
: SlaveBase( "mobile", pool, app)
{
}
@@ -80,14 +80,14 @@ KMobileProtocol::~KMobileProtocol()
/*
* getDeviceAndRessource("mobile:/<devicename>/<resource>/...") - split
*/
-int KMobileProtocol::getDeviceAndRessource(const QString &_path,
- QString &devName, QString &resource, QString &devPath,
+int KMobileProtocol::getDeviceAndRessource(const TQString &_path,
+ TQString &devName, TQString &resource, TQString &devPath,
KMobileDevice::Capabilities &devCaps)
{
-// PRINT_DEBUG << QString("###getDeviceAndRessource### %1\n").arg(_path);
- QStringList path = QStringList::split('/', _path, false);
+// PRINT_DEBUG << TQString("###getDeviceAndRessource### %1\n").arg(_path);
+ TQStringList path = TQStringList::split('/', _path, false);
- devName = resource = devPath = QString::null;
+ devName = resource = devPath = TQString::null;
devCaps = KMobileDevice::hasNothing;
if (path.count() >= 1) { devName = path[0]; path.pop_front(); };
@@ -108,7 +108,7 @@ int KMobileProtocol::getDeviceAndRessource(const QString &_path,
int cap = 1UL << i;
if ((_caps & cap) == 0)
continue;
- QString capname = m_dev.nameForCap(devName,cap);
+ TQString capname = m_dev.nameForCap(devName,cap);
if (capname != resource)
continue;
devCaps = (KMobileDevice::Capabilities) cap;
@@ -120,7 +120,7 @@ int KMobileProtocol::getDeviceAndRessource(const QString &_path,
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;
@@ -130,7 +130,7 @@ void addAtom(KIO::UDSEntry& entry, unsigned int ID, long l, const QString& s = Q
}
static
-void createDirEntry(KIO::UDSEntry& entry, const QString& name, const QString& url, const QString& mime)
+void createDirEntry(KIO::UDSEntry& entry, const TQString& name, const TQString& url, const TQString& mime)
{
entry.clear();
addAtom(entry, KIO::UDS_NAME, 0, name);
@@ -140,13 +140,13 @@ void createDirEntry(KIO::UDSEntry& entry, const QString& name, const QString& ur
addAtom(entry, KIO::UDS_URL, 0, url);
addAtom(entry, KIO::UDS_USER, 0, getenv("USER"));
addAtom(entry, KIO::UDS_GROUP, 0, getenv("USER"));
- 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);
}
static
-void createFileEntry(KIO::UDSEntry& entry, const QString& name, const QString& url, const QString& mime,
+void createFileEntry(KIO::UDSEntry& entry, const TQString& name, const TQString& url, const TQString& mime,
const unsigned long size = 0)
{
entry.clear();
@@ -159,7 +159,7 @@ void createFileEntry(KIO::UDSEntry& entry, const QString& name, const QString& u
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);
}
@@ -169,10 +169,10 @@ void createFileEntry(KIO::UDSEntry& entry, const QString& name, const QString& u
void KMobileProtocol::get(const KURL &url)
{
PRINT_DEBUG << "###############################\n";
- PRINT_DEBUG << QString("get(%1)\n").arg(url.path());
+ PRINT_DEBUG << TQString("get(%1)\n").arg(url.path());
KMobileDevice::Capabilities devCaps;
- QString devName, resource, devPath;
+ TQString devName, resource, devPath;
int err = getDeviceAndRessource(url.path(), devName, resource, devPath, devCaps);
if (err) {
@@ -186,8 +186,8 @@ void KMobileProtocol::get(const KURL &url)
}
// collect the result
- QCString result;
- QString mime;
+ TQCString result;
+ TQString mime;
switch (devCaps) {
case KMobileDevice::hasAddressBook: err = getVCard(devName, result, mime, devPath);
break;
@@ -213,13 +213,13 @@ void KMobileProtocol::get(const KURL &url)
totalSize(processed_size);
// tell the contents of the URL
- QByteArray array;
+ TQByteArray array;
array.setRawData( result.data(), result.length() );
data(array);
array.resetRawData( result.data(), result.length() );
processedSize( processed_size );
// tell we are finished
- data(QByteArray());
+ data(TQByteArray());
// tell we are finished
finished();
@@ -231,11 +231,11 @@ void KMobileProtocol::get(const KURL &url)
*/
void KMobileProtocol::listRoot(const KURL& url)
{
- PRINT_DEBUG << QString("########## listRoot(%1) for %2:/\n").arg(url.path()).arg(url.protocol());
+ PRINT_DEBUG << TQString("########## listRoot(%1) for %2:/\n").arg(url.path()).arg(url.protocol());
KIO::UDSEntry entry;
- QStringList deviceNames = m_dev.deviceNames();
+ TQStringList deviceNames = m_dev.deviceNames();
unsigned int dirs = deviceNames.count();
totalSize(dirs);
@@ -251,7 +251,7 @@ void KMobileProtocol::listRoot(const KURL& url)
for (unsigned int i=0; i<dirs; i++) {
- QString devName = deviceNames[i];
+ TQString devName = deviceNames[i];
if (classMask != KMobileDevice::Unclassified &&
m_dev.classType(devName) != classMask)
@@ -271,9 +271,9 @@ void KMobileProtocol::listRoot(const KURL& url)
/*
* folderMimeType() - returns mimetype of the folder itself
*/
-QString KMobileProtocol::folderMimeType(int cap)
+TQString KMobileProtocol::folderMimeType(int cap)
{
- QString mimetype;
+ TQString mimetype;
switch (cap) {
case KMobileDevice::hasAddressBook: mimetype = KMOBILE_MIMETYPE_INODE "addressbook";
break;
@@ -290,9 +290,9 @@ QString KMobileProtocol::folderMimeType(int cap)
/*
* entryMimeType() - returns mimetype of the entries in the given folder
*/
-QString KMobileProtocol::entryMimeType(int cap)
+TQString KMobileProtocol::entryMimeType(int cap)
{
- QString mimetype;
+ TQString mimetype;
switch (cap) {
case KMobileDevice::hasAddressBook: mimetype = "text/x-vcard";
break;
@@ -310,9 +310,9 @@ QString KMobileProtocol::entryMimeType(int cap)
* listTopDeviceDir("mobile:/<devicename>") - sub-directory of a devices
*/
-void KMobileProtocol::listTopDeviceDir(const QString &devName)
+void KMobileProtocol::listTopDeviceDir(const TQString &devName)
{
- PRINT_DEBUG << QString("listTopDeviceDir(%1)\n").arg(devName);
+ PRINT_DEBUG << TQString("listTopDeviceDir(%1)\n").arg(devName);
KIO::UDSEntry entry;
unsigned int caps = m_dev.capabilities(devName);
@@ -322,10 +322,10 @@ void KMobileProtocol::listTopDeviceDir(const QString &devName)
if ((caps & cap) == 0)
continue;
- QString filename = m_dev.nameForCap(devName, cap);
- QString mimetype = folderMimeType(cap);
+ TQString filename = m_dev.nameForCap(devName, cap);
+ TQString mimetype = folderMimeType(cap);
- createDirEntry(entry, filename, QString("mobile:/%1/%2/").arg(devName).arg(filename), mimetype);
+ createDirEntry(entry, filename, TQString("mobile:/%1/%2/").arg(devName).arg(filename), mimetype);
listEntry(entry, false);
}
listEntry(entry, true);
@@ -336,11 +336,11 @@ void KMobileProtocol::listTopDeviceDir(const QString &devName)
/*
* listEntries("mobile:/<devicename>/<resource>") - resources of a device
*/
-void KMobileProtocol::listEntries(const QString &devName,
- const QString &resource, const QString &devPath,
+void KMobileProtocol::listEntries(const TQString &devName,
+ const TQString &resource, const TQString &devPath,
const KMobileDevice::Capabilities devCaps)
{
- PRINT_DEBUG << QString("listEntries(%1,%2,%3)\n").arg(devName).arg(resource).arg(devPath);
+ PRINT_DEBUG << TQString("listEntries(%1,%2,%3)\n").arg(devName).arg(resource).arg(devPath);
switch (devCaps) {
case KMobileDevice::hasAddressBook: listAddressBook(devName, resource);
break;
@@ -351,16 +351,16 @@ void KMobileProtocol::listEntries(const QString &devName,
case KMobileDevice::hasFileStorage: listFileStorage(devName, resource, devPath);
break;
default: error( ERR_CANNOT_ENTER_DIRECTORY,
- QString("/%1/%2").arg(devName).arg(resource) );
+ TQString("/%1/%2").arg(devName).arg(resource) );
}
}
/*
* listAddressBook("mobile:/<devicename>/Addressbook) - list the addressbook
*/
-void KMobileProtocol::listAddressBook(const QString &devName, const QString &resource)
+void KMobileProtocol::listAddressBook(const TQString &devName, const TQString &resource)
{
- PRINT_DEBUG << QString("listAddressBook(%1)\n").arg(devName);
+ PRINT_DEBUG << TQString("listAddressBook(%1)\n").arg(devName);
KIO::UDSEntry entry;
@@ -370,23 +370,23 @@ void KMobileProtocol::listAddressBook(const QString &devName, const QString &res
if (entries>=100) fieldwidth=3; else
if (entries>=10) fieldwidth=2; else fieldwidth=1;
totalSize(entries);
-// QRegExp rx; rx.setPattern( ".*FN:([\\w\\s]*)[\\n\\r]{2}.*" );
- QString name;
+// TQRegExp rx; rx.setPattern( ".*FN:([\\w\\s]*)[\\n\\r]{2}.*" );
+ TQString name;
for (int i=0; i<entries; i++) {
#if 0
- QString content = m_dev.readAddress(devName, i);
+ TQString content = m_dev.readAddress(devName, i);
if ( rx.search( content ) < 0 )
- name = QString::null;
+ name = TQString::null;
else
name = "_" + rx.cap(1);
#endif
- QString filename = QString("%1%2.vcf").arg(i,fieldwidth).arg(name);
+ TQString filename = TQString("%1%2.vcf").arg(i,fieldwidth).arg(name);
for (int p=0; p<fieldwidth; p++) {
if (filename[p]==' ') filename[p]='0'; else break;
}
- QString url = QString("mobile:/%1/%2/%3").arg(devName).arg(resource).arg(filename);
+ TQString url = TQString("mobile:/%1/%2/%3").arg(devName).arg(resource).arg(filename);
createFileEntry(entry, filename, url, entryMimeType(KMobileDevice::hasAddressBook),
400 /*content.utf8().length()*/ );
@@ -401,9 +401,9 @@ void KMobileProtocol::listAddressBook(const QString &devName, const QString &res
/*
* getVCard() - gives the vCard of the given file
*/
-int KMobileProtocol::getVCard( const QString &devName, QCString &result, QString &mime, const QString &path )
+int KMobileProtocol::getVCard( const TQString &devName, TQCString &result, TQString &mime, const TQString &path )
{
- PRINT_DEBUG << QString("getVCard(%1)\n").arg(path);
+ PRINT_DEBUG << TQString("getVCard(%1)\n").arg(path);
int index = path.find('.');
if (index>0)
@@ -411,21 +411,21 @@ int KMobileProtocol::getVCard( const QString &devName, QCString &result, QString
if (index<0 || index>=m_dev.numAddresses(devName))
return KIO::ERR_DOES_NOT_EXIST;
- QString str = m_dev.readAddress(devName, index);
+ TQString str = m_dev.readAddress(devName, index);
if (str.isEmpty())
return KIO::ERR_INTERNAL;
result = str.utf8();
mime = entryMimeType(KMobileDevice::hasAddressBook);
-// setMetaData("plugin", "const QString &key, const QString &value);
+// setMetaData("plugin", "const TQString &key, const TQString &value);
return 0;
}
/*
* listCalendar("mobile:/<devicename>/Calendar) - list the calendar entries
*/
-void KMobileProtocol::listCalendar( const QString &devName, const QString &resource)
+void KMobileProtocol::listCalendar( const TQString &devName, const TQString &resource)
{
- PRINT_DEBUG << QString("listCalendar(%1)\n").arg(devName);
+ PRINT_DEBUG << TQString("listCalendar(%1)\n").arg(devName);
KIO::UDSEntry entry;
@@ -433,8 +433,8 @@ void KMobileProtocol::listCalendar( const QString &devName, const QString &resou
totalSize(entries);
for (int i=0; i<entries; i++) {
- QString filename = QString("%1_%2.vcs").arg(i).arg(i18n("calendar"));
- QString url = QString("mobile:/%1/%2/%3").arg(devName).arg(resource).arg(filename);
+ TQString filename = TQString("%1_%2.vcs").arg(i).arg(i18n("calendar"));
+ TQString url = TQString("mobile:/%1/%2/%3").arg(devName).arg(resource).arg(filename);
createFileEntry(entry, filename, url, entryMimeType(KMobileDevice::hasCalendar));
listEntry(entry, false);
@@ -448,9 +448,9 @@ void KMobileProtocol::listCalendar( const QString &devName, const QString &resou
/*
* getCalendar() - reads a calendar entry
*/
-int KMobileProtocol::getCalendar( const QString &devName, QCString &result, QString &mime, const QString &path)
+int KMobileProtocol::getCalendar( const TQString &devName, TQCString &result, TQString &mime, const TQString &path)
{
- PRINT_DEBUG << QString("getCalendar(%1, #%2)\n").arg(devName).arg(path);
+ PRINT_DEBUG << TQString("getCalendar(%1, #%2)\n").arg(devName).arg(path);
/* TODO */
Q_UNUSED(result);
@@ -462,9 +462,9 @@ int KMobileProtocol::getCalendar( const QString &devName, QCString &result, QStr
/*
* listNotes("mobile:/<devicename>/Notes) - list the notes
*/
-void KMobileProtocol::listNotes( const QString &devName, const QString &resource)
+void KMobileProtocol::listNotes( const TQString &devName, const TQString &resource)
{
- PRINT_DEBUG << QString("listNotes(%1)\n").arg(devName);
+ PRINT_DEBUG << TQString("listNotes(%1)\n").arg(devName);
KIO::UDSEntry entry;
@@ -472,10 +472,10 @@ void KMobileProtocol::listNotes( const QString &devName, const QString &resource
totalSize(entries);
for (int i=0; i<entries; i++) {
- QString note /*= m_dev.readNote(devName, i)*/;
+ TQString note /*= m_dev.readNote(devName, i)*/;
- QString filename = QString("%1_%2.txt").arg(i).arg(i18n("note"));
- QString url = QString("mobile:/%1/%2/%3").arg(devName).arg(resource).arg(filename);
+ TQString filename = TQString("%1_%2.txt").arg(i).arg(i18n("note"));
+ TQString url = TQString("mobile:/%1/%2/%3").arg(devName).arg(resource).arg(filename);
createFileEntry(entry, filename, url, entryMimeType(KMobileDevice::hasNotes),
0 /*note.utf8().length()*/);
@@ -490,9 +490,9 @@ void KMobileProtocol::listNotes( const QString &devName, const QString &resource
/*
* getNote() - gives the Note of the given file
*/
-int KMobileProtocol::getNote( const QString &devName, QCString &result, QString &mime, const QString &path )
+int KMobileProtocol::getNote( const TQString &devName, TQCString &result, TQString &mime, const TQString &path )
{
- PRINT_DEBUG << QString("getNote(%1)\n").arg(path);
+ PRINT_DEBUG << TQString("getNote(%1)\n").arg(path);
int index = path.find('_');
if (index>0)
@@ -500,7 +500,7 @@ int KMobileProtocol::getNote( const QString &devName, QCString &result, QString
if (index<0 || index>=m_dev.numNotes(devName))
return KIO::ERR_DOES_NOT_EXIST;
- QString note = m_dev.readNote(devName, index);
+ TQString note = m_dev.readNote(devName, index);
if (note.isEmpty())
return KIO::ERR_DOES_NOT_EXIST;
@@ -512,20 +512,20 @@ int KMobileProtocol::getNote( const QString &devName, QCString &result, QString
/*
* listFileStorage("mobile:/<devicename>/Files) - list the files on the device
*/
-void KMobileProtocol::listFileStorage(const QString &devName, const QString &resource, const QString &devPath)
+void KMobileProtocol::listFileStorage(const TQString &devName, const TQString &resource, const TQString &devPath)
{
- PRINT_DEBUG << QString("listFileStorage(%1,%2)\n").arg(devName).arg(devPath);
+ PRINT_DEBUG << TQString("listFileStorage(%1,%2)\n").arg(devName).arg(devPath);
/* TODO */
- error( KIO::ERR_DOES_NOT_EXIST, QString("/%1/%2/%3").arg(devName).arg(resource).arg(devPath) );
+ error( KIO::ERR_DOES_NOT_EXIST, TQString("/%1/%2/%3").arg(devName).arg(resource).arg(devPath) );
}
/*
* getFileStorage() - gives the file contents of the given file
*/
-int KMobileProtocol::getFileStorage(const QString &devName, QCString &result, QString &mime, const QString &path)
+int KMobileProtocol::getFileStorage(const TQString &devName, TQCString &result, TQString &mime, const TQString &path)
{
- PRINT_DEBUG << QString("getFileStorage(%1)\n").arg(path);
+ PRINT_DEBUG << TQString("getFileStorage(%1)\n").arg(path);
/* TODO */
Q_UNUSED(devName);
@@ -541,10 +541,10 @@ int KMobileProtocol::getFileStorage(const QString &devName, QCString &result, QS
void KMobileProtocol::stat( const KURL &url )
{
PRINT_DEBUG << "###############################\n";
- PRINT_DEBUG << QString("stat(%1)\n").arg(url.path());
+ PRINT_DEBUG << TQString("stat(%1)\n").arg(url.path());
KMobileDevice::Capabilities devCaps;
- QString devName, resource, devPath;
+ TQString devName, resource, devPath;
int err = getDeviceAndRessource(url.path(), devName, resource, devPath, devCaps);
if (err) {
@@ -552,10 +552,10 @@ void KMobileProtocol::stat( const KURL &url )
return;
}
- QStringList path = QStringList::split('/', url.path(), false);
- QString filename = (path.count()>0) ? path[path.count()-1] : "/";
- QString fullPath = path.join("/");
- QString fullUrl = QString("mobile:/%1").arg(fullPath);
+ TQStringList path = TQStringList::split('/', url.path(), false);
+ TQString filename = (path.count()>0) ? path[path.count()-1] : "/";
+ TQString fullPath = path.join("/");
+ TQString fullUrl = TQString("mobile:/%1").arg(fullPath);
UDSEntry entry;
@@ -577,10 +577,10 @@ void KMobileProtocol::stat( const KURL &url )
void KMobileProtocol::mimetype(const KURL &url)
{
PRINT_DEBUG << "###############################\n";
- PRINT_DEBUG << QString("mimetype(%1)\n").arg(url.path());
+ PRINT_DEBUG << TQString("mimetype(%1)\n").arg(url.path());
KMobileDevice::Capabilities devCaps;
- QString devName, resource, devPath;
+ TQString devName, resource, devPath;
int err = getDeviceAndRessource(url.path(), devName, resource, devPath, devCaps);
if (err) {
@@ -599,7 +599,7 @@ void KMobileProtocol::mimetype(const KURL &url)
void KMobileProtocol::listDir(const KURL &url)
{
PRINT_DEBUG << "###############################\n";
- PRINT_DEBUG << QString("listDir(%1)\n").arg(url.path());
+ PRINT_DEBUG << TQString("listDir(%1)\n").arg(url.path());
if (!m_dev.isKMobileAvailable()) {
error( KIO::ERR_CONNECTION_BROKEN, i18n("KDE Mobile Device Manager") );
@@ -607,7 +607,7 @@ void KMobileProtocol::listDir(const KURL &url)
}
KMobileDevice::Capabilities devCaps;
- QString devName, resource, devPath;
+ TQString devName, resource, devPath;
int err = getDeviceAndRessource(url.path(), devName, resource, devPath, devCaps);
if (err) {
@@ -622,7 +622,7 @@ void KMobileProtocol::listDir(const KURL &url)
#if 0
if (!dev) {
- error( KIO::ERR_DOES_NOT_EXIST, QString("/%1").arg(devName) );
+ error( KIO::ERR_DOES_NOT_EXIST, TQString("/%1").arg(devName) );
return;
}
#endif