Adding an entry to the Create New menu/pt-br: Difference between revisions

From KDE UserBase Wiki
(Created page with "Preencha esses campos conforme abaixo: * '''Name''' é o texto que aparece no menu <menuchoice>Criar novo</menuchoice>. *: Image:CustomCreateNewMenuEntry.png *: "Custom En...")
(Created page with "* '''Comment''' é a legenda para indicação do nome dos novos arquivos desse tipo. Quando selecionar seu item personalizado no menu <menuchoice>Criar novo</menuchoice>, apar...")
Line 30: Line 30:
*: "Custom Entry" é o conteúdo do campo '''Name'''.
*: "Custom Entry" é o conteúdo do campo '''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''' é a legenda para indicação do nome dos novos arquivos desse tipo. Quando selecionar seu item personalizado no menu <menuchoice>Criar novo</menuchoice>, aparecerá uma caixa de diálogo que solicita o nome do seu novo arquivo. Esse texto será a legenda do campo onde você deverá digitar o nome.
*: [[Image:CustomCreateNewMenuEntryComment.png]]
*: [[Image:CustomCreateNewMenuEntryComment.png]]
*: "New custom entry:" is the value of the '''Comment''' field.
*: "New custom entry:" é o conteúdo do campo '''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 02:38, 25 July 2015

Other languages:
Tutorial que descreve como adicionar um item ao menu Criar novo dos gerenciadores de arquivos, como o Dolphin ou o Konqueror

Os itens do menu Criar novo são chamados de templates. Eles são definidos de forma global no sistema em /usr/share/templates ou apenas para o usuário em ~/.kde4/share/templates. Neste tutorial nós mostraremos como adicionar um novo template em ~/.kde4/share/templates.

Definição dos metadados

Crie uma pasta chamada templates em ~/.kde4/share, caso esta pasta ainda não existir. Depois, entre na pasta templates.

Nessa pasta, crie um novo arquivo com a extensão .desktop. Por exemplo: arquivo-personalizado.desktop.

Abra este arquivo e cole o conteúdo a seguir dentro dele:

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

Preencha esses campos conforme abaixo:

  • Name é o texto que aparece no menu Criar novo.
    "Custom Entry" é o conteúdo do campo Name.
  • Comment é a legenda para indicação do nome dos novos arquivos desse tipo. Quando selecionar seu item personalizado no menu Criar novo, aparecerá uma caixa de diálogo que solicita o nome do seu novo arquivo. Esse texto será a legenda do campo onde você deverá digitar o nome.
    "New custom entry:" é o conteúdo do campo 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.