Commit 70720756 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Use standard rename action for bin rename (with standard F2 shortcut)

parent d3b8ae9b
...@@ -1767,17 +1767,20 @@ void Bin::selectProxyModel(const QModelIndex &id) ...@@ -1767,17 +1767,20 @@ void Bin::selectProxyModel(const QModelIndex &id)
m_proxyAction->setText(i18n("Proxy Clip")); m_proxyAction->setText(i18n("Proxy Clip"));
} }
m_deleteAction->setEnabled(true); m_deleteAction->setEnabled(true);
m_renameAction->setEnabled(true);
} else { } else {
m_reloadAction->setEnabled(false); m_reloadAction->setEnabled(false);
m_locateAction->setEnabled(false); m_locateAction->setEnabled(false);
m_duplicateAction->setEnabled(false); m_duplicateAction->setEnabled(false);
m_openAction->setEnabled(false); m_openAction->setEnabled(false);
m_deleteAction->setEnabled(false); m_deleteAction->setEnabled(false);
m_renameAction->setEnabled(false);
} }
} else { } else {
// No item selected in bin // No item selected in bin
m_openAction->setEnabled(false); m_openAction->setEnabled(false);
m_deleteAction->setEnabled(false); m_deleteAction->setEnabled(false);
m_renameAction->setEnabled(false);
showClipProperties(nullptr); showClipProperties(nullptr);
emit requestClipShow(nullptr); emit requestClipShow(nullptr);
// clear effect stack // clear effect stack
...@@ -2058,7 +2061,6 @@ void Bin::contextMenuEvent(QContextMenuEvent *event) ...@@ -2058,7 +2061,6 @@ void Bin::contextMenuEvent(QContextMenuEvent *event)
m_reloadAction->setEnabled(enableClipActions); m_reloadAction->setEnabled(enableClipActions);
m_locateAction->setEnabled(enableClipActions); m_locateAction->setEnabled(enableClipActions);
m_duplicateAction->setEnabled(enableClipActions); m_duplicateAction->setEnabled(enableClipActions);
m_renameAction->setEnabled(true);
m_editAction->setVisible(!isFolder); m_editAction->setVisible(!isFolder);
m_clipsActionsMenu->setEnabled(enableClipActions); m_clipsActionsMenu->setEnabled(enableClipActions);
...@@ -2067,7 +2069,6 @@ void Bin::contextMenuEvent(QContextMenuEvent *event) ...@@ -2067,7 +2069,6 @@ void Bin::contextMenuEvent(QContextMenuEvent *event)
m_reloadAction->setVisible(itemType != AbstractProjectItem::FolderItem); m_reloadAction->setVisible(itemType != AbstractProjectItem::FolderItem);
m_duplicateAction->setVisible(itemType != AbstractProjectItem::FolderItem); m_duplicateAction->setVisible(itemType != AbstractProjectItem::FolderItem);
m_inTimelineAction->setVisible(itemType != AbstractProjectItem::FolderItem); m_inTimelineAction->setVisible(itemType != AbstractProjectItem::FolderItem);
m_renameAction->setVisible(true);
if (m_transcodeAction) { if (m_transcodeAction) {
m_transcodeAction->setEnabled(enableClipActions); m_transcodeAction->setEnabled(enableClipActions);
...@@ -2494,11 +2495,8 @@ void Bin::setupMenu() ...@@ -2494,11 +2495,8 @@ void Bin::setupMenu()
m_openAction->setEnabled(false); m_openAction->setEnabled(false);
connect(m_openAction, &QAction::triggered, this, &Bin::slotOpenClip); connect(m_openAction, &QAction::triggered, this, &Bin::slotOpenClip);
m_renameAction = m_renameAction = KStandardAction::renameFile(this, SLOT(slotRenameItem()), pCore->window()->actionCollection());
addAction(QStringLiteral("rename_clip"), i18n("Rename Clip"), QIcon::fromTheme(QStringLiteral("document-edit")));
m_renameAction->setData("rename_clip");
m_renameAction->setEnabled(false); m_renameAction->setEnabled(false);
connect(m_renameAction, &QAction::triggered, this, &Bin::slotRenameItem);
m_deleteAction = m_deleteAction =
addAction(QStringLiteral("delete_clip"), i18n("Delete Clip"), QIcon::fromTheme(QStringLiteral("edit-delete"))); addAction(QStringLiteral("delete_clip"), i18n("Delete Clip"), QIcon::fromTheme(QStringLiteral("edit-delete")));
...@@ -3548,6 +3546,9 @@ void Bin::setBinEffectsEnabled(bool enabled) ...@@ -3548,6 +3546,9 @@ void Bin::setBinEffectsEnabled(bool enabled)
void Bin::slotRenameItem() void Bin::slotRenameItem()
{ {
if (!hasFocus() && !m_itemView->hasFocus()) {
return;
}
const QModelIndexList indexes = m_proxyModel->selectionModel()->selectedRows(0); const QModelIndexList indexes = m_proxyModel->selectionModel()->selectedRows(0);
for (const QModelIndex &ix : indexes) { for (const QModelIndex &ix : indexes) {
if (!ix.isValid()) { if (!ix.isValid()) {
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="kdenlive" version="169" translationDomain="kdenlive"> <kpartgui name="kdenlive" version="170" translationDomain="kdenlive">
<MenuBar> <MenuBar>
<Menu name="file" > <Menu name="file" >
<Action name="dvd_wizard" /> <Action name="dvd_wizard" />
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
</Menu> </Menu>
<Action name="clip_properties" /> <Action name="clip_properties" />
<Action name="edit_clip" /> <Action name="edit_clip" />
<Action name="rename_clip" /> <Action name="renamefile" />
<Action name="delete_clip" /> <Action name="delete_clip" />
</Menu> </Menu>
......
  • Renaming of the labels directly with F2 would be great:
    image

Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment