forked from qt-creator/qt-creator
Core: Enable context menu for document-less editors
Change-Id: I92edf53230d34cb222dcc82391b8046e09c7599d Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
95d22fc972
commit
f51553b228
@@ -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);
|
||||
|
Reference in New Issue
Block a user