Add copy, move and index action to File tree

This commit is contained in:
2022-05-09 18:14:10 +02:00
parent c971a919ec
commit b84d8127ad
4 changed files with 41 additions and 1 deletions
+22
View File
@@ -66,12 +66,22 @@ void Filetree::contextMenuEvent(QContextMenuEvent *event)
QMenu menu;
QAction *open = nullptr;
QAction *setRoot = nullptr;
QAction *copy = nullptr;
QAction *move = nullptr;
QAction *indexDir = nullptr;
if(info.isFile())
open = menu.addAction(tr("Open"));
if(info.isDir())
{
open = menu.addAction(tr("Open"));
setRoot = menu.addAction("Set as root");
copy = menu.addAction(tr("Copy marked files"));
move = menu.addAction(tr("Move marked files"));
indexDir = menu.addAction(tr("Index directory"));
}
menu.addSeparator();
QAction *resetRoot = menu.addAction("Reset root");
QAction *goUp = menu.addAction("Go up");
@@ -96,4 +106,16 @@ void Filetree::contextMenuEvent(QContextMenuEvent *event)
setRootIndex(rootIndex().parent());
m_rootDir = m_fileSystemModel->filePath(rootIndex().parent());
}
else if(a == copy)
{
emit copyFiles(m_fileSystemModel->filePath(index));
}
else if(a == move)
{
emit moveFiles(m_fileSystemModel->filePath(index));
}
else if(a == indexDir)
{
emit indexDirectory(m_fileSystemModel->filePath(index));
}
}