Write a kioslave for KDE 3.5

From ThorstensHome
Revision as of 10:09, 18 October 2008 by WikiSysop (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This tutorial is written for SUSE 10.3

Understanding

A kioslave is a shared object plus its description. E.g. the imap4 kioslave consist of the following files:

linux-7nj1:/opt/kde3 # find -iname "*imap4*"
./lib/kde3/kio_imap4.so
./lib/kde3/kio_imap4.la
./share/services/imap4.protocol

Where the .la file is only needed if you compile software that depends on it.

create kio_hello

We want to write a "hello world" kioslave, so install kdepim and start its program kode:

linux-7nj1:~/kio # kode --create-kioslave --classname Kio_hello

Verify the program has done something:

linux-7nj1:~/kio # ls
Makefile.am  kio_hello.cpp  kio_hello.h  kio_hello.protocol
linux-7nj1:~/kio # g++ --shared -lkdeui -lkio -lkdecore -L/opt/kde3/lib -I/opt/kde3/include -I/usr/lib/qt3/include  kio_hello.cpp -o kio_hello.so
linux-7nj1:~/kio # file kio_hello.so
kio_hello.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), not stripped
linux-7nj1:~/kio # cp kio_hello.so /opt/kde3/lib/

Start kinfocenter, choose protocols and verify you really have the imap protocol.

cp /opt/kde3/share/services/imap4.protocol /opt/kde3/share/services/hello.protocol

now adapt /opt/kde3/share/services/hello.protocol using kwrite. Start kinfocenter, verify you have a protocol hello. In your konqueror, you can now enter hello:/// and you do NOT get "protocol not supported".