Installer framework CreateDesktopEntry help.



  • I'm trying to create a desktop entry using a script file with the installer framework but not working.

    Here is the content of the script file:

    function Component() {
        installer.finishButtonClicked.connect(this, Component.prototype.installationFinished);
    }
    
    Component.prototype.createOperations = function() {
        component.createOperations();
    }
    
    Component.prototype.installationFinished = function() {
        try {
            if (installer.isInstaller() && installer.status == QInstaller.Success) {
                component.addOperation("CreateDesktopEntry", 
                                      "@HomeDir@/.local/share/applications/Cumulus.desktop", 
                                      "Type=Application\n
                                      Terminal=false\n
                                      Exec=@TargetDir@/Cumulus\n
                                      Name=Cumulus\n
                                      Icon=@TargetDir@/cumulus.svg");
                component.addOperation("Copy", "@HomeDir@/.local/share/applications/Cumulus.desktop", "@HomeDir@/Desktop/Cumulus.desktop");
                QDesktopServices.openUrl("file:///" + installer.value("TargetDir") + "/InstallationLog.txt");
            }
        } catch(e) {
            console.log(e);
        }
    }
    

    The script runs and no error is logged, when finishing the InstallationLog.txt opens and is there to confirm that the script is runing.
    I have also tried copying a file from within installation using Copy operation but not working at all either.



  • It's strange as addOperation doesn't work when inside installationFinished , i had to put it under createOperations and remove the if condition.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.