forked from qt-creator/qt-creator
Maemo: Tell file manager not to bother the user with expected updates.
This commit is contained in:
@@ -230,6 +230,7 @@ bool MaemoDeployableListModel::addDesktopFile(QString &error)
|
||||
return true;
|
||||
const QString desktopFilePath = QFileInfo(m_proFilePath).path()
|
||||
+ QLatin1Char('/') + m_projectName + QLatin1String(".desktop");
|
||||
MaemoGlobal::FileUpdate update(desktopFilePath);
|
||||
QFile desktopFile(desktopFilePath);
|
||||
const bool existsAlready = desktopFile.exists();
|
||||
if (!desktopFile.open(QIODevice::ReadWrite)) {
|
||||
@@ -316,6 +317,7 @@ QString MaemoDeployableListModel::remoteIconFilePath() const
|
||||
bool MaemoDeployableListModel::addLinesToProFile(const QStringList &lines)
|
||||
{
|
||||
QFile projectFile(m_proFilePath);
|
||||
MaemoGlobal::FileUpdate update(m_proFilePath);
|
||||
if (!projectFile.open(QIODevice::WriteOnly | QIODevice::Append)) {
|
||||
qWarning("Error opening .pro file for writing.");
|
||||
return false;
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "maemoconstants.h"
|
||||
#include "maemodeviceconfigurations.h"
|
||||
|
||||
#include <coreplugin/filemanager.h>
|
||||
#include <coreplugin/ssh/sshconnection.h>
|
||||
#include <qt4projectmanager/qtversionmanager.h>
|
||||
#include <utils/environment.h>
|
||||
@@ -212,5 +213,16 @@ bool MaemoGlobal::callMaddeShellScript(QProcess &proc, const QString &maddeRoot,
|
||||
return true;
|
||||
}
|
||||
|
||||
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 Qt4ProjectManager
|
||||
|
||||
@@ -63,6 +63,14 @@ class MaemoGlobal
|
||||
public:
|
||||
enum MaemoVersion { Maemo5, Maemo6 };
|
||||
|
||||
class FileUpdate {
|
||||
public:
|
||||
FileUpdate(const QString &fileName);
|
||||
~FileUpdate();
|
||||
private:
|
||||
const QString m_fileName;
|
||||
};
|
||||
|
||||
static QString homeDirOnDevice(const QString &uname);
|
||||
static QString remoteSudo();
|
||||
static QString remoteCommandPrefix(const QString &commandFilePath);
|
||||
|
||||
@@ -458,8 +458,10 @@ QString MaemoTemplatesManager::version(const Project *project,
|
||||
bool MaemoTemplatesManager::setVersion(const Project *project,
|
||||
const QString &version, QString *error) const
|
||||
{
|
||||
const QString filePath = changeLogFilePath(project);
|
||||
MaemoGlobal::FileUpdate update(filePath);
|
||||
QSharedPointer<QFile> changeLog
|
||||
= openFile(changeLogFilePath(project), QIODevice::ReadWrite, error);
|
||||
= openFile(filePath, QIODevice::ReadWrite, error);
|
||||
if (!changeLog)
|
||||
return false;
|
||||
|
||||
@@ -496,8 +498,10 @@ QIcon MaemoTemplatesManager::packageManagerIcon(const Project *project,
|
||||
bool MaemoTemplatesManager::setPackageManagerIcon(const Project *project,
|
||||
const QString &iconFilePath, QString *error) const
|
||||
{
|
||||
const QString filePath = controlFilePath(project);
|
||||
MaemoGlobal::FileUpdate update(filePath);
|
||||
const QSharedPointer<QFile> controlFile
|
||||
= openFile(controlFilePath(project), QIODevice::ReadWrite, error);
|
||||
= openFile(filePath, QIODevice::ReadWrite, error);
|
||||
if (!controlFile)
|
||||
return false;
|
||||
const QPixmap pixmap(iconFilePath);
|
||||
@@ -577,6 +581,7 @@ bool MaemoTemplatesManager::setFieldValue(const Project *project,
|
||||
const QByteArray &fieldName, const QByteArray &fieldValue)
|
||||
{
|
||||
QFile controlFile(controlFilePath(project));
|
||||
MaemoGlobal::FileUpdate update(controlFile.fileName());
|
||||
if (!controlFile.open(QIODevice::ReadWrite))
|
||||
return false;
|
||||
QByteArray contents = controlFile.readAll();
|
||||
|
||||
Reference in New Issue
Block a user