forked from qt-creator/qt-creator
Move copyFilePath/Name context actions to editor manager
Synchronizing the context menus on the open documents pane and the editor tool bar. Change-Id: I29f614d483a425dec58fc1247b691fd433c4acc0 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -47,7 +47,6 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QToolButton>
|
||||
#include <QMenu>
|
||||
#include <QClipboard>
|
||||
|
||||
enum {
|
||||
debug = false
|
||||
@@ -317,24 +316,11 @@ void EditorToolBar::listContextMenu(QPoint pos)
|
||||
{
|
||||
DocumentModel::Entry *entry = DocumentModel::entryAtRow(
|
||||
d->m_editorList->currentIndex());
|
||||
QString fileName = entry ? entry->fileName() : QString();
|
||||
QString shortFileName = entry ? QFileInfo(fileName).fileName() : QString();
|
||||
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);
|
||||
QAction *result = menu.exec(d->m_editorList->mapToGlobal(pos));
|
||||
if (result == copyPath)
|
||||
QApplication::clipboard()->setText(QDir::toNativeSeparators(fileName));
|
||||
if (result == copyFileName)
|
||||
QApplication::clipboard()->setText(shortFileName);
|
||||
menu.exec(d->m_editorList->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void EditorToolBar::makeEditorWritable()
|
||||
|
||||
Reference in New Issue
Block a user