mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-20 18:56:07 -05:00
Remove dependency to Group- and EntryView from MainWindow.
This commit is contained in:
parent
b718e9d8f2
commit
9363d23e09
6 changed files with 39 additions and 12 deletions
|
|
@ -23,15 +23,11 @@
|
|||
|
||||
#include "autotype/AutoType.h"
|
||||
#include "core/Config.h"
|
||||
#include "core/Database.h"
|
||||
#include "core/Entry.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/InactivityTimer.h"
|
||||
#include "core/Metadata.h"
|
||||
#include "gui/AboutDialog.h"
|
||||
#include "gui/DatabaseWidget.h"
|
||||
#include "gui/entry/EntryView.h"
|
||||
#include "gui/group/GroupView.h"
|
||||
|
||||
const QString MainWindow::BaseWindowTitle = "KeePassX";
|
||||
|
||||
|
|
@ -40,6 +36,8 @@ MainWindow::MainWindow()
|
|||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_countDefaultAttributes = m_ui->menuEntryCopyAttribute->actions().size();
|
||||
|
||||
restoreGeometry(config()->get("window/Geometry").toByteArray());
|
||||
|
||||
setWindowIcon(filePath()->applicationIcon());
|
||||
|
|
@ -229,17 +227,16 @@ void MainWindow::updateCopyAttributesMenu()
|
|||
return;
|
||||
}
|
||||
|
||||
Entry* entry = dbWidget->entryView()->currentEntry();
|
||||
if (!entry || !dbWidget->entryView()->isSingleEntrySelected()) {
|
||||
if (!dbWidget->numberOfSelectedEntries() == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
QList<QAction*> actions = m_ui->menuEntryCopyAttribute->actions();
|
||||
for (int i = EntryAttributes::DefaultAttributes.size() + 1; i < actions.size(); i++) {
|
||||
for (int i = m_countDefaultAttributes + 1; i < actions.size(); i++) {
|
||||
delete actions[i];
|
||||
}
|
||||
|
||||
Q_FOREACH (const QString& key, entry->attributes()->customKeys()) {
|
||||
Q_FOREACH (const QString& key, dbWidget->customEntryAttributes()) {
|
||||
QAction* action = m_ui->menuEntryCopyAttribute->addAction(key);
|
||||
m_copyAdditionalAttributeActions->addAction(action);
|
||||
}
|
||||
|
|
@ -276,9 +273,9 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
|||
switch (mode) {
|
||||
case DatabaseWidget::ViewMode: {
|
||||
bool inSearch = dbWidget->isInSearchMode();
|
||||
bool singleEntrySelected = dbWidget->entryView()->isSingleEntrySelected();
|
||||
bool entriesSelected = !dbWidget->entryView()->selectionModel()->selectedRows().isEmpty();
|
||||
bool groupSelected = dbWidget->groupView()->currentGroup();
|
||||
bool singleEntrySelected = dbWidget->numberOfSelectedEntries() == 1;
|
||||
bool entriesSelected = dbWidget->numberOfSelectedEntries() > 0;
|
||||
bool groupSelected = dbWidget->isGroupSelected();
|
||||
|
||||
m_ui->actionEntryNew->setEnabled(!inSearch);
|
||||
m_ui->actionEntryClone->setEnabled(singleEntrySelected && !inSearch);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue