From e03da7a558d79e399e3704a5b2f35646e92dacb7 Mon Sep 17 00:00:00 2001 From: Slávek Banko Date: Mon, 23 Sep 2013 00:43:43 +0200 Subject: Initial TQt conversion --- src/utils.cpp | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'src/utils.cpp') 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 -#include +#include namespace KioSword { @@ -40,9 +40,9 @@ namespace KioSword { static void mergeOptionsToURL(KURL& url, const SwordOptions* options) { - QMap items = options->getQueryStringParams(); - QMap::const_iterator it; - QMap::const_iterator it_end = items.end(); + TQMap items = options->getQueryStringParams(); + TQMap::const_iterator it; + TQMap::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 items = options.getQueryStringParams(); - QMap::const_iterator it; - QMap::const_iterator it_end = items.end(); + TQString output; + TQMap items = options.getQueryStringParams(); + TQMap::const_iterator it; + TQMap::const_iterator it_end = items.end(); for(it = items.begin(); it != it_end; ++it) { - output += QString("") + output += TQString("") .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; -- cgit v1.2.3