Couldn't find this covered here yet, and thought it might be helpful.
To create a new entry in the "create new" menu, you just need two files in the right places.
Below, typewriter text is used to show a file or directory (folder).
What you need:
1) .desktop file
Desktop files are plain text files that desktop programs use for information and actions. In this case, Konqueror and Dolphin use the desktop files to create the right click menu.
For this tutorial, we will use Main_Document.desktop, "Main_Document" because that is the name of my default template for new OpenOffice.org documents. The code for Main_Document.desktop is below. Just copy it and paste it into a plain text document in Kate or Kwrite, and save as Main_Document.desktop.
Comment=New ODF Document:
The lines of the file are fairly easy to understand, but don't worry to much about what each line means. The most important one is the URL line. It must show the location of your template file. (more on that below)
Also, some of the information in the desktop file can be changed through the properties dialog in Dolphin or Konqueror. (Right click => Properties, on the .desktop file and look through the tabs. For example, click the icon in the "General" tab to change the icon, then reopen the file in Kate and automagically, the Icon line is updated.)
2) template file
The template file is the "new" file you want to create. It can be any file. The screen shot shows that I added two OpenOffice.org entries (APA_Document and Main_Document) and one LaTeX entry (LaTeX_APA) to my "create new" menu. Each entry has a corresponding template file.
For this tutorial, I will use main.odt, a document created with my main template (in OpenOffice.org) and saved. You can use any file you want. We will talk about how to customize the desktop file for different kinds of files later.
To add your file to the "create new" menu:
Put Main_Document.desktop into ~/.kde4/share/templates
(create the directory templates if it doesn't already exist)
Inside the templates directory, create a hidden directory named .source (notice the period/full stop at the start of the name - that makes it hidden). Put your new file in .source. So, on my machine I put main.odt into the .source directory.
Maybe you don't want main.odt. Perhaps you need a spreadsheet for monthly expenses. After you set up the spreadsheet once, put a copy in .source and change the URL line in the desktop file to the name of your spreadsheet file. (And you may want to change the icon as well. Your new desktop file might be monthly-expenses.desktop :
Comment=New ODF Spreadsheet:
That is all there is to it.
The easiest way to create more entries is to copy the desktop file and rename the copy, and then edit it to point to your new template file. I find Kate easiest, but the Properties GUI works too, especially for changing the icon.
In the desktop files, there is no need for the underscores in the Name fields. I did that originally just to be safe, but you don't need them, spaces are OK.
When you create a new file with the right click menu, don't forget to type the extension for the file type. (Assuming you want one.) The template file might be main.odt, but when you create the file and Dolphin asks for a name, you need to type the .odt (or .txt or .jpg, or whatever) part at the end of the name you give the new file.
This works on KDE 3 and KDE 4, just use the appropriate kde directory.
[attachment deleted by admin]