<!doctype linuxdoc system>

<!-- The KFM Handbook.

 -->

<article>

<!-- Title information -->

<title>The KFM Handbook
<author>The KDE Team
<date>Version 0.1, 5 June 1998
<abstract>This Handbook describes KFM 1.83

<!-- Table of contents -->
<toc>

<!-- Begin the document -->


<sect>Introduction<p>

KFM is KDE's file manager. At the
same time it is a full featured web browser, ftp client
and tar archive utility and it acts as a server for
other KDE applications, since it offers its network service
that make up KDE's network transparent file access.

<tt>Torben Weis</tt>
<p>
<htmlurl url="mailto:weis@kde.org" name="weis@kde.org">
<p>


<sect>Philosophy<p>

<sect1>Desktop<p>

The desktop metaphor< is very important for KFM.
Many filemanagers in the UNIX world
work only in their windows. But KFM gives you a Desktop like OS/2, Apple and
( I hate to say it ) Win NT/95. Files on the desktop work like the ones
in the windows.
Since KFM supports drag and drop it is a good idea to use the Desktop for
storing some temporary things. On the other hand it is always nice to have
some important icons always handy on the Desktop. Well, just do what you want


<sect1>Templates<p>

Templates have been introduced by OS/2. KFM has some - not really that
powerful but never the less nice - feature to support them. All files in the
Templates directory are supposed to be templates ( I think you would not have
guessed that! ). Move for example an template for a Lyx letter in here, or a
default Makefile or whatever. Even complete directory structures may act as
templates. If for example a project you start always has the same directory
structure, you can create such a structure in the templates directory. Then
you change to the directory where you want to have a new
document/project/what-ever. Open the Menu <tt>File</tt> and there the
submenu <tt>New</tt> and you will get a list of all installed
templates. Just select one to create it. This way you can create
directories, too. The idea is simple but useful.
<P>

<sect1>*.kdelnk files<p>

These files are important for KFM and kpanel and the whole KDE project.
Such a file can do very much for you. For example it can hold an URL or a
device or may stand for a program. Using such a file you can mount/unmount
devices, make links to URLs on your desktop or just create a nice icon
represantation for an executable. Read the section 'Usage'
to learn more about these files and what they can do for you.
You dont need to know how the files are structured,
because KFM has nice dialogs for you, so you can click some <TT>*.kdelnk
</TT> files in existence very easy. If you drag for example a URL pointing to
<TT>ftp://ftp.kde.org</TT> on your desktop, KFM will create such a file for
you. Clicking on it will open a FTP connection for you.


<sect1>Internet<p>

The Internet is very important for KFM, too, because it could be called an
internet desktop. It uses FTP and HTTP. This means that KFM makes no big
differences between files on some FTP server or on your local hard disk. Since
KFM uses HTML to show its output it has no problem with HTML pages. This means
that you can follow HTML links like you would do with your browser. Indeed KFM
acts like a Web-Browser many times. It is indeed a Web-Browser with integrated
file management. The HTML widget is not perfect yet, so some HTML pages are
ugly, but it is getting better all the time. As a result of the above KFM
uses URLs instead of usual file names ( of course you can use your old
fashioned file names, too ). KFM supports an extension to usual URLs. It
features subprotocols. Ususally the user does not have to deal with them, he
may still click around with the mouse. For example <TT>ftp://ftp.cdrom.com/unix/kde.tgz#tar:/kdebase/kfm/main.cpp
</TT> is a valid URL. It defines a tar file on an ftp server and references
some file in the tar archive. Clicking on some tar archive will do the job for you.



<sect1>Multi Tasking<p>

KFM is highly multi tasking. It has some slave processes running that do
the IO stuff. This means that no IO can block your desktop. This is especially
important for the Internet. You know that even Netscape can lock up for some
seconds. KFM does not have this problem any more. It just locks up if you found
a bug.

<sect1>Look<p>

