aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/widgets
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-12-01 17:25:46 +0000
committerSaturneric <[email protected]>2021-12-01 17:53:09 +0000
commit1ae8663decb3163b92d32b80cefb46eb678a5af6 (patch)
tree8e8cb58cacfe12827438b0524917cb0926f926cb /src/ui/widgets
parentAdd & Modified (diff)
downloadGpgFrontend-1ae8663decb3163b92d32b80cefb46eb678a5af6.tar.gz
GpgFrontend-1ae8663decb3163b92d32b80cefb46eb678a5af6.zip
Add i18n Support
1. Remove Qt Linguist. 2. Add GNU gettext libraries. 3. Modified source codes to meet with i18n support.
Diffstat (limited to 'src/ui/widgets')
-rw-r--r--src/ui/widgets/EditorPage.cpp6
-rw-r--r--src/ui/widgets/EditorPage.h4
-rw-r--r--src/ui/widgets/FilePage.cpp24
-rw-r--r--src/ui/widgets/FilePage.h4
-rw-r--r--src/ui/widgets/GroupKeyList.cpp4
-rw-r--r--src/ui/widgets/GroupKeyList.h4
-rw-r--r--src/ui/widgets/HelpPage.cpp8
-rw-r--r--src/ui/widgets/InfoBoardWidget.cpp8
-rw-r--r--src/ui/widgets/InfoBoardWidget.h4
-rw-r--r--src/ui/widgets/KeyList.cpp24
-rw-r--r--src/ui/widgets/KeyList.h4
-rw-r--r--src/ui/widgets/SignersPicker.cpp6
-rw-r--r--src/ui/widgets/SignersPicker.h4
-rw-r--r--src/ui/widgets/TextEdit.cpp66
-rw-r--r--src/ui/widgets/TextEdit.h4
-rw-r--r--src/ui/widgets/VerifyKeyDetailBox.cpp99
-rw-r--r--src/ui/widgets/VerifyKeyDetailBox.h7
17 files changed, 149 insertions, 131 deletions
diff --git a/src/ui/widgets/EditorPage.cpp b/src/ui/widgets/EditorPage.cpp
index 26976048..6fd72c20 100644
--- a/src/ui/widgets/EditorPage.cpp
+++ b/src/ui/widgets/EditorPage.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * GpgFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@@ -41,7 +41,7 @@ EditorPage::EditorPage(QString filePath, QWidget* parent)
mainLayout->addWidget(textPage);
mainLayout->setContentsMargins(0, 0, 0, 0);
setLayout(mainLayout);
-
+
textPage->setFocus();
// Front in same width
diff --git a/src/ui/widgets/EditorPage.h b/src/ui/widgets/EditorPage.h
index 0f637500..1e19a0de 100644
--- a/src/ui/widgets/EditorPage.h
+++ b/src/ui/widgets/EditorPage.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * GpgFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
diff --git a/src/ui/widgets/FilePage.cpp b/src/ui/widgets/FilePage.cpp
index 2cb59ae1..4b88092b 100644
--- a/src/ui/widgets/FilePage.cpp
+++ b/src/ui/widgets/FilePage.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * GpgFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@@ -167,17 +167,17 @@ void FilePage::slotGoPath() {
void FilePage::createPopupMenu() {
popUpMenu = new QMenu();
- auto openItemAct = new QAction(tr("Open"), this);
+ auto openItemAct = new QAction(_("Open"), this);
connect(openItemAct, SIGNAL(triggered()), this, SLOT(slotOpenItem()));
- auto deleteItemAct = new QAction(tr("Delete"), this);
+ auto deleteItemAct = new QAction(_("Delete"), this);
connect(deleteItemAct, SIGNAL(triggered()), this, SLOT(slotDeleteItem()));
- encryptItemAct = new QAction(tr("Encrypt and Sign"), this);
+ encryptItemAct = new QAction(_("Encrypt and Sign"), this);
connect(encryptItemAct, SIGNAL(triggered()), this, SLOT(slotEncryptItem()));
- decryptItemAct = new QAction(tr("Decrypt and Verify"), this);
+ decryptItemAct = new QAction(_("Decrypt and Verify"), this);
connect(decryptItemAct, SIGNAL(triggered()), this, SLOT(slotDecryptItem()));
- signItemAct = new QAction(tr("Only Sign"), this);
+ signItemAct = new QAction(_("Only Sign"), this);
connect(signItemAct, SIGNAL(triggered()), this, SLOT(slotSignItem()));
- verifyItemAct = new QAction(tr("Only Verify"), this);
+ verifyItemAct = new QAction(_("Only Verify"), this);
connect(verifyItemAct, SIGNAL(triggered()), this, SLOT(slotVerifyItem()));
popUpMenu->addAction(openItemAct);
@@ -233,8 +233,8 @@ void FilePage::slotDeleteItem() {
QModelIndex index = dirTreeView->currentIndex();
QVariant data = dirTreeView->model()->data(index);
- auto ret = QMessageBox::warning(this, tr("Warning"),
- tr("Are you sure you want to delete it?"),
+ auto ret = QMessageBox::warning(this, _("Warning"),
+ _("Are you sure you want to delete it?"),
QMessageBox::Ok | QMessageBox::Cancel);
if (ret == QMessageBox::Cancel) return;
@@ -242,8 +242,8 @@ void FilePage::slotDeleteItem() {
qDebug() << "Delete Item" << data.toString();
if (!dirModel->remove(index)) {
- QMessageBox::critical(this, tr("Error"),
- tr("Unable to delete the file or folder."));
+ QMessageBox::critical(this, _("Error"),
+ _("Unable to delete the file or folder."));
}
}
diff --git a/src/ui/widgets/FilePage.h b/src/ui/widgets/FilePage.h
index 9fd4308e..31be81f3 100644
--- a/src/ui/widgets/FilePage.h
+++ b/src/ui/widgets/FilePage.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * GpgFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
diff --git a/src/ui/widgets/GroupKeyList.cpp b/src/ui/widgets/GroupKeyList.cpp
index 404e8faf..efba4428 100644
--- a/src/ui/widgets/GroupKeyList.cpp
+++ b/src/ui/widgets/GroupKeyList.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * GpgFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
diff --git a/src/ui/widgets/GroupKeyList.h b/src/ui/widgets/GroupKeyList.h
index f0c9e2c6..163c7126 100644
--- a/src/ui/widgets/GroupKeyList.h
+++ b/src/ui/widgets/GroupKeyList.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * GpgFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
diff --git a/src/ui/widgets/HelpPage.cpp b/src/ui/widgets/HelpPage.cpp
index dfc24929..7b1e86c0 100644
--- a/src/ui/widgets/HelpPage.cpp
+++ b/src/ui/widgets/HelpPage.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * GpgFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@@ -77,8 +77,6 @@ QUrl HelpPage::localizedHelp(const QUrl& url) {
}
}
-QTextBrowser* HelpPage::getBrowser() {
- return browser;
-}
+QTextBrowser* HelpPage::getBrowser() { return browser; }
} // namespace GpgFrontend::UI
diff --git a/src/ui/widgets/InfoBoardWidget.cpp b/src/ui/widgets/InfoBoardWidget.cpp
index aac80514..7de99a2b 100644
--- a/src/ui/widgets/InfoBoardWidget.cpp
+++ b/src/ui/widgets/InfoBoardWidget.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * GpgFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@@ -39,7 +39,7 @@ InfoBoardWidget::InfoBoardWidget(QWidget* parent, KeyList* keyList)
infoBoard->setContentsMargins(0, 0, 0, 0);
importFromKeyserverAct =
- new QAction(tr("Import missing key from Keyserver"), this);
+ new QAction(_("Import missing key from Keyserver"), this);
connect(importFromKeyserverAct, SIGNAL(triggered()), this,
SLOT(slotImportFromKeyserver()));
@@ -57,7 +57,7 @@ InfoBoardWidget::InfoBoardWidget(QWidget* parent, KeyList* keyList)
actionButtonLayout->setSpacing(0);
actionButtonMenu->setLayout(actionButtonLayout);
- auto label = new QLabel(tr("Optional Actions"));
+ auto label = new QLabel(_("Optional Actions"));
label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
label->setContentsMargins(0, 0, 0, 0);
diff --git a/src/ui/widgets/InfoBoardWidget.h b/src/ui/widgets/InfoBoardWidget.h
index 5512a78a..858aa014 100644
--- a/src/ui/widgets/InfoBoardWidget.h
+++ b/src/ui/widgets/InfoBoardWidget.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * GpgFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
diff --git a/src/ui/widgets/KeyList.cpp b/src/ui/widgets/KeyList.cpp
index 4cb30acf..b3391c68 100644
--- a/src/ui/widgets/KeyList.cpp
+++ b/src/ui/widgets/KeyList.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * GpgFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@@ -78,8 +78,8 @@ KeyList::KeyList(KeyListRow::KeyType selectType,
}
QStringList labels;
- labels << tr("Select") << tr("Type") << tr("Name") << tr("Email Address")
- << tr("Usage") << tr("Validity") << tr("Finger Print");
+ labels << _("Select") << _("Type") << _("Name") << _("Email Address")
+ << _("Usage") << _("Validity") << _("Finger Print");
mKeyList->setHorizontalHeaderLabels(labels);
mKeyList->horizontalHeader()->setStretchLastSection(false);
@@ -103,7 +103,6 @@ KeyList::KeyList(KeyListRow::KeyType selectType,
}
void KeyList::slotRefresh() {
-
LOG(INFO) << "KeyList::slotRefresh Called";
auto keyList = getChecked();
@@ -302,14 +301,16 @@ void KeyList::addMenuAction(QAction* act) { popupMenu->addAction(act); }
void KeyList::dropEvent(QDropEvent* event) {
auto* dialog = new QDialog();
- dialog->setWindowTitle(tr("Import Keys"));
+ dialog->setWindowTitle(_("Import Keys"));
QLabel* label;
- label = new QLabel(tr("You've dropped something on the table.\n GpgFrontend "
- "will now try to import key(s).") +
- "\n");
+ label =
+ new QLabel(QString(_("You've dropped something on the table.")) + "\n " +
+ _("GpgFrontend "
+ "will now try to import key(s).") +
+ "\n");
// "always import keys"-CheckBox
- auto* checkBox = new QCheckBox(tr("Always import without bothering."));
+ auto* checkBox = new QCheckBox(_("Always import without bothering."));
if (settings.value("general/confirmImportKeys").toBool())
checkBox->setCheckState(Qt::Unchecked);
@@ -343,7 +344,8 @@ void KeyList::dropEvent(QDropEvent* event) {
QFile file;
file.setFileName(tmp.toLocalFile());
if (!file.open(QIODevice::ReadOnly)) {
- qDebug() << tr("Couldn't Open File: ") + tmp.toString();
+ LOG(INFO) << _("Couldn't Open File") << ":"
+ << tmp.toString().toStdString();
}
QByteArray inBuffer = file.readAll();
this->importKeys(inBuffer);
diff --git a/src/ui/widgets/KeyList.h b/src/ui/widgets/KeyList.h
index c1c49c5c..524b2bd0 100644
--- a/src/ui/widgets/KeyList.h
+++ b/src/ui/widgets/KeyList.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * GpgFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
diff --git a/src/ui/widgets/SignersPicker.cpp b/src/ui/widgets/SignersPicker.cpp
index 3c720b10..3131989b 100644
--- a/src/ui/widgets/SignersPicker.cpp
+++ b/src/ui/widgets/SignersPicker.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * GpgFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@@ -27,7 +27,7 @@
namespace GpgFrontend::UI {
SignersPicker::SignersPicker(QWidget* parent) : QDialog(parent) {
- auto confirmButton = new QPushButton(tr("Confirm"));
+ auto confirmButton = new QPushButton(_("Confirm"));
connect(confirmButton, SIGNAL(clicked(bool)), this, SLOT(accept()));
/*Setup KeyList*/
diff --git a/src/ui/widgets/SignersPicker.h b/src/ui/widgets/SignersPicker.h
index 278e0142..055b6ef6 100644
--- a/src/ui/widgets/SignersPicker.h
+++ b/src/ui/widgets/SignersPicker.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * GpgFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
diff --git a/src/ui/widgets/TextEdit.cpp b/src/ui/widgets/TextEdit.cpp
index aaac98ee..efc2abbf 100644
--- a/src/ui/widgets/TextEdit.cpp
+++ b/src/ui/widgets/TextEdit.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * GpgFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@@ -24,6 +24,8 @@
#include "ui/widgets/TextEdit.h"
+#include <boost/format.hpp>
+
namespace GpgFrontend::UI {
TextEdit::TextEdit(QWidget* parent) : QWidget(parent) {
@@ -46,7 +48,7 @@ TextEdit::TextEdit(QWidget* parent) : QWidget(parent) {
}
void TextEdit::slotNewTab() {
- QString header = tr("untitled") + QString::number(++countPage) + ".txt";
+ QString header = _("untitled") + QString::number(++countPage) + ".txt";
auto* page = new EditorPage();
tabWidget->addTab(page, header);
@@ -83,9 +85,11 @@ void TextEdit::slotOpenFile(QString& path) {
page->getTextPage()->setFocus();
page->readFile();
} else {
- QMessageBox::warning(
- this, tr("Warning"),
- tr("Cannot read file %1:\n%2.").arg(path).arg(file.errorString()));
+ QMessageBox::warning(this, _("Warning"),
+ (boost::format(_("Cannot read file %1%:\n%2%.")) %
+ path.toStdString() % file.errorString().toStdString())
+ .str()
+ .c_str());
}
file.close();
@@ -93,7 +97,7 @@ void TextEdit::slotOpenFile(QString& path) {
void TextEdit::slotOpen() {
QStringList fileNames =
- QFileDialog::getOpenFileNames(this, tr("Open file"), QDir::currentPath());
+ QFileDialog::getOpenFileNames(this, _("Open file"), QDir::currentPath());
for (const auto& fileName : fileNames) {
if (!fileName.isEmpty()) {
QFile file(fileName);
@@ -118,10 +122,12 @@ void TextEdit::slotOpen() {
// enableAction(true)
file.close();
} else {
- QMessageBox::warning(this, tr("Warning"),
- tr("Cannot read file %1:\n%2.")
- .arg(fileName)
- .arg(file.errorString()));
+ QMessageBox::warning(
+ this, _("Warning"),
+ (boost::format(_("Cannot read file %1%:\n%2%.")) %
+ fileName.toStdString() % file.errorString().toStdString())
+ .str()
+ .c_str());
}
}
}
@@ -164,13 +170,16 @@ bool TextEdit::saveFile(const QString& fileName) {
int curIndex = tabWidget->currentIndex();
tabWidget->setTabText(curIndex, strippedName(fileName));
page->setFilePath(fileName);
- // statusBar()->showMessage(tr("File saved"), 2000);
+ // statusBar()->showMessage(_("File saved"), 2000);
file.close();
return true;
} else {
QMessageBox::warning(
- this, tr("File"),
- tr("Cannot write file %1:\n%2.").arg(fileName).arg(file.errorString()));
+ this, _("Warning"),
+ (boost::format(_("Cannot read file %1%:\n%2%.")) %
+ fileName.toStdString() % file.errorString().toStdString())
+ .str()
+ .c_str());
return false;
}
}
@@ -182,13 +191,13 @@ bool TextEdit::slotSaveAs() {
EditorPage* page = slotCurPageTextEdit();
QString path;
- if (page->getFilePath() != "") {
+ if (!page->getFilePath().isEmpty()) {
path = page->getFilePath();
} else {
path = tabWidget->tabText(tabWidget->currentIndex()).remove(0, 2);
}
- QString fileName = QFileDialog::getSaveFileName(this, tr("Save file"), path);
+ QString fileName = QFileDialog::getSaveFileName(this, _("Save file"), path);
return saveFile(fileName);
}
@@ -250,16 +259,18 @@ bool TextEdit::maybeSaveCurrentTab(bool askToSave) {
const QString& filePath = page->getFilePath();
if (askToSave) {
result = QMessageBox::warning(
- this, tr("Unsaved document"),
- tr("The document \"%1\" has been modified. Do you want to "
- "save your changes?<br/>")
+ this, _("Unsaved document"),
+ QString(_("The document \"%1\" has been modified. Do you want to "
+ "save your changes?"))
.arg(docname) +
- tr("<b>Note:</b> If you don't save these files, all changes are "
- "lost.<br/>"),
+ "<br/><b>" + _("Note:") + "</b>" +
+ _("If you don't save these files, all changes are "
+ "lost.") +
+ "<br/>",
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
}
if ((result == QMessageBox::Save) || (!askToSave)) {
- if (filePath == "") {
+ if (filePath.isEmpty()) {
// QString docname = tabWidget->tabText(tabWidget->currentIndex());
// docname.remove(0,2);
return slotSaveAs();
@@ -398,8 +409,11 @@ void TextEdit::loadFile(const QString& fileName) {
QFile file(fileName);
if (!file.open(QFile::ReadOnly | QFile::Text)) {
QMessageBox::warning(
- this, tr("Application"),
- tr("Cannot read file %1:\n%2.").arg(fileName).arg(file.errorString()));
+ this, _("Warning"),
+ (boost::format(_("Cannot read file %1%:\n%2%.")) %
+ fileName.toStdString() % file.errorString().toStdString())
+ .str()
+ .c_str());
return;
}
QTextStream in(&file);
@@ -409,7 +423,7 @@ void TextEdit::loadFile(const QString& fileName) {
slotCurPageTextEdit()->setFilePath(fileName);
tabWidget->setTabText(tabWidget->currentIndex(), strippedName(fileName));
file.close();
- // statusBar()->showMessage(tr("File loaded"), 2000);
+ // statusBar()->showMessage(_("File loaded"), 2000);
}
QString TextEdit::strippedName(const QString& fullFileName) {
@@ -434,7 +448,7 @@ void TextEdit::slotPrint() {
}
document->print(&printer);
- // statusBar()->showMessage(tr("Ready"), 2000);
+ // statusBar()->showMessage(_("Ready"), 2000);
#endif
}
diff --git a/src/ui/widgets/TextEdit.h b/src/ui/widgets/TextEdit.h
index beebc8c4..3cff74e7 100644
--- a/src/ui/widgets/TextEdit.h
+++ b/src/ui/widgets/TextEdit.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * GpgFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
diff --git a/src/ui/widgets/VerifyKeyDetailBox.cpp b/src/ui/widgets/VerifyKeyDetailBox.cpp
index 97f792b1..7c25d593 100644
--- a/src/ui/widgets/VerifyKeyDetailBox.cpp
+++ b/src/ui/widgets/VerifyKeyDetailBox.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * GpgFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@@ -36,17 +36,17 @@ VerifyKeyDetailBox::VerifyKeyDetailBox(QWidget* parent, KeyList* keyList,
switch (gpg_err_code(signature->status)) {
case GPG_ERR_NO_PUBKEY: {
this->setTitle("A Error Signature");
- auto* importButton = new QPushButton(tr("Import from keyserver"));
+ auto* importButton = new QPushButton(_("Import from keyserver"));
connect(importButton, SIGNAL(clicked()), this,
SLOT(slotImportFormKeyserver()));
- this->setTitle(tr("Key not present with id 0x") + signature->fpr);
+ this->setTitle(QString(_("Key not present with id 0x")) + signature->fpr);
auto grid = new QGridLayout();
- grid->addWidget(new QLabel(tr("Status:")), 0, 0);
- // grid->addWidget(new QLabel(tr("Fingerprint:")), 1, 0);
- grid->addWidget(new QLabel(tr("Key not present in keylist")), 0, 1);
+ grid->addWidget(new QLabel(QString(_("Status")) + _(":")), 0, 0);
+ // grid->addWidget(new QLabel(_("Fingerprint:")), 1, 0);
+ grid->addWidget(new QLabel(_("Key not present in key list")), 0, 1);
// grid->addWidget(new QLabel(signature->fpr), 1, 1);
grid->addWidget(importButton, 2, 0, 2, 1);
@@ -54,91 +54,96 @@ VerifyKeyDetailBox::VerifyKeyDetailBox(QWidget* parent, KeyList* keyList,
break;
}
case GPG_ERR_NO_ERROR: {
- this->setTitle("A Signature:");
+ this->setTitle(QString(_("A Signature")) + ":");
auto gird = createKeyInfoGrid(signature);
if (gird != nullptr) {
vbox->addLayout(gird);
} else {
- vbox->addWidget(new QLabel(tr("Key Information is NOT Available")));
+ vbox->addWidget(new QLabel(_("Key Information is NOT Available")));
if (signature->fpr != nullptr) {
- vbox->addWidget(
- new QLabel(tr("Fingerprint: ") + QString(signature->fpr)));
+ vbox->addWidget(new QLabel(QString(_("Fingerprint")) + ": " +
+ QString(signature->fpr)));
}
}
break;
}
case GPG_ERR_CERT_REVOKED: {
this->setTitle("An Error Signature");
- vbox->addWidget(new QLabel(tr("Status: Cert Revoked")));
+ vbox->addWidget(
+ new QLabel(QString(_("Status")) + ":" + _("Cert Revoked")));
auto gird = createKeyInfoGrid(signature);
if (gird != nullptr) {
vbox->addLayout(gird);
} else {
- vbox->addWidget(new QLabel(tr("Key Information is NOT Available")));
+ vbox->addWidget(new QLabel(_("Key Information is NOT Available")));
if (signature->fpr != nullptr) {
- vbox->addWidget(
- new QLabel(tr("Fingerprint: ") + QString(signature->fpr)));
+ vbox->addWidget(new QLabel(QString(_("Fingerprint")) + ": " +
+ QString(signature->fpr)));
}
}
break;
}
case GPG_ERR_SIG_EXPIRED: {
this->setTitle("An Error Signature");
- vbox->addWidget(new QLabel(tr("Status: Signature Expired")));
+ vbox->addWidget(
+ new QLabel(QString(_("Status")) + ":" + _("Signature Expired")));
auto gird = createKeyInfoGrid(signature);
if (gird != nullptr) {
vbox->addLayout(gird);
} else {
- vbox->addWidget(new QLabel(tr("Key Information is NOT Available")));
+ vbox->addWidget(new QLabel(_("Key Information is NOT Available")));
if (signature->fpr != nullptr) {
- vbox->addWidget(
- new QLabel(tr("Fingerprint: ") + QString(signature->fpr)));
+ vbox->addWidget(new QLabel(QString(_("Fingerprint")) + ": " +
+ QString(signature->fpr)));
}
}
break;
}
case GPG_ERR_KEY_EXPIRED: {
this->setTitle("An Error Signature");
- vbox->addWidget(new QLabel(tr("Status: Signature Expired")));
- vbox->addWidget(new QLabel(tr("Status: Key Expired")));
+ vbox->addWidget(
+ new QLabel(QString(_("Status")) + ":" + _("Key Expired")));
+ vbox->addWidget(
+ new QLabel(QString(_("Status")) + ":" + _("Key Expired")));
auto gird = createKeyInfoGrid(signature);
if (gird != nullptr) {
vbox->addLayout(gird);
} else {
- vbox->addWidget(new QLabel(tr("Key Information is NOT Available")));
+ vbox->addWidget(new QLabel(_("Key Information is NOT Available")));
if (signature->fpr != nullptr) {
- vbox->addWidget(
- new QLabel(tr("Fingerprint: ") + QString(signature->fpr)));
+ vbox->addWidget(new QLabel(QString(_("Fingerprint")) + ": " +
+ QString(signature->fpr)));
}
}
break;
}
case GPG_ERR_GENERAL: {
this->setTitle("An Error Signature");
- vbox->addWidget(new QLabel(tr("Status: General Error")));
+ vbox->addWidget(
+ new QLabel(QString(_("Status")) + ":" + _("General Error")));
auto gird = createKeyInfoGrid(signature);
if (gird != nullptr) {
vbox->addLayout(gird);
} else {
- vbox->addWidget(new QLabel(tr("Key Information is NOT Available")));
+ vbox->addWidget(new QLabel(_("Key Information is NOT Available")));
if (signature->fpr != nullptr) {
- vbox->addWidget(
- new QLabel(tr("Fingerprint: ") + QString(signature->fpr)));
+ vbox->addWidget(new QLabel(QString(_("Fingerprint")) + ": " +
+ QString(signature->fpr)));
}
}
break;
}
default: {
this->setTitle("An Error Signature");
- this->setTitle(tr("Status: Unknown Error"));
+ this->setTitle(QString(_("Status")) + ":" + _("Unknown Error "));
auto gird = createKeyInfoGrid(signature);
if (gird != nullptr) {
vbox->addLayout(gird);
} else {
- vbox->addWidget(new QLabel(tr("Key Information is NOT Available")));
+ vbox->addWidget(new QLabel(_("Key Information is NOT Available")));
if (signature->fpr != nullptr) {
- vbox->addWidget(
- new QLabel(tr("Fingerprint: ") + QString(signature->fpr)));
+ vbox->addWidget(new QLabel(QString(_("Fingerprint")) + ": " +
+ QString(signature->fpr)));
}
}
break;
@@ -168,48 +173,48 @@ QGridLayout* VerifyKeyDetailBox::createKeyInfoGrid(
GpgKey key = GpgKeyGetter::GetInstance().GetKey(signature->fpr);
if (!key.good()) return nullptr;
- grid->addWidget(new QLabel(tr("Signer Name:")), 0, 0);
- grid->addWidget(new QLabel(tr("Signer Email:")), 1, 0);
- grid->addWidget(new QLabel(tr("Key's Fingerprint:")), 2, 0);
- grid->addWidget(new QLabel(tr("Valid:")), 3, 0);
- grid->addWidget(new QLabel(tr("Flags:")), 4, 0);
+ grid->addWidget(new QLabel(QString(_("Signer Name")) + ":"), 0, 0);
+ grid->addWidget(new QLabel(QString(_("Signer Email")) + ":"), 1, 0);
+ grid->addWidget(new QLabel(QString(_("Key's Fingerprint")) + ":"), 2, 0);
+ grid->addWidget(new QLabel(QString(_("Valid")) + ":"), 3, 0);
+ grid->addWidget(new QLabel(QString(_("Flags")) + ":"), 4, 0);
grid->addWidget(new QLabel(QString::fromStdString(key.name())), 0, 1);
grid->addWidget(new QLabel(QString::fromStdString(key.email())), 1, 1);
grid->addWidget(new QLabel(beautifyFingerprint(signature->fpr)), 2, 1);
if (signature->summary & GPGME_SIGSUM_VALID) {
- grid->addWidget(new QLabel(tr("Fully Valid")), 3, 1);
+ grid->addWidget(new QLabel(_("Fully Valid")), 3, 1);
} else {
- grid->addWidget(new QLabel(tr("NOT Fully Valid")), 3, 1);
+ grid->addWidget(new QLabel(_("NOT Fully Valid")), 3, 1);
}
QString flags;
QTextStream textStream(&flags);
if (signature->summary & GPGME_SIGSUM_GREEN) {
- textStream << tr("Good ");
+ textStream << _("Good") << " ";
}
if (signature->summary & GPGME_SIGSUM_RED) {
- textStream << tr("Bad ");
+ textStream << _("Bad") << " ";
}
if (signature->summary & GPGME_SIGSUM_SIG_EXPIRED) {
- textStream << tr("Expired ");
+ textStream << _("Expired") << " ";
}
if (signature->summary & GPGME_SIGSUM_KEY_MISSING) {
- textStream << tr("Missing Key ");
+ textStream << _("Missing Key") << " ";
}
if (signature->summary & GPGME_SIGSUM_KEY_REVOKED) {
- textStream << tr("Revoked Key ");
+ textStream << _("Revoked Key") << " ";
}
if (signature->summary & GPGME_SIGSUM_KEY_EXPIRED) {
- textStream << tr("Expired Key ");
+ textStream << _("Expired Key") << " ";
}
if (signature->summary & GPGME_SIGSUM_CRL_MISSING) {
- textStream << tr("Missing CRL ");
+ textStream << _("Missing CRL") << " ";
}
- grid->addWidget(new QLabel(tr(flags.toUtf8().constData())), 4, 1);
+ grid->addWidget(new QLabel(_(flags.toUtf8().constData())), 4, 1);
return grid;
}
diff --git a/src/ui/widgets/VerifyKeyDetailBox.h b/src/ui/widgets/VerifyKeyDetailBox.h
index 7a6ded4e..c1b26bb2 100644
--- a/src/ui/widgets/VerifyKeyDetailBox.h
+++ b/src/ui/widgets/VerifyKeyDetailBox.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * GpgFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@@ -33,8 +33,7 @@ namespace GpgFrontend::UI {
class VerifyKeyDetailBox : public QGroupBox {
Q_OBJECT
public:
- explicit VerifyKeyDetailBox(QWidget* parent,
- KeyList* mKeyList,
+ explicit VerifyKeyDetailBox(QWidget* parent, KeyList* mKeyList,
gpgme_signature_t signature);
private slots: