Projects and resources (En) > Contributing to FOSS

QtShortcut-Creator feedback thread

<< < (2/2)

melodie:
Hi, here is a desktop file:


--- Citer ---[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=volumeicon-alsa
Exec=/usr/bin/volumeicon
--- Fin de citation ---

this one is only to put in the autostart directory, it does not have all entries to be sitting in a regular menu. Here is another one:


--- Citer ---[Desktop Entry]
Encoding=UTF-8
Name=dxtime
Comment=small program for time tracking
Exec=dxtime
Icon=dxtime
Terminal=false
Type=Application
Categories=Utility;

--- Fin de citation ---

this one is in the menus, in the Utility category (fr: Accessoires), and could be copied as is in a autostart directory, or on the desktop of the user. I think this one would be the good example.

djohnston, thanks, but you didn't need to worry. :)

PS: we can also have desktop files which are links to something, such as a link to a web page, ie:


--- Citer ---[Desktop Entry]
Encoding=UTF-8
Icon=text-html
Type=Link
Name=Multi-level Navigation Plugin
URL=http://downloads.wordpress.org/plugin/multi-level-navigation-plugin.zip
[InternetShortcut]
URL=http://downloads.wordpress.org/plugin/multi-level-navigation-plugin.zip
--- Fin de citation ---

So this time "Type" is not application anymore, but Link, and clicking on it will open a web page with the "x-www-browser" application. The icon is default set to text-html by the Firefox plugin "SaveLink" and of course I could change it to something else.

Just to say Type can have Applications as argument, or Link ?


caymus:
Yes, here how this thing work:



//Create the .desktop file

    QString place = ui->comboBox_path->currentText();   //a combobox editable who store path
    QString namedeskfile = ui->lineEdit->text(); //text entry who store name of the .desktop
    QString categorie = ui->comboBox_categ->currentText(); //Non editable combox with various categories entry
    QString name = ui->lineEdit_Name->text(); //text entry box, name into .desktop
    QString comment = ui->lineEdit_Comment->text();   //text entry box, comment
    QString icon = ui->lineEdit_Icon->text();    //text entry box, images path
    QString app = ui->lineEdit_App->text();    //text entry box, executables path

    QFile file(place+"/"+namedeskfile+".desktop");  //QFile manage file manipulation, something like "nano" + (place+"/"+namedeskfile+".desktop") and store all into file from QFile file

    if (file.exists())
    {
        file.remove();  // easy to understand
    }

    file.open(QIODevice::ReadWrite | QIODevice::Text | QIODevice::Append); // file variable is open in read write mode and next
    QTextStream out(&file); // put out value into file value
    out << "[Desktop Entry]\n" << "Encoding=UTF-8\n" << "Type=Application\n" << "Name=" << name << "\n"  << "Icon=" << icon << "\n" << "Exec=" << app << "\n" << "Comment=" << comment << "\n" << "Categories=" << categorie << endl; //"this is static text", "\n" = return, << add something else.

    file.close()


This is the easy part made in 30 minutes, but i need to know all what you need into your file & sort the different types usages and their  compatible/incompatibles options, QString values can be turned on or off by switchs , but i need a good happening everywhere .desktop structure.

Wrong options into the .desktop may make it incompatible inoperative with a particular window manager.

the 2nd that you mention, mélodie is the most compatible, the 3rd I've never tried but it is also possible to make.

By cons there are many other options, but it is likely to be too specific.

melodie:
Hi,

Having the second one would be a great thing and a real progress over the actual Lxshortcut, really!

konaexpress:
Wow guy, you are doing a nice job with this idea. ;D

Navigation

[0] Index des messages

[*] Page précédente

Utiliser la version classique