Add copy, move and index action to File tree
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user