KFM gives you control over the look of your directories. If it finds a
<tt>.kde.html</tt> or <tt>index.html</tt> file in your directory it displays
it ( can be turned
off ). There are some HTML extensions that allow you to separate for example
directories and documents on such a HTML page. You need not write a link for
every file in the HTML page. The HTML extension helps you very much here.
Instead of writing a complete HTML page you can select a background
color/image for some directories and change the color of the font. You may
give executables and directories special icons. Those icon settings are
recognized by kpanel, too. For more details see as usual the
section 'Usage' in the handbook.
<P>




<sect>Usage<p>

<sect1>Keyboard shortcuts<p>
<tscreen><verb>
Back in History                                 ALT + Left
Forward in History                              ALT + Right
One directory up                                ALT + Up
Open a file/directory                           Return
Open a popupmenu for the current file           ESC
Move among the icons                            Left/Right/Up/Down
Select/Unselect file                            Space
Scroll up fast                                  Page Up
Scroll down fast                                Page Down
Scroll right (on WWW pages)                     Right
Scroll left  (on WWW pages)                     Left
Scroll up    (on WWW pages)                     Up
Scroll down  (on WWW pages)                     Down
Copy selected file to clipboard                 CTRL + C
Paste files from clipboard to current directory CTRL + V
Select files by pattern                         CTRL + S
Open a terminal in the current directory        CTRL + T
Open new location                               CTRL + L
Find files                                      CTRL + F
Close window                                    CTRL + W
</verb></tscreen>


<sect1>How to install new data types<p>

<sect2>What are data types<p>

A file contains only bits and bytes. One must know how
to interprete them to give them a meaning. A usual method
to archive this is to look at the filename. If it ends
with <tt>.gif</tt> for example, you assume that it is a
GIF image. That's what most desktop environments (further on
called DE) do. KFM does this, too, since it is very fast, but
not convenient. If the extension is not available one does
not know of which data type the file is and that means in turn
that KFM does not know which appliaction can deal with the data.
So if KFM can not figure out the data type by extension it will have
a look in the first bytes of the file and lookup some stuff
in its magic file. This is called
automatic-mime-type-detection-magic and works quite nice.
So if the datatype has an entry in the magic file
<tt>$KDEDIR/share/mimelnk/magic</tt>, then KFM would
know that the file <tt>MyGirlFriend</tt> contains an image.

<p>
You must register data types in KFM. This poor little
helper of yours must know common extensions of this data type,
an icon, some descriptive text, perhaps a default application
( we will learn more about this later ) and the mime type.

<sect2>What is a Mime Type<p>

Mime types are an internet standard. This standard is a naming
scheme for data types. A data types name is devided in two sections.
The first one tells about the general kind of data ( image, video,
audio, text ... ) and since there are different kinds of text
( C-sources, english text, ... ) and different formats for saving
images and so on, the second part tells abou the special format.
A good example is <tt>image/gif</tt>. The first part tell,
its an image and the second one tells, it is saved in GIF format.

<p>
If you are not shure about the correct mime type, then have a look
at the magic file, many many mime types are already registered there.

<p>
Usually this chapter is only of interest for system maintainers and
application developers. A proper installed KDE should come with all
this stuff already done, but some people always want to know how stuff
works, so here we go.

<p>
The directory <tt>$KDEDIR/share/mimelnk</tt> contains many subdirectories
which correspond to the first section of the mime type names. For example
our example <tt>image/gif</tt> is represented by a file named
<tt>$KDEDIR/share/mimelnk/image/gif.kdelnk</tt>. Every KFM config file
has the <tt>.kdelnk</tt> extension. Sometimes KFM hides this extension, since
it does not look very nice.

