aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/CMakeLists.txt13
-rw-r--r--src/GpgFrontendBuildInfo.h.in8
-rw-r--r--src/core/function/result_analyse/GpgSignResultAnalyse.cpp6
-rw-r--r--src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp11
-rw-r--r--src/core/utils/LocalizedUtils.cpp7
-rw-r--r--src/core/utils/LocalizedUtils.h6
-rw-r--r--src/module/integrated/version_checking_module/VersionCheckTask.cpp12
-rw-r--r--src/ui/GpgFrontendApplication.cpp5
-rw-r--r--src/ui/UserInterfaceUtils.cpp7
-rw-r--r--src/ui/dialog/Wizard.cpp3
-rw-r--r--src/ui/dialog/help/AboutDialog.cpp4
-rw-r--r--src/ui/dialog/import_export/KeyUploadDialog.cpp2
-rw-r--r--src/ui/main_window/MainWindowSlotFunction.cpp7
-rw-r--r--src/ui/thread/KeyServerImportTask.cpp7
-rw-r--r--src/ui/thread/KeyServerSearchTask.cpp7
-rw-r--r--src/ui/thread/ListedKeyServerTestTask.cpp8
-rw-r--r--src/ui/thread/ProxyConnectionTestTask.cpp7
17 files changed, 85 insertions, 35 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 57988b3f..eab2df9d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -121,10 +121,12 @@ if (BUILD_APPLICATION)
if (APPLE)
set(RESOURCE_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Resources)
elseif (LINUX AND NOT LINUX_INSTALL_SOFTWARE)
- file(COPY ${CMAKE_SOURCE_DIR}/resource/lfs/app-image/gpgfrontend DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ FOLLOW_SYMLINK_CHAIN)
- file(COPY ${CMAKE_SOURCE_DIR}/resource/appstream/com.bktus.gpgfrontend.metainfo.xml DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/gpgfrontend/usr/share/metainfo FOLLOW_SYMLINK_CHAIN)
- file(COPY ${CMAKE_SOURCE_DIR}/resource/appstream/com.bktus.gpgfrontend.desktop DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/gpgfrontend/usr/share/applications FOLLOW_SYMLINK_CHAIN)
- set(RESOURCE_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/gpgfrontend/usr/share)
+ file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/AppDir)
+ file(COPY ${CMAKE_SOURCE_DIR}/resource/lfs/hicolor DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/AppDir/usr/share/icons)
+ file(COPY ${CMAKE_SOURCE_DIR}/resource/appstream/com.bktus.gpgfrontend.metainfo.xml DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/AppDir/usr/share/metainfo FOLLOW_SYMLINK_CHAIN)
+ file(COPY ${CMAKE_SOURCE_DIR}/resource/appstream/com.bktus.gpgfrontend.desktop DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/AppDir/usr/share/applications FOLLOW_SYMLINK_CHAIN)
+ file(COPY ${CMAKE_SOURCE_DIR}/resource/lfs/pixmaps/com.bktus.gpgfrontend.png DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/AppDir FOLLOW_SYMLINK_CHAIN)
+ set(RESOURCE_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/AppDir/usr/share)
else ()
set(RESOURCE_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif ()
@@ -466,7 +468,8 @@ endif ()
# add i18n support
if (BUILD_APPLICATION)
set(LOCALE_TS_PATH ${CMAKE_SOURCE_DIR}/resource/lfs/locale/ts)
- set(TS_FILES "${LOCALE_TS_PATH}/GpgFrontend.de_DE.ts"
+ set(TS_FILES "${LOCALE_TS_PATH}/GpgFrontend.en_US.ts"
+ "${LOCALE_TS_PATH}/GpgFrontend.de_DE.ts"
"${LOCALE_TS_PATH}/GpgFrontend.fr_FR.ts"
"${LOCALE_TS_PATH}/GpgFrontend.zh_CN.ts"
"${LOCALE_TS_PATH}/GpgFrontend.zh_TW.ts"
diff --git a/src/GpgFrontendBuildInfo.h.in b/src/GpgFrontendBuildInfo.h.in
index c6242b1e..37338de0 100644
--- a/src/GpgFrontendBuildInfo.h.in
+++ b/src/GpgFrontendBuildInfo.h.in
@@ -52,4 +52,10 @@
*/
#define BUILD_FLAG "@BUILD_FLAG@"
#define BUILD_TIMESTAMP "@BUILD_TIMESTAMP@"
-#define APP_INSTALL_FLAG "@APP_INSTALL_FLAG@" \ No newline at end of file
+#define APP_INSTALL_FLAG "@APP_INSTALL_FLAG@"
+
+/**
+ * @brief Network
+ *
+ */
+#define HTTP_REQUEST_USER_AGENT "@HTTP_REQUEST_USER_AGENT@" \ No newline at end of file
diff --git a/src/core/function/result_analyse/GpgSignResultAnalyse.cpp b/src/core/function/result_analyse/GpgSignResultAnalyse.cpp
index 3f3040b8..e02996b3 100644
--- a/src/core/function/result_analyse/GpgSignResultAnalyse.cpp
+++ b/src/core/function/result_analyse/GpgSignResultAnalyse.cpp
@@ -103,11 +103,9 @@ void GpgSignResultAnalyse::doAnalyse() {
stream_ << "- " << tr("Hash Algo") << ": "
<< gpgme_hash_algo_name(new_sign->hash_algo) << Qt::endl;
stream_ << "- " << tr("Sign Date") << "(" << tr("UTC") << ")"
- << ": "
- << QDateTime::fromSecsSinceEpoch(new_sign->timestamp).toString()
- << Qt::endl;
+ << ": " << GetUTCDateByTimestamp(new_sign->timestamp) << Qt::endl;
stream_ << "- " << tr("Sign Date") << "(" << tr("Localized") << ")"
- << ": " << GetFormatedDateByTimestamp(new_sign->timestamp)
+ << ": " << GetLocalizedDateByTimestamp(new_sign->timestamp)
<< Qt::endl;
stream_ << Qt::endl
diff --git a/src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp b/src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp
index df6b58b0..0a098a93 100644
--- a/src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp
+++ b/src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp
@@ -55,11 +55,10 @@ void GpgFrontend::GpgVerifyResultAnalyse::doAnalyse() {
auto *sign = result->signatures;
stream_ << "-> " << tr("Signed On") << "(" << tr("UTC") << ")"
- << ": " << QDateTime::fromSecsSinceEpoch(sign->timestamp).toString()
- << Qt::endl;
+ << ": " << GetUTCDateByTimestamp(sign->timestamp) << Qt::endl;
stream_ << "-> " << tr("Signed On") << "(" << tr("Localized") << ")"
- << ": " << GetFormatedDateByTimestamp(sign->timestamp) << Qt::endl;
+ << ": " << GetLocalizedDateByTimestamp(sign->timestamp) << Qt::endl;
stream_ << Qt::endl << "## " << tr("Signatures List") << ":" << Qt::endl;
stream_ << Qt::endl;
@@ -190,7 +189,8 @@ auto GpgFrontend::GpgVerifyResultAnalyse::print_signer_without_key(
<< Qt::endl;
stream << "- " << tr("Hash Algo") << ": " << sign.GetHashAlgo() << Qt::endl;
stream << "- " << tr("Sign Date") << "(" << tr("UTC") << ")"
- << ": " << sign.GetCreateTime().toString() << Qt::endl;
+ << ": " << QLocale().toString(sign.GetCreateTime().toUTC())
+ << Qt::endl;
stream << "- " << tr("Sign Date") << "(" << tr("Localized") << ")"
<< ": " << QLocale().toString(sign.GetCreateTime()) << Qt::endl;
return true;
@@ -235,7 +235,8 @@ auto GpgFrontend::GpgVerifyResultAnalyse::print_signer(QTextStream &stream,
<< Qt::endl;
stream << "- " << tr("Hash Algo") << ": " << sign.GetHashAlgo() << Qt::endl;
stream << "- " << tr("Sign Date") << "(" << tr("UTC") << ")"
- << ": " << sign.GetCreateTime().toString() << Qt::endl;
+ << ": " << QLocale().toString(sign.GetCreateTime().toUTC())
+ << Qt::endl;
stream << "- " << tr("Sign Date") << "(" << tr("Localized") << ")"
<< ": " << QLocale().toString(sign.GetCreateTime()) << Qt::endl;
stream << Qt::endl;
diff --git a/src/core/utils/LocalizedUtils.cpp b/src/core/utils/LocalizedUtils.cpp
index 6c020ed7..e5c9b434 100644
--- a/src/core/utils/LocalizedUtils.cpp
+++ b/src/core/utils/LocalizedUtils.cpp
@@ -32,7 +32,12 @@
namespace GpgFrontend {
-auto GetFormatedDateByTimestamp(time_t timestamp) -> QString {
+auto GetLocalizedDateByTimestamp(time_t timestamp) -> QString {
return QLocale().toString(QDateTime::fromSecsSinceEpoch(timestamp));
}
+
+auto GetUTCDateByTimestamp(time_t timestamp) -> QString {
+ return QLocale().toString(QDateTime::fromSecsSinceEpoch(timestamp).toUTC());
+}
+
} // namespace GpgFrontend
diff --git a/src/core/utils/LocalizedUtils.h b/src/core/utils/LocalizedUtils.h
index d7aaf0c8..b93b500c 100644
--- a/src/core/utils/LocalizedUtils.h
+++ b/src/core/utils/LocalizedUtils.h
@@ -30,6 +30,8 @@
namespace GpgFrontend {
-auto GPGFRONTEND_CORE_EXPORT GetFormatedDateByTimestamp(time_t) -> QString;
+auto GPGFRONTEND_CORE_EXPORT GetLocalizedDateByTimestamp(time_t) -> QString;
-} \ No newline at end of file
+auto GPGFRONTEND_CORE_EXPORT GetUTCDateByTimestamp(time_t) -> QString;
+
+} // namespace GpgFrontend \ No newline at end of file
diff --git a/src/module/integrated/version_checking_module/VersionCheckTask.cpp b/src/module/integrated/version_checking_module/VersionCheckTask.cpp
index 83844af8..e81fc92d 100644
--- a/src/module/integrated/version_checking_module/VersionCheckTask.cpp
+++ b/src/module/integrated/version_checking_module/VersionCheckTask.cpp
@@ -50,8 +50,10 @@ auto VersionCheckTask::Run() -> int {
QString latest_version_url =
"https://api.github.com/repos/saturneric/gpgfrontend/releases/latest";
- QNetworkRequest latest_request;
- latest_request.setUrl(QUrl(latest_version_url));
+ QNetworkRequest latest_request(latest_version_url);
+ latest_request.setHeader(QNetworkRequest::UserAgentHeader,
+ HTTP_REQUEST_USER_AGENT);
+
latest_reply_ = network_manager_->get(latest_request);
connect(latest_reply_, &QNetworkReply::finished, this,
&VersionCheckTask::slot_parse_latest_version_info);
@@ -109,8 +111,10 @@ void VersionCheckTask::slot_parse_latest_version_info() {
current_version_;
MODULE_LOG_DEBUG("current version info query url: {}", current_version_url);
- QNetworkRequest current_request;
- current_request.setUrl(QUrl(current_version_url));
+ QNetworkRequest current_request(current_version_url);
+ current_request.setHeader(QNetworkRequest::UserAgentHeader,
+ HTTP_REQUEST_USER_AGENT);
+
current_reply_ = network_manager_->get(current_request);
connect(current_reply_, &QNetworkReply::finished, this,
diff --git a/src/ui/GpgFrontendApplication.cpp b/src/ui/GpgFrontendApplication.cpp
index 1304aad5..c832ffe0 100644
--- a/src/ui/GpgFrontendApplication.cpp
+++ b/src/ui/GpgFrontendApplication.cpp
@@ -36,8 +36,9 @@ namespace GpgFrontend::UI {
GpgFrontendApplication::GpgFrontendApplication(int &argc, char *argv[])
: QApplication(argc, argv) {
-#ifndef MACOS
- this->setWindowIcon(QIcon(":/icons/gpgfrontend.png"));
+#if defined(DEBUG) || !defined(MACOS)
+ GpgFrontend::UI::GpgFrontendApplication::setWindowIcon(
+ QIcon(":/icons/gpgfrontend.png"));
#endif
// set the extra information of the build
diff --git a/src/ui/UserInterfaceUtils.cpp b/src/ui/UserInterfaceUtils.cpp
index ab8aeac9..9daca57b 100644
--- a/src/ui/UserInterfaceUtils.cpp
+++ b/src/ui/UserInterfaceUtils.cpp
@@ -30,6 +30,7 @@
#include <cstddef>
+#include "GpgFrontendBuildInfo.h"
#include "core/GpgConstants.h"
#include "core/function/CoreSignalStation.h"
#include "core/function/gpg/GpgKeyGetter.h"
@@ -428,7 +429,11 @@ void CommonUtils::SlotImportKeyFromKeyServer(
GF_UI_LOG_DEBUG("request url: {}", req_url.toString());
// Waiting for reply
- QNetworkReply *reply = network_manager->get(QNetworkRequest(req_url));
+ auto request = QNetworkRequest(req_url);
+ request.setHeader(QNetworkRequest::UserAgentHeader,
+ HTTP_REQUEST_USER_AGENT);
+
+ QNetworkReply *reply = network_manager->get(request);
QEventLoop loop;
connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
loop.exec();
diff --git a/src/ui/dialog/Wizard.cpp b/src/ui/dialog/Wizard.cpp
index 5765bd1b..ad97d2e5 100644
--- a/src/ui/dialog/Wizard.cpp
+++ b/src/ui/dialog/Wizard.cpp
@@ -42,7 +42,8 @@ Wizard::Wizard(QWidget* parent) : QWizard(parent) {
#endif
setWindowTitle(tr("First Start Wizard"));
- setPixmap(QWizard::LogoPixmap, QPixmap(":/icons/logo.png").scaled(64, 64));
+ setPixmap(QWizard::LogoPixmap,
+ QPixmap(":/icons/gpgfrontend_logo.png").scaled(64, 64));
int next_page_id = GlobalSettingStation::GetInstance()
.GetSettings()
diff --git a/src/ui/dialog/help/AboutDialog.cpp b/src/ui/dialog/help/AboutDialog.cpp
index b26d9cc2..61b01dfe 100644
--- a/src/ui/dialog/help/AboutDialog.cpp
+++ b/src/ui/dialog/help/AboutDialog.cpp
@@ -78,8 +78,8 @@ InfoTab::InfoTab(QWidget* parent) : QWidget(parent) {
"core", "gpgme.version", QString{"2.0.0"});
GF_UI_LOG_DEBUG("got gpgme version from rt: {}", gpgme_version);
- auto pixmap = QPixmap(":/icons/logo.png");
- pixmap = pixmap.scaled(200, 200);
+ auto pixmap = QPixmap(":/icons/gpgfrontend_logo.png");
+ pixmap = pixmap.scaled(128, 128);
auto text =
"<center><h2>" + qApp->applicationName() + "</h2></center>" +
diff --git a/src/ui/dialog/import_export/KeyUploadDialog.cpp b/src/ui/dialog/import_export/KeyUploadDialog.cpp
index f59f9daa..0e0dca4d 100644
--- a/src/ui/dialog/import_export/KeyUploadDialog.cpp
+++ b/src/ui/dialog/import_export/KeyUploadDialog.cpp
@@ -30,6 +30,7 @@
#include <QtNetwork>
+#include "GpgFrontendBuildInfo.h"
#include "core/GpgModel.h"
#include "core/function/gpg/GpgKeyGetter.h"
#include "core/function/gpg/GpgKeyImportExporter.h"
@@ -115,6 +116,7 @@ void KeyUploadDialog::slot_upload_key_to_server(
data.replace(" ", "+");
QNetworkRequest request(req_url);
+ request.setHeader(QNetworkRequest::UserAgentHeader, HTTP_REQUEST_USER_AGENT);
request.setHeader(QNetworkRequest::ContentTypeHeader,
"application/x-www-form-urlencoded");
diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp
index 6f0a99fb..61c5de56 100644
--- a/src/ui/main_window/MainWindowSlotFunction.cpp
+++ b/src/ui/main_window/MainWindowSlotFunction.cpp
@@ -101,8 +101,9 @@ void MainWindow::slot_append_keys_create_datetime() {
auto create_datetime_format_str_local =
QLocale().toString(key.GetCreateTime()) + " (" + tr("Localize") + ") " +
"\n";
- auto create_datetime_format_str = key.GetCreateTime().toString(Qt::ISODate) +
- " (" + tr("UTC") + ") " + "\n ";
+ auto create_datetime_format_str =
+ QLocale().toString(key.GetCreateTime().toUTC()) + " (" + tr("UTC") +
+ ") " + "\n ";
edit_->SlotAppendText2CurTextPage(create_datetime_format_str_local +
create_datetime_format_str);
}
@@ -125,7 +126,7 @@ void MainWindow::slot_append_keys_expire_datetime() {
QLocale().toString(key.GetCreateTime()) + " (" + tr("Local Time") + ") " +
"\n";
auto expire_datetime_format_str =
- key.GetCreateTime().toString(Qt::ISODate) + " (UTC) " + "\n";
+ QLocale().toString(key.GetCreateTime().toUTC()) + " (UTC) " + "\n";
edit_->SlotAppendText2CurTextPage(expire_datetime_format_str_local +
expire_datetime_format_str);
diff --git a/src/ui/thread/KeyServerImportTask.cpp b/src/ui/thread/KeyServerImportTask.cpp
index 63cabbcd..c908f5d7 100644
--- a/src/ui/thread/KeyServerImportTask.cpp
+++ b/src/ui/thread/KeyServerImportTask.cpp
@@ -28,6 +28,7 @@
#include "ui/thread/KeyServerImportTask.h"
+#include "GpgFrontendBuildInfo.h"
#include "core/function/gpg/GpgKeyImportExporter.h"
#include "ui/struct/SettingsObject.h"
#include "ui/struct/settings/KeyServerSO.h"
@@ -54,7 +55,11 @@ auto GpgFrontend::UI::KeyServerImportTask::Run() -> int {
QUrl const req_url(keyserver_url.scheme() + "://" + keyserver_url.host() +
"/pks/lookup?op=get&search=0x" + key_id + "&options=mr");
- reply_ = manager_->get(QNetworkRequest(req_url));
+ auto request = QNetworkRequest(req_url);
+ request.setHeader(QNetworkRequest::UserAgentHeader,
+ HTTP_REQUEST_USER_AGENT);
+
+ reply_ = manager_->get(request);
connect(reply_, &QNetworkReply::finished, this,
&KeyServerImportTask::dealing_reply_from_server);
}
diff --git a/src/ui/thread/KeyServerSearchTask.cpp b/src/ui/thread/KeyServerSearchTask.cpp
index 2f05b774..eb650c4b 100644
--- a/src/ui/thread/KeyServerSearchTask.cpp
+++ b/src/ui/thread/KeyServerSearchTask.cpp
@@ -28,6 +28,8 @@
#include "ui/thread/KeyServerSearchTask.h"
+#include "GpgFrontendBuildInfo.h"
+
GpgFrontend::UI::KeyServerSearchTask::KeyServerSearchTask(QString keyserver_url,
QString search_string)
: Task("key_server_search_task"),
@@ -42,7 +44,10 @@ auto GpgFrontend::UI::KeyServerSearchTask::Run() -> int {
"/pks/lookup?search=" + search_string_ +
"&op=index&options=mr";
- reply_ = manager_->get(QNetworkRequest(url_from_remote));
+ auto request = QNetworkRequest(url_from_remote);
+ request.setHeader(QNetworkRequest::UserAgentHeader, HTTP_REQUEST_USER_AGENT);
+
+ reply_ = manager_->get(request);
connect(reply_, &QNetworkReply::finished, this,
&KeyServerSearchTask::dealing_reply_from_server);
diff --git a/src/ui/thread/ListedKeyServerTestTask.cpp b/src/ui/thread/ListedKeyServerTestTask.cpp
index f50a66ab..15ea959f 100644
--- a/src/ui/thread/ListedKeyServerTestTask.cpp
+++ b/src/ui/thread/ListedKeyServerTestTask.cpp
@@ -31,6 +31,8 @@
#include <QtNetwork>
#include <vector>
+#include "GpgFrontendBuildInfo.h"
+
GpgFrontend::UI::ListedKeyServerTestTask::ListedKeyServerTestTask(
QStringList urls, int timeout, QWidget* /*parent*/)
: Task("listed_key_server_test_task"),
@@ -49,7 +51,11 @@ auto GpgFrontend::UI::ListedKeyServerTestTask::Run() -> int {
auto key_url = QUrl{url};
GF_UI_LOG_DEBUG("key server request: {}", key_url.host());
- auto* network_reply = network_manager_->get(QNetworkRequest{key_url});
+ auto request = QNetworkRequest(key_url);
+ request.setHeader(QNetworkRequest::UserAgentHeader,
+ HTTP_REQUEST_USER_AGENT);
+
+ auto* network_reply = network_manager_->get(request);
auto* timer = new QTimer(this);
connect(network_reply, &QNetworkReply::finished, this,
diff --git a/src/ui/thread/ProxyConnectionTestTask.cpp b/src/ui/thread/ProxyConnectionTestTask.cpp
index b681ca6d..003205e5 100644
--- a/src/ui/thread/ProxyConnectionTestTask.cpp
+++ b/src/ui/thread/ProxyConnectionTestTask.cpp
@@ -30,6 +30,8 @@
#include <QtNetwork>
+#include "GpgFrontendBuildInfo.h"
+
GpgFrontend::UI::ProxyConnectionTestTask::ProxyConnectionTestTask(QString url,
int timeout)
: Task("proxy_connection_test_task"),
@@ -40,7 +42,10 @@ GpgFrontend::UI::ProxyConnectionTestTask::ProxyConnectionTestTask(QString url,
}
auto GpgFrontend::UI::ProxyConnectionTestTask::Run() -> int {
- auto* network_reply = network_manager_->get(QNetworkRequest{url_});
+ auto request = QNetworkRequest(url_);
+ request.setHeader(QNetworkRequest::UserAgentHeader, HTTP_REQUEST_USER_AGENT);
+
+ auto* network_reply = network_manager_->get(request);
auto* timer = new QTimer(this);
connect(network_reply, &QNetworkReply::finished, this,