Results 1 to 4 of 4

Thread: Installer framework CreateDesktopEntry help

  1. #1
    Join Date
    Oct 2013
    Posts
    142
    Thanks
    36
    Thanked 3 Times in 3 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default 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:

    Qt Code:
    1. function Component() {
    2. installer.finishButtonClicked.connect(this, Component.prototype.installationFinished);
    3. }
    4.  
    5. Component.prototype.createOperations = function() {
    6. component.createOperations();
    7. }
    8.  
    9. Component.prototype.installationFinished = function() {
    10. try {
    11. if (installer.isInstaller() && installer.status == QInstaller.Success) {
    12. component.addOperation("CreateDesktopEntry",
    13. "@HomeDir@/.local/share/applications/Cumulus.desktop",
    14. "Type=Application\n
    15. Terminal=false\n
    16. Exec=@TargetDir@/Cumulus\n
    17. Name=Cumulus\n
    18. Icon=@TargetDir@/cumulus.svg");
    19. component.addOperation("Copy", "@HomeDir@/.local/share/applications/Cumulus.desktop", "@HomeDir@/Desktop/Cumulus.desktop");
    20. QDesktopServices.openUrl("file:///" + installer.value("TargetDir") + "/InstallationLog.txt");
    21. }
    22. } catch(e) {
    23. console.log(e);
    24. }
    25. }
    To copy to clipboard, switch view to plain text mode 

    I also have tried the following version for installation Finished:

    Qt Code:
    1. Component.prototype.installationFinished = function() {
    2. var targetDir = installer.value("TargetDir");
    3. var homeDir = installer.value("HomeDir");
    4. var desktopFileTarget = installer.value("HomeDir") + "/.local/share/applications";
    5. try {
    6. if (installer.isInstaller() && installer.status == QInstaller.Success) {
    7. component.addOperation("CreateDesktopEntry",
    8. desktopFileTarget + "/Cumulus.desktop",
    9. "Type=Application\nTerminal=false\nExec= " + targetDir + "/Cumulus\nName=Cumulus\nIcon= " + targetDir + "/cumulus.svg");
    10. QDesktopServices.openUrl("file:///" + installer.value("TargetDir") + "/InstallationLog.txt");
    11. }
    12. } catch(e) {
    13. console.log(e);
    14. }
    15. }
    To copy to clipboard, switch view to plain text mode 

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

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Installer framework CreateDesktopEntry help

    I don't have any know-how on the installer framework, but have you tried a tmp path for the target to see if it could be a path problem?

    Cheers,
    _

    P.S.: $HOME/.local/share is the fallback default value if $XDG_DATA_HOME is not set, so you could end up with a wrong path on systems where that is set to something else

  3. #3
    Join Date
    Oct 2013
    Posts
    142
    Thanks
    36
    Thanked 3 Times in 3 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Installer framework CreateDesktopEntry help

    Hi anda,
    I don't understand what you mean by tmp path, you mean an absolute path for the desktop entry? I have tried that.
    I also tried other operations, if it's not written correctly I get errors otherwise it doesn't fire.......I don't understand what's happening :|


    Added after 15 minutes:


    Appearently Qt Installer Framework doesn't do operations after finish button was clicked.........

    I have modified my script this way:
    Qt Code:
    1. function Component() {}
    2. Component.prototype.createOperations = function() {
    3. component.createOperations();
    4. var targetDir = installer.value("TargetDir");
    5. var homeDir = installer.value("HomeDir");
    6. var desktopFileTarget = installer.value("HomeDir") + "/.local/share/applications";
    7. component.addOperation("CreateDesktopEntry",
    8. "Cumulus.desktop",
    9. "Type=Application\nTerminal=false\nExec= " + targetDir + "/Cumulus\nName=Cumulus\nIcon= " + targetDir + "/cumulus.svg");
    10. component.addOperation("CreateDesktopEntry",
    11. homeDir + "/.config/autostart/Cumulus.desktop",
    12. "Type=Application\nTerminal=false\nExec= " + targetDir + "/Cumulus\nName=Cumulus\nIcon= " + targetDir + "/cumulus.svg");
    13. }
    To copy to clipboard, switch view to plain text mode 

    Makes both Dash entry and autostart on login.
    Last edited by adutzu89; 11th December 2016 at 14:14.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Installer framework CreateDesktopEntry help

    Quote Originally Posted by adutzu89 View Post
    Hi anda,
    I don't understand what you mean by tmp path, you mean an absolute path for the desktop entry?
    Yes, a fixed path, probably in the system temp directory. Something you know exists and is user writable.

    Cheers,
    _

  5. The following user says thank you to anda_skoa for this useful post:

    adutzu89 (14th December 2016)

Similar Threads

  1. How to add icon using QT installer framework
    By romzxlat in forum Newbie
    Replies: 4
    Last Post: 19th February 2016, 10:10
  2. Qt Installer Framework - Check directory
    By papercut87 in forum Qt Programming
    Replies: 1
    Last Post: 6th October 2015, 12:20
  3. Replies: 0
    Last Post: 7th July 2015, 19:59
  4. Installer Framework (IFW 2.0) and Qt5 - errors while make && qmake
    By Charlie37 in forum Installation and Deployment
    Replies: 0
    Last Post: 9th January 2015, 10:23
  5. Qt Installer Framework Styling
    By jmsbc in forum Installation and Deployment
    Replies: 1
    Last Post: 3rd August 2013, 12:33

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.