diff options
Diffstat (limited to 'lib/qextfileinfo.cpp')
-rw-r--r-- | lib/qextfileinfo.cpp | 186 |
1 files changed, 93 insertions, 93 deletions
diff --git a/lib/qextfileinfo.cpp b/lib/qextfileinfo.cpp index b7c7e741..7ff92c60 100644 --- a/lib/qextfileinfo.cpp +++ b/lib/qextfileinfo.cpp @@ -12,12 +12,12 @@ //qt includes -#include <qdir.h> -#include <qapplication.h> -#include <qptrlist.h> -#include <qstringlist.h> -#include <qregexp.h> -#include <qtimer.h> +#include <tqdir.h> +#include <tqapplication.h> +#include <tqptrlist.h> +#include <tqstringlist.h> +#include <tqregexp.h> +#include <tqtimer.h> //kde includes #include <kurl.h> @@ -32,34 +32,34 @@ //app includes #include "qextfileinfo.h" -QString QExtFileInfo::lastErrorMsg = ""; +TQString QExtFileInfo::lastErrorMsg = ""; -QString QExtFileInfo::canonicalPath(const QString& path) +TQString QExtFileInfo::canonicalPath(const TQString& path) { if (!path.startsWith("/") || path == "/") return path; bool endsWithSlash = path.endsWith("/"); - QDir dir(path); - if (dir.exists() || QFileInfo(path).exists()) + TQDir dir(path); + if (dir.exists() || TQFileInfo(path).exists()) { - QString s = dir.canonicalPath(); + TQString s = dir.canonicalPath(); if (endsWithSlash) s.append("/"); return s; } else { KURL u = KURL::fromPathOrURL(path).upURL(); - QString s = u.path(-1) + "/"; + TQString s = u.path(-1) + "/"; if (s == "//") s = "/"; - QString s2 = path.mid(s.length()); + TQString s2 = path.mid(s.length()); s2 = QExtFileInfo::canonicalPath(s) + s2; return s2; } } -QString QExtFileInfo::homeDirPath() +TQString QExtFileInfo::homeDirPath() { - return QDir(QDir::homeDirPath()).canonicalPath(); + return TQDir(TQDir::homeDirPath()).canonicalPath(); } /** create a relative short url based in baseURL*/ @@ -72,7 +72,7 @@ KURL QExtFileInfo::toRelative(const KURL& _urlToConvert,const KURL& _baseURL, bo { if (urlToConvert.isLocalFile()) { - QString path; + TQString path; if (resolveSymlinks) path = QExtFileInfo::canonicalPath(urlToConvert.path()); else @@ -86,8 +86,8 @@ KURL QExtFileInfo::toRelative(const KURL& _urlToConvert,const KURL& _baseURL, bo if (!path.isEmpty()) baseURL.setPath(path); } - QString path = urlToConvert.path(); - QString basePath = baseURL.path(1); + TQString path = urlToConvert.path(); + TQString basePath = baseURL.path(1); if (path.startsWith("/")) { path.remove(0, 1); @@ -118,7 +118,7 @@ KURL QExtFileInfo::toRelative(const KURL& _urlToConvert,const KURL& _baseURL, bo }; } - resultURL.setPath(QDir::cleanDirPath(path)); + resultURL.setPath(TQDir::cleanDirPath(path)); } if (urlToConvert.path().endsWith("/") && !resultURL.path().isEmpty()) @@ -136,20 +136,20 @@ KURL QExtFileInfo::toAbsolute(const KURL& _urlToConvert,const KURL& _baseURL) { if (urlToConvert.isLocalFile()) { - QString path = QExtFileInfo::canonicalPath(baseURL.path()); + TQString path = QExtFileInfo::canonicalPath(baseURL.path()); if (!path.isEmpty()) baseURL.setPath(path); } int pos; - QString cutname = urlToConvert.path(); - QString cutdir = baseURL.path(1); + TQString cutname = urlToConvert.path(); + TQString cutdir = baseURL.path(1); while ( (pos = cutname.find("../")) >=0 ) { cutname.remove( 0, pos+3 ); cutdir.remove( cutdir.length()-1, 1 ); cutdir.remove( cutdir.findRev('/')+1 , 1000); } - resultURL.setPath(QDir::cleanDirPath(cutdir+cutname)); + resultURL.setPath(TQDir::cleanDirPath(cutdir+cutname)); } if (urlToConvert.path().endsWith("/")) resultURL.adjustPath(1); @@ -161,13 +161,13 @@ KURL QExtFileInfo::toAbsolute(const KURL& _urlToConvert,const KURL& _baseURL) This is needed for empty directory adding/handling. (Andras) Currently works only for local directories */ -KURL::List QExtFileInfo::allFiles( const KURL& path, const QString& mask, QWidget *window) +KURL::List QExtFileInfo::allFiles( const KURL& path, const TQString& mask, TQWidget *window) { QExtFileInfo internalFileInfo; return internalFileInfo.allFilesInternal(path, mask, window); } -KURL::List QExtFileInfo::allFilesRelative( const KURL& path, const QString& mask, QWidget *window, bool resolveSymlinks) +KURL::List QExtFileInfo::allFilesRelative( const KURL& path, const TQString& mask, TQWidget *window, bool resolveSymlinks) { QExtFileInfo internalFileInfo; KURL::List r = internalFileInfo.allFilesInternal(path, mask, window); @@ -181,14 +181,14 @@ KURL::List QExtFileInfo::allFilesRelative( const KURL& path, const QString& mask return r; } -QDict<KFileItem> QExtFileInfo::allFilesDetailed(const KURL& path, const QString& mask, QWidget *window) +TQDict<KFileItem> QExtFileInfo::allFilesDetailed(const KURL& path, const TQString& mask, TQWidget *window) { QExtFileInfo internalFileInfo; return internalFileInfo.allFilesDetailedInternal(path, mask, window); } -bool QExtFileInfo::createDir(const KURL& path, QWidget *window) +bool QExtFileInfo::createDir(const KURL& path, TQWidget *window) { int i = 0; bool result; @@ -226,7 +226,7 @@ bool QExtFileInfo::createDir(const KURL& path, QWidget *window) KURL QExtFileInfo::cdUp(const KURL &url) { KURL u = url; - QString dir = u.path(-1); + TQString dir = u.path(-1); while ( !dir.isEmpty() && dir.right(1) != "/" ) { dir.remove( dir.length()-1,1); @@ -235,7 +235,7 @@ KURL QExtFileInfo::cdUp(const KURL &url) return u; } -QString QExtFileInfo::shortName(const QString &fname) +TQString QExtFileInfo::shortName(const TQString &fname) { return fname.section("/", -1); } @@ -250,12 +250,12 @@ KURL QExtFileInfo::path( const KURL &url ) KURL QExtFileInfo::home() { KURL url; - url.setPath(QDir::currentDirPath()+"/"); + url.setPath(TQDir::currentDirPath()+"/"); return url; } -bool QExtFileInfo::exists(const KURL& a_url, bool readingOnly, QWidget *window) +bool QExtFileInfo::exists(const KURL& a_url, bool readingOnly, TQWidget *window) { // Andras: Don't use it now, as it brings up an extra dialog and need manual // intervention when usign fish @@ -264,7 +264,7 @@ bool QExtFileInfo::exists(const KURL& a_url, bool readingOnly, QWidget *window) // No dialog when stating. if (a_url.isLocalFile()) { - return QFile::exists(a_url.path()); + return TQFile::exists(a_url.path()); } else { QExtFileInfo internalFileInfo; @@ -274,14 +274,14 @@ bool QExtFileInfo::exists(const KURL& a_url, bool readingOnly, QWidget *window) /* Synchronous copy, like NetAccess::file_copy in KDE 3.2 */ bool QExtFileInfo::copy( const KURL& src, const KURL& target, int permissions, - bool overwrite, bool resume, QWidget* window ) + bool overwrite, bool resume, TQWidget* window ) { QExtFileInfo internalFileInfo; return internalFileInfo.internalCopy( src, target, permissions, overwrite, resume, window ); } /** No descriptions */ -KURL::List QExtFileInfo::allFilesInternal(const KURL& startURL, const QString& mask, QWidget *window) +KURL::List QExtFileInfo::allFilesInternal(const KURL& startURL, const TQString& mask, TQWidget *window) { if (startURL.isLocalFile()) return allLocalFiles(startURL.path(-1), mask); @@ -292,18 +292,18 @@ KURL::List QExtFileInfo::allFilesInternal(const KURL& startURL, const QString& m lstFilters.setAutoDelete(true); lstFilters.clear(); // Split on white space - QStringList list = QStringList::split( ' ', mask ); - for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) - lstFilters.append( new QRegExp(*it, false, true ) ); + TQStringList list = TQStringList::split( ' ', mask ); + for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) + lstFilters.append( new TQRegExp(*it, false, true ) ); bJobOK = true; KIO::ListJob *job = KIO::listRecursive(startURL, false, true); job->setWindow(window); m_listJobCount = 1; - connect(job, SIGNAL(entries(KIO::Job *, const KIO::UDSEntryList&)), - this, SLOT(slotNewEntries(KIO::Job *, const KIO::UDSEntryList&))); - connect( job, SIGNAL( result (KIO::Job *) ), - this, SLOT( slotListResult (KIO::Job *) ) ); + connect(job, TQT_SIGNAL(entries(KIO::Job *, const KIO::UDSEntryList&)), + this, TQT_SLOT(slotNewEntries(KIO::Job *, const KIO::UDSEntryList&))); + connect( job, TQT_SIGNAL( result (KIO::Job *) ), + this, TQT_SLOT( slotListResult (KIO::Job *) ) ); m_listStartURL = startURL.url(); //kdDebug(24000) << "Now listing: " << startURL.url() << endl; @@ -320,7 +320,7 @@ KURL::List QExtFileInfo::allFilesInternal(const KURL& startURL, const QString& m } /** No descriptions */ -QDict<KFileItem> QExtFileInfo::allFilesDetailedInternal(const KURL& startURL, const QString& mask, QWidget *window) +TQDict<KFileItem> QExtFileInfo::allFilesDetailedInternal(const KURL& startURL, const TQString& mask, TQWidget *window) { detailedDirListItems.setAutoDelete(true); detailedDirListItems.clear(); @@ -330,18 +330,18 @@ QDict<KFileItem> QExtFileInfo::allFilesDetailedInternal(const KURL& startURL, co lstFilters.setAutoDelete(true); lstFilters.clear(); // Split on white space - QStringList list = QStringList::split( ' ', mask ); - for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) - lstFilters.append( new QRegExp(*it, false, true ) ); + TQStringList list = TQStringList::split( ' ', mask ); + for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) + lstFilters.append( new TQRegExp(*it, false, true ) ); bJobOK = true; KIO::ListJob *job = KIO::listRecursive(startURL, false, true); job->setWindow(window); m_listJobCount = 1; - connect(job, SIGNAL(entries(KIO::Job *, const KIO::UDSEntryList&)), - this, SLOT(slotNewDetailedEntries(KIO::Job *, const KIO::UDSEntryList&))); - connect( job, SIGNAL( result (KIO::Job *) ), - this, SLOT( slotListResult (KIO::Job *) ) ); + connect(job, TQT_SIGNAL(entries(KIO::Job *, const KIO::UDSEntryList&)), + this, TQT_SLOT(slotNewDetailedEntries(KIO::Job *, const KIO::UDSEntryList&))); + connect( job, TQT_SIGNAL( result (KIO::Job *) ), + this, TQT_SLOT( slotListResult (KIO::Job *) ) ); m_listStartURL = startURL.url(); //kdDebug(24000) << "Now listing: " << startURL.url() << endl; enter_loop(); @@ -356,27 +356,27 @@ QDict<KFileItem> QExtFileInfo::allFilesDetailedInternal(const KURL& startURL, co return detailedDirListItems; } -KURL::List QExtFileInfo::allLocalFiles(const QString& startPath, const QString& mask) +KURL::List QExtFileInfo::allLocalFiles(const TQString& startPath, const TQString& mask) { KURL::List list; - QDir d(startPath, mask); - QStringList l = d.entryList(); - QStringList::ConstIterator end = l.constEnd(); - QString path; - for (QStringList::ConstIterator it = l.constBegin(); it != end; ++it) + TQDir d(startPath, mask); + TQStringList l = d.entryList(); + TQStringList::ConstIterator end = l.constEnd(); + TQString path; + for (TQStringList::ConstIterator it = l.constBegin(); it != end; ++it) { path = *it; if (path != "." && path != "..") { path = startPath + "/" + path; - if (QFileInfo(path).isDir()) + if (TQFileInfo(path).isDir()) path.append("/"); list.append(KURL::fromPathOrURL(path)); } } - l = d.entryList("*", QDir::Dirs); + l = d.entryList("*", TQDir::Dirs); end = l.constEnd(); - for (QStringList::ConstIterator it = l.constBegin(); it != end; ++it) + for (TQStringList::ConstIterator it = l.constBegin(); it != end; ++it) { if ((*it) != "." && (*it) != "..") list += allLocalFiles(startPath + "/" + (*it), mask); @@ -387,7 +387,7 @@ KURL::List QExtFileInfo::allLocalFiles(const QString& startPath, const QString& //Some hackery from KIO::NetAccess as they do not do exactly what we want /* return true if the url exists*/ -bool QExtFileInfo::internalExists(const KURL& url, bool readingOnly, QWidget *window) +bool QExtFileInfo::internalExists(const KURL& url, bool readingOnly, TQWidget *window) { bJobOK = true; KURL url2 = url; @@ -397,11 +397,11 @@ bool QExtFileInfo::internalExists(const KURL& url, bool readingOnly, QWidget *wi job->setWindow(window); job->setDetails(0); job->setSide(readingOnly); - connect( job, SIGNAL( result (KIO::Job *) ), - this, SLOT( slotResult (KIO::Job *) ) ); + connect( job, TQT_SIGNAL( result (KIO::Job *) ), + this, TQT_SLOT( slotResult (KIO::Job *) ) ); //To avoid lock-ups, start a timer. - QTimer::singleShot(60*1000, this,SLOT(slotTimeout())); + TQTimer::singleShot(60*1000, this,TQT_SLOT(slotTimeout())); //kdDebug(24000)<<"QExtFileInfo::internalExists:before enter_loop"<<endl; enter_loop(); //kdDebug(24000)<<"QExtFileInfo::internalExists:after enter_loop"<<endl; @@ -409,7 +409,7 @@ bool QExtFileInfo::internalExists(const KURL& url, bool readingOnly, QWidget *wi } bool QExtFileInfo::internalCopy(const KURL& src, const KURL& target, int permissions, - bool overwrite, bool resume, QWidget* window) + bool overwrite, bool resume, TQWidget* window) { bJobOK = true; // success unless further error occurs @@ -417,8 +417,8 @@ bool QExtFileInfo::internalCopy(const KURL& src, const KURL& target, int permiss KIO::Job * job = KIO::file_copy( src, target, permissions, overwrite, resume, false ); // KIO::Job * job2 = KIO::del(target, false ); //job2->setWindow (window); - //connect( job2, SIGNAL( result (KIO::Job *) ), -// this, SLOT( slotResult (KIO::Job *) ) ); + //connect( job2, TQT_SIGNAL( result (KIO::Job *) ), +// this, TQT_SLOT( slotResult (KIO::Job *) ) ); //enter_loop(); //if (bJobOK) @@ -426,21 +426,21 @@ bool QExtFileInfo::internalCopy(const KURL& src, const KURL& target, int permiss // kdDebug(24000) << "Copying " << src << " to " << target << endl; // KIO::Job *job = KIO::copy( src, target, false ); job->setWindow (window); - connect( job, SIGNAL( result (KIO::Job *) ), - this, SLOT( slotResult (KIO::Job *) ) ); + connect( job, TQT_SIGNAL( result (KIO::Job *) ), + this, TQT_SLOT( slotResult (KIO::Job *) ) ); enter_loop(); } return bJobOK; } -void qt_enter_modal( QWidget *widget ); -void qt_leave_modal( QWidget *widget ); +void qt_enter_modal( TQWidget *widget ); +void qt_leave_modal( TQWidget *widget ); void QExtFileInfo::enter_loop() { - QWidget dummy(0,0,WType_Dialog | WShowModal); - dummy.setFocusPolicy( QWidget::NoFocus ); + TQWidget dummy(0,0,WType_Dialog | WShowModal); + dummy.setFocusPolicy( TQWidget::NoFocus ); qt_enter_modal(&dummy); //kdDebug(24000)<<"QExtFileInfo::enter_loop:before qApp->enter_loop()"<< endl; qApp->enter_loop(); @@ -474,17 +474,17 @@ void QExtFileInfo::slotNewEntries(KIO::Job *job, const KIO::UDSEntryList& udsLis KURL url = static_cast<KIO::ListJob *>(job)->url(); url.adjustPath(-1); // avoid creating these QStrings again and again - static const QString& dot = KGlobal::staticQString("."); - static const QString& dotdot = KGlobal::staticQString(".."); + static const TQString& dot = KGlobal::staticQString("."); + static const TQString& dotdot = KGlobal::staticQString(".."); KIO::UDSEntryListConstIterator it = udsList.begin(); KIO::UDSEntryListConstIterator end = udsList.end(); KURL itemURL; - QPtrList<KFileItem> linkItems; + TQPtrList<KFileItem> linkItems; linkItems.setAutoDelete(true); for ( ; it != end; ++it ) { - QString name; + TQString name; // find out about the name KIO::UDSEntry::ConstIterator entit = (*it).begin(); @@ -501,7 +501,7 @@ void QExtFileInfo::slotNewEntries(KIO::Job *job, const KIO::UDSEntryList& udsLis if (item->isDir() && item->isLink()) { KURL u = item->url(); - QString linkDest = item->linkDest(); + TQString linkDest = item->linkDest(); kdDebug(24000) << "Got link: " << name << " Points to:" << linkDest << endl; if (linkDest.startsWith("./") || linkDest.startsWith("../") ) { @@ -523,7 +523,7 @@ void QExtFileInfo::slotNewEntries(KIO::Job *job, const KIO::UDSEntryList& udsLis itemURL = item->url(); if (item->isDir()) itemURL.adjustPath(1); - for (QPtrListIterator<QRegExp> filterIt(lstFilters); filterIt.current(); ++filterIt ) + for (TQPtrListIterator<TQRegExp> filterIt(lstFilters); filterIt.current(); ++filterIt ) { if (filterIt.current()->exactMatch(item->text())) dirListItems.append(itemURL); @@ -531,15 +531,15 @@ void QExtFileInfo::slotNewEntries(KIO::Job *job, const KIO::UDSEntryList& udsLis delete item; } } - for (QPtrList<KFileItem>::ConstIterator it = linkItems.constBegin(); it != linkItems.constEnd(); ++it) + for (TQPtrList<KFileItem>::ConstIterator it = linkItems.constBegin(); it != linkItems.constEnd(); ++it) { KIO::ListJob *ljob = KIO::listRecursive((*it)->url(), false, true); m_listJobCount++; //kdDebug(24000) << "Now listing: " << (*it)->url() << endl; - connect( ljob, SIGNAL(entries(KIO::Job *,const KIO::UDSEntryList &)), - this,SLOT (slotNewEntries(KIO::Job *,const KIO::UDSEntryList &))); - connect( ljob, SIGNAL(result(KIO::Job *)), - this,SLOT (slotListResult(KIO::Job *))); + connect( ljob, TQT_SIGNAL(entries(KIO::Job *,const KIO::UDSEntryList &)), + this,TQT_SLOT (slotNewEntries(KIO::Job *,const KIO::UDSEntryList &))); + connect( ljob, TQT_SIGNAL(result(KIO::Job *)), + this,TQT_SLOT (slotListResult(KIO::Job *))); } } @@ -548,17 +548,17 @@ void QExtFileInfo::slotNewDetailedEntries(KIO::Job *job, const KIO::UDSEntryList KURL url = static_cast<KIO::ListJob *>(job)->url(); url.adjustPath(-1); // avoid creating these QStrings again and again - static const QString& dot = KGlobal::staticQString("."); - static const QString& dotdot = KGlobal::staticQString(".."); + static const TQString& dot = KGlobal::staticQString("."); + static const TQString& dotdot = KGlobal::staticQString(".."); KIO::UDSEntryListConstIterator it = udsList.begin(); KIO::UDSEntryListConstIterator end = udsList.end(); KURL itemURL; - QPtrList<KFileItem> linkItems; + TQPtrList<KFileItem> linkItems; linkItems.setAutoDelete(true); for ( ; it != end; ++it ) { - QString name; + TQString name; // find out about the name KIO::UDSEntry::ConstIterator entit = (*it).begin(); @@ -576,7 +576,7 @@ void QExtFileInfo::slotNewDetailedEntries(KIO::Job *job, const KIO::UDSEntryList { KURL u = item->url(); u.setPath(item->linkDest()); - QString urlStr = u.url(); + TQString urlStr = u.url(); if (detailedDirListItems.find(urlStr) == 0L && (urlStr != m_listStartURL)) { @@ -588,7 +588,7 @@ void QExtFileInfo::slotNewDetailedEntries(KIO::Job *job, const KIO::UDSEntryList } } bool added = false; - for (QPtrListIterator<QRegExp> filterIt( lstFilters ); filterIt.current(); ++filterIt) + for (TQPtrListIterator<TQRegExp> filterIt( lstFilters ); filterIt.current(); ++filterIt) if (filterIt.current()->exactMatch(item->text())) { detailedDirListItems.insert(item->url().url(), item); @@ -598,15 +598,15 @@ void QExtFileInfo::slotNewDetailedEntries(KIO::Job *job, const KIO::UDSEntryList delete item; } } - for (QPtrList<KFileItem>::ConstIterator it = linkItems.constBegin(); it != linkItems.constEnd(); ++it) + for (TQPtrList<KFileItem>::ConstIterator it = linkItems.constBegin(); it != linkItems.constEnd(); ++it) { KIO::ListJob *ljob = KIO::listRecursive((*it)->url(), false, true); m_listJobCount++; // kdDebug(24000) << "Now listing: " << (*it)->url() << endl; - connect( ljob, SIGNAL(entries(KIO::Job *,const KIO::UDSEntryList &)), - this,SLOT (slotNewDetailedEntries(KIO::Job *,const KIO::UDSEntryList &))); - connect( ljob, SIGNAL(result(KIO::Job *)), - this,SLOT (slotListResult(KIO::Job *))); + connect( ljob, TQT_SIGNAL(entries(KIO::Job *,const KIO::UDSEntryList &)), + this,TQT_SLOT (slotNewDetailedEntries(KIO::Job *,const KIO::UDSEntryList &))); + connect( ljob, TQT_SIGNAL(result(KIO::Job *)), + this,TQT_SLOT (slotListResult(KIO::Job *))); } } |