forked from qt-creator/qt-creator
Move IEditor::createNew to IDocument::setContents
The method is for setting the contents, so it belongs to the document, and should be named correspondingly. Change-Id: I40363dc08f11268f530885b512e4a88e8b10d096 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -349,12 +349,6 @@ void VcsBaseSubmitEditor::slotDescriptionChanged()
|
||||
{
|
||||
}
|
||||
|
||||
bool VcsBaseSubmitEditor::createNew(const QString &contents)
|
||||
{
|
||||
setFileContents(contents);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VcsBaseSubmitEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
|
||||
{
|
||||
if (fileName.isEmpty())
|
||||
@@ -365,7 +359,7 @@ bool VcsBaseSubmitEditor::open(QString *errorString, const QString &fileName, co
|
||||
return false;
|
||||
|
||||
const QString text = QString::fromLocal8Bit(reader.data());
|
||||
if (!createNew(text))
|
||||
if (!setFileContents(text.toUtf8()))
|
||||
return false;
|
||||
|
||||
d->m_file->setFilePath(QFileInfo(fileName).absoluteFilePath());
|
||||
@@ -518,9 +512,9 @@ QByteArray VcsBaseSubmitEditor::fileContents() const
|
||||
return d->m_widget->descriptionText().toLocal8Bit();
|
||||
}
|
||||
|
||||
bool VcsBaseSubmitEditor::setFileContents(const QString &contents)
|
||||
bool VcsBaseSubmitEditor::setFileContents(const QByteArray &contents)
|
||||
{
|
||||
d->m_widget->setDescriptionText(contents);
|
||||
d->m_widget->setDescriptionText(QString::fromUtf8(contents));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user