Optimize deletion of copy to clipboard actions.

This commit is contained in:
Florian Geyer 2013-12-01 15:41:26 +01:00
parent a3b95c1c38
commit fc3cc12038
2 changed files with 4 additions and 11 deletions

View File

@ -221,21 +221,13 @@ void MainWindow::updateCopyAttributesMenu()
return;
}
QList<QAction*> actionsToRemove = m_ui->menuEntryCopyAttribute->actions();
actionsToRemove.removeOne(m_ui->actionEntryCopyTitle);
actionsToRemove.removeOne(m_ui->actionEntryCopyUsername);
actionsToRemove.removeOne(m_ui->actionEntryCopyPassword);
actionsToRemove.removeOne(m_ui->actionEntryCopyURL);
actionsToRemove.removeOne(m_ui->actionEntryCopyNotes);
Q_FOREACH (QAction* action, actionsToRemove) {
delete action;
QList<QAction*> actions = m_ui->menuEntryCopyAttribute->actions();
for (int i = EntryAttributes::DefaultAttributes.size() + 1; i < actions.size(); i++) {
delete actions[i];
}
Entry* entry = dbWidget->entryView()->currentEntry();
m_ui->menuEntryCopyAttribute->addSeparator();
Q_FOREACH (const QString& key, entry->attributes()->customKeys()) {
QAction* action = m_ui->menuEntryCopyAttribute->addAction(key);
m_copyAdditionalAttributeActions->addAction(action);

View File

@ -119,6 +119,7 @@
<addaction name="actionEntryCopyPassword"/>
<addaction name="actionEntryCopyURL"/>
<addaction name="actionEntryCopyNotes"/>
<addaction name="separator"/>
</widget>
<addaction name="actionEntryNew"/>
<addaction name="actionEntryClone"/>