diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/GpgFrontend.h.in | 3 | ||||
-rw-r--r-- | src/core/function/gpg/GpgSmartCardManager.cpp | 13 | ||||
-rw-r--r-- | src/ui/GpgFrontendApplication.cpp | 2 | ||||
-rw-r--r-- | src/ui/GpgFrontendUIInit.cpp | 50 | ||||
-rw-r--r-- | src/ui/dialog/keypair_details/KeyPairOperaTab.cpp | 2 | ||||
-rw-r--r-- | src/ui/dialog/keypair_details/KeyPairUIDTab.cpp | 5 | ||||
-rw-r--r-- | src/ui/main_window/KeyMgmt.cpp | 8 | ||||
-rw-r--r-- | src/ui/main_window/MainWindow.cpp | 11 | ||||
-rw-r--r-- | src/ui/widgets/KeyList.cpp | 10 |
9 files changed, 59 insertions, 45 deletions
diff --git a/src/GpgFrontend.h.in b/src/GpgFrontend.h.in index e7a971d5..cfa49371 100644 --- a/src/GpgFrontend.h.in +++ b/src/GpgFrontend.h.in @@ -29,8 +29,9 @@ #pragma once #if defined(_WIN32) || defined(WIN32) -#include <windows.h> #include <winsock2.h> +// should include winsock2.h before windows.h +#include <windows.h> #endif // qt global diff --git a/src/core/function/gpg/GpgSmartCardManager.cpp b/src/core/function/gpg/GpgSmartCardManager.cpp index e0608dd3..976b7fd1 100644 --- a/src/core/function/gpg/GpgSmartCardManager.cpp +++ b/src/core/function/gpg/GpgSmartCardManager.cpp @@ -204,7 +204,9 @@ auto PercentDataEscape(const QByteArray& data, bool plus_escape = false, } else if (plus_escape && ch == ' ') { result += '+'; } else if (plus_escape && (ch < 0x20 || ch == '+')) { - result += QString("%%%1").arg(static_cast<int>(static_cast<unsigned char>(ch)), 2, 16, QLatin1Char('0')).toUpper(); + result += QString("%%%1") + .arg(static_cast<int>(ch), 2, 16, QLatin1Char('0')) + .toUpper(); } else { result += QLatin1Char(ch); } @@ -250,10 +252,11 @@ auto GpgSmartCardManager::ModifyPin(const QString& pin_ref) return {err, status.join(' ')}; } -auto GpgSmartCardManager::GenerateKey( - const QString& serial_number, const QString& name, const QString& email, - const QString& comment, const QDateTime& expire, - bool non_expire) -> std::tuple<GpgError, QString> { +auto GpgSmartCardManager::GenerateKey(const QString& serial_number, + const QString& name, const QString& email, + const QString& comment, + const QDateTime& expire, bool non_expire) + -> std::tuple<GpgError, QString> { if (name.isEmpty() || email.isEmpty()) { return {GPG_ERR_INV_ARG, "name or email is empty"}; } diff --git a/src/ui/GpgFrontendApplication.cpp b/src/ui/GpgFrontendApplication.cpp index 961d1194..eed6a054 100644 --- a/src/ui/GpgFrontendApplication.cpp +++ b/src/ui/GpgFrontendApplication.cpp @@ -73,7 +73,7 @@ bool GpgFrontendApplication::notify(QObject *receiver, QEvent *event) { try { return QApplication::notify(receiver, event); } catch (const std::exception &ex) { - FLOG_W("exception was caught in notify: {}", ex.what()); + FLOG_W("exception was caught in notify: %s", ex.what()); QMessageBox::information( nullptr, tr("Standard Exception Thrown"), tr("Oops, an standard exception was thrown " diff --git a/src/ui/GpgFrontendUIInit.cpp b/src/ui/GpgFrontendUIInit.cpp index 3c56b777..03863516 100644 --- a/src/ui/GpgFrontendUIInit.cpp +++ b/src/ui/GpgFrontendUIInit.cpp @@ -134,35 +134,35 @@ void InitGpgFrontendUI(QApplication* app) { QApplication::setStyle(QStyleFactory::create("Fusion")); // Check if system is using dark mode by comparing text/background lightness - QPalette systemPalette = QApplication::palette(); - QColor windowColor = systemPalette.color(QPalette::Window); - QColor textColor = systemPalette.color(QPalette::WindowText); - + QPalette system_palette = QApplication::palette(); + QColor window_color = system_palette.color(QPalette::Window); + QColor text_color = system_palette.color(QPalette::WindowText); + // In dark themes, text is typically lighter than the background - bool isDarkMode = textColor.lightness() > windowColor.lightness(); - - FLOG_D("Dark mode detected: %s", isDarkMode ? "true" : "false"); + bool is_dark_mode = text_color.lightness() > window_color.lightness(); + LOG_D() << "dark mode status:" << is_dark_mode; + + if (is_dark_mode) { + LOG_D() << "applying dark palette..."; - if (isDarkMode) { - FLOG_D("Applying dark palette..."); // Apply dark palette for Fusion - QPalette darkPalette; - darkPalette.setColor(QPalette::Window, QColor(53, 53, 53)); - darkPalette.setColor(QPalette::WindowText, Qt::white); - darkPalette.setColor(QPalette::Base, QColor(25, 25, 25)); - darkPalette.setColor(QPalette::AlternateBase, QColor(53, 53, 53)); - darkPalette.setColor(QPalette::ToolTipBase, Qt::white); - darkPalette.setColor(QPalette::ToolTipText, Qt::white); - darkPalette.setColor(QPalette::Text, Qt::white); - darkPalette.setColor(QPalette::Button, QColor(53, 53, 53)); - darkPalette.setColor(QPalette::ButtonText, Qt::white); - darkPalette.setColor(QPalette::BrightText, Qt::red); - darkPalette.setColor(QPalette::Link, QColor(42, 130, 218)); - darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218)); - darkPalette.setColor(QPalette::HighlightedText, Qt::black); - + QPalette dark_palette; + dark_palette.setColor(QPalette::Window, QColor(53, 53, 53)); + dark_palette.setColor(QPalette::WindowText, Qt::white); + dark_palette.setColor(QPalette::Base, QColor(25, 25, 25)); + dark_palette.setColor(QPalette::AlternateBase, QColor(53, 53, 53)); + dark_palette.setColor(QPalette::ToolTipBase, Qt::black); + dark_palette.setColor(QPalette::ToolTipText, Qt::white); + dark_palette.setColor(QPalette::Text, Qt::white); + dark_palette.setColor(QPalette::Button, QColor(53, 53, 53)); + dark_palette.setColor(QPalette::ButtonText, Qt::white); + dark_palette.setColor(QPalette::BrightText, Qt::red); + dark_palette.setColor(QPalette::Link, QColor(42, 130, 218)); + dark_palette.setColor(QPalette::Highlight, QColor(42, 130, 218)); + dark_palette.setColor(QPalette::HighlightedText, Qt::black); + // Apply the dark palette - QApplication::setPalette(darkPalette); + QApplication::setPalette(dark_palette); } // If user has explicitly set a theme in settings, use that instead diff --git a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp index a06ec835..d52794aa 100644 --- a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp +++ b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp @@ -237,7 +237,7 @@ void KeyPairOperaTab::slot_export_key(bool secret, bool ascii, bool shortest, #if defined(_WIN32) || defined(WIN32) auto file_name = QString("%1[%2](%3)_%4.asc"); #else - auto file_name = QString("%1<%2[(%3)_%4.asc"); + auto file_name = QString("%1<%2>(%3)_%4.asc"); #endif file_name = diff --git a/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp b/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp index bc9e422c..9e81fae6 100644 --- a/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp +++ b/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp @@ -431,16 +431,17 @@ void KeyPairUIDTab::create_uid_popup_menu() { if (m_key_->IsHasMasterKey()) { uid_popup_menu_->addAction(set_primary_uid_act_); - uid_popup_menu_->addAction(sign_uid_act_); uid_popup_menu_->addAction(rev_uid_act_); uid_popup_menu_->addAction(del_uid_act_); } + + uid_popup_menu_->addAction(sign_uid_act_); } void KeyPairUIDTab::contextMenuEvent(QContextMenuEvent* event) { if (uid_list_->selectedItems().length() > 0 && sig_list_->selectedItems().isEmpty()) { - auto is_primary_uid = + const auto is_primary_uid = get_selected_uid().GetUID() == buffered_uids_.front().GetUID(); set_primary_uid_act_->setDisabled(is_primary_uid); rev_uid_act_->setDisabled(is_primary_uid); diff --git a/src/ui/main_window/KeyMgmt.cpp b/src/ui/main_window/KeyMgmt.cpp index f9364ecf..8c384ebb 100644 --- a/src/ui/main_window/KeyMgmt.cpp +++ b/src/ui/main_window/KeyMgmt.cpp @@ -622,10 +622,10 @@ void KeyMgmt::slot_popup_menu_by_key_list(QContextMenuEvent* event, if (keys.isEmpty()) return; auto key = keys.front(); - generate_subkey_act_->setDisabled(key->KeyType() != - GpgAbstractKeyType::kGPG_KEY); - set_owner_trust_of_key_act_->setDisabled(key->KeyType() != - GpgAbstractKeyType::kGPG_KEY); + generate_subkey_act_->setVisible( + key->KeyType() == GpgAbstractKeyType::kGPG_KEY && key->IsPrivateKey()); + set_owner_trust_of_key_act_->setVisible(key->KeyType() == + GpgAbstractKeyType::kGPG_KEY); popup_menu_->exec(event->globalPos()); } diff --git a/src/ui/main_window/MainWindow.cpp b/src/ui/main_window/MainWindow.cpp index e2c4f1e3..76830691 100644 --- a/src/ui/main_window/MainWindow.cpp +++ b/src/ui/main_window/MainWindow.cpp @@ -305,12 +305,15 @@ void MainWindow::slot_popup_menu_by_key_list(QContextMenuEvent* event, if (event == nullptr || key_table == nullptr) return; const auto key_table_name = key_table->objectName(); + + LOG_D() << "current key table object name: " << key_table_name; + if (key_table_name == "favourite") { - remove_key_from_favourtie_act_->setDisabled(true); - add_key_2_favourite_act_->setDisabled(false); + remove_key_from_favourtie_act_->setVisible(true); + add_key_2_favourite_act_->setVisible(false); } else { - remove_key_from_favourtie_act_->setDisabled(false); - add_key_2_favourite_act_->setDisabled(true); + remove_key_from_favourtie_act_->setVisible(false); + add_key_2_favourite_act_->setVisible(true); } popup_menu_->popup(event->globalPos()); diff --git a/src/ui/widgets/KeyList.cpp b/src/ui/widgets/KeyList.cpp index dfabe885..13d4b211 100644 --- a/src/ui/widgets/KeyList.cpp +++ b/src/ui/widgets/KeyList.cpp @@ -280,11 +280,17 @@ void KeyList::init() { tr("Sync public key with your default keyserver.")); ui_->uncheckButton->setText(tr("Uncheck ALL")); ui_->uncheckButton->setToolTip( - tr("Cancel all checked items in the current tab at once.")); + tr("Cancel all checked keys in the current tab at once.")); ui_->checkALLButton->setText(tr("Check ALL")); ui_->checkALLButton->setToolTip( - tr("Check all items in the current tab at once")); + tr("Check all keys in the current tab at once")); ui_->searchBarEdit->setPlaceholderText(tr("Search for keys...")); + ui_->columnTypeButton->setText(tr("Column Type")); + ui_->columnTypeButton->setToolTip(tr("Selected showed column type(s)")); + ui_->keyGroupButton->setText(tr("New Key Group")); + ui_->keyGroupButton->setToolTip(tr("Create a new key group")); + ui_->switchContextButton->setText(tr("Key Databases")); + ui_->switchContextButton->setToolTip(tr("Switch between Key Databases")); } auto KeyList::AddListGroupTab( |