[X2Go-Commits] [x2goclient] 02/03: x2goutils.{h, cpp}: split up show_RichText_WarningMsgBox() into the aforementioned function and a new convert_to_rich_text() helper function.
git-admin at x2go.org
git-admin at x2go.org
Thu Mar 12 20:25:04 CET 2015
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch bugfix/osx
in repository x2goclient.
commit b59e5d94fb84a22d4b553aa8c0378c1d7561f621
Author: Mihai Moldovan <ionic at ionic.de>
Date: Thu Mar 12 20:21:27 2015 +0100
x2goutils.{h,cpp}: split up show_RichText_WarningMsgBox() into the aforementioned function and a new convert_to_rich_text() helper function.
---
debian/changelog | 2 ++
src/x2goutils.cpp | 27 +++++++++++++++++----------
src/x2goutils.h | 1 +
3 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 8c327e6..eb9c295 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -222,6 +222,8 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low
reformat code.
- onmainwindow.{cpp,h}: make slotTunnelOk parameter optional and use the
non-parameter call for the QSingleShotTimer::timeout() signal.
+ - x2goutils.{h,cpp}: split up show_RichText_WarningMsgBox() into the
+ aforementioned function and a new convert_to_rich_text() helper function.
-- X2Go Release Manager <git-admin at x2go.org> Thu, 19 Feb 2015 13:25:28 +0100
diff --git a/src/x2goutils.cpp b/src/x2goutils.cpp
index a053306..7f6eb5b 100644
--- a/src/x2goutils.cpp
+++ b/src/x2goutils.cpp
@@ -74,17 +74,24 @@ QString wrap_legacy_resource_URIs (const QString& res_path) {
return (ret);
}
+QString convert_to_rich_text (const QString &text, bool force) {
+ QString fixup_text (text);
+ fixup_text.replace ("\n", "\n<br />\n");
+
+ if (force) {
+ // This is a workaround for a bug in Qt. Even though we set Qt::RichText as the text format
+ // later on, the informative text is not recognized as rich text, UNLESS a HTML tag
+ // is used ON THE VERY FIRST LINE.
+ // Make sure, that there always is one...
+ fixup_text.prepend ("<b></b>");
+ }
+
+ return (fixup_text);
+}
+
void show_RichText_WarningMsgBox (const QString& main_text, const QString& informative_text) {
- QString fixup_main_text (main_text);
- QString fixup_informative_text (informative_text);
- fixup_main_text.replace ("\n", "\n<br />\n");
- fixup_informative_text.replace ("\n", "\n<br />\n");
-
- // This is a workaround for a bug in Qt. Even though we set Qt::RichText as the text format
- // later on, the informative text is not recognized as rich text, UNLESS a HTML tag
- // is used ON THE VERY FIRST LINE.
- // Make sure, that there always is one...
- fixup_informative_text.prepend ("<b></b>");
+ QString fixup_main_text (convert_to_rich_text (main_text));
+ QString fixup_informative_text (convert_to_rich_text (informative_text, true));
QMessageBox msg_box (QMessageBox::Warning, QString ("X2Go Client"),
fixup_main_text, NULL);
diff --git a/src/x2goutils.h b/src/x2goutils.h
index 82a5f76..cf95b58 100644
--- a/src/x2goutils.h
+++ b/src/x2goutils.h
@@ -26,6 +26,7 @@
QString expandHome( QString path );
QString fixup_resource_URIs (const QString& res_path);
QString wrap_legacy_resource_URIs (const QString& res_path);
+QString convert_to_rich_text (const QString &text, bool force = false);
void show_RichText_WarningMsgBox (const QString& main_text, const QString& informative_text = "");
#endif /* !defined (X2GOUTILS_H) */
--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
More information about the x2go-commits
mailing list