Move displayName from IEditor to IDocument

The display name is not editor instance specific, but belongs to the
document.

Change-Id: I3c936f04a86e10e6ca30063d85036d85b4b5880e
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Eike Ziller
2013-07-04 22:25:15 +02:00
parent 81eba6f984
commit 113c5600c9
57 changed files with 177 additions and 325 deletions

View File

@@ -133,4 +133,31 @@ void IDocument::setFilePath(const QString &filePath)
emit changed();
}
/*!
Returns the string to display for this document, e.g. in the open document combo box
and pane.
\sa setDisplayName()
*/
QString IDocument::displayName() const
{
if (!m_displayName.isEmpty())
return m_displayName;
return QFileInfo(m_filePath).fileName();
}
/*!
Sets the string that is displayed for this document, e.g. in the open document combo box
and pane, to \a name. Defaults to the file name of the file path for this document.
You can reset the display name to the default by passing an empty string.
\sa displayName()
\sa filePath()
*/
void IDocument::setDisplayName(const QString &name)
{
if (name == m_displayName)
return;
m_displayName = name;
emit changed();
}
} // namespace Core