aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <[email protected]>2015-12-06 09:41:40 +0100
committerJean-Baptiste Mardelle <[email protected]>2015-12-06 09:41:40 +0100
commitf6137eab6e900bddcfcaa33f33c34f51fffa2136 (patch)
treec037c91c28d0672f8e43b4a83b8c782857c9cc1c
parent0fa521cefb9aab9e3526d2941426441746604c58 (diff)
Add context menu option to rename a bin folder
-rw-r--r--src/bin/bin.cpp23
-rw-r--r--src/bin/bin.h3
2 files changed, 26 insertions, 0 deletions
diff --git a/src/bin/bin.cpp b/src/bin/bin.cpp
index 6454100..834ee85 100644
--- a/src/bin/bin.cpp
+++ b/src/bin/bin.cpp
@@ -358,6 +358,11 @@ Bin::Bin(QWidget* parent) :
disableEffects->setChecked(false);
pCore->window()->actionCollection()->addAction("disable_bin_effects", disableEffects);
+ m_renameFolderAction = new QAction(i18n("Rename Folder"), this);
+ connect(m_renameFolderAction, SIGNAL(triggered(bool)), this, SLOT(slotRenameFolder()));
+ m_renameFolderAction->setData("rename_folder");
+ pCore->window()->actionCollection()->addAction("rename_folder", m_renameFolderAction);
+
listType->setToolBarMode(KSelectAction::MenuMode);
connect(listType, SIGNAL(triggered(QAction*)), this, SLOT(slotInitView(QAction*)));
@@ -1354,6 +1359,7 @@ void Bin::contextMenuEvent(QContextMenuEvent *event)
m_duplicateAction->setEnabled(enableClipActions);
m_clipsActionsMenu->setEnabled(enableClipActions);
m_extractAudioAction->setEnabled(enableClipActions);
+ m_renameFolderAction->setVisible(isFolder);
m_openAction->setVisible(!isFolder);
m_reloadAction->setVisible(!isFolder);
m_duplicateAction->setVisible(!isFolder);
@@ -1740,6 +1746,7 @@ void Bin::setupGeneratorMenu()
}
m_menu->addAction(m_editAction);
m_menu->addAction(m_openAction);
+ m_menu->addAction(m_renameFolderAction);
m_menu->addAction(m_deleteAction);
m_menu->insertSeparator(m_deleteAction);
}
@@ -2879,3 +2886,19 @@ void Bin::setBinEffectsDisabledStatus(bool disabled)
}
pCore->projectManager()->disableBinEffects(disabled);
}
+
+void Bin::slotRenameFolder()
+{
+ QModelIndexList indexes = m_proxyModel->selectionModel()->selectedIndexes();
+ foreach (const QModelIndex &ix, indexes) {
+ if (!ix.isValid() || ix.column() != 0) {
+ continue;
+ }
+ AbstractProjectItem *item = static_cast<AbstractProjectItem*>(m_proxyModel->mapToSource(ix).internalPointer());
+ ProjectFolder *currentItem = qobject_cast<ProjectFolder*>(item);
+ if (currentItem) {
+ m_itemView->edit(ix);
+ return;
+ }
+ }
+}
diff --git a/src/bin/bin.h b/src/bin/bin.h
index 67ad0d4..2df08b1 100644
--- a/src/bin/bin.h
+++ b/src/bin/bin.h
@@ -503,6 +503,8 @@ private slots:
void slotGotFocus();
/** @brief Dis/Enable all bin effects. */
void slotDisableEffects(bool disable);
+ /** @brief Rename a Bin Folder. */
+ void slotRenameFolder();
public slots:
void slotThumbnailReady(const QString &id, const QImage &img, bool fromFile = false);
@@ -604,6 +606,7 @@ private:
QAction *m_proxyAction;
QAction *m_editAction;
QAction *m_deleteAction;
+ QAction *m_renameFolderAction;
QMenu *m_jobsMenu;
QAction *m_cancelJobs;
QAction *m_discardCurrentClipJobs;