<p>
You will find out sooner or later that the directory structure
in your global KDE directory is the same as the one in your
<tt>~/.kde</tt> directory. As sysadmin on your local Linux box,
you may usually want to edit the global configuration, while a user
at the universities UNIX cluster may only edit his personal
configuration. Everything we say about the <tt>$KDEDIR</tt> directory
here, applies to the <tt>~/.kde</tt> directory, too. To edit the
global config files in <tt>$KDEDIR</tt> you need a super users password,
for the personal stuff of course not.


<sect2>Internals<p>
The config files are very simple and of course human readable.
You can have a look at it here:

<tscreen><verb>
# KDE Config File
[KDE Desktop Entry]
Type=MimeType
MimeType=image/gif
Icon=image.xpm
Patterns=*.gif;*.GIF;
Comment=Gif images
Comment[de]=GIF Dokument
Comment[nl]=Gif afbeelding
</verb></tscreen>


<p>
You dont need to understand what this means, since KFM provides a GUI
for you, that makes things much easier. Hackers never the less
want to know and hack everything, so here is a brief description.

<p>
The first line is the header of every KDE config file.
The <tt>Type</tt>line is included in every KFM config file to
distinguish the purpose of the config file. This is followed
by the mime types name, the icon, a <tt>;</tt> separated list
of patterns and comments in english, german, ...

<p>
Now the hackers may leave this lesson.

<sect1>How to install a new application<p>

Every KDE application should come with its configuration
files so there is no need for the user to edit them. But unless
every distribution is KDE ready you may want to configure
existing applications to work with KDE. In this lesson we
try to install XV in the K Desktop Environment.<p>

<sect2>Why and where<p>

Every application must put a config file in the directory
tree <tt>$KDEDIR/share/applnk</tt>. In addition you have a local
directory structure in <tt>~/.kde/share/applnk</tt> where you can
install additional apps. These files will only be visible for
you, not for other users. KFM and KPanel scan these
directories on startup. KPanels system menu corresponds to this
directory structure. The icons in this directory behave like
real applications. You can click on them to start the
application and you may drop files on them. It is sometimes
a good idea to have such config files outside the <tt>applnk</tt>
tree. They work in every directory, but only the ones in the
<tt>applnk</tt> directory are scanned in on startup. So if you
want to install for example XV as the default app for images, then
you must move the config file inside this special tree. But perhaps
there are some apps which you dont want to appear in KFM or KPanel
but on your desktop, then you may of course create such config files
on your desktop or elsewhere. The procedure is almost the same as the
one we are describing here.

<p>
If KFM find a file it first tries to find out about its data
type. After doing so it searches all applications which regsitered for this
data type. If none is found the user is prompted. If only one is found
or a default on was specified, KFM will use this one, otherwise KFM will make a
guess. Using the right popup menu will show you a selection of all
applications which registered for this data type.<p>

<sect2>Step by step<p>

You may now continue with the next section while
the hackers and developers may want to learn more internals.

<p>
The config file we want to create will look like this:<p>

<tscreen><verb>
# KDE Config File
[KDE Desktop Entry]
BinaryPattern=xv;
MimeType=image/gif;image/jpeg;image/tiff;image/x-xbm;image/x-xpm;
Comment=XV Image App
Comment[de]=XV Graphik Programm
Exec=xv %f
TerminalOptions=
Icon=image.xpm
Path=
Type=Application
Terminal=0
Name=XV
Name[de]=XV
</verb></tscreen>

<p>
The first line contains some magic bytes and
the second line contains a <tt>;</tt> separated list of names that
the binary of this application may have. This way the binary gets a nice
icon, too. The next line conatins a list of all mime types the app can
handle, followed by the usual comments in different languages.
the <tt>Exec</tt> tag contains the shell quoted command that will
be executed to start the application. The <tt>%f</tt> is going to be replaced
by the documents filenames, but see the next chapter for more details.
The <tt>Type</tt> tag is needed like in every KFM config file. You can
tell KFM to start the app in a terminal by setting <tt>Terminal</tt> to
1 and by setting some terminal options if needed. In addition the
<tt>Path</tt> tag allows you to specify a working directory. The last two
lines determine the name of the applicattion. This name is used in KFMs
context sensitive popup menus for example. As with the comments you must
provide a english version and may supply diffrent translations.<p>


