#include "maemodeviceconfigurations.h"
+#include <coreplugin/ifile.h>
#include <utils/environment.h>
#include <projectexplorer/buildstep.h>
class BaseQtVersion;
namespace Internal {
+class WatchableFile : public Core::IFile
+{
+ Q_OBJECT
+public:
+ WatchableFile(const QString &fileName, QObject *parent = 0)
+ : Core::IFile(parent), m_fileName(fileName) {}
+
+ bool save(QString *, const QString &, bool) { return false; }
+ QString fileName() const { return m_fileName; }
+ QString defaultPath() const { return QString(); }
+ QString suggestedFileName() const { return QString(); }
+ QString mimeType() const { return QLatin1String("text/plain"); }
+ bool isModified() const { return false; }
+ bool isReadOnly() const { return false; }
+ bool isSaveAsAllowed() const { return false; }
+ ReloadBehavior reloadBehavior(ChangeTrigger, ChangeType) const { return BehaviorSilent; }
+ bool reload(QString *, ReloadFlag, ChangeType) { emit modified(); return true; }
+ void rename(const QString &) {}
+
+signals:
+ void modified();
+
+private:
+ QString m_fileName;
+};
+
class MaemoGlobal
{
Q_DECLARE_TR_FUNCTIONS(Qt4ProjectManager::Internal::MaemoGlobal)
setPackageManagerIcon(iconPath);
}
m_filesWatcher->addDirectory(debianDirPath(), Utils::FileSystemWatcher::WatchAllChanges);
- m_filesWatcher->addFile(changeLogFilePath(), Utils::FileSystemWatcher::WatchAllChanges);
- m_filesWatcher->addFile(controlFilePath(), Utils::FileSystemWatcher::WatchAllChanges);
+ m_controlFile = new WatchableFile(controlFilePath(), this);
+ connect(m_controlFile, SIGNAL(modified()), SIGNAL(controlChanged()));
+ m_changeLogFile = new WatchableFile(changeLogFilePath(), this);
+ connect(m_changeLogFile, SIGNAL(modified()), SIGNAL(changeLogChanged()));
+ Core::FileManager::instance()->addFiles(QList<Core::IFile *>()
+ << m_controlFile << m_changeLogFile);
connect(m_filesWatcher, SIGNAL(directoryChanged(QString)), this,
SLOT(handleDebianDirContentsChanged()));
- connect(m_filesWatcher, SIGNAL(fileChanged(QString)), this,
- SLOT(handleDebianFileChanged(QString)));
handleDebianDirContentsChanged();
- handleDebianFileChanged(changeLogFilePath());
- handleDebianFileChanged(controlFilePath());
+ emit controlChanged();
+ emit changeLogChanged();
}
bool AbstractDebBasedQt4MaemoTarget::targetCanBeRemoved() const
qDebug("%s", qPrintable(error));
}
-void AbstractDebBasedQt4MaemoTarget::handleDebianFileChanged(const QString &filePath)
-{
- if (filePath == changeLogFilePath())
- emit changeLogChanged();
- else if (filePath == controlFilePath())
- emit controlChanged();
-}
-
void AbstractDebBasedQt4MaemoTarget::handleDebianDirContentsChanged()
{
emit debianDirContentsChanged();
void AbstractRpmBasedQt4MaemoTarget::handleTargetAddedSpecial()
{
- m_filesWatcher->addFile(specFilePath(), Utils::FileSystemWatcher::WatchAllChanges);
- connect(m_filesWatcher, SIGNAL(fileChanged(QString)), this,
- SIGNAL(specFileChanged()));
+ m_specFile = new WatchableFile(specFilePath(), this);
+ connect(m_specFile, SIGNAL(modified()), SIGNAL(specFileChanged()));
+ Core::FileManager::instance()->addFile(m_specFile);
+ emit specFileChanged();
}
bool AbstractRpmBasedQt4MaemoTarget::targetCanBeRemoved() const
class Qt4Project;
namespace Internal {
class Qt4MaemoDeployConfigurationFactory;
+class WatchableFile;
class AbstractQt4MaemoTarget : public Qt4BaseTarget
{
private slots:
void handleDebianDirContentsChanged();
- void handleDebianFileChanged(const QString &filePath);
private:
virtual bool setProjectVersionInternal(const QString &version,
QString *error = 0);
QString defaultPackageFileName() const;
bool setPackageManagerNameInternal(const QString &name, QString *error = 0);
+
+ WatchableFile *m_controlFile;
+ WatchableFile *m_changeLogFile;
};
QByteArray getValueForTag(const QByteArray &tag, QString *error) const;
bool setValueForTag(const QByteArray &tag, const QByteArray &value,
QString *error);
+
+ WatchableFile *m_specFile;
};