forked from qt-creator/qt-creator
Read-only file dialog: Use VCS terms if applicable
Also add keyboard accelerators Change-Id: Icea8af6af7e5d94623ba7782c375977bbab17f22 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
6750a1c829
commit
1faea8a0b3
@@ -136,6 +136,16 @@ bool ClearCaseControl::vcsAnnotate(const QString &file, int line)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ClearCaseControl::vcsOpenText() const
|
||||||
|
{
|
||||||
|
return tr("&Check Out");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ClearCaseControl::vcsMakeWritableText() const
|
||||||
|
{
|
||||||
|
return tr("&Hijack");
|
||||||
|
}
|
||||||
|
|
||||||
void ClearCaseControl::emitRepositoryChanged(const QString &s)
|
void ClearCaseControl::emitRepositoryChanged(const QString &s)
|
||||||
{
|
{
|
||||||
emit repositoryChanged(s);
|
emit repositoryChanged(s);
|
||||||
|
@@ -70,6 +70,9 @@ public:
|
|||||||
|
|
||||||
bool vcsAnnotate(const QString &file, int line);
|
bool vcsAnnotate(const QString &file, int line);
|
||||||
|
|
||||||
|
QString vcsOpenText() const;
|
||||||
|
QString vcsMakeWritableText() const;
|
||||||
|
|
||||||
void emitRepositoryChanged(const QString &);
|
void emitRepositoryChanged(const QString &);
|
||||||
void emitFilesChanged(const QStringList &);
|
void emitFilesChanged(const QStringList &);
|
||||||
void emitConfigurationChanged();
|
void emitConfigurationChanged();
|
||||||
|
@@ -102,7 +102,8 @@ SOURCES += mainwindow.cpp \
|
|||||||
idocument.cpp \
|
idocument.cpp \
|
||||||
textdocument.cpp \
|
textdocument.cpp \
|
||||||
documentmanager.cpp \
|
documentmanager.cpp \
|
||||||
removefiledialog.cpp
|
removefiledialog.cpp \
|
||||||
|
iversioncontrol.cpp
|
||||||
|
|
||||||
HEADERS += mainwindow.h \
|
HEADERS += mainwindow.h \
|
||||||
editmode.h \
|
editmode.h \
|
||||||
|
@@ -152,6 +152,7 @@ QtcPlugin {
|
|||||||
"versiondialog.cpp",
|
"versiondialog.cpp",
|
||||||
"versiondialog.h",
|
"versiondialog.h",
|
||||||
"id.cpp",
|
"id.cpp",
|
||||||
|
"iversioncontrol.cpp",
|
||||||
"iversioncontrol.h",
|
"iversioncontrol.h",
|
||||||
"variablechooser.cpp",
|
"variablechooser.cpp",
|
||||||
"variablemanager.cpp",
|
"variablemanager.cpp",
|
||||||
|
@@ -829,15 +829,20 @@ DocumentManager::ReadOnlyAction
|
|||||||
tr("The file <i>%1</i> is read only.").arg(QDir::toNativeSeparators(fileName)),
|
tr("The file <i>%1</i> is read only.").arg(QDir::toNativeSeparators(fileName)),
|
||||||
QMessageBox::Cancel, parent);
|
QMessageBox::Cancel, parent);
|
||||||
|
|
||||||
|
QString makeWritableText;
|
||||||
QPushButton *vcsButton = 0;
|
QPushButton *vcsButton = 0;
|
||||||
if (promptVCS)
|
if (promptVCS) {
|
||||||
vcsButton = msgBox.addButton(tr("Open with VCS (%1)").arg(versionControl->displayName()), QMessageBox::AcceptRole);
|
vcsButton = msgBox.addButton(versionControl->vcsOpenText(), QMessageBox::AcceptRole);
|
||||||
|
makeWritableText = versionControl->vcsMakeWritableText();
|
||||||
|
}
|
||||||
|
if (makeWritableText.isEmpty())
|
||||||
|
makeWritableText = tr("Make &Writable");
|
||||||
|
|
||||||
QPushButton *makeWritableButton = msgBox.addButton(tr("Make Writable"), QMessageBox::AcceptRole);
|
QPushButton *makeWritableButton = msgBox.addButton(makeWritableText, QMessageBox::AcceptRole);
|
||||||
|
|
||||||
QPushButton *saveAsButton = 0;
|
QPushButton *saveAsButton = 0;
|
||||||
if (displaySaveAsButton)
|
if (displaySaveAsButton)
|
||||||
saveAsButton = msgBox.addButton(tr("Save As..."), QMessageBox::ActionRole);
|
saveAsButton = msgBox.addButton(tr("&Save As..."), QMessageBox::ActionRole);
|
||||||
|
|
||||||
msgBox.setDefaultButton(vcsButton ? vcsButton : makeWritableButton);
|
msgBox.setDefaultButton(vcsButton ? vcsButton : makeWritableButton);
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
|
45
src/plugins/coreplugin/iversioncontrol.cpp
Normal file
45
src/plugins/coreplugin/iversioncontrol.cpp
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: http://www.qt-project.org/
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
**
|
||||||
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
|
** License version 2.1 as published by the Free Software Foundation and
|
||||||
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||||
|
** Please review the following information to ensure the GNU Lesser General
|
||||||
|
** Public License version 2.1 requirements will be met:
|
||||||
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** Other Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used in accordance with the terms and
|
||||||
|
** conditions contained in a signed written agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#include "iversioncontrol.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
|
QString IVersionControl::vcsOpenText() const
|
||||||
|
{
|
||||||
|
return tr("Open with VCS (%1)").arg(displayName());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString IVersionControl::vcsMakeWritableText() const
|
||||||
|
{
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -163,6 +163,16 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual bool vcsAnnotate(const QString &file, int line) = 0;
|
virtual bool vcsAnnotate(const QString &file, int line) = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Display text for Open operation
|
||||||
|
*/
|
||||||
|
virtual QString vcsOpenText() const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Display text for Make Writable
|
||||||
|
*/
|
||||||
|
virtual QString vcsMakeWritableText() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void repositoryChanged(const QString &repository);
|
void repositoryChanged(const QString &repository);
|
||||||
void filesChanged(const QStringList &files);
|
void filesChanged(const QStringList &files);
|
||||||
|
@@ -158,6 +158,16 @@ QString PerforceVersionControl::vcsGetRepositoryURL(const QString &)
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString PerforceVersionControl::vcsOpenText() const
|
||||||
|
{
|
||||||
|
return tr("&Edit (%1)").arg(displayName());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString PerforceVersionControl::vcsMakeWritableText() const
|
||||||
|
{
|
||||||
|
return tr("&Hijack");
|
||||||
|
}
|
||||||
|
|
||||||
bool PerforceVersionControl::managesDirectory(const QString &directory, QString *topLevel) const
|
bool PerforceVersionControl::managesDirectory(const QString &directory, QString *topLevel) const
|
||||||
{
|
{
|
||||||
const bool rc = m_plugin->managesDirectory(directory, topLevel);
|
const bool rc = m_plugin->managesDirectory(directory, topLevel);
|
||||||
|
@@ -64,6 +64,8 @@ public:
|
|||||||
bool vcsRestoreSnapshot(const QString &topLevel, const QString &name);
|
bool vcsRestoreSnapshot(const QString &topLevel, const QString &name);
|
||||||
bool vcsRemoveSnapshot(const QString &topLevel, const QString &name);
|
bool vcsRemoveSnapshot(const QString &topLevel, const QString &name);
|
||||||
bool vcsAnnotate(const QString &file, int line);
|
bool vcsAnnotate(const QString &file, int line);
|
||||||
|
QString vcsOpenText() const;
|
||||||
|
QString vcsMakeWritableText() const;
|
||||||
|
|
||||||
void emitRepositoryChanged(const QString &s);
|
void emitRepositoryChanged(const QString &s);
|
||||||
void emitFilesChanged(const QStringList &l);
|
void emitFilesChanged(const QStringList &l);
|
||||||
|
Reference in New Issue
Block a user