summaryrefslogtreecommitdiffstats
path: root/src/tools.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-10 06:08:18 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-10 06:08:18 +0000
commit33f08e93132a53bf14f41f5f1e567eeea832b336 (patch)
treef71204bc1c7d41a0545805a1276c5af43e1c3094 /src/tools.cpp
parent14284db4dfa93999d6227344141e8663d9fcf7f9 (diff)
downloadbasket-33f08e93132a53bf14f41f5f1e567eeea832b336.tar.gz
basket-33f08e93132a53bf14f41f5f1e567eeea832b336.zip
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
Diffstat (limited to 'src/tools.cpp')
-rw-r--r--src/tools.cpp76
1 files changed, 38 insertions, 38 deletions
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 == "&nbsp;")
return "<p>&nbsp;</p>";
- // convertFromPlainText() tqreplace "\n\n" by "</p>\n<p>": we don't want that
+ // convertFromPlainText() replace "\n\n" by "</p>\n<p>": we don't want that
TQString htmlString = TQStyleSheet::convertFromPlainText(text, TQStyleSheetItem::WhiteSpaceNormal);
- return htmlString.tqreplace("</p>\n", "<br>\n<br>\n").tqreplace("\n<p>", "\n"); // Don't replace first and last tags
+ return htmlString.replace("</p>\n", "<br>\n<br>\n").replace("\n<p>", "\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 <html> start tag, all the <head> and the <body> start
// Because <body> can contain style="..." parameter, we transform it to <span>
- int pos = result.tqfind("<body");
+ int pos = result.find("<body");
if (pos != -1) {
result = "<span" + result.mid(pos + 5);
startedBySpan = true;
@@ -96,14 +96,14 @@ TQString Tools::htmlToParagraph(const TQString &html)
// Remove the ending "</p>\n</body></html>", each tag can be separated by space characters (%s)
// "</p>" can be omitted (eg. if the HTML doesn't contain paragraph but tables), as well as "</body>" (optinal)
- pos = result.tqfind(TQRegExp("(?:(?:</p>[\\s\\n\\r\\t]*)*</body>[\\s\\n\\r\\t]*)*</html>", false)); // Case unsensitive
+ pos = result.find(TQRegExp("(?:(?:</p>[\\s\\n\\r\\t]*)*</body>[\\s\\n\\r\\t]*)*</html>", false)); // Case unsensitive
if (pos != -1)
result = result.left(pos);
if (startedBySpan)
result += "</span>";
- return result.tqreplace("</p>", "<br><br>").tqreplace("<p>", "");
+ return result.replace("</p>", "<br><br>").replace("<p>", "");
}
// The following is adapted from KStringHanlder::tagURLs
@@ -125,7 +125,7 @@ TQString Tools::tagURLs(const TQString &text)
continue;
}
TQString anchor = "<a href=\"" + href + "\">" + href + "</a>";
- 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("</h1>", "\n");
- text.tqreplace("</h2>", "\n");
- text.tqreplace("</h3>", "\n");
- text.tqreplace("</h4>", "\n");
- text.tqreplace("</h5>", "\n");
- text.tqreplace("</h6>", "\n");
- text.tqreplace("</li>", "\n");
- text.tqreplace("</dt>", "\n");
- text.tqreplace("</dd>", "\n");
- text.tqreplace("<dd>", " ");
- text.tqreplace("</div>","\n");
- text.tqreplace("</blockquote>","\n");
- text.tqreplace("</caption>","\n");
- text.tqreplace("</tr>", "\n");
- text.tqreplace("</th>", " ");
- text.tqreplace("</td>", " ");
- text.tqreplace("<br>", "\n");
- text.tqreplace("<br />","\n");
+ text.replace("</h1>", "\n");
+ text.replace("</h2>", "\n");
+ text.replace("</h3>", "\n");
+ text.replace("</h4>", "\n");
+ text.replace("</h5>", "\n");
+ text.replace("</h6>", "\n");
+ text.replace("</li>", "\n");
+ text.replace("</dt>", "\n");
+ text.replace("</dd>", "\n");
+ text.replace("<dd>", " ");
+ text.replace("</div>","\n");
+ text.replace("</blockquote>","\n");
+ text.replace("</caption>","\n");
+ text.replace("</tr>", "\n");
+ text.replace("</th>", " ");
+ text.replace("</td>", " ");
+ text.replace("<br>", "\n");
+ text.replace("<br />","\n");
// FIXME: Format <table> tags better, if possible
// TODO: Replace &eacute; and co. by theire equivalent!
@@ -165,7 +165,7 @@ TQString Tools::htmlToText(const TQString &html)
TQValueStack<bool> ul; // true if current list is a <ul> one, false if it's an <ol> one
TQValueStack<int> lines; // The line number if it is an <ol> 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("&gt;", ">");
- text.tqreplace("&lt;", "<");
- text.tqreplace("&quot;", "\"");
- text.tqreplace("&nbsp;", " ");
- text.tqreplace("&amp;", "&"); // CONVERT IN LAST!!
+ text.replace("&gt;", ">");
+ text.replace("&lt;", "<");
+ text.replace("&quot;", "\"");
+ text.replace("&nbsp;", " ");
+ text.replace("&amp;", "&"); // 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);