summaryrefslogtreecommitdiffstats
path: root/kioslave/trash
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:33:34 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:33:34 +0000
commitc663b6440964f6ac48027143ac9e63298991f9d0 (patch)
tree6d8b0c5a5f9db1ee16acf98b1397cea9126b281d /kioslave/trash
parenta061f7191beebb0e4a3b0c0a7c534ec5f22f2dc7 (diff)
downloadtdebase-c663b6440964f6ac48027143ac9e63298991f9d0.tar.gz
tdebase-c663b6440964f6ac48027143ac9e63298991f9d0.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1157639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kioslave/trash')
-rw-r--r--kioslave/trash/kfile-plugin/kfile_trash.cpp22
-rw-r--r--kioslave/trash/kfile-plugin/kfile_trash.h4
-rw-r--r--kioslave/trash/kio_trash.cpp108
-rw-r--r--kioslave/trash/kio_trash.h16
-rw-r--r--kioslave/trash/ktrash.cpp14
-rw-r--r--kioslave/trash/testtrash.cpp414
-rw-r--r--kioslave/trash/testtrash.h36
-rw-r--r--kioslave/trash/trashimpl.cpp242
-rw-r--r--kioslave/trash/trashimpl.h86
9 files changed, 471 insertions, 471 deletions
diff --git a/kioslave/trash/kfile-plugin/kfile_trash.cpp b/kioslave/trash/kfile-plugin/kfile_trash.cpp
index baa27143c..edd57014d 100644
--- a/kioslave/trash/kfile-plugin/kfile_trash.cpp
+++ b/kioslave/trash/kfile-plugin/kfile_trash.cpp
@@ -23,16 +23,16 @@
#include <kgenericfactory.h>
#include <kdebug.h>
-#include <qfile.h>
-#include <qstringlist.h>
-#include <qdatetime.h>
+#include <tqfile.h>
+#include <tqstringlist.h>
+#include <tqdatetime.h>
typedef KGenericFactory<KTrashPlugin> TrashFactory;
K_EXPORT_COMPONENT_FACTORY(kfile_trash, TrashFactory("kfile_trash"))
-KTrashPlugin::KTrashPlugin(QObject *parent, const char *name,
- const QStringList &args) : KFilePlugin(parent, name, args)
+KTrashPlugin::KTrashPlugin(TQObject *parent, const char *name,
+ const TQStringList &args) : KFilePlugin(parent, name, args)
{
KGlobal::locale()->insertCatalogue( "kio_trash" );
@@ -44,7 +44,7 @@ KTrashPlugin::KTrashPlugin(QObject *parent, const char *name,
(void)impl.init();
}
-void KTrashPlugin::makeMimeTypeInfo(const QString& mimeType)
+void KTrashPlugin::makeMimeTypeInfo(const TQString& mimeType)
{
KFileMimeTypeInfo* info = addMimeTypeInfo( mimeType );
@@ -52,8 +52,8 @@ void KTrashPlugin::makeMimeTypeInfo(const QString& mimeType)
addGroupInfo(info, "General", i18n("General"));
KFileMimeTypeInfo::ItemInfo* item;
- item = addItemInfo(group, "OriginalPath", i18n("Original Path"), QVariant::String);
- item = addItemInfo(group, "DateOfDeletion", i18n("Date of Deletion"), QVariant::DateTime);
+ item = addItemInfo(group, "OriginalPath", i18n("Original Path"), TQVariant::String);
+ item = addItemInfo(group, "DateOfDeletion", i18n("Date of Deletion"), TQVariant::DateTime);
}
bool KTrashPlugin::readInfo(KFileMetaInfo& info, uint)
@@ -63,7 +63,7 @@ bool KTrashPlugin::readInfo(KFileMetaInfo& info, uint)
if ( url.protocol()=="system"
&& url.path().startsWith("/trash") )
{
- QString path = url.path();
+ TQString path = url.path();
path.remove(0, 6);
url.setProtocol("trash");
url.setPath(path);
@@ -74,8 +74,8 @@ bool KTrashPlugin::readInfo(KFileMetaInfo& info, uint)
return false;
int trashId;
- QString fileId;
- QString relativePath;
+ TQString fileId;
+ TQString relativePath;
if ( !TrashImpl::parseURL( url, trashId, fileId, relativePath ) )
return false;
diff --git a/kioslave/trash/kfile-plugin/kfile_trash.h b/kioslave/trash/kfile-plugin/kfile_trash.h
index 8316f7402..a041999a4 100644
--- a/kioslave/trash/kfile-plugin/kfile_trash.h
+++ b/kioslave/trash/kfile-plugin/kfile_trash.h
@@ -31,11 +31,11 @@ class KTrashPlugin: public KFilePlugin
Q_OBJECT
public:
- KTrashPlugin(QObject *parent, const char *name, const QStringList& args);
+ KTrashPlugin(TQObject *parent, const char *name, const TQStringList& args);
virtual bool readInfo(KFileMetaInfo& info, uint what);
private:
- void makeMimeTypeInfo(const QString& mimeType);
+ void makeMimeTypeInfo(const TQString& mimeType);
TrashImpl impl;
};
diff --git a/kioslave/trash/kio_trash.cpp b/kioslave/trash/kio_trash.cpp
index 7912cbb7c..1210bb59a 100644
--- a/kioslave/trash/kio_trash.cpp
+++ b/kioslave/trash/kio_trash.cpp
@@ -29,10 +29,10 @@
#include <kprocess.h>
#include <dcopclient.h>
-#include <qdatastream.h>
-#include <qtextstream.h>
-#include <qfile.h>
-#include <qeventloop.h>
+#include <tqdatastream.h>
+#include <tqtextstream.h>
+#include <tqfile.h>
+#include <tqeventloop.h>
#include <time.h>
#include <pwd.h>
@@ -73,15 +73,15 @@ extern "C" {
return; \
}
-TrashProtocol::TrashProtocol( const QCString& protocol, const QCString &pool, const QCString &app)
+TrashProtocol::TrashProtocol( const TQCString& protocol, const TQCString &pool, const TQCString &app)
: SlaveBase(protocol, pool, app )
{
struct passwd *user = getpwuid( getuid() );
if ( user )
- m_userName = QString::fromLatin1(user->pw_name);
+ m_userName = TQString::fromLatin1(user->pw_name);
struct group *grp = getgrgid( getgid() );
if ( grp )
- m_groupName = QString::fromLatin1(grp->gr_name);
+ m_groupName = TQString::fromLatin1(grp->gr_name);
}
TrashProtocol::~TrashProtocol()
@@ -91,7 +91,7 @@ TrashProtocol::~TrashProtocol()
void TrashProtocol::restore( const KURL& trashURL )
{
int trashId;
- QString fileId, relativePath;
+ TQString fileId, relativePath;
bool ok = TrashImpl::parseURL( trashURL, trashId, fileId, relativePath );
if ( !ok ) {
error( KIO::ERR_SLAVE_DEFINED, i18n( "Malformed URL %1" ).arg( trashURL.prettyURL() ) );
@@ -109,9 +109,9 @@ void TrashProtocol::restore( const KURL& trashURL )
dest.addPath( relativePath );
// Check that the destination directory exists, to improve the error code in case it doesn't.
- const QString destDir = dest.directory();
+ const TQString destDir = dest.directory();
KDE_struct_stat buff;
- if ( KDE_lstat( QFile::encodeName( destDir ), &buff ) == -1 ) {
+ if ( KDE_lstat( TQFile::encodeName( destDir ), &buff ) == -1 ) {
error( KIO::ERR_SLAVE_DEFINED,
i18n( "The directory %1 does not exist anymore, so it is not possible to restore this item to its original location. "
"You can either recreate that directory and use the restore operation again, or drag the item anywhere else to restore it." ).arg( destDir ) );
@@ -154,16 +154,16 @@ void TrashProtocol::copyOrMove( const KURL &src, const KURL &dest, bool overwrit
if ( src.protocol() == "trash" && dest.isLocalFile() ) {
// Extracting (e.g. via dnd). Ignore original location stored in info file.
int trashId;
- QString fileId, relativePath;
+ TQString fileId, relativePath;
bool ok = TrashImpl::parseURL( src, trashId, fileId, relativePath );
if ( !ok ) {
error( KIO::ERR_SLAVE_DEFINED, i18n( "Malformed URL %1" ).arg( src.prettyURL() ) );
return;
}
- const QString destPath = dest.path();
- if ( QFile::exists( destPath ) ) {
+ const TQString destPath = dest.path();
+ if ( TQFile::exists( destPath ) ) {
if ( overwrite ) {
- ok = QFile::remove( destPath );
+ ok = TQFile::remove( destPath );
Q_ASSERT( ok ); // ### TODO
} else {
error( KIO::ERR_FILE_ALREADY_EXIST, destPath );
@@ -187,20 +187,20 @@ void TrashProtocol::copyOrMove( const KURL &src, const KURL &dest, bool overwrit
}
return;
} else if ( src.isLocalFile() && dest.protocol() == "trash" ) {
- QString dir = dest.directory();
+ TQString dir = dest.directory();
//kdDebug() << "trashing a file to " << dir << endl;
// Trashing a file
// We detect the case where this isn't normal trashing, but
// e.g. if kwrite tries to save (moving tempfile over destination)
if ( dir.length() <= 1 && src.fileName() == dest.fileName() ) // new toplevel entry
{
- const QString srcPath = src.path();
+ const TQString srcPath = src.path();
// In theory we should use TrashImpl::parseURL to give the right filename to createInfo,
// in case the trash URL didn't contain the same filename as srcPath.
// But this can only happen with copyAs/moveAs, not available in the GUI
// for the trash (New/... or Rename from iconview/listview).
int trashId;
- QString fileId;
+ TQString fileId;
if ( !impl.createInfo( srcPath, trashId, fileId ) ) {
error( impl.lastErrorCode(), impl.lastErrorMessage() );
} else {
@@ -217,7 +217,7 @@ void TrashProtocol::copyOrMove( const KURL &src, const KURL &dest, bool overwrit
error( impl.lastErrorCode(), impl.lastErrorMessage() );
} else {
// Inform caller of the final URL. Used by konq_undo.
- const KURL url = impl.makeURL( trashId, fileId, QString::null );
+ const KURL url = impl.makeURL( trashId, fileId, TQString::null );
setMetaData( "trashURL-" + srcPath, url.url() );
finished();
}
@@ -233,7 +233,7 @@ void TrashProtocol::copyOrMove( const KURL &src, const KURL &dest, bool overwrit
error( KIO::ERR_UNSUPPORTED_ACTION, "should never happen" );
}
-static void addAtom(KIO::UDSEntry& entry, unsigned int ID, long long l, const QString& s = QString::null)
+static void addAtom(KIO::UDSEntry& entry, unsigned int ID, long long l, const TQString& s = TQString::null)
{
KIO::UDSAtom atom;
atom.m_uds = ID;
@@ -256,7 +256,7 @@ void TrashProtocol::createTopLevelDirEntry(KIO::UDSEntry& entry)
void TrashProtocol::stat(const KURL& url)
{
INIT_IMPL;
- const QString path = url.path();
+ const TQString path = url.path();
if( path.isEmpty() || path == "/" ) {
// The root is "virtual" - it's not a single physical directory
KIO::UDSEntry entry;
@@ -265,7 +265,7 @@ void TrashProtocol::stat(const KURL& url)
finished();
} else {
int trashId;
- QString fileId, relativePath;
+ TQString fileId, relativePath;
bool ok = TrashImpl::parseURL( url, trashId, fileId, relativePath );
@@ -279,15 +279,15 @@ void TrashProtocol::stat(const KURL& url)
return;
}
- const QString filePath = impl.physicalPath( trashId, fileId, relativePath );
+ const TQString filePath = impl.physicalPath( trashId, fileId, relativePath );
if ( filePath.isEmpty() ) {
error( impl.lastErrorCode(), impl.lastErrorMessage() );
return;
}
- QString fileName = filePath.section('/', -1, -1, QString::SectionSkipEmpty);
+ TQString fileName = filePath.section('/', -1, -1, TQString::SectionSkipEmpty);
- QString fileURL = QString::null;
+ TQString fileURL = TQString::null;
if ( url.path().length() > 1 ) {
fileURL = url.url();
}
@@ -310,7 +310,7 @@ void TrashProtocol::stat(const KURL& url)
void TrashProtocol::del( const KURL &url, bool /*isfile*/ )
{
int trashId;
- QString fileId, relativePath;
+ TQString fileId, relativePath;
bool ok = TrashImpl::parseURL( url, trashId, fileId, relativePath );
if ( !ok ) {
@@ -342,14 +342,14 @@ void TrashProtocol::listDir(const KURL& url)
return;
}
int trashId;
- QString fileId;
- QString relativePath;
+ TQString fileId;
+ TQString relativePath;
bool ok = TrashImpl::parseURL( url, trashId, fileId, relativePath );
if ( !ok ) {
error( KIO::ERR_SLAVE_DEFINED, i18n( "Malformed URL %1" ).arg( url.prettyURL() ) );
return;
}
- //was: const QString physicalPath = impl.physicalPath( trashId, fileId, relativePath );
+ //was: const TQString physicalPath = impl.physicalPath( trashId, fileId, relativePath );
// Get info for deleted directory - the date of deletion and orig path will be used
// for all the items in it, and we need the physicalPath.
@@ -366,22 +366,22 @@ void TrashProtocol::listDir(const KURL& url)
// List subdir. Can't use kio_file here since we provide our own info...
kdDebug() << k_funcinfo << "listing " << info.physicalPath << endl;
- QStrList entryNames = impl.listDir( info.physicalPath );
+ TQStrList entryNames = impl.listDir( info.physicalPath );
totalSize( entryNames.count() );
KIO::UDSEntry entry;
- QStrListIterator entryIt( entryNames );
+ TQStrListIterator entryIt( entryNames );
for (; entryIt.current(); ++entryIt) {
- QString fileName = QFile::decodeName( entryIt.current() );
+ TQString fileName = TQFile::decodeName( entryIt.current() );
if ( fileName == ".." )
continue;
- const QString filePath = info.physicalPath + "/" + fileName;
+ const TQString filePath = info.physicalPath + "/" + fileName;
// shouldn't be necessary
- //const QString url = TrashImpl::makeURL( trashId, fileId, relativePath + "/" + fileName );
+ //const TQString url = TrashImpl::makeURL( trashId, fileId, relativePath + "/" + fileName );
entry.clear();
TrashedFileInfo infoForItem( info );
infoForItem.origPath += '/';
infoForItem.origPath += fileName;
- if ( ok && createUDSEntry( filePath, fileName, QString::null /*url*/, entry, infoForItem ) ) {
+ if ( ok && createUDSEntry( filePath, fileName, TQString::null /*url*/, entry, infoForItem ) ) {
listEntry( entry, false );
}
}
@@ -390,9 +390,9 @@ void TrashProtocol::listDir(const KURL& url)
finished();
}
-bool TrashProtocol::createUDSEntry( const QString& physicalPath, const QString& fileName, const QString& url, KIO::UDSEntry& entry, const TrashedFileInfo& info )
+bool TrashProtocol::createUDSEntry( const TQString& physicalPath, const TQString& fileName, const TQString& url, KIO::UDSEntry& entry, const TrashedFileInfo& info )
{
- QCString physicalPath_c = QFile::encodeName( physicalPath );
+ TQCString physicalPath_c = TQFile::encodeName( physicalPath );
KDE_struct_stat buff;
if ( KDE_lstat( physicalPath_c, &buff ) == -1 ) {
kdWarning() << "couldn't stat " << physicalPath << endl;
@@ -405,7 +405,7 @@ bool TrashProtocol::createUDSEntry( const QString& physicalPath, const QString&
buffer2[ n ] = 0;
}
- addAtom( entry, KIO::UDS_LINK_DEST, 0, QFile::decodeName( buffer2 ) );
+ addAtom( entry, KIO::UDS_LINK_DEST, 0, TQFile::decodeName( buffer2 ) );
// Follow symlink
// That makes sense in kio_file, but not in the trash, especially for the size
// #136876
@@ -449,7 +449,7 @@ void TrashProtocol::listRoot()
createTopLevelDirEntry( entry );
listEntry( entry, false );
for ( TrashedFileInfoList::ConstIterator it = lst.begin(); it != lst.end(); ++it ) {
- const KURL url = TrashImpl::makeURL( (*it).trashId, (*it).fileId, QString::null );
+ const KURL url = TrashImpl::makeURL( (*it).trashId, (*it).fileId, TQString::null );
KURL origURL;
origURL.setPath( (*it).origPath );
entry.clear();
@@ -461,10 +461,10 @@ void TrashProtocol::listRoot()
finished();
}
-void TrashProtocol::special( const QByteArray & data )
+void TrashProtocol::special( const TQByteArray & data )
{
INIT_IMPL;
- QDataStream stream( data, IO_ReadOnly );
+ TQDataStream stream( data, IO_ReadOnly );
int cmd;
stream >> cmd;
@@ -488,7 +488,7 @@ void TrashProtocol::special( const QByteArray & data )
}
default:
kdWarning(7116) << "Unknown command in special(): " << cmd << endl;
- error( KIO::ERR_UNSUPPORTED_ACTION, QString::number(cmd) );
+ error( KIO::ERR_UNSUPPORTED_ACTION, TQString::number(cmd) );
break;
}
}
@@ -516,14 +516,14 @@ void TrashProtocol::get( const KURL& url )
return;
}
int trashId;
- QString fileId;
- QString relativePath;
+ TQString fileId;
+ TQString relativePath;
bool ok = TrashImpl::parseURL( url, trashId, fileId, relativePath );
if ( !ok ) {
error( KIO::ERR_SLAVE_DEFINED, i18n( "Malformed URL %1" ).arg( url.prettyURL() ) );
return;
}
- const QString physicalPath = impl.physicalPath( trashId, fileId, relativePath );
+ const TQString physicalPath = impl.physicalPath( trashId, fileId, relativePath );
if ( physicalPath.isEmpty() ) {
error( impl.lastErrorCode(), impl.lastErrorMessage() );
return;
@@ -534,21 +534,21 @@ void TrashProtocol::get( const KURL& url )
KURL fileURL;
fileURL.setPath( physicalPath );
KIO::Job* job = KIO::get( fileURL );
- connect( job, SIGNAL( data( KIO::Job*, const QByteArray& ) ),
- this, SLOT( slotData( KIO::Job*, const QByteArray& ) ) );
- connect( job, SIGNAL( mimetype( KIO::Job*, const QString& ) ),
- this, SLOT( slotMimetype( KIO::Job*, const QString& ) ) );
- connect( job, SIGNAL( result(KIO::Job *) ),
- this, SLOT( jobFinished(KIO::Job *) ) );
+ connect( job, TQT_SIGNAL( data( KIO::Job*, const TQByteArray& ) ),
+ this, TQT_SLOT( slotData( KIO::Job*, const TQByteArray& ) ) );
+ connect( job, TQT_SIGNAL( mimetype( KIO::Job*, const TQString& ) ),
+ this, TQT_SLOT( slotMimetype( KIO::Job*, const TQString& ) ) );
+ connect( job, TQT_SIGNAL( result(KIO::Job *) ),
+ this, TQT_SLOT( jobFinished(KIO::Job *) ) );
qApp->eventLoop()->enterLoop();
}
-void TrashProtocol::slotData( KIO::Job*, const QByteArray&arr )
+void TrashProtocol::slotData( KIO::Job*, const TQByteArray&arr )
{
data( arr );
}
-void TrashProtocol::slotMimetype( KIO::Job*, const QString& mt )
+void TrashProtocol::slotMimetype( KIO::Job*, const TQString& mt )
{
mimeType( mt );
}
@@ -570,13 +570,13 @@ void TrashProtocol::mkdir( const KURL& url, int /*permissions*/ )
// ############ Problem: we don't know the original path.
// Let's try to avoid this case (we should get to copy() instead, for local files)
kdDebug() << "mkdir: " << url << endl;
- QString dir = url.directory();
+ TQString dir = url.directory();
if ( dir.length() <= 1 ) // new toplevel entry
{
// ## we should use TrashImpl::parseURL to give the right filename to createInfo
int trashId;
- QString fileId;
+ TQString fileId;
if ( !impl.createInfo( url.path(), trashId, fileId ) ) {
error( impl.lastErrorCode(), impl.lastErrorMessage() );
} else {
diff --git a/kioslave/trash/kio_trash.h b/kioslave/trash/kio_trash.h
index 726db431e..37ea1944f 100644
--- a/kioslave/trash/kio_trash.h
+++ b/kioslave/trash/kio_trash.h
@@ -27,11 +27,11 @@ namespace KIO { class Job; }
typedef TrashImpl::TrashedFileInfo TrashedFileInfo;
typedef TrashImpl::TrashedFileInfoList TrashedFileInfoList;
-class TrashProtocol : public QObject, public KIO::SlaveBase
+class TrashProtocol : public TQObject, public KIO::SlaveBase
{
Q_OBJECT
public:
- TrashProtocol( const QCString& protocol, const QCString &pool, const QCString &app);
+ TrashProtocol( const TQCString& protocol, const TQCString &pool, const TQCString &app);
virtual ~TrashProtocol();
virtual void stat(const KURL& url);
virtual void listDir(const KURL& url);
@@ -47,25 +47,25 @@ public:
* 2 : migrate old (pre-kde-3.4) trash contents
* 3 : restore a file to its original location. Args: KURL trashURL.
*/
- virtual void special( const QByteArray & data );
+ virtual void special( const TQByteArray & data );
private slots:
- void slotData( KIO::Job*, const QByteArray& );
- void slotMimetype( KIO::Job*, const QString& );
+ void slotData( KIO::Job*, const TQByteArray& );
+ void slotMimetype( KIO::Job*, const TQString& );
void jobFinished( KIO::Job* job );
private:
typedef enum CopyOrMove { Copy, Move };
void copyOrMove( const KURL& src, const KURL& dest, bool overwrite, CopyOrMove action );
void createTopLevelDirEntry(KIO::UDSEntry& entry);
- bool createUDSEntry( const QString& physicalPath, const QString& fileName, const QString& url,
+ bool createUDSEntry( const TQString& physicalPath, const TQString& fileName, const TQString& url,
KIO::UDSEntry& entry, const TrashedFileInfo& info );
void listRoot();
void restore( const KURL& trashURL );
TrashImpl impl;
- QString m_userName;
- QString m_groupName;
+ TQString m_userName;
+ TQString m_groupName;
};
#endif
diff --git a/kioslave/trash/ktrash.cpp b/kioslave/trash/ktrash.cpp
index 4fa5ccd27..0c9710367 100644
--- a/kioslave/trash/ktrash.cpp
+++ b/kioslave/trash/ktrash.cpp
@@ -50,8 +50,8 @@ int main(int argc, char *argv[])
if ( args->isSet( "empty" ) ) {
// We use a kio job instead of linking to TrashImpl, for a smaller binary
// (and the possibility of a central service at some point)
- QByteArray packedArgs;
- QDataStream stream( packedArgs, IO_WriteOnly );
+ TQByteArray packedArgs;
+ TQDataStream stream( packedArgs, IO_WriteOnly );
stream << (int)1;
KIO::Job* job = KIO::special( "trash:/", packedArgs );
(void)KIO::NetAccess::synchronousRun( job, 0 );
@@ -65,8 +65,8 @@ int main(int argc, char *argv[])
#if 0
// This is only for testing. KDesktop handles it automatically.
if ( args->isSet( "migrate" ) ) {
- QByteArray packedArgs;
- QDataStream stream( packedArgs, IO_WriteOnly );
+ TQByteArray packedArgs;
+ TQDataStream stream( packedArgs, IO_WriteOnly );
stream << (int)2;
KIO::Job* job = KIO::special( "trash:/", packedArgs );
(void)KIO::NetAccess::synchronousRun( job, 0 );
@@ -74,7 +74,7 @@ int main(int argc, char *argv[])
}
#endif
- QCString restoreArg = args->getOption( "restore" );
+ TQCString restoreArg = args->getOption( "restore" );
if ( !restoreArg.isEmpty() ) {
if (restoreArg.find("system:/trash")==0) {
@@ -88,8 +88,8 @@ int main(int argc, char *argv[])
return 1;
}
- QByteArray packedArgs;
- QDataStream stream( packedArgs, IO_WriteOnly );
+ TQByteArray packedArgs;
+ TQDataStream stream( packedArgs, IO_WriteOnly );
stream << (int)3 << trashURL;
KIO::Job* job = KIO::special( trashURL, packedArgs );
bool ok = KIO::NetAccess::synchronousRun( job, 0 );
diff --git a/kioslave/trash/testtrash.cpp b/kioslave/trash/testtrash.cpp
index 4557c5031..fb6927d3e 100644
--- a/kioslave/trash/testtrash.cpp
+++ b/kioslave/trash/testtrash.cpp
@@ -34,9 +34,9 @@
#include <kdebug.h>
#include <kcmdlineargs.h>
-#include <qdir.h>
-#include <qfileinfo.h>
-#include <qvaluevector.h>
+#include <tqdir.h>
+#include <tqfileinfo.h>
+#include <tqvaluevector.h>
#include <stdio.h>
#include <stdlib.h>
@@ -45,12 +45,12 @@
#include <kfileitem.h>
#include <kstandarddirs.h>
-static bool check(const QString& txt, QString a, QString b)
+static bool check(const TQString& txt, TQString a, TQString b)
{
if (a.isEmpty())
- a = QString::null;
+ a = TQString::null;
if (b.isEmpty())
- b = QString::null;
+ b = TQString::null;
if (a == b) {
kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "ok" << endl;
}
@@ -69,7 +69,7 @@ static bool check(const QString& txt, QString a, QString b)
int main(int argc, char *argv[])
{
- // Ensure a known QFile::encodeName behavior for trashUtf8FileFromHome
+ // Ensure a known TQFile::encodeName behavior for trashUtf8FileFromHome
// However this assume your $HOME doesn't use characters from other locales...
setenv( "LC_ALL", "en_GB.ISO-8859-1", 1 );
#ifdef UTF8TEST
@@ -79,7 +79,7 @@ int main(int argc, char *argv[])
#endif
// Use another directory than the real one, just to keep things clean
- setenv( "XDG_DATA_HOME", QFile::encodeName( QDir::homeDirPath() + "/.local-testtrash" ), true );
+ setenv( "XDG_DATA_HOME", TQFile::encodeName( TQDir::homeDirPath() + "/.local-testtrash" ), true );
setenv( "KDE_FORK_SLAVES", "yes", true );
KApplication::disableAutoDcopRegistration();
@@ -93,44 +93,44 @@ int main(int argc, char *argv[])
return 0; // success. The exit(1) in check() is what happens in case of failure.
}
-QString TestTrash::homeTmpDir() const
+TQString TestTrash::homeTmpDir() const
{
- return QDir::homeDirPath() + "/.kde/testtrash/";
+ return TQDir::homeDirPath() + "/.kde/testtrash/";
}
-QString TestTrash::readOnlyDirPath() const
+TQString TestTrash::readOnlyDirPath() const
{
- return homeTmpDir() + QString( "readonly" );
+ return homeTmpDir() + TQString( "readonly" );
}
-QString TestTrash::otherTmpDir() const
+TQString TestTrash::otherTmpDir() const
{
// This one needs to be on another partition
return "/tmp/testtrash/";
}
-QString TestTrash::utf8FileName() const
+TQString TestTrash::utf8FileName() const
{
- return QString( "test" ) + QChar( 0x2153 ); // "1/3" character, not part of latin1
+ return TQString( "test" ) + TQChar( 0x2153 ); // "1/3" character, not part of latin1
}
-QString TestTrash::umlautFileName() const
+TQString TestTrash::umlautFileName() const
{
- return QString( "umlaut" ) + QChar( 0xEB );
+ return TQString( "umlaut" ) + TQChar( 0xEB );
}
-static void removeFile( const QString& trashDir, const QString& fileName )
+static void removeFile( const TQString& trashDir, const TQString& fileName )
{
- QDir dir;
+ TQDir dir;
dir.remove( trashDir + fileName );
- assert( !QDir( trashDir + fileName ).exists() );
+ assert( !TQDir( trashDir + fileName ).exists() );
}
-static void removeDir( const QString& trashDir, const QString& dirName )
+static void removeDir( const TQString& trashDir, const TQString& dirName )
{
- QDir dir;
+ TQDir dir;
dir.rmdir( trashDir + dirName );
- assert( !QDir( trashDir + dirName ).exists() );
+ assert( !TQDir( trashDir + dirName ).exists() );
}
void TestTrash::setup()
@@ -148,7 +148,7 @@ void TestTrash::setup()
m_otherPartitionId = 0;
m_tmpIsWritablePartition = false;
m_tmpTrashId = -1;
- QValueVector<int> writableTopDirs;
+ TQValueVector<int> writableTopDirs;
for ( TrashImpl::TrashDirMap::ConstIterator it = trashDirs.begin(); it != trashDirs.end() ; ++it ) {
if ( it.key() == 0 ) {
assert( it.data() == m_trashDir );
@@ -156,8 +156,8 @@ void TestTrash::setup()
foundTrashDir = true;
} else {
assert( topDirs.find( it.key() ) != topDirs.end() );
- const QString topdir = topDirs[it.key()];
- if ( QFileInfo( topdir ).isWritable() ) {
+ const TQString topdir = topDirs[it.key()];
+ if ( TQFileInfo( topdir ).isWritable() ) {
writableTopDirs.append( it.key() );
if ( topdir == "/tmp/" ) {
m_tmpIsWritablePartition = true;
@@ -174,9 +174,9 @@ void TestTrash::setup()
}
}
}
- for ( QValueVector<int>::const_iterator it = writableTopDirs.begin(); it != writableTopDirs.end(); ++it ) {
- const QString topdir = topDirs[ *it ];
- const QString trashdir = trashDirs[ *it ];
+ for ( TQValueVector<int>::const_iterator it = writableTopDirs.begin(); it != writableTopDirs.end(); ++it ) {
+ const TQString topdir = topDirs[ *it ];
+ const TQString trashdir = trashDirs[ *it ];
assert( !topdir.isEmpty() );
assert( !trashDirs.isEmpty() );
if ( topdir != "/tmp/" || // we'd prefer not to use /tmp here, to separate the tests
@@ -196,17 +196,17 @@ void TestTrash::setup()
kdWarning() << "No writable partition other than $HOME found, some tests will be skipped" << endl;
// Start with a clean base dir
- if ( QFileInfo( homeTmpDir() ).exists() ) {
+ if ( TQFileInfo( homeTmpDir() ).exists() ) {
bool ok = KIO::NetAccess::del( homeTmpDir(), 0 );
if ( !ok )
kdFatal() << "Couldn't delete " << homeTmpDir() << endl;
}
- if ( QFileInfo( otherTmpDir() ).exists() ) {
+ if ( TQFileInfo( otherTmpDir() ).exists() ) {
bool ok = KIO::NetAccess::del( otherTmpDir(), 0 );
if ( !ok )
kdFatal() << "Couldn't delete " << otherTmpDir() << endl;
}
- QDir dir; // TT: why not a static method?
+ TQDir dir; // TT: why not a static method?
bool ok = dir.mkdir( homeTmpDir() );
if ( !ok )
kdFatal() << "Couldn't create " << homeTmpDir() << endl;
@@ -325,17 +325,17 @@ void TestTrash::runAll()
void TestTrash::urlTestFile()
{
- const KURL url = TrashImpl::makeURL( 1, "fileId", QString::null );
+ const KURL url = TrashImpl::makeURL( 1, "fileId", TQString::null );
check( "makeURL for a file", url.url(), "trash:/1-fileId" );
int trashId;
- QString fileId;
- QString relativePath;
+ TQString fileId;
+ TQString relativePath;
bool ok = TrashImpl::parseURL( url, trashId, fileId, relativePath );
assert( ok );
- check( "parseURL: trashId", QString::number( trashId ), "1" );
+ check( "parseURL: trashId", TQString::number( trashId ), "1" );
check( "parseURL: fileId", fileId, "fileId" );
- check( "parseURL: relativePath", relativePath, QString::null );
+ check( "parseURL: relativePath", relativePath, TQString::null );
}
void TestTrash::urlTestDirectory()
@@ -344,11 +344,11 @@ void TestTrash::urlTestDirectory()
check( "makeURL", url.url(), "trash:/1-fileId/subfile" );
int trashId;
- QString fileId;
- QString relativePath;
+ TQString fileId;
+ TQString relativePath;
bool ok = TrashImpl::parseURL( url, trashId, fileId, relativePath );
assert( ok );
- check( "parseURL: trashId", QString::number( trashId ), "1" );
+ check( "parseURL: trashId", TQString::number( trashId ), "1" );
check( "parseURL: fileId", fileId, "fileId" );
check( "parseURL: relativePath", relativePath, "subfile" );
}
@@ -359,54 +359,54 @@ void TestTrash::urlTestSubDirectory()
check( "makeURL", url.url(), "trash:/1-fileId/subfile/foobar" );
int trashId;
- QString fileId;
- QString relativePath;
+ TQString fileId;
+ TQString relativePath;
bool ok = TrashImpl::parseURL( url, trashId, fileId, relativePath );
assert( ok );
- check( "parseURL: trashId", QString::number( trashId ), "1" );
+ check( "parseURL: trashId", TQString::number( trashId ), "1" );
check( "parseURL: fileId", fileId, "fileId" );
check( "parseURL: relativePath", relativePath, "subfile/foobar" );
}
-static void checkInfoFile( const QString& infoPath, const QString& origFilePath )
+static void checkInfoFile( const TQString& infoPath, const TQString& origFilePath )
{
kdDebug() << k_funcinfo << infoPath << endl;
- QFileInfo info( infoPath );
+ TQFileInfo info( infoPath );
assert( info.exists() );
assert( info.isFile() );
KSimpleConfig infoFile( info.absFilePath(), true );
if ( !infoFile.hasGroup( "Trash Info" ) )
kdFatal() << "no Trash Info group in " << info.absFilePath() << endl;
infoFile.setGroup( "Trash Info" );
- const QString origPath = infoFile.readEntry( "Path" );
+ const TQString origPath = infoFile.readEntry( "Path" );
assert( !origPath.isEmpty() );
assert( origPath == KURL::encode_string( origFilePath, KGlobal::locale()->fileEncodingMib() ) );
- const QString date = infoFile.readEntry( "DeletionDate" );
+ const TQString date = infoFile.readEntry( "DeletionDate" );
assert( !date.isEmpty() );
assert( date.contains( "T" ) );
}
-static void createTestFile( const QString& path )
+static void createTestFile( const TQString& path )
{
- QFile f( path );
+ TQFile f( path );
if ( !f.open( IO_WriteOnly ) )
kdFatal() << "Can't create " << path << endl;
f.writeBlock( "Hello world\n", 12 );
f.close();
- assert( QFile::exists( path ) );
+ assert( TQFile::exists( path ) );
}
-void TestTrash::trashFile( const QString& origFilePath, const QString& fileId )
+void TestTrash::trashFile( const TQString& origFilePath, const TQString& fileId )
{
// setup
- if ( !QFile::exists( origFilePath ) )
+ if ( !TQFile::exists( origFilePath ) )
createTestFile( origFilePath );
KURL u;
u.setPath( origFilePath );
// test
KIO::Job* job = KIO::move( u, "trash:/" );
- QMap<QString, QString> metaData;
+ TQMap<TQString, TQString> metaData;
//bool ok = KIO::NetAccess::move( u, "trash:/" );
bool ok = KIO::NetAccess::synchronousRun( job, 0, 0, 0, &metaData );
if ( !ok )
@@ -417,20 +417,20 @@ void TestTrash::trashFile( const QString& origFilePath, const QString& fileId )
} else {
checkInfoFile( m_trashDir + "/info/" + fileId + ".trashinfo", origFilePath );
- QFileInfo files( m_trashDir + "/files/" + fileId );
+ TQFileInfo files( m_trashDir + "/files/" + fileId );
assert( files.isFile() );
assert( files.size() == 12 );
}
// coolo suggests testing that the original file is actually gone, too :)
- assert( !QFile::exists( origFilePath ) );
+ assert( !TQFile::exists( origFilePath ) );
assert( !metaData.isEmpty() );
bool found = false;
- QMap<QString, QString>::ConstIterator it = metaData.begin();
+ TQMap<TQString, TQString>::ConstIterator it = metaData.begin();
for ( ; it != metaData.end() ; ++it ) {
if ( it.key().startsWith( "trashURL" ) ) {
- const QString origPath = it.key().mid( 9 );
+ const TQString origPath = it.key().mid( 9 );
KURL trashURL( it.data() );
kdDebug() << trashURL << endl;
assert( !trashURL.isEmpty() );
@@ -438,7 +438,7 @@ void TestTrash::trashFile( const QString& origFilePath, const QString& fileId )
int trashId = 0;
if ( origFilePath.startsWith( "/tmp" ) && m_tmpIsWritablePartition )
trashId = m_tmpTrashId;
- assert( trashURL.path() == "/" + QString::number( trashId ) + "-" + fileId );
+ assert( trashURL.path() == "/" + TQString::number( trashId ) + "-" + fileId );
found = true;
}
}
@@ -448,7 +448,7 @@ void TestTrash::trashFile( const QString& origFilePath, const QString& fileId )
void TestTrash::trashFileFromHome()
{
kdDebug() << k_funcinfo << endl;
- const QString fileName = "fileFromHome";
+ const TQString fileName = "fileFromHome";
trashFile( homeTmpDir() + fileName, fileName );
// Do it again, check that we got a different id
@@ -458,21 +458,21 @@ void TestTrash::trashFileFromHome()
void TestTrash::trashPercentFileFromHome()
{
kdDebug() << k_funcinfo << endl;
- const QString fileName = "file%2f";
+ const TQString fileName = "file%2f";
trashFile( homeTmpDir() + fileName, fileName );
}
void TestTrash::trashUtf8FileFromHome()
{
kdDebug() << k_funcinfo << endl;
- const QString fileName = utf8FileName();
+ const TQString fileName = utf8FileName();
trashFile( homeTmpDir() + fileName, fileName );
}
void TestTrash::trashUmlautFileFromHome()
{
kdDebug() << k_funcinfo << endl;
- const QString fileName = umlautFileName();
+ const TQString fileName = umlautFileName();
trashFile( homeTmpDir() + fileName, fileName );
}
@@ -487,7 +487,7 @@ void TestTrash::testTrashNotEmpty()
void TestTrash::trashFileFromOther()
{
kdDebug() << k_funcinfo << endl;
- const QString fileName = "fileFromOther";
+ const TQString fileName = "fileFromOther";
trashFile( otherTmpDir() + fileName, fileName );
}
@@ -498,45 +498,45 @@ void TestTrash::trashFileIntoOtherPartition()
return;
}
kdDebug() << k_funcinfo << endl;
- const QString fileName = "testtrash-file";
- const QString origFilePath = m_otherPartitionTopDir + fileName;
- const QString fileId = fileName;
+ const TQString fileName = "testtrash-file";
+ const TQString origFilePath = m_otherPartitionTopDir + fileName;
+ const TQString fileId = fileName;
// cleanup
- QFile::remove( m_otherPartitionTrashDir + "/info/" + fileId + ".trashinfo" );
- QFile::remove( m_otherPartitionTrashDir + "/files/" + fileId );
+ TQFile::remove( m_otherPartitionTrashDir + "/info/" + fileId + ".trashinfo" );
+ TQFile::remove( m_otherPartitionTrashDir + "/files/" + fileId );
// setup
- if ( !QFile::exists( origFilePath ) )
+ if ( !TQFile::exists( origFilePath ) )
createTestFile( origFilePath );
KURL u;
u.setPath( origFilePath );
// test
KIO::Job* job = KIO::move( u, "trash:/" );
- QMap<QString, QString> metaData;
+ TQMap<TQString, TQString> metaData;
bool ok = KIO::NetAccess::synchronousRun( job, 0, 0, 0, &metaData );
assert( ok );
// Note that the Path stored in the info file is relative, on other partitions (#95652)
checkInfoFile( m_otherPartitionTrashDir + "/info/" + fileId + ".trashinfo", fileName );
- QFileInfo files( m_otherPartitionTrashDir + "/files/" + fileId );
+ TQFileInfo files( m_otherPartitionTrashDir + "/files/" + fileId );
assert( files.isFile() );
assert( files.size() == 12 );
// coolo suggests testing that the original file is actually gone, too :)
- assert( !QFile::exists( origFilePath ) );
+ assert( !TQFile::exists( origFilePath ) );
assert( !metaData.isEmpty() );
bool found = false;
- QMap<QString, QString>::ConstIterator it = metaData.begin();
+ TQMap<TQString, TQString>::ConstIterator it = metaData.begin();
for ( ; it != metaData.end() ; ++it ) {
if ( it.key().startsWith( "trashURL" ) ) {
- const QString origPath = it.key().mid( 9 );
+ const TQString origPath = it.key().mid( 9 );
KURL trashURL( it.data() );
kdDebug() << trashURL << endl;
assert( !trashURL.isEmpty() );
assert( trashURL.protocol() == "trash" );
- assert( trashURL.path() == QString( "/%1-%2" ).arg( m_otherPartitionId ).arg( fileId ) );
+ assert( trashURL.path() == TQString( "/%1-%2" ).arg( m_otherPartitionId ).arg( fileId ) );
found = true;
}
}
@@ -548,30 +548,30 @@ void TestTrash::trashFileOwnedByRoot()
kdDebug() << k_funcinfo << endl;
KURL u;
u.setPath( "/etc/passwd" );
- const QString fileId = "passwd";
+ const TQString fileId = "passwd";
KIO::CopyJob* job = KIO::move( u, "trash:/" );
job->setInteractive( false ); // no skip dialog, thanks
- QMap<QString, QString> metaData;
+ TQMap<TQString, TQString> metaData;
//bool ok = KIO::NetAccess::move( u, "trash:/" );
bool ok = KIO::NetAccess::synchronousRun( job, 0, 0, 0, &metaData );
assert( !ok );
assert( KIO::NetAccess::lastError() == KIO::ERR_ACCESS_DENIED );
- const QString infoPath( m_trashDir + "/info/" + fileId + ".trashinfo" );
- assert( !QFile::exists( infoPath ) );
+ const TQString infoPath( m_trashDir + "/info/" + fileId + ".trashinfo" );
+ assert( !TQFile::exists( infoPath ) );
- QFileInfo files( m_trashDir + "/files/" + fileId );
+ TQFileInfo files( m_trashDir + "/files/" + fileId );
assert( !files.exists() );
- assert( QFile::exists( u.path() ) );
+ assert( TQFile::exists( u.path() ) );
}
-void TestTrash::trashSymlink( const QString& origFilePath, const QString& fileId, bool broken )
+void TestTrash::trashSymlink( const TQString& origFilePath, const TQString& fileId, bool broken )
{
kdDebug() << k_funcinfo << endl;
// setup
const char* target = broken ? "/nonexistent" : "/tmp";
- bool ok = ::symlink( target, QFile::encodeName( origFilePath ) ) == 0;
+ bool ok = ::symlink( target, TQFile::encodeName( origFilePath ) ) == 0;
assert( ok );
KURL u;
u.setPath( origFilePath );
@@ -585,39 +585,39 @@ void TestTrash::trashSymlink( const QString& origFilePath, const QString& fileId
}
checkInfoFile( m_trashDir + "/info/" + fileId + ".trashinfo", origFilePath );
- QFileInfo files( m_trashDir + "/files/" + fileId );
+ TQFileInfo files( m_trashDir + "/files/" + fileId );
assert( files.isSymLink() );
- assert( files.readLink() == QFile::decodeName( target ) );
- assert( !QFile::exists( origFilePath ) );
+ assert( files.readLink() == TQFile::decodeName( target ) );
+ assert( !TQFile::exists( origFilePath ) );
}
void TestTrash::trashSymlinkFromHome()
{
kdDebug() << k_funcinfo << endl;
- const QString fileName = "symlinkFromHome";
+ const TQString fileName = "symlinkFromHome";
trashSymlink( homeTmpDir() + fileName, fileName, false );
}
void TestTrash::trashSymlinkFromOther()
{
kdDebug() << k_funcinfo << endl;
- const QString fileName = "symlinkFromOther";
+ const TQString fileName = "symlinkFromOther";
trashSymlink( otherTmpDir() + fileName, fileName, false );
}
void TestTrash::trashBrokenSymlinkFromHome()
{
kdDebug() << k_funcinfo << endl;
- const QString fileName = "brokenSymlinkFromHome";
+ const TQString fileName = "brokenSymlinkFromHome";
trashSymlink( homeTmpDir() + fileName, fileName, true );
}
-void TestTrash::trashDirectory( const QString& origPath, const QString& fileId )
+void TestTrash::trashDirectory( const TQString& origPath, const TQString& fileId )
{
kdDebug() << k_funcinfo << fileId << endl;
// setup
- if ( !QFileInfo( origPath ).exists() ) {
- QDir dir;
+ if ( !TQFileInfo( origPath ).exists() ) {
+ TQDir dir;
bool ok = dir.mkdir( origPath );
Q_ASSERT( ok );
}
@@ -633,19 +633,19 @@ void TestTrash::trashDirectory( const QString& origPath, const QString& fileId )
}
checkInfoFile( m_trashDir + "/info/" + fileId + ".trashinfo", origPath );
- QFileInfo filesDir( m_trashDir + "/files/" + fileId );
+ TQFileInfo filesDir( m_trashDir + "/files/" + fileId );
assert( filesDir.isDir() );
- QFileInfo files( m_trashDir + "/files/" + fileId + "/testfile" );
+ TQFileInfo files( m_trashDir + "/files/" + fileId + "/testfile" );
assert( files.exists() );
assert( files.isFile() );
assert( files.size() == 12 );
- assert( !QFile::exists( origPath ) );
+ assert( !TQFile::exists( origPath ) );
}
void TestTrash::trashDirectoryFromHome()
{
kdDebug() << k_funcinfo << endl;
- QString dirName = "trashDirFromHome";
+ TQString dirName = "trashDirFromHome";
trashDirectory( homeTmpDir() + dirName, dirName );
// Do it again, check that we got a different id
trashDirectory( homeTmpDir() + dirName, dirName + "_1" );
@@ -654,16 +654,16 @@ void TestTrash::trashDirectoryFromHome()
void TestTrash::trashReadOnlyDirFromHome()
{
kdDebug() << k_funcinfo << endl;
- const QString dirName = readOnlyDirPath();
- QDir dir;
+ const TQString dirName = readOnlyDirPath();
+ TQDir dir;
bool ok = dir.mkdir( dirName );
Q_ASSERT( ok );
// #130780
- const QString subDirPath = dirName + "/readonly_subdir";
+ const TQString subDirPath = dirName + "/readonly_subdir";
ok = dir.mkdir( subDirPath );
Q_ASSERT( ok );
createTestFile( subDirPath + "/testfile_in_subdir" );
- ::chmod( QFile::encodeName( subDirPath ), 0500 );
+ ::chmod( TQFile::encodeName( subDirPath ), 0500 );
trashDirectory( dirName, "readonly" );
}
@@ -671,7 +671,7 @@ void TestTrash::trashReadOnlyDirFromHome()
void TestTrash::trashDirectoryFromOther()
{
kdDebug() << k_funcinfo << endl;
- QString dirName = "trashDirFromOther";
+ TQString dirName = "trashDirFromOther";
trashDirectory( otherTmpDir() + dirName, dirName );
}
@@ -696,13 +696,13 @@ void TestTrash::delRootFile()
bool ok = KIO::NetAccess::del( "trash:/0-fileFromHome", 0L );
assert( ok );
- QFileInfo file( m_trashDir + "/files/fileFromHome" );
+ TQFileInfo file( m_trashDir + "/files/fileFromHome" );
assert( !file.exists() );
- QFileInfo info( m_trashDir + "/info/fileFromHome.trashinfo" );
+ TQFileInfo info( m_trashDir + "/info/fileFromHome.trashinfo" );
assert( !info.exists() );
// trash it again, we might need it later
- const QString fileName = "fileFromHome";
+ const TQString fileName = "fileFromHome";
trashFile( homeTmpDir() + fileName, fileName );
}
@@ -715,11 +715,11 @@ void TestTrash::delFileInDirectory()
assert( !ok );
assert( KIO::NetAccess::lastError() == KIO::ERR_ACCESS_DENIED );
- QFileInfo dir( m_trashDir + "/files/trashDirFromHome" );
+ TQFileInfo dir( m_trashDir + "/files/trashDirFromHome" );
assert( dir.exists() );
- QFileInfo file( m_trashDir + "/files/trashDirFromHome/testfile" );
+ TQFileInfo file( m_trashDir + "/files/trashDirFromHome/testfile" );
assert( file.exists() );
- QFileInfo info( m_trashDir + "/info/trashDirFromHome.trashinfo" );
+ TQFileInfo info( m_trashDir + "/info/trashDirFromHome.trashinfo" );
assert( info.exists() );
}
@@ -731,15 +731,15 @@ void TestTrash::delDirectory()
bool ok = KIO::NetAccess::del( "trash:/0-trashDirFromHome", 0L );
assert( ok );
- QFileInfo dir( m_trashDir + "/files/trashDirFromHome" );
+ TQFileInfo dir( m_trashDir + "/files/trashDirFromHome" );
assert( !dir.exists() );
- QFileInfo file( m_trashDir + "/files/trashDirFromHome/testfile" );
+ TQFileInfo file( m_trashDir + "/files/trashDirFromHome/testfile" );
assert( !file.exists() );
- QFileInfo info( m_trashDir + "/info/trashDirFromHome.trashinfo" );
+ TQFileInfo info( m_trashDir + "/info/trashDirFromHome.trashinfo" );
assert( !info.exists() );
// trash it again, we'll need it later
- QString dirName = "trashDirFromHome";
+ TQString dirName = "trashDirFromHome";
trashDirectory( homeTmpDir() + dirName, dirName );
}
@@ -829,7 +829,7 @@ void TestTrash::statFileInDirectory()
assert( !item.acceptsDrops() );
}
-void TestTrash::copyFromTrash( const QString& fileId, const QString& destPath, const QString& relativePath )
+void TestTrash::copyFromTrash( const TQString& fileId, const TQString& destPath, const TQString& relativePath )
{
KURL src( "trash:/0-" + fileId );
if ( !relativePath.isEmpty() )
@@ -837,57 +837,57 @@ void TestTrash::copyFromTrash( const QString& fileId, const QString& destPath, c
KURL dest;
dest.setPath( destPath );
- assert( KIO::NetAccess::exists( src, true, (QWidget*)0 ) );
+ assert( KIO::NetAccess::exists( src, true, (TQWidget*)0 ) );
// A dnd would use copy(), but we use copyAs to ensure the final filename
//kdDebug() << k_funcinfo << "copyAs:" << src << " -> " << dest << endl;
KIO::Job* job = KIO::copyAs( src, dest );
bool ok = KIO::NetAccess::synchronousRun( job, 0 );
assert( ok );
- QString infoFile( m_trashDir + "/info/" + fileId + ".trashinfo" );
- assert( QFile::exists( infoFile ) );
+ TQString infoFile( m_trashDir + "/info/" + fileId + ".trashinfo" );
+ assert( TQFile::exists( infoFile ) );
- QFileInfo filesItem( m_trashDir + "/files/" + fileId );
+ TQFileInfo filesItem( m_trashDir + "/files/" + fileId );
assert( filesItem.exists() );
- assert( QFile::exists( destPath ) );
+ assert( TQFile::exists( destPath ) );
}
void TestTrash::copyFileFromTrash()
{
kdDebug() << k_funcinfo << endl;
- const QString destPath = otherTmpDir() + "fileFromHome_copied";
+ const TQString destPath = otherTmpDir() + "fileFromHome_copied";
copyFromTrash( "fileFromHome", destPath );
- assert( QFileInfo( destPath ).isFile() );
- assert( QFileInfo( destPath ).size() == 12 );
+ assert( TQFileInfo( destPath ).isFile() );
+ assert( TQFileInfo( destPath ).size() == 12 );
}
void TestTrash::copyFileInDirectoryFromTrash()
{
kdDebug() << k_funcinfo << endl;
- const QString destPath = otherTmpDir() + "testfile_copied";
+ const TQString destPath = otherTmpDir() + "testfile_copied";
copyFromTrash( "trashDirFromHome", destPath, "testfile" );
- assert( QFileInfo( destPath ).isFile() );
- assert( QFileInfo( destPath ).size() == 12 );
+ assert( TQFileInfo( destPath ).isFile() );
+ assert( TQFileInfo( destPath ).size() == 12 );
}
void TestTrash::copyDirectoryFromTrash()
{
kdDebug() << k_funcinfo << endl;
- const QString destPath = otherTmpDir() + "trashDirFromHome_copied";
+ const TQString destPath = otherTmpDir() + "trashDirFromHome_copied";
copyFromTrash( "trashDirFromHome", destPath );
- assert( QFileInfo( destPath ).isDir() );
+ assert( TQFileInfo( destPath ).isDir() );
}
void TestTrash::copySymlinkFromTrash()
{
kdDebug() << k_funcinfo << endl;
- const QString destPath = otherTmpDir() + "symlinkFromHome_copied";
+ const TQString destPath = otherTmpDir() + "symlinkFromHome_copied";
copyFromTrash( "symlinkFromHome", destPath );
- assert( QFileInfo( destPath ).isSymLink() );
+ assert( TQFileInfo( destPath ).isSymLink() );
}
-void TestTrash::moveFromTrash( const QString& fileId, const QString& destPath, const QString& relativePath )
+void TestTrash::moveFromTrash( const TQString& fileId, const TQString& destPath, const TQString& relativePath )
{
KURL src( "trash:/0-" + fileId );
if ( !relativePath.isEmpty() )
@@ -895,106 +895,106 @@ void TestTrash::moveFromTrash( const QString& fileId, const QString& destPath, c
KURL dest;
dest.setPath( destPath );
- assert( KIO::NetAccess::exists( src, true, (QWidget*)0 ) );
+ assert( KIO::NetAccess::exists( src, true, (TQWidget*)0 ) );
// A dnd would use move(), but we use moveAs to ensure the final filename
KIO::Job* job = KIO::moveAs( src, dest );
bool ok = KIO::NetAccess::synchronousRun( job, 0 );
assert( ok );
- QString infoFile( m_trashDir + "/info/" + fileId + ".trashinfo" );
- assert( !QFile::exists( infoFile ) );
+ TQString infoFile( m_trashDir + "/info/" + fileId + ".trashinfo" );
+ assert( !TQFile::exists( infoFile ) );
- QFileInfo filesItem( m_trashDir + "/files/" + fileId );
+ TQFileInfo filesItem( m_trashDir + "/files/" + fileId );
assert( !filesItem.exists() );
- assert( QFile::exists( destPath ) );
+ assert( TQFile::exists( destPath ) );
}
void TestTrash::moveFileFromTrash()
{
kdDebug() << k_funcinfo << endl;
- const QString destPath = otherTmpDir() + "fileFromHome_restored";
+ const TQString destPath = otherTmpDir() + "fileFromHome_restored";
moveFromTrash( "fileFromHome", destPath );
- assert( QFileInfo( destPath ).isFile() );
- assert( QFileInfo( destPath ).size() == 12 );
+ assert( TQFileInfo( destPath ).isFile() );
+ assert( TQFileInfo( destPath ).size() == 12 );
// trash it again for later
- const QString fileName = "fileFromHome";
+ const TQString fileName = "fileFromHome";
trashFile( homeTmpDir() + fileName, fileName );
}
void TestTrash::moveFileInDirectoryFromTrash()
{
kdDebug() << k_funcinfo << endl;
- const QString destPath = otherTmpDir() + "testfile_restored";
+ const TQString destPath = otherTmpDir() + "testfile_restored";
copyFromTrash( "trashDirFromHome", destPath, "testfile" );
- assert( QFileInfo( destPath ).isFile() );
- assert( QFileInfo( destPath ).size() == 12 );
+ assert( TQFileInfo( destPath ).isFile() );
+ assert( TQFileInfo( destPath ).size() == 12 );
}
void TestTrash::moveDirectoryFromTrash()
{
kdDebug() << k_funcinfo << endl;
- const QString destPath = otherTmpDir() + "trashDirFromHome_restored";
+ const TQString destPath = otherTmpDir() + "trashDirFromHome_restored";
moveFromTrash( "trashDirFromHome", destPath );
- assert( QFileInfo( destPath ).isDir() );
+ assert( TQFileInfo( destPath ).isDir() );
// trash it again, we'll need it later
- QString dirName = "trashDirFromHome";
+ TQString dirName = "trashDirFromHome";
trashDirectory( homeTmpDir() + dirName, dirName );
}
void TestTrash::trashDirectoryOwnedByRoot()
{
KURL u;
- if ( QFile::exists( "/etc/cups" ) )
+ if ( TQFile::exists( "/etc/cups" ) )
u.setPath( "/etc/cups" );
- else if ( QFile::exists( "/boot" ) )
+ else if ( TQFile::exists( "/boot" ) )
u.setPath( "/boot" );
else
u.setPath( "/etc" );
- const QString fileId = u.path();
+ const TQString fileId = u.path();
kdDebug() << k_funcinfo << "fileId=" << fileId << endl;
KIO::CopyJob* job = KIO::move( u, "trash:/" );
job->setInteractive( false ); // no skip dialog, thanks
- QMap<QString, QString> metaData;
+ TQMap<TQString, TQString> metaData;
bool ok = KIO::NetAccess::synchronousRun( job, 0, 0, 0, &metaData );
assert( !ok );
const int err = KIO::NetAccess::lastError();
assert( err == KIO::ERR_ACCESS_DENIED
|| err == KIO::ERR_CANNOT_OPEN_FOR_READING );
- const QString infoPath( m_trashDir + "/info/" + fileId + ".trashinfo" );
- assert( !QFile::exists( infoPath ) );
+ const TQString infoPath( m_trashDir + "/info/" + fileId + ".trashinfo" );
+ assert( !TQFile::exists( infoPath ) );
- QFileInfo files( m_trashDir + "/files/" + fileId );
+ TQFileInfo files( m_trashDir + "/files/" + fileId );
assert( !files.exists() );
- assert( QFile::exists( u.path() ) );
+ assert( TQFile::exists( u.path() ) );
}
void TestTrash::moveSymlinkFromTrash()
{
kdDebug() << k_funcinfo << endl;
- const QString destPath = otherTmpDir() + "symlinkFromHome_restored";
+ const TQString destPath = otherTmpDir() + "symlinkFromHome_restored";
moveFromTrash( "symlinkFromHome", destPath );
- assert( QFileInfo( destPath ).isSymLink() );
+ assert( TQFileInfo( destPath ).isSymLink() );
}
void TestTrash::getFile()
{
kdDebug() << k_funcinfo << endl;
- const QString fileId = "fileFromHome_1";
- const KURL url = TrashImpl::makeURL( 0, fileId, QString::null );
- QString tmpFile;
+ const TQString fileId = "fileFromHome_1";
+ const KURL url = TrashImpl::makeURL( 0, fileId, TQString::null );
+ TQString tmpFile;
bool ok = KIO::NetAccess::download( url, tmpFile, 0 );
assert( ok );
- QFile file( tmpFile );
+ TQFile file( tmpFile );
ok = file.open( IO_ReadOnly );
assert( ok );
- QByteArray str = file.readAll();
- QCString cstr( str.data(), str.size() + 1 );
+ TQByteArray str = file.readAll();
+ TQCString cstr( str.data(), str.size() + 1 );
if ( cstr != "Hello world\n" )
kdFatal() << "get() returned the following data:" << cstr << endl;
file.close();
@@ -1004,43 +1004,43 @@ void TestTrash::getFile()
void TestTrash::restoreFile()
{
kdDebug() << k_funcinfo << endl;
- const QString fileId = "fileFromHome_1";
- const KURL url = TrashImpl::makeURL( 0, fileId, QString::null );
- const QString infoFile( m_trashDir + "/info/" + fileId + ".trashinfo" );
- const QString filesItem( m_trashDir + "/files/" + fileId );
+ const TQString fileId = "fileFromHome_1";
+ const KURL url = TrashImpl::makeURL( 0, fileId, TQString::null );
+ const TQString infoFile( m_trashDir + "/info/" + fileId + ".trashinfo" );
+ const TQString filesItem( m_trashDir + "/files/" + fileId );
- assert( QFile::exists( infoFile ) );
- assert( QFile::exists( filesItem ) );
+ assert( TQFile::exists( infoFile ) );
+ assert( TQFile::exists( filesItem ) );
- QByteArray packedArgs;
- QDataStream stream( packedArgs, IO_WriteOnly );
+ TQByteArray packedArgs;
+ TQDataStream stream( packedArgs, IO_WriteOnly );
stream << (int)3 << url;
KIO::Job* job = KIO::special( url, packedArgs );
bool ok = KIO::NetAccess::synchronousRun( job, 0 );
assert( ok );
- assert( !QFile::exists( infoFile ) );
- assert( !QFile::exists( filesItem ) );
+ assert( !TQFile::exists( infoFile ) );
+ assert( !TQFile::exists( filesItem ) );
- const QString destPath = homeTmpDir() + "fileFromHome";
- assert( QFile::exists( destPath ) );
+ const TQString destPath = homeTmpDir() + "fileFromHome";
+ assert( TQFile::exists( destPath ) );
}
void TestTrash::restoreFileFromSubDir()
{
kdDebug() << k_funcinfo << endl;
- const QString fileId = "trashDirFromHome_1/testfile";
- assert( !QFile::exists( homeTmpDir() + "trashDirFromHome_1" ) );
+ const TQString fileId = "trashDirFromHome_1/testfile";
+ assert( !TQFile::exists( homeTmpDir() + "trashDirFromHome_1" ) );
- const KURL url = TrashImpl::makeURL( 0, fileId, QString::null );
- const QString infoFile( m_trashDir + "/info/trashDirFromHome_1.trashinfo" );
- const QString filesItem( m_trashDir + "/files/trashDirFromHome_1/testfile" );
+ const KURL url = TrashImpl::makeURL( 0, fileId, TQString::null );
+ const TQString infoFile( m_trashDir + "/info/trashDirFromHome_1.trashinfo" );
+ const TQString filesItem( m_trashDir + "/files/trashDirFromHome_1/testfile" );
- assert( QFile::exists( infoFile ) );
- assert( QFile::exists( filesItem ) );
+ assert( TQFile::exists( infoFile ) );
+ assert( TQFile::exists( filesItem ) );
- QByteArray packedArgs;
- QDataStream stream( packedArgs, IO_WriteOnly );
+ TQByteArray packedArgs;
+ TQDataStream stream( packedArgs, IO_WriteOnly );
stream << (int)3 << url;
KIO::Job* job = KIO::special( url, packedArgs );
bool ok = KIO::NetAccess::synchronousRun( job, 0 );
@@ -1049,9 +1049,9 @@ void TestTrash::restoreFileFromSubDir()
assert( KIO::NetAccess::lastError() == KIO::ERR_SLAVE_DEFINED );
// check that nothing happened
- assert( QFile::exists( infoFile ) );
- assert( QFile::exists( filesItem ) );
- assert( !QFile::exists( homeTmpDir() + "trashDirFromHome_1" ) );
+ assert( TQFile::exists( infoFile ) );
+ assert( TQFile::exists( filesItem ) );
+ assert( !TQFile::exists( homeTmpDir() + "trashDirFromHome_1" ) );
}
void TestTrash::restoreFileToDeletedDirectory()
@@ -1065,16 +1065,16 @@ void TestTrash::restoreFileToDeletedDirectory()
bool delOK = KIO::NetAccess::del( homeTmpDir(), 0 );
assert( delOK );
- const QString fileId = "fileFromHome";
- const KURL url = TrashImpl::makeURL( 0, fileId, QString::null );
- const QString infoFile( m_trashDir + "/info/" + fileId + ".trashinfo" );
- const QString filesItem( m_trashDir + "/files/" + fileId );
+ const TQString fileId = "fileFromHome";
+ const KURL url = TrashImpl::makeURL( 0, fileId, TQString::null );
+ const TQString infoFile( m_trashDir + "/info/" + fileId + ".trashinfo" );
+ const TQString filesItem( m_trashDir + "/files/" + fileId );
- assert( QFile::exists( infoFile ) );
- assert( QFile::exists( filesItem ) );
+ assert( TQFile::exists( infoFile ) );
+ assert( TQFile::exists( filesItem ) );
- QByteArray packedArgs;
- QDataStream stream( packedArgs, IO_WriteOnly );
+ TQByteArray packedArgs;
+ TQDataStream stream( packedArgs, IO_WriteOnly );
stream << (int)3 << url;
KIO::Job* job = KIO::special( url, packedArgs );
bool ok = KIO::NetAccess::synchronousRun( job, 0 );
@@ -1083,11 +1083,11 @@ void TestTrash::restoreFileToDeletedDirectory()
assert( KIO::NetAccess::lastError() == KIO::ERR_SLAVE_DEFINED );
// check that nothing happened
- assert( QFile::exists( infoFile ) );
- assert( QFile::exists( filesItem ) );
+ assert( TQFile::exists( infoFile ) );
+ assert( TQFile::exists( filesItem ) );
- const QString destPath = homeTmpDir() + "fileFromHome";
- assert( !QFile::exists( destPath ) );
+ const TQString destPath = homeTmpDir() + "fileFromHome";
+ assert( !TQFile::exists( destPath ) );
}
void TestTrash::listRootDir()
@@ -1096,8 +1096,8 @@ void TestTrash::listRootDir()
m_entryCount = 0;
m_listResult.clear();
KIO::ListJob* job = KIO::listDir( "trash:/" );
- connect( job, SIGNAL( entries( KIO::Job*, const KIO::UDSEntryList& ) ),
- SLOT( slotEntries( KIO::Job*, const KIO::UDSEntryList& ) ) );
+ connect( job, TQT_SIGNAL( entries( KIO::Job*, const KIO::UDSEntryList& ) ),
+ TQT_SLOT( slotEntries( KIO::Job*, const KIO::UDSEntryList& ) ) );
bool ok = KIO::NetAccess::synchronousRun( job, 0 );
assert( ok );
kdDebug() << "listDir done - m_entryCount=" << m_entryCount << endl;
@@ -1113,8 +1113,8 @@ void TestTrash::listRecursiveRootDir()
m_entryCount = 0;
m_listResult.clear();
KIO::ListJob* job = KIO::listRecursive( "trash:/" );
- connect( job, SIGNAL( entries( KIO::Job*, const KIO::UDSEntryList& ) ),
- SLOT( slotEntries( KIO::Job*, const KIO::UDSEntryList& ) ) );
+ connect( job, TQT_SIGNAL( entries( KIO::Job*, const KIO::UDSEntryList& ) ),
+ TQT_SLOT( slotEntries( KIO::Job*, const KIO::UDSEntryList& ) ) );
bool ok = KIO::NetAccess::synchronousRun( job, 0 );
assert( ok );
kdDebug() << "listDir done - m_entryCount=" << m_entryCount << endl;
@@ -1130,8 +1130,8 @@ void TestTrash::listSubDir()
m_entryCount = 0;
m_listResult.clear();
KIO::ListJob* job = KIO::listDir( "trash:/0-trashDirFromHome" );
- connect( job, SIGNAL( entries( KIO::Job*, const KIO::UDSEntryList& ) ),
- SLOT( slotEntries( KIO::Job*, const KIO::UDSEntryList& ) ) );
+ connect( job, TQT_SIGNAL( entries( KIO::Job*, const KIO::UDSEntryList& ) ),
+ TQT_SLOT( slotEntries( KIO::Job*, const KIO::UDSEntryList& ) ) );
bool ok = KIO::NetAccess::synchronousRun( job, 0 );
assert( ok );
kdDebug() << "listDir done - m_entryCount=" << m_entryCount << endl;
@@ -1146,7 +1146,7 @@ void TestTrash::slotEntries( KIO::Job*, const KIO::UDSEntryList& lst )
{
for( KIO::UDSEntryList::ConstIterator it = lst.begin(); it != lst.end(); ++it ) {
KIO::UDSEntry::ConstIterator it2 = (*it).begin();
- QString displayName;
+ TQString displayName;
KURL url;
for( ; it2 != (*it).end(); it2++ ) {
switch ((*it2).m_uds) {
@@ -1174,8 +1174,8 @@ void TestTrash::emptyTrash()
// So we can't activate this test by default.
#if 0
kdDebug() << k_funcinfo << endl;
- QByteArray packedArgs;
- QDataStream stream( packedArgs, IO_WriteOnly );
+ TQByteArray packedArgs;
+ TQDataStream stream( packedArgs, IO_WriteOnly );
stream << (int)1;
KIO::Job* job = KIO::special( "trash:/", packedArgs );
bool ok = KIO::NetAccess::synchronousRun( job, 0 );
@@ -1186,9 +1186,9 @@ void TestTrash::emptyTrash()
cfg.setGroup( "Status" );
assert( cfg.readBoolEntry( "Empty", false ) == true );
- assert( !QFile::exists( m_trashDir + "/files/fileFromHome" ) );
- assert( !QFile::exists( m_trashDir + "/files/readonly" ) );
- assert( !QFile::exists( m_trashDir + "/info/readonly.trashinfo" ) );
+ assert( !TQFile::exists( m_trashDir + "/files/fileFromHome" ) );
+ assert( !TQFile::exists( m_trashDir + "/files/readonly" ) );
+ assert( !TQFile::exists( m_trashDir + "/info/readonly.trashinfo" ) );
#else
kdDebug() << k_funcinfo << " : SKIPPED" << endl;
diff --git a/kioslave/trash/testtrash.h b/kioslave/trash/testtrash.h
index 70d06dc8b..fd286c945 100644
--- a/kioslave/trash/testtrash.h
+++ b/kioslave/trash/testtrash.h
@@ -20,7 +20,7 @@
#ifndef TESTTRASH_H
#define TESTTRASH_H
-#include <qobject.h>
+#include <tqobject.h>
class TestTrash : public QObject
{
@@ -91,28 +91,28 @@ private slots:
void slotEntries( KIO::Job*, const KIO::UDSEntryList& );
private:
- void trashFile( const QString& origFilePath, const QString& fileId );
- void trashSymlink( const QString& origFilePath, const QString& fileName, bool broken );
- void trashDirectory( const QString& origPath, const QString& fileName );
- void copyFromTrash( const QString& fileId, const QString& destPath, const QString& relativePath = QString::null );
- void moveFromTrash( const QString& fileId, const QString& destPath, const QString& relativePath = QString::null );
-
- QString homeTmpDir() const;
- QString otherTmpDir() const;
- QString utf8FileName() const;
- QString umlautFileName() const;
- QString readOnlyDirPath() const;
-
- QString m_trashDir;
-
- QString m_otherPartitionTopDir;
- QString m_otherPartitionTrashDir;
+ void trashFile( const TQString& origFilePath, const TQString& fileId );
+ void trashSymlink( const TQString& origFilePath, const TQString& fileName, bool broken );
+ void trashDirectory( const TQString& origPath, const TQString& fileName );
+ void copyFromTrash( const TQString& fileId, const TQString& destPath, const TQString& relativePath = TQString::null );
+ void moveFromTrash( const TQString& fileId, const TQString& destPath, const TQString& relativePath = TQString::null );
+
+ TQString homeTmpDir() const;
+ TQString otherTmpDir() const;
+ TQString utf8FileName() const;
+ TQString umlautFileName() const;
+ TQString readOnlyDirPath() const;
+
+ TQString m_trashDir;
+
+ TQString m_otherPartitionTopDir;
+ TQString m_otherPartitionTrashDir;
bool m_tmpIsWritablePartition;
int m_tmpTrashId;
int m_otherPartitionId;
int m_entryCount;
- QStringList m_listResult;
+ TQStringList m_listResult;
};
#endif
diff --git a/kioslave/trash/trashimpl.cpp b/kioslave/trash/trashimpl.cpp
index 9507c77ab..f43e7929f 100644
--- a/kioslave/trash/trashimpl.cpp
+++ b/kioslave/trash/trashimpl.cpp
@@ -35,10 +35,10 @@
#include <dcopref.h>
-#include <qapplication.h>
-#include <qeventloop.h>
-#include <qfile.h>
-#include <qdir.h>
+#include <tqapplication.h>
+#include <tqeventloop.h>
+#include <tqfile.h>
+#include <tqdir.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -50,7 +50,7 @@
#include <errno.h>
TrashImpl::TrashImpl() :
- QObject(),
+ TQObject(),
m_lastErrorCode( 0 ),
m_initStatus( InitToBeDone ),
m_lastId( 0 ),
@@ -62,7 +62,7 @@ TrashImpl::TrashImpl() :
m_config( "trashrc" )
{
KDE_struct_stat buff;
- if ( KDE_lstat( QFile::encodeName( QDir::homeDirPath() ), &buff ) == 0 ) {
+ if ( KDE_lstat( TQFile::encodeName( TQDir::homeDirPath() ), &buff ) == 0 ) {
m_homeDevice = buff.st_dev;
} else {
kdError() << "Should never happen: couldn't stat $HOME " << strerror( errno ) << endl;
@@ -75,15 +75,15 @@ TrashImpl::TrashImpl() :
* @return errorcode, or 0 if the dir was created or existed already
* Warning, don't use return value like a bool
*/
-int TrashImpl::testDir( const QString &_name ) const
+int TrashImpl::testDir( const TQString &_name ) const
{
- DIR *dp = opendir( QFile::encodeName(_name) );
+ DIR *dp = opendir( TQFile::encodeName(_name) );
if ( dp == NULL )
{
- QString name = _name;
+ TQString name = _name;
if ( name.endsWith( "/" ) )
name.truncate( name.length() - 1 );
- QCString path = QFile::encodeName(name);
+ TQCString path = TQFile::encodeName(name);
bool ok = ::mkdir( path, S_IRWXU ) == 0;
if ( !ok && errno == EEXIST ) {
@@ -132,13 +132,13 @@ bool TrashImpl::init()
// see also kdesktop/init.cc for first time initialization
m_initStatus = InitError;
// $XDG_DATA_HOME/Trash, i.e. ~/.local/share/Trash by default.
- const QString xdgDataDir = KGlobal::dirs()->localxdgdatadir();
+ const TQString xdgDataDir = KGlobal::dirs()->localxdgdatadir();
if ( !KStandardDirs::makeDir( xdgDataDir, 0700 ) ) {
kdWarning() << "failed to create " << xdgDataDir << endl;
return false;
}
- const QString trashDir = xdgDataDir + "Trash";
+ const TQString trashDir = xdgDataDir + "Trash";
int err;
if ( ( err = testDir( trashDir ) ) ) {
error( err, trashDir );
@@ -161,17 +161,17 @@ bool TrashImpl::init()
void TrashImpl::migrateOldTrash()
{
kdDebug() << k_funcinfo << endl;
- const QString oldTrashDir = KGlobalSettings::trashPath();
- const QStrList entries = listDir( oldTrashDir );
+ const TQString oldTrashDir = KGlobalSettings::trashPath();
+ const TQStrList entries = listDir( oldTrashDir );
bool allOK = true;
- QStrListIterator entryIt( entries );
+ TQStrListIterator entryIt( entries );
for (; entryIt.current(); ++entryIt) {
- QString srcPath = QFile::decodeName( *entryIt );
+ TQString srcPath = TQFile::decodeName( *entryIt );
if ( srcPath == "." || srcPath == ".." || srcPath == ".directory" )
continue;
srcPath.prepend( oldTrashDir ); // make absolute
int trashId;
- QString fileId;
+ TQString fileId;
if ( !createInfo( srcPath, trashId, fileId ) ) {
kdWarning() << "Trash migration: failed to create info for " << srcPath << endl;
allOK = false;
@@ -193,11 +193,11 @@ void TrashImpl::migrateOldTrash()
}
}
-bool TrashImpl::createInfo( const QString& origPath, int& trashId, QString& fileId )
+bool TrashImpl::createInfo( const TQString& origPath, int& trashId, TQString& fileId )
{
kdDebug() << k_funcinfo << origPath << endl;
// Check source
- const QCString origPath_c( QFile::encodeName( origPath ) );
+ const TQCString origPath_c( TQFile::encodeName( origPath ) );
KDE_struct_stat buff_src;
if ( KDE_lstat( origPath_c.data(), &buff_src ) == -1 ) {
if ( errno == EACCES )
@@ -218,7 +218,7 @@ bool TrashImpl::createInfo( const QString& origPath, int& trashId, QString& file
// Grab original filename
KURL url;
url.setPath( origPath );
- const QString origFileName = url.fileName();
+ const TQString origFileName = url.fileName();
// Make destination file in info/
url.setPath( infoPath( trashId, origFileName ) ); // we first try with origFileName
@@ -228,7 +228,7 @@ bool TrashImpl::createInfo( const QString& origPath, int& trashId, QString& file
int fd = 0;
do {
kdDebug() << k_funcinfo << "trying to create " << url.path() << endl;
- fd = ::open( QFile::encodeName( url.path() ), O_WRONLY | O_CREAT | O_EXCL, 0600 );
+ fd = ::open( TQFile::encodeName( url.path() ), O_WRONLY | O_CREAT | O_EXCL, 0600 );
if ( fd < 0 ) {
if ( errno == EEXIST ) {
url.setFileName( KIO::RenameDlg::suggestName( baseDirectory, url.fileName() ) );
@@ -239,7 +239,7 @@ bool TrashImpl::createInfo( const QString& origPath, int& trashId, QString& file
}
}
} while ( fd < 0 );
- const QString infoPath = url.path();
+ const TQString infoPath = url.path();
fileId = url.fileName();
Q_ASSERT( fileId.endsWith( ".trashinfo" ) );
fileId.truncate( fileId.length() - 10 ); // remove .trashinfo from fileId
@@ -252,7 +252,7 @@ bool TrashImpl::createInfo( const QString& origPath, int& trashId, QString& file
// Contents of the info file. We could use KSimpleConfig, but that would
// mean closing and reopening fd, i.e. opening a race condition...
- QCString info = "[Trash Info]\n";
+ TQCString info = "[Trash Info]\n";
info += "Path=";
// Escape filenames according to the way they are encoded on the filesystem
// All this to basically get back to the raw 8-bit representation of the filename...
@@ -262,14 +262,14 @@ bool TrashImpl::createInfo( const QString& origPath, int& trashId, QString& file
info += KURL::encode_string( makeRelativePath( topDirectoryPath( trashId ), origPath ), m_mibEnum ).latin1();
info += "\n";
info += "DeletionDate=";
- info += QDateTime::currentDateTime().toString( Qt::ISODate ).latin1();
+ info += TQDateTime::currentDateTime().toString( Qt::ISODate ).latin1();
info += "\n";
size_t sz = info.size() - 1; // avoid trailing 0 from QCString
size_t written = ::fwrite(info.data(), 1, sz, file);
if ( written != sz ) {
::fclose( file );
- QFile::remove( infoPath );
+ TQFile::remove( infoPath );
error( KIO::ERR_DISK_FULL, infoPath );
return false;
}
@@ -280,12 +280,12 @@ bool TrashImpl::createInfo( const QString& origPath, int& trashId, QString& file
return true;
}
-QString TrashImpl::makeRelativePath( const QString& topdir, const QString& path )
+TQString TrashImpl::makeRelativePath( const TQString& topdir, const TQString& path )
{
- const QString realPath = KStandardDirs::realFilePath( path );
+ const TQString realPath = KStandardDirs::realFilePath( path );
// topdir ends with '/'
if ( realPath.startsWith( topdir ) ) {
- const QString rel = realPath.mid( topdir.length() );
+ const TQString rel = realPath.mid( topdir.length() );
Q_ASSERT( rel[0] != '/' );
return rel;
} else { // shouldn't happen...
@@ -294,40 +294,40 @@ QString TrashImpl::makeRelativePath( const QString& topdir, const QString& path
}
}
-QString TrashImpl::infoPath( int trashId, const QString& fileId ) const
+TQString TrashImpl::infoPath( int trashId, const TQString& fileId ) const
{
- QString trashPath = trashDirectoryPath( trashId );
+ TQString trashPath = trashDirectoryPath( trashId );
trashPath += "/info/";
trashPath += fileId;
trashPath += ".trashinfo";
return trashPath;
}
-QString TrashImpl::filesPath( int trashId, const QString& fileId ) const
+TQString TrashImpl::filesPath( int trashId, const TQString& fileId ) const
{
- QString trashPath = trashDirectoryPath( trashId );
+ TQString trashPath = trashDirectoryPath( trashId );
trashPath += "/files/";
trashPath += fileId;
return trashPath;
}
-bool TrashImpl::deleteInfo( int trashId, const QString& fileId )
+bool TrashImpl::deleteInfo( int trashId, const TQString& fileId )
{
- bool ok = QFile::remove( infoPath( trashId, fileId ) );
+ bool ok = TQFile::remove( infoPath( trashId, fileId ) );
if ( ok )
fileRemoved();
return ok;
}
-bool TrashImpl::moveToTrash( const QString& origPath, int trashId, const QString& fileId )
+bool TrashImpl::moveToTrash( const TQString& origPath, int trashId, const TQString& fileId )
{
kdDebug() << k_funcinfo << endl;
- const QString dest = filesPath( trashId, fileId );
+ const TQString dest = filesPath( trashId, fileId );
if ( !move( origPath, dest ) ) {
// Maybe the move failed due to no permissions to delete source.
// In that case, delete dest to keep things consistent, since KIO doesn't do it.
- if ( QFileInfo( dest ).isFile() )
- QFile::remove( dest );
+ if ( TQFileInfo( dest ).isFile() )
+ TQFile::remove( dest );
else
synchronousDel( dest, false, true );
return false;
@@ -336,9 +336,9 @@ bool TrashImpl::moveToTrash( const QString& origPath, int trashId, const QString
return true;
}
-bool TrashImpl::moveFromTrash( const QString& dest, int trashId, const QString& fileId, const QString& relativePath )
+bool TrashImpl::moveFromTrash( const TQString& dest, int trashId, const TQString& fileId, const TQString& relativePath )
{
- QString src = filesPath( trashId, fileId );
+ TQString src = filesPath( trashId, fileId );
if ( !relativePath.isEmpty() ) {
src += '/';
src += relativePath;
@@ -348,7 +348,7 @@ bool TrashImpl::moveFromTrash( const QString& dest, int trashId, const QString&
return true;
}
-bool TrashImpl::move( const QString& src, const QString& dest )
+bool TrashImpl::move( const TQString& src, const TQString& dest )
{
if ( directRename( src, dest ) ) {
// This notification is done by KIO::moveAs when using the code below
@@ -370,8 +370,8 @@ bool TrashImpl::move( const QString& src, const QString& dest )
#ifdef KIO_COPYJOB_HAS_SETINTERACTIVE
job->setInteractive( false );
#endif
- connect( job, SIGNAL( result(KIO::Job *) ),
- this, SLOT( jobFinished(KIO::Job *) ) );
+ connect( job, TQT_SIGNAL( result(KIO::Job *) ),
+ this, TQT_SLOT( jobFinished(KIO::Job *) ) );
qApp->eventLoop()->enterLoop();
return m_lastErrorCode == 0;
@@ -384,19 +384,19 @@ void TrashImpl::jobFinished(KIO::Job* job)
qApp->eventLoop()->exitLoop();
}
-bool TrashImpl::copyToTrash( const QString& origPath, int trashId, const QString& fileId )
+bool TrashImpl::copyToTrash( const TQString& origPath, int trashId, const TQString& fileId )
{
kdDebug() << k_funcinfo << endl;
- const QString dest = filesPath( trashId, fileId );
+ const TQString dest = filesPath( trashId, fileId );
if ( !copy( origPath, dest ) )
return false;
fileAdded();
return true;
}
-bool TrashImpl::copyFromTrash( const QString& dest, int trashId, const QString& fileId, const QString& relativePath )
+bool TrashImpl::copyFromTrash( const TQString& dest, int trashId, const TQString& fileId, const TQString& relativePath )
{
- QString src = filesPath( trashId, fileId );
+ TQString src = filesPath( trashId, fileId );
if ( !relativePath.isEmpty() ) {
src += '/';
src += relativePath;
@@ -404,7 +404,7 @@ bool TrashImpl::copyFromTrash( const QString& dest, int trashId, const QString&
return copy( src, dest );
}
-bool TrashImpl::copy( const QString& src, const QString& dest )
+bool TrashImpl::copy( const TQString& src, const TQString& dest )
{
// kio_file's copy() method is quite complex (in order to be fast), let's just call it...
m_lastErrorCode = 0;
@@ -417,19 +417,19 @@ bool TrashImpl::copy( const QString& src, const QString& dest )
#ifdef KIO_COPYJOB_HAS_SETINTERACTIVE
job->setInteractive( false );
#endif
- connect( job, SIGNAL( result( KIO::Job* ) ),
- this, SLOT( jobFinished( KIO::Job* ) ) );
+ connect( job, TQT_SIGNAL( result( KIO::Job* ) ),
+ this, TQT_SLOT( jobFinished( KIO::Job* ) ) );
qApp->eventLoop()->enterLoop();
return m_lastErrorCode == 0;
}
-bool TrashImpl::directRename( const QString& src, const QString& dest )
+bool TrashImpl::directRename( const TQString& src, const TQString& dest )
{
kdDebug() << k_funcinfo << src << " -> " << dest << endl;
- if ( ::rename( QFile::encodeName( src ), QFile::encodeName( dest ) ) != 0 ) {
+ if ( ::rename( TQFile::encodeName( src ), TQFile::encodeName( dest ) ) != 0 ) {
if (errno == EXDEV) {
- error( KIO::ERR_UNSUPPORTED_ACTION, QString::fromLatin1("rename") );
+ error( KIO::ERR_UNSUPPORTED_ACTION, TQString::fromLatin1("rename") );
} else {
if (( errno == EACCES ) || (errno == EPERM)) {
error( KIO::ERR_ACCESS_DENIED, dest );
@@ -445,10 +445,10 @@ bool TrashImpl::directRename( const QString& src, const QString& dest )
}
#if 0
-bool TrashImpl::mkdir( int trashId, const QString& fileId, int permissions )
+bool TrashImpl::mkdir( int trashId, const TQString& fileId, int permissions )
{
- const QString path = filesPath( trashId, fileId );
- if ( ::mkdir( QFile::encodeName( path ), permissions ) != 0 ) {
+ const TQString path = filesPath( trashId, fileId );
+ if ( ::mkdir( TQFile::encodeName( path ), permissions ) != 0 ) {
if ( errno == EACCES ) {
error( KIO::ERR_ACCESS_DENIED, path );
return false;
@@ -461,18 +461,18 @@ bool TrashImpl::mkdir( int trashId, const QString& fileId, int permissions )
}
} else {
if ( permissions != -1 )
- ::chmod( QFile::encodeName( path ), permissions );
+ ::chmod( TQFile::encodeName( path ), permissions );
}
return true;
}
#endif
-bool TrashImpl::del( int trashId, const QString& fileId )
+bool TrashImpl::del( int trashId, const TQString& fileId )
{
- QString info = infoPath(trashId, fileId);
- QString file = filesPath(trashId, fileId);
+ TQString info = infoPath(trashId, fileId);
+ TQString file = filesPath(trashId, fileId);
- QCString info_c = QFile::encodeName(info);
+ TQCString info_c = TQFile::encodeName(info);
KDE_struct_stat buff;
if ( KDE_lstat( info_c.data(), &buff ) == -1 ) {
@@ -483,18 +483,18 @@ bool TrashImpl::del( int trashId, const QString& fileId )
return false;
}
- if ( !synchronousDel( file, true, QFileInfo(file).isDir() ) )
+ if ( !synchronousDel( file, true, TQFileInfo(file).isDir() ) )
return false;
- QFile::remove( info );
+ TQFile::remove( info );
fileRemoved();
return true;
}
-bool TrashImpl::synchronousDel( const QString& path, bool setLastErrorCode, bool isDir )
+bool TrashImpl::synchronousDel( const TQString& path, bool setLastErrorCode, bool isDir )
{
const int oldErrorCode = m_lastErrorCode;
- const QString oldErrorMsg = m_lastErrorMessage;
+ const TQString oldErrorMsg = m_lastErrorMessage;
KURL url;
url.setPath( path );
@@ -505,16 +505,16 @@ bool TrashImpl::synchronousDel( const QString& path, bool setLastErrorCode, bool
KFileItem fileItem( url, "inode/directory", KFileItem::Unknown );
KFileItemList fileItemList;
fileItemList.append( &fileItem );
- KIO::ChmodJob* chmodJob = KIO::chmod( fileItemList, 0200, 0200, QString::null, QString::null, true /*recursive*/, false /*showProgressInfo*/ );
- connect( chmodJob, SIGNAL( result(KIO::Job *) ),
- this, SLOT( jobFinished(KIO::Job *) ) );
+ KIO::ChmodJob* chmodJob = KIO::chmod( fileItemList, 0200, 0200, TQString::null, TQString::null, true /*recursive*/, false /*showProgressInfo*/ );
+ connect( chmodJob, TQT_SIGNAL( result(KIO::Job *) ),
+ this, TQT_SLOT( jobFinished(KIO::Job *) ) );
qApp->eventLoop()->enterLoop();
}
kdDebug() << k_funcinfo << "deleting " << url << endl;
KIO::DeleteJob *job = KIO::del( url, false, false );
- connect( job, SIGNAL( result(KIO::Job *) ),
- this, SLOT( jobFinished(KIO::Job *) ) );
+ connect( job, TQT_SIGNAL( result(KIO::Job *) ),
+ this, TQT_SLOT( jobFinished(KIO::Job *) ) );
qApp->eventLoop()->enterLoop();
bool ok = m_lastErrorCode == 0;
if ( !setLastErrorCode ) {
@@ -538,9 +538,9 @@ bool TrashImpl::emptyTrash()
const TrashedFileInfoList::const_iterator end = fileInfoList.end();
for ( ; it != end ; ++it ) {
const TrashedFileInfo& info = *it;
- const QString filesPath = info.physicalPath;
+ const TQString filesPath = info.physicalPath;
if ( synchronousDel( filesPath, true, true ) ) {
- QFile::remove( infoPath( info.trashId, info.fileId ) );
+ TQFile::remove( infoPath( info.trashId, info.fileId ) );
} // else error code is set
}
fileRemoved();
@@ -559,17 +559,17 @@ TrashImpl::TrashedFileInfoList TrashImpl::list()
TrashDirMap::const_iterator it = m_trashDirectories.begin();
for ( ; it != m_trashDirectories.end() ; ++it ) {
const int trashId = it.key();
- QString infoPath = it.data();
+ TQString infoPath = it.data();
infoPath += "/info";
// Code taken from kio_file
- QStrList entryNames = listDir( infoPath );
+ TQStrList entryNames = listDir( infoPath );
//char path_buffer[PATH_MAX];
//getcwd(path_buffer, PATH_MAX - 1);
//if ( chdir( infoPathEnc ) )
// continue;
- QStrListIterator entryIt( entryNames );
+ TQStrListIterator entryIt( entryNames );
for (; entryIt.current(); ++entryIt) {
- QString fileName = QFile::decodeName( *entryIt );
+ TQString fileName = TQFile::decodeName( *entryIt );
if ( fileName == "." || fileName == ".." )
continue;
if ( !fileName.endsWith( ".trashinfo" ) ) {
@@ -587,11 +587,11 @@ TrashImpl::TrashedFileInfoList TrashImpl::list()
}
// Returns the entries in a given directory - including "." and ".."
-QStrList TrashImpl::listDir( const QString& physicalPath )
+TQStrList TrashImpl::listDir( const TQString& physicalPath )
{
- const QCString physicalPathEnc = QFile::encodeName( physicalPath );
+ const TQCString physicalPathEnc = TQFile::encodeName( physicalPath );
kdDebug() << k_funcinfo << "listing " << physicalPath << endl;
- QStrList entryNames;
+ TQStrList entryNames;
DIR *dp = opendir( physicalPathEnc );
if ( dp == 0 )
return entryNames;
@@ -602,7 +602,7 @@ QStrList TrashImpl::listDir( const QString& physicalPath )
return entryNames;
}
-bool TrashImpl::infoForFile( int trashId, const QString& fileId, TrashedFileInfo& info )
+bool TrashImpl::infoForFile( int trashId, const TQString& fileId, TrashedFileInfo& info )
{
kdDebug() << k_funcinfo << trashId << " " << fileId << endl;
info.trashId = trashId; // easy :)
@@ -611,7 +611,7 @@ bool TrashImpl::infoForFile( int trashId, const QString& fileId, TrashedFileInfo
return readInfoFile( infoPath( trashId, fileId ), info, trashId );
}
-bool TrashImpl::readInfoFile( const QString& infoPath, TrashedFileInfo& info, int trashId )
+bool TrashImpl::readInfoFile( const TQString& infoPath, TrashedFileInfo& info, int trashId )
{
KSimpleConfig cfg( infoPath, true );
if ( !cfg.hasGroup( "Trash Info" ) ) {
@@ -625,19 +625,19 @@ bool TrashImpl::readInfoFile( const QString& infoPath, TrashedFileInfo& info, in
if ( trashId == 0 )
Q_ASSERT( info.origPath[0] == '/' );
else {
- const QString topdir = topDirectoryPath( trashId ); // includes trailing slash
+ const TQString topdir = topDirectoryPath( trashId ); // includes trailing slash
info.origPath.prepend( topdir );
}
- QString line = cfg.readEntry( "DeletionDate" );
+ TQString line = cfg.readEntry( "DeletionDate" );
if ( !line.isEmpty() ) {
- info.deletionDate = QDateTime::fromString( line, Qt::ISODate );
+ info.deletionDate = TQDateTime::fromString( line, Qt::ISODate );
}
return true;
}
-QString TrashImpl::physicalPath( int trashId, const QString& fileId, const QString& relativePath )
+TQString TrashImpl::physicalPath( int trashId, const TQString& fileId, const TQString& relativePath )
{
- QString filePath = filesPath( trashId, fileId );
+ TQString filePath = filesPath( trashId, fileId );
if ( !relativePath.isEmpty() ) {
filePath += "/";
filePath += relativePath;
@@ -645,7 +645,7 @@ QString TrashImpl::physicalPath( int trashId, const QString& fileId, const QStri
return filePath;
}
-void TrashImpl::error( int e, const QString& s )
+void TrashImpl::error( int e, const TQString& s )
{
if ( e )
kdDebug() << k_funcinfo << e << " " << s << endl;
@@ -660,10 +660,10 @@ bool TrashImpl::isEmpty() const
scanTrashDirectories();
TrashDirMap::const_iterator it = m_trashDirectories.begin();
for ( ; it != m_trashDirectories.end() ; ++it ) {
- QString infoPath = it.data();
+ TQString infoPath = it.data();
infoPath += "/info";
- DIR *dp = opendir( QFile::encodeName( infoPath ) );
+ DIR *dp = opendir( TQFile::encodeName( infoPath ) );
if ( dp )
{
struct dirent *ep;
@@ -704,17 +704,17 @@ void TrashImpl::fileRemoved()
// which will be done by the job soon after this.
}
-int TrashImpl::findTrashDirectory( const QString& origPath )
+int TrashImpl::findTrashDirectory( const TQString& origPath )
{
kdDebug() << k_funcinfo << origPath << endl;
// First check if same device as $HOME, then we use the home trash right away.
KDE_struct_stat buff;
- if ( KDE_lstat( QFile::encodeName( origPath ), &buff ) == 0
+ if ( KDE_lstat( TQFile::encodeName( origPath ), &buff ) == 0
&& buff.st_dev == m_homeDevice )
return 0;
- QString mountPoint = KIO::findPathMountPoint( origPath );
- const QString trashDir = trashForMountPoint( mountPoint, true );
+ TQString mountPoint = KIO::findPathMountPoint( origPath );
+ const TQString trashDir = trashForMountPoint( mountPoint, true );
kdDebug() << "mountPoint=" << mountPoint << " trashDir=" << trashDir << endl;
if ( trashDir.isEmpty() )
return 0; // no trash available on partition
@@ -742,14 +742,14 @@ void TrashImpl::scanTrashDirectories() const
{
const KMountPoint::List lst = KMountPoint::currentMountPoints();
for ( KMountPoint::List::ConstIterator it = lst.begin() ; it != lst.end() ; ++it ) {
- const QCString str = (*it)->mountType().latin1();
+ const TQCString str = (*it)->mountType().latin1();
// Skip pseudo-filesystems, there's no chance we'll find a .Trash on them :)
// ## Maybe we should also skip readonly filesystems
if ( str != "proc" && str != "devfs" && str != "usbdevfs" &&
str != "sysfs" && str != "devpts" && str != "subfs" /* #96259 */ &&
str != "autofs" /* #101116 */ ) {
- QString topdir = (*it)->mountPoint();
- QString trashDir = trashForMountPoint( topdir, false );
+ TQString topdir = (*it)->mountPoint();
+ TQString trashDir = trashForMountPoint( topdir, false );
if ( !trashDir.isEmpty() ) {
// OK, trashDir is a valid trash directory. Ensure it's registered.
int trashId = idForTrashDirectory( trashDir );
@@ -781,13 +781,13 @@ TrashImpl::TrashDirMap TrashImpl::topDirectories() const
return m_topDirectories;
}
-QString TrashImpl::trashForMountPoint( const QString& topdir, bool createIfNeeded ) const
+TQString TrashImpl::trashForMountPoint( const TQString& topdir, bool createIfNeeded ) const
{
// (1) Administrator-created $topdir/.Trash directory
- const QString rootTrashDir = topdir + "/.Trash";
- const QCString rootTrashDir_c = QFile::encodeName( rootTrashDir );
- // Can't use QFileInfo here since we need to test for the sticky bit
+ const TQString rootTrashDir = topdir + "/.Trash";
+ const TQCString rootTrashDir_c = TQFile::encodeName( rootTrashDir );
+ // Can't use TQFileInfo here since we need to test for the sticky bit
uid_t uid = getuid();
KDE_struct_stat buff;
const uint requiredBits = S_ISVTX; // Sticky bit required
@@ -797,8 +797,8 @@ QString TrashImpl::trashForMountPoint( const QString& topdir, bool createIfNeede
&& ((buff.st_mode & requiredBits) == requiredBits)
&& (::access(rootTrashDir_c, W_OK))
) {
- const QString trashDir = rootTrashDir + "/" + QString::number( uid );
- const QCString trashDir_c = QFile::encodeName( trashDir );
+ const TQString trashDir = rootTrashDir + "/" + TQString::number( uid );
+ const TQCString trashDir_c = TQFile::encodeName( trashDir );
if ( KDE_lstat( trashDir_c, &buff ) == 0 ) {
if ( (buff.st_uid == uid) // must be owned by user
&& (S_ISDIR(buff.st_mode)) // must be a dir
@@ -817,8 +817,8 @@ QString TrashImpl::trashForMountPoint( const QString& topdir, bool createIfNeede
}
// (2) $topdir/.Trash-$uid
- const QString trashDir = topdir + "/.Trash-" + QString::number( uid );
- const QCString trashDir_c = QFile::encodeName( trashDir );
+ const TQString trashDir = topdir + "/.Trash-" + TQString::number( uid );
+ const TQCString trashDir_c = TQFile::encodeName( trashDir );
if ( KDE_lstat( trashDir_c, &buff ) == 0 )
{
if ( (buff.st_uid == uid) // must be owned by user
@@ -831,15 +831,15 @@ QString TrashImpl::trashForMountPoint( const QString& topdir, bool createIfNeede
}
kdDebug() << "Directory " << trashDir << " exists but didn't pass the security checks, can't use it" << endl;
// Exists, but not useable
- return QString::null;
+ return TQString::null;
}
if ( createIfNeeded && initTrashDirectory( trashDir_c ) ) {
return trashDir;
}
- return QString::null;
+ return TQString::null;
}
-int TrashImpl::idForTrashDirectory( const QString& trashDir ) const
+int TrashImpl::idForTrashDirectory( const TQString& trashDir ) const
{
// If this is too slow we can always use a reverse map...
TrashDirMap::ConstIterator it = m_trashDirectories.begin();
@@ -851,7 +851,7 @@ int TrashImpl::idForTrashDirectory( const QString& trashDir ) const
return -1;
}
-bool TrashImpl::initTrashDirectory( const QCString& trashDir_c ) const
+bool TrashImpl::initTrashDirectory( const TQCString& trashDir_c ) const
{
if ( ::mkdir( trashDir_c, 0700 ) != 0 )
return false;
@@ -879,20 +879,20 @@ bool TrashImpl::initTrashDirectory( const QCString& trashDir_c ) const
return true;
}
-bool TrashImpl::checkTrashSubdirs( const QCString& trashDir_c ) const
+bool TrashImpl::checkTrashSubdirs( const TQCString& trashDir_c ) const
{
- // testDir currently works with a QString - ## optimize
- QString trashDir = QFile::decodeName( trashDir_c );
- const QString info = trashDir + "/info";
+ // testDir currently works with a TQString - ## optimize
+ TQString trashDir = TQFile::decodeName( trashDir_c );
+ const TQString info = trashDir + "/info";
if ( testDir( info ) != 0 )
return false;
- const QString files = trashDir + "/files";
+ const TQString files = trashDir + "/files";
if ( testDir( files ) != 0 )
return false;
return true;
}
-QString TrashImpl::trashDirectoryPath( int trashId ) const
+TQString TrashImpl::trashDirectoryPath( int trashId ) const
{
// Never scanned for trash dirs? (This can happen after killing kio_trash
// and reusing a directory listing from the earlier instance.)
@@ -902,7 +902,7 @@ QString TrashImpl::trashDirectoryPath( int trashId ) const
return m_trashDirectories[trashId];
}
-QString TrashImpl::topDirectoryPath( int trashId ) const
+TQString TrashImpl::topDirectoryPath( int trashId ) const
{
if ( !m_trashDirectoriesScanned )
scanTrashDirectories();
@@ -913,12 +913,12 @@ QString TrashImpl::topDirectoryPath( int trashId ) const
// Helper method. Creates a URL with the format trash:/trashid-fileid or
// trash:/trashid-fileid/relativePath/To/File for a file inside a trashed directory.
-KURL TrashImpl::makeURL( int trashId, const QString& fileId, const QString& relativePath )
+KURL TrashImpl::makeURL( int trashId, const TQString& fileId, const TQString& relativePath )
{
KURL url;
url.setProtocol( "trash" );
- QString path = "/";
- path += QString::number( trashId );
+ TQString path = "/";
+ path += TQString::number( trashId );
path += '-';
path += fileId;
if ( !relativePath.isEmpty() ) {
@@ -931,11 +931,11 @@ KURL TrashImpl::makeURL( int trashId, const QString& fileId, const QString& rela
// Helper method. Parses a trash URL with the URL scheme defined in makeURL.
// The trash:/ URL itself isn't parsed here, must be caught by the caller before hand.
-bool TrashImpl::parseURL( const KURL& url, int& trashId, QString& fileId, QString& relativePath )
+bool TrashImpl::parseURL( const KURL& url, int& trashId, TQString& fileId, TQString& relativePath )
{
if ( url.protocol() != "trash" )
return false;
- const QString path = url.path();
+ const TQString path = url.path();
int start = 0;
if ( path[0] == '/' ) // always true I hope
start = 1;
@@ -951,7 +951,7 @@ bool TrashImpl::parseURL( const KURL& url, int& trashId, QString& fileId, QStrin
slashPos = path.find( '/', start );
if ( slashPos <= 0 ) {
fileId = path.mid( start );
- relativePath = QString::null;
+ relativePath = TQString::null;
return true;
}
fileId = path.mid( start, slashPos - start );
diff --git a/kioslave/trash/trashimpl.h b/kioslave/trash/trashimpl.h
index 2b16ec67e..027864456 100644
--- a/kioslave/trash/trashimpl.h
+++ b/kioslave/trash/trashimpl.h
@@ -23,11 +23,11 @@
#include <kio/jobclasses.h>
#include <ksimpleconfig.h>
-#include <qstring.h>
-#include <qdatetime.h>
-#include <qmap.h>
-#include <qvaluelist.h>
-#include <qstrlist.h>
+#include <tqstring.h>
+#include <tqdatetime.h>
+#include <tqmap.h>
+#include <tqvaluelist.h>
+#include <tqstrlist.h>
#include <assert.h>
/**
@@ -47,29 +47,29 @@ public:
/// Create info for a file to be trashed
/// Returns trashId and fileId
/// The caller is then responsible for actually trashing the file
- bool createInfo( const QString& origPath, int& trashId, QString& fileId );
+ bool createInfo( const TQString& origPath, int& trashId, TQString& fileId );
/// Delete info file for a file to be trashed
/// Usually used for undoing what createInfo did if trashing failed
- bool deleteInfo( int trashId, const QString& fileId );
+ bool deleteInfo( int trashId, const TQString& fileId );
/// Moving a file or directory into the trash. The ids come from createInfo.
- bool moveToTrash( const QString& origPath, int trashId, const QString& fileId );
+ bool moveToTrash( const TQString& origPath, int trashId, const TQString& fileId );
/// Moving a file or directory out of the trash. The ids come from createInfo.
- bool moveFromTrash( const QString& origPath, int trashId, const QString& fileId, const QString& relativePath );
+ bool moveFromTrash( const TQString& origPath, int trashId, const TQString& fileId, const TQString& relativePath );
/// Copying a file or directory into the trash. The ids come from createInfo.
- bool copyToTrash( const QString& origPath, int trashId, const QString& fileId );
+ bool copyToTrash( const TQString& origPath, int trashId, const TQString& fileId );
/// Copying a file or directory out of the trash. The ids come from createInfo.
- bool copyFromTrash( const QString& origPath, int trashId, const QString& fileId, const QString& relativePath );
+ bool copyFromTrash( const TQString& origPath, int trashId, const TQString& fileId, const TQString& relativePath );
/// Create a top-level trashed directory
- //bool mkdir( int trashId, const QString& fileId, int permissions );
+ //bool mkdir( int trashId, const TQString& fileId, int permissions );
/// Get rid of a trashed file
- bool del( int trashId, const QString& fileId );
+ bool del( int trashId, const TQString& fileId );
/// Empty trash, i.e. delete all trashed files
bool emptyTrash();
@@ -79,35 +79,35 @@ public:
struct TrashedFileInfo {
int trashId; // for the url
- QString fileId; // for the url
- QString physicalPath; // for stat'ing etc.
- QString origPath; // from info file
- QDateTime deletionDate; // from info file
+ TQString fileId; // for the url
+ TQString physicalPath; // for stat'ing etc.
+ TQString origPath; // from info file
+ TQDateTime deletionDate; // from info file
};
/// List trashed files
- typedef QValueList<TrashedFileInfo> TrashedFileInfoList;
+ typedef TQValueList<TrashedFileInfo> TrashedFileInfoList;
TrashedFileInfoList list();
/// Return the info for a given trashed file
- bool infoForFile( int trashId, const QString& fileId, TrashedFileInfo& info );
+ bool infoForFile( int trashId, const TQString& fileId, TrashedFileInfo& info );
/// Return the physicalPath for a given trashed file - helper method which
/// encapsulates the call to infoForFile. Don't use if you need more info from TrashedFileInfo.
- QString physicalPath( int trashId, const QString& fileId, const QString& relativePath );
+ TQString physicalPath( int trashId, const TQString& fileId, const TQString& relativePath );
/// Move data from the old trash system to the new one
void migrateOldTrash();
/// KIO error code
int lastErrorCode() const { return m_lastErrorCode; }
- QString lastErrorMessage() const { return m_lastErrorMessage; }
+ TQString lastErrorMessage() const { return m_lastErrorMessage; }
- QStrList listDir( const QString& physicalPath );
+ TQStrList listDir( const TQString& physicalPath );
- static KURL makeURL( int trashId, const QString& fileId, const QString& relativePath );
- static bool parseURL( const KURL& url, int& trashId, QString& fileId, QString& relativePath );
+ static KURL makeURL( int trashId, const TQString& fileId, const TQString& relativePath );
+ static bool parseURL( const KURL& url, int& trashId, TQString& fileId, TQString& relativePath );
- typedef QMap<int, QString> TrashDirMap;
+ typedef TQMap<int, TQString> TrashDirMap;
/// @internal This method is for TestTrash only. Home trash is included (id 0).
TrashDirMap trashDirectories() const;
/// @internal This method is for TestTrash only. No entry with id 0.
@@ -115,38 +115,38 @@ public:
private:
/// Helper method. Moves a file or directory using the appropriate method.
- bool move( const QString& src, const QString& dest );
- bool copy( const QString& src, const QString& dest );
+ bool move( const TQString& src, const TQString& dest );
+ bool copy( const TQString& src, const TQString& dest );
/// Helper method. Tries to call ::rename(src,dest) and does error handling.
- bool directRename( const QString& src, const QString& dest );
+ bool directRename( const TQString& src, const TQString& dest );
void fileAdded();
void fileRemoved();
// Warning, returns error code, not a bool
- int testDir( const QString& name ) const;
- void error( int e, const QString& s );
+ int testDir( const TQString& name ) const;
+ void error( int e, const TQString& s );
- bool readInfoFile( const QString& infoPath, TrashedFileInfo& info, int trashId );
+ bool readInfoFile( const TQString& infoPath, TrashedFileInfo& info, int trashId );
- QString infoPath( int trashId, const QString& fileId ) const;
- QString filesPath( int trashId, const QString& fileId ) const;
+ TQString infoPath( int trashId, const TQString& fileId ) const;
+ TQString filesPath( int trashId, const TQString& fileId ) const;
/// Find the trash dir to use for a given file to delete, based on original path
- int findTrashDirectory( const QString& origPath );
+ int findTrashDirectory( const TQString& origPath );
- QString trashDirectoryPath( int trashId ) const;
- QString topDirectoryPath( int trashId ) const;
+ TQString trashDirectoryPath( int trashId ) const;
+ TQString topDirectoryPath( int trashId ) const;
- bool synchronousDel( const QString& path, bool setLastErrorCode, bool isDir );
+ bool synchronousDel( const TQString& path, bool setLastErrorCode, bool isDir );
void scanTrashDirectories() const;
- int idForTrashDirectory( const QString& trashDir ) const;
- bool initTrashDirectory( const QCString& trashDir_c ) const;
- bool checkTrashSubdirs( const QCString& trashDir_c ) const;
- QString trashForMountPoint( const QString& topdir, bool createIfNeeded ) const;
- static QString makeRelativePath( const QString& topdir, const QString& path );
+ int idForTrashDirectory( const TQString& trashDir ) const;
+ bool initTrashDirectory( const TQCString& trashDir_c ) const;
+ bool checkTrashSubdirs( const TQCString& trashDir_c ) const;
+ TQString trashForMountPoint( const TQString& topdir, bool createIfNeeded ) const;
+ static TQString makeRelativePath( const TQString& topdir, const TQString& path );
private slots:
void jobFinished(KIO::Job *job);
@@ -155,7 +155,7 @@ private:
/// Last error code stored in class to simplify API.
/// Note that this means almost no method can be const.
int m_lastErrorCode;
- QString m_lastErrorMessage;
+ TQString m_lastErrorMessage;
enum { InitToBeDone, InitOK, InitError } m_initStatus;