summaryrefslogtreecommitdiffstats
path: root/src/maingui
diff options
context:
space:
mode:
authorSimon Rettberg2023-02-17 12:08:20 +0100
committerSimon Rettberg2023-02-17 12:08:20 +0100
commitfd9ae49b5167bef653bdb96f638d0fdfed0553d6 (patch)
tree581d4741310d22bf34d5a799dc14939ac25261de /src/maingui
parentcmake: Update a bit (diff)
downloadprintergui-fd9ae49b5167bef653bdb96f638d0fdfed0553d6.tar.gz
printergui-fd9ae49b5167bef653bdb96f638d0fdfed0553d6.tar.xz
printergui-fd9ae49b5167bef653bdb96f638d0fdfed0553d6.zip
[maingui] Fallback to latin1 for document name encoding
Diffstat (limited to 'src/maingui')
-rw-r--r--src/maingui/printergui.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/maingui/printergui.cpp b/src/maingui/printergui.cpp
index 3c6b224..a54ac7a 100644
--- a/src/maingui/printergui.cpp
+++ b/src/maingui/printergui.cpp
@@ -174,7 +174,12 @@ void PrinterGui::initializeUI()
if (docName == NULL) {
docName = "Untitled";
}
- this->setWindowTitle(QString::fromUtf8("Drucken - %1 [%2]").arg(this->user, QString::fromUtf8(docName)));
+ QString docNameString = QString::fromUtf8(docName);
+ if (strcmp(docNameString.toUtf8().constData(), docName) != 0) {
+ // Not UTF-8, fallback to latin-1
+ docNameString = QString::fromLatin1(docName);
+ }
+ this->setWindowTitle(QString::fromUtf8("Drucken - %1 [%2]").arg(this->user, docNameString));
this->show();
this->showNormal();