From 33f08e93132a53bf14f41f5f1e567eeea832b336 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 10 Aug 2011 06:08:18 +0000 Subject: rename the following methods: tqfind find tqreplace replace tqcontains contains git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/basket@1246075 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/tools.cpp | 76 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 38 insertions(+), 38 deletions(-) (limited to 'src/tools.cpp') diff --git a/src/tools.cpp b/src/tools.cpp index 2d3cce7..7d74837 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -69,9 +69,9 @@ TQString Tools::textToHTML(const TQString &text) if (/*text.isEmpty() ||*/ text == " " || text == " ") return "

 

"; - // convertFromPlainText() tqreplace "\n\n" by "

\n

": we don't want that + // convertFromPlainText() replace "\n\n" by "

\n

": we don't want that TQString htmlString = TQStyleSheet::convertFromPlainText(text, TQStyleSheetItem::WhiteSpaceNormal); - return htmlString.tqreplace("

\n", "
\n
\n").tqreplace("\n

", "\n"); // Don't replace first and last tags + return htmlString.replace("

\n", "
\n
\n").replace("\n

", "\n"); // Don't replace first and last tags } TQString Tools::textToHTMLWithoutP(const TQString &text) @@ -88,7 +88,7 @@ TQString Tools::htmlToParagraph(const TQString &html) // Remove the start tag, all the and the start // Because can contain style="..." parameter, we transform it to - int pos = result.tqfind("\n", each tag can be separated by space characters (%s) // "

" can be omitted (eg. if the HTML doesn't contain paragraph but tables), as well as "" (optinal) - pos = result.tqfind(TQRegExp("(?:(?:

[\\s\\n\\r\\t]*)*[\\s\\n\\r\\t]*)*", false)); // Case unsensitive + pos = result.find(TQRegExp("(?:(?:

[\\s\\n\\r\\t]*)*[\\s\\n\\r\\t]*)*", false)); // Case unsensitive if (pos != -1) result = result.left(pos); if (startedBySpan) result += ""; - return result.tqreplace("

", "

").tqreplace("

", ""); + return result.replace("

", "

").replace("

", ""); } // The following is adapted from KStringHanlder::tagURLs @@ -125,7 +125,7 @@ TQString Tools::tagURLs(const TQString &text) continue; } TQString anchor = "" + href + ""; - richText.tqreplace(urlPos, urlLen, anchor); + richText.replace(urlPos, urlLen, anchor); urlPos += anchor.length(); } return richText; @@ -135,24 +135,24 @@ TQString Tools::htmlToText(const TQString &html) { TQString text = htmlToParagraph(html); text.remove("\n"); - text.tqreplace("", "\n"); - text.tqreplace("", "\n"); - text.tqreplace("", "\n"); - text.tqreplace("", "\n"); - text.tqreplace("", "\n"); - text.tqreplace("", "\n"); - text.tqreplace("", "\n"); - text.tqreplace("", "\n"); - text.tqreplace("", "\n"); - text.tqreplace("

", " "); - text.tqreplace("","\n"); - text.tqreplace("","\n"); - text.tqreplace("","\n"); - text.tqreplace("", "\n"); - text.tqreplace("", " "); - text.tqreplace("", " "); - text.tqreplace("
", "\n"); - text.tqreplace("
","\n"); + text.replace("", "\n"); + text.replace("", "\n"); + text.replace("", "\n"); + text.replace("", "\n"); + text.replace("", "\n"); + text.replace("", "\n"); + text.replace("", "\n"); + text.replace("", "\n"); + text.replace("
", "\n"); + text.replace("
", " "); + text.replace("","\n"); + text.replace("","\n"); + text.replace("","\n"); + text.replace("", "\n"); + text.replace("", " "); + text.replace("", " "); + text.replace("
", "\n"); + text.replace("
","\n"); // FIXME: Format tags better, if possible // TODO: Replace é and co. by theire equivalent! @@ -165,7 +165,7 @@ TQString Tools::htmlToText(const TQString &html) TQValueStack ul; // true if current list is a
    one, false if it's an
      one TQValueStack lines; // The line number if it is an
        list // We're removing every other tags, or replace them in the case of li: - while ( (pos = text.tqfind("<"), pos) != -1 ) { + while ( (pos = text.find("<"), pos) != -1 ) { // What is the current tag? tag = text.mid(pos + 1, 2); tag3 = text.mid(pos + 1, 3); @@ -184,7 +184,7 @@ TQString Tools::htmlToText(const TQString &html) lines.pop(); } // Where the tag closes? - pos2 = text.tqfind(">"); + pos2 = text.find(">"); if (pos2 != -1) { // Remove the tag: text.remove(pos, pos2 - pos + 1); @@ -209,11 +209,11 @@ TQString Tools::htmlToText(const TQString &html) ++pos; } - text.tqreplace(">", ">"); - text.tqreplace("<", "<"); - text.tqreplace(""", "\""); - text.tqreplace(" ", " "); - text.tqreplace("&", "&"); // CONVERT IN LAST!! + text.replace(">", ">"); + text.replace("<", "<"); + text.replace(""", "\""); + text.replace(" ", " "); + text.replace("&", "&"); // CONVERT IN LAST!! return text; } @@ -227,14 +227,14 @@ TQString Tools::cssFontDefinition(const TQFont &font, bool onlyFontFamily) // Then, try to match the font name with a standard CSS font family: TQString genericFont = ""; - if (definition.tqcontains("serif", false) || definition.tqcontains("roman", false)) + if (definition.contains("serif", false) || definition.contains("roman", false)) genericFont = "serif"; // No "else if" because "sans serif" must be counted as "sans". So, the order between "serif" and "sans" is important - if (definition.tqcontains("sans", false) || definition.tqcontains("arial", false) || definition.tqcontains("helvetica", false)) + if (definition.contains("sans", false) || definition.contains("arial", false) || definition.contains("helvetica", false)) genericFont = "sans-serif"; - if (definition.tqcontains("mono", false) || definition.tqcontains("courier", false) || - definition.tqcontains("typewriter", false) || definition.tqcontains("console", false) || - definition.tqcontains("terminal", false) || definition.tqcontains("news", false)) + if (definition.contains("mono", false) || definition.contains("courier", false) || + definition.contains("typewriter", false) || definition.contains("console", false) || + definition.contains("terminal", false) || definition.contains("news", false)) genericFont = "monospace"; // Eventually add the generic font family to the definition: @@ -384,7 +384,7 @@ TQString Tools::fileNameForNewFile(const TQString &wantedName, const TQString &d // Find the file extension, if it exists : Split fileName in fileName and extension // Example : fileName == "note5-3.txt" => fileName = "note5-3" and extension = ".txt" - int extIndex = fileName.tqfindRev('.'); + int extIndex = fileName.findRev('.'); if (extIndex != -1 && extIndex != int(fileName.length()-1)) { // Extension found and fileName do not ends with '.' ! extension = fileName.mid(extIndex); fileName.truncate(extIndex); @@ -392,7 +392,7 @@ TQString Tools::fileNameForNewFile(const TQString &wantedName, const TQString &d // Find the file number, if it exists : Split fileName in fileName and number // Example : fileName == "note5-3" => fileName = "note5" and number = 3 - int extNumber = fileName.tqfindRev('-'); + int extNumber = fileName.findRev('-'); if (extNumber != -1 && extNumber != int(fileName.length()-1)) { // Number found and fileName do not ends with '-' ! bool isANumber; int theNumber = fileName.mid(extNumber + 1).toInt(&isANumber); -- cgit v1.2.1