diff options
author | saturneric <[email protected]> | 2024-06-02 20:03:59 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-06-02 20:03:59 +0000 |
commit | e7694f9a0729cb88064eda6623c99070f5a46dc0 (patch) | |
tree | 39c5339991212dc4eaf653ec3e016b8daa79fbb7 /src/ui/main_window/MainWindowUI.cpp | |
parent | fix: cannot show version in about tab (diff) | |
download | GpgFrontend-e7694f9a0729cb88064eda6623c99070f5a46dc0.tar.gz GpgFrontend-e7694f9a0729cb88064eda6623c99070f5a46dc0.zip |
feat: rewrite key list structure and logic
Diffstat (limited to 'src/ui/main_window/MainWindowUI.cpp')
-rw-r--r-- | src/ui/main_window/MainWindowUI.cpp | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/src/ui/main_window/MainWindowUI.cpp b/src/ui/main_window/MainWindowUI.cpp index 8b611152..f96cf595 100644 --- a/src/ui/main_window/MainWindowUI.cpp +++ b/src/ui/main_window/MainWindowUI.cpp @@ -707,37 +707,44 @@ void MainWindow::create_dock_windows() { addDockWidget(Qt::RightDockWidgetArea, key_list_dock_); m_key_list_->AddListGroupTab( - tr("Default"), "default", KeyListRow::SECRET_OR_PUBLIC_KEY, - KeyListColumn::TYPE | KeyListColumn::NAME | KeyListColumn::EmailAddress | - KeyListColumn::Usage | KeyListColumn::Validity, - [](const GpgKey& key, const KeyTable&) -> bool { + tr("Default"), "default", + GpgKeyTableDisplayMode::kPublicKey | GpgKeyTableDisplayMode::kPrivateKey, + GpgKeyTableColumn::kType | GpgKeyTableColumn::kName | + GpgKeyTableColumn::kEmailAddress | GpgKeyTableColumn::kUsage | + GpgKeyTableColumn::kValidity, + [](const GpgKey& key) -> bool { return !(key.IsRevoked() || key.IsDisabled() || key.IsExpired()); }); m_key_list_->AddListGroupTab( - tr("Favourite"), "favourite", KeyListRow::SECRET_OR_PUBLIC_KEY, - KeyListColumn::TYPE | KeyListColumn::NAME | KeyListColumn::EmailAddress | - KeyListColumn::Usage | KeyListColumn::Validity, - [](const GpgKey& key, const KeyTable&) -> bool { + tr("Favourite"), "favourite", + GpgKeyTableDisplayMode::kPublicKey | GpgKeyTableDisplayMode::kPrivateKey | + GpgKeyTableDisplayMode::kFavorites, + GpgKeyTableColumn::kType | GpgKeyTableColumn::kName | + GpgKeyTableColumn::kEmailAddress | GpgKeyTableColumn::kUsage | + GpgKeyTableColumn::kValidity, + [](const GpgKey& key) -> bool { return CommonUtils::GetInstance()->KeyExistsinFavouriteList(key); }); m_key_list_->AddListGroupTab( tr("Only Public Key"), "only_public_key", - KeyListRow::SECRET_OR_PUBLIC_KEY, - KeyListColumn::TYPE | KeyListColumn::NAME | KeyListColumn::EmailAddress | - KeyListColumn::Usage | KeyListColumn::Validity, - [](const GpgKey& key, const KeyTable&) -> bool { + GpgKeyTableDisplayMode::kPublicKey, + GpgKeyTableColumn::kType | GpgKeyTableColumn::kName | + GpgKeyTableColumn::kEmailAddress | GpgKeyTableColumn::kUsage | + GpgKeyTableColumn::kValidity, + [](const GpgKey& key) -> bool { return !key.IsPrivateKey() && !(key.IsRevoked() || key.IsDisabled() || key.IsExpired()); }); m_key_list_->AddListGroupTab( tr("Has Private Key"), "has_private_key", - KeyListRow::SECRET_OR_PUBLIC_KEY, - KeyListColumn::TYPE | KeyListColumn::NAME | KeyListColumn::EmailAddress | - KeyListColumn::Usage | KeyListColumn::Validity, - [](const GpgKey& key, const KeyTable&) -> bool { + GpgKeyTableDisplayMode::kPrivateKey, + GpgKeyTableColumn::kType | GpgKeyTableColumn::kName | + GpgKeyTableColumn::kEmailAddress | GpgKeyTableColumn::kUsage | + GpgKeyTableColumn::kValidity, + [](const GpgKey& key) -> bool { return key.IsPrivateKey() && !(key.IsRevoked() || key.IsDisabled() || key.IsExpired()); }); |