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/kio_sword.cpp | |
parent | b9d8d75902c4603fa10c63735873816556a7468c (diff) | |
download | tdeio-sword-e03da7a558d79e399e3704a5b2f35646e92dacb7.tar.gz tdeio-sword-e03da7a558d79e399e3704a5b2f35646e92dacb7.zip |
Initial TQt conversion
Diffstat (limited to 'src/kio_sword.cpp')
-rw-r--r-- | src/kio_sword.cpp | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/src/kio_sword.cpp b/src/kio_sword.cpp index b0db5bc..ddb4afa 100644 --- a/src/kio_sword.cpp +++ b/src/kio_sword.cpp @@ -37,9 +37,9 @@ #include <kurl.h> #include <kstandarddirs.h> -// Qt -#include <qcstring.h> -#include <qmap.h> +// TQt +#include <ntqcstring.h> +#include <ntqmap.h> // Standard C++ /C #include <list> @@ -77,13 +77,13 @@ namespace KioSword class SwordOptions; // HTML fragments that will be initialised at run time ------------------------------------------------------------------------- - static QString search_form; - static QString help_page; + static TQString search_form; + static TQString help_page; - SwordProtocol::SwordProtocol(const QCString & pool_socket, - const QCString & app_socket) + SwordProtocol::SwordProtocol(const TQCString & pool_socket, + const TQCString & app_socket) : SlaveBase("kio_sword", pool_socket, app_socket) { kdDebug() << "SwordProtocol::SwordProtocol()" << endl; @@ -98,14 +98,14 @@ namespace KioSword void SwordProtocol::get(const KURL & url) { - QString modname; - QString query; - QString error; + TQString modname; + TQString query; + TQString error; kdDebug() << "SwordProtocol::get(const KURL& url)" << endl; /* kdDebug() << "Seconds: " << url.query() << endl; - QString remoteServer = url.host(); + TQString remoteServer = url.host(); int remotePort = url.port(); kdDebug() << "myURL: " << url.prettyURL() << endl; */ @@ -141,8 +141,8 @@ namespace KioSword } else { - modname = m_path.section('/', 0, 0, QString::SectionSkipEmpty); - query = m_path.section('/', 1, -1, QString::SectionSkipEmpty); + modname = m_path.section('/', 0, 0, TQString::SectionSkipEmpty); + query = m_path.section('/', 1, -1, TQString::SectionSkipEmpty); } } @@ -206,7 +206,7 @@ namespace KioSword if (!modname.isEmpty()) { m_renderer.moduleQuery(modname, query, m_options, tmplt); } else { - QString body; + TQString body; tmplt->setTitle(i18n("Modules - Kio-Sword")); if (!error.isEmpty()) { body = error; @@ -255,16 +255,16 @@ namespace KioSword finished(); } - /* redefine data for QCStrings so we don't send the trailing + /* redefine data for TQCStrings so we don't send the trailing null */ - void SwordProtocol::data(const QCString& text) { - QByteArray nonull; + void SwordProtocol::data(const TQCString& text) { + TQByteArray nonull; nonull.setRawData(text.data(), text.size()-1); SlaveBase::data(nonull); nonull.resetRawData(text.data(), text.size()-1); } - void SwordProtocol::data(const QByteArray& array) { + void SwordProtocol::data(const TQByteArray& array) { SlaveBase::data(array); } @@ -273,9 +273,9 @@ namespace KioSword m_options.readFromConfig(m_config); } - QString SwordProtocol::saveUserConfig() + TQString SwordProtocol::saveUserConfig() { - QString message; + TQString message; m_options.saveToConfig(m_config); m_config->sync(); // search form depends on settings, so force it to be recreated @@ -295,11 +295,11 @@ namespace KioSword // Reset data members that should always be // retrieved from URL m_action = QUERY; - m_path = QString::null; - m_redirect.module = QString::null; - m_redirect.query = QString::null; - m_previous.module = QString::null; - m_previous.query = QString::null; + m_path = TQString::null; + m_redirect.module = TQString::null; + m_redirect.query = TQString::null; + m_previous.module = TQString::null; + m_previous.query = TQString::null; m_moduletype = DEFMODULETYPE_NONE; if (url.hasPath()) @@ -310,10 +310,10 @@ namespace KioSword // URLs will be encoded in UTF-8 since they are sometimes // generated from the search form, and the browser will // encode in UTF-8 since the whole page has UTF-8 charset - QMap<QString, QString> items = url.queryItems(KURL::CaseInsensitiveKeys, 106); - QMap<QString, QString>::const_iterator it; - QMap<QString, QString>::const_iterator it_end = items.end(); - QString val; + TQMap<TQString, TQString> items = url.queryItems(KURL::CaseInsensitiveKeys, 106); + TQMap<TQString, TQString>::const_iterator it; + TQMap<TQString, TQString>::const_iterator it_end = items.end(); + TQString val; const char *key; for(it = items.begin(); it != it_end; it++) { @@ -366,8 +366,8 @@ namespace KioSword else ENUM_OPTION(m_action, "testsettings", REDIRECT_QUERY) else if (!strcasecmp(key, "previouspath")) { - m_previous.module = val.section('/', 0, 0, QString::SectionSkipEmpty); - m_previous.query = val.section('/', 1, -1, QString::SectionSkipEmpty); + m_previous.module = val.section('/', 0, 0, TQString::SectionSkipEmpty); + m_previous.query = val.section('/', 1, -1, TQString::SectionSkipEmpty); } } @@ -382,16 +382,16 @@ namespace KioSword void SwordProtocol::sendPage(const Template* tplt) { data(tplt->render(m_options)); - data(QByteArray()); // empty array means we're done sending the data + data(TQByteArray()); // empty array means we're done sending the data finished(); } /** Returns a string representing notes about an option for the settings page */ template <class T> - QString optionNotes(const Option<T>& option) + TQString optionNotes(const Option<T>& option) { - QString output; + TQString output; if (!option.m_propagate) { output += "<sup>1</sup>"; @@ -409,8 +409,8 @@ namespace KioSword /** HTML for a boolean option */ - QString settingsBooleanOptionRow(const QString& description, const Option<bool>& option) { - static const QString boolean_option_row( + TQString settingsBooleanOptionRow(const TQString& description, const Option<bool>& option) { + static const TQString boolean_option_row( "<tr><td>%1</td><td><nobr><input type='radio' name='%2' value='1' %3>%4 <input type='radio' name='%2' value='0' %5>%6</nobr></td><td>%2, %7</td></tr>"); return boolean_option_row .arg(description + optionNotes(option)) @@ -432,10 +432,10 @@ namespace KioSword * @param optionList HTML containing the <option>s * @return */ - QString settingsGeneralOptionRow(const QString& description, const Option<QString>& option, - const QString& optionList) + TQString settingsGeneralOptionRow(const TQString& description, const Option<TQString>& option, + const TQString& optionList) { - static const QString general_option_row( + static const TQString general_option_row( "<tr><td>%1</td><td><select name='%2'>%3</select></td><td>%4, %5</td></tr>"); return general_option_row .arg(description + optionNotes(option)) @@ -445,13 +445,13 @@ namespace KioSword .arg(option.m_qsLongName); } - QString SwordProtocol::settingsForm() { - QString output; - QStringList modules; - QStringList::Iterator it; - QString temp; + TQString SwordProtocol::settingsForm() { + TQString output; + TQStringList modules; + TQStringList::Iterator it; + TQString temp; - static const QString separator_row( + static const TQString separator_row( "<tr><td class='settingscategory' colspan='3'>%1</td></tr>"); @@ -461,7 +461,7 @@ namespace KioSword " save these settings to your own configuration file. 'Test settings' will return " " you to the previous page with the options you have specified. <br>"); - output += QString( + output += TQString( "<form action='sword:/' method='GET'>" "<table class='settings' border=0 cellspacing=0>" " <tr><th>%1</th><th>%2</th><th>%4</th></tr>") @@ -480,11 +480,11 @@ namespace KioSword output += separator_row.arg(i18n("Language")); // Locale - QStringList locales = m_renderer.availableLocales(); + TQStringList locales = m_renderer.availableLocales(); temp = ""; for (int i = 0; i < locales.size(); i++) { - temp += QString("<option value='%1' %3>%2</option>") + temp += TQString("<option value='%1' %3>%2</option>") .arg(locales[i]) .arg(locales[i]) .arg((m_options.locale() == locales[i]) ? "selected" : ""); @@ -513,9 +513,9 @@ namespace KioSword output += separator_row.arg(i18n("Default modules")); modules = m_renderer.moduleList(); - vector<QString> dm_desc; - vector<Option<QString> > dm_options; - vector<QString>::size_type i; + vector<TQString> dm_desc; + vector<Option<TQString> > dm_options; + vector<TQString>::size_type i; dm_desc.push_back(i18n("Default Bible")); dm_options.push_back(m_options.defaultBible); @@ -532,11 +532,11 @@ namespace KioSword dm_options.push_back(m_options.defaultHebrewMorph); for (i = 0; i < dm_options.size(); i++) { - temp = QString("<option value='' %1> </option>") + temp = TQString("<option value='' %1> </option>") .arg(dm_options[i]().stripWhiteSpace().isEmpty() ? "selected" : ""); for (it = modules.begin(); it != modules.end(); ++it ) { - temp += QString("<option value='%1' %3>%2</option>") + temp += TQString("<option value='%1' %3>%2</option>") .arg(*it) .arg(*it) .arg(((*it) == dm_options[i]() ? "selected" : "")); @@ -549,13 +549,13 @@ namespace KioSword output += settingsBooleanOptionRow(i18n("Make formatting options propagate. This makes Kio-Sword remember formatting settings that you have set, by propagating them in the links. (Some navigation options are always excluded from this behaviour)."), m_options.propagate); - output += QString("</table>"); + output += TQString("</table>"); output += i18n("<p>Notes:<br/>" "1) These options never propagate<br/>" "2) These options are never saved<br/></p>"); - output += QString( + output += TQString( "<br><input type='hidden' name='module' value='%1'>" // redirection path "<input type='hidden' name='query' value='%2'>" // redirection path "<input type='submit' name='testsettings' value='%3'> " // "Test settings" @@ -576,7 +576,7 @@ namespace KioSword return output; } - QString SwordProtocol::helpPage() { + TQString SwordProtocol::helpPage() { if (help_page.isEmpty()) { help_page += i18n("<h1>Help</h1>" "<p>For full documentation, see <a href=\"help:/kio_sword\">installed help files</a>.</p>" @@ -616,8 +616,8 @@ namespace KioSword return help_page; } - QString SwordProtocol::searchForm(const SwordOptions& options) { - static const QString search_form_tmpl( + TQString SwordProtocol::searchForm(const SwordOptions& options) { + static const TQString search_form_tmpl( "<h1 class='searchform'>%1</h1>" // title "<div class='searchform'>" "<form action='sword:/' method='GET'>" @@ -646,13 +646,13 @@ namespace KioSword "</div>"); if (search_form.isEmpty()) { // avoid calculating this twice - QStringList modules = m_renderer.moduleList(); - QString temp; - QStringList::Iterator it; + TQStringList modules = m_renderer.moduleList(); + TQString temp; + TQStringList::Iterator it; temp = "<option value=''></option>"; for (it = modules.begin(); it != modules.end(); ++it ) { - temp += QString("<option value='%1' %3>%2</option>") + temp += TQString("<option value='%1' %3>%2</option>") .arg(*it) .arg(*it) .arg((*it == m_options.defaultBible()) ? "selected='selected'" : ""); @@ -670,7 +670,7 @@ namespace KioSword } // search_form is generated once, but we need to modify // form each time to include propagated values - QString output(search_form); + TQString output(search_form); return output.replace("</form>", optionsAsHiddenFields(options) + "</form>"); } } |