diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-16 19:02:47 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-16 19:02:47 +0000 |
commit | e985f7e545f4739493965aad69bbecb136dc9346 (patch) | |
tree | 54afd409d8acd6202dd8ab611d24e78c28e4c0a0 /lib/qextfileinfo.cpp | |
parent | f7670c198945adc3b95ad69a959fe5f8ae55b493 (diff) | |
download | tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.tar.gz tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.zip |
TQt4 port kdewebdev
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1237029 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/qextfileinfo.cpp')
-rw-r--r-- | lib/qextfileinfo.cpp | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/lib/qextfileinfo.cpp b/lib/qextfileinfo.cpp index 7ff92c60..28f5a8e1 100644 --- a/lib/qextfileinfo.cpp +++ b/lib/qextfileinfo.cpp @@ -32,9 +32,9 @@ //app includes #include "qextfileinfo.h" -TQString QExtFileInfo::lastErrorMsg = ""; +TQString TQExtFileInfo::lastErrorMsg = ""; -TQString QExtFileInfo::canonicalPath(const TQString& path) +TQString TQExtFileInfo::canonicalPath(const TQString& path) { if (!path.startsWith("/") || path == "/") return path; @@ -52,18 +52,18 @@ TQString QExtFileInfo::canonicalPath(const TQString& path) TQString s = u.path(-1) + "/"; if (s == "//") s = "/"; TQString s2 = path.mid(s.length()); - s2 = QExtFileInfo::canonicalPath(s) + s2; + s2 = TQExtFileInfo::canonicalPath(s) + s2; return s2; } } -TQString QExtFileInfo::homeDirPath() +TQString TQExtFileInfo::homeDirPath() { return TQDir(TQDir::homeDirPath()).canonicalPath(); } /** create a relative short url based in baseURL*/ -KURL QExtFileInfo::toRelative(const KURL& _urlToConvert,const KURL& _baseURL, bool resolveSymlinks) +KURL TQExtFileInfo::toRelative(const KURL& _urlToConvert,const KURL& _baseURL, bool resolveSymlinks) { KURL urlToConvert = _urlToConvert; KURL baseURL = _baseURL; @@ -74,13 +74,13 @@ KURL QExtFileInfo::toRelative(const KURL& _urlToConvert,const KURL& _baseURL, bo { TQString path; if (resolveSymlinks) - path = QExtFileInfo::canonicalPath(urlToConvert.path()); + path = TQExtFileInfo::canonicalPath(urlToConvert.path()); else path = urlToConvert.path(); if (!path.isEmpty()) urlToConvert.setPath(path); if (resolveSymlinks) - path = QExtFileInfo::canonicalPath(baseURL.path()); + path = TQExtFileInfo::canonicalPath(baseURL.path()); else path = baseURL.path(); if (!path.isEmpty()) @@ -98,8 +98,8 @@ KURL QExtFileInfo::toRelative(const KURL& _urlToConvert,const KURL& _baseURL, bo int pos1=0; for (;;) { - pos=path.find("/"); - pos1=basePath.find("/"); + pos=path.tqfind("/"); + pos1=basePath.tqfind("/"); if ( pos<0 || pos1<0 ) break; if ( path.left(pos+1 ) == basePath.left(pos1+1) ) { @@ -111,7 +111,7 @@ KURL QExtFileInfo::toRelative(const KURL& _urlToConvert,const KURL& _baseURL, bo }; if ( basePath == "/" ) basePath=""; - int level = basePath.contains("/"); + int level = basePath.tqcontains("/"); for (int i=0; i<level; i++) { path="../"+path; @@ -126,7 +126,7 @@ KURL QExtFileInfo::toRelative(const KURL& _urlToConvert,const KURL& _baseURL, bo return resultURL; } /** convert relative filename to absolute */ -KURL QExtFileInfo::toAbsolute(const KURL& _urlToConvert,const KURL& _baseURL) +KURL TQExtFileInfo::toAbsolute(const KURL& _urlToConvert,const KURL& _baseURL) { KURL urlToConvert = _urlToConvert; KURL baseURL = _baseURL; @@ -136,18 +136,18 @@ KURL QExtFileInfo::toAbsolute(const KURL& _urlToConvert,const KURL& _baseURL) { if (urlToConvert.isLocalFile()) { - TQString path = QExtFileInfo::canonicalPath(baseURL.path()); + TQString path = TQExtFileInfo::canonicalPath(baseURL.path()); if (!path.isEmpty()) baseURL.setPath(path); } int pos; TQString cutname = urlToConvert.path(); TQString cutdir = baseURL.path(1); - while ( (pos = cutname.find("../")) >=0 ) + while ( (pos = cutname.tqfind("../")) >=0 ) { cutname.remove( 0, pos+3 ); cutdir.remove( cutdir.length()-1, 1 ); - cutdir.remove( cutdir.findRev('/')+1 , 1000); + cutdir.remove( cutdir.tqfindRev('/')+1 , 1000); } resultURL.setPath(TQDir::cleanDirPath(cutdir+cutname)); } @@ -161,34 +161,34 @@ 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 TQString& mask, TQWidget *window) +KURL::List TQExtFileInfo::allFiles( const KURL& path, const TQString& tqmask, TQWidget *window) { - QExtFileInfo internalFileInfo; - return internalFileInfo.allFilesInternal(path, mask, window); + TQExtFileInfo internalFileInfo; + return internalFileInfo.allFilesInternal(path, tqmask, window); } -KURL::List QExtFileInfo::allFilesRelative( const KURL& path, const TQString& mask, TQWidget *window, bool resolveSymlinks) +KURL::List TQExtFileInfo::allFilesRelative( const KURL& path, const TQString& tqmask, TQWidget *window, bool resolveSymlinks) { - QExtFileInfo internalFileInfo; - KURL::List r = internalFileInfo.allFilesInternal(path, mask, window); + TQExtFileInfo internalFileInfo; + KURL::List r = internalFileInfo.allFilesInternal(path, tqmask, window); KURL::List::Iterator it; for ( it = r.begin(); it != r.end(); ++it ) { - *it = QExtFileInfo::toRelative( *it, path, resolveSymlinks ); + *it = TQExtFileInfo::toRelative( *it, path, resolveSymlinks ); } return r; } -TQDict<KFileItem> QExtFileInfo::allFilesDetailed(const KURL& path, const TQString& mask, TQWidget *window) +TQDict<KFileItem> TQExtFileInfo::allFilesDetailed(const KURL& path, const TQString& tqmask, TQWidget *window) { - QExtFileInfo internalFileInfo; - return internalFileInfo.allFilesDetailedInternal(path, mask, window); + TQExtFileInfo internalFileInfo; + return internalFileInfo.allFilesDetailedInternal(path, tqmask, window); } -bool QExtFileInfo::createDir(const KURL& path, TQWidget *window) +bool TQExtFileInfo::createDir(const KURL& path, TQWidget *window) { int i = 0; bool result; @@ -223,7 +223,7 @@ bool QExtFileInfo::createDir(const KURL& path, TQWidget *window) return result; } -KURL QExtFileInfo::cdUp(const KURL &url) +KURL TQExtFileInfo::cdUp(const KURL &url) { KURL u = url; TQString dir = u.path(-1); @@ -235,19 +235,19 @@ KURL QExtFileInfo::cdUp(const KURL &url) return u; } -TQString QExtFileInfo::shortName(const TQString &fname) +TQString TQExtFileInfo::shortName(const TQString &fname) { return fname.section("/", -1); } -KURL QExtFileInfo::path( const KURL &url ) +KURL TQExtFileInfo::path( const KURL &url ) { KURL result = url; result.setPath(result.directory(false,false)); return result; } -KURL QExtFileInfo::home() +KURL TQExtFileInfo::home() { KURL url; url.setPath(TQDir::currentDirPath()+"/"); @@ -255,7 +255,7 @@ KURL QExtFileInfo::home() } -bool QExtFileInfo::exists(const KURL& a_url, bool readingOnly, TQWidget *window) +bool TQExtFileInfo::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 @@ -267,24 +267,24 @@ bool QExtFileInfo::exists(const KURL& a_url, bool readingOnly, TQWidget *window) return TQFile::exists(a_url.path()); } else { - QExtFileInfo internalFileInfo; + TQExtFileInfo internalFileInfo; return internalFileInfo.internalExists(a_url, readingOnly, window); } } /* Synchronous copy, like NetAccess::file_copy in KDE 3.2 */ -bool QExtFileInfo::copy( const KURL& src, const KURL& target, int permissions, +bool TQExtFileInfo::copy( const KURL& src, const KURL& target, int permissions, bool overwrite, bool resume, TQWidget* window ) { - QExtFileInfo internalFileInfo; + TQExtFileInfo internalFileInfo; return internalFileInfo.internalCopy( src, target, permissions, overwrite, resume, window ); } /** No descriptions */ -KURL::List QExtFileInfo::allFilesInternal(const KURL& startURL, const TQString& mask, TQWidget *window) +KURL::List TQExtFileInfo::allFilesInternal(const KURL& startURL, const TQString& tqmask, TQWidget *window) { if (startURL.isLocalFile()) - return allLocalFiles(startURL.path(-1), mask); + return allLocalFiles(startURL.path(-1), tqmask); dirListItems.clear(); if (internalExists(startURL, true, window)) @@ -292,7 +292,7 @@ KURL::List QExtFileInfo::allFilesInternal(const KURL& startURL, const TQString& lstFilters.setAutoDelete(true); lstFilters.clear(); // Split on white space - TQStringList list = TQStringList::split( ' ', mask ); + TQStringList list = TQStringList::split( ' ', tqmask ); for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) lstFilters.append( new TQRegExp(*it, false, true ) ); @@ -320,7 +320,7 @@ KURL::List QExtFileInfo::allFilesInternal(const KURL& startURL, const TQString& } /** No descriptions */ -TQDict<KFileItem> QExtFileInfo::allFilesDetailedInternal(const KURL& startURL, const TQString& mask, TQWidget *window) +TQDict<KFileItem> TQExtFileInfo::allFilesDetailedInternal(const KURL& startURL, const TQString& tqmask, TQWidget *window) { detailedDirListItems.setAutoDelete(true); detailedDirListItems.clear(); @@ -330,7 +330,7 @@ TQDict<KFileItem> QExtFileInfo::allFilesDetailedInternal(const KURL& startURL, c lstFilters.setAutoDelete(true); lstFilters.clear(); // Split on white space - TQStringList list = TQStringList::split( ' ', mask ); + TQStringList list = TQStringList::split( ' ', tqmask ); for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) lstFilters.append( new TQRegExp(*it, false, true ) ); @@ -356,10 +356,10 @@ TQDict<KFileItem> QExtFileInfo::allFilesDetailedInternal(const KURL& startURL, c return detailedDirListItems; } -KURL::List QExtFileInfo::allLocalFiles(const TQString& startPath, const TQString& mask) +KURL::List TQExtFileInfo::allLocalFiles(const TQString& startPath, const TQString& tqmask) { KURL::List list; - TQDir d(startPath, mask); + TQDir d(startPath, tqmask); TQStringList l = d.entryList(); TQStringList::ConstIterator end = l.constEnd(); TQString path; @@ -379,7 +379,7 @@ KURL::List QExtFileInfo::allLocalFiles(const TQString& startPath, const TQString for (TQStringList::ConstIterator it = l.constBegin(); it != end; ++it) { if ((*it) != "." && (*it) != "..") - list += allLocalFiles(startPath + "/" + (*it), mask); + list += allLocalFiles(startPath + "/" + (*it), tqmask); } return list; } @@ -387,12 +387,12 @@ KURL::List QExtFileInfo::allLocalFiles(const TQString& startPath, const TQString //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, TQWidget *window) +bool TQExtFileInfo::internalExists(const KURL& url, bool readingOnly, TQWidget *window) { bJobOK = true; KURL url2 = url; url2.adjustPath(-1); - // kdDebug(24000)<<"QExtFileInfo::internalExists"<<endl; + // kdDebug(24000)<<"TQExtFileInfo::internalExists"<<endl; KIO::StatJob * job = KIO::stat(url2, false); job->setWindow(window); job->setDetails(0); @@ -402,13 +402,13 @@ bool QExtFileInfo::internalExists(const KURL& url, bool readingOnly, TQWidget *w //To avoid lock-ups, start a timer. TQTimer::singleShot(60*1000, this,TQT_SLOT(slotTimeout())); - //kdDebug(24000)<<"QExtFileInfo::internalExists:before enter_loop"<<endl; + //kdDebug(24000)<<"TQExtFileInfo::internalExists:before enter_loop"<<endl; enter_loop(); - //kdDebug(24000)<<"QExtFileInfo::internalExists:after enter_loop"<<endl; + //kdDebug(24000)<<"TQExtFileInfo::internalExists:after enter_loop"<<endl; return bJobOK; } -bool QExtFileInfo::internalCopy(const KURL& src, const KURL& target, int permissions, +bool TQExtFileInfo::internalCopy(const KURL& src, const KURL& target, int permissions, bool overwrite, bool resume, TQWidget* window) { bJobOK = true; // success unless further error occurs @@ -437,27 +437,27 @@ bool QExtFileInfo::internalCopy(const KURL& src, const KURL& target, int permiss void qt_enter_modal( TQWidget *widget ); void qt_leave_modal( TQWidget *widget ); -void QExtFileInfo::enter_loop() +void TQExtFileInfo::enter_loop() { TQWidget dummy(0,0,WType_Dialog | WShowModal); - dummy.setFocusPolicy( TQWidget::NoFocus ); + dummy.setFocusPolicy( TQ_NoFocus ); qt_enter_modal(&dummy); - //kdDebug(24000)<<"QExtFileInfo::enter_loop:before qApp->enter_loop()"<< endl; - qApp->enter_loop(); -// kdDebug(24000)<<"QExtFileInfo::enter_loop:after qApp->enter_loop()"<<endl; + //kdDebug(24000)<<"TQExtFileInfo::enter_loop:before tqApp->enter_loop()"<< endl; + tqApp->enter_loop(); +// kdDebug(24000)<<"TQExtFileInfo::enter_loop:after tqApp->enter_loop()"<<endl; qt_leave_modal(&dummy); } -void QExtFileInfo::slotListResult(KIO::Job *job) +void TQExtFileInfo::slotListResult(KIO::Job *job) { m_listJobCount--; if (m_listJobCount == 0) slotResult(job); } -void QExtFileInfo::slotResult(KIO::Job *job) +void TQExtFileInfo::slotResult(KIO::Job *job) { - //kdDebug(24000)<<"QExtFileInfo::slotResult"<<endl; + //kdDebug(24000)<<"TQExtFileInfo::slotResult"<<endl; bJobOK = !job->error(); if ( !bJobOK ) { @@ -466,14 +466,14 @@ void QExtFileInfo::slotResult(KIO::Job *job) } if ( job->isA("KIO::StatJob") ) m_entry = static_cast<KIO::StatJob *>(job)->statResult(); - qApp->exit_loop(); + tqApp->exit_loop(); } -void QExtFileInfo::slotNewEntries(KIO::Job *job, const KIO::UDSEntryList& udsList) +void TQExtFileInfo::slotNewEntries(KIO::Job *job, const KIO::UDSEntryList& udsList) { KURL url = static_cast<KIO::ListJob *>(job)->url(); url.adjustPath(-1); - // avoid creating these QStrings again and again + // avoid creating these TQStrings again and again static const TQString& dot = KGlobal::staticQString("."); static const TQString& dotdot = KGlobal::staticQString(".."); @@ -511,7 +511,7 @@ void QExtFileInfo::slotNewEntries(KIO::Job *job, const KIO::UDSEntryList& udsLis else u.setPath(linkDest); u.adjustPath(+1); - if (!dirListItems.contains(u) && u.url() != m_listStartURL && !u.isParentOf(item->url())) + if (!dirListItems.tqcontains(u) && u.url() != m_listStartURL && !u.isParentOf(item->url())) { linkItems.append(new KFileItem(*item)); } else @@ -543,11 +543,11 @@ void QExtFileInfo::slotNewEntries(KIO::Job *job, const KIO::UDSEntryList& udsLis } } -void QExtFileInfo::slotNewDetailedEntries(KIO::Job *job, const KIO::UDSEntryList& udsList) +void TQExtFileInfo::slotNewDetailedEntries(KIO::Job *job, const KIO::UDSEntryList& udsList) { KURL url = static_cast<KIO::ListJob *>(job)->url(); url.adjustPath(-1); - // avoid creating these QStrings again and again + // avoid creating these TQStrings again and again static const TQString& dot = KGlobal::staticQString("."); static const TQString& dotdot = KGlobal::staticQString(".."); @@ -577,7 +577,7 @@ void QExtFileInfo::slotNewDetailedEntries(KIO::Job *job, const KIO::UDSEntryList KURL u = item->url(); u.setPath(item->linkDest()); TQString urlStr = u.url(); - if (detailedDirListItems.find(urlStr) == 0L && + if (detailedDirListItems.tqfind(urlStr) == 0L && (urlStr != m_listStartURL)) { linkItems.append(new KFileItem(*item)); @@ -611,9 +611,9 @@ void QExtFileInfo::slotNewDetailedEntries(KIO::Job *job, const KIO::UDSEntryList } /** Timeout occurred while waiting for some network function to return. */ -void QExtFileInfo::slotTimeout() +void TQExtFileInfo::slotTimeout() { bJobOK = false; - qApp->exit_loop(); + tqApp->exit_loop(); } #include "qextfileinfo.moc" |