summaryrefslogtreecommitdiffstats
path: root/deploy/installer/controlscript.qs
blob: a53c3e99e6f04ac0902b772b66a494582def5b65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
 * Source: http://stackoverflow.com/questions/21389105/qt-installer-framework-offline-update-how
 */

function Controller()
{
}

Controller.prototype.TargetDirectoryPageCallback = function()
{
    var widget = gui.currentPageWidget();
    widget.TargetDirectoryLineEdit.textChanged.connect( this, Controller.prototype.targetChanged );
    Controller.prototype.targetChanged( widget.TargetDirectoryLineEdit.text );
}

Controller.prototype.targetChanged = function( text )
{
    if( text != "" && installer.fileExists(text + "/components.xml") )
	{
        if( QMessageBox.question("PreviousInstallation", "Previous installation detected", "Do you want to uninstall the previous installation?", QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes )
		{
            installer.execute( text+"/maintenancetool.exe", new Array("--script", text+"/uninstall.qs") )
		}
    }
}