summaryrefslogtreecommitdiff
path: root/src/plugins/vcsbase/nicknamedialog.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-03-30 15:15:15 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-04-18 14:10:14 +0200
commit45c9cf7a1298feed925d18596c30ac9c6cd1dac5 (patch)
tree6f484122011b76a5f3a2f1915b7b308b1f5058ea /src/plugins/vcsbase/nicknamedialog.cpp
parentfae7dc9584b4e2f2192f8b7a71c428fcaa2ddb70 (diff)
downloadqt-creator-45c9cf7a1298feed925d18596c30ac9c6cd1dac5.tar.gz
add/unify i/o error handling
lots of use of Utils::FileSaver and Utils::FileReader Task-number: QTCREATORBUG-1619
Diffstat (limited to 'src/plugins/vcsbase/nicknamedialog.cpp')
-rw-r--r--src/plugins/vcsbase/nicknamedialog.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/plugins/vcsbase/nicknamedialog.cpp b/src/plugins/vcsbase/nicknamedialog.cpp
index 080a969cd3..5c0be4a0b2 100644
--- a/src/plugins/vcsbase/nicknamedialog.cpp
+++ b/src/plugins/vcsbase/nicknamedialog.cpp
@@ -33,6 +33,8 @@
#include "nicknamedialog.h"
#include "ui_nicknamedialog.h"
+#include <utils/fileutils.h>
+
#include <QtCore/QDebug>
#include <QtCore/QFile>
#include <QtCore/QDir>
@@ -244,15 +246,12 @@ bool NickNameDialog::populateModelFromMailCapFile(const QString &fileName,
model->removeRows(0, rowCount);
if (fileName.isEmpty())
return true;
- QFile file(fileName);
- if (!file.open(QIODevice::ReadOnly|QIODevice::Text)) {
- *errorMessage = tr("Cannot open '%1': %2").
- arg(QDir::toNativeSeparators(fileName), file.errorString());
+ Utils::FileReader reader;
+ if (!reader.fetch(fileName, QIODevice::Text, errorMessage))
return false;
- }
// Split into lines and read
NickNameEntry entry;
- const QStringList lines = QString::fromUtf8(file.readAll()).trimmed().split(QLatin1Char('\n'));
+ const QStringList lines = QString::fromUtf8(reader.data()).trimmed().split(QLatin1Char('\n'));
const int count = lines.size();
for (int i = 0; i < count; i++) {
if (entry.parse(lines.at(i))) {