Commit 4f146f65 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Use Core::FileChangeBlocker

Remove class that does something similar.

Reviewed-by: Christian Kandeler
Change-Id: I7acfa119cf18d96c22d1873a464b1c004c78e132
parent 72e01313
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "qt4maemotarget.h" #include "qt4maemotarget.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/filemanager.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
#include <qt4projectmanager/qt4buildconfiguration.h> #include <qt4projectmanager/qt4buildconfiguration.h>
...@@ -299,7 +300,7 @@ QString MaemoDeployableListModel::remoteIconFilePath() const ...@@ -299,7 +300,7 @@ QString MaemoDeployableListModel::remoteIconFilePath() const
bool MaemoDeployableListModel::addLinesToProFile(const QStringList &lines) bool MaemoDeployableListModel::addLinesToProFile(const QStringList &lines)
{ {
MaemoGlobal::FileUpdate update(m_proFilePath); Core::FileChangeBlocker update(m_proFilePath);
const QLatin1String separator("\n "); const QLatin1String separator("\n ");
const QString proFileString = QString(QLatin1Char('\n') + proFileScope() const QString proFileString = QString(QLatin1Char('\n') + proFileScope()
......
...@@ -426,16 +426,5 @@ MaemoGlobal::PackagingSystem MaemoGlobal::packagingSystem(MaemoDeviceConfig::OsV ...@@ -426,16 +426,5 @@ MaemoGlobal::PackagingSystem MaemoGlobal::packagingSystem(MaemoDeviceConfig::OsV
return static_cast<PackagingSystem>(-1); return static_cast<PackagingSystem>(-1);
} }
MaemoGlobal::FileUpdate::FileUpdate(const QString &fileName)
: m_fileName(fileName)
{
Core::FileManager::instance()->expectFileChange(fileName);
}
MaemoGlobal::FileUpdate::~FileUpdate()
{
Core::FileManager::instance()->unexpectFileChange(m_fileName);
}
} // namespace Internal } // namespace Internal
} // namespace Qt4ProjectManager } // namespace Qt4ProjectManager
...@@ -65,14 +65,6 @@ class MaemoGlobal ...@@ -65,14 +65,6 @@ class MaemoGlobal
public: public:
enum PackagingSystem { Dpkg, Rpm, Tar }; enum PackagingSystem { Dpkg, Rpm, Tar };
class FileUpdate {
public:
FileUpdate(const QString &fileName);
~FileUpdate();
private:
const QString m_fileName;
};
static bool isMaemoTargetId(const QString &id); static bool isMaemoTargetId(const QString &id);
static bool isFremantleTargetId(const QString &id); static bool isFremantleTargetId(const QString &id);
static bool isHarmattanTargetId(const QString &id); static bool isHarmattanTargetId(const QString &id);
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "maemotoolchain.h" #include "maemotoolchain.h"
#include "qt4maemodeployconfiguration.h" #include "qt4maemodeployconfiguration.h"
#include <coreplugin/filemanager.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/iversioncontrol.h> #include <coreplugin/iversioncontrol.h>
#include <coreplugin/vcsmanager.h> #include <coreplugin/vcsmanager.h>
...@@ -420,7 +421,7 @@ bool AbstractDebBasedQt4MaemoTarget::setProjectVersionInternal(const QString &ve ...@@ -420,7 +421,7 @@ bool AbstractDebBasedQt4MaemoTarget::setProjectVersionInternal(const QString &ve
QString content = QString::fromUtf8(reader.data()); QString content = QString::fromUtf8(reader.data());
content.replace(QRegExp(QLatin1String("\\([a-zA-Z0-9_\\.]+\\)")), content.replace(QRegExp(QLatin1String("\\([a-zA-Z0-9_\\.]+\\)")),
QLatin1Char('(') + version + QLatin1Char(')')); QLatin1Char('(') + version + QLatin1Char(')'));
MaemoGlobal::FileUpdate update(filePath); Core::FileChangeBlocker update(filePath);
Utils::FileSaver saver(filePath); Utils::FileSaver saver(filePath);
saver.write(content.toUtf8()); saver.write(content.toUtf8());
return saver.finalize(error); return saver.finalize(error);
...@@ -488,7 +489,7 @@ bool AbstractDebBasedQt4MaemoTarget::setPackageManagerIconInternal(const QString ...@@ -488,7 +489,7 @@ bool AbstractDebBasedQt4MaemoTarget::setPackageManagerIconInternal(const QString
contents.replace(oldIconStartPos, nextEolPos - oldIconStartPos, contents.replace(oldIconStartPos, nextEolPos - oldIconStartPos,
' ' + iconAsBase64); ' ' + iconAsBase64);
} }
MaemoGlobal::FileUpdate update(filePath); Core::FileChangeBlocker update(filePath);
Utils::FileSaver saver(filePath); Utils::FileSaver saver(filePath);
saver.write(contents); saver.write(contents);
return saver.finalize(error); return saver.finalize(error);
...@@ -646,7 +647,7 @@ bool AbstractDebBasedQt4MaemoTarget::setControlFieldValue(const QByteArray &fiel ...@@ -646,7 +647,7 @@ bool AbstractDebBasedQt4MaemoTarget::setControlFieldValue(const QByteArray &fiel
return false; return false;
QByteArray contents = reader.data(); QByteArray contents = reader.data();
if (adaptControlFileField(contents, fieldName, fieldValue)) { if (adaptControlFileField(contents, fieldName, fieldValue)) {
MaemoGlobal::FileUpdate update(controlFilePath()); Core::FileChangeBlocker update(controlFilePath());
Utils::FileSaver saver(controlFilePath()); Utils::FileSaver saver(controlFilePath());
saver.write(contents); saver.write(contents);
return saver.finalize(); return saver.finalize();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment