diff options
| author | Slávek Banko <slavek.banko@axis.cz> | 2013-09-23 00:43:43 +0200 |
|---|---|---|
| committer | Slávek Banko <slavek.banko@axis.cz> | 2013-09-23 00:43:43 +0200 |
| commit | e03da7a558d79e399e3704a5b2f35646e92dacb7 (patch) | |
| tree | e9948950e8947f6978fa3270605d04f94216515b /src/utils.cpp | |
| parent | b9d8d75902c4603fa10c63735873816556a7468c (diff) | |
| download | tdeio-sword-e03da7a558d79e399e3704a5b2f35646e92dacb7.tar.gz tdeio-sword-e03da7a558d79e399e3704a5b2f35646e92dacb7.zip | |
Initial TQt conversion
Diffstat (limited to 'src/utils.cpp')
| -rw-r--r-- | src/utils.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/utils.cpp b/src/utils.cpp index 15e1506..dcbbe17 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -26,7 +26,7 @@ #include "swordoptions.h" #include <kurl.h> -#include <qstring.h> +#include <ntqstring.h> namespace KioSword { @@ -40,9 +40,9 @@ namespace KioSword { static void mergeOptionsToURL(KURL& url, const SwordOptions* options) { - QMap<QString, QString> items = options->getQueryStringParams(); - QMap<QString, QString>::const_iterator it; - QMap<QString, QString>::const_iterator it_end = items.end(); + TQMap<TQString, TQString> items = options->getQueryStringParams(); + TQMap<TQString, TQString>::const_iterator it; + TQMap<TQString, TQString>::const_iterator it_end = items.end(); for(it = items.begin(); it != it_end; ++it) { url.addQueryItem(it.key(), it.data()); } @@ -53,9 +53,9 @@ namespace KioSword { return mergeOptionsToURL(url, &options); } - static QString htmlEncode(const QString& text) + static TQString htmlEncode(const TQString& text) { - QString output = text; + TQString output = text; return output .replace("&", "&") .replace("<", "<") @@ -64,14 +64,14 @@ namespace KioSword { } /** Returns options that need to be propagated as HTML for a form */ - QString optionsAsHiddenFields(const SwordOptions& options) + TQString optionsAsHiddenFields(const SwordOptions& options) { - QString output; - QMap<QString, QString> items = options.getQueryStringParams(); - QMap<QString, QString>::const_iterator it; - QMap<QString, QString>::const_iterator it_end = items.end(); + TQString output; + TQMap<TQString, TQString> items = options.getQueryStringParams(); + TQMap<TQString, TQString>::const_iterator it; + TQMap<TQString, TQString>::const_iterator it_end = items.end(); for(it = items.begin(); it != it_end; ++it) { - output += QString("<input type=\"hidden\" name=\"%1\" value=\"%2\">") + output += TQString("<input type=\"hidden\" name=\"%1\" value=\"%2\">") .arg(it.key()) .arg(htmlEncode(it.data())); } @@ -87,8 +87,8 @@ namespace KioSword { * * @param path path to be encode */ - QString swordUrl(const QString& path, const SwordOptions& options, bool htmlEncodeOutput) { - QString output; + TQString swordUrl(const TQString& path, const SwordOptions& options, bool htmlEncodeOutput) { + TQString output; KURL url; url.setProtocol(SWORD_PROTOCOL); if (path.at(0) != '/') @@ -107,7 +107,7 @@ namespace KioSword { * @param module name of module * @param reference within module */ - QString swordUrl(const QString& module, const QString& ref, const SwordOptions& options, bool htmlEncodeOutput) { + TQString swordUrl(const TQString& module, const TQString& ref, const SwordOptions& options, bool htmlEncodeOutput) { if (ref.at(0) == '/') return swordUrl(module + ref, options, htmlEncodeOutput); else @@ -118,9 +118,9 @@ namespace KioSword { * return a valid sword URL for 'pages' such as 'help', 'settings' etc, * which are defined using a query parameter */ - QString swordUrlForPage(const QString& page, const SwordOptions& options, bool htmlEncodeOutput) + TQString swordUrlForPage(const TQString& page, const SwordOptions& options, bool htmlEncodeOutput) { - QString output; + TQString output; KURL url; url.setProtocol(SWORD_PROTOCOL); url.addPath("/"); @@ -132,9 +132,9 @@ namespace KioSword { return url.url(0, 106); // return as utf-8 } - QString swordUrlForSettings(const QString& path, const SwordOptions& options, bool htmlEncodeOutput) + TQString swordUrlForSettings(const TQString& path, const SwordOptions& options, bool htmlEncodeOutput) { - QString output; + TQString output; KURL url; url.setProtocol(SWORD_PROTOCOL); url.addPath("/"); @@ -158,16 +158,16 @@ namespace KioSword { } /** Get a URL for doing a search */ - QString swordUrlForSearch(DefModuleType modType, const QString& searchQuery, const SwordOptions& options, bool htmlEncodeOutput) + TQString swordUrlForSearch(DefModuleType modType, const TQString& searchQuery, const SwordOptions& options, bool htmlEncodeOutput) { return swordUrlForSearch(modType, searchQuery, &options, htmlEncodeOutput); } /** Get a URL for doing a search */ - QString swordUrlForSearch(DefModuleType modType, const QString& searchQuery, const SwordOptions* options, bool htmlEncodeOutput) + TQString swordUrlForSearch(DefModuleType modType, const TQString& searchQuery, const SwordOptions* options, bool htmlEncodeOutput) { - QString modTypeStr; - QString output; + TQString modTypeStr; + TQString output; KURL url; // FIXME - make this into a dictionary or something better? switch (modType) @@ -202,8 +202,8 @@ namespace KioSword { } /** truncate a string to len chars, adding an ellipsis if necessary */ - QString shorten(const QString &ref, uint len) { - QString output = ref.stripWhiteSpace(); + TQString shorten(const TQString &ref, uint len) { + TQString output = ref.stripWhiteSpace(); if (output.length() > len) output = output.left(len-2) + "..."; return output; |
