forked from qt-creator/qt-creator
Enabling not silent installation on Symbian OS
Reviewed-by: Tobias Hunger
This commit is contained in:
@@ -102,13 +102,17 @@ struct LauncherPrivate {
|
|||||||
Launcher::Actions m_startupActions;
|
Launcher::Actions m_startupActions;
|
||||||
bool m_closeDevice;
|
bool m_closeDevice;
|
||||||
CrashReportState m_crashReportState;
|
CrashReportState m_crashReportState;
|
||||||
|
Launcher::InstallationMode m_installationMode;
|
||||||
|
Launcher::InstallationMode m_currentInstallationStep;
|
||||||
};
|
};
|
||||||
|
|
||||||
LauncherPrivate::LauncherPrivate(const TrkDevicePtr &d) :
|
LauncherPrivate::LauncherPrivate(const TrkDevicePtr &d) :
|
||||||
m_device(d),
|
m_device(d),
|
||||||
m_state(Launcher::Disconnected),
|
m_state(Launcher::Disconnected),
|
||||||
m_verbose(0),
|
m_verbose(0),
|
||||||
m_closeDevice(true)
|
m_closeDevice(true),
|
||||||
|
m_installationMode(Launcher::InstallationModeSilentAndUser),
|
||||||
|
m_currentInstallationStep(Launcher::InstallationModeSilent)
|
||||||
{
|
{
|
||||||
if (m_device.isNull())
|
if (m_device.isNull())
|
||||||
m_device = TrkDevicePtr(new TrkDevice);
|
m_device = TrkDevicePtr(new TrkDevice);
|
||||||
@@ -147,6 +151,11 @@ void Launcher::setState(State s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Launcher::setInstallationMode(InstallationMode installation)
|
||||||
|
{
|
||||||
|
d->m_installationMode = installation;
|
||||||
|
}
|
||||||
|
|
||||||
void Launcher::addStartupActions(trk::Launcher::Actions startupActions)
|
void Launcher::addStartupActions(trk::Launcher::Actions startupActions)
|
||||||
{
|
{
|
||||||
d->m_startupActions = Actions(d->m_startupActions | startupActions);
|
d->m_startupActions = Actions(d->m_startupActions | startupActions);
|
||||||
@@ -204,7 +213,6 @@ bool Launcher::serialFrame() const
|
|||||||
return d->m_device->serialFrame();
|
return d->m_device->serialFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Launcher::closeDevice() const
|
bool Launcher::closeDevice() const
|
||||||
{
|
{
|
||||||
return d->m_closeDevice;
|
return d->m_closeDevice;
|
||||||
@@ -215,6 +223,11 @@ void Launcher::setCloseDevice(bool c)
|
|||||||
d->m_closeDevice = c;
|
d->m_closeDevice = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Launcher::InstallationMode Launcher::installationMode() const
|
||||||
|
{
|
||||||
|
return d->m_installationMode;
|
||||||
|
}
|
||||||
|
|
||||||
bool Launcher::startServer(QString *errorMessage)
|
bool Launcher::startServer(QString *errorMessage)
|
||||||
{
|
{
|
||||||
errorMessage->clear();
|
errorMessage->clear();
|
||||||
@@ -291,7 +304,7 @@ void Launcher::handleConnect(const TrkResult &result)
|
|||||||
if (d->m_startupActions & ActionCopy)
|
if (d->m_startupActions & ActionCopy)
|
||||||
copyFileToRemote();
|
copyFileToRemote();
|
||||||
else if (d->m_startupActions & ActionInstall)
|
else if (d->m_startupActions & ActionInstall)
|
||||||
installRemotePackageSilently();
|
installRemotePackage();
|
||||||
else if (d->m_startupActions & ActionRun)
|
else if (d->m_startupActions & ActionRun)
|
||||||
startInferiorIfNeeded();
|
startInferiorIfNeeded();
|
||||||
else if (d->m_startupActions & ActionDownload)
|
else if (d->m_startupActions & ActionDownload)
|
||||||
@@ -678,7 +691,7 @@ void Launcher::handleFileCopied(const TrkResult &result)
|
|||||||
if (result.errorCode())
|
if (result.errorCode())
|
||||||
emit canNotCloseFile(d->m_copyState.destinationFileName, result.errorString());
|
emit canNotCloseFile(d->m_copyState.destinationFileName, result.errorString());
|
||||||
if (d->m_startupActions & ActionInstall)
|
if (d->m_startupActions & ActionInstall)
|
||||||
installRemotePackageSilently();
|
installRemotePackage();
|
||||||
else if (d->m_startupActions & ActionRun)
|
else if (d->m_startupActions & ActionRun)
|
||||||
startInferiorIfNeeded();
|
startInferiorIfNeeded();
|
||||||
else if (d->m_startupActions & ActionDownload)
|
else if (d->m_startupActions & ActionDownload)
|
||||||
@@ -847,15 +860,45 @@ void Launcher::copyFileFromRemote()
|
|||||||
void Launcher::installRemotePackageSilently()
|
void Launcher::installRemotePackageSilently()
|
||||||
{
|
{
|
||||||
emit installingStarted();
|
emit installingStarted();
|
||||||
|
d->m_currentInstallationStep = InstallationModeSilent;
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
ba.append('C');
|
ba.append('C');
|
||||||
appendString(&ba, d->m_installFileName.toLocal8Bit(), TargetByteOrder, false);
|
appendString(&ba, d->m_installFileName.toLocal8Bit(), TargetByteOrder, false);
|
||||||
d->m_device->sendTrkMessage(TrkInstallFile, TrkCallback(this, &Launcher::handleInstallPackageFinished), ba);
|
d->m_device->sendTrkMessage(TrkInstallFile, TrkCallback(this, &Launcher::handleInstallPackageFinished), ba);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Launcher::installRemotePackageByUser()
|
||||||
|
{
|
||||||
|
emit installingStarted();
|
||||||
|
d->m_currentInstallationStep = InstallationModeUser;
|
||||||
|
QByteArray ba;
|
||||||
|
appendString(&ba, d->m_installFileName.toLocal8Bit(), TargetByteOrder, false);
|
||||||
|
d->m_device->sendTrkMessage(TrkInstallFile2, TrkCallback(this, &Launcher::handleInstallPackageFinished), ba);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Launcher::installRemotePackage()
|
||||||
|
{
|
||||||
|
switch (installationMode()) {
|
||||||
|
case InstallationModeSilent:
|
||||||
|
case InstallationModeSilentAndUser:
|
||||||
|
installRemotePackageSilently();
|
||||||
|
break;
|
||||||
|
case InstallationModeUser:
|
||||||
|
installRemotePackageByUser();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Launcher::handleInstallPackageFinished(const TrkResult &result)
|
void Launcher::handleInstallPackageFinished(const TrkResult &result)
|
||||||
{
|
{
|
||||||
if (result.errorCode()) {
|
if (result.errorCode()) {
|
||||||
|
if( installationMode() == InstallationModeSilentAndUser
|
||||||
|
&& d->m_currentInstallationStep & InstallationModeSilent ) {
|
||||||
|
installRemotePackageByUser();
|
||||||
|
return;
|
||||||
|
}
|
||||||
emit canNotInstall(d->m_installFileName, result.errorString());
|
emit canNotInstall(d->m_installFileName, result.errorString());
|
||||||
disconnectTrk();
|
disconnectTrk();
|
||||||
return;
|
return;
|
||||||
|
@@ -51,6 +51,13 @@ class SYMBIANUTILS_EXPORT Launcher : public QObject
|
|||||||
public:
|
public:
|
||||||
typedef void (Launcher::*TrkCallBack)(const TrkResult &);
|
typedef void (Launcher::*TrkCallBack)(const TrkResult &);
|
||||||
|
|
||||||
|
enum InstallationMode {
|
||||||
|
InstallationModeSilent = 0x1,
|
||||||
|
InstallationModeUser = 0x2,
|
||||||
|
InstallationModeSilentAndUser = InstallationModeSilent|InstallationModeUser
|
||||||
|
//first attempt is silent and if it fails then the user installation is launched
|
||||||
|
};
|
||||||
|
|
||||||
enum Actions {
|
enum Actions {
|
||||||
ActionPingOnly = 0x0,
|
ActionPingOnly = 0x0,
|
||||||
ActionCopy = 0x1,
|
ActionCopy = 0x1,
|
||||||
@@ -87,8 +94,12 @@ public:
|
|||||||
void setInstallFileName(const QString &name);
|
void setInstallFileName(const QString &name);
|
||||||
void setCommandLineArgs(const QStringList &args);
|
void setCommandLineArgs(const QStringList &args);
|
||||||
bool startServer(QString *errorMessage);
|
bool startServer(QString *errorMessage);
|
||||||
|
void setInstallationMode(InstallationMode installation);
|
||||||
void setVerbose(int v);
|
void setVerbose(int v);
|
||||||
void setSerialFrame(bool b);
|
void setSerialFrame(bool b);
|
||||||
|
|
||||||
|
InstallationMode installationMode() const;
|
||||||
|
|
||||||
bool serialFrame() const;
|
bool serialFrame() const;
|
||||||
// Close device or leave it open
|
// Close device or leave it open
|
||||||
bool closeDevice() const;
|
bool closeDevice() const;
|
||||||
@@ -185,6 +196,8 @@ private:
|
|||||||
void copyFileToRemote();
|
void copyFileToRemote();
|
||||||
void copyFileFromRemote();
|
void copyFileFromRemote();
|
||||||
void installRemotePackageSilently();
|
void installRemotePackageSilently();
|
||||||
|
void installRemotePackageByUser();
|
||||||
|
void installRemotePackage();
|
||||||
void startInferiorIfNeeded();
|
void startInferiorIfNeeded();
|
||||||
void handleFinished();
|
void handleFinished();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user