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;
|
||||
bool m_closeDevice;
|
||||
CrashReportState m_crashReportState;
|
||||
Launcher::InstallationMode m_installationMode;
|
||||
Launcher::InstallationMode m_currentInstallationStep;
|
||||
};
|
||||
|
||||
LauncherPrivate::LauncherPrivate(const TrkDevicePtr &d) :
|
||||
m_device(d),
|
||||
m_state(Launcher::Disconnected),
|
||||
m_verbose(0),
|
||||
m_closeDevice(true)
|
||||
m_closeDevice(true),
|
||||
m_installationMode(Launcher::InstallationModeSilentAndUser),
|
||||
m_currentInstallationStep(Launcher::InstallationModeSilent)
|
||||
{
|
||||
if (m_device.isNull())
|
||||
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)
|
||||
{
|
||||
d->m_startupActions = Actions(d->m_startupActions | startupActions);
|
||||
@@ -204,7 +213,6 @@ bool Launcher::serialFrame() const
|
||||
return d->m_device->serialFrame();
|
||||
}
|
||||
|
||||
|
||||
bool Launcher::closeDevice() const
|
||||
{
|
||||
return d->m_closeDevice;
|
||||
@@ -215,6 +223,11 @@ void Launcher::setCloseDevice(bool c)
|
||||
d->m_closeDevice = c;
|
||||
}
|
||||
|
||||
Launcher::InstallationMode Launcher::installationMode() const
|
||||
{
|
||||
return d->m_installationMode;
|
||||
}
|
||||
|
||||
bool Launcher::startServer(QString *errorMessage)
|
||||
{
|
||||
errorMessage->clear();
|
||||
@@ -291,7 +304,7 @@ void Launcher::handleConnect(const TrkResult &result)
|
||||
if (d->m_startupActions & ActionCopy)
|
||||
copyFileToRemote();
|
||||
else if (d->m_startupActions & ActionInstall)
|
||||
installRemotePackageSilently();
|
||||
installRemotePackage();
|
||||
else if (d->m_startupActions & ActionRun)
|
||||
startInferiorIfNeeded();
|
||||
else if (d->m_startupActions & ActionDownload)
|
||||
@@ -678,7 +691,7 @@ void Launcher::handleFileCopied(const TrkResult &result)
|
||||
if (result.errorCode())
|
||||
emit canNotCloseFile(d->m_copyState.destinationFileName, result.errorString());
|
||||
if (d->m_startupActions & ActionInstall)
|
||||
installRemotePackageSilently();
|
||||
installRemotePackage();
|
||||
else if (d->m_startupActions & ActionRun)
|
||||
startInferiorIfNeeded();
|
||||
else if (d->m_startupActions & ActionDownload)
|
||||
@@ -847,15 +860,45 @@ void Launcher::copyFileFromRemote()
|
||||
void Launcher::installRemotePackageSilently()
|
||||
{
|
||||
emit installingStarted();
|
||||
d->m_currentInstallationStep = InstallationModeSilent;
|
||||
QByteArray ba;
|
||||
ba.append('C');
|
||||
appendString(&ba, d->m_installFileName.toLocal8Bit(), TargetByteOrder, false);
|
||||
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)
|
||||
{
|
||||
if (result.errorCode()) {
|
||||
if( installationMode() == InstallationModeSilentAndUser
|
||||
&& d->m_currentInstallationStep & InstallationModeSilent ) {
|
||||
installRemotePackageByUser();
|
||||
return;
|
||||
}
|
||||
emit canNotInstall(d->m_installFileName, result.errorString());
|
||||
disconnectTrk();
|
||||
return;
|
||||
|
@@ -51,6 +51,13 @@ class SYMBIANUTILS_EXPORT Launcher : public QObject
|
||||
public:
|
||||
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 {
|
||||
ActionPingOnly = 0x0,
|
||||
ActionCopy = 0x1,
|
||||
@@ -87,8 +94,12 @@ public:
|
||||
void setInstallFileName(const QString &name);
|
||||
void setCommandLineArgs(const QStringList &args);
|
||||
bool startServer(QString *errorMessage);
|
||||
void setInstallationMode(InstallationMode installation);
|
||||
void setVerbose(int v);
|
||||
void setSerialFrame(bool b);
|
||||
|
||||
InstallationMode installationMode() const;
|
||||
|
||||
bool serialFrame() const;
|
||||
// Close device or leave it open
|
||||
bool closeDevice() const;
|
||||
@@ -185,6 +196,8 @@ private:
|
||||
void copyFileToRemote();
|
||||
void copyFileFromRemote();
|
||||
void installRemotePackageSilently();
|
||||
void installRemotePackageByUser();
|
||||
void installRemotePackage();
|
||||
void startInferiorIfNeeded();
|
||||
void handleFinished();
|
||||
|
||||
|
Reference in New Issue
Block a user