mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-10-11 21:10:48 -04:00
parent
bc5d0df19e
commit
304cb44d0d
9 changed files with 43 additions and 0 deletions
|
@ -826,6 +826,19 @@ void DatabaseWidget::createGroup()
|
|||
switchToGroupEdit(m_newGroup.data(), true);
|
||||
}
|
||||
|
||||
void DatabaseWidget::cloneGroup()
|
||||
{
|
||||
Group* currentGroup = m_groupView->currentGroup();
|
||||
Q_ASSERT(currentGroup && canCloneCurrentGroup());
|
||||
if (!currentGroup || !canCloneCurrentGroup()) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_newGroup.reset(currentGroup->clone(Entry::CloneCopy, Group::CloneDefault | Group::CloneRenameTitle));
|
||||
m_newParent = currentGroup->parentGroup();
|
||||
switchToGroupEdit(m_newGroup.data(), true);
|
||||
}
|
||||
|
||||
void DatabaseWidget::deleteGroup()
|
||||
{
|
||||
Group* currentGroup = m_groupView->currentGroup();
|
||||
|
@ -1375,6 +1388,14 @@ void DatabaseWidget::onEntryChanged(Entry* entry)
|
|||
emit entrySelectionChanged();
|
||||
}
|
||||
|
||||
bool DatabaseWidget::canCloneCurrentGroup() const
|
||||
{
|
||||
bool isRootGroup = m_db->rootGroup() == m_groupView->currentGroup();
|
||||
// bool isRecycleBin = isRecycleBinSelected();
|
||||
|
||||
return !isRootGroup;
|
||||
}
|
||||
|
||||
bool DatabaseWidget::canDeleteCurrentGroup() const
|
||||
{
|
||||
bool isRootGroup = m_db->rootGroup() == m_groupView->currentGroup();
|
||||
|
|
|
@ -94,6 +94,7 @@ public:
|
|||
EntryView* entryView();
|
||||
|
||||
Group* currentGroup() const;
|
||||
bool canCloneCurrentGroup() const;
|
||||
bool canDeleteCurrentGroup() const;
|
||||
bool isGroupSelected() const;
|
||||
bool isRecycleBinSelected() const;
|
||||
|
@ -190,6 +191,7 @@ public slots:
|
|||
void downloadAllFavicons();
|
||||
void openUrlForEntry(Entry* entry);
|
||||
void createGroup();
|
||||
void cloneGroup();
|
||||
void deleteGroup();
|
||||
void switchToMainView(bool previousDialogAccepted = false);
|
||||
void switchToEntryEdit();
|
||||
|
|
|
@ -390,6 +390,7 @@ MainWindow::MainWindow()
|
|||
|
||||
m_ui->actionGroupNew->setIcon(icons()->icon("group-new"));
|
||||
m_ui->actionGroupEdit->setIcon(icons()->icon("group-edit"));
|
||||
m_ui->actionGroupClone->setIcon(icons()->icon("group-clone"));
|
||||
m_ui->actionGroupDelete->setIcon(icons()->icon("group-delete"));
|
||||
m_ui->actionGroupEmptyRecycleBin->setIcon(icons()->icon("group-empty-trash"));
|
||||
m_ui->actionEntryOpenUrl->setIcon(icons()->icon("web"));
|
||||
|
@ -490,6 +491,7 @@ MainWindow::MainWindow()
|
|||
|
||||
m_actionMultiplexer.connect(m_ui->actionGroupNew, SIGNAL(triggered()), SLOT(createGroup()));
|
||||
m_actionMultiplexer.connect(m_ui->actionGroupEdit, SIGNAL(triggered()), SLOT(switchToGroupEdit()));
|
||||
m_actionMultiplexer.connect(m_ui->actionGroupClone, SIGNAL(triggered()), SLOT(cloneGroup()));
|
||||
m_actionMultiplexer.connect(m_ui->actionGroupDelete, SIGNAL(triggered()), SLOT(deleteGroup()));
|
||||
m_actionMultiplexer.connect(m_ui->actionGroupEmptyRecycleBin, SIGNAL(triggered()), SLOT(emptyRecycleBin()));
|
||||
m_actionMultiplexer.connect(m_ui->actionGroupSortAsc, SIGNAL(triggered()), SLOT(sortGroupsAsc()));
|
||||
|
@ -830,6 +832,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
|||
|| (singleEntrySelected && dbWidget->currentEntryHasUrl()));
|
||||
m_ui->actionGroupNew->setEnabled(groupSelected);
|
||||
m_ui->actionGroupEdit->setEnabled(groupSelected);
|
||||
m_ui->actionGroupClone->setEnabled(groupSelected && dbWidget->canCloneCurrentGroup());
|
||||
m_ui->actionGroupDelete->setEnabled(groupSelected && dbWidget->canDeleteCurrentGroup());
|
||||
m_ui->actionGroupSortAsc->setEnabled(groupSelected && currentGroupHasChildren);
|
||||
m_ui->actionGroupSortDesc->setEnabled(groupSelected && currentGroupHasChildren);
|
||||
|
|
|
@ -337,6 +337,7 @@
|
|||
</property>
|
||||
<addaction name="actionGroupNew"/>
|
||||
<addaction name="actionGroupEdit"/>
|
||||
<addaction name="actionGroupClone"/>
|
||||
<addaction name="actionGroupDelete"/>
|
||||
<addaction name="actionGroupEmptyRecycleBin"/>
|
||||
<addaction name="separator"/>
|
||||
|
@ -1045,6 +1046,14 @@
|
|||
<string notr="true">{USERNAME}{TAB}{PASSWORD}{ENTER}</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGroupClone">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clone Group...</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue