[X2Go-Commits] [x2goclient] 02/04: x2goutils.{h, cpp}: add new helper function show_RichText_WarningMsgBox.
git-admin at x2go.org
git-admin at x2go.org
Thu Mar 12 06:01:25 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 f86629a8a1fda7341c4880c882a8448ebce32a6b
Author: Mihai Moldovan <ionic at ionic.de>
Date: Thu Mar 12 05:56:42 2015 +0100
x2goutils.{h,cpp}: add new helper function show_RichText_WarningMsgBox.
---
debian/changelog | 1 +
src/x2goutils.cpp | 22 ++++++++++++++++++++++
src/x2goutils.h | 1 +
3 files changed, 24 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 60d759f..b1226e0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -211,6 +211,7 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low
URL's and installation instructions, don't show outdated version warning
when no XQuartz server is installed. Fixes: #792.
- x2goutils.{h,cpp}: use QString references.
+ - x2goutils.{h,cpp}: add new helper function show_RichText_WarningMsgBox.
-- 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 76e8b31..33b5410 100644
--- a/src/x2goutils.cpp
+++ b/src/x2goutils.cpp
@@ -20,6 +20,7 @@
#include <algorithm>
#include <QString>
#include <QDir>
+#include <QMessageBox>
QString expandHome( QString path )
{
@@ -70,3 +71,24 @@ QString wrap_legacy_resource_URIs (const QString& res_path) {
return (ret);
}
+
+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>");
+
+ QMessageBox msg_box (QMessageBox::Warning, QString ("X2Go Client"),
+ fixup_main_text, NULL);
+
+ msg_box.setTextFormat (Qt::RichText);
+ msg_box.setInformativeText (fixup_informative_text);
+ msg_box.setWindowModality (Qt::WindowModal);
+ msg_box.exec ();
+}
diff --git a/src/x2goutils.h b/src/x2goutils.h
index dc2dc71..82a5f76 100644
--- a/src/x2goutils.h
+++ b/src/x2goutils.h
@@ -26,5 +26,6 @@
QString expandHome( QString path );
QString fixup_resource_URIs (const QString& res_path);
QString wrap_legacy_resource_URIs (const QString& res_path);
+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