aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-01-23 13:24:14 +0000
committersaturneric <[email protected]>2024-01-23 13:24:14 +0000
commitbab198aa131d4856a5af1668494d96cbcd612c0f (patch)
tree3d0fe2acc7eea39a75bfa7cbc60d7f90d89571d8
parentfeat: add a setting to enable gpgme debug log (diff)
downloadGpgFrontend-bab198aa131d4856a5af1668494d96cbcd612c0f.tar.gz
GpgFrontend-bab198aa131d4856a5af1668494d96cbcd612c0f.zip
feat: improve key list and find widget
-rw-r--r--gpgfrontend.qrc4
-rw-r--r--resource/lfs/icons/close.pngbin0 -> 6036 bytes
-rw-r--r--resource/lfs/icons/editor.pngbin0 -> 3240 bytes
-rw-r--r--resource/lfs/icons/search.pngbin0 -> 3991 bytes
-rw-r--r--resource/lfs/icons/txt.pngbin2482 -> 0 bytes
-rw-r--r--src/ui/dialog/Wizard.cpp14
-rw-r--r--src/ui/dialog/settings/SettingsGeneral.cpp7
-rw-r--r--src/ui/main_window/MainWindowSlotFunction.cpp4
-rw-r--r--src/ui/main_window/MainWindowUI.cpp3
-rw-r--r--src/ui/widgets/FindWidget.cpp23
-rw-r--r--src/ui/widgets/KeyList.cpp49
-rw-r--r--src/ui/widgets/KeyList.h1
-rw-r--r--ui/GeneralSettings.ui7
-rw-r--r--ui/InfoBoard.ui41
14 files changed, 99 insertions, 54 deletions
diff --git a/gpgfrontend.qrc b/gpgfrontend.qrc
index 9e0b754b..a5b5e24e 100644
--- a/gpgfrontend.qrc
+++ b/gpgfrontend.qrc
@@ -63,7 +63,7 @@
<file alias="ssh-key.png">resource/lfs/icons/ssh-key.png</file>
<file alias="statusbar_icon.png">resource/lfs/icons/statusbar_icon.png</file>
<file alias="trash.png">resource/lfs/icons/trash.png</file>
- <file alias="txt.png">resource/lfs/icons/txt.png</file>
+ <file alias="editor.png">resource/lfs/icons/editor.png</file>
<file alias="undo.png">resource/lfs/icons/undo.png</file>
<file alias="verify.png">resource/lfs/icons/verify.png</file>
<file alias="export_key_to_clipboard.png">resource/lfs/icons/export_key_to_clipboard.png</file>
@@ -86,6 +86,8 @@
<file alias="clear.png">resource/lfs/icons/clear.png</file>
<file alias="cloud_sync.png">resource/lfs/icons/cloud_sync.png</file>
<file alias="total_selection.png">resource/lfs/icons/total_selection.png</file>
+ <file alias="search.png">resource/lfs/icons/search.png</file>
+ <file alias="close.png">resource/lfs/icons/close.png</file>
</qresource>
<qresource prefix="/test/key">
<file alias="pv1.key">resource/lfs/test/data/pv1.key</file>
diff --git a/resource/lfs/icons/close.png b/resource/lfs/icons/close.png
new file mode 100644
index 00000000..9136e287
--- /dev/null
+++ b/resource/lfs/icons/close.png
Binary files differ
diff --git a/resource/lfs/icons/editor.png b/resource/lfs/icons/editor.png
new file mode 100644
index 00000000..fb1e5480
--- /dev/null
+++ b/resource/lfs/icons/editor.png
Binary files differ
diff --git a/resource/lfs/icons/search.png b/resource/lfs/icons/search.png
new file mode 100644
index 00000000..6d845d7b
--- /dev/null
+++ b/resource/lfs/icons/search.png
Binary files differ
diff --git a/resource/lfs/icons/txt.png b/resource/lfs/icons/txt.png
deleted file mode 100644
index 8db7ba45..00000000
--- a/resource/lfs/icons/txt.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/dialog/Wizard.cpp b/src/ui/dialog/Wizard.cpp
index 89ebee27..b6fa53f3 100644
--- a/src/ui/dialog/Wizard.cpp
+++ b/src/ui/dialog/Wizard.cpp
@@ -218,20 +218,20 @@ ConclusionPage::ConclusionPage(QWidget* parent) : QWizardPage(parent) {
setTitle(tr("Ready."));
setSubTitle(tr("Have fun with GpgFrontend!"));
- auto* bottomLabel = new QLabel(
+ auto* bottom_label = new QLabel(
tr("You are ready to use GpgFrontend now.<br><br>") +
"<a "
- "href=\"https://saturneric.github.io/GpgFrontend/index.html#/"
+ "href=\"https://gpgfrontend.bktus.com/manual/understand-interface"
"overview\">" +
tr("The Online Document") + "</a>" +
tr(" will get you started with GpgFrontend. Anytime you encounter "
"problems, please try to find help from the documentation") +
"<br>");
- bottomLabel->setTextFormat(Qt::RichText);
- bottomLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
- bottomLabel->setOpenExternalLinks(true);
- bottomLabel->setWordWrap(true);
+ bottom_label->setTextFormat(Qt::RichText);
+ bottom_label->setTextInteractionFlags(Qt::TextBrowserInteraction);
+ bottom_label->setOpenExternalLinks(true);
+ bottom_label->setWordWrap(true);
open_help_check_box_ = new QCheckBox(tr("Open offline help."));
open_help_check_box_->setChecked(true);
@@ -243,7 +243,7 @@ ConclusionPage::ConclusionPage(QWidget* parent) : QWizardPage(parent) {
// registerField("openHelp", openHelpCheckBox);
auto* layout = new QVBoxLayout;
- layout->addWidget(bottomLabel);
+ layout->addWidget(bottom_label);
// layout->addWidget(openHelpCheckBox);
layout->addWidget(dont_show_wizard_checkbox_);
setLayout(layout);
diff --git a/src/ui/dialog/settings/SettingsGeneral.cpp b/src/ui/dialog/settings/SettingsGeneral.cpp
index 2f3e171e..bcf42867 100644
--- a/src/ui/dialog/settings/SettingsGeneral.cpp
+++ b/src/ui/dialog/settings/SettingsGeneral.cpp
@@ -66,6 +66,8 @@ GeneralTab::GeneralTab(QWidget* parent)
tr("Clear All Data Objects (Total Size: %1)")
.arg(GlobalSettingStation::GetInstance().GetDataObjectsFilesSize()));
+ ui_->revealInFileExplorerButton->setText(tr("Reveal in File Explorer"));
+
lang_ = SettingsDialog::ListLanguages();
for (const auto& l : lang_) {
ui_->langSelectBox->addItem(l);
@@ -96,6 +98,11 @@ GeneralTab::GeneralTab(QWidget* parent)
}
});
+ connect(ui_->revealInFileExplorerButton, &QPushButton::clicked, this, [=]() {
+ QDesktopServices::openUrl(QUrl::fromLocalFile(
+ GlobalSettingStation::GetInstance().GetAppDataPath()));
+ });
+
SetSettings();
}
diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp
index 2ee7470c..8bf2e411 100644
--- a/src/ui/main_window/MainWindowSlotFunction.cpp
+++ b/src/ui/main_window/MainWindowSlotFunction.cpp
@@ -50,10 +50,10 @@ void MainWindow::slot_find() {
}
// At first close verifynotification, if existing
- edit_->SlotCurPageTextEdit()->CloseNoteByClass("findwidget");
+ edit_->SlotCurPageTextEdit()->CloseNoteByClass("FindWidget");
auto* fw = new FindWidget(this, edit_->CurTextPage());
- edit_->SlotCurPageTextEdit()->ShowNotificationWidget(fw, "findWidget");
+ edit_->SlotCurPageTextEdit()->ShowNotificationWidget(fw, "FindWidget");
}
/*
diff --git a/src/ui/main_window/MainWindowUI.cpp b/src/ui/main_window/MainWindowUI.cpp
index c193e4d1..8b6fc74c 100644
--- a/src/ui/main_window/MainWindowUI.cpp
+++ b/src/ui/main_window/MainWindowUI.cpp
@@ -147,6 +147,7 @@ void MainWindow::create_actions() {
&TextEdit::SlotSelectAll);
find_act_ = new QAction(tr("Find"), this);
+ find_act_->setIcon(QIcon(":/icons/search.png"));
find_act_->setShortcut(QKeySequence::Find);
find_act_->setToolTip(tr("Find a word"));
connect(find_act_, &QAction::triggered, this, &MainWindow::slot_find);
@@ -330,7 +331,7 @@ void MainWindow::create_actions() {
});
import_key_from_edit_act_ = new QAction(tr("Editor"), this);
- import_key_from_edit_act_->setIcon(QIcon(":/icons/txt.png"));
+ import_key_from_edit_act_->setIcon(QIcon(":/icons/editor.png"));
import_key_from_edit_act_->setToolTip(tr("Import New Key From Editor"));
connect(import_key_from_edit_act_, &QAction::triggered, this,
&MainWindow::slot_import_key_from_edit);
diff --git a/src/ui/widgets/FindWidget.cpp b/src/ui/widgets/FindWidget.cpp
index 7cc569e4..6b5b386c 100644
--- a/src/ui/widgets/FindWidget.cpp
+++ b/src/ui/widgets/FindWidget.cpp
@@ -33,9 +33,8 @@ namespace GpgFrontend::UI {
FindWidget::FindWidget(QWidget* parent, PlainTextEditorPage* edit)
: QWidget(parent), m_text_page_(edit) {
find_edit_ = new QLineEdit(this);
- auto* close_button = new QPushButton(
- this->style()->standardIcon(QStyle::SP_TitleBarCloseButton), QString(),
- this);
+ auto* close_button =
+ new QPushButton(QIcon(":/icons/close.png"), QString(), this);
auto* next_button =
new QPushButton(QIcon(":/icons/button_next.png"), QString());
auto* previous_button =
@@ -60,24 +59,10 @@ FindWidget::FindWidget(QWidget* parent, PlainTextEditorPage* edit)
connect(close_button, &QPushButton::clicked, this, &FindWidget::slot_close);
// The timer is necessary for setting the focus
- QTimer::singleShot(0, find_edit_, SLOT(setFocus()));
+ QTimer::singleShot(32, find_edit_, SLOT(setFocus()));
}
-void FindWidget::set_background() {
- // auto cursor = m_text_page_->GetTextPage()->textCursor();
- // if match is found set background of QLineEdit to white, otherwise to red
- QPalette bg_palette(find_edit_->palette());
-
- if (!find_edit_->text().isEmpty() && m_text_page_->GetTextPage()
- ->document()
- ->find(find_edit_->text())
- .position() < 0) {
- bg_palette.setColor(QPalette::Base, "#ececba");
- } else {
- bg_palette.setColor(QPalette::Base, Qt::white);
- }
- find_edit_->setPalette(bg_palette);
-}
+void FindWidget::set_background() {}
void FindWidget::slot_find_next() {
QTextCursor cursor = m_text_page_->GetTextPage()->textCursor();
diff --git a/src/ui/widgets/KeyList.cpp b/src/ui/widgets/KeyList.cpp
index 4fb883db..e2152c5a 100644
--- a/src/ui/widgets/KeyList.cpp
+++ b/src/ui/widgets/KeyList.cpp
@@ -126,7 +126,7 @@ void KeyList::AddListGroupTab(const QString& name, const QString& id,
m_key_tables_.emplace_back(key_list, selectType, infoType, filter);
m_key_tables_.back().SetMenuAbility(menu_ability_);
- key_list->setColumnCount(7);
+ key_list->setColumnCount(8);
key_list->horizontalHeader()->setSectionResizeMode(
QHeaderView::ResizeToContents);
key_list->verticalHeader()->hide();
@@ -159,13 +159,16 @@ void KeyList::AddListGroupTab(const QString& name, const QString& id,
if ((infoType & KeyListColumn::Validity) == 0U) {
key_list->setColumnHidden(5, true);
}
- if ((infoType & KeyListColumn::FingerPrint) == 0U) {
+ if ((infoType & KeyListColumn::KeyID) == 0U) {
key_list->setColumnHidden(6, true);
}
+ if ((infoType & KeyListColumn::FingerPrint) == 0U) {
+ key_list->setColumnHidden(7, true);
+ }
QStringList labels;
labels << tr("Select") << tr("Type") << tr("Name") << tr("Email Address")
- << tr("Usage") << tr("Trust") << tr("Finger Print");
+ << tr("Usage") << tr("Trust") << tr("Key ID") << tr("Finger Print");
key_list->setHorizontalHeaderLabels(labels);
key_list->horizontalHeader()->setStretchLastSection(false);
@@ -190,7 +193,7 @@ void KeyList::SlotRefreshUI() {
this->slot_refresh_ui();
}
-KeyIdArgsListPtr KeyList::GetChecked(const KeyTable& key_table) {
+auto KeyList::GetChecked(const KeyTable& key_table) -> KeyIdArgsListPtr {
auto ret = std::make_unique<KeyIdArgsList>();
for (int i = 0; i < key_table.key_list_->rowCount(); i++) {
if (key_table.key_list_->item(i, 0)->checkState() == Qt::Checked) {
@@ -200,7 +203,7 @@ KeyIdArgsListPtr KeyList::GetChecked(const KeyTable& key_table) {
return ret;
}
-KeyIdArgsListPtr KeyList::GetChecked() {
+auto KeyList::GetChecked() -> KeyIdArgsListPtr {
auto* key_list =
qobject_cast<QTableWidget*>(ui_->keyGroupTab->currentWidget());
const auto& buffered_keys =
@@ -214,7 +217,7 @@ KeyIdArgsListPtr KeyList::GetChecked() {
return ret;
}
-KeyIdArgsListPtr KeyList::GetAllPrivateKeys() {
+auto KeyList::GetAllPrivateKeys() -> KeyIdArgsListPtr {
auto* key_list =
qobject_cast<QTableWidget*>(ui_->keyGroupTab->currentWidget());
const auto& buffered_keys =
@@ -228,7 +231,7 @@ KeyIdArgsListPtr KeyList::GetAllPrivateKeys() {
return ret;
}
-KeyIdArgsListPtr KeyList::GetPrivateChecked() {
+auto KeyList::GetPrivateChecked() -> KeyIdArgsListPtr {
auto ret = std::make_unique<KeyIdArgsList>();
if (ui_->keyGroupTab->size().isEmpty()) return ret;
@@ -289,7 +292,7 @@ KeyIdArgsListPtr KeyList::GetSelected() {
return ret;
}
-[[maybe_unused]] bool KeyList::ContainsPrivateKeys() {
+[[maybe_unused]] auto KeyList::ContainsPrivateKeys() -> bool {
if (ui_->keyGroupTab->size().isEmpty()) return false;
m_key_list_ = qobject_cast<QTableWidget*>(ui_->keyGroupTab->currentWidget());
@@ -657,22 +660,28 @@ void KeyTable::Refresh(KeyLinkListPtr m_keys) {
temp_validity->setTextAlignment(Qt::AlignCenter);
key_list_->setItem(row_index, 5, temp_validity);
+ auto* temp_id = new QTableWidgetItem(it->GetId());
+ temp_id->setTextAlignment(Qt::AlignCenter);
+ key_list_->setItem(row_index, 6, temp_id);
+
auto* temp_fpr = new QTableWidgetItem(it->GetFingerprint());
temp_fpr->setTextAlignment(Qt::AlignCenter);
- key_list_->setItem(row_index, 6, temp_fpr);
+ key_list_->setItem(row_index, 7, temp_fpr);
+
+ QFont font = tmp2->font();
// strike out expired keys
- if (it->IsExpired() || it->IsRevoked()) {
- QFont strike = tmp2->font();
- strike.setStrikeOut(true);
- tmp0->setFont(strike);
- temp_usage->setFont(strike);
- temp_fpr->setFont(strike);
- temp_validity->setFont(strike);
- tmp1->setFont(strike);
- tmp2->setFont(strike);
- tmp3->setFont(strike);
- }
+ if (it->IsExpired() || it->IsRevoked()) font.setStrikeOut(true);
+ if (it->IsPrivateKey()) font.setBold(true);
+
+ tmp0->setFont(font);
+ temp_usage->setFont(font);
+ temp_fpr->setFont(font);
+ temp_validity->setFont(font);
+ tmp1->setFont(font);
+ tmp2->setFont(font);
+ tmp3->setFont(font);
+ temp_id->setFont(font);
// move to buffered keys
buffered_keys_.emplace_back(std::move(*it));
diff --git a/src/ui/widgets/KeyList.h b/src/ui/widgets/KeyList.h
index cfefe043..25180496 100644
--- a/src/ui/widgets/KeyList.h
+++ b/src/ui/widgets/KeyList.h
@@ -59,6 +59,7 @@ struct KeyListColumn {
static constexpr InfoType Usage = 1 << 3; ///<
static constexpr InfoType Validity = 1 << 4; ///<
static constexpr InfoType FingerPrint = 1 << 5; ///<
+ static constexpr InfoType KeyID = 1 << 6; ///<
};
/**
diff --git a/ui/GeneralSettings.ui b/ui/GeneralSettings.ui
index 958b956a..a19626f5 100644
--- a/ui/GeneralSettings.ui
+++ b/ui/GeneralSettings.ui
@@ -106,6 +106,13 @@
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
+ <widget class="QPushButton" name="revealInFileExplorerButton">
+ <property name="text">
+ <string>Reveal in File Explorer</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QPushButton" name="clearAllLogFilesButton">
<property name="text">
<string>Clear All Log Files</string>
diff --git a/ui/InfoBoard.ui b/ui/InfoBoard.ui
index 9e50505d..564ab52a 100644
--- a/ui/InfoBoard.ui
+++ b/ui/InfoBoard.ui
@@ -14,15 +14,48 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
- <widget class="QTextEdit" name="infoBoard">
- <property name="readOnly">
- <bool>true</bool>
- </property>
+ <widget class="QStackedWidget" name="stackedWidget">
+ <widget class="QWidget" name="page">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QTextEdit" name="infoBoard">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page_2"/>
</widget>
</item>
</layout>