Test for read-only when session is loaded

Task-number: QTCREATORBUG-5131
Change-Id: I6642ec2b80ff156b76bba86172e8a2362cb02bc8
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
Orgad Shaneh
2011-12-01 23:34:23 +02:00
committed by Eike Ziller
parent 76136202e3
commit d4a881e6ee

View File

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