diff options
Diffstat (limited to 'src/svnqt/path.cpp')
-rw-r--r-- | src/svnqt/path.cpp | 76 |
1 files changed, 32 insertions, 44 deletions
diff --git a/src/svnqt/path.cpp b/src/svnqt/path.cpp index 676c151..71b877c 100644 --- a/src/svnqt/path.cpp +++ b/src/svnqt/path.cpp @@ -43,16 +43,16 @@ #include "svnqt/revision.hpp" #include "svnqt/exception.hpp" -#include <qurl.h> +#include <tqurl.h> namespace svn { Path::Path (const char * path) { - init(QString::FROMUTF8(path)); + init(TQString::FROMUTF8(path)); } - Path::Path (const QString & path) + Path::Path (const TQString & path) { init (path); } @@ -63,7 +63,7 @@ namespace svn } void - Path::init (const QString& path) + Path::init (const TQString& path) { Pool pool; @@ -76,25 +76,17 @@ namespace svn int_path = svn_path_uri_encode(int_path,pool); } } - m_path = QString::FROMUTF8(int_path); -#if QT_VERSION < 0x040000 - if (Url::isValid(path) && m_path.find("@")!=-1 ) { -#else - if (Url::isValid(path) && m_path.indexOf("@")!=-1 ) { -#endif + m_path = TQString::FROMUTF8(int_path); + if (Url::isValid(path) && m_path.tqfind("@")!=-1 ) { /// @todo make sure that "@" is never used as revision paramter - QUrl uri = m_path; + TQUrl uri = m_path; m_path = uri.path(); - m_path.replace("@","%40"); -#if QT_VERSION < 0x040000 + m_path.tqreplace("@","%40"); m_path = uri.protocol()+"://"+(uri.hasUser()?uri.user()+(uri.hasPassword()?":"+uri.password():"")+"@":"") +uri.host()+m_path; -#else - m_path = uri.scheme()+"://"+uri.authority()+m_path; -#endif if (m_path.endsWith("/")) { int_path = svn_path_internal_style (path.TOUTF8(), pool.pool () ); - m_path = QString::FROMUTF8(int_path); + m_path = TQString::FROMUTF8(int_path); } } } @@ -105,30 +97,30 @@ namespace svn return Url::isValid(m_path); } - const QString & + const TQString & Path::path () const { return m_path; } - Path::operator const QString&()const + Path::operator const TQString&()const { return m_path; } - QString Path::prettyPath()const + TQString Path::prettyPath()const { if (!Url::isValid(m_path)) { return m_path; } Pool pool; const char * int_path = svn_path_uri_decode(m_path.TOUTF8(), pool.pool () ); - QString _p = QString::FROMUTF8(int_path); - _p.replace("%40","@"); + TQString _p = TQString::FROMUTF8(int_path); + _p.tqreplace("%40","@"); return _p; } - const QByteArray + const TQByteArray Path::cstr() const { return m_path.TOUTF8(); @@ -150,7 +142,7 @@ namespace svn } void - Path::addComponent (const QString& component) + Path::addComponent (const TQString& component) { Pool pool; @@ -158,7 +150,7 @@ namespace svn { const char * newPath = svn_path_url_add_component (m_path.TOUTF8(), component.TOUTF8(), pool); - m_path = QString::FROMUTF8(newPath); + m_path = TQString::FROMUTF8(newPath); } else { @@ -168,7 +160,7 @@ namespace svn svn_path_add_component (pathStringbuf, component.TOUTF8()); - m_path = QString::FROMUTF8(pathStringbuf->data); + m_path = TQString::FROMUTF8(pathStringbuf->data); } } @@ -176,7 +168,7 @@ namespace svn void Path::addComponent (const char* component) { - addComponent (QString::FROMUTF8(component)); + addComponent (TQString::FROMUTF8(component)); } @@ -185,16 +177,16 @@ namespace svn { Pool pool; if (m_path.length()<=1) { - m_path=QString::FROMUTF8(""); + m_path=TQString::FROMUTF8(""); } svn_stringbuf_t*pathStringbuf= svn_stringbuf_create (m_path.TOUTF8(), pool); svn_path_remove_component(pathStringbuf); - m_path = QString::FROMUTF8(pathStringbuf->data); + m_path = TQString::FROMUTF8(pathStringbuf->data); } void - Path::split (QString & dirpath, QString & basename) const + Path::split (TQString & dirpath, TQString & basename) const { Pool pool; @@ -202,30 +194,26 @@ namespace svn const char * cbasename; svn_path_split (prettyPath().TOUTF8(), &cdirpath, &cbasename, pool); - dirpath = QString::FROMUTF8(cdirpath); - basename = QString::FROMUTF8(cbasename); + dirpath = TQString::FROMUTF8(cdirpath); + basename = TQString::FROMUTF8(cbasename); } void - Path::split (QString & dir, QString & filename, QString & ext) const + Path::split (TQString & dir, TQString & filename, TQString & ext) const { - QString basename; + TQString basename; // first split path into dir and filename+ext split (dir, basename); // next search for last . -#if QT_VERSION < 0x040000 - int pos = basename.findRev(QChar('.')); -#else - int pos = basename.lastIndexOf(QChar('.')); -#endif + int pos = basename.tqfindRev(TQChar('.')); if (pos == -1) { filename = basename; - ext = QString::fromLatin1(""); + ext = TQString::tqfromLatin1(""); } else { @@ -249,12 +237,12 @@ namespace svn } void - Path::parsePeg(const QString&pathorurl,Path&_path,svn::Revision&_peg) + Path::parsePeg(const TQString&pathorurl,Path&_path,svn::Revision&_peg) { const char *truepath = 0; svn_opt_revision_t pegr; svn_error_t *error = 0; - QByteArray _buf = pathorurl.TOUTF8(); + TQByteArray _buf = pathorurl.TOUTF8(); Pool pool; error = svn_opt_parse_path(&pegr, &truepath,_buf,pool); @@ -273,12 +261,12 @@ namespace svn } - QString + TQString Path::native () const { Pool pool; - return QString::FROMUTF8(svn_path_local_style (m_path.TOUTF8(), pool)); + return TQString::FROMUTF8(svn_path_local_style (m_path.TOUTF8(), pool)); } } |