mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
[FoldersPanel] Don't show 'Limit to Home Directory' in the view context menu
The `viewContextMenuRequested` signal is emitted without a valid KFileItem, so `m_fileItem` will always be null in `TreeViewContextMenu::open()`.
This commit is contained in:
parent
b7e84ed42f
commit
3c9efb362a
|
@ -123,15 +123,17 @@ void TreeViewContextMenu::open()
|
|||
popup->addAction(showHiddenFilesAction);
|
||||
connect(showHiddenFilesAction, &QAction::toggled, this, &TreeViewContextMenu::setShowHiddenFiles);
|
||||
|
||||
// insert 'Limit to Home Directory'
|
||||
const QUrl url = m_fileItem.url();
|
||||
const bool enableLimitToHomeDirectory = url.isLocalFile();
|
||||
QAction* limitFoldersPanelToHomeAction = new QAction(i18nc("@action:inmenu", "Limit to Home Directory"), this);
|
||||
limitFoldersPanelToHomeAction->setCheckable(true);
|
||||
limitFoldersPanelToHomeAction->setEnabled(enableLimitToHomeDirectory);
|
||||
limitFoldersPanelToHomeAction->setChecked(m_parent->limitFoldersPanelToHome());
|
||||
popup->addAction(limitFoldersPanelToHomeAction);
|
||||
connect(limitFoldersPanelToHomeAction, &QAction::toggled, this, &TreeViewContextMenu::setLimitFoldersPanelToHome);
|
||||
if (!m_fileItem.isNull()) {
|
||||
// insert 'Limit to Home Directory'
|
||||
const QUrl url = m_fileItem.url();
|
||||
const bool enableLimitToHomeDirectory = url.isLocalFile();
|
||||
QAction* limitFoldersPanelToHomeAction = new QAction(i18nc("@action:inmenu", "Limit to Home Directory"), this);
|
||||
limitFoldersPanelToHomeAction->setCheckable(true);
|
||||
limitFoldersPanelToHomeAction->setEnabled(enableLimitToHomeDirectory);
|
||||
limitFoldersPanelToHomeAction->setChecked(m_parent->limitFoldersPanelToHome());
|
||||
popup->addAction(limitFoldersPanelToHomeAction);
|
||||
connect(limitFoldersPanelToHomeAction, &QAction::toggled, this, &TreeViewContextMenu::setLimitFoldersPanelToHome);
|
||||
}
|
||||
|
||||
// insert 'Automatic Scrolling'
|
||||
QAction* autoScrollingAction = new QAction(i18nc("@action:inmenu", "Automatic Scrolling"), this);
|
||||
|
|
Loading…
Reference in a new issue