<sect2>Secret tips<p>

Most old style apps may need the <tt>%f</tt> argument. This means that
they can only accept files on the local hard disks. If you use URLs
never the less, KFM will download the files first and start the application
afterwards. If the files are modified by the app, the user is prompted wether
he wants them to be uploaded.

<p>You may enter <tt>%u</tt> instead of <tt>%f</tt>. This will cause KFM to
pass URLs to the application. External files are not preloaded. Some KDE
apps support this cool feature.

<p>
There are addtional tags you may use. Here is a short list:

<itemize>
<item><bf><tt>%k</tt></bf> The path and name of the config file itself.
This is useful if the app you want to start should read/modify the
config file that started it. This way you can for example implement 
simple printer representations. The same file that repesents the
printer on your desktop stores your prefered printer settings. Use <tt>%k</tt>
to pass the config file to the printer GUI.
<item><bf><tt>%n</tt></bf> The filename of the documents without path.
<item><bf><tt>%d</tt></bf> The path of the documents without file name.
The <tt>%d</tt> and the <tt>%n</tt> tag together are the same
as <tt>%f</tt>.
<item><bf><tt>%c</tt></bf> Name of the application. This is the (possibly
translated) title of the application, as set in the kdelnk file. This way you
can set the title of the application.
</itemize>


<sect1>Bookmarks<p>

KFM enlarges the meaning of bookmarks. Bookmarks can refer to every file,
that means apart from HTML pages and FTP directories documents, applications
and <tt>*.kdelnk</tt> files. If a bookmark is selected in KFM, the convenient
action follows; a document is opened, an application is started etc. To add a
file to the collection of bookmarks, you only have to use the right mouse
button on the file and select the entry 'Bookmarks'.<p>

<sect2>Editing Bookmarks<p>

Each bookmark corresponds to a file in $HOME/.kde/share/apps/kfm/bookmarks.
An entry in the bookmarks menu makes it easy to find this directory. Renaming a
bookmark file also changes the bookmark menu immediately. If you open the
properties for such a file, you can configure the bookmark, i.e. for example
change the destination (URL) or the icon. You can move, copy and rename files in
this directory tree as you desire. Please make sure that these files have a
suffix <tt>*.kdelnk</tt>, so that KFM will easily distinguish them from
'normal' files.

<sect2>Bookmark Tree<p>

Creating a new directory in $HOME/.kde/share/apps/kfm/bookmarks will create
a submenu of the bookmark menu at the same time. To add a bookmark to the new
submenu, pop it up. The first entry will add a bookmark for the current
URL.<p>

<sect2>Bookmarks outside KFM<p>

The program krootwm allows the access on the bookmarks. Clicking the right
mouse botton on the background of the desktop makes (besides other stuff) the
bookmark menu appear. Changings on the bookmarks are not immediately applied
to krootwm yet. At the moment you have to restart krootwm to do so.<p>

<sect>Frequently Asked Questions<p>

<sect1>How can I run programs on startup<p>

KFM can do even more. Throw a program, *.kdelnk file, exectuable, directory
or a link to any of them in the <tt>Autostart</tt> folder on your desktop.
The Autostart folder has the path <tt>$HOME/Desktop/Autostart</tt> by
default, but you may have a different setup, since it is configureable. If
KFM finds a kdelnk file, it does what you would epect by clicking on
the file. Throwing a directory in the autostart folder will open a KFM window
with this directory, executables will of course be executed. But you may
put documents! in the autostart folder, too. In this case KFM will start
the default application for this document with the document as argument.
You can use this to start for example the word processor with your master
thesis whenever you login. You may find it useful to put
<tt>kdisplay -init</tt> and <tt>kpanel</tt> in the autostart folder. The
autostart folder can be used as a replacement for <tt>.xinitrc</tt><p>

