add/unify i/o error handling

lots of use of Utils::FileSaver and Utils::FileReader

Task-number: QTCREATORBUG-1619
This commit is contained in:
Oswald Buddenhagen
2011-03-30 15:15:15 +02:00
parent fae7dc9584
commit 45c9cf7a12
70 changed files with 632 additions and 710 deletions

View File

@@ -45,6 +45,7 @@
#include <projectexplorer/projectnodes.h>
#include <utils/pathchooser.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
#include <QtCore/QFile>
@@ -187,13 +188,12 @@ void SuppressionDialog::accept()
QTC_ASSERT(!path.isEmpty(), return);
QTC_ASSERT(!m_ui->suppressionEdit->toPlainText().trimmed().isEmpty(), return);
QFile file(path);
bool opened = file.open(QIODevice::WriteOnly | QIODevice::Append);
QTC_ASSERT(opened, return);
QTextStream stream(&file);
Utils::FileSaver saver(path, QIODevice::Append);
QTextStream stream(saver.file());
stream << m_ui->suppressionEdit->toPlainText();
file.close();
saver.setResult(&stream);
if (!saver.finalize(this))
return;
// add file to project (if there is a project that contains this file on the file system)
ProjectExplorer::SessionManager *session = ProjectExplorer::ProjectExplorerPlugin::instance()->session();