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

From KDE UserBase Wiki
(Created page with "Відкрийте цей новий файл і вставте до нього такі рядки:")
(Created page with "== Визначення вмісту ==")
Line 60: Line 60:
</source>
</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 {{Path|.source}} folder in {{Path|~/.kde4/share/templates}} if such a folder does not exist already, and enter the hidden {{Path|.source}} folder.

Revision as of 17:47, 11 September 2014

Other languages:
У цьому підручнику описано процедуру додавання пункту до меню «Створити» програм для керування файлами, зокрема Dolphin та Konqueror.

Пункти меню Створити називаються шаблонами. Ці шаблони визначаються або на загальносистемному рівні, у каталозі /usr/share/templates, або на рівні поточного користувача, у каталозі ~/.kde4/share/templates. У цьому підручнику ми опишемо процес додавання нового шаблону до каталогу ~/.kde4/share/templates.

Визначення метаданих

Створіть теку templates у каталозі ~/.kde4/share, якщо такої теки ще не існує, і увійдіть до теки templates.

У цій теці створіть новий файл із суфіксом назви .desktop. Приклад: custom-file.desktop.

Відкрийте цей новий файл і вставте до нього такі рядки:

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

Fill these fields as follows:

  • Name is the text that appears in the Create New menu.
    "Custom Entry" is the value of the Name field.
  • 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.
    "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 .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

Визначення вмісту

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.