<sect1>How can I start KFM without any opened window<p>

Many people think that it is annoying that KFM always opens the home
directory. You may start KFM with the option <tt>-d</tt> to avoid this
behaviour.<p>


<sect1>How can I open a new view for a directory<p>

Clicking with the left mouse button will change the directory,
execute an executable or open a document. One click with the right button
opens a menu and a click with the middle button on directories will
open a new window for this directory.<p>

<sect1>How can I select multiple files<p>

Press the CTRL key and click once on every file you want to
select. Pressing the right mouse button now will show you all actions that
apply to all files you selected. This way you could start multiple documents
at once or delete/copy/move a couple of files. If multiple files are selected
and you start a drag then all selected files are dragged.<p>

<sect1>How can I mount a device<p>

To mount a device you first need a *.kdelnk file that describes the
device. If you dont have one already, you must read the 
section 'Usage' in this handbook to see
how to create such files. Once you have done this you may press the right mouse
button over the devices icon. Now you have several mount options. Unmounting
works just like this. Before you can access a device you must mount it first.
Once the device is mounted you can open it with a click. Sometimes
it is possible to mount several file systems. But if the default
one is the correct one, then you may click on the umnounted icon
once and KFM tries to mount the device and will then open a window
to show you the content.<p>

<sect1>How can I print<p>

You can throw a document on the printer icon. Now it is up to your printer
daemon/filter. Usually it only makes sense to throw TeX/DVI/PS/ASCII files on
the printer. Be careful. In the worst case your printer may dump out lots of
papers with the ASCII codes of the document you wanted to print. Dont forget
to open the properties dialog of the printer first to check wether the print
command is ok on your system. If you dont find printer icons on your
desktop the you must consult the section 'Usage' in this handbook.
to see how you can create such a printer icon.<P>

<sect1>How can I link a URL on the desktop<p>

You can link any URL in any place on your hard disk. Open the
<tt>Templates</tt> folder or use the menu <tt>File->New</tt> to copy/create a
new <tt>URL.kdelnk</tt> file or something like this. Open the properties menu
and enter the URL. That's all. If you have a link to this URL in a KFM
window or in any app that supports DND, you may drop the link on every KFM
window or on the desktop. Then click on <tt>Link</tt> in the popup menu
and KFM will create a <tt>*.kdelnk</tt> file for you on the fly.<p>

<sect1>How can I look in a TAR file<p>

You just have to click on the <tt>*.tar.gz *.tar *.tgz</tt> file to
have a look at it. You may now delete files or drag files out of the tar
file. Some apps support loading documents out of tar files. You may for
example use KView to open an image that is located in a tar file.<p>



<sect>Author<p>

My name is Torben Weis. I am a student of computer sciences at the 
University of Frankfurt,
Germany. Feel free to contact me and send me your reports, wishes, some
cookies or whatever. I am a poor student and always hungry!.

<sect>Thanks<p>

KFM would not be what it is without so many people sending me bug reports,
writing patches and extensions and many good ideas. Thanks to you all.
There are some persons which I want to mention in detail:

<itemize>
<item>Martin Jones wrote
most of the HTML widget and is doing the painful job of bug fixing it
and catching up with Netscapes latest broken HTML features.
<item>Fritz Elfert wrote
the automatic mime type detection stuff at KDE-ONE in Arnsberg.
<item>Stephan Kulow did the
automake and autoconf stuff and introduced me to the mysteries
of CVS and is my last help in questions of platform independence.
<item>Stefan Westerfeld rewrote
the kioslave for KFM II.
<item>Claudia Sorg, my
girlfriend, she had to face my bad moods whenever KFM crashed again
and it crashed very often.
</itemize>
<p>

<sect>Copyright<p>
<tscreen><verb>
KFM is Copyright 1997-98 Torben Weis weis@kde.org

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.     

</verb></tscreen>
<p>

</article>
