From aa0726b20f398264f0a2abc60215be044b106f9c Mon Sep 17 00:00:00 2001
From: tpearson
Date: Tue, 17 May 2011 08:20:48 +0000
Subject: TQt4 port basket This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/basket@1232416 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
---
src/tools.cpp | 234 +++++++++++++++++++++++++++++-----------------------------
1 file changed, 117 insertions(+), 117 deletions(-)
(limited to 'src/tools.cpp')
diff --git a/src/tools.cpp b/src/tools.cpp
index 9acbda7..2d3cce7 100644
--- a/src/tools.cpp
+++ b/src/tools.cpp
@@ -19,24 +19,24 @@
***************************************************************************/
#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
#include "tools.h"
-QMemArray StopWatch::starts;
-QMemArray StopWatch::totals;
-QMemArray StopWatch::counts;
+TQMemArray StopWatch::starts;
+TQMemArray StopWatch::totals;
+TQMemArray StopWatch::counts;
void StopWatch::start(uint id)
{
@@ -49,46 +49,46 @@ void StopWatch::start(uint id)
}
starts.resize(id + 1);
}
- starts[id] = QTime::currentTime();
+ starts[id] = TQTime::currentTime();
}
void StopWatch::check(uint id)
{
if (id >= starts.size())
return;
- double time = starts[id].msecsTo(QTime::currentTime()) / 1000.0;
+ double time = starts[id].msecsTo(TQTime::currentTime()) / 1000.0;
totals[id] += time;
counts[id]++;
kdDebug() << k_funcinfo << "Timer_" << id << ": " << time << " s [" << counts[id] << " times, total: " << totals[id] << " s, average: " << totals[id] / counts[id] << " s]" << endl;
}
-QString Tools::textToHTML(const QString &text)
+TQString Tools::textToHTML(const TQString &text)
{
if (text.isEmpty())
return "";
if (/*text.isEmpty() ||*/ text == " " || text == " ")
return "
";
- // convertFromPlainText() replace "\n\n" by "
\n": we don't want that
- QString htmlString = QStyleSheet::convertFromPlainText(text, QStyleSheetItem::WhiteSpaceNormal);
- return htmlString.replace("
\n", "
\n
\n").replace("\n", "\n"); // Don't replace first and last tags
+ // convertFromPlainText() tqreplace "\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
}
-QString Tools::textToHTMLWithoutP(const QString &text)
+TQString Tools::textToHTMLWithoutP(const TQString &text)
{
// textToHTML(text) return "
HTMLizedText
". We remove the strating "" and ending
"
- QString HTMLizedText = textToHTML(text);
+ TQString HTMLizedText = textToHTML(text);
return HTMLizedText.mid(3, HTMLizedText.length() - 3 - 4);
}
-QString Tools::htmlToParagraph(const QString &html)
+TQString Tools::htmlToParagraph(const TQString &html)
{
- QString result = html;
+ TQString result = html;
bool startedBySpan = false;
// Remove the start tag, all the and the start
// Because can contain style="..." parameter, we transform it to
- int pos = result.find("\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.find(QRegExp("(?:(?:[\\s\\n\\r\\t]*)*[\\s\\n\\r\\t]*)*", false)); // Case unsensitive
+ pos = result.tqfind(TQRegExp("(?:(?:[\\s\\n\\r\\t]*)*