Make IFile::isReadOnly consistent.

It is supposed to refer to the property of the file on disk (if there is
any).

Task-number: QTCREATORBUG-4998
Change-Id: Iaed62c17d124b364aecec4d1f910046bade42d40
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
Eike Ziller
2012-02-14 12:10:29 +01:00
parent d7b0ceac8a
commit f916d38dce
35 changed files with 36 additions and 238 deletions

View File

@@ -80,11 +80,6 @@ bool AutotoolsProjectFile::isModified() const
return false; return false;
} }
bool AutotoolsProjectFile::isReadOnly() const
{
return true;
}
bool AutotoolsProjectFile::isSaveAsAllowed() const bool AutotoolsProjectFile::isSaveAsAllowed() const
{ {
return false; return false;

View File

@@ -65,7 +65,6 @@ public:
QString suggestedFileName() const; QString suggestedFileName() const;
QString mimeType() const; QString mimeType() const;
bool isModified() const; bool isModified() const;
bool isReadOnly() const;
bool isSaveAsAllowed() const; bool isSaveAsAllowed() const;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type); bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
void rename(const QString &newName); void rename(const QString &newName);

View File

@@ -297,7 +297,7 @@ public:
bool isModified() const { return m_editor->isMemoryView() ? false : m_editor->isModified(); } bool isModified() const { return m_editor->isMemoryView() ? false : m_editor->isModified(); }
bool isReadOnly() const { bool isReadOnly() const {
if (m_editor->isMemoryView()) if (m_editor->isMemoryView() || m_fileName.isEmpty())
return false; return false;
const QFileInfo fi(m_fileName); const QFileInfo fi(m_fileName);
return !fi.isWritable(); return !fi.isWritable();

View File

@@ -780,11 +780,6 @@ bool CMakeFile::isModified() const
return false; return false;
} }
bool CMakeFile::isReadOnly() const
{
return true;
}
bool CMakeFile::isSaveAsAllowed() const bool CMakeFile::isSaveAsAllowed() const
{ {
return false; return false;

View File

@@ -207,7 +207,6 @@ public:
QString mimeType() const; QString mimeType() const;
bool isModified() const; bool isModified() const;
bool isReadOnly() const;
bool isSaveAsAllowed() const; bool isSaveAsAllowed() const;
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;

View File

@@ -311,12 +311,15 @@ QVariant OpenEditorsModel::data(const QModelIndex &index, int role) const
: e.displayName(); : e.displayName();
case Qt::DecorationRole: case Qt::DecorationRole:
{ {
bool readOnly = false; bool showLock = false;
if (e.editor) if (e.editor) {
readOnly = e.editor->file()->isReadOnly(); showLock = e.editor->file()->fileName().isEmpty()
else ? false
readOnly = !QFileInfo(e.m_fileName).isWritable(); : e.editor->file()->isReadOnly();
return readOnly ? d->m_lockedIcon : QIcon(); } else {
showLock = !QFileInfo(e.m_fileName).isWritable();
}
return showLock ? d->m_lockedIcon : QIcon();
} }
case Qt::ToolTipRole: case Qt::ToolTipRole:
return e.fileName().isEmpty() return e.fileName().isEmpty()

View File

@@ -213,7 +213,8 @@ void OpenEditorsWindow::setEditors(EditorView *mainView, EditorView *view, OpenE
QTreeWidgetItem *item = new QTreeWidgetItem(); QTreeWidgetItem *item = new QTreeWidgetItem();
if (hi.file->isModified()) if (hi.file->isModified())
title += tr("*"); 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->setText(0, title);
item->setToolTip(0, hi.file->fileName()); item->setToolTip(0, hi.file->fileName());
item->setData(0, Qt::UserRole, QVariant::fromValue(hi.file.data())); 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); QString title = model->displayNameForFile(hi.file);
if (hi.file->isModified()) if (hi.file->isModified())
title += tr("*"); 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->setText(0, title);
item->setToolTip(0, hi.file->fileName()); item->setToolTip(0, hi.file->fileName());
item->setData(0, Qt::UserRole, QVariant::fromValue(hi.file.data())); item->setData(0, Qt::UserRole, QVariant::fromValue(hi.file.data()));

View File

@@ -400,9 +400,13 @@ void EditorToolBar::updateEditorStatus(IEditor *editor)
d->m_editorList->setCurrentIndex(d->m_editorsListModel->indexOf(editor).row()); 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->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")); d->m_lockButton->setToolTip(tr("Make Writable"));
} else { } else {
d->m_lockButton->setIcon(QIcon(d->m_editorsListModel->unlockedIcon())); d->m_lockButton->setIcon(QIcon(d->m_editorsListModel->unlockedIcon()));

View File

@@ -607,10 +607,10 @@ static QList<IFile *> saveModifiedFilesHelper(const QList<IFile *> &files,
if (name.isEmpty()) if (name.isEmpty())
name = file->suggestedFileName(); name = file->suggestedFileName();
// There can be several FileInterfaces pointing to the same file // There can be several IFiles pointing to the same file
// Select one that is not readonly. // Prefer one that is not readonly
if (!(modifiedFilesMap.key(name, 0) // (even though it *should* not happen that the IFiles are inconsistent with readonly)
&& file->isReadOnly())) if (!modifiedFilesMap.key(name, 0) || !file->isReadOnly())
modifiedFilesMap.insert(file, name); modifiedFilesMap.insert(file, name);
} }
} }

