Commit f51553b2 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Core: Enable context menu for document-less editors

Change-Id: I92edf53230d34cb222dcc82391b8046e09c7599d
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 95d22fc9
......@@ -2031,9 +2031,10 @@ void EditorManager::updateMakeWritableWarning()
void EditorManager::setupSaveActions(IDocument *document, QAction *saveAction, QAction *saveAsAction, QAction *revertToSavedAction)
{
saveAction->setEnabled(document != 0 && document->isModified());
const bool hasFile = document != 0 && !document->filePath().isEmpty();
saveAction->setEnabled(hasFile && document->isModified());
saveAsAction->setEnabled(document != 0 && document->isSaveAsAllowed());
revertToSavedAction->setEnabled(document != 0 && !document->filePath().isEmpty());
revertToSavedAction->setEnabled(hasFile);
const QString documentName = document ? document->displayName() : QString();
QString quotedName;
......
......@@ -317,12 +317,14 @@ void EditorToolBar::listContextMenu(QPoint pos)
d->m_editorList->currentIndex());
QString fileName = entry ? entry->fileName() : QString();
QString shortFileName = entry ? QFileInfo(fileName).fileName() : QString();
if (fileName.isEmpty() || shortFileName.isEmpty())
return;
QMenu menu;
QAction *copyPath = menu.addAction(tr("Copy Full Path to Clipboard"));
QAction *copyFileName = menu.addAction(tr("Copy File Name to Clipboard"));
menu.addSeparator();
if (fileName.isEmpty() || shortFileName.isEmpty()) {
copyPath->setEnabled(false);
copyFileName->setEnabled(false);
}
EditorManager::addSaveAndCloseEditorActions(&menu, entry);
menu.addSeparator();
EditorManager::addNativeDirAndOpenWithActions(&menu, entry);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment