diff options
author | Ken Moore <ken@ixsystems.com> | 2017-01-05 14:10:06 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-01-05 14:10:06 -0500 |
commit | aeb44640ed4adda2a7c585bc40b8db213e445473 (patch) | |
tree | 17818830945fd3376b9911de8e36bedae638b4aa | |
parent | Translated using Weblate (lumina_CONFIG@ca (generated)) (diff) | |
download | lumina-aeb44640ed4adda2a7c585bc40b8db213e445473.tar.gz lumina-aeb44640ed4adda2a7c585bc40b8db213e445473.tar.bz2 lumina-aeb44640ed4adda2a7c585bc40b8db213e445473.zip |
Fix up the context menu enable modes and rearrange the options a bit.
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp index 9b26e2e5..967e6b1a 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp @@ -477,8 +477,9 @@ void DirWidget::OpenContextMenu(){ void DirWidget::UpdateContextMenu(){ //First generate the context menu based on the selection - //qDebug() << "Update context menu"; QStringList sel = currentBrowser()->currentSelection(); + //qDebug() << "Update context menu"; + //qDebug() << " Selection:" << sel; contextMenu->clear(); if(!sel.isEmpty()){ @@ -488,15 +489,22 @@ void DirWidget::UpdateContextMenu(){ contextMenu->addSection(LXDG::findIcon("unknown",""), tr("File Operations")); // contextMenu->addMenu(cFModMenu); // cFModMenu->setEnabled(!sel.isEmpty() && canmodify); - contextMenu->addMenu(cFViewMenu); - contextMenu->setEnabled(!sel.isEmpty()); - contextMenu->addAction(LXDG::findIcon("edit-rename",""), tr("Rename..."), this, SLOT(renameFiles()), kRename->key() ); - contextMenu->addAction(LXDG::findIcon("edit-cut",""), tr("Cut Selection"), this, SLOT(cutFiles()), kCut->key() ); - contextMenu->addAction(LXDG::findIcon("edit-copy",""), tr("Copy Selection"), this, SLOT(copyFiles()), kCopy->key() ); - contextMenu->addAction(LXDG::findIcon("edit-paste",""), tr("Paste"), this, SLOT(pasteFiles()), QKeySequence(Qt::CTRL+Qt::Key_V) )->setEnabled(QApplication::clipboard()->mimeData()->hasFormat("x-special/lumina-copied-files") && canmodify); - contextMenu->addSeparator(); - contextMenu->addAction(LXDG::findIcon("edit-delete",""), tr("Delete Selection"), this, SLOT(removeFiles()), kDel->key() ); - contextMenu->addSeparator(); + + if(!sel.isEmpty()){ + contextMenu->addAction(LXDG::findIcon("edit-rename",""), tr("Rename..."), this, SLOT(renameFiles()), kRename->key() )->setEnabled(canmodify); + contextMenu->addAction(LXDG::findIcon("edit-cut",""), tr("Cut Selection"), this, SLOT(cutFiles()), kCut->key() )->setEnabled(canmodify); + contextMenu->addAction(LXDG::findIcon("edit-copy",""), tr("Copy Selection"), this, SLOT(copyFiles()), kCopy->key() )->setEnabled(canmodify); + } + if( QApplication::clipboard()->mimeData()->hasFormat("x-special/lumina-copied-files") ){ + contextMenu->addAction(LXDG::findIcon("edit-paste",""), tr("Paste"), this, SLOT(pasteFiles()), QKeySequence(Qt::CTRL+Qt::Key_V) )->setEnabled(canmodify); + } + if(!sel.isEmpty()){ + contextMenu->addSeparator(); + contextMenu->addAction(LXDG::findIcon("edit-delete",""), tr("Delete Selection"), this, SLOT(removeFiles()), kDel->key() )->setEnabled(canmodify); + contextMenu->addSeparator(); + } + contextMenu->addMenu(cFViewMenu); + cFViewMenu->setEnabled(!sel.isEmpty()); //Now add the general selection options contextMenu->addSection(LXDG::findIcon("folder","inode/directory"), tr("Directory Operations")); |