Maemo: Tell file manager not to bother the user with expected updates.

This commit is contained in:
Christian Kandeler
2011-01-10 12:13:27 +01:00
parent 7e0c289edd
commit 549022b55f
4 changed files with 29 additions and 2 deletions

View File

@@ -230,6 +230,7 @@ bool MaemoDeployableListModel::addDesktopFile(QString &error)
return true; return true;
const QString desktopFilePath = QFileInfo(m_proFilePath).path() const QString desktopFilePath = QFileInfo(m_proFilePath).path()
+ QLatin1Char('/') + m_projectName + QLatin1String(".desktop"); + QLatin1Char('/') + m_projectName + QLatin1String(".desktop");
MaemoGlobal::FileUpdate update(desktopFilePath);
QFile desktopFile(desktopFilePath); QFile desktopFile(desktopFilePath);
const bool existsAlready = desktopFile.exists(); const bool existsAlready = desktopFile.exists();
if (!desktopFile.open(QIODevice::ReadWrite)) { if (!desktopFile.open(QIODevice::ReadWrite)) {
@@ -316,6 +317,7 @@ QString MaemoDeployableListModel::remoteIconFilePath() const
bool MaemoDeployableListModel::addLinesToProFile(const QStringList &lines) bool MaemoDeployableListModel::addLinesToProFile(const QStringList &lines)
{ {
QFile projectFile(m_proFilePath); QFile projectFile(m_proFilePath);
MaemoGlobal::FileUpdate update(m_proFilePath);
if (!projectFile.open(QIODevice::WriteOnly | QIODevice::Append)) { if (!projectFile.open(QIODevice::WriteOnly | QIODevice::Append)) {
qWarning("Error opening .pro file for writing."); qWarning("Error opening .pro file for writing.");
return false; return false;

View File

@@ -36,6 +36,7 @@
#include "maemoconstants.h" #include "maemoconstants.h"
#include "maemodeviceconfigurations.h" #include "maemodeviceconfigurations.h"
#include <coreplugin/filemanager.h>
#include <coreplugin/ssh/sshconnection.h> #include <coreplugin/ssh/sshconnection.h>
#include <qt4projectmanager/qtversionmanager.h> #include <qt4projectmanager/qtversionmanager.h>
#include <utils/environment.h> #include <utils/environment.h>
@@ -212,5 +213,16 @@ bool MaemoGlobal::callMaddeShellScript(QProcess &proc, const QString &maddeRoot,
return true; 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 Internal
} // namespace Qt4ProjectManager } // namespace Qt4ProjectManager

View File

@@ -63,6 +63,14 @@ class MaemoGlobal
public: public:
enum MaemoVersion { Maemo5, Maemo6 }; 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 homeDirOnDevice(const QString &uname);
static QString remoteSudo(); static QString remoteSudo();
static QString remoteCommandPrefix(const QString &commandFilePath); static QString remoteCommandPrefix(const QString &commandFilePath);

View File

@@ -458,8 +458,10 @@ QString MaemoTemplatesManager::version(const Project *project,
bool MaemoTemplatesManager::setVersion(const Project *project, bool MaemoTemplatesManager::setVersion(const Project *project,
const QString &version, QString *error) const const QString &version, QString *error) const
{ {
const QString filePath = changeLogFilePath(project);
MaemoGlobal::FileUpdate update(filePath);
QSharedPointer<QFile> changeLog QSharedPointer<QFile> changeLog
= openFile(changeLogFilePath(project), QIODevice::ReadWrite, error); = openFile(filePath, QIODevice::ReadWrite, error);
if (!changeLog) if (!changeLog)
return false; return false;
@@ -496,8 +498,10 @@ QIcon MaemoTemplatesManager::packageManagerIcon(const Project *project,
bool MaemoTemplatesManager::setPackageManagerIcon(const Project *project, bool MaemoTemplatesManager::setPackageManagerIcon(const Project *project,
const QString &iconFilePath, QString *error) const const QString &iconFilePath, QString *error) const
{ {
const QString filePath = controlFilePath(project);
MaemoGlobal::FileUpdate update(filePath);
const QSharedPointer<QFile> controlFile const QSharedPointer<QFile> controlFile
= openFile(controlFilePath(project), QIODevice::ReadWrite, error); = openFile(filePath, QIODevice::ReadWrite, error);
if (!controlFile) if (!controlFile)
return false; return false;
const QPixmap pixmap(iconFilePath); const QPixmap pixmap(iconFilePath);
@@ -577,6 +581,7 @@ bool MaemoTemplatesManager::setFieldValue(const Project *project,
const QByteArray &fieldName, const QByteArray &fieldValue) const QByteArray &fieldName, const QByteArray &fieldValue)
{ {
QFile controlFile(controlFilePath(project)); QFile controlFile(controlFilePath(project));
MaemoGlobal::FileUpdate update(controlFile.fileName());
if (!controlFile.open(QIODevice::ReadWrite)) if (!controlFile.open(QIODevice::ReadWrite))
return false; return false;
QByteArray contents = controlFile.readAll(); QByteArray contents = controlFile.readAll();