[kde-linux] Konqueror: "Create new" [SOLVED]

Robert Morrison orbert at orbert.net
Sat Jan 7 22:37:15 UTC 2006


On Saturday 07 January 2006 14:40, Thomas McGuire wrote:
> Hi,
> 
> On Saturday 07 January 2006 20:55, Robert Morrison wrote:
> > In Konqueror, right-clicking in a directory window
> > brings up a dialog with (among other things) a "Create
> > new" option. Selecting that option brings up another
> > dialog with (among other things) a list of file types:
> > e.g. "Text file" and "HTML file". Can anyone tell me:
> >
> > a) What determines the contents of a file created
> > this way? How can I change it?
> Look in path_to_kde/share/templates, there is a list of desktop files, for 
> example TextFile.desktop. That desktop files contains a line which points to 
> another file which determines the content of the new file 
> (.source/TextFile.txt).

Great! I was able to remove that _annoying_ space in front
of the newline in new text files.

> > b) What is involved in adding a new file type to
> > this list?
> My guess is adding new desktop & content files to the templates directory, 
> either in path_to_kde/share/templates for global templates 

That worked. Specifically:

1) Copy an existing "XXX.desktop" file:

  $ cd /opt/kde3/share/templates/
  $ cp HTMLFile.desktop HTMLFile2.desktop

2) Edit 2 lines in the new file.

(WARNING: these files are UTF-8. If you edit them in 
an editor that doesn't save UTF-8 correctly, non-ASCII 
characters may not be saved properly. I used vi and
it worked ok.)

The lines that need to be edited are:

2a) The prompt that will be displayed in
the "create new" dialog.

For English, this is the line that starts with:

   Name=

For other languages, look for "Name[xx]=",
where "xx" is the language code.

In my case, it was line 3 of the file.

2b) The pointer to the file used for the template.

This is near the bottom of the file: in my case,
it was:

URL=.source/HTMLFile.html

and I changed it to:

URL=.source/HTMLFile2.html

3) Create the file you specified in step 2b and 
put whatever you want to into it.

> or in  
> $HOME/.kde/share/templates for user-specific templates. 
> I have not tried that  myself though.

That worked! I created ~/.kde/share/templates and
~/.kde/share/templates/.source, copied a .desktop
file and edited as above, created a new file in
.source and the new filetype was added to the menu.

> Hope that helps,
> Thomas

Indeed! Many thanks.

Robert




More information about the kde-linux mailing list