diff options
Diffstat (limited to 'src/plugins')
35 files changed, 36 insertions, 238 deletions
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.cpp b/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.cpp index 48ca34ad14..f528f7438f 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.cpp @@ -80,11 +80,6 @@ bool AutotoolsProjectFile::isModified() const return false; } -bool AutotoolsProjectFile::isReadOnly() const -{ - return true; -} - bool AutotoolsProjectFile::isSaveAsAllowed() const { return false; diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.h b/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.h index 4bc6c1bb6a..9f7750a11c 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.h +++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.h @@ -65,7 +65,6 @@ public: QString suggestedFileName() const; QString mimeType() const; bool isModified() const; - bool isReadOnly() const; bool isSaveAsAllowed() const; bool reload(QString *errorString, ReloadFlag flag, ChangeType type); void rename(const QString &newName); diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp index 1625af74b6..b646a0da99 100644 --- a/src/plugins/bineditor/bineditorplugin.cpp +++ b/src/plugins/bineditor/bineditorplugin.cpp @@ -297,7 +297,7 @@ public: bool isModified() const { return m_editor->isMemoryView() ? false : m_editor->isModified(); } bool isReadOnly() const { - if (m_editor->isMemoryView()) + if (m_editor->isMemoryView() || m_fileName.isEmpty()) return false; const QFileInfo fi(m_fileName); return !fi.isWritable(); diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index f7ba1e5073..202a6dd174 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -780,11 +780,6 @@ bool CMakeFile::isModified() const return false; } -bool CMakeFile::isReadOnly() const -{ - return true; -} - bool CMakeFile::isSaveAsAllowed() const { return false; diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.h b/src/plugins/cmakeprojectmanager/cmakeproject.h index bad6d3c2d0..1fe60a1c1d 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.h +++ b/src/plugins/cmakeprojectmanager/cmakeproject.h @@ -207,7 +207,6 @@ public: QString mimeType() const; bool isModified() const; - bool isReadOnly() const; bool isSaveAsAllowed() const; ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; diff --git a/src/plugins/coreplugin/editormanager/openeditorsmodel.cpp b/src/plugins/coreplugin/editormanager/openeditorsmodel.cpp index 496fbe801c..cdd6f36c91 100644 --- a/src/plugins/coreplugin/editormanager/openeditorsmodel.cpp +++ b/src/plugins/coreplugin/editormanager/openeditorsmodel.cpp @@ -311,12 +311,15 @@ QVariant OpenEditorsModel::data(const QModelIndex &index, int role) const : e.displayName(); case Qt::DecorationRole: { - bool readOnly = false; - if (e.editor) - readOnly = e.editor->file()->isReadOnly(); - else - readOnly = !QFileInfo(e.m_fileName).isWritable(); - return readOnly ? d->m_lockedIcon : QIcon(); + bool showLock = false; + if (e.editor) { + showLock = e.editor->file()->fileName().isEmpty() + ? false + : e.editor->file()->isReadOnly(); + } else { + showLock = !QFileInfo(e.m_fileName).isWritable(); + } + return showLock ? d->m_lockedIcon : QIcon(); } case Qt::ToolTipRole: return e.fileName().isEmpty() diff --git a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp index bd71b76c67..d5074e440c 100644 --- a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp +++ b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp @@ -213,7 +213,8 @@ void OpenEditorsWindow::setEditors(EditorView *mainView, EditorView *view, OpenE QTreeWidgetItem *item = new QTreeWidgetItem(); if (hi.file->isModified()) title += tr("*"); - item->setIcon(0, hi.file->isReadOnly() ? model->lockedIcon() : m_emptyIcon); + item->setIcon(0, !hi.file->fileName().isEmpty() && hi.file->isReadOnly() + ? model->lockedIcon() : m_emptyIcon); item->setText(0, title); item->setToolTip(0, hi.file->fileName()); item->setData(0, Qt::UserRole, QVariant::fromValue(hi.file.data())); @@ -240,7 +241,8 @@ void OpenEditorsWindow::setEditors(EditorView *mainView, EditorView *view, OpenE QString title = model->displayNameForFile(hi.file); if (hi.file->isModified()) title += tr("*"); - item->setIcon(0, hi.file->isReadOnly() ? model->lockedIcon() : m_emptyIcon); + item->setIcon(0, !hi.file->fileName().isEmpty() && hi.file->isReadOnly() + ? model->lockedIcon() : m_emptyIcon); item->setText(0, title); item->setToolTip(0, hi.file->fileName()); item->setData(0, Qt::UserRole, QVariant::fromValue(hi.file.data())); diff --git a/src/plugins/coreplugin/editortoolbar.cpp b/src/plugins/coreplugin/editortoolbar.cpp index 9c77a61305..66fc23b3d2 100644 --- a/src/plugins/coreplugin/editortoolbar.cpp +++ b/src/plugins/coreplugin/editortoolbar.cpp @@ -400,9 +400,13 @@ void EditorToolBar::updateEditorStatus(IEditor *editor) d->m_editorList->setCurrentIndex(d->m_editorsListModel->indexOf(editor).row()); - if (editor->file()->isReadOnly()) { + if (editor->file()->fileName().isEmpty()) { + d->m_lockButton->setIcon(QIcon()); + d->m_lockButton->setEnabled(false); + d->m_lockButton->setToolTip(QString()); + } else if (editor->file()->isReadOnly()) { d->m_lockButton->setIcon(QIcon(d->m_editorsListModel->lockedIcon())); - d->m_lockButton->setEnabled(!editor->file()->fileName().isEmpty()); + d->m_lockButton->setEnabled(true); d->m_lockButton->setToolTip(tr("Make Writable")); } else { d->m_lockButton->setIcon(QIcon(d->m_editorsListModel->unlockedIcon())); diff --git a/src/plugins/coreplugin/filemanager.cpp b/src/plugins/coreplugin/filemanager.cpp index 982d0c4d3c..0979184298 100644 --- a/src/plugins/coreplugin/filemanager.cpp +++ b/src/plugins/coreplugin/filemanager.cpp @@ -607,10 +607,10 @@ static QList<IFile *> saveModifiedFilesHelper(const QList<IFile *> &files, if (name.isEmpty()) name = file->suggestedFileName(); - // There can be several FileInterfaces pointing to the same file - // Select one that is not readonly. - if (!(modifiedFilesMap.key(name, 0) - && file->isReadOnly())) + // There can be several IFiles pointing to the same file + // Prefer one that is not readonly + // (even though it *should* not happen that the IFiles are inconsistent with readonly) + if (!modifiedFilesMap.key(name, 0) || !file->isReadOnly()) modifiedFilesMap.insert(file, name); } } diff --git a/src/plugins/coreplugin/ifile.cpp b/src/plugins/coreplugin/ifile.cpp index 1badff4648..f88d0c60fd 100644 --- a/src/plugins/coreplugin/ifile.cpp +++ b/src/plugins/coreplugin/ifile.cpp @@ -35,6 +35,7 @@ #include "infobar.h" #include <QtCore/QFile> +#include <QtCore/QFileInfo> namespace Core { @@ -66,6 +67,13 @@ bool IFile::shouldAutoSave() const return false; } +bool IFile::isReadOnly() const +{ + if (fileName().isEmpty()) + return false; + return !QFileInfo(fileName()).isWritable(); +} + bool IFile::autoSave(QString *errorString, const QString &fileName) { if (!save(errorString, fileName, true)) diff --git a/src/plugins/coreplugin/ifile.h b/src/plugins/coreplugin/ifile.h index 0d62419694..58baf35f59 100644 --- a/src/plugins/coreplugin/ifile.h +++ b/src/plugins/coreplugin/ifile.h @@ -93,7 +93,7 @@ public: virtual bool shouldAutoSave() const; virtual bool isModified() const = 0; - virtual bool isReadOnly() const = 0; + virtual bool isReadOnly() const; virtual bool isSaveAsAllowed() const = 0; virtual ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; diff --git a/src/plugins/designer/formwindowfile.cpp b/src/plugins/designer/formwindowfile.cpp index 6488438c25..3defd2c1a6 100644 --- a/src/plugins/designer/formwindowfile.cpp +++ b/src/plugins/designer/formwindowfile.cpp @@ -137,14 +137,6 @@ bool FormWindowFile::isModified() const return m_formWindow && m_formWindow->isDirty(); } -bool FormWindowFile::isReadOnly() const -{ - if (m_fileName.isEmpty()) - return false; - const QFileInfo fi(m_fileName); - return !fi.isWritable(); -} - bool FormWindowFile::isSaveAsAllowed() const { return true; diff --git a/src/plugins/designer/formwindowfile.h b/src/plugins/designer/formwindowfile.h index a85d8c5b4f..eb58152884 100644 --- a/src/plugins/designer/formwindowfile.h +++ b/src/plugins/designer/formwindowfile.h @@ -57,7 +57,6 @@ public: virtual QString fileName() const; virtual bool shouldAutoSave() const; virtual bool isModified() const; - virtual bool isReadOnly() const; virtual bool isSaveAsAllowed() const; bool reload(QString *errorString, ReloadFlag flag, ChangeType type); virtual QString defaultPath() const; diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp index 0572678409..2d0b53a5c4 100644 --- a/src/plugins/genericprojectmanager/genericproject.cpp +++ b/src/plugins/genericprojectmanager/genericproject.cpp @@ -639,11 +639,6 @@ bool GenericProjectFile::isModified() const return false; } -bool GenericProjectFile::isReadOnly() const -{ - return true; -} - bool GenericProjectFile::isSaveAsAllowed() const { return false; diff --git a/src/plugins/genericprojectmanager/genericproject.h b/src/plugins/genericprojectmanager/genericproject.h index 80df0d566a..6e845f02e8 100644 --- a/src/plugins/genericprojectmanager/genericproject.h +++ b/src/plugins/genericprojectmanager/genericproject.h @@ -172,7 +172,6 @@ public: virtual QString mimeType() const; virtual bool isModified() const; - virtual bool isReadOnly() const; virtual bool isSaveAsAllowed() const; virtual void rename(const QString &newName); diff --git a/src/plugins/imageviewer/imageviewerfile.cpp b/src/plugins/imageviewer/imageviewerfile.cpp index b55a654842..03cbc2e3f8 100644 --- a/src/plugins/imageviewer/imageviewerfile.cpp +++ b/src/plugins/imageviewer/imageviewerfile.cpp @@ -116,11 +116,6 @@ bool ImageViewerFile::isModified() const return false; } -bool ImageViewerFile::isReadOnly() const -{ - return true; -} - bool ImageViewerFile::isSaveAsAllowed() const { return false; diff --git a/src/plugins/imageviewer/imageviewerfile.h b/src/plugins/imageviewer/imageviewerfile.h index fa4f08905d..631e2bec86 100644 --- a/src/plugins/imageviewer/imageviewerfile.h +++ b/src/plugins/imageviewer/imageviewerfile.h @@ -59,7 +59,6 @@ public: QString mimeType() const; bool isModified() const; - bool isReadOnly() const; bool isSaveAsAllowed() const; bool reload(QString *errorString, ReloadFlag flag, ChangeType type); diff --git a/src/plugins/madde/maemoglobal.h b/src/plugins/madde/maemoglobal.h index b46c2eb515..5835e3f1bc 100644 --- a/src/plugins/madde/maemoglobal.h +++ b/src/plugins/madde/maemoglobal.h @@ -69,7 +69,6 @@ public: QString suggestedFileName() const { return QString(); } QString mimeType() const { return QLatin1String("text/plain"); } bool isModified() const { return false; } - bool isReadOnly() const { return false; } bool isSaveAsAllowed() const { return false; } ReloadBehavior reloadBehavior(ChangeTrigger, ChangeType) const { return BehaviorSilent; } bool reload(QString *, ReloadFlag, ChangeType) { emit modified(); return true; } diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 717a919465..cc6493560b 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1078,16 +1078,8 @@ void ProjectExplorerPlugin::unloadProject() QList<Core::IFile*> filesToSave; filesToSave << fi; - - // check the number of modified files - int readonlycount = 0; - foreach (const Core::IFile *file, filesToSave) { - if (file->isReadOnly()) - ++readonlycount; - } - bool success = false; - if (readonlycount > 0) + if (fi->isReadOnly()) success = Core::FileManager::saveModifiedFiles(filesToSave).isEmpty(); else success = Core::FileManager::saveModifiedFilesSilently(filesToSave).isEmpty(); diff --git a/src/plugins/qmlprojectmanager/qmlprojectfile.cpp b/src/plugins/qmlprojectmanager/qmlprojectfile.cpp index d7aba905f8..af3ca30f86 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectfile.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectfile.cpp @@ -88,11 +88,6 @@ bool QmlProjectFile::isModified() const return false; } -bool QmlProjectFile::isReadOnly() const -{ - return true; -} - bool QmlProjectFile::isSaveAsAllowed() const { return false; diff --git a/src/plugins/qmlprojectmanager/qmlprojectfile.h b/src/plugins/qmlprojectmanager/qmlprojectfile.h index 4e143edd16..deb117d9f0 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectfile.h +++ b/src/plugins/qmlprojectmanager/qmlprojectfile.h @@ -58,7 +58,6 @@ public: virtual QString mimeType() const; virtual bool isModified() const; - virtual bool isReadOnly() const; virtual bool isSaveAsAllowed() const; ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index e20653d798..ae95dffcce 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -211,11 +211,6 @@ bool Qt4PriFile::isModified() const return false; } -bool Qt4PriFile::isReadOnly() const -{ - return false; -} - bool Qt4PriFile::isSaveAsAllowed() const { return false; diff --git a/src/plugins/qt4projectmanager/qt4nodes.h b/src/plugins/qt4projectmanager/qt4nodes.h index eeeb52c8f9..cb25e4e13c 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.h +++ b/src/plugins/qt4projectmanager/qt4nodes.h @@ -230,7 +230,6 @@ public: virtual QString mimeType() const; virtual bool isModified() const; - virtual bool isReadOnly() const; virtual bool isSaveAsAllowed() const; ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index 298a44bb35..29d4fc2088 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -97,7 +97,6 @@ public: virtual QString mimeType() const; bool isModified() const; - bool isReadOnly() const; bool isSaveAsAllowed() const; ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; @@ -283,12 +282,6 @@ bool Qt4ProjectFile::isModified() const return false; // we save after changing anyway } -bool Qt4ProjectFile::isReadOnly() const -{ - QFileInfo fi(m_filePath); - return !fi.isWritable(); -} - bool Qt4ProjectFile::isSaveAsAllowed() const { return false; diff --git a/src/plugins/resourceeditor/resourceeditorw.cpp b/src/plugins/resourceeditor/resourceeditorw.cpp index 4dd9ea34c0..97d02941f8 100644 --- a/src/plugins/resourceeditor/resourceeditorw.cpp +++ b/src/plugins/resourceeditor/resourceeditorw.cpp @@ -218,15 +218,6 @@ bool ResourceEditorFile::isModified() const return m_parent->m_resourceEditor->isDirty(); } -bool ResourceEditorFile::isReadOnly() const -{ - const QString fileName = m_parent->m_resourceEditor->fileName(); - if (fileName.isEmpty()) - return false; - const QFileInfo fi(fileName); - return !fi.isWritable(); -} - bool ResourceEditorFile::isSaveAsAllowed() const { return true; diff --git a/src/plugins/resourceeditor/resourceeditorw.h b/src/plugins/resourceeditor/resourceeditorw.h index ac2cd0a589..d84060c062 100644 --- a/src/plugins/resourceeditor/resourceeditorw.h +++ b/src/plugins/resourceeditor/resourceeditorw.h @@ -65,7 +65,6 @@ public: QString fileName() const; bool shouldAutoSave() const; bool isModified() const; - bool isReadOnly() const; bool isSaveAsAllowed() const; bool reload(QString *errorString, ReloadFlag flag, ChangeType type); QString defaultPath() const; diff --git a/src/plugins/tasklist/taskfile.cpp b/src/plugins/tasklist/taskfile.cpp index b0d3edb481..186dd5f9bd 100644 --- a/src/plugins/tasklist/taskfile.cpp +++ b/src/plugins/tasklist/taskfile.cpp @@ -81,11 +81,6 @@ bool TaskFile::isModified() const return false; } -bool TaskFile::isReadOnly() const -{ - return true; -} - bool TaskFile::isSaveAsAllowed() const { return false; diff --git a/src/plugins/tasklist/taskfile.h b/src/plugins/tasklist/taskfile.h index a4dcdf5aa2..135e9e4bb1 100644 --- a/src/plugins/tasklist/taskfile.h +++ b/src/plugins/tasklist/taskfile.h @@ -56,7 +56,6 @@ public: QString mimeType() const; bool isModified() const; - bool isReadOnly() const; bool isSaveAsAllowed() const; ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp index 374f721472..4f6f4c1c7d 100644 --- a/src/plugins/texteditor/basetextdocument.cpp +++ b/src/plugins/texteditor/basetextdocument.cpp @@ -411,8 +411,6 @@ void BaseTextDocument::rename(const QString &newName) bool BaseTextDocument::isReadOnly() const { - if (hasDecodingError()) - return true; if (d->m_fileName.isEmpty()) //have no corresponding file, so editing is ok return false; return d->m_fileIsReadOnly; diff --git a/src/plugins/vcsbase/submiteditorfile.h b/src/plugins/vcsbase/submiteditorfile.h index 4a64b33c95..6dd5ae35b4 100644 --- a/src/plugins/vcsbase/submiteditorfile.h +++ b/src/plugins/vcsbase/submiteditorfile.h @@ -51,7 +51,6 @@ public: bool isModified() const { return m_modified; } QString mimeType() const; - bool isReadOnly() const { return false; } bool isSaveAsAllowed() const { return false; } bool save(QString *errorString, const QString &fileName, bool autoSave); ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; diff --git a/src/plugins/vcsbase/vcsbase.pro b/src/plugins/vcsbase/vcsbase.pro index e3446c627b..5c377dc70e 100644 --- a/src/plugins/vcsbase/vcsbase.pro +++ b/src/plugins/vcsbase/vcsbase.pro @@ -11,7 +11,6 @@ HEADERS += vcsbase_global.h \ vcsbaseplugin.h \ baseannotationhighlighter.h \ diffhighlighter.h \ - vcsbasetextdocument.h \ vcsbaseeditor.h \ vcsbasesubmiteditor.h \ basevcseditorfactory.h \ @@ -40,7 +39,6 @@ SOURCES += vcsplugin.cpp \ corelistener.cpp \ baseannotationhighlighter.cpp \ diffhighlighter.cpp \ - vcsbasetextdocument.cpp \ vcsbaseeditor.cpp \ vcsbasesubmiteditor.cpp \ basevcseditorfactory.cpp \ diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index b669e5ee9e..c3e688406d 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -33,7 +33,6 @@ #include "vcsbaseeditor.h" #include "diffhighlighter.h" #include "baseannotationhighlighter.h" -#include "vcsbasetextdocument.h" #include "vcsbaseconstants.h" #include "vcsbaseoutputwindow.h" #include "vcsbaseplugin.h" @@ -50,6 +49,7 @@ #include <projectexplorer/projectexplorer.h> #include <projectexplorer/project.h> #include <projectexplorer/session.h> +#include <texteditor/basetextdocument.h> #include <texteditor/basetextdocumentlayout.h> #include <texteditor/fontsettings.h> #include <texteditor/texteditorconstants.h> @@ -663,7 +663,6 @@ VcsBaseEditorWidget::VcsBaseEditorWidget(const VcsBaseEditorParameters *type, QW d(new Internal::VcsBaseEditorWidgetPrivate(this, type)) { viewport()->setMouseTracking(true); - setBaseTextDocument(new Internal::VcsBaseTextDocument); setMimeType(QLatin1String(d->m_parameters->mimeType)); } @@ -696,21 +695,12 @@ VcsBaseEditorWidget::~VcsBaseEditorWidget() void VcsBaseEditorWidget::setForceReadOnly(bool b) { - Internal::VcsBaseTextDocument *vbd = qobject_cast<Internal::VcsBaseTextDocument*>(baseTextDocument()); VcsBaseEditor *eda = qobject_cast<VcsBaseEditor *>(editor()); - QTC_ASSERT(vbd != 0 && eda != 0, return); + QTC_ASSERT(eda != 0, return); setReadOnly(b); - vbd->setForceReadOnly(b); eda->setTemporary(b); } -bool VcsBaseEditorWidget::isForceReadOnly() const -{ - const Internal::VcsBaseTextDocument *vbd = qobject_cast<const Internal::VcsBaseTextDocument*>(baseTextDocument()); - QTC_ASSERT(vbd, return false); - return vbd->isForceReadOnly(); -} - QString VcsBaseEditorWidget::source() const { return d->m_source; diff --git a/src/plugins/vcsbase/vcsbaseeditor.h b/src/plugins/vcsbase/vcsbaseeditor.h index 5148f95fd4..b945b790fb 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.h +++ b/src/plugins/vcsbase/vcsbaseeditor.h @@ -113,7 +113,6 @@ public: * by default since it should not trigger when patches are opened as * files. */ void setForceReadOnly(bool b); - bool isForceReadOnly() const; QString source() const; void setSource(const QString &source); diff --git a/src/plugins/vcsbase/vcsbasetextdocument.cpp b/src/plugins/vcsbase/vcsbasetextdocument.cpp deleted file mode 100644 index 59de134884..0000000000 --- a/src/plugins/vcsbase/vcsbasetextdocument.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "vcsbasetextdocument.h" - -using namespace VcsBase::Internal; - -VcsBaseTextDocument::VcsBaseTextDocument() : - m_forceReadOnly(false) -{ -} - -bool VcsBaseTextDocument::isReadOnly() const -{ - return m_forceReadOnly ? - true : - TextEditor::BaseTextDocument::isReadOnly(); -} - -bool VcsBaseTextDocument::isModified() const -{ - return m_forceReadOnly ? - false : - TextEditor::BaseTextDocument::isModified(); -} - -void VcsBaseTextDocument::setForceReadOnly(bool b) -{ - m_forceReadOnly = b; -} - -bool VcsBaseTextDocument::isForceReadOnly() const -{ - return m_forceReadOnly; -} diff --git a/src/plugins/vcsbase/vcsbasetextdocument.h b/src/plugins/vcsbase/vcsbasetextdocument.h deleted file mode 100644 index 7b27fb052d..0000000000 --- a/src/plugins/vcsbase/vcsbasetextdocument.h +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef VCSBASETEXTDOCUMENT_H -#define VCSBASETEXTDOCUMENT_H - -#include <texteditor/basetextdocument.h> - -namespace VcsBase { -namespace Internal { - -// A read-only text document. -class VcsBaseTextDocument : public TextEditor::BaseTextDocument -{ - Q_OBJECT - -public: - VcsBaseTextDocument(); - - bool isReadOnly() const; - bool isModified() const; - - void setForceReadOnly(bool b); - bool isForceReadOnly() const; - -private: - bool m_forceReadOnly; -}; - -} // namespace Internal -} // namespace VcsBase - -#endif // VCSBASETEXTDOCUMENT_H |