View File

@@ -35,6 +35,7 @@
#include "infobar.h" #include "infobar.h"
#include <QtCore/QFile> #include <QtCore/QFile>
#include <QtCore/QFileInfo>
namespace Core { namespace Core {
@@ -66,6 +67,13 @@ bool IFile::shouldAutoSave() const
return false; return false;
} }
bool IFile::isReadOnly() const
{
if (fileName().isEmpty())
return false;
return !QFileInfo(fileName()).isWritable();
}
bool IFile::autoSave(QString *errorString, const QString &fileName) bool IFile::autoSave(QString *errorString, const QString &fileName)
{ {
if (!save(errorString, fileName, true)) if (!save(errorString, fileName, true))

View File

@@ -93,7 +93,7 @@ public:
virtual bool shouldAutoSave() const; virtual bool shouldAutoSave() const;
virtual bool isModified() const = 0; virtual bool isModified() const = 0;
virtual bool isReadOnly() const = 0; virtual bool isReadOnly() const;
virtual bool isSaveAsAllowed() const = 0; virtual bool isSaveAsAllowed() const = 0;
virtual ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; virtual ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;

View File

@@ -137,14 +137,6 @@ bool FormWindowFile::isModified() const
return m_formWindow && m_formWindow->isDirty(); 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 bool FormWindowFile::isSaveAsAllowed() const
{ {
return true; return true;

View File

@@ -57,7 +57,6 @@ public:
virtual QString fileName() const; virtual QString fileName() const;
virtual bool shouldAutoSave() const; virtual bool shouldAutoSave() const;
virtual bool isModified() const; virtual bool isModified() const;
virtual bool isReadOnly() const;
virtual bool isSaveAsAllowed() const; virtual bool isSaveAsAllowed() const;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type); bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
virtual QString defaultPath() const; virtual QString defaultPath() const;

View File

@@ -639,11 +639,6 @@ bool GenericProjectFile::isModified() const
return false; return false;
} }
bool GenericProjectFile::isReadOnly() const
{
return true;
}
bool GenericProjectFile::isSaveAsAllowed() const bool GenericProjectFile::isSaveAsAllowed() const
{ {
return false; return false;

View File

@@ -172,7 +172,6 @@ public:
virtual QString mimeType() const; virtual QString mimeType() const;
virtual bool isModified() const; virtual bool isModified() const;
virtual bool isReadOnly() const;
virtual bool isSaveAsAllowed() const; virtual bool isSaveAsAllowed() const;
virtual void rename(const QString &newName); virtual void rename(const QString &newName);

View File

@@ -116,11 +116,6 @@ bool ImageViewerFile::isModified() const
return false; return false;
} }
bool ImageViewerFile::isReadOnly() const
{
return true;
}
bool ImageViewerFile::isSaveAsAllowed() const bool ImageViewerFile::isSaveAsAllowed() const
{ {
return false; return false;

View File

@@ -59,7 +59,6 @@ public:
QString mimeType() const; QString mimeType() const;
bool isModified() const; bool isModified() const;
bool isReadOnly() const;
bool isSaveAsAllowed() const; bool isSaveAsAllowed() const;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type); bool reload(QString *errorString, ReloadFlag flag, ChangeType type);

View File

@@ -69,7 +69,6 @@ public:
QString suggestedFileName() const { return QString(); } QString suggestedFileName() const { return QString(); }
QString mimeType() const { return QLatin1String("text/plain"); } QString mimeType() const { return QLatin1String("text/plain"); }
bool isModified() const { return false; } bool isModified() const { return false; }
bool isReadOnly() const { return false; }
bool isSaveAsAllowed() const { return false; } bool isSaveAsAllowed() const { return false; }
ReloadBehavior reloadBehavior(ChangeTrigger, ChangeType) const { return BehaviorSilent; } ReloadBehavior reloadBehavior(ChangeTrigger, ChangeType) const { return BehaviorSilent; }
bool reload(QString *, ReloadFlag, ChangeType) { emit modified(); return true; } bool reload(QString *, ReloadFlag, ChangeType) { emit modified(); return true; }

View File

@@ -1078,16 +1078,8 @@ void ProjectExplorerPlugin::unloadProject()
QList<Core::IFile*> filesToSave; QList<Core::IFile*> filesToSave;
filesToSave << fi; filesToSave << fi;
// check the number of modified files
int readonlycount = 0;
foreach (const Core::IFile *file, filesToSave) {
if (file->isReadOnly())
++readonlycount;
}
bool success = false; bool success = false;
if (readonlycount > 0) if (fi->isReadOnly())
success = Core::FileManager::saveModifiedFiles(filesToSave).isEmpty(); success = Core::FileManager::saveModifiedFiles(filesToSave).isEmpty();
else else
success = Core::FileManager::saveModifiedFilesSilently(filesToSave).isEmpty(); success = Core::FileManager::saveModifiedFilesSilently(filesToSave).isEmpty();

View File

@@ -88,11 +88,6 @@ bool QmlProjectFile::isModified() const
return false; return false;
} }
bool QmlProjectFile::isReadOnly() const
{
return true;
}
bool QmlProjectFile::isSaveAsAllowed() const bool QmlProjectFile::isSaveAsAllowed() const
{ {
return false; return false;

View File

@@ -58,7 +58,6 @@ public:
virtual QString mimeType() const; virtual QString mimeType() const;
virtual bool isModified() const; virtual bool isModified() const;
virtual bool isReadOnly() const;
virtual bool isSaveAsAllowed() const; virtual bool isSaveAsAllowed() const;
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;

View File

@@ -211,11 +211,6 @@ bool Qt4PriFile::isModified() const
return false; return false;
} }
bool Qt4PriFile::isReadOnly() const
{
return false;
}
bool Qt4PriFile::isSaveAsAllowed() const bool Qt4PriFile::isSaveAsAllowed() const
{ {
return false; return false;

View File

@@ -230,7 +230,6 @@ public:
virtual QString mimeType() const; virtual QString mimeType() const;
virtual bool isModified() const; virtual bool isModified() const;
virtual bool isReadOnly() const;
virtual bool isSaveAsAllowed() const; virtual bool isSaveAsAllowed() const;
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;

View File

@@ -97,7 +97,6 @@ public:
virtual QString mimeType() const; virtual QString mimeType() const;
bool isModified() const; bool isModified() const;
bool isReadOnly() const;
bool isSaveAsAllowed() const; bool isSaveAsAllowed() const;
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
@@ -283,12 +282,6 @@ bool Qt4ProjectFile::isModified() const
return false; // we save after changing anyway return false; // we save after changing anyway
} }
bool Qt4ProjectFile::isReadOnly() const
{
QFileInfo fi(m_filePath);
return !fi.isWritable();
}
bool Qt4ProjectFile::isSaveAsAllowed() const bool Qt4ProjectFile::isSaveAsAllowed() const
{ {
return false; return false;

View File

@@ -218,15 +218,6 @@ bool ResourceEditorFile::isModified() const
return m_parent->m_resourceEditor->isDirty(); 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 bool ResourceEditorFile::isSaveAsAllowed() const
{ {
return true; return true;

View File

@@ -65,7 +65,6 @@ public:
QString fileName() const; QString fileName() const;
bool shouldAutoSave() const; bool shouldAutoSave() const;
bool isModified() const; bool isModified() const;
bool isReadOnly() const;
bool isSaveAsAllowed() const; bool isSaveAsAllowed() const;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type); bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
QString defaultPath() const; QString defaultPath() const;

View File

@@ -81,11 +81,6 @@ bool TaskFile::isModified() const
return false; return false;
} }
bool TaskFile::isReadOnly() const
{
return true;
}
bool TaskFile::isSaveAsAllowed() const bool TaskFile::isSaveAsAllowed() const
{ {
return false; return false;

View File

@@ -56,7 +56,6 @@ public:
QString mimeType() const; QString mimeType() const;
bool isModified() const; bool isModified() const;
bool isReadOnly() const;
bool isSaveAsAllowed() const; bool isSaveAsAllowed() const;
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;

View File

@@ -411,8 +411,6 @@ void BaseTextDocument::rename(const QString &newName)
bool BaseTextDocument::isReadOnly() const bool BaseTextDocument::isReadOnly() const
{ {
if (hasDecodingError())
return true;
if (d->m_fileName.isEmpty()) //have no corresponding file, so editing is ok if (d->m_fileName.isEmpty()) //have no corresponding file, so editing is ok
return false; return false;
return d->m_fileIsReadOnly; return d->m_fileIsReadOnly;

View File

@@ -51,7 +51,6 @@ public:
bool isModified() const { return m_modified; } bool isModified() const { return m_modified; }
QString mimeType() const; QString mimeType() const;
bool isReadOnly() const { return false; }
bool isSaveAsAllowed() const { return false; } bool isSaveAsAllowed() const { return false; }
bool save(QString *errorString, const QString &fileName, bool autoSave); bool save(QString *errorString, const QString &fileName, bool autoSave);
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;

View File

@@ -11,7 +11,6 @@ HEADERS += vcsbase_global.h \
vcsbaseplugin.h \ vcsbaseplugin.h \
baseannotationhighlighter.h \ baseannotationhighlighter.h \
diffhighlighter.h \ diffhighlighter.h \
vcsbasetextdocument.h \
vcsbaseeditor.h \ vcsbaseeditor.h \
vcsbasesubmiteditor.h \ vcsbasesubmiteditor.h \
basevcseditorfactory.h \ basevcseditorfactory.h \
@@ -40,7 +39,6 @@ SOURCES += vcsplugin.cpp \
corelistener.cpp \ corelistener.cpp \
baseannotationhighlighter.cpp \ baseannotationhighlighter.cpp \
diffhighlighter.cpp \ diffhighlighter.cpp \
vcsbasetextdocument.cpp \
vcsbaseeditor.cpp \ vcsbaseeditor.cpp \
vcsbasesubmiteditor.cpp \ vcsbasesubmiteditor.cpp \
basevcseditorfactory.cpp \ basevcseditorfactory.cpp \

View File

@@ -33,7 +33,6 @@
#include "vcsbaseeditor.h" #include "vcsbaseeditor.h"
#include "diffhighlighter.h" #include "diffhighlighter.h"
#include "baseannotationhighlighter.h" #include "baseannotationhighlighter.h"
#include "vcsbasetextdocument.h"
#include "vcsbaseconstants.h" #include "vcsbaseconstants.h"
#include "vcsbaseoutputwindow.h" #include "vcsbaseoutputwindow.h"
#include "vcsbaseplugin.h" #include "vcsbaseplugin.h"
@@ -50,6 +49,7 @@
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
#include <texteditor/basetextdocument.h>
#include <texteditor/basetextdocumentlayout.h> #include <texteditor/basetextdocumentlayout.h>
#include <texteditor/fontsettings.h> #include <texteditor/fontsettings.h>
#include <texteditor/texteditorconstants.h> #include <texteditor/texteditorconstants.h>
@@ -663,7 +663,6 @@ VcsBaseEditorWidget::VcsBaseEditorWidget(const VcsBaseEditorParameters *type, QW
d(new Internal::VcsBaseEditorWidgetPrivate(this, type)) d(new Internal::VcsBaseEditorWidgetPrivate(this, type))
{ {
viewport()->setMouseTracking(true); viewport()->setMouseTracking(true);
setBaseTextDocument(new Internal::VcsBaseTextDocument);
setMimeType(QLatin1String(d->m_parameters->mimeType)); setMimeType(QLatin1String(d->m_parameters->mimeType));
} }
@@ -696,21 +695,12 @@ VcsBaseEditorWidget::~VcsBaseEditorWidget()
void VcsBaseEditorWidget::setForceReadOnly(bool b) void VcsBaseEditorWidget::setForceReadOnly(bool b)
{ {
Internal::VcsBaseTextDocument *vbd = qobject_cast<Internal::VcsBaseTextDocument*>(baseTextDocument());
VcsBaseEditor *eda = qobject_cast<VcsBaseEditor *>(editor()); VcsBaseEditor *eda = qobject_cast<VcsBaseEditor *>(editor());
QTC_ASSERT(vbd != 0 && eda != 0, return); QTC_ASSERT(eda != 0, return);
setReadOnly(b); setReadOnly(b);
vbd->setForceReadOnly(b);
eda->setTemporary(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 QString VcsBaseEditorWidget::source() const
{ {
return d->m_source; return d->m_source;

View File

@@ -113,7 +113,6 @@ public:
* by default since it should not trigger when patches are opened as * by default since it should not trigger when patches are opened as
* files. */ * files. */
void setForceReadOnly(bool b); void setForceReadOnly(bool b);
bool isForceReadOnly() const;
QString source() const; QString source() const;
void setSource(const QString &source); void setSource(const QString &source);

View File

@@ -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;
}

View File

@@ -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