Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Installer framework CreateDesktopEntry help.
Qt 6.11 is out! See what's new in the release blog

Installer framework CreateDesktopEntry help.

Scheduled Pinned Locked Moved Installation and Deployment
2 Posts 1 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    adutzu89
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      adutzu89
      wrote on last edited by
      #2

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

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved