Difference between revisions of "Adding an entry to the Create New menu/da"

Jump to: navigation, search
(Created page with "Åbn denne fil og kopiér følgende indhold til den:")
(Created page with "Udfyld disse felter således: * '''Name''' er den tekst, som optræder i menuen <menuchoice>Opret ny</menuchoide>. *: Image:CustomCreateNewMenuEntry.png *: "Custom Entry" ...")
Line 25: Line 25:
 
</source>
 
</source>
  
Fill these fields as follows:
+
Udfyld disse felter således:
* '''Name''' is the text that appears in the '''Create New''' menu.
+
* '''Name''' er den tekst, som optræder i menuen <menuchoice>Opret ny</menuchoide>.
 
*: [[Image:CustomCreateNewMenuEntry.png]]
 
*: [[Image:CustomCreateNewMenuEntry.png]]
*: "Custom Entry" is the value of the '''Name''' field.
+
*: "Custom Entry" er værdien hørende til feltet '''Name'''.
  
 
* '''Comment''' is the label for the new name of files of this type. When you select your custom entry in the '''Create New''' 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''' is the label for the new name of files of this type. When you select your custom entry in the '''Create New''' 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.

Revision as of 05:06, 20 October 2014

Other languages:
dansk • ‎English • ‎français • ‎português do Brasil • ‎українська
CustomCreateNewMenuEntry.png Vejledning som beskriver, hvordan man føjer et punkt til menuen Opret ny i en filbrowser som Dolphin eller Konqueror

Punkterne i menuen Opret ny kaldes skabeloner. De er enten defineret for hele systemet i /usr/share/templates eller for den enkelte bruger i ~/.kde4/share/templates. I denne vejledning vil vi føje en ny skabelon til ~/.kde4/share/templates.

Definition af metadata

Opret mappen templates i ~/.kde4/share hvis den ikke allerede eksisterer og gå til denne mappe.

I denne mappe oprettes en ny fil med filendelsen .desktop; for eksempel tilpasset-fil.desktop.

Åbn denne fil og kopiér følgende indhold til den:

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

Udfyld disse felter således:

  • Name er den tekst, som optræder i menuen Opret ny</menuchoide>.
    [[Image:CustomCreateNewMenuEntry.png]]
    "Custom Entry" er værdien hørende til feltet '''Name'''.
  • '''Comment''' is the label for the new name of files of this type. When you select your custom entry in the '''Create New''' 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.
    [[Image:CustomCreateNewMenuEntryComment.png]]
    "New custom entry:" is the value of the '''Comment''' field.
  • '''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}}.
  • '''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 {{Path|/usr/share/icons/&lt;theme&gt;/&lt;size&gt;/mimetypes/}}. For example, to use {{Path|/usr/share/icons/&lt;theme&gt;/&lt;size&gt;/mimetypes/application-vnd.oasis.opendocument.text.png}}, fill '''Icon''' with "application-vnd.oasis.opendocument.text".

This is an example of a filled {{Path|.desktop}} file:

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

=== 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 {{Path|.desktop}} file with the form "Field[language code]=Value" for each language that you want to support. For example:

<source lang="ini"> [Desktop Entry] Name=Custom Entry Name[ca]=Entrada personalitzada Name[gl]=Entrada personalizada </source>

== Defining the content ==

Create a {{Path|.source}} folder in {{Path|~/.kde4/share/templates}} if such a folder does not exist already, and enter the hidden {{Path|.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.

[[Category:Tutorials]]


Content is available under Creative Commons License SA 4.0 unless otherwise noted.