Adding an entry to the Create New menu/fr: Difference between revisions

From KDE UserBase Wiki
(Created page with "Remplissez les champs de la manière suivante : * '''Name''' est le texte qui apparaîtra dans le menu <menuchoice>Create New</menuchoice>. *: Image:CustomCreateNewMenuEntr...")
(Created page with "* '''Comment''' est l’étiquette pour les nouveaux noms de fichiers de ce type. Quand vous sélectionnez votre entrée dans le menu <menuchoice>Create New</menuchoice>, une...")
Line 30: Line 30:
*: "Custom Entry" est la valeur du champ '''Name'''.
*: "Custom Entry" est la valeur du champ '''Name'''.


* '''Comment''' is the label for the new name of files of this type. When you select your custom entry in the <menuchoice>Create New</menuchoice> menu, a dialog shows up asking you for the name of your new file, and this text is the label of the field where you enter this new name.
* '''Comment''' est l’étiquette pour les nouveaux noms de fichiers de ce type. Quand vous sélectionnez votre entrée dans le menu <menuchoice>Create New</menuchoice>, une boîte de dialogue apparaît vous demandant le nom de votre nouveau fichier, et ce texte est l’étiquette du champ où vous entrez ce nouveau nom.
*: [[Image:CustomCreateNewMenuEntryComment.png]]
*: [[Image:CustomCreateNewMenuEntryComment.png]]
*: "New custom entry:" is the value of the '''Comment''' field.
*: "New custom entry:" est la valeur du champ '''Comment'''.


* '''URL''' is the path to a file containing the initial content that new files of this type have. These files with the initial content are usually located within the hidden {{Path|.source}} folder of the {{Path|templates}} folder, so use a relative path that starts with {{Path|.source/}}, such as {{Path|.source/custom-entry.txt}}.
* '''URL''' is the path to a file containing the initial content that new files of this type have. These files with the initial content are usually located within the hidden {{Path|.source}} folder of the {{Path|templates}} folder, so use a relative path that starts with {{Path|.source/}}, such as {{Path|.source/custom-entry.txt}}.

Revision as of 16:58, 8 May 2016

Tutoriel qui décrit comment ajouter une entrée au menu Créer un nouveau des navigateurs de fichiers tels que Dolphin ou Konqueror

Les entrées du menu Créer un nouveau sont appelés des templates. Ils sont définis au niveau du système, dans /usr/share/templates, ou seulement pour l'utilisateur courant, dans ~/.kde4/share/templates. Dans ce tutoriel, nous allons ajouter un nouveau template dans ~/.kde4/share/templates.

Définir les métadonnées

Créez un dossier templates dans ~/.kde4/share si un tel dossier n’existe pas , et entrez dans le dossier templates.

Dans ce dossier, créez un nouveau fichier avec l’extension .desktop. Par exemple : custom-file.desktop.

Ouvrez ce nouveau fichier et coller le contenu suivant à l’intérieur :

[Desktop Entry]
Name=
Comment=
Type=Link
URL=
Icon=

Remplissez les champs de la manière suivante :

  • Name est le texte qui apparaîtra dans le menu Create New.
    "Custom Entry" est la valeur du champ Name.
  • Comment est l’étiquette pour les nouveaux noms de fichiers de ce type. Quand vous sélectionnez votre entrée dans le menu Create New, une boîte de dialogue apparaît vous demandant le nom de votre nouveau fichier, et ce texte est l’étiquette du champ où vous entrez ce nouveau nom.
    "New custom entry:" est la valeur du champ Comment.
  • URL is the path to a file containing the initial content that new files of this type have. These files with the initial content are usually located within the hidden .source folder of the templates folder, so use a relative path that starts with .source/, such as .source/custom-entry.txt.
  • Icon is the code of the icon that appears in the Create New menu for your custom entry. The code is the filename of the icon to use. You can browse MIME type icon files at /usr/share/icons/<theme>/<size>/mimetypes/. For example, to use /usr/share/icons/<theme>/<size>/mimetypes/application-vnd.oasis.opendocument.text.png, fill Icon with "application-vnd.oasis.opendocument.text".

This is an example of a filled .desktop file:

[Desktop Entry]
Name=Custom Entry
Comment=New custom entry:
Type=Link
URL=.source/custom-entry.txt
Icon=application-vnd.oasis.opendocument.text

Translating the Name and Comment

The Name and Comment fields can be translated to any language. To provide a translation, include a new field in your .desktop file with the form "Field[language code]=Value" for each language that you want to support. For example:

[Desktop Entry]
Name=Custom Entry
Name[ca]=Entrada personalitzada
Name[gl]=Entrada personalizada

Defining the content

Create a .source folder in ~/.kde4/share/templates if such a folder does not exist already, and enter the hidden .source folder.

Create a new file with the same filename that you defined in the URL field of the metadata of your new entry, and fill the file with the default content that you want for new files created with your new entry.