summaryrefslogtreecommitdiffstats
path: root/kmobile
diff options
context:
space:
mode:
Diffstat (limited to 'kmobile')
-rw-r--r--kmobile/DESIGN96
-rw-r--r--kmobile/Makefile.am48
-rw-r--r--kmobile/TODO31
-rw-r--r--kmobile/configure.in.in16
-rw-r--r--kmobile/devices/Makefile.am5
-rw-r--r--kmobile/devices/digicam/Makefile.am1
-rw-r--r--kmobile/devices/digicam/libkmobile_digicam.desktop115
-rw-r--r--kmobile/devices/gammu/Makefile.am1
-rw-r--r--kmobile/devices/gammu/libkmobile_gammu.desktop109
-rw-r--r--kmobile/devices/gnokii/Makefile.am11
-rw-r--r--kmobile/devices/gnokii/configure.in.in2
-rw-r--r--kmobile/devices/gnokii/gnokii_mobile.cpp878
-rw-r--r--kmobile/devices/gnokii/gnokii_mobile.h93
-rw-r--r--kmobile/devices/gnokii/gnokiiconfig.cpp98
-rw-r--r--kmobile/devices/gnokii/gnokiiconfig.h41
-rw-r--r--kmobile/devices/gnokii/gnokiiconfigui.ui273
-rw-r--r--kmobile/devices/gnokii/libkmobile_gnokii.desktop109
-rw-r--r--kmobile/devices/pics/Makefile.am6
-rw-r--r--kmobile/devices/pics/mobile_camera.pngbin0 -> 1627 bytes
-rw-r--r--kmobile/devices/pics/mobile_musicplayer.pngbin0 -> 2207 bytes
-rw-r--r--kmobile/devices/pics/mobile_organizer.pngbin0 -> 2801 bytes
-rw-r--r--kmobile/devices/pics/mobile_phone.pngbin0 -> 5519 bytes
-rw-r--r--kmobile/devices/pics/mobile_unknown.pngbin0 -> 2815 bytes
-rw-r--r--kmobile/devices/skeleton/Makefile.am11
-rw-r--r--kmobile/devices/skeleton/libkmobile_skeleton.desktop109
-rw-r--r--kmobile/devices/skeleton/skeleton.cpp164
-rw-r--r--kmobile/devices/skeleton/skeleton.h71
-rw-r--r--kmobile/hi16-app-kmobile.pngbin0 -> 598 bytes
-rw-r--r--kmobile/hi32-app-kmobile.pngbin0 -> 1793 bytes
-rw-r--r--kmobile/hi48-app-kmobile.pngbin0 -> 3465 bytes
-rw-r--r--kmobile/kioslave/Makefile.am18
-rw-r--r--kmobile/kioslave/cellphone.protocol18
-rw-r--r--kmobile/kioslave/kio_mobile.cpp636
-rw-r--r--kmobile/kioslave/kio_mobile.h70
-rw-r--r--kmobile/kioslave/mimetypes/Makefile.am4
-rw-r--r--kmobile/kioslave/mimetypes/mobile_addressbook.desktop61
-rw-r--r--kmobile/kioslave/mimetypes/mobile_calendar.desktop61
-rw-r--r--kmobile/kioslave/mimetypes/mobile_device.desktop65
-rw-r--r--kmobile/kioslave/mimetypes/mobile_notes.desktop59
-rw-r--r--kmobile/kioslave/mobile.protocol18
-rw-r--r--kmobile/kioslave/organizer.protocol18
-rw-r--r--kmobile/kioslave/pda.protocol18
-rw-r--r--kmobile/kioslave/phonecamera.protocol18
-rw-r--r--kmobile/kmobile.cpp407
-rw-r--r--kmobile/kmobile.desktop136
-rw-r--r--kmobile/kmobile.h98
-rw-r--r--kmobile/kmobile.lsm16
-rw-r--r--kmobile/kmobile_selectiondialog.ui115
-rw-r--r--kmobile/kmobileclient.cpp235
-rw-r--r--kmobile/kmobileclient.h62
-rw-r--r--kmobile/kmobiledevice.cpp470
-rw-r--r--kmobile/kmobiledevice.h504
-rw-r--r--kmobile/kmobileiface.h55
-rw-r--r--kmobile/kmobileitem.cpp195
-rw-r--r--kmobile/kmobileitem.h52
-rw-r--r--kmobile/kmobileui.rc29
-rw-r--r--kmobile/kmobileview.cpp439
-rw-r--r--kmobile/kmobileview.h89
-rw-r--r--kmobile/libkmobile.desktop51
-rw-r--r--kmobile/main.cpp65
-rw-r--r--kmobile/pref.cpp44
-rw-r--r--kmobile/pref.h39
-rw-r--r--kmobile/systemtray.cpp106
-rw-r--r--kmobile/systemtray.h53
-rw-r--r--kmobile/testlibkmobile.cpp40
65 files changed, 6652 insertions, 0 deletions
diff --git a/kmobile/DESIGN b/kmobile/DESIGN
new file mode 100644
index 000000000..287a3d9a2
--- /dev/null
+++ b/kmobile/DESIGN
@@ -0,0 +1,96 @@
+
+ KMOBILE
+
+(C) Copyright 2003, Helge Deller <deller@kde.org>
+
+
+
+"kmobile" is suite to easily access "Mobile Devices",
+which means, that you have one single interface to access
+any type of mobile device (e.g. cellular phone, PDAs,
+MP3-Players, Digital Cameras and a lot more).
+
+Each of this devices have different types of information,
+(capatibilities) which can be:
+ - An addressbook
+ - A collection of notes
+ - calendar entries,
+ - a file storage section (e.g. pictures in digital cameras)
+ - and more
+
+The whole interface is pretty extendable. Each device has
+a device driver, which reports the capatibilities of the
+connected device to the higher level.
+So, if you once write a device driver, you can access it's
+contents from any KDE application later.
+
+Currently the whole interface is divided into 3 sections:
+
+a) The low-level device driver
+b) A mid-layer, which is realized in the "kmobile" application
+c) A userland library, to which KDE applications should link.
+
+
+Here is some background info:
+
+a) The low-level device driver (libkmobile_xxxx.so)
+
+The low-level driver has to be derived from the KMobileDevice class
+(#include <kmobiledevice.h>). The drivers should be located below the
+directory /device, and you can find a sample implementation in
+/device/skeleton-directory. See below for some hints on how to
+write such a device driver.
+
+
+b) The mid-layer (kmobile)
+
+The mid-layer handles the main functionality, which is entirely
+implemented in the kmobile application. All low-level drivers
+are loaded by kmobile only, and then all low-level functions
+to any device is made available to other applications
+with a DCOP interface. Normal KDE applications should prefer the
+userland library (see below) instead of using direct DCOP calls.
+Nevertheless, the DCOP interface might be very interesting to write
+standalone command line tools.
+
+
+c) The userland library (libkmobileclient.so)
+
+Any KDE application which wants to access mobile devices
+should #include <kmobileclient.h> and link to the libkmobileclient.la
+library. libkmobileclient translates all calls to DCOP calls and
+makes accessing mobile devices completely transparent to the
+application.
+
+One sample program which uses the client library is the kmobile
+kioslave. In Konqueror you might access any mobile device directly
+by giving "mobile:/" as the URL.
+
+
+
+
+
+HINTS FOR DRIVER DEVELOPERS:
+----------------------------
+- KMobile device drivers are very similiar to kioslaves. Refer
+ at the kioslave documentation if needed.
+
+- derive your driver only from the KMobileDevice class (#include <kmobiledevice.h>)
+ and reimplement the functions which you really need
+
+- remember to set the classtype and capatibilities as soon as possible
+
+- your driver will be loaded only once in the whole KDE system
+
+- you don't need to worry about syncronisation - KMobile syncronizes
+ all calls to your driver, so you always will have a clean state
+
+- use lockDevice("/dev/ttyS1") and unlockDevice("/dev/ttyS1") to
+ lock those devices system-wide (creates /var/lock/LCK..<devname> files),
+ and to prevent other applications to access the same physical ports/devices
+
+- use the helper functions createDirEntry() and createFileEntry() to
+ create the right UDSEntries for listEntries(), stat(), ...
+
+- never fork() your driver !!
+
diff --git a/kmobile/Makefile.am b/kmobile/Makefile.am
new file mode 100644
index 000000000..d63a889db
--- /dev/null
+++ b/kmobile/Makefile.am
@@ -0,0 +1,48 @@
+## Makefile.am for kmobile
+
+SUBDIRS = . devices # kioslave
+
+bin_PROGRAMS = kmobile
+
+lib_LTLIBRARIES = libkmobiledevice.la libkmobileclient.la
+
+INCLUDES = $(all_includes)
+
+kmobile_LDFLAGS = $(KDE_RPATH) $(all_libraries)
+kmobile_LDADD = $(LIB_KFILE) $(LIB_KABC) libkmobiledevice.la
+kmobile_SOURCES = main.cpp kmobile.cpp kmobileview.cpp kmobileitem.cpp\
+ pref.cpp kmobileiface.skel kmobile_selectiondialog.ui \
+ systemtray.cpp
+
+KDE_ICON = kmobile
+
+noinst_HEADERS = kmobile.h kmobileview.h kmobileitem.h pref.h
+
+# the low-level devices driver library
+libkmobiledevice_la_SOURCES = kmobiledevice.cpp
+libkmobiledevice_la_LDFLAGS = $(all_libraries) -no-undefined -avoid-version
+libkmobiledevice_la_LIBADD = $(LIB_KABC) $(LIB_LOCKDEV) ../libkcal/libkcal.la
+
+# the KDE application's client library to KMobile
+libkmobileclient_la_SOURCES = kmobileclient.cpp
+libkmobileclient_la_LDFLAGS = $(all_libraries) -no-undefined -avoid-version
+libkmobileclient_la_LIBADD = $(LIB_KDECORE) -lDCOP
+
+EXTRA_PROGRAMS = testlibkmobile
+testlibkmobile_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+testlibkmobile_LDADD = libkmobileclient.la
+testlibkmobile_SOURCES = testlibkmobile.cpp
+
+# the servicetype for mobile devices
+kde_servicetypes_DATA = libkmobile.desktop
+
+METASOURCES = AUTO
+
+xdg_apps_DATA = kmobile.desktop
+
+rc_DATA = kmobileui.rc
+rcdir = $(kde_datadir)/kmobile
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/kmobile.pot
+
diff --git a/kmobile/TODO b/kmobile/TODO
new file mode 100644
index 000000000..f5b209fc8
--- /dev/null
+++ b/kmobile/TODO
@@ -0,0 +1,31 @@
+DONE:
+-----
+- devices:/ kioslave integration
+- show per-device icons in konqueror (same as in the kmobile view)
+- fix mimetypes and their location under /share/mimelnk
+- kioslaves: cellphone:/, organizer:/, pda:/, (camera:/ not activated)
+- system tray plugin
+- serial/IRDA/(USB?) locking features (acording to standards - done, but untested !!)
+
+TODO:
+-----
+- fix doubled loading of plugins
+- where do I get the device name from the kmobile unique process?
+- finish the functions which are available to client apps.
+- kitchensync driver/plugin (starting...)
+- a plugin for the left side of the "Open File Dialog". ->
+ makes direct access to mobile devices really easy
+- make the daemon a KDED (KDE Meta Daemon) module (kdelibs/kded/HOWTO, README.kded)
+- more drivers (always)
+
+General Interface TODO:
+-----------------------
+- automatic logoff timers
+- Authentication
+
+
+TODO (lower priority):
+----------------------
+- a kmobile-driver, which can connect to another KDE-computer
+ to be able to access Calendar-Entries, ToDo's, ... from there
+ and to be able to syncronize them via kitchensync (maybe?)
diff --git a/kmobile/configure.in.in b/kmobile/configure.in.in
new file mode 100644
index 000000000..cf47242d2
--- /dev/null
+++ b/kmobile/configure.in.in
@@ -0,0 +1,16 @@
+DO_NOT_COMPILE="$DO_NOT_COMPILE kmobile"
+
+AC_CHECK_HEADERS(baudboy.h,,,
+[
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#define inline __inline__
+])
+AC_CHECK_HEADERS(lockdev.h)
+AC_CHECK_LIB(lockdev, dev_lock, [ LIB_LOCKDEV="-llockdev" ])
+dnl We don't need liblockdev if we have baudboy working
+if [[ -n "$HAVE_BAUDBOY_H" ]]; then
+ LIB_LOCKDEV=""
+fi
+AC_SUBST(LIB_LOCKDEV)
diff --git a/kmobile/devices/Makefile.am b/kmobile/devices/Makefile.am
new file mode 100644
index 000000000..3b5f927a5
--- /dev/null
+++ b/kmobile/devices/Makefile.am
@@ -0,0 +1,5 @@
+if include_gnokii_device
+KMOBILE_GNOKIIDIR = gnokii
+endif
+
+SUBDIRS = pics skeleton $(KMOBILE_GNOKIIDIR) digicam gammu
diff --git a/kmobile/devices/digicam/Makefile.am b/kmobile/devices/digicam/Makefile.am
new file mode 100644
index 000000000..69f6689f1
--- /dev/null
+++ b/kmobile/devices/digicam/Makefile.am
@@ -0,0 +1 @@
+kde_services_DATA = libkmobile_digicam.desktop
diff --git a/kmobile/devices/digicam/libkmobile_digicam.desktop b/kmobile/devices/digicam/libkmobile_digicam.desktop
new file mode 100644
index 000000000..b00b8d702
--- /dev/null
+++ b/kmobile/devices/digicam/libkmobile_digicam.desktop
@@ -0,0 +1,115 @@
+[Desktop Entry]
+Name=Digital Camera
+Name[af]=Digitale Kamera
+Name[ar]=كاميرا رقمية
+Name[bg]=Фотоапарат
+Name[br]=Kamera niverel
+Name[bs]=Digitalna kamera
+Name[ca]=Càmera digital
+Name[cs]=Digitální fotoaparát
+Name[cy]=Camera Digidol
+Name[da]=Digitalt kamera
+Name[de]=Digitalkamera
+Name[el]=Ψηφιακή κάμερα
+Name[eo]=Cifereca fotilo
+Name[es]=Cámara digital
+Name[et]=Digitaalkaamera
+Name[eu]=Kamera digitala
+Name[fa]=دوربین رقمی
+Name[fi]=digitaalikamera
+Name[fr]=Appareil photo numérique
+Name[fy]=Digitale kamera
+Name[ga]=Ceamara Digiteach
+Name[gl]=Cámara dixital
+Name[hi]=डिजिटल कैमरा
+Name[hr]=Digitalna kamera
+Name[hu]=Fényképezőgép
+Name[is]=Stafræn myndavél
+Name[it]=Macchina fotografica digitale
+Name[ja]=デジタルカメラ
+Name[ka]=ციფრული კამერა
+Name[kk]=Цифрлық камера
+Name[km]=ម៉ាស៊ីន​ថត​រូប​ឌីជីថល
+Name[lt]=Skaitmeninė kamera
+Name[mk]=Дигитална камера
+Name[ms]=Kamera Digital
+Name[nb]=Digitalkamera
+Name[nds]=Digitaalkamera
+Name[ne]=डिजिटल क्यामेरा
+Name[nl]=Digitale camera
+Name[nn]=Digitalt kamera
+Name[pa]=ਡਿਜ਼ੀਟਲ ਕੈਮਰਾ
+Name[pl]=Aparat cyfrowy
+Name[pt]=Máquina Fotográfica Digital
+Name[pt_BR]=Câmera Digital
+Name[ro]=Aparat foto digital
+Name[ru]=Цифровая камера
+Name[se]=Digitálalaš govvenapperáhta
+Name[sk]=Digitálny fotoaparát
+Name[sl]=Digitalna kamera
+Name[sr]=Дигитална камера
+Name[sr@Latn]=Digitalna kamera
+Name[sv]=Digitalkamera
+Name[ta]=டிஜிடல் காமரா
+Name[tg]=Камераи digital
+Name[tr]=Dijital Kamera
+Name[uk]=Цифровий фотоапарат
+Name[uz]=Fotoaparat
+Name[uz@cyrillic]=Фотоапарат
+Name[zh_CN]=数码相机
+Name[zh_TW]=數位相機
+Comment=This driver supports many digital cameras
+Comment[af]=Hierdie drywer ondersteun baie digitale kameras
+Comment[bg]=Драйвер за поддръжка на цифрови фотоапарати и камери
+Comment[bs]=Ovaj drajver podržava mnoge digitalne kamere
+Comment[ca]=Aquest controlador accepta moltes càmeres digitals
+Comment[cs]=Tento ovladač podporuje mnoho digitálních fotoaparátů
+Comment[cy]=Cynhala'r gyrrydd yma lawer o gamerau digidol
+Comment[da]=Denne driver understøtter mange digitale kameraer
+Comment[de]=Ein Treiber, der zahlreiche Digitalkameras unterstützt
+Comment[el]=Αυτός ο οδηγός υποστηρίζει πολλές ψηφιακές κάμερες
+Comment[es]=Este manejador admite muchas cámaras digitales
+Comment[et]=See draiver toetab paljusid digitaalkaameraid
+Comment[eu]=Kontrolatzaile honek kamera digital asko onartzen ditu
+Comment[fa]=این گرداننده اغلب دوربینهای رقمی را پشتیبانی می‌کند
+Comment[fi]=Tämä ajuri tukee useita digitaalikameroita
+Comment[fr]=Ce pilote prend en charge beaucoup d'appareils photo numériques
+Comment[fy]=Dit stjoerprogramma jout stipe foar in soad kamera's
+Comment[ga]=Tacaíonn an tiománaí seo le neart ceamaraí digiteacha
+Comment[gl]=Este controlador atura moitas cámaras dixitais
+Comment[hi]=यह ड्राइवर बहुत से डिजिटल कैमरे समर्थित करता है
+Comment[hu]=Ez a meghajtó különféle digitális fényképezőgépek kezelését teszi lehetővé
+Comment[is]=Þessi rekill styður margar stafrænar myndavélar
+Comment[it]=Questo driver supporta molte fotocamere digitali
+Comment[ja]=このドライバは多種のデジタルカメラをサポートします
+Comment[ka]=ეს დრაივერი უჭერს მხარს მრავალ ციფრულ კამერას
+Comment[kk]=Бұл бірспыра цифрлық камераларды қамтитын драйвер
+Comment[km]=កម្មវិធី​បញ្ជា​នេះ​គាំទ្រ​ម៉ាស៊ីន​ថត​រូប​ឌីជីថល​ជាច្រើន
+Comment[lt]=Ši tvarkyklė palaiko daugelį skaitmeninių kamerų
+Comment[mk]=Овој управувач поддржува многу дигитални камери
+Comment[ms]=Pemacu ini menyokong banyak kamera digital
+Comment[nb]=Denne driveren støtter mange digitalkameraer
+Comment[nds]=Ein Driever, de vele Digitaalkameras ünnerstütt
+Comment[ne]=यो ड्राइभरले धेरै डिजिटल क्यामेरा समर्थन गर्छ
+Comment[nl]=Dit stuurprogramma biedt ondersteuning voor veel camera's
+Comment[nn]=Denne drivaren støttar mange digitale kamera
+Comment[pl]=Ten sterownik obsługuje wiele aparatów cyfrowych
+Comment[pt]=Este controlador suporta várias máquinas fotográficas digitais
+Comment[pt_BR]=Este driver suporta muitas câmeras digitais
+Comment[ro]=Acest driver suportă multe camere foto digitale
+Comment[ru]=Этот драйвер поддерживает множество моделей цифровых камер
+Comment[sk]=Tento ovládač podporuje veľa digitálnych fotoaparátov
+Comment[sl]=Ta gonilnik podpira mnogo digitalnih kamer
+Comment[sr]=Овај управљачки програм подржава многе дигиталне камере
+Comment[sr@Latn]=Ovaj upravljački program podržava mnoge digitalne kamere
+Comment[sv]=Den här drivrutinen stöder många digitalkameror
+Comment[ta]=இந்த இயக்கம் பல இலக்கக் காமிராக்களை ஆதரிக்கும்
+Comment[tg]=Ин драйвер бисёри тамсилаҳои камераҳои digital-ро дастгирӣ мекунад
+Comment[tr]=Bu sürücü birçok dijital kamerayı destekler
+Comment[uk]=Цей драйвер підтримує багато цифрових камер
+Comment[zh_CN]=此驱动程序支持许多数码相机
+Comment[zh_TW]=此驅動程式支援許多數位相機
+Type=Service
+ServiceTypes=kdedevice/mobiledevice
+X-KDE-Library=libkmobile_digicam
+Icon=mobile_camera
diff --git a/kmobile/devices/gammu/Makefile.am b/kmobile/devices/gammu/Makefile.am
new file mode 100644
index 000000000..678befd9d
--- /dev/null
+++ b/kmobile/devices/gammu/Makefile.am
@@ -0,0 +1 @@
+kde_services_DATA = libkmobile_gammu.desktop
diff --git a/kmobile/devices/gammu/libkmobile_gammu.desktop b/kmobile/devices/gammu/libkmobile_gammu.desktop
new file mode 100644
index 000000000..4dd6e5060
--- /dev/null
+++ b/kmobile/devices/gammu/libkmobile_gammu.desktop
@@ -0,0 +1,109 @@
+[Desktop Entry]
+Name=Mobile Phone or Organizer (gammu)
+Name[af]=Selfoon of Digitale Dagboek (gammu)
+Name[ar]=الهاتف النقّال أو المنظم (gammu)
+Name[be]=Мабільны тэлефон ці арганізатар (gammu)
+Name[bg]=Мобилни телефони или организатори (gammu)
+Name[bs]=Mobilni telefon ili organizer (gammu)
+Name[ca]=Telèfon mòbil o organitzador (gammu)
+Name[cs]=Mobilní telefon nebo Organizér (gammu)
+Name[cy]=Ffôn Symudol neu Drefnydd (gammu)
+Name[da]=Mobiltelefon eller organisator (gammu)
+Name[de]=Mobiltelefon oder Organizer (gammu)
+Name[el]=Κινητό τηλέφωνο ή Organizer (gammu)
+Name[en_GB]=Mobile Phone or Organiser (gammu)
+Name[es]=Teléfono móvil u organizador (gammu)
+Name[et]=Mobiiltelefon või Organizer (gammu)
+Name[eu]=Mugikorra edo antolatzailea (gammu)
+Name[fa]=تلفن همراه یا سازمان‌دهنده (gammu)
+Name[fi]=Matkapuhelin tai organisaattori (gammu)
+Name[fr]=Téléphone portable ou organiseur (gammu)
+Name[fy]=Mobile tillefoan of Organizer (gammu)
+Name[ga]=Fón Póca nó Eagraí (gammu)
+Name[gl]=Teléfono móbil ou organizador (gammu)
+Name[he]=טלפון נייד או אירגונית (gammu)
+Name[hi]=मोबाइल फोन या आर्गेनाइज़र (गम्मू)
+Name[hu]=Mobiltelefon/határidőnapló-kezelő (Gammu)
+Name[is]=Farsími eða lófatölva (gammu)
+Name[it]=Organizer o telefono cellulare (gammu)
+Name[ja]=携帯電話またはスケジュール管理 (gammu)
+Name[ka]=მობილური ტელეფონი ან ორგანიზატორი(gammu)
+Name[kk]=Қалта телефон не Ұйымдастырғыш (gammu)
+Name[km]=កម្មវិធី​រៀបចំ​ទូរស័ព្ទ​ចល័ត (gammu)
+Name[lt]=Mobilus telefonas ar asmeninės info tvarkyklė (gammu)
+Name[ms]=Telefon Bimbit atau Penyusun (gammu)
+Name[nb]=Mobiltelefon eller PDA (gammu)
+Name[nds]=Mobiltelefoon oder Handreekner (gammu)
+Name[ne]=मोबाइल फोन वा आयोजक (गामु)
+Name[nl]=Mobiele telefoon of Organizer (gammu)
+Name[nn]=Mobiltelefon eller organisator (gammu)
+Name[pl]=Telefon komórkowy lub organizer (gammu)
+Name[pt]=Organizador ou Telemóvel (Gammu)
+Name[pt_BR]=Telefone Móvel ou Organizador (gammu)
+Name[ru]=Мобильный телефон или органайзер (gammu)
+Name[sk]=Mobil alebo organizér (gammu)
+Name[sl]=Prenosni telefon ali organizator (gammu)
+Name[sr]=Мобилни телефон или организатор (gammu)
+Name[sr@Latn]=Mobilni telefon ili organizator (gammu)
+Name[sv]=Mobilenhet (gammu)
+Name[ta]=செல்பேசி அல்லது ஒருங்கிணைப்பாளர்(gammu)
+Name[tg]=Телефони мобилӣ ё органайзер (gammu)
+Name[tr]=Cep Telefonu ya da Organizer (gammu)
+Name[uk]=Мобільний телефон та тижневик (gammu)
+Name[uz]=Uyali telefon yoki organayzer (gammu)
+Name[uz@cyrillic]=Уяли телефон ёки органайзер (gammu)
+Name[zh_CN]=移动电话或 PDA(gammu)
+Name[zh_TW]=行動電話或數位助理(gammu)
+Comment=This driver supports many NOKIA and other mobile phones via the gammu library
+Comment[af]=Hierdie drywer ondersteun baie Nokia en ander selfone d.m.v. die gammu biblioteek
+Comment[bg]=Драйвер за поддръжка на мобилни телефони, предимно Нокиа, чрез библиотеката gammu
+Comment[bs]=Ovaj drajver podržava mnoge NOKIA i druge mobilne telefone putem gammu biblioteke
+Comment[ca]=Aquest controlador accepta molts NOKIA i d'altres telèfons mòbils mitjançant la biblioteca «gammu»
+Comment[cs]=Tento ovladač podporuje mnoho mobilních telefonů NOKIA a dalších pomocí knihovny gammu
+Comment[cy]=Cynhala'r gyrrydd yma lawer o ffoniau NOKIA a ffoniau symudol eraill drwy'r rhaglengell gammu
+Comment[da]=Denne driver understøtter mange NOKIA og andre mobiltelefoner via gammu-biblioteket
+Comment[de]=Ein Treiber, der zahlreiche NOKIA- und sonstige Mobiltelefone über die gammu-Bibliothek unterstützt
+Comment[el]=Αυτός ο οδηγός υποστηρίζει πολλά NOKIA και άλλα κινητά τηλέφωνα μέσω της βιβλιοθήκης gammu
+Comment[es]=Este manejador admite muchos teléfonos móviles NOKIA y de otras marcas vía la biblioteca gammu
+Comment[et]=See draiver toetab gammu teegi vahendusel paljusid Nokia ja teisi mobiiltelefone
+Comment[eu]=Kontrolatzaile honek NOKIA eta beste mugikor asko onartzen ditu gammu liburutegiaren bidez
+Comment[fa]=این گرداننده، اغلب تلفنهای همراه نوکیا و غیره را از طریق کتابخانۀ gammu پشتیبانی می‌کند
+Comment[fi]=Tämä ajuri tukee monia Nokian ja muita matkapuhelimia gammu-kirjaston kautta
+Comment[fr]=Ce pilote prend en charge beaucoup de téléphones portables Nokia et autres à l'aide de la bibliothèque gammu
+Comment[fy]=Dit stjoerprogramma jout stipe foar in soad Nokia- en oare mobile tillefoans fia de gammu-bibliotheek
+Comment[ga]=Tacaíonn an tiománaí seo le neart fóin NOKIA agus cinn eile, tríd an leabharlann gammu
+Comment[gl]=Este controlador soporta moitos móbiles Nokia e outros mediante a libraría gammu
+Comment[hi]=यह ड्राइवर बहुत से नोकिया तथा अन्य मोबाइल फोनों को गम्मू लाइब्रेरी के द्वारा समर्थित करता है
+Comment[hu]=Ez a meghajtó mobiltelefonok (elsősorban Nokia gyártmányúak) kezelését teszi lehetővé a Gammu programkönyvtáron keresztül
+Comment[is]=Þessi rekill styður marga NOKIA og aðra farsíma gegnum gammu aðgerðasafnið
+Comment[it]=Questo driver supporta molti NOKIA e altri telefoni cellulari tramite la libreria gammu.
+Comment[ja]=このドライバは gammu ライブラリを介して NOKIA および他社製の携帯電話を幅広くサポートします
+Comment[ka]=ეს დრაივერი მხარს უჭერს Nokia-ს მრავალ და სხვა ტელეფონებს gammu ბიბლიოთეკის საშუალებით
+Comment[kk]=Бұл көп NOKIA мен басқа қалта құрылғыларды, gammu жиыны арқылы, қамтитын драйвер
+Comment[km]=កម្មវិធី​បញ្ជា​នេះ​គាំទ្រ​ប្រភេទ​ទូរស័ព្ទ​ណូគៀ និងទូរស័ព្ទ​ផ្សេងៗ​ទៀត​ជាច្រើន​តាម​រយៈ​បណ្ណាល័យ gammu
+Comment[lt]=Ši tvarkyklė palaiko daugelį NOKIA ir kitų telefonų pasinaudodama gammu biblioteka
+Comment[ms]=Pemacu ini menyokong banyak NOKIA dan telefon bimbit lain melalui pustaka gammu
+Comment[nb]=Denne driveren støtter mange NOKIA og andre mobiltelefoner via gammu-biblioteket
+Comment[nds]=Disse Driever ünnerstütt vele Nokia- un anner Mobiltelefonen över de gammu-Bibliotheek
+Comment[ne]=यो ड्राइभरले गामु लाइब्रेरीबाट धेरै नोकिया र अन्य मोबाइल फोन समर्थन गर्छ
+Comment[nl]=Dit stuurprogramma biedt ondersteuning voor veel Nokia- en andere mobiele telefoons via de gammu-bibliotheek
+Comment[nn]=Denne drivaren støttar mange NOKIA og andre mobiltelefonar via gammu-biblioteket
+Comment[pl]=Ten sterownik obsługuje wiele telefonów komórkowych Nokia i innych za pomocą biblioteki gammu
+Comment[pt]=Este controlador suportar muitos NOKIAs, bem como outros telemóveis, com a biblioteca 'gammu'
+Comment[pt_BR]=Este driver suporta muitos telefones móveis, NOKIA e outros, via biblioteca gammu
+Comment[ru]=Этот драйвер поддерживает множество моделей мобильных телефонов Nokia и других производителей через библиотеку gammu
+Comment[sk]=Tento ovládač podporuje veľa mobilov NOKIA a iných pomocou knižnice gammu
+Comment[sl]=Ta gonilnik preko knjižnice gammu podpira mnoge prenosne telefone NOKIA kot tudi druge
+Comment[sr]=Овај управљачки програм подржава многе Nokia-ине и друге мобилне телефоне преко библиотеке gammu
+Comment[sr@Latn]=Ovaj upravljački program podržava mnoge Nokia-ine i druge mobilne telefone preko biblioteke gammu
+Comment[sv]=Den här drivrutinen stöder många Nokia och andra mobiltelefoner via biblioteket gammu
+Comment[ta]=இந்த இயக்கி பல NOKIA மற்றும் மற்ற செல்பேசிகளை கம்மு நூலகம் வழியாக ஆதரிக்கிறது.
+Comment[tg]=Ин драйвер бисёри тамсилаҳои телефонҳои мобилии Nokia-ро ва дигар истеҳсолкунандаҳоро аз китобхонаи gammu дастгирӣ мекунад
+Comment[tr]=Bu sürücü birçok NOKIA ve gammu kütüphanesiyle diğer cep telefonlarını destekler
+Comment[uk]=Цей драйвер підтримує багато мобільних телефонів фірми NOKIA та інших мобільних телефонів через бібліотеку gammu
+Comment[zh_CN]=此驱动程序通过 gammu 库支持许多诺基亚和其它移动电话
+Comment[zh_TW]=此驅動程式支援許多 NOKIA 及其他手機,使用 gammu 函式庫
+Type=Service
+ServiceTypes=kdedevice/mobiledevice
+X-KDE-Library=libkmobile_gammu
+Icon=mobile_phone
diff --git a/kmobile/devices/gnokii/Makefile.am b/kmobile/devices/gnokii/Makefile.am
new file mode 100644
index 000000000..c9ec8642c
--- /dev/null
+++ b/kmobile/devices/gnokii/Makefile.am
@@ -0,0 +1,11 @@
+INCLUDES = -I$(top_srcdir)/kmobile -I$(top_srcdir) $(all_includes)
+
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = libkmobile_gnokii.la
+
+kde_services_DATA = libkmobile_gnokii.desktop
+
+libkmobile_gnokii_la_SOURCES = gnokii_mobile.cpp gnokiiconfigui.ui gnokiiconfig.cpp
+libkmobile_gnokii_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) $(KDE_RPATH) -no-undefined -module
+libkmobile_gnokii_la_LIBADD = ../../libkmobiledevice.la ../../../libkcal/libkcal.la $(XPMLIB) $(LIB_GNOKII)
diff --git a/kmobile/devices/gnokii/configure.in.in b/kmobile/devices/gnokii/configure.in.in
new file mode 100644
index 000000000..150191bf6
--- /dev/null
+++ b/kmobile/devices/gnokii/configure.in.in
@@ -0,0 +1,2 @@
+# $Id$
+AM_CONDITIONAL(include_gnokii_device, test -n "$LIB_GNOKII")
diff --git a/kmobile/devices/gnokii/gnokii_mobile.cpp b/kmobile/devices/gnokii/gnokii_mobile.cpp
new file mode 100644
index 000000000..871442847
--- /dev/null
+++ b/kmobile/devices/gnokii/gnokii_mobile.cpp
@@ -0,0 +1,878 @@
+/* This file is part of the KDE mobile library.
+ Copyright (C) 2003-2005 Helge Deller <deller@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qdir.h>
+
+#include <klibloader.h>
+#include <kconfig.h>
+#include <kstandarddirs.h>
+#include <kmessagebox.h>
+#include <kio/global.h>
+#include <kdebug.h>
+#include <klocale.h>
+
+#include <gnokii.h>
+
+#include "gnokii_mobile.h"
+#include "gnokiiconfig.h"
+
+
+#define KGNOKII_DEBUG_AREA 5730
+#define PRINT_DEBUG kdDebug(KGNOKII_DEBUG_AREA) << "KMobileGnokii: "
+#define GNOKII_DEBUG(x) PRINT_DEBUG << x
+
+
+#define APP "KMobileGnokii"
+#define GNOKII_CHECK_ERROR(error) \
+ do { \
+ if (error) \
+ PRINT_DEBUG << QString("ERROR %1: %2\n").arg(error).arg(gn_error_print(error));\
+ } while (0)
+
+
+/* This is a loaded library, which is initialized with the line below */
+K_EXPORT_COMPONENT_FACTORY( libkmobile_gnokii, KMobileGnokii() )
+
+/* createObject needs to be reimplemented by every KMobileDevice driver */
+QObject *KMobileGnokii::createObject( QObject *parent, const char *name,
+ const char *, const QStringList &args )
+{
+ return new KMobileGnokii( parent, name, args );
+}
+
+
+static char *BinDir;
+static char *lockfile = NULL;
+static char model[GN_MODEL_MAX_LENGTH+1], revision[GN_REVISION_MAX_LENGTH+1], imei[GN_IMEI_MAX_LENGTH+1];
+static QString PhoneProductId;
+
+static gn_statemachine state;
+static gn_data data;
+static gn_calnote_list calnote_list;
+
+
+/**
+ * The KDE gnokii mobile device driver.
+ */
+
+KMobileGnokii::KMobileGnokii(QObject *obj, const char *name, const QStringList &args )
+ : KMobileDevice(obj, name, args)
+{
+ // set initial device info
+ setClassType( Phone );
+ m_deviceName = i18n("Mobile Phone accessed via GNOKII");
+ m_deviceRevision = "";
+ m_connectionName = "/dev/ircomm0";
+ setCapabilities( hasAddressBook | hasNotes );
+
+ m_numAddresses = -1;
+
+ // now initialize the configuration based on the
+ // given config file from args[0]
+ loadDeviceConfiguration();
+ if (m_modelnr.isEmpty())
+ loadGnokiiConfiguration();
+
+ if (m_modelnr.isEmpty()) {
+ // default communcation values
+ m_modelnr = "6310";
+ m_connection = "infrared";
+ m_port = "/dev/ircomm0";
+ m_baud = "9600";
+ }
+
+ PRINT_DEBUG << QString("Using GNOKII configuration: %1 %2 %3 %4\n").arg(m_modelnr)
+ .arg(m_connection).arg(m_port).arg(m_baud);
+
+ saveDeviceConfiguration();
+ saveGnokiiConfiguration();
+}
+
+KMobileGnokii::~KMobileGnokii()
+{
+}
+
+
+/******************************************************************************************
+ * GNOKII lowlevel interface
+ ******************************************************************************************/
+
+static gn_connection_type connectionToValue( QString connectionName )
+{
+ if (connectionName == "serial")
+ return GN_CT_Serial;
+ if (connectionName == "dau9p")
+ return GN_CT_DAU9P;
+ if (connectionName == "dlr3p")
+ return GN_CT_DLR3P;
+ if (connectionName == "infrared")
+ return GN_CT_Infrared;
+ if (connectionName == "m2bus")
+ return GN_CT_M2BUS;
+ if (connectionName == "irda")
+ return GN_CT_Irda;
+ if (connectionName == "bluetooth")
+ return GN_CT_Bluetooth;
+//#ifndef WIN32
+ if (connectionName == "tcp")
+ return GN_CT_TCP;
+//#endif
+ if (connectionName == "tekram")
+ return GN_CT_Tekram;
+ return GN_CT_Serial; /* default */
+}
+
+bool KMobileGnokii::setGnokiiStateMachine()
+{
+ // set the state machine to our configuration
+ qstrncpy( state.config.model, m_modelnr.utf8(), sizeof(state.config.model)-1 );
+ qstrncpy( state.config.port_device, m_port.utf8(), sizeof(state.config.port_device)-1 );
+ state.config.connection_type = connectionToValue(m_connection);
+ state.config.serial_baudrate = m_baud.toUInt();
+ return true;
+}
+
+bool KMobileGnokii::saveConfig( KConfig &conf, QString group )
+{
+ conf.setGroup(group);
+ conf.writeEntry("model", m_modelnr );
+ conf.writeEntry("port", m_port );
+ conf.writeEntry("connection", m_connection );
+// conf.writeEntry("initlength", "default" );
+ conf.writeEntry("serial_baudrate", m_baud );
+// conf.writeEntry("serial_write_usleep", "0" );
+// conf.writeEntry("handshake", "" ); // software (or:rtscts), hardware (or:xonxoff)
+ conf.writeEntry("require_dcd", "1" );
+// conf.writeEntry("smsc_timeout", "1" );
+ conf.sync();
+ return true;
+}
+
+bool KMobileGnokii::loadConfig( KConfig &conf, QString group )
+{
+ conf.setGroup(group);
+ m_modelnr = conf.readEntry("model", m_modelnr );
+ m_port = conf.readEntry("port", m_port );
+ m_connection = conf.readEntry("connection", m_connection );
+ m_baud = conf.readEntry("serial_baudrate", m_baud );
+ return true;
+}
+
+bool KMobileGnokii::saveGnokiiConfiguration()
+{
+ KConfig conf( QDir::homeDirPath() + "/.gnokiirc", false, false, "" );
+ return saveConfig( conf, "global" );
+}
+
+bool KMobileGnokii::loadGnokiiConfiguration()
+{
+ KConfig conf( QDir::homeDirPath() + "/.gnokiirc", true, false, "" );
+ return loadConfig( conf, "global" );
+}
+
+bool KMobileGnokii::saveDeviceConfiguration()
+{
+ return saveConfig( *config(), "global" );
+}
+
+bool KMobileGnokii::loadDeviceConfiguration()
+{
+ return loadConfig( *config(), "global" );
+}
+
+
+static void busterminate(void)
+{
+ gn_sm_functions(GN_OP_Terminate, NULL, &state);
+ if (lockfile) gn_device_unlock(lockfile);
+}
+
+static QString businit(void)
+{
+ gn_error error;
+ char *aux;
+
+ if (gn_cfg_read(&BinDir)<0 || !gn_cfg_phone_load("", &state))
+ return i18n("GNOKII isn't yet configured.");
+
+ gn_data_clear(&data);
+
+ aux = gn_cfg_get(gn_cfg_info, "global", "use_locking");
+ // Defaults to 'no'
+ if (aux && !strcmp(aux, "yes")) {
+ lockfile = gn_device_lock(state.config.port_device);
+ if (lockfile == NULL) {
+ return i18n("Lock file error.\n "
+ "Please exit all other running instances of gnokii and try again.");
+ }
+ }
+
+ // Initialise the code for the GSM interface.
+ int old_dcd = state.config.require_dcd; // work-around for older gnokii versions
+ state.config.require_dcd = false;
+ error = gn_gsm_initialise(&state);
+ GNOKII_CHECK_ERROR(error);
+ state.config.require_dcd = old_dcd;
+ if (error != GN_ERR_NONE) {
+ busterminate();
+ return i18n("Mobile phone interface initialization failed:\n%1").arg(gn_error_print(error));
+ }
+
+ // model
+ gn_data_clear(&data);
+ data.model = model;
+ model[0] = 0;
+ error = gn_sm_functions(GN_OP_GetModel, &data, &state);
+ GNOKII_CHECK_ERROR(error);
+ if (model[0] == 0)
+ strcpy(model, i18n("unknown").utf8());
+ data.model = NULL;
+
+ // revision
+ data.revision = revision;
+ revision[0] = 0;
+ error = gn_sm_functions(GN_OP_GetRevision, &data, &state);
+ GNOKII_CHECK_ERROR(error);
+ data.revision = NULL;
+
+ // imei
+ data.imei = imei;
+ imei[0] = 0;
+ error = gn_sm_functions(GN_OP_GetImei, &data, &state);
+ GNOKII_CHECK_ERROR(error);
+ data.imei = NULL;
+
+ GNOKII_DEBUG( QString("Found mobile phone: Model: %1, Revision: %2, IMEI: %3\n")
+ .arg(model).arg(revision).arg(imei) );
+
+ PhoneProductId = QString("%1-%2-%3-%4").arg(APP).arg(model).arg(revision).arg(imei);
+
+ return QString::null;
+}
+
+
+// get number of entries in this phone memory type (internal/SIM-card)
+static gn_error read_phone_memstat( gn_memory_type memtype, gn_memory_status *memstat )
+{
+ gn_error error;
+
+ gn_data_clear(&data);
+ memset(memstat, 0, sizeof(*memstat));
+ memstat->memory_type = memtype;
+ data.memory_status = memstat;
+ error = gn_sm_functions(GN_OP_GetMemoryStatus, &data, &state);
+ GNOKII_CHECK_ERROR(error);
+ if (error != GN_ERR_NONE) {
+ switch (memtype) {
+ case GN_MT_SM:
+ // use at least 100 entries
+ memstat->used = 0;
+ memstat->free = 100;
+ break;
+ default:
+ case GN_MT_ME:
+ // Phone doesn't support ME (5110)
+ memstat->used = memstat->free = 0;
+ break;
+ }
+ }
+ GNOKII_DEBUG( QString("\n\nMobile phone memory status: Type: %1, used=%2, free=%3, total=%4\n\n")
+ .arg(memtype).arg(memstat->used).arg(memstat->free).arg(memstat->used+memstat->free) );
+ return error;
+}
+
+
+// read phone entry #index from memory #memtype
+static gn_error read_phone_entry( int index, gn_memory_type memtype, gn_phonebook_entry *entry )
+{
+ gn_error error;
+ entry->memory_type = memtype;
+ entry->location = index;
+ data.phonebook_entry = entry;
+ error = gn_sm_functions(GN_OP_ReadPhonebook, &data, &state);
+ GNOKII_CHECK_ERROR(error);
+ return error;
+}
+
+#if 0
+static bool phone_entry_empty( int index, gn_memory_type memtype )
+{
+ gn_phonebook_entry entry;
+ gn_error error;
+ error = read_phone_entry( index, memtype, &entry );
+ if (error == GN_ERR_EMPTYLOCATION)
+ return true;
+ if (error == GN_ERR_NONE && entry.empty)
+ return true;
+ return false;
+}
+#endif
+
+static int gn_error2kio_error( gn_error err )
+{
+ if (err != GN_ERR_NONE)
+ GNOKII_CHECK_ERROR(err);
+
+ switch (err) {
+ case GN_ERR_NONE:
+ return 0;
+ case GN_ERR_INVALIDMEMORYTYPE:
+ case GN_ERR_INVALIDLOCATION:
+ case GN_ERR_EMPTYLOCATION:
+ return KIO::ERR_DOES_NOT_EXIST;
+ case GN_ERR_MEMORYFULL:
+ return KIO::ERR_OUT_OF_MEMORY;
+ case GN_ERR_NOLINK:
+ return KIO::ERR_COULD_NOT_CONNECT;
+ case GN_ERR_TIMEOUT:
+ return KIO::ERR_SERVER_TIMEOUT;
+ case GN_ERR_ENTRYTOOLONG:
+ case GN_ERR_WRONGDATAFORMAT:
+ case GN_ERR_INVALIDSIZE:
+ return KIO::ERR_COULD_NOT_WRITE;
+ default:
+ return KIO::ERR_INTERNAL;
+ }
+}
+
+static gn_error read_phone_entry_highlevel( int index, const gn_memory_type memtype, KABC::Addressee *a )
+{
+ gn_phonebook_entry entry;
+ QStringList addrlist;
+ QString s, country;
+ KABC::Address *addr;
+ gn_error error;
+
+// if (index > (memstat.used + memstat.free))
+// return GN_ERR_INVALIDLOCATION;
+
+ error = read_phone_entry( index, memtype, &entry );
+ if (error != GN_ERR_NONE)
+ return error;
+
+ GNOKII_DEBUG(QString("%1: %2, num=%3, location=%4, group=%5, count=%6\n").arg(index).arg(entry.name)
+ .arg(entry.number).arg(entry.location).arg(entry.caller_group).arg(entry.subentries_count));
+
+ // try to split Name into FamilyName and GivenName
+ s = QString(entry.name).simplifyWhiteSpace();
+ a->setFormattedName(s);
+ if (s.find(',')!=-1) {
+ addrlist = QStringList::split(',', s);
+ if (addrlist.count()==2) {
+ a->setFamilyName(addrlist[0].simplifyWhiteSpace());
+ a->setGivenName(addrlist[1].simplifyWhiteSpace());
+ } else
+ a->setGivenName(s);
+ } else {
+ addrlist = QStringList::split(' ', s);
+ if (addrlist.count()==2) {
+ a->setFamilyName(addrlist[1].simplifyWhiteSpace());
+ a->setGivenName(addrlist[0].simplifyWhiteSpace());
+ } else
+ a->setGivenName(s);
+ }
+
+ a->insertCustom(APP, "X_GSM_CALLERGROUP", s.setNum(entry.caller_group));
+ a->insertCustom(APP, "X_GSM_STORE_AT", QString("%1_%2").arg(GN_MT_ME).arg(entry.location));
+
+ // set ProductId
+ a->setProductId(PhoneProductId);
+
+ // evaluate timestamp (ignore timezone)
+ QDateTime datetime;
+ if (entry.date.year<1998)
+ datetime = QDateTime::currentDateTime();
+ else
+ datetime = QDateTime( QDate(entry.date.year, entry.date.month, entry.date.day),
+ QTime(entry.date.hour, entry.date.minute, entry.date.second) );
+ GNOKII_DEBUG(QString(" date=%1\n").arg(datetime.toString()));
+ a->setRevision(datetime);
+
+ if (!entry.subentries_count)
+ a->insertPhoneNumber(KABC::PhoneNumber(entry.number, KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref));
+
+ /* scan sub-entries */
+ if (entry.subentries_count)
+ for (int n=0; n<entry.subentries_count; n++) {
+ QString s = QString(entry.subentries[n].data.number).simplifyWhiteSpace();
+ GNOKII_DEBUG(QString(" Subentry#%1, entry_type=%2, number_type=%3, number=%4\n")
+ .arg(n).arg(entry.subentries[n].entry_type)
+ .arg(entry.subentries[n].number_type).arg(s));
+ if (s.isEmpty())
+ continue;
+ switch(entry.subentries[n].entry_type) {
+ case GN_PHONEBOOK_ENTRY_Name:
+ a->setName(s);
+ break;
+ case GN_PHONEBOOK_ENTRY_Email:
+ a->insertEmail(s);
+ break;
+ case GN_PHONEBOOK_ENTRY_Postal:
+ addrlist = QStringList::split(',', s, true);
+ addr = new KABC::Address(KABC::Address::Work);
+ switch (addrlist.count()) {
+ case 4: addr->setStreet(addrlist[0].simplifyWhiteSpace());
+ addr->setLocality(addrlist[1].simplifyWhiteSpace());
+ addr->setPostalCode(addrlist[2].simplifyWhiteSpace());
+ country = addrlist[3].simplifyWhiteSpace();
+ if (!country.isEmpty())
+ addr->setCountry(i18n(country.utf8()));
+ break;
+ case 3: addr->setLocality(addrlist[0].simplifyWhiteSpace());
+ addr->setPostalCode(addrlist[1].simplifyWhiteSpace());
+ country = addrlist[2].simplifyWhiteSpace();
+ if (!country.isEmpty())
+ addr->setCountry(i18n(country.utf8()));
+ break;
+ default: addr->setStreet(s.simplifyWhiteSpace());
+ }
+ a->insertAddress(*addr);
+ delete addr;
+ break;
+ case GN_PHONEBOOK_ENTRY_Note:
+ if (!a->note().isEmpty())
+ s = "\n" + s;
+ a->setNote(a->note()+s);
+ break;
+ case GN_PHONEBOOK_ENTRY_Number:
+ enum KABC::PhoneNumber::Types phonetype;
+ switch (entry.subentries[n].number_type) {
+ case GN_PHONEBOOK_NUMBER_Mobile: phonetype = KABC::PhoneNumber::Cell; break;
+ case GN_PHONEBOOK_NUMBER_Fax: phonetype = KABC::PhoneNumber::Fax; break;
+ case GN_PHONEBOOK_NUMBER_General:
+ case GN_PHONEBOOK_NUMBER_Work: phonetype = KABC::PhoneNumber::Work; break;
+ default:
+ case GN_PHONEBOOK_NUMBER_Home: phonetype = KABC::PhoneNumber::Home; break;
+ }
+ //if (s == entry.number)
+ // type = (KABC::PhoneNumber::Types) (phonetype | KABC::PhoneNumber::Pref);
+ a->insertPhoneNumber(KABC::PhoneNumber(s, phonetype));
+ break;
+ case GN_PHONEBOOK_ENTRY_URL:
+ a->setUrl(s);
+ break;
+ case GN_PHONEBOOK_ENTRY_Group:
+ a->insertCategory(s);
+ break;
+ default:
+ GNOKII_DEBUG(QString(" Not handled id=%1, entry=%2\n")
+ .arg(entry.subentries[n].entry_type).arg(s));
+ break;
+ } // switch()
+ } // for(subentry)
+
+ GNOKII_CHECK_ERROR(error);
+ return error;
+}
+
+/******************************************************************************************
+ *
+ ******************************************************************************************/
+
+
+
+// connect the device and ask user to turn device on (if necessary)
+bool KMobileGnokii::connectDevice(QWidget * /*parent*/)
+{
+ if (connected())
+ return true;
+
+ QString err = businit();
+ m_connected = err.isEmpty();
+ PRINT_DEBUG << QString("connectDevice() : %1\n").arg(m_connected ? "Ok" : err);
+ return m_connected;
+}
+
+// disconnect the device and return true, if sucessful
+bool KMobileGnokii::disconnectDevice(QWidget * /*parent*/)
+{
+ if (!connected())
+ return true;
+ busterminate();
+ m_connected = false;
+ PRINT_DEBUG << QString("disconnectDevice() : %1\n").arg("done");
+ return true;
+}
+
+// provice the own configuration dialog
+bool KMobileGnokii::configDialog(QWidget *parent)
+{
+ QString model, connection, port, baud;
+ int ok = 0;
+ GnokiiConfig *dialog = new GnokiiConfig(parent);
+ if (dialog) {
+ dialog->setValues(m_modelnr, m_connection, m_port, m_baud);
+ ok = dialog->exec();
+ }
+ dialog->getValues(model, connection, port, baud);
+ delete dialog;
+ if (ok == QDialog::Accepted) {
+ m_modelnr = model;
+ m_connection = connection;
+ m_port = port;
+ m_baud = baud;
+ saveDeviceConfiguration();
+ };
+ return true;
+}
+
+QString KMobileGnokii::iconFileName() const
+{
+ return "mobile_phone";
+}
+
+// return a unique ID, e.g. the IMEI number of phones, or a serial number
+// this String is used to have a unique identification for syncronisation.
+QString KMobileGnokii::deviceUniqueID()
+{
+ return QString("GNOKII-IMEI-%1").arg(QString::fromLocal8Bit(imei));
+}
+
+
+
+/**********************************************************************************
+ * Addressbook / Phonebook support *
+ **********************************************************************************/
+
+int KMobileGnokii::numAddresses()
+{
+ if (!connectDevice(NULL))
+ return 0;
+
+ gn_memory_status memstat;
+ gn_error error;
+
+ if (m_numAddresses>=0)
+ return m_numAddresses;
+
+ error = read_phone_memstat( GN_MT_ME, &memstat );
+ GNOKII_CHECK_ERROR(error);
+ if (error)
+ memstat.used = -1;
+
+ m_numAddresses = memstat.used;
+
+ if (m_numAddresses>0) {
+ // initialize the addrList array
+ m_addrList.clear();
+ KABC::Addressee addr;
+ for (int i=0; i<=m_numAddresses; i++)
+ m_addrList.append(addr);
+ }
+
+ return m_numAddresses;
+}
+
+int KMobileGnokii::readAddress( int index, KABC::Addressee &addr )
+{
+ PRINT_DEBUG << QString("############ GET ADDRESS #%1\n").arg(index);
+ // index is zero-based, but in gnokii the first address starts at 1
+ if (index<0 || index>=numAddresses())
+ return KIO::ERR_DOES_NOT_EXIST;
+
+ // now get our addressbook entry
+
+ // do we have this entry in the cache already ?
+ if (m_addrList.count() > (unsigned)index && !m_addrList[index].isEmpty()) {
+ addr = m_addrList[index];
+ return 0;
+ }
+
+ gn_error err = read_phone_entry_highlevel(index+1, GN_MT_ME, &addr );
+ if (!err)
+ m_addrList[index] = addr;
+
+ return gn_error2kio_error(err);
+}
+
+int KMobileGnokii::storeAddress( int, const KABC::Addressee &, bool )
+{
+ /* XXX: this is a read-only device */
+ return KIO::ERR_WRITE_ACCESS_DENIED;
+}
+
+
+
+/**********************************************************************************
+ * Calendar support *
+ **********************************************************************************/
+
+static void QDateTime_2_timestamp( const QDateTime &qdt, gn_timestamp &ts )
+{
+ ts.year = qdt.date().year();
+ ts.month = qdt.date().month();
+ ts.day = qdt.date().day();
+ ts.hour = qdt.time().hour();
+ ts.minute = qdt.time().minute();
+ ts.second = qdt.time().second();
+ ts.timezone = 0;
+}
+
+static QDateTime timestamp_2_QDateTime( const gn_timestamp &ts )
+{
+ return QDateTime( QDate(ts.year, ts.month, ts.day),
+ QTime(ts.hour, ts.minute, ts.second) );
+}
+
+static void print_calnote( const gn_calnote &entry )
+{
+ gn_timestamp ts = entry.time;
+ kdWarning() << "location=" << entry.location /* The number of the note in the phone memory */
+ << " type=" << entry.type /* The type of the note */
+ << " gn_timestamp=" << /* The time of the note */
+ " year=" << ts.year <<
+ " month=" << ts.month <<
+ " day=" << ts.day <<
+ " hour=" << ts.hour <<
+ " minute=" << ts.minute <<
+ " second=" << ts.second <<
+ " TZ=" << ts.timezone
+ << " gn_calnote_alarm="<< entry.alarm.enabled /* The alarm of the note */
+ << " text=" << entry.text /* The text of the note */
+ << " number=" << entry.phone_number /* For Call only: the phone number */
+ << " recurr=" << entry.recurrence << endl << endl;
+}
+
+
+
+
+int KMobileGnokii::numCalendarEntries()
+{
+ gn_data_clear(&data);
+ gn_calnote entry;
+
+ memset(&entry, 0, sizeof(entry));
+ data.calnote = &entry;
+ entry.location = 1;
+ data.calnote_list = &calnote_list;
+
+ gn_error error = gn_sm_functions(GN_OP_GetCalendarNote, &data, &state);
+ switch (error) {
+ case GN_ERR_NONE:
+ case GN_ERR_INVALIDLOCATION:
+ case GN_ERR_EMPTYLOCATION:
+ return calnote_list.number;
+ default:
+ GNOKII_CHECK_ERROR(error);
+ return 0;
+ }
+}
+
+int KMobileGnokii::readCalendarEntry( int index, KCal::Event &event )
+{
+ if (index < 0 || index >= GN_CALNOTE_MAX_NUMBER)
+ return KIO::ERR_DOES_NOT_EXIST;
+
+ gn_data_clear(&data);
+ gn_calnote entry;
+
+ memset(&entry, 0, sizeof(entry));
+ entry.location = index+1;
+ data.calnote = &entry;
+ data.calnote_list = &calnote_list;
+
+ gn_error error = gn_sm_functions(GN_OP_GetCalendarNote, &data, &state);
+ GNOKII_CHECK_ERROR(error);
+ if (error != GN_ERR_NONE)
+ return gn_error2kio_error(error);
+
+ print_calnote( entry );
+
+ QDateTime dt_start = timestamp_2_QDateTime(entry.time);
+ QDateTime dt_end = dt_start.addSecs( 60*60 ); // XXX: assume one hour
+ event.setDtStart( dt_start );
+ event.setDtEnd( dt_end );
+ event.setSummary( QString::fromUtf8(entry.text) );
+
+ // type:
+ switch (entry.type) {
+ case GN_CALNOTE_MEETING:
+ event.setCategories(i18n("MEETING"));
+ break;
+ case GN_CALNOTE_CALL:
+ event.setCategories(i18n("PHONE CALL"));
+ event.setDescription(QString::fromUtf8(entry.phone_number));
+ break;
+ case GN_CALNOTE_BIRTHDAY:
+ event.setCategories(i18n("BIRTHDAY"));
+ break;
+ case GN_CALNOTE_REMINDER:
+ event.setCategories(i18n("REMINDER"));
+ break;
+ default:
+ kdWarning() << "unknown calendar GN_CALNOTE_XXXX type #" << entry.type << endl;
+ }
+
+ // alarm:
+ if (entry.alarm.enabled) {
+ QDateTime at = timestamp_2_QDateTime(entry.alarm.timestamp);
+ if (at.isValid() && dt_start.isValid()) {
+ int seconds = abs(at.secsTo(dt_start));
+ seconds %= 60*60*24; /* max. 1 day in advance... */
+ KCal::Alarm *eventalarm = event.newAlarm();
+ eventalarm->setStartOffset(KCal::Duration(seconds));
+ }
+ }
+
+ // recurrence:
+ switch (entry.recurrence) {
+ case GN_CALNOTE_NEVER:
+ break;
+ case GN_CALNOTE_DAILY:
+ event.recurrence()->setDaily(1,-1);
+ break;
+ case GN_CALNOTE_WEEKLY:
+ case GN_CALNOTE_2WEEKLY:
+ event.recurrence()->setDaily( 7 + (entry.recurrence==GN_CALNOTE_2WEEKLY ? 7:0) , -1);
+ break;
+ case GN_CALNOTE_MONTHLY:
+ event.recurrence()->setMonthly(KCal::Recurrence::rMonthlyPos, 1, -1);
+ break;
+ case GN_CALNOTE_YEARLY:
+ event.recurrence()->setYearly(KCal::Recurrence::rYearlyPos, 1, -1);
+ break;
+ default: // hourly
+ event.recurrence()->setHourly(entry.recurrence, -1);
+ break;
+ }
+
+ return 0;
+}
+
+int KMobileGnokii::storeCalendarEntry( int index, const KCal::Event &event )
+{
+ if (index < 0 || index >= GN_CALNOTE_MAX_NUMBER)
+ return KIO::ERR_DOES_NOT_EXIST;
+
+ gn_error error;
+ gn_calnote entry;
+
+ gn_data_clear(&data);
+ memset(&entry, 0, sizeof(entry));
+ entry.location = index+1;
+ data.calnote = &entry;
+ data.calnote_list = &calnote_list;
+
+ // read first
+ error = gn_sm_functions(GN_OP_GetCalendarNote, &data, &state);
+ // GNOKII_CHECK_ERROR(error);
+
+ QDateTime_2_timestamp( event.dtStart(), entry.time );
+ strncpy(entry.text, event.summary().utf8(), sizeof(entry.text)-1);
+
+ // type:
+ entry.type = GN_CALNOTE_MEETING;
+ if (event.categories().findIndex(i18n("MEETING")) != -1) {
+ entry.type = GN_CALNOTE_MEETING;
+ } else if (event.categories().findIndex(i18n("PHONE CALL")) != -1) {
+ entry.type = GN_CALNOTE_CALL;
+ strncpy(entry.phone_number, event.description().utf8(), sizeof(entry.phone_number)-1);
+ } else if (event.categories().findIndex(i18n("BIRTHDAY")) != -1) {
+ entry.type = GN_CALNOTE_BIRTHDAY;
+ } else { // assume i18n("REMINDER")
+ entry.type = GN_CALNOTE_REMINDER;
+ }
+
+ // alarm:
+ entry.alarm.enabled = 0;
+ if (event.isAlarmEnabled()) {
+ const KCal::Alarm *eventalarm = *event.alarms().at(0);
+ if (eventalarm) {
+ if (eventalarm->hasTime()) {
+
+ QDateTime_2_timestamp( eventalarm->time(), entry.alarm.timestamp );
+ } else
+ if (eventalarm->hasStartOffset()) {
+ QDateTime dt = event.dtStart();
+ dt = dt.addSecs(-eventalarm->startOffset().asSeconds());
+ QDateTime_2_timestamp( dt, entry.alarm.timestamp );
+ }
+ }
+ }
+
+ // recurrence:
+ switch (event.recurrence()->recurrenceType()) {
+ case KCal::Recurrence::rNone:
+ default:
+ entry.recurrence = GN_CALNOTE_NEVER;
+ break;
+ case KCal::Recurrence::rHourly:
+ entry.recurrence = (gn_calnote_recurrence) (event.recurrence()->frequency());
+ break;
+ case KCal::Recurrence::rDaily:
+ entry.recurrence = GN_CALNOTE_DAILY;
+ break;
+ case KCal::Recurrence::rWeekly:
+ entry.recurrence = (gn_calnote_recurrence) (GN_CALNOTE_WEEKLY * event.recurrence()->frequency());
+ break;
+ case KCal::Recurrence::rMonthlyPos:
+ case KCal::Recurrence::rMonthlyDay:
+ entry.recurrence = GN_CALNOTE_MONTHLY;
+ break;
+ case KCal::Recurrence::rYearlyMonth:
+ case KCal::Recurrence::rYearlyDay:
+ case KCal::Recurrence::rYearlyPos:
+ entry.recurrence = GN_CALNOTE_YEARLY;
+ break;
+ }
+
+ print_calnote( entry );
+
+return 0; // XXX
+
+ error = gn_sm_functions(GN_OP_WriteCalendarNote, &data, &state);
+ GNOKII_CHECK_ERROR(error);
+
+ return 0;
+}
+
+
+/**********************************************************************************
+ * Notes support *
+ **********************************************************************************/
+
+int KMobileGnokii::numNotes()
+{
+ return 100; /* we simulate one address */
+}
+
+int KMobileGnokii::readNote( int index, QString &note )
+{
+ // index is zero-based, and we only have one simulated note
+ if (index<0 || index>=numNotes())
+ return KIO::ERR_DOES_NOT_EXIST;
+
+ note = QString("NOTE #%1\n"
+ "--------\n"
+ "This is a sample note #%2\n\n"
+ "DeviceClassName: %3\n"
+ "Device Driver : %4\n"
+ "Device Revision: %5\n")
+ .arg(index).arg(index)
+ .arg(deviceClassName()).arg(deviceName()).arg(revision());
+ return 0;
+}
+
+#include "gnokii_mobile.moc"
diff --git a/kmobile/devices/gnokii/gnokii_mobile.h b/kmobile/devices/gnokii/gnokii_mobile.h
new file mode 100644
index 000000000..fdc61e30e
--- /dev/null
+++ b/kmobile/devices/gnokii/gnokii_mobile.h
@@ -0,0 +1,93 @@
+/*
+ This file is part of libkmobile.
+ Copyright (c) 2003 - 2003 Helge Deller <deller@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
+ without including the source code for Qt in the source distribution.
+*/
+
+#ifndef LIBKMOBILE_GNOKII_H
+#define LIBKMOBILE_GNOKII_H
+
+#include <kmobiledevice.h>
+#include <kabc/addressee.h>
+
+class KMobileGnokii : public KMobileDevice
+{
+Q_OBJECT
+public:
+ KMobileGnokii( QObject *obj=0, const char *name=0, const QStringList &args=QStringList() );
+ ~KMobileGnokii();
+
+ // createObject needs to be reimplemented by every KMobileDevice driver
+ QObject *createObject( QObject *parent=0, const char *name=0,
+ const char *classname="QObject", const QStringList &args=QStringList() );
+
+ // connect, disconnect and current status
+ bool connectDevice(QWidget *parent);
+ bool disconnectDevice(QWidget *parent);
+
+ // provide a device-specific configure dialog
+ bool configDialog(QWidget *parent);
+
+ // filename and path to gnokii-icon
+ QString iconFileName() const;
+
+ QString deviceUniqueID();
+
+ /*
+ * Addressbook / Phonebook support
+ */
+ int numAddresses();
+ int readAddress( int index, KABC::Addressee &adr );
+ int storeAddress( int index, const KABC::Addressee &adr, bool append = false );
+
+ /*
+ * Calendar support
+ */
+ int numCalendarEntries();
+ int readCalendarEntry( int index, KCal::Event &entry );
+ int storeCalendarEntry( int index, const KCal::Event &entry );
+
+ /*
+ * Notes support
+ */
+ int numNotes();
+ int readNote( int index, QString &note );
+
+signals:
+ void connectionChanged( bool connected );
+ void message( int msgLevel, const QString &msg );
+
+protected:
+ bool setGnokiiStateMachine();
+ bool saveConfig( KConfig &conf, QString group );
+ bool loadConfig( KConfig &conf, QString group );
+ bool saveGnokiiConfiguration();
+ bool loadGnokiiConfiguration();
+ bool saveDeviceConfiguration();
+ bool loadDeviceConfiguration();
+
+private:
+ QString m_modelnr, m_connection, m_port, m_baud;
+
+ int m_numAddresses;
+ KABC::Addressee::List m_addrList;
+};
+
+#endif
diff --git a/kmobile/devices/gnokii/gnokiiconfig.cpp b/kmobile/devices/gnokii/gnokiiconfig.cpp
new file mode 100644
index 000000000..780dc23ce
--- /dev/null
+++ b/kmobile/devices/gnokii/gnokiiconfig.cpp
@@ -0,0 +1,98 @@
+/* This file is part of the KDE mobile library.
+ Copyright (C) 2003 Helge Deller <deller@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qlabel.h>
+#include <qwidget.h>
+#include <qcombobox.h>
+
+#include "gnokiiconfigui.h"
+#include "gnokiiconfig.h"
+
+#define MODELS "AT 1611 2110i 2148i 2711 2731 3110 3210 3310 3330 3360 3410 3810 " \
+ "5100 5110 5120 5130 5160 5190 540 550 6110 6120 6130 6150 616x " \
+ "6185 6190 6210 6230 6250 6310 6310i 6360 640 650 6510 6610 7110 7190 " \
+ "7650 8110 8210 8250 8290 8310 8810 9110 9210 RPM-1"
+
+#define CONNECTIONS "serial infrared irda dau9p dlr3p m2bus bluetooth tekram tcp"
+
+#if defined(__linux__) || defined(__linux)
+#define AVAILABLE_PORTS "/dev/ttyS0 /dev/ttyS1 /dev/ttyS2 /dev/ttyS3 " \
+ "/dev/ircomm0 /dev/ircomm1 /dev/irda /dev/rfcomm0 /dev/rfcomm1"
+#else
+#define AVAILABLE_PORTS "/dev/ttyS0"
+#endif
+
+#define BAUDRATES "57600 38400 19200 14400 9600 4800 2400"
+
+
+GnokiiConfig::GnokiiConfig( QWidget* parent, const char* name, bool modal, WFlags fl )
+ : GnokiiConfigUI(parent, name, modal, fl)
+{
+ QStringList list = QStringList::split(" ", MODELS);
+ cb_Model->insertStringList(list);
+
+ list = QStringList::split(" ", CONNECTIONS);
+ cb_Connection->insertStringList(list);
+
+ list = QStringList::split(" ", AVAILABLE_PORTS);
+ cb_Port->insertStringList(list);
+
+ list = QStringList::split(" ", BAUDRATES);
+ cb_Baud->insertStringList(list);
+}
+
+GnokiiConfig::~GnokiiConfig()
+{
+}
+
+void GnokiiConfig::setValues(const QString &model, const QString &connection, const QString &port, const QString &baud)
+{
+ cb_Model->setCurrentText(model);
+ cb_Connection->setCurrentText(connection);
+ cb_Port->setCurrentText(port);
+ cb_Baud->setCurrentText(baud);
+
+ slotCheckValues();
+
+ connect( cb_Connection, SIGNAL(textChanged(const QString &)), this, SLOT(slotCheckValues(const QString &)) );
+}
+
+void GnokiiConfig::getValues(QString &model, QString &connection, QString &port, QString &baud) const
+{
+ model = cb_Model->currentText();
+ connection = cb_Connection->currentText();
+ port = cb_Port->currentText();
+ baud = cb_Baud->currentText();
+}
+
+void GnokiiConfig::slotCheckValues(const QString &txt)
+{
+ bool disable_serial = (QString("infrared irda").find(txt,0,false)>=0);
+ textLabelBaudRate->setDisabled(disable_serial);
+ cb_Baud->setDisabled(disable_serial);
+}
+
+void GnokiiConfig::slotCheckValues()
+{
+ slotCheckValues(cb_Connection->currentText());
+}
+
+#include "gnokiiconfig.moc"
diff --git a/kmobile/devices/gnokii/gnokiiconfig.h b/kmobile/devices/gnokii/gnokiiconfig.h
new file mode 100644
index 000000000..662386010
--- /dev/null
+++ b/kmobile/devices/gnokii/gnokiiconfig.h
@@ -0,0 +1,41 @@
+/* This file is part of the KDE mobile library.
+ Copyright (C) 2004 Helge Deller <deller@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef GNOKIICONFIG_H
+#define GNOKIICONFIG_H
+
+#include <qobject.h>
+
+#include <gnokiiconfigui.h>
+
+class GnokiiConfig : public GnokiiConfigUI
+{
+Q_OBJECT
+public:
+ GnokiiConfig( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~GnokiiConfig();
+
+ void setValues(const QString &model, const QString &connection, const QString &port, const QString &baud);
+ void getValues(QString &model, QString &connection, QString &port, QString &baud) const;
+
+private slots:
+ void slotCheckValues();
+ void slotCheckValues(const QString &);
+};
+
+#endif
diff --git a/kmobile/devices/gnokii/gnokiiconfigui.ui b/kmobile/devices/gnokii/gnokiiconfigui.ui
new file mode 100644
index 000000000..5b2893a3a
--- /dev/null
+++ b/kmobile/devices/gnokii/gnokiiconfigui.ui
@@ -0,0 +1,273 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>GnokiiConfigUI</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>GnokiiConfigUI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>471</width>
+ <height>308</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Configure Gnokii Mobile Device</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Help</string>
+ </property>
+ <property name="accel">
+ <string>F1</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QFrame" row="0" column="0">
+ <property name="name">
+ <cstring>frame7</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Please configure your Gnokii mobile device</string>
+ </property>
+ </widget>
+ <spacer row="2" column="0">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>140</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QFrame" row="1" column="0">
+ <property name="name">
+ <cstring>frame8</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QComboBox" row="3" column="1">
+ <property name="name">
+ <cstring>cb_Baud</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <property name="name">
+ <cstring>cb_Connection</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>4</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="1">
+ <property name="name">
+ <cstring>cb_Port</cstring>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>cb_Model</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>41</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Connection:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Phone model:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel1_3</cstring>
+ </property>
+ <property name="text">
+ <string>Port:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabelBaudRate</cstring>
+ </property>
+ <property name="text">
+ <string>Baudrate:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>GnokiiConfigUI</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>GnokiiConfigUI</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmobile/devices/gnokii/libkmobile_gnokii.desktop b/kmobile/devices/gnokii/libkmobile_gnokii.desktop
new file mode 100644
index 000000000..6479e480a
--- /dev/null
+++ b/kmobile/devices/gnokii/libkmobile_gnokii.desktop
@@ -0,0 +1,109 @@
+[Desktop Entry]
+Name=Mobile Phone or Organizer (gnokii)
+Name[af]=Selfoon of Digitale Dagboek (gnokii)
+Name[ar]=الهاتف النقّال أو المنظم (gnokii)
+Name[be]=Мабільны тэлефон ці арганізатар (gnokii)
+Name[bg]=Мобилни телефони или организатори (gnokii)
+Name[bs]=Mobilni telefon ili organizer (gnokii)
+Name[ca]=Telèfon mòbil o organitzador (gnokii)
+Name[cs]=Mobilní telefon nebo Organizér (gnokii)
+Name[cy]=Ffôn Symudol neu Drefnydd (gnokii)
+Name[da]=Mobiltelefon eller organisator (gnokii)
+Name[de]=Mobiltelefon oder Organizer (gnokii)
+Name[el]=Κινητό τηλέφωνο ή Organizer (gnokii)
+Name[en_GB]=Mobile Phone or Organiser (gnokii)
+Name[es]=Teléfono móvil u organizador (gnokii)
+Name[et]=Mobiiltelefon või Organizer (gnokii)
+Name[eu]=Mugikorra edo antolatzailea (gnokii)
+Name[fa]=تلفن همراه یا سازمان‌دهنده (gnokii)
+Name[fi]=Matkapuhelin tai organisoija (gnokii)
+Name[fr]=Téléphone portable ou organiseur (gnokii)
+Name[fy]=Mobile tillefoan of Organizer (gnokii)
+Name[ga]=Fón Póca nó Eagraí (gnokii)
+Name[gl]=Teléfono móbil ou organizador (gnokii)
+Name[he]=טלפון נייד או אירגונית (gnokii)
+Name[hi]=मोबाइल फोन या आर्गेनाइज़र (ग्नोकी)
+Name[hu]=Mobiltelefon/határidőnapló-kezelő (Gnokii)
+Name[is]=Farsími eða lófatölva (gnokii)
+Name[it]=Telefono cellulare o organizer (gnokii)
+Name[ja]=携帯電話またはスケジュール管理 (gnokii)
+Name[ka]=მობილური ტელეფონი ან ორგანიზატორი(gnokii)
+Name[kk]=Қалта телефон не Ұйымдастырғыш (gnokii)
+Name[km]=កម្មវិធី​រៀបចំ​ទូរស័ព្ទ​ចល័ត (gnokii)
+Name[lt]=Mobilus telefonas ar asmeninės info tvarkyklė (gnokii)
+Name[ms]=Telefon Bimbit atau Penyusun (gnokii)
+Name[nb]=Mobiltelefon eller PDA (gnokii)
+Name[nds]=Mobiltelefoon oder Handreekner (gnokii)
+Name[ne]=मोबाइल फोन वा आयोजक (जिनोकी)
+Name[nl]=Mobiele telefoon of Organizer (gnokii)
+Name[nn]=Mobiltelefon eller organisator (gnokii)
+Name[pl]=Telefon komórkowy lub organizer (gnokii)
+Name[pt]=Organizador ou Telemóvel (Gnokii)
+Name[pt_BR]=Telefone Móvel ou Organizador (gnokii)
+Name[ru]=Мобильный телефон или органайзер (gnokii)
+Name[sk]=Mobil alebo organizér (gnokii)
+Name[sl]=Prenosni telefon ali organizator (gnokii)
+Name[sr]=Мобилни телефон или организатор (gnokii)
+Name[sr@Latn]=Mobilni telefon ili organizator (gnokii)
+Name[sv]=Mobilenhet (gnokii)
+Name[ta]=செல்பேசி அல்லது ஒருங்கிணைப்பாளர்(gnokii)
+Name[tg]=Телефони мобилӣ ё органайзери (gnokii)
+Name[tr]=Cep Telefonu ya da Organizer (gnokii)
+Name[uk]=Мобільний телефон та тижневик (gnokii)
+Name[uz]=Uyali telefon yoki organayzer (gnokii)
+Name[uz@cyrillic]=Уяли телефон ёки органайзер (gnokii)
+Name[zh_CN]=移动电话或 PDA(gnokii)
+Name[zh_TW]=行動電話或數位助理(gnokii)
+Comment=This driver supports many NOKIA and other mobile phones via the gnokii library
+Comment[af]=Hierdie drywer ondersteun baie Nokia en ander selfone d.m.v. die gnokii biblioteek
+Comment[bg]=Драйвер за поддръжка на мобилни телефони, предимно Нокиа, чрез библиотеката gnokii
+Comment[bs]=Ovaj drajver podržava mnoge NOKIA i druge mobilne telefone putem gnokii biblioteke
+Comment[ca]=Aquest controlador accepta molts NOKIA i d'altres telèfons mòbils mitjançant la biblioteca «gnokii»
+Comment[cs]=Tento ovladač podporuje mnoho mobilních telefonů NOKIA a dalších pomocí knihovny gnokii
+Comment[cy]=Cynhala'r gyrrydd yma lawer o ffoniau NOKIA a ffoniau symudol eraill drwy'r rhaglengell gnokii
+Comment[da]=Denne driver understøtter mange NOKIA og andre mobiltelefoner via gnokii-biblioteket
+Comment[de]=Ein Treiber, der zahlreiche NOKIA- und sonstige Mobiltelefone über die gnokii-Bibliothek unterstützt
+Comment[el]=Αυτός ο οδηγός υποστηρίζει πολλά NOKIA και άλλα κινητά τηλέφωνα μέσω της βιβλιοθήκης gnokii
+Comment[es]=Este manejador admite muchos teléfonos móviles NOKIA y de otras marcas vía la biblioteca gnokii
+Comment[et]=See draiver toetab gnokii teegi vahendusel paljusid Nokia ja teisi mobiiltelefone
+Comment[eu]=Kontrolatzaile honek NOKIA eta beste mugikor asko onartzen ditu gnokii liburutegiaren bidez
+Comment[fa]=این گرداننده، اغلب تلفنهای همراه نوکیا و غیره را از طریق کتابخانۀ gnokii پشتیبانی می‌کند
+Comment[fi]=Tämä ajuri tukee monia Nokian ja muita matkapuhelimia gnokii-kirjaston kautta
+Comment[fr]=Ce pilote prend en charge beaucoup de téléphones portables Nokia et autres à l'aide de la bibliothèque gnokii
+Comment[fy]=Dit stjoerprogramma jout stipe foar in soad Nokia- en oare mobile tilefoans fia de gnokii-bibliotheek
+Comment[ga]=Tacaíonn an tiománaí seo le neart fóin NOKIA agus cinn eile, tríd an leabharlann gnokii
+Comment[gl]=Este controlador soporta moitos móbiles Nokia e outros mediante a libraría gnokii
+Comment[hi]=यह ड्राइवर बहुत से नोकिया तथा अन्य मोबाइल फोनों को ग्नोकी लाइब्रेरी के द्वारा समर्थित करता है
+Comment[hu]=Ez a meghajtó mobiltelefonok (elsősorban Nokia gyártmányúak) kezelését teszi lehetővé a Gnokii programkönyvtáron keresztül
+Comment[is]=Þessi rekill styður marga farsíma frá NOKIA og fleiri gegnum gnokii aðgerðasafnið
+Comment[it]=Questo driver supporta molti NOKIA e altri telefoni cellulari tramite la libreria gnokii
+Comment[ja]=このドライバは gnokii ライブラリを介して NOKIA および他社製の携帯電話を幅広くサポートします
+Comment[ka]=ეს დრაივერი მხარს უჭერს Nokia-ს მრავალ და სხვა ტელეფონებს gnokii ბიბლიოთეკის საშუალებით
+Comment[kk]=Бұл көп NOKIA мен басқа қалта құрылғыларды, gnokii жиыны арқылы, қамтитын драйвер
+Comment[km]=កម្មវិធី​បញ្ជា​នេះ​គាំទ្រ​ប្រភេទ​ទូរស័ព្ទ​ណូគៀ និង​ទូរស័ព្ទ​ផ្សេងៗ​ទៀត​ជាច្រើន​តាម​រយៈ​បណ្ណាល័យ gnokii
+Comment[lt]=Ši tvarkyklė palaiko daugelį NOKIA ir kitų telefonų pasinaudodama gnokii biblioteka
+Comment[ms]=Pemacu ini menyokong banyak NOKIA dan telefon bimbit lain melalui pustaka gnokii
+Comment[nb]=Denne driveren støtter mange NOKIA og andre mobiltelefoner via gnokii-biblioteket
+Comment[nds]=Disse Driever ünnerstütt vele Nokia- un anner Mobiltelefonen över de gnokii-Bibliotheek
+Comment[ne]=यो ड्राइभरले जिनोकी लाइब्रेरीबाट धेरै नोकिया र अन्य मोबाइल फोन समर्थन गर्छ
+Comment[nl]=Dit stuurprogramma biedt ondersteuning voor veel Nokia- en andere mobiele telefoons via de gnokii-bibliotheek
+Comment[nn]=Denne drivaren støttar mange NOKIA og andre mobiltelefonar via gnokii-biblioteket
+Comment[pl]=Ten sterownik obsługuje wiele telefonów komórkowych Nokia i innych za pomocą biblioteki gnokii
+Comment[pt]=Este controlador suportar muitos NOKIAs, bem como outros telemóveis, com a biblioteca 'gnokii'
+Comment[pt_BR]=Este driver suporta muitos telefones móveis, NOKIA e outros, via biblioteca gnokii
+Comment[ru]=Этот драйвер поддерживает множество моделей мобильных телефонов Nokia и других производителей через библиотеку gnokii
+Comment[sk]=Tento ovládač podporuje veľa mobilov NOKIA a iných pomocou knižnice gnokii
+Comment[sl]=Ta gonilnik preko knjižnice gnokii podpira mnoge prenosne telefone NOKIA kot tudi druge
+Comment[sr]=Овај управљачки програм подржава многе Nokia-ине и друге мобилне телефоне преко библиотеке gnokii
+Comment[sr@Latn]=Ovaj upravljački program podržava mnoge Nokia-ine i druge mobilne telefone preko biblioteke gnokii
+Comment[sv]=Den här drivrutinen stöder många Nokia och andra mobiltelefoner via biblioteket gnokii
+Comment[ta]=இந்த இயக்கி பல NOKIA மற்றும் மற்ற செல்பேசிகளை gnokii நூலகம் வழியாக ஆதரிக்கிறது.
+Comment[tg]=Ин драйвер бисёри тамсилаҳои телефонҳои мобилии Nokia-ро ва дигар истеҳсолкунандаҳоро аз китобхонаи gnokii дастгирӣ мекунад
+Comment[tr]=Bu sürücü birçok NOKIA ve gnokii kütüphanesiyle diğer cep telefonlarını destekler
+Comment[uk]=Цей драйвер підтримує багато мобільних телефонів фірми NOKIA та інших мобільних телефонів через бібліотеку gnokii
+Comment[zh_CN]=此驱动程序通过 gnokii 库支持许多诺基亚和其它移动电话
+Comment[zh_TW]=此驅動程式支援許多 NOKIA 及其他手機,使用 gnokii 函式庫
+Type=Service
+ServiceTypes=kdedevice/mobiledevice
+X-KDE-Library=libkmobile_gnokii
+Icon=mobile_phone
diff --git a/kmobile/devices/pics/Makefile.am b/kmobile/devices/pics/Makefile.am
new file mode 100644
index 000000000..489635e5b
--- /dev/null
+++ b/kmobile/devices/pics/Makefile.am
@@ -0,0 +1,6 @@
+libkmobilepics_DATA = \
+ mobile_phone.png mobile_organizer.png mobile_camera.png \
+ mobile_musicplayer.png mobile_unknown.png
+
+# libkmobilepicsdir = $(kde_datadir)/kmobile/pics
+libkmobilepicsdir = $(kde_icondir)/default.kde/32x32/devices
diff --git a/kmobile/devices/pics/mobile_camera.png b/kmobile/devices/pics/mobile_camera.png
new file mode 100644
index 000000000..6876fa90c
--- /dev/null
+++ b/kmobile/devices/pics/mobile_camera.png
Binary files differ
diff --git a/kmobile/devices/pics/mobile_musicplayer.png b/kmobile/devices/pics/mobile_musicplayer.png
new file mode 100644
index 000000000..2036faa52
--- /dev/null
+++ b/kmobile/devices/pics/mobile_musicplayer.png
Binary files differ
diff --git a/kmobile/devices/pics/mobile_organizer.png b/kmobile/devices/pics/mobile_organizer.png
new file mode 100644
index 000000000..ffa2b6fb1
--- /dev/null
+++ b/kmobile/devices/pics/mobile_organizer.png
Binary files differ
diff --git a/kmobile/devices/pics/mobile_phone.png b/kmobile/devices/pics/mobile_phone.png
new file mode 100644
index 000000000..ca416931b
--- /dev/null
+++ b/kmobile/devices/pics/mobile_phone.png
Binary files differ
diff --git a/kmobile/devices/pics/mobile_unknown.png b/kmobile/devices/pics/mobile_unknown.png
new file mode 100644
index 000000000..785b8a0fc
--- /dev/null
+++ b/kmobile/devices/pics/mobile_unknown.png
Binary files differ
diff --git a/kmobile/devices/skeleton/Makefile.am b/kmobile/devices/skeleton/Makefile.am
new file mode 100644
index 000000000..7003bbc63
--- /dev/null
+++ b/kmobile/devices/skeleton/Makefile.am
@@ -0,0 +1,11 @@
+INCLUDES = -I$(top_srcdir)/kmobile -I$(top_srcdir) $(all_includes)
+
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = libkmobile_skeleton.la
+
+kde_services_DATA = libkmobile_skeleton.desktop
+
+libkmobile_skeleton_la_SOURCES = skeleton.cpp
+libkmobile_skeleton_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) $(KDE_RPATH) -no-undefined -module
+libkmobile_skeleton_la_LIBADD = ../../libkmobiledevice.la
diff --git a/kmobile/devices/skeleton/libkmobile_skeleton.desktop b/kmobile/devices/skeleton/libkmobile_skeleton.desktop
new file mode 100644
index 000000000..06f59c101
--- /dev/null
+++ b/kmobile/devices/skeleton/libkmobile_skeleton.desktop
@@ -0,0 +1,109 @@
+[Desktop Entry]
+Name=Skeleton Device
+Name[af]=Raamwerk Toestel
+Name[bg]=Организатори
+Name[br]=Patrom trobarzhell
+Name[bs]=Skeleton uređaj
+Name[ca]=Dispositiu Skeleton
+Name[cs]=Ukázkové zařízení
+Name[cy]=Dyfais Sgerbwd
+Name[da]=Skeleton-enhed
+Name[de]=Skeleton-Gerät
+Name[el]=Συσκευή Skeleton
+Name[eo]=Skelet-aparato
+Name[es]=Dispositivo Skeleton
+Name[et]=Mallseade
+Name[eu]=Skeleton dispositiboa
+Name[fa]=دستگاه Skeleton
+Name[fi]=Luurankolaite
+Name[fr]=Périphérique modèle
+Name[fy]=Foarbyldapparaat
+Name[ga]=Creatghléas
+Name[gl]=Dispositivo Skeleton
+Name[he]=התקן דמה
+Name[hi]=स्केलेटन उपकरण
+Name[hu]=Skeleton eszköz
+Name[is]=Grunntæki
+Name[it]=Dispositivo skeleton
+Name[ja]=スケルトンデバイス
+Name[ka]=მოწყობილობის ჩონჩხი
+Name[kk]=Қаңқалы құрылғы
+Name[km]=ឧបករណ៍​គ្រោង
+Name[lt]=Įrenginio skeletas
+Name[ms]=Peranti Rangka
+Name[nb]=Ramme-enhet
+Name[nds]=Skeleton-Reedschap
+Name[ne]=ढाँचा यन्त्र
+Name[nl]=Voorbeeldapparaat
+Name[nn]=Skjeletteining
+Name[pl]=Urządzenie szkieletowe
+Name[pt]=Dispositivo de Esqueleto
+Name[pt_BR]=Dispositivo Skeleton
+Name[ro]=Dispozitiv schelet
+Name[ru]=Прототип устройства
+Name[sk]=Kostra zariadenia
+Name[sl]=Ogrodna naprava
+Name[sr]=Скелетни уређај
+Name[sr@Latn]=Skeletni uređaj
+Name[sv]=Obestämd mobilenhet
+Name[ta]= எலும்புக்கூடு சாதனம்
+Name[tg]=Прототипи дастгоҳ
+Name[tr]=Çatı Aygıt
+Name[uk]=Прототип пристрою
+Name[zh_CN]=万能设备
+Name[zh_TW]=空殼裝置
+Comment=Mobile Skeleton Device
+Comment[af]=Mobiele raamwerk toestel
+Comment[bg]=Мобилни организатори (устройства)
+Comment[bs]=Mobilni skeleton uređaj
+Comment[ca]=Dispositiu mòbil Skeleton
+Comment[cs]=Ukázkové mobilní zařízení
+Comment[cy]=Dyfais Sgerbwd Symudol
+Comment[da]=Mobil skeleton-enhed
+Comment[de]=Mobiles Skeleton-Gerät
+Comment[el]=Φορητή συσκευή Skeleton
+Comment[eo]=Mobila skelet-aparato
+Comment[es]=Dispositivo móvil Skeleton
+Comment[et]=Mobiili mallseade
+Comment[eu]=Skeleton dispositibo mugikorra
+Comment[fa]=دستگاه Skeleton تلفن همراه
+Comment[fi]=Matkapuhelimen luurankolaite
+Comment[fr]=Modèle de périphérique mobile
+Comment[fy]=Mobyl foarbyldapparaat
+Comment[ga]=Creatghléas Móibíleach
+Comment[gl]=Dispositivo de Esqueleto Móbil
+Comment[he]=התקן נייד דמה
+Comment[hi]=मोबाइल स्केलेटन उपकरण
+Comment[hu]=Hordozható skeleton eszköz
+Comment[is]=Grunn farsími eða lófatölva
+Comment[it]=Dispositivo portatile skeleton
+Comment[ja]=モバイルスケルトンデバイス
+Comment[ka]=მობილურის ჩონჩხის მოწყობილობა
+Comment[kk]=Қалта қаңқалы құрылғы
+Comment[km]=ឧបករណ៍​គ្រោង​ចល័ត
+Comment[lt]=Mobilaus įrenginio skeletas
+Comment[ms]=Peranti Rangka Mudah Alih
+Comment[nb]=Mobil ramme-enhet
+Comment[nds]=Mobil Skeleton-Reedschap
+Comment[ne]=मोबाइल ढाँचा यन्त्र
+Comment[nl]=Mobiel voorbeeldapparaat
+Comment[nn]=Mobil skjeletteining
+Comment[pl]=Szkieletowe urządzenie przenośne
+Comment[pt]=Um Dispositivo Móvel de Esqueleto
+Comment[pt_BR]=Dispositivo Skeleton Móvel
+Comment[ru]=Прототип мобильного устройства
+Comment[sk]=Kostra zariadenia mobilumobilného zaria
+Comment[sl]=Mobilna ogrodna naprava
+Comment[sr]=Мобилни скелетни уређај
+Comment[sr@Latn]=Mobilni skeletni uređaj
+Comment[sv]=Obestämd mobilenhet
+Comment[ta]=நடமாடும் எலும்பு சாதனம்
+Comment[tg]=Прототипи дастгоҳи мобилӣ
+Comment[tr]=Taşınabilir Çatı Aygıtı
+Comment[uk]=Прототип мобільного пристрою
+Comment[zh_CN]=移动万能设备
+Comment[zh_TW]=行動通訊空殼裝置
+Type=Service
+ServiceTypes=kdedevice/mobiledevice
+X-KDE-Library=libkmobile_skeleton
+Icon=mobile_unknown
diff --git a/kmobile/devices/skeleton/skeleton.cpp b/kmobile/devices/skeleton/skeleton.cpp
new file mode 100644
index 000000000..122e2af20
--- /dev/null
+++ b/kmobile/devices/skeleton/skeleton.cpp
@@ -0,0 +1,164 @@
+/* This file is part of the libkmobile library.
+ Copyright (C) 2003 Helge Deller <deller@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include <qstring.h>
+#include <qstringlist.h>
+
+#include <klibloader.h>
+#include <kstandarddirs.h>
+#include <kmessagebox.h>
+
+#include <kio/global.h>
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "skeleton.h"
+
+
+/* This is a loaded library, which is initialized with the line below */
+K_EXPORT_COMPONENT_FACTORY( libkmobile_skeleton, KMobileSkeleton() )
+
+/* createObject needs to be reimplemented by every KMobileDevice driver */
+QObject *KMobileSkeleton::createObject( QObject *parent, const char *name,
+ const char *, const QStringList &args )
+{
+ return new KMobileSkeleton( parent, name, args );
+}
+
+
+/**
+ * The KDE skeleton mobile device driver.
+ */
+
+KMobileSkeleton::KMobileSkeleton(QObject *obj, const char *name, const QStringList &args )
+ : KMobileDevice(obj, name, args)
+{
+ // set initial device info
+ setClassType( Phone );
+ m_deviceName = i18n("LX-50-Moohoo Addressbook (Skeleton)");
+ m_deviceRevision = "0.1";
+ setCapabilities( hasAddressBook | hasNotes );
+}
+
+KMobileSkeleton::~KMobileSkeleton()
+{
+}
+
+// connect the device and ask user to turn device on (if necessary)
+bool KMobileSkeleton::connectDevice(QWidget *parent)
+{
+ if (KMessageBox::Continue != KMessageBox::warningContinueCancel(parent,
+ i18n("Please turn on your %1 on now and press continue to proceed.").arg(m_deviceName),
+ m_deviceClassName ) )
+ return false;
+ // connect it now...
+ m_connected = true;
+ return m_connected;
+}
+
+// disconnect the device and return true, if sucessful
+bool KMobileSkeleton::disconnectDevice(QWidget *)
+{
+ m_connected = true;
+ return true;
+}
+
+// returns true, if this device is read-only (default: false)
+bool KMobileSkeleton::isReadOnly() const
+{
+ return true;
+}
+
+// return a unique ID, e.g. the IMEI number of phones, or a serial number
+// this String is used to have a unique identification for syncronisation.
+QString KMobileSkeleton::deviceUniqueID()
+{
+ return QString::fromLocal8Bit("SkElEtOn-123456789");
+}
+
+QString KMobileSkeleton::iconFileName() const
+{
+ return "mobile_unknown"; /* KMOBILE_ICON_UNKNOWN */
+}
+
+/*
+ * Addressbook / Phonebook support
+ */
+int KMobileSkeleton::numAddresses()
+{
+ return 10; /* number of addresses we simulate */
+}
+
+int KMobileSkeleton::readAddress( int index, KABC::Addressee &addr )
+{
+ // index is zero-based
+ if (index<0 || index>=numAddresses())
+ return KIO::ERR_DOES_NOT_EXIST;
+
+ // now build our own sample name
+ addr.setFamilyName(QString("Meyer_%1").arg(index+1));
+ addr.setGivenName("Peter");
+ addr.setFormattedName("Peter "+addr.familyName());
+ addr.setNickName("PeterM");
+ addr.setBirthday(QDateTime(QDate(1970,7,22)));
+ addr.setRole("KDE Software Developer");
+ addr.setOrganization("KDE.ORG");
+ addr.setNote("the best KDE developer ever");
+ addr.setUrl(KURL("www.kde.org"));
+ addr.insertEmail("peterm@kde.org");
+ addr.insertPhoneNumber(KABC::PhoneNumber("+49 6110 12345"));
+
+ // the Revision might be important for syncronisations
+ addr.setRevision(QDateTime(QDate(2003,1,1)));
+
+ return 0;
+}
+
+int KMobileSkeleton::storeAddress( int, const KABC::Addressee &, bool )
+{
+ /* this is a read-only device */
+ return KIO::ERR_WRITE_ACCESS_DENIED;
+}
+
+/*
+ * Notes support
+ */
+int KMobileSkeleton::numNotes()
+{
+ return 100;
+}
+
+int KMobileSkeleton::readNote( int index, QString &note )
+{
+ // index is zero-based, and we only have one simulated note
+ if (index<0 || index>=numNotes())
+ return KIO::ERR_DOES_NOT_EXIST;
+
+ note = QString("NOTE #%1\n"
+ "--------\n"
+ "This is a sample note #%2\n\n"
+ "DeviceClassName: %3\n"
+ "Device Driver : %4\n"
+ "Device Revision: %5\n")
+ .arg(index).arg(index)
+ .arg(deviceClassName()).arg(deviceName()).arg(revision());
+ return 0;
+}
+
+#include "skeleton.moc"
diff --git a/kmobile/devices/skeleton/skeleton.h b/kmobile/devices/skeleton/skeleton.h
new file mode 100644
index 000000000..eb0d7db0b
--- /dev/null
+++ b/kmobile/devices/skeleton/skeleton.h
@@ -0,0 +1,71 @@
+/*
+ This file is part of libkmobile.
+ Copyright (c) 2003 - 2003 Helge Deller <deller@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
+ without including the source code for Qt in the source distribution.
+*/
+
+#ifndef LIBKMOBILE_SKELETON_H
+#define LIBKMOBILE_SKELETON_H
+
+#include <kmobiledevice.h>
+
+class KMobileSkeleton : public KMobileDevice
+{
+Q_OBJECT
+public:
+ KMobileSkeleton( QObject *obj=0, const char *name=0, const QStringList &args=QStringList() );
+ ~KMobileSkeleton();
+
+ // createObject needs to be reimplemented by every KMobileDevice driver
+ QObject *createObject( QObject *parent=0, const char *name=0,
+ const char *classname="QObject", const QStringList &args=QStringList() );
+
+ // connect, disconnect and current status
+ bool connectDevice(QWidget *parent);
+ bool disconnectDevice(QWidget *parent);
+
+ // returns true, if this device is read-only (default: false)
+ bool isReadOnly() const;
+
+ // you may provide your own icon() implementation to display
+ // an appropriate Pixmap (e.g. a Palm Pilot or a Zaurus image).
+ QString iconFileName() const;
+
+ QString deviceUniqueID();
+
+ /*
+ * Addressbook / Phonebook support
+ */
+ int numAddresses();
+ int readAddress( int index, KABC::Addressee &adr );
+ int storeAddress( int index, const KABC::Addressee &adr, bool append = false );
+
+ /*
+ * Notes support
+ */
+ int numNotes();
+ int readNote( int index, QString &note );
+
+signals:
+ void connectionChanged( bool connected );
+ void message( int msgLevel, const QString &msg );
+};
+
+#endif
diff --git a/kmobile/hi16-app-kmobile.png b/kmobile/hi16-app-kmobile.png
new file mode 100644
index 000000000..c339a2139
--- /dev/null
+++ b/kmobile/hi16-app-kmobile.png
Binary files differ
diff --git a/kmobile/hi32-app-kmobile.png b/kmobile/hi32-app-kmobile.png
new file mode 100644
index 000000000..0f5d74ec1
--- /dev/null
+++ b/kmobile/hi32-app-kmobile.png
Binary files differ
diff --git a/kmobile/hi48-app-kmobile.png b/kmobile/hi48-app-kmobile.png
new file mode 100644
index 000000000..3b959914a
--- /dev/null
+++ b/kmobile/hi48-app-kmobile.png
Binary files differ
diff --git a/kmobile/kioslave/Makefile.am b/kmobile/kioslave/Makefile.am
new file mode 100644
index 000000000..6f9d24201
--- /dev/null
+++ b/kmobile/kioslave/Makefile.am
@@ -0,0 +1,18 @@
+SUBDIRS = mimetypes
+
+INCLUDES = -I$(top_srcdir)/kmobile -I$(top_srcdir) $(all_includes)
+
+kde_module_LTLIBRARIES = kio_mobile.la
+
+kio_mobile_la_SOURCES = kio_mobile.cpp
+kio_mobile_la_LIBADD = $(LIB_KIO) ../libkmobileclient.la
+kio_mobile_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -module $(KDE_PLUGIN)
+
+kde_services_DATA = mobile.protocol cellphone.protocol \
+ organizer.protocol pda.protocol
+# do not install the camera protocol now - we already have a
+# camera kioslave !!
+# phonecamera.protocol
+
+messages:
+ $(XGETTEXT) *.cpp -o $(podir)/kio_mobile.pot
diff --git a/kmobile/kioslave/cellphone.protocol b/kmobile/kioslave/cellphone.protocol
new file mode 100644
index 000000000..5f37df784
--- /dev/null
+++ b/kmobile/kioslave/cellphone.protocol
@@ -0,0 +1,18 @@
+[Protocol]
+exec=kio_mobile
+protocol=cellphone
+input=none
+output=filesystem
+# listing=Name
+listing=Name,Type,URL,MimeType
+reading=true
+source=true
+writing=true
+makedir=true
+deleting=true
+# linking=true
+# moving=true
+# mimetype=text/plain
+# determineMimetypeFromExtension=true
+DocPath=kioslave/mobile.html
+Icon=mobile_phone
diff --git a/kmobile/kioslave/kio_mobile.cpp b/kmobile/kioslave/kio_mobile.cpp
new file mode 100644
index 000000000..ec987fb06
--- /dev/null
+++ b/kmobile/kioslave/kio_mobile.cpp
@@ -0,0 +1,636 @@
+/* This file is part of the KDE KMobile library
+ Copyright (C) 2003 Helge Deller <deller@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <time.h>
+
+#include <qregexp.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+#include <kinstance.h>
+#include <kabc/vcardconverter.h>
+
+#include "kio_mobile.h"
+
+#include <kdepimmacros.h>
+
+using namespace KIO;
+
+#define KIO_MOBILE_DEBUG_AREA 7126
+#define PRINT_DEBUG kdDebug(KIO_MOBILE_DEBUG_AREA) << "kio_mobile: "
+
+extern "C" { KDE_EXPORT int kdemain(int argc, char **argv); }
+
+/**
+ * The main program.
+ */
+int kdemain(int argc, char **argv)
+{
+ KInstance instance( "kio_mobile" );
+
+ PRINT_DEBUG << "Starting " << getpid() << endl;
+
+ if (argc != 4) {
+ fprintf(stderr, "Usage kio_mobile protocol pool app\n");
+ return -1;
+ }
+ // let the protocol class do its work
+ KMobileProtocol slave(argv[2], argv[3]);
+
+ slave.dispatchLoop();
+
+ PRINT_DEBUG << "Done" << endl;
+ return 0;
+}
+
+
+/**
+ * Initialize the mobile slave
+ */
+KMobileProtocol::KMobileProtocol(const QCString &pool, const QCString &app)
+ : SlaveBase( "mobile", pool, app)
+{
+}
+
+KMobileProtocol::~KMobileProtocol()
+{
+}
+
+/*
+ * getDeviceAndRessource("mobile:/<devicename>/<resource>/...") - split
+ */
+int KMobileProtocol::getDeviceAndRessource(const QString &_path,
+ QString &devName, QString &resource, QString &devPath,
+ KMobileDevice::Capabilities &devCaps)
+{
+// PRINT_DEBUG << QString("###getDeviceAndRessource### %1\n").arg(_path);
+ QStringList path = QStringList::split('/', _path, false);
+
+ devName = resource = devPath = QString::null;
+ devCaps = KMobileDevice::hasNothing;
+
+ if (path.count() >= 1) { devName = path[0]; path.pop_front(); };
+ if (path.count() >= 1) { resource = path[0]; path.pop_front(); };
+ if (path.count() >= 1) devPath = path.join("/");
+
+ if (devName.isEmpty())
+ return 0;
+
+ int _caps = m_dev.capabilities(devName);
+
+ if (resource.isEmpty()) {
+ devCaps = (KMobileDevice::Capabilities) _caps;
+ return 0;
+ }
+
+ for (int i=0; i<31; i++) {
+ int cap = 1UL << i;
+ if ((_caps & cap) == 0)
+ continue;
+ QString capname = m_dev.nameForCap(devName,cap);
+ if (capname != resource)
+ continue;
+ devCaps = (KMobileDevice::Capabilities) cap;
+ return 0;
+ }
+
+ return KIO::ERR_DOES_NOT_EXIST;
+}
+
+
+static
+void addAtom(KIO::UDSEntry& entry, unsigned int ID, long l, const QString& s = QString::null)
+{
+ KIO::UDSAtom atom;
+ atom.m_uds = ID;
+ atom.m_long = l;
+ atom.m_str = s;
+ entry.append(atom);
+}
+
+static
+void createDirEntry(KIO::UDSEntry& entry, const QString& name, const QString& url, const QString& mime)
+{
+ entry.clear();
+ addAtom(entry, KIO::UDS_NAME, 0, name);
+ addAtom(entry, KIO::UDS_FILE_TYPE, S_IFDIR);
+ addAtom(entry, KIO::UDS_ACCESS, 0500);
+ addAtom(entry, KIO::UDS_MIME_TYPE, 0, mime);
+ addAtom(entry, KIO::UDS_URL, 0, url);
+ addAtom(entry, KIO::UDS_USER, 0, getenv("USER"));
+ addAtom(entry, KIO::UDS_GROUP, 0, getenv("USER"));
+ PRINT_DEBUG << QString("createDirEntry: File: %1 MIME: %2 URL: %3\n").arg(name).arg(mime).arg(url);
+// addAtom(entry, KIO::UDS_SIZE, 0);
+ addAtom(entry, KIO::UDS_GUESSED_MIME_TYPE, 0, mime);
+}
+
+static
+void createFileEntry(KIO::UDSEntry& entry, const QString& name, const QString& url, const QString& mime,
+ const unsigned long size = 0)
+{
+ entry.clear();
+ addAtom(entry, KIO::UDS_NAME, 0, name);
+ addAtom(entry, KIO::UDS_FILE_TYPE, S_IFREG);
+ addAtom(entry, KIO::UDS_URL, 0, url);
+ addAtom(entry, KIO::UDS_ACCESS, 0400);
+ addAtom(entry, KIO::UDS_USER, 0, getenv("USER"));
+ addAtom(entry, KIO::UDS_GROUP, 0, getenv("USER"));
+ addAtom(entry, KIO::UDS_MIME_TYPE, 0, mime);
+ if (size) addAtom(entry, KIO::UDS_SIZE, size);
+ addAtom(entry, KIO::UDS_GUESSED_MIME_TYPE, 0, mime);
+ PRINT_DEBUG << QString("createFileEntry: File: %1, Size: %2, MIME: %3\n").arg(name).arg(size).arg(mime);
+}
+
+
+/**
+ * Get the information contained in the URL.
+ */
+void KMobileProtocol::get(const KURL &url)
+{
+ PRINT_DEBUG << "###############################\n";
+ PRINT_DEBUG << QString("get(%1)\n").arg(url.path());
+
+ KMobileDevice::Capabilities devCaps;
+ QString devName, resource, devPath;
+
+ int err = getDeviceAndRessource(url.path(), devName, resource, devPath, devCaps);
+ if (err) {
+ error(err, url.path());
+ return;
+ }
+
+ if (devName.isEmpty() || resource.isEmpty()) {
+ error(KIO::ERR_DOES_NOT_EXIST, url.path());
+ return;
+ }
+
+ // collect the result
+ QCString result;
+ QString mime;
+ switch (devCaps) {
+ case KMobileDevice::hasAddressBook: err = getVCard(devName, result, mime, devPath);
+ break;
+ case KMobileDevice::hasCalendar: err = getCalendar(devName, result, mime, devPath);
+ break;
+ case KMobileDevice::hasNotes: err = getNote(devName, result, mime, devPath);
+ break;
+ case KMobileDevice::hasFileStorage: err = getFileStorage(devName, result, mime, devPath);
+ break;
+ default: err = KIO::ERR_CANNOT_ENTER_DIRECTORY; /* TODO */
+ }
+
+ if (err) {
+ error(err, url.path());
+ return;
+ }
+
+ // tell the mimetype
+ mimeType(mime);
+
+ // tell the length
+ KIO::filesize_t processed_size = result.length();
+ totalSize(processed_size);
+
+ // tell the contents of the URL
+ QByteArray array;
+ array.setRawData( result.data(), result.length() );
+ data(array);
+ array.resetRawData( result.data(), result.length() );
+ processedSize( processed_size );
+ // tell we are finished
+ data(QByteArray());
+
+ // tell we are finished
+ finished();
+}
+
+
+/*
+ * listRoot() - gives listing of all devices
+ */
+void KMobileProtocol::listRoot(const KURL& url)
+{
+ PRINT_DEBUG << QString("########## listRoot(%1) for %2:/\n").arg(url.path()).arg(url.protocol());
+
+ KIO::UDSEntry entry;
+
+ QStringList deviceNames = m_dev.deviceNames();
+ unsigned int dirs = deviceNames.count();
+ totalSize(dirs);
+
+ int classMask = KMobileDevice::Unclassified;
+ /* handle all possible protocols here and just add a <protocol>.protocol file */
+ if (url.protocol() == "cellphone") // cellphone:/
+ classMask = KMobileDevice::Phone;
+ if (url.protocol() == "organizer" || // organizer:/
+ url.protocol() == "pda") // pda:/
+ classMask = KMobileDevice::Organizer;
+ if (url.protocol() == "phonecamera") // camera:/
+ classMask = KMobileDevice::Camera;
+
+ for (unsigned int i=0; i<dirs; i++) {
+
+ QString devName = deviceNames[i];
+
+ if (classMask != KMobileDevice::Unclassified &&
+ m_dev.classType(devName) != classMask)
+ continue;
+
+ createDirEntry(entry, devName, "mobile:/"+devName,
+ KMOBILE_MIMETYPE_DEVICE_KONQUEROR(devName));
+ listEntry(entry, false);
+
+ processedSize(i+1);
+ }
+ listEntry(entry, true);
+ finished();
+}
+
+
+/*
+ * folderMimeType() - returns mimetype of the folder itself
+ */
+QString KMobileProtocol::folderMimeType(int cap)
+{
+ QString mimetype;
+ switch (cap) {
+ case KMobileDevice::hasAddressBook: mimetype = KMOBILE_MIMETYPE_INODE "addressbook";
+ break;
+ case KMobileDevice::hasCalendar: mimetype = KMOBILE_MIMETYPE_INODE "calendar";
+ break;
+ case KMobileDevice::hasNotes: mimetype = KMOBILE_MIMETYPE_INODE "notes";
+ break;
+ case KMobileDevice::hasFileStorage:
+ default: mimetype = "inode/directory";
+ }
+ return mimetype;
+}
+
+/*
+ * entryMimeType() - returns mimetype of the entries in the given folder
+ */
+QString KMobileProtocol::entryMimeType(int cap)
+{
+ QString mimetype;
+ switch (cap) {
+ case KMobileDevice::hasAddressBook: mimetype = "text/x-vcard";
+ break;
+ case KMobileDevice::hasCalendar: mimetype = "text/x-vcalendar";
+ break;
+ case KMobileDevice::hasNotes: mimetype = "text/plain";
+ break;
+ case KMobileDevice::hasFileStorage:
+ default: mimetype = "text/plain";
+ }
+ return mimetype;
+}
+
+/*
+ * listTopDeviceDir("mobile:/<devicename>") - sub-directory of a devices
+ */
+
+void KMobileProtocol::listTopDeviceDir(const QString &devName)
+{
+ PRINT_DEBUG << QString("listTopDeviceDir(%1)\n").arg(devName);
+
+ KIO::UDSEntry entry;
+ unsigned int caps = m_dev.capabilities(devName);
+
+ for (int i=0; i<31; i++) {
+ unsigned int cap = 1UL<<i;
+ if ((caps & cap) == 0)
+ continue;
+
+ QString filename = m_dev.nameForCap(devName, cap);
+ QString mimetype = folderMimeType(cap);
+
+ createDirEntry(entry, filename, QString("mobile:/%1/%2/").arg(devName).arg(filename), mimetype);
+ listEntry(entry, false);
+ }
+ listEntry(entry, true);
+ finished();
+}
+
+
+/*
+ * listEntries("mobile:/<devicename>/<resource>") - resources of a device
+ */
+void KMobileProtocol::listEntries(const QString &devName,
+ const QString &resource, const QString &devPath,
+ const KMobileDevice::Capabilities devCaps)
+{
+ PRINT_DEBUG << QString("listEntries(%1,%2,%3)\n").arg(devName).arg(resource).arg(devPath);
+ switch (devCaps) {
+ case KMobileDevice::hasAddressBook: listAddressBook(devName, resource);
+ break;
+ case KMobileDevice::hasCalendar: listCalendar(devName, resource);
+ break;
+ case KMobileDevice::hasNotes: listNotes(devName, resource);
+ break;
+ case KMobileDevice::hasFileStorage: listFileStorage(devName, resource, devPath);
+ break;
+ default: error( ERR_CANNOT_ENTER_DIRECTORY,
+ QString("/%1/%2").arg(devName).arg(resource) );
+ }
+}
+
+/*
+ * listAddressBook("mobile:/<devicename>/Addressbook) - list the addressbook
+ */
+void KMobileProtocol::listAddressBook(const QString &devName, const QString &resource)
+{
+ PRINT_DEBUG << QString("listAddressBook(%1)\n").arg(devName);
+
+ KIO::UDSEntry entry;
+
+ int fieldwidth;
+ int entries = m_dev.numAddresses(devName);
+ if (entries>=1000) fieldwidth=4; else
+ if (entries>=100) fieldwidth=3; else
+ if (entries>=10) fieldwidth=2; else fieldwidth=1;
+ totalSize(entries);
+// QRegExp rx; rx.setPattern( ".*FN:([\\w\\s]*)[\\n\\r]{2}.*" );
+ QString name;
+ for (int i=0; i<entries; i++) {
+
+#if 0
+ QString content = m_dev.readAddress(devName, i);
+ if ( rx.search( content ) < 0 )
+ name = QString::null;
+ else
+ name = "_" + rx.cap(1);
+#endif
+
+ QString filename = QString("%1%2.vcf").arg(i,fieldwidth).arg(name);
+ for (int p=0; p<fieldwidth; p++) {
+ if (filename[p]==' ') filename[p]='0'; else break;
+ }
+ QString url = QString("mobile:/%1/%2/%3").arg(devName).arg(resource).arg(filename);
+
+ createFileEntry(entry, filename, url, entryMimeType(KMobileDevice::hasAddressBook),
+ 400 /*content.utf8().length()*/ );
+ listEntry(entry, false);
+
+ processedSize(i+1);
+ }
+ listEntry(entry, true);
+ finished();
+}
+
+/*
+ * getVCard() - gives the vCard of the given file
+ */
+int KMobileProtocol::getVCard( const QString &devName, QCString &result, QString &mime, const QString &path )
+{
+ PRINT_DEBUG << QString("getVCard(%1)\n").arg(path);
+
+ int index = path.find('.');
+ if (index>0)
+ index = path.left(index).toInt();
+ if (index<0 || index>=m_dev.numAddresses(devName))
+ return KIO::ERR_DOES_NOT_EXIST;
+
+ QString str = m_dev.readAddress(devName, index);
+ if (str.isEmpty())
+ return KIO::ERR_INTERNAL;
+ result = str.utf8();
+ mime = entryMimeType(KMobileDevice::hasAddressBook);
+// setMetaData("plugin", "const QString &key, const QString &value);
+ return 0;
+}
+
+/*
+ * listCalendar("mobile:/<devicename>/Calendar) - list the calendar entries
+ */
+void KMobileProtocol::listCalendar( const QString &devName, const QString &resource)
+{
+ PRINT_DEBUG << QString("listCalendar(%1)\n").arg(devName);
+
+ KIO::UDSEntry entry;
+
+ int entries = m_dev.numCalendarEntries(devName);
+ totalSize(entries);
+ for (int i=0; i<entries; i++) {
+
+ QString filename = QString("%1_%2.vcs").arg(i).arg(i18n("calendar"));
+ QString url = QString("mobile:/%1/%2/%3").arg(devName).arg(resource).arg(filename);
+
+ createFileEntry(entry, filename, url, entryMimeType(KMobileDevice::hasCalendar));
+ listEntry(entry, false);
+
+ processedSize(i+1);
+ }
+ listEntry(entry, true);
+ finished();
+}
+
+/*
+ * getCalendar() - reads a calendar entry
+ */
+int KMobileProtocol::getCalendar( const QString &devName, QCString &result, QString &mime, const QString &path)
+{
+ PRINT_DEBUG << QString("getCalendar(%1, #%2)\n").arg(devName).arg(path);
+
+ /* TODO */
+ Q_UNUSED(result);
+ Q_UNUSED(mime);
+ return KIO::ERR_CANNOT_ENTER_DIRECTORY;
+}
+
+
+/*
+ * listNotes("mobile:/<devicename>/Notes) - list the notes
+ */
+void KMobileProtocol::listNotes( const QString &devName, const QString &resource)
+{
+ PRINT_DEBUG << QString("listNotes(%1)\n").arg(devName);
+
+ KIO::UDSEntry entry;
+
+ int entries = m_dev.numNotes(devName);
+ totalSize(entries);
+ for (int i=0; i<entries; i++) {
+
+ QString note /*= m_dev.readNote(devName, i)*/;
+
+ QString filename = QString("%1_%2.txt").arg(i).arg(i18n("note"));
+ QString url = QString("mobile:/%1/%2/%3").arg(devName).arg(resource).arg(filename);
+
+ createFileEntry(entry, filename, url, entryMimeType(KMobileDevice::hasNotes),
+ 0 /*note.utf8().length()*/);
+ listEntry(entry, false);
+
+ processedSize(i+1);
+ }
+ listEntry(entry, true);
+ finished();
+}
+
+/*
+ * getNote() - gives the Note of the given file
+ */
+int KMobileProtocol::getNote( const QString &devName, QCString &result, QString &mime, const QString &path )
+{
+ PRINT_DEBUG << QString("getNote(%1)\n").arg(path);
+
+ int index = path.find('_');
+ if (index>0)
+ index = path.left(index).toInt();
+ if (index<0 || index>=m_dev.numNotes(devName))
+ return KIO::ERR_DOES_NOT_EXIST;
+
+ QString note = m_dev.readNote(devName, index);
+ if (note.isEmpty())
+ return KIO::ERR_DOES_NOT_EXIST;
+
+ result = note.utf8();
+ mime = entryMimeType(KMobileDevice::hasNotes);
+ return 0;
+}
+
+/*
+ * listFileStorage("mobile:/<devicename>/Files) - list the files on the device
+ */
+void KMobileProtocol::listFileStorage(const QString &devName, const QString &resource, const QString &devPath)
+{
+ PRINT_DEBUG << QString("listFileStorage(%1,%2)\n").arg(devName).arg(devPath);
+
+ /* TODO */
+ error( KIO::ERR_DOES_NOT_EXIST, QString("/%1/%2/%3").arg(devName).arg(resource).arg(devPath) );
+}
+
+/*
+ * getFileStorage() - gives the file contents of the given file
+ */
+int KMobileProtocol::getFileStorage(const QString &devName, QCString &result, QString &mime, const QString &path)
+{
+ PRINT_DEBUG << QString("getFileStorage(%1)\n").arg(path);
+
+ /* TODO */
+ Q_UNUSED(devName);
+ Q_UNUSED(result);
+ Q_UNUSED(mime);
+ return KIO::ERR_CANNOT_ENTER_DIRECTORY;
+}
+
+
+/**
+ * Test if the url contains a directory or a file.
+ */
+void KMobileProtocol::stat( const KURL &url )
+{
+ PRINT_DEBUG << "###############################\n";
+ PRINT_DEBUG << QString("stat(%1)\n").arg(url.path());
+
+ KMobileDevice::Capabilities devCaps;
+ QString devName, resource, devPath;
+
+ int err = getDeviceAndRessource(url.path(), devName, resource, devPath, devCaps);
+ if (err) {
+ error(err, url.path());
+ return;
+ }
+
+ QStringList path = QStringList::split('/', url.path(), false);
+ QString filename = (path.count()>0) ? path[path.count()-1] : "/";
+ QString fullPath = path.join("/");
+ QString fullUrl = QString("mobile:/%1").arg(fullPath);
+
+ UDSEntry entry;
+
+ bool isDir = devPath.isEmpty();
+
+ if (isDir) {
+ createDirEntry(entry, filename, fullUrl, folderMimeType(devCaps));
+ } else {
+ createFileEntry(entry, filename, fullUrl, entryMimeType(devCaps));
+ }
+
+ statEntry(entry);
+ finished();
+}
+
+/**
+ * Get the mimetype.
+ */
+void KMobileProtocol::mimetype(const KURL &url)
+{
+ PRINT_DEBUG << "###############################\n";
+ PRINT_DEBUG << QString("mimetype(%1)\n").arg(url.path());
+
+ KMobileDevice::Capabilities devCaps;
+ QString devName, resource, devPath;
+
+ int err = getDeviceAndRessource(url.path(), devName, resource, devPath, devCaps);
+ if (err) {
+ error(err, url.path());
+ return;
+ }
+
+ // tell the mimetype
+ mimeType(entryMimeType(devCaps));
+ finished();
+}
+
+/**
+ * List the contents of a directory.
+ */
+void KMobileProtocol::listDir(const KURL &url)
+{
+ PRINT_DEBUG << "###############################\n";
+ PRINT_DEBUG << QString("listDir(%1)\n").arg(url.path());
+
+ if (!m_dev.isKMobileAvailable()) {
+ error( KIO::ERR_CONNECTION_BROKEN, i18n("KDE Mobile Device Manager") );
+ return;
+ }
+
+ KMobileDevice::Capabilities devCaps;
+ QString devName, resource, devPath;
+
+ int err = getDeviceAndRessource(url.path(), devName, resource, devPath, devCaps);
+ if (err) {
+ error(err, url.path());
+ return;
+ }
+
+ if (devName.isEmpty()) {
+ listRoot(url);
+ return;
+ }
+
+#if 0
+ if (!dev) {
+ error( KIO::ERR_DOES_NOT_EXIST, QString("/%1").arg(devName) );
+ return;
+ }
+#endif
+
+ if (resource.isEmpty()) {
+ listTopDeviceDir(devName);
+ return;
+ }
+
+ listEntries(devName, resource, devPath, devCaps);
+}
diff --git a/kmobile/kioslave/kio_mobile.h b/kmobile/kioslave/kio_mobile.h
new file mode 100644
index 000000000..8094f514b
--- /dev/null
+++ b/kmobile/kioslave/kio_mobile.h
@@ -0,0 +1,70 @@
+/* This file is part of the KDE mobile library.
+ Copyright (C) 2004 Helge Deller <deller@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef __KIO_MOBILE_H__
+#define __KIO_MOBILE_H__
+
+#include <qstring.h>
+#include <qvaluelist.h>
+
+#include <kio/slavebase.h>
+#include <kmobiledevice.h>
+#include <kmobileclient.h>
+
+class KMobileProtocol : public KIO::SlaveBase
+{
+public:
+ KMobileProtocol( const QCString &pool, const QCString &app );
+ ~KMobileProtocol();
+
+ void get( const KURL& url );
+ void stat( const KURL& url );
+ void mimetype( const KURL& url );
+ void listDir( const KURL& url );
+
+protected:
+ int getDeviceAndRessource(const QString &_path,
+ QString &devName, QString &resource, QString &devPath,
+ KMobileDevice::Capabilities &devCaps);
+
+ QString folderMimeType(int cap);
+ QString entryMimeType(int cap);
+
+ void listRoot(const KURL& url);
+ void listTopDeviceDir(const QString &devName);
+ void listEntries(const QString &devName,
+ const QString &resource, const QString &devPath,
+ const KMobileDevice::Capabilities devCaps);
+
+ void listAddressBook(const QString &devName, const QString &resource);
+ int getVCard( const QString &devName, QCString &result, QString &mime, const QString &path );
+
+ void listCalendar(const QString &devName, const QString &resource);
+ int getCalendar( const QString &devName, QCString &result, QString &mime, const QString &path );
+
+ void listNotes(const QString &devName, const QString &resource);
+ int getNote( const QString &devName, QCString &result, QString &mime, const QString &path );
+
+ void listFileStorage(const QString &devName, const QString &resource, const QString &devPath);
+ int getFileStorage( const QString &devName, QCString &result, QString &mime, const QString &path );
+
+private:
+ KMobileClient m_dev;
+};
+
+#endif
diff --git a/kmobile/kioslave/mimetypes/Makefile.am b/kmobile/kioslave/mimetypes/Makefile.am
new file mode 100644
index 000000000..5105c51bf
--- /dev/null
+++ b/kmobile/kioslave/mimetypes/Makefile.am
@@ -0,0 +1,4 @@
+mimetype_DATA = \
+ mobile_addressbook.desktop mobile_calendar.desktop mobile_notes.desktop \
+ mobile_device.desktop
+mimetypedir = $(kde_mimedir)/inode
diff --git a/kmobile/kioslave/mimetypes/mobile_addressbook.desktop b/kmobile/kioslave/mimetypes/mobile_addressbook.desktop
new file mode 100644
index 000000000..53a041c1f
--- /dev/null
+++ b/kmobile/kioslave/mimetypes/mobile_addressbook.desktop
@@ -0,0 +1,61 @@
+[Desktop Entry]
+Comment=Contacts in Mobile Device
+Comment[af]=Kontakte op die draagbare toestel
+Comment[ar]=المراسلون في الجهاز النقّال
+Comment[be]=Кантакты ў мабільнай прыладзе
+Comment[bg]=Контакти в мобилни устройства
+Comment[bs]=Kontakti u mobilnom uređaju
+Comment[ca]=Contactes en el dispositiu mòbil
+Comment[cs]=Kontakty na mobilním zařízení
+Comment[cy]=Cysylltau yn y Dyfais Symudol
+Comment[da]=Kontakter i mobil-enhed
+Comment[de]=Kontakte im Mobilgerät
+Comment[el]=Επαφές στη φορητή συσκευή
+Comment[es]=Contactos del dispositivo móvil
+Comment[et]=Mobiili kontaktid
+Comment[eu]=Kontaktuak dispositibo mugikorrean
+Comment[fa]=تماسها در دستگاه تلفن همراه
+Comment[fi]=Mobiililaitteen yhteystiedot
+Comment[fr]=Contacts dans le périphérique mobile
+Comment[fy]=Kontaktpersoanen yn mobyl apparaat
+Comment[ga]=Teagmhálacha i nGléas Móibíleach
+Comment[gl]=Contactos no dispositivo móbil
+Comment[he]=אנשי קשר בהתקן הנייד
+Comment[hi]=मोबाइल उपकरण में सम्पर्क
+Comment[hu]=Címbejegyzések a mobiltelefonon
+Comment[is]=Tengiliðir í farsíma eða lófatölvu
+Comment[it]=Contatti nel dispositivo portatile
+Comment[ja]=モバイル機器内の連絡先
+Comment[ka]=კონტაქტები მობილურ მოწყობილობაზ
+Comment[kk]=Қалта құрылғыдағы контакттар
+Comment[km]=ទំនាក់​ទំនង​ក្នុង​ឧបករណ៍​ចល័ត
+Comment[lt]=Kontaktai mobiliajame įrenginyje
+Comment[mk]=Контакти од мобилен уред
+Comment[ms]=Orang hubungan di dalam Peranti Mudah Alih
+Comment[nb]=Kontaktliste i mobil enhet
+Comment[nds]=Kontakten op de Mobilreedschap
+Comment[ne]=मोबाइल यन्त्रमा सम्पर्क गर्छ
+Comment[nl]=Contactpersonen in mobiel apparaat
+Comment[nn]=Kontaktar i mobileiningar
+Comment[pl]=Wizytówki w urządzeniu przenośnym
+Comment[pt]=Contactos no Dispositivo Móvel
+Comment[pt_BR]=Contatos em Dispositivo Móvel
+Comment[ro]=Contacte în dispozitiv mobil
+Comment[ru]=Контакты на мобильном устройстве
+Comment[sk]=Kontakty v prenosnom zariadení
+Comment[sl]=Stiki v prenosni napravi
+Comment[sr]=Контакти у мобилном уређају
+Comment[sr@Latn]=Kontakti u mobilnom uređaju
+Comment[sv]=Kontakter i mobilenhet
+Comment[ta]=நடமாடும் சாதனத்தின் தொடர்ப்புகள்
+Comment[tg]=Алоқот дар дастгоҳи мобилӣ
+Comment[tr]=Taşınabilir Aygıt Bağlantıları
+Comment[uk]=Контакти у мобільному пристрої
+Comment[zh_CN]=移动设备中的联系人
+Comment[zh_TW]=行動裝置中的聯絡人
+Icon=kaddressbook
+Type=MimeType
+MimeType=inode/addressbook
+Patterns=
+
+X-KDE-AutoEmbed=true
diff --git a/kmobile/kioslave/mimetypes/mobile_calendar.desktop b/kmobile/kioslave/mimetypes/mobile_calendar.desktop
new file mode 100644
index 000000000..35fa7b9ba
--- /dev/null
+++ b/kmobile/kioslave/mimetypes/mobile_calendar.desktop
@@ -0,0 +1,61 @@
+[Desktop Entry]
+Comment=Calendar in Mobile Device
+Comment[af]=Kalender op die draagbare toestel
+Comment[be]=Каляндар у мабільнай прыладзе
+Comment[bg]=Календар в мобилни устройства
+Comment[bs]=Kalendar u mobilnom uređaju
+Comment[ca]=Calendari en el dispositiu mòbil
+Comment[cs]=Kalendář na mobilním zařízení
+Comment[cy]=Calendr yn y Dyfais Symudol
+Comment[da]=Kalender i mobil-enhed
+Comment[de]=Kalender für Mobiltelefon
+Comment[el]=Ημερολόγιο στη φορητή συσκευή
+Comment[eo]=Kalendaro en mobila aparato
+Comment[es]=Calendario del dispositivo móvil
+Comment[et]=Mobiili kalender
+Comment[eu]=Egutegia dispositibo mugikorrean
+Comment[fa]=تقویم در دستگاه تلفن همراه
+Comment[fi]=Mobiililaitteen kalenteri
+Comment[fr]=Calendrier dans un périphérique mobile
+Comment[fy]=Aginda yn mobyl apparaat
+Comment[ga]=Féilire i nGléas Móibíleach
+Comment[gl]=Calendario no Dispositivo Móbil
+Comment[he]=לוח שנה בהתקן הנייד
+Comment[hi]=मोबाइल उपकरण में कैलेन्डर
+Comment[hu]=Naptár a mobiltelefonon
+Comment[is]=Dagatal í farsíma eða lófatölvu
+Comment[it]=Calendari nel dispositivo portatile
+Comment[ja]=モバイル機器内のカレンダー
+Comment[ka]=კალენდარი მობილურ მოწყობილობაზე
+Comment[kk]=Қалта құрылғыдағы күнтізбе
+Comment[km]=ប្រតិទិន​ក្នុង​ឧបករណ៍​ចល័ត
+Comment[lt]=Kalendorius mobiliajame įrenginyje
+Comment[mk]=Календар од мобилен уред
+Comment[ms]=Kalendar dalam Peranti Mudah Alih
+Comment[nb]=Kalender i mobil enhet
+Comment[nds]=Kalenner op Mobilreedschap
+Comment[ne]=मोबाइल यन्त्रको क्यालेन्डर
+Comment[nl]=Agenda in mobiel apparaat
+Comment[nn]=Kalender i mobileiningar
+Comment[pl]=Kalendarz w urządzeniu przenośnym
+Comment[pt]=Calendário no Dispositivo Móvel
+Comment[pt_BR]=Calendário em Dispositivo Móvel
+Comment[ro]=Calendar în dispozitiv mobil
+Comment[ru]=Календарь на мобильном устройстве
+Comment[sk]=Kalendár v prenosnom zariadení
+Comment[sl]=Koledar v prenosni napravi
+Comment[sr]=Календар у мобилном уређају
+Comment[sr@Latn]=Kalendar u mobilnom uređaju
+Comment[sv]=Kalender i mobilenhet
+Comment[ta]=நடமாடும் சாதனத்தில் உள்ள நாள்காட்டி
+Comment[tg]=Тақвим дар дастгоҳи мобилӣ
+Comment[tr]=Cep Telefonu Takvimi
+Comment[uk]=Календар у мобільному пристрої
+Comment[zh_CN]=移动设备中的日历
+Comment[zh_TW]=行動裝置中的行事曆
+Icon=korganizer
+Type=MimeType
+MimeType=inode/calendar
+Patterns=
+
+X-KDE-AutoEmbed=true
diff --git a/kmobile/kioslave/mimetypes/mobile_device.desktop b/kmobile/kioslave/mimetypes/mobile_device.desktop
new file mode 100644
index 000000000..025d5d5d8
--- /dev/null
+++ b/kmobile/kioslave/mimetypes/mobile_device.desktop
@@ -0,0 +1,65 @@
+[Desktop Entry]
+Comment=Mobile Device
+Comment[af]=Draagbare Toestel
+Comment[ar]=الجهاز النقّال
+Comment[be]=Мабільная прылада
+Comment[bg]=Мобилни устройства
+Comment[br]=Trobarzhell lem-laka
+Comment[bs]=Mobilni uređaj
+Comment[ca]=Dispositiu mòbil
+Comment[cs]=Mobilní zařízení
+Comment[cy]=Dyfais Symudol
+Comment[da]=Mobil-enhed
+Comment[de]=Mobilgerät
+Comment[el]=Φορητή συσκευή
+Comment[eo]=Mobila aparato
+Comment[es]=Dispositivo móvil
+Comment[et]=Mobiil
+Comment[eu]=Dispositibo mugikorra
+Comment[fa]=دستگاه تلفن همراه
+Comment[fi]=Mobiililaite
+Comment[fr]=Périphérique mobile
+Comment[fy]=Mobyl apparaat
+Comment[ga]=Gléas Móibíleach
+Comment[gl]=Dispositivo Móbil
+Comment[he]=התקן נייד
+Comment[hi]=मोबाइल उपकरण
+Comment[hu]=Mobil eszköz
+Comment[is]=Farsími eða lófatölva
+Comment[it]=Dispositivo portatile
+Comment[ja]=モバイル機器
+Comment[ka]=მობილური მოწყობილობა
+Comment[kk]=Қалта құрылғысы
+Comment[km]=ឧបករណ៍​ចល័ត
+Comment[lt]=Mobilusis įrenginys
+Comment[mk]=Мобилен уред
+Comment[ms]=Peranti Mudah Alih
+Comment[nb]=Mobil enhet
+Comment[nds]=Mobilreedschap
+Comment[ne]=मोबाइल यन्त्र
+Comment[nl]=Mobiel apparaat
+Comment[nn]=Mobileining
+Comment[pa]=ਮੋਬਾਇਲ ਜੰਤਰ
+Comment[pl]=Urządzenie przenośne
+Comment[pt]=Dispositivo Móvel
+Comment[pt_BR]=Dispositivo Móvel
+Comment[ro]=Dispozitiv mobil
+Comment[ru]=Мобильное устройство
+Comment[se]=Mobilovttadat
+Comment[sk]=Prenosné zariadenie
+Comment[sl]=Mobilna naprava
+Comment[sr]=Мобилни уређај
+Comment[sr@Latn]=Mobilni uređaj
+Comment[sv]=Mobilenhet
+Comment[ta]= நடமாடும் சாதனம்
+Comment[tg]=Дастгоҳи мобилӣ
+Comment[tr]=Taşınabilir Aygıt
+Comment[uk]=Мобільний пристрій
+Comment[zh_CN]=移动设备
+Comment[zh_TW]=行動裝置
+Icon=kmobile
+Type=MimeType
+MimeType=kdedevice/mobiledevice
+Patterns=
+
+X-KDE-AutoEmbed=true
diff --git a/kmobile/kioslave/mimetypes/mobile_notes.desktop b/kmobile/kioslave/mimetypes/mobile_notes.desktop
new file mode 100644
index 000000000..12dc25c0c
--- /dev/null
+++ b/kmobile/kioslave/mimetypes/mobile_notes.desktop
@@ -0,0 +1,59 @@
+[Desktop Entry]
+Comment=Notes in Mobile Device
+Comment[af]=Notas op die draagbare toestel
+Comment[be]=Нататкі ў мабільнай прыладзе
+Comment[bg]=Бележки в мобилни устройства
+Comment[bs]=Bilješke u mobilnom uređaju
+Comment[ca]=Notes en el dispositiu mòbil
+Comment[cs]=Poznámky na mobilním zařízení
+Comment[cy]=Nodiadau yn y Dyfais Symudol
+Comment[da]=Noter i mobil-enhed
+Comment[de]=Notizen im Mobilgerät
+Comment[el]=Σημειώσεις στη φορητή συσκευή
+Comment[es]=Notas del dispositivo móvil
+Comment[et]=Mobiili märkmed (Notes)
+Comment[eu]=Oharrak dispositibo mugikorrean
+Comment[fa]=یادداشتها در دستگاه تلفن همراه
+Comment[fi]=Mobiililaitteen muistio
+Comment[fr]=Notes dans un périphérique mobile
+Comment[fy]=Notysjes yn mobyl apparaat
+Comment[ga]=Nótaí i nGléas Móibíleach
+Comment[gl]=Notas no Dispositivo Móbil
+Comment[he]=פתקים בהתקן הנייד
+Comment[hi]=मोबाइल उपकरण में टीप
+Comment[hu]=Feljegyzések a mobiltelefonon
+Comment[is]=Áminningar í farsíma eða lófatölvu
+Comment[it]=Note nel dispositivo portatile
+Comment[ja]=モバイル機器内のメモ
+Comment[ka]=ჩანიშვნები მობილურ ტელეფონზე
+Comment[kk]=Қалта құрылғыдағы жазбалар
+Comment[km]=ចំណាំ​ក្នុង​ឧបករណ៍​ចល័ត
+Comment[lt]=Užrašai mobiliajame įrenginyje
+Comment[mk]=Белешки од мобилен уред
+Comment[ms]=Nota dalam Peranti Mudah Alih
+Comment[nb]=Notater i mobil enhet
+Comment[nds]=Notizen op Mobilreedschap
+Comment[ne]=मोबाइल यन्त्र भित्रका टिपोट
+Comment[nl]=Notities in mobiel apparaat
+Comment[nn]=Notat i mobileiningar
+Comment[pl]=Notatki w urządzeniu przenośnym
+Comment[pt]=Notas no Dispositivo Móvel
+Comment[pt_BR]=Notas em Dispositivo Móvel
+Comment[ru]=Заметки на мобильном устройстве
+Comment[sk]=Poznámky v prenosnom zariadení
+Comment[sl]=Notice v prenosni napravi
+Comment[sr]=Белешке у мобилном уређају
+Comment[sr@Latn]=Beleške u mobilnom uređaju
+Comment[sv]=Anteckning i mobilenhet
+Comment[ta]=நடமாடும் சாதனத்தின் குறிப்புகள்
+Comment[tg]=Хабарҳо дар дастгоҳи мобилӣ
+Comment[tr]=Cep Telefonu Notları
+Comment[uk]=Нотатки у мобільному пристрої
+Comment[zh_CN]=移动电话中的便笺
+Comment[zh_TW]=行動裝置中的備忘錄
+Icon=knotes
+Type=MimeType
+MimeType=inode/notes
+Patterns=
+
+X-KDE-AutoEmbed=true
diff --git a/kmobile/kioslave/mobile.protocol b/kmobile/kioslave/mobile.protocol
new file mode 100644
index 000000000..7b8385f86
--- /dev/null
+++ b/kmobile/kioslave/mobile.protocol
@@ -0,0 +1,18 @@
+[Protocol]
+exec=kio_mobile
+protocol=mobile
+input=none
+output=filesystem
+# listing=Name
+listing=Name,Type,Size,Date,AccessDate,Access,URL,MimeType
+reading=true
+source=true
+writing=true
+makedir=true
+deleting=true
+# linking=true
+# moving=true
+# mimetype=text/plain
+# determineMimetypeFromExtension=true
+DocPath=kioslave/mobile.html
+Icon=kaddressbook
diff --git a/kmobile/kioslave/organizer.protocol b/kmobile/kioslave/organizer.protocol
new file mode 100644
index 000000000..b211a74f9
--- /dev/null
+++ b/kmobile/kioslave/organizer.protocol
@@ -0,0 +1,18 @@
+[Protocol]
+exec=kio_mobile
+protocol=organizer
+input=none
+output=filesystem
+# listing=Name
+listing=Name,Type,Size,Date,AccessDate,Access,URL,MimeType
+reading=true
+source=true
+writing=true
+makedir=true
+deleting=true
+# linking=true
+# moving=true
+# mimetype=text/plain
+# determineMimetypeFromExtension=true
+DocPath=kioslave/mobile.html
+Icon=mobile_organizer
diff --git a/kmobile/kioslave/pda.protocol b/kmobile/kioslave/pda.protocol
new file mode 100644
index 000000000..cbab2e03a
--- /dev/null
+++ b/kmobile/kioslave/pda.protocol
@@ -0,0 +1,18 @@
+[Protocol]
+exec=kio_mobile
+protocol=pda
+input=none
+output=filesystem
+# listing=Name
+listing=Name,Type,Size,Date,AccessDate,Access,URL,MimeType
+reading=true
+source=true
+writing=true
+makedir=true
+deleting=true
+# linking=true
+# moving=true
+# mimetype=text/plain
+# determineMimetypeFromExtension=true
+DocPath=kioslave/mobile.html
+Icon=mobile_organizer
diff --git a/kmobile/kioslave/phonecamera.protocol b/kmobile/kioslave/phonecamera.protocol
new file mode 100644
index 000000000..7a0b341f2
--- /dev/null
+++ b/kmobile/kioslave/phonecamera.protocol
@@ -0,0 +1,18 @@
+[Protocol]
+exec=kio_mobile
+protocol=camera
+input=none
+output=filesystem
+# listing=Name
+listing=Name,Type,URL,MimeType
+reading=true
+source=true
+writing=true
+makedir=true
+deleting=true
+# linking=true
+# moving=true
+# mimetype=text/plain
+# determineMimetypeFromExtension=true
+DocPath=kioslave/mobile.html
+Icon=mobile_camera
diff --git a/kmobile/kmobile.cpp b/kmobile/kmobile.cpp
new file mode 100644
index 000000000..0c056bd4c
--- /dev/null
+++ b/kmobile/kmobile.cpp
@@ -0,0 +1,407 @@
+/* This file is part of the KDE KMobile library
+ Copyright (C) 2003 Helge Deller <deller@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include <qdragobject.h>
+#include <kprinter.h>
+#include <qpainter.h>
+#include <qpaintdevicemetrics.h>
+
+#include <kglobal.h>
+#include <klocale.h>
+#include <kiconloader.h>
+#include <kmenubar.h>
+#include <kstatusbar.h>
+#include <kkeydialog.h>
+#include <kaccel.h>
+#include <kio/netaccess.h>
+#include <kfiledialog.h>
+#include <kmessagebox.h>
+#include <kconfig.h>
+
+#include <kedittoolbar.h>
+
+#include <kstdaccel.h>
+#include <kaction.h>
+#include <kstdaction.h>
+
+#include <kpushbutton.h>
+#include <kdebug.h>
+#include <kstandarddirs.h>
+
+#include "kmobile.h"
+#include "pref.h"
+
+#include "systemtray.h"
+
+#include "kmobileitem.h"
+#include "kmobile_selectiondialog.h"
+
+KMobile::KMobile()
+ : KMainWindow( 0, "kmobile" )
+{
+ m_config = new KConfig("kmobilerc");
+
+ m_view = new KMobileView(this, m_config);
+
+ // tell the KMainWindow that this is indeed the main widget
+ setCentralWidget(m_view);
+
+ // then, setup our actions
+ setupActions();
+
+ toolBar()->show();
+ statusBar()->show();
+
+ // apply the saved mainwindow settings, if any, and ask the mainwindow
+ // to automatically save settings if changed: window size, toolbar
+ // position, icon size, etc.
+ setAutoSaveSettings();
+
+ // allow the view to change the statusbar and caption
+ connect(m_view, SIGNAL(signalChangeStatusbar(const QString&)),
+ this, SLOT(changeStatusbar(const QString&)));
+
+ // restore all configured devices
+ restoreAll();
+
+ // setup the system tray
+ m_systemTray = new SystemTray(this, "systemTray");
+ m_systemTray->show();
+ connect(m_systemTray, SIGNAL(quitSelected()), this, SLOT(slotQuit()));
+}
+
+KMobile::~KMobile()
+{
+ delete m_config;
+}
+
+void KMobile::setupActions()
+{
+ KStdAction::close(this, SLOT(dockApplication()), actionCollection());
+ KStdAction::quit(kapp, SLOT(quit()), actionCollection());
+
+ m_toolbarAction = KStdAction::showToolbar(this, SLOT(optionsShowToolbar()), actionCollection());
+ optionsShowToolbar();
+ m_statusbarAction = KStdAction::showStatusbar(this, SLOT(optionsShowStatusbar()), actionCollection());
+
+ KStdAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection());
+ KStdAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection());
+ KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection());
+
+ new KAction(i18n("&Add Device..."), "folder_new", 0,
+ this, SLOT(addDevice()), actionCollection(), "device_add");
+ new KAction( KGuiItem( i18n("&Remove Device"), "edittrash", i18n("Remove this device") ),
+ "Delete", this, SLOT(removeDevice()), actionCollection(), "device_remove");
+ new KAction(i18n("Re&name Device..."), 0, Key_F2,
+ this, SLOT(renameDevice()), actionCollection(), "device_rename");
+ new KAction(i18n("&Configure Device..."), "configure", 0,
+ this, SLOT(configDevice()), actionCollection(), "device_configure");
+
+ createGUI();
+
+ connect( kapp, SIGNAL(aboutToQuit()), this, SLOT(saveAll()) );
+}
+
+
+void KMobile::dockApplication()
+{
+ // dock to system tray
+ hide();
+}
+
+bool KMobile::queryClose()
+{
+ dockApplication();
+ return false;
+}
+
+bool KMobile::queryExit()
+{
+ dockApplication();
+ return false;
+}
+
+void KMobile::slotQuit()
+{
+ kapp->quit();
+}
+
+void KMobile::showMinimized()
+{
+ dockApplication();
+}
+
+
+void KMobile::saveAll()
+{
+ m_view->saveAll();
+}
+
+void KMobile::restoreAll()
+{
+ m_view->restoreAll();
+}
+
+void KMobile::fileSave()
+{
+ // this slot is called whenever the File->Save menu is selected,
+ // the Save shortcut is pressed (usually CTRL+S) or the Save toolbar
+ // button is clicked
+
+ // save the current file
+}
+
+
+void KMobile::saveProperties(KConfig *)
+{
+ // the 'config' object points to the session managed
+ // config file. anything you write here will be available
+ // later when this app is restored
+}
+
+void KMobile::readProperties(KConfig *config)
+{
+ // the 'config' object points to the session managed
+ // config file. this function is automatically called whenever
+ // the app is being restored. read in here whatever you wrote
+ // in 'saveProperties'
+
+ QString url = config->readPathEntry("lastURL");
+}
+
+void KMobile::optionsShowToolbar()
+{
+ // this is all very cut and paste code for showing/hiding the
+ // toolbar
+ if (m_toolbarAction->isChecked())
+ toolBar()->show();
+ else
+ toolBar()->hide();
+}
+
+void KMobile::optionsShowStatusbar()
+{
+ // this is all very cut and paste code for showing/hiding the
+ // statusbar
+ if (m_statusbarAction->isChecked())
+ statusBar()->show();
+ else
+ statusBar()->hide();
+}
+
+void KMobile::optionsConfigureKeys()
+{
+ KKeyDialog::configure(actionCollection());
+}
+
+void KMobile::optionsConfigureToolbars()
+{
+ // use the standard toolbar editor
+ saveMainWindowSettings(KGlobal::config(), autoSaveGroup());
+}
+
+void KMobile::newToolbarConfig()
+{
+ // this slot is called when user clicks "Ok" or "Apply" in the toolbar editor.
+ // recreate our GUI, and re-apply the settings (e.g. "text under icons", etc.)
+ createGUI();
+
+ applyMainWindowSettings(KGlobal::config(), autoSaveGroup());
+}
+
+void KMobile::optionsPreferences()
+{
+ // popup some sort of preference dialog, here
+#if 0
+ KMobilePreferences dlg;
+ if (dlg.exec())
+ {
+ // redo your settings
+ }
+#endif
+}
+
+
+void KMobile::renameDevice()
+{
+ // rename the current selected device
+ QIconViewItem *item = m_view->currentItem();
+ if (item)
+ item->rename();
+}
+
+/*
+ * Add a new Device (Dialog)
+ */
+
+void KMobile::addDevice()
+{
+ KMobile_SelectionDialog *dialog = new KMobile_SelectionDialog(m_view);
+ if (!dialog)
+ return;
+
+ dialog->setCaption( i18n("Add New Mobile or Portable Device") );
+
+ dialog->helpText->setText( i18n("Please select the category to which your new device belongs:") );
+ dialog->addButton->setText( i18n("&Scan for New Devices...") );
+ dialog->addButton->setDisabled(true);
+ dialog->iconView->connect( dialog->iconView, SIGNAL(doubleClicked(QIconViewItem*)),
+ dialog, SLOT(accept()) );
+ dialog->selectButton->setText( i18n("&Add") );
+ dialog->selectButton->connect( dialog->selectButton, SIGNAL(clicked()), dialog, SLOT(accept()) );
+ dialog->cancelButton->connect( dialog->cancelButton, SIGNAL(clicked()), dialog, SLOT(reject()) );
+
+ KTrader::OfferList list = KMobileItem::getMobileDevicesList();
+ KTrader::OfferListIterator it;
+ KService::Ptr ptr;
+ for ( it = list.begin(); it != list.end(); ++it ) {
+ ptr = *it;
+ kdDebug() << QString("LIBRARY: '%1', NAME: '%2', ICON: '%3', COMMENT: '%4'\n")
+ .arg(ptr->library()).arg(ptr->name()).arg(ptr->icon()).arg(ptr->comment());
+
+ QString iconName = ptr->icon();
+ if (iconName.isEmpty())
+ iconName = KMOBILE_ICON_UNKNOWN;
+ QPixmap pm = KGlobal::instance()->iconLoader()->loadIcon(iconName, KIcon::Desktop );
+
+ QIconViewItem *item;
+ item = new QIconViewItem( dialog->iconView, ptr->name(), pm );
+
+ //if (!ptr->comment().isNull())
+ // QToolTip::add(item->pixmap(), ptr->comment() );
+ }
+
+ int index = -1;
+ if (dialog->exec() == QDialog::Accepted)
+ index = dialog->iconView->currentItem()->index(); // get index of selected item
+ delete dialog;
+
+ if (index<0 || index>=(int)list.count())
+ return;
+
+ ptr = list[index];
+
+ // add the new device to the list
+ if (!m_view->addNewDevice(m_config, ptr)) {
+ KMessageBox::error(this,
+ QString("<qt>KMobile could not load the <b>%1</b> Device Driver.<p>"
+ "Please use the Skeleton- or Gnokii Device Driver during development.<p>"
+ "This driver will still be visible, but you won't be able to access it "
+ "from Konqueror or any other application.</qt>").arg(ptr->name()),
+ kapp->name());
+ }
+
+ saveAll();
+}
+
+#if 0
+/*
+ * show dialog to user, in which he may choose and select one of the already
+ * configured mobile devices.
+ */
+KMobileDevice * KMobileFactory::chooseDeviceDialog( QWidget *parent,
+ enum KMobileDevice::ClassType /*type*/, enum KMobileDevice::Capabilities /*caps*/ )
+{
+ int num;
+
+ m_parent = parent;
+
+ // do we already have some devices configured ?
+ num = readDevicesList();
+ if (!num) {
+ int answ;
+ answ = KMessageBox::questionYesNo(parent,
+ i18n( "<qt>You have no mobile devices configured yet.<p>"
+ "Do you want to add a device now ?</qt>" ),
+ i18n( "KDE Mobile Device Access" ), KStdGuiItem::add(), i18n("Do Not Add") );
+ if (answ != KMessageBox::Yes)
+ return 0L;
+ // add a new device
+ addDeviceDialog(parent);
+ }
+ num = readDevicesList();
+ if (!num)
+ return 0L;
+
+ // let the user select one of the configured devices
+ KMobile_selectiondialog *dialog = new KMobile_selectiondialog(parent);
+ if (!dialog)
+ return 0L;
+
+ dialog->addButton->connect( dialog->addButton, SIGNAL(clicked()), this, SLOT(slotAddDevice()) );
+ dialog->iconView->connect( dialog->iconView, SIGNAL(doubleClicked(QIconViewItem*)),
+ dialog, SLOT(accept()) );
+ dialog->selectButton->connect( dialog->selectButton, SIGNAL(clicked()), dialog, SLOT(accept()) );
+ dialog->cancelButton->connect( dialog->cancelButton, SIGNAL(clicked()), dialog, SLOT(reject()) );
+
+ for (int i=0; i<countDevices(); i++) {
+ KService::Ptr ptr;
+ ptr = ServiceForEntry(i);
+ if (!ptr)
+ continue;
+
+ // kdDebug() << QString("LIBRARY: '%1', NAME: '%2', ICON: '%3', COMMENT: '%4' #%5\n")
+ // .arg(ptr->library()).arg(ptr->name()).arg(ptr->icon()).arg(ptr->comment()).arg(i);
+
+ QString iconName = ptr->icon();
+ if (iconName.isEmpty())
+ iconName = KMOBILE_ICON_UNKNOWN;
+ QPixmap pm( ::locate("icon", iconName+".png") );
+
+ QIconViewItem *item;
+ item = new QIconViewItem( dialog->iconView, ptr->name(), pm );
+
+ }
+
+ int index = -1;
+ if (dialog->exec() == QDialog::Accepted)
+ index = dialog->iconView->currentItem()->index(); // get index of selected item
+ delete dialog;
+
+ if (index<0 || index>=countDevices())
+ return 0L;
+
+ return getDevice(index);
+}
+#endif
+
+
+void KMobile::removeDevice()
+{
+ // remove the current selected device
+ QIconViewItem *item = m_view->currentItem();
+ if (item)
+ m_view->removeDevice( item->text() );
+}
+
+void KMobile::configDevice()
+{
+ // configure the current selected device
+ QIconViewItem *item = m_view->currentItem();
+ if (item)
+ m_view->configDevice( item->text() );
+}
+
+void KMobile::changeStatusbar(const QString& text)
+{
+ // display the text on the statusbar
+ statusBar()->message(text);
+}
+
+#include "kmobile.moc"
diff --git a/kmobile/kmobile.desktop b/kmobile/kmobile.desktop
new file mode 100644
index 000000000..f8f0d5a10
--- /dev/null
+++ b/kmobile/kmobile.desktop
@@ -0,0 +1,136 @@
+[Desktop Entry]
+Exec=kmobile
+Icon=kmobile
+Type=Application
+DocPath=kmobile/kmobile.html
+Terminal=false
+
+Name=KMobile
+Name[cy]=KSymudol
+Name[hi]=के-मोबाइल
+Name[ne]=केडीई मोबाइल
+Name[nn]=KMobil
+Name[sv]=Kmobile
+Name[ta]=கேநடமாடும் தொலைபேசி
+Name[zh_TW]=KMobile 行動裝置
+
+GenericName=Manage Mobile Devices
+GenericName[af]=Bestuur draagbare toestelle
+GenericName[ar]=تسيير الأجهزة النقّالة
+GenericName[be]=Кіраванне мабільнымі прыладамі
+GenericName[bg]=Мобилни устройства
+GenericName[br]=Merañ an trobarhelloù lem-laka
+GenericName[bs]=Upravljajte mobilnim uređajima
+GenericName[ca]=Gestor per a dispositius mòbils
+GenericName[cs]=Spravovat mobilní zařízení
+GenericName[cy]=Rheoli Dyfeisiau Symudol
+GenericName[da]=Håndtér mobil-enheder
+GenericName[de]=Mobiltelefone verwalten
+GenericName[el]=Διαχείριση φορητών συσκευών
+GenericName[eo]=Administri mobilajn aparatojn
+GenericName[es]=Gestiona dispositivos móviles
+GenericName[et]=Mobiilihaldur
+GenericName[eu]=Dispositibo mugikorrak kudeatu
+GenericName[fa]=مدیریت دستگاههای تلفن همراه
+GenericName[fi]=Hallitse matkapuhelinlaitteita
+GenericName[fr]=Gérer les périphériques mobiles
+GenericName[fy]=Mobile apparaten beheare
+GenericName[ga]=Bainistigh Gléasanna Móibíleacha
+GenericName[gl]=Xestionar Dispositivos Móbiles
+GenericName[he]=ניהול של התקנים ניידים
+GenericName[hi]=मोबाइल उपकरण प्रबंधन करें
+GenericName[hu]=Mobilkezelő
+GenericName[is]=Sýsla með lófatölvur og farsíma
+GenericName[it]=Gestisce dispositivi portatili
+GenericName[ja]=モバイル機器の管理
+GenericName[ka]=მობილური მოწყობილობების მართვა
+GenericName[kk]=Қалта құрылғыларды басқару
+GenericName[km]=គ្រប់គ្រង​ឧបករណ៍​ចល័ត
+GenericName[lt]=Mobiliųjų įrenginių tvarkymas
+GenericName[mk]=Менаџирање мобилни уреди
+GenericName[ms]=Menguruskan Peranti Mudah Alih
+GenericName[nb]=Håndtere mobile enheter
+GenericName[nds]=Mobilreedschappen plegen
+GenericName[ne]=मोबाइल यन्त्र व्यवस्थापन गर्नुहोस्
+GenericName[nl]=Mobiele apparaten beheren
+GenericName[nn]=Handtera mobileiningar
+GenericName[pl]=Zarządzanie urządzeniami przenośnymi
+GenericName[pt]=Gestão dos Dispositivos Móveis
+GenericName[pt_BR]=Gerenciar Dispositivos Móveis
+GenericName[ro]=Manager dispozitive mobile
+GenericName[ru]=Управление мобильными устройствами
+GenericName[se]=Gieđahala mobilovttadagaid
+GenericName[sk]=Správa prenosných zariadení
+GenericName[sl]=Upravljaj mobilne naprave
+GenericName[sr]=Управљање мобилним уређајима
+GenericName[sr@Latn]=Upravljanje mobilnim uređajima
+GenericName[sv]=Hantera mobilenheter
+GenericName[ta]=நடமாடும் சாதனத்தை நிர்வகி
+GenericName[tg]=Идоракунӣ бо дастгоҳи мобилӣ
+GenericName[tr]=Taşınabilir Aygıtlar Yöneticisi
+GenericName[uk]=Робота з мобільними пристроями
+GenericName[zh_CN]=管理移动设备
+GenericName[zh_TW]=管理行動裝置
+
+Comment=A KDE Mobile Devices Manager
+Comment[af]='n KDE draagbare toestel bestuurder
+Comment[be]=Кіраванне мабільнымі прыладамі KDE
+Comment[bg]=Управление на мобилни устройства
+Comment[bs]=KDE upravitelj mobilnim uređajima
+Comment[ca]=Un gestor de KDE per a dispositius mòbils
+Comment[cs]=Správce mobilních zařízení KDE
+Comment[cy]=Rheolydd Dyfeisiau Symudol KDE
+Comment[da]=En KDE-håndtering af mobil-enheder
+Comment[de]=Verwaltung für mobile Geräte
+Comment[el]=Ένας διαχειριστής φορητών συσκευών του KDE
+Comment[eo]=KDE-mobilaparat-administrilo
+Comment[es]=A gestor de dispositivos móviles para KDE
+Comment[et]=KDE mobiilihaldur
+Comment[eu]=KDE-ren dispositibo mugikorren kudeatzailea
+Comment[fa]=مدیر دستگاههای تلفن همراه KDE
+Comment[fi]=KDE:n matkapuhelinlaitteiden hallinta
+Comment[fr]=Un gestionnaire de périphériques mobiles pour KDE
+Comment[fy]=Behear fan mobile apparaten yn KDE
+Comment[ga]=Bainisteoir Gléasanna Móibíleacha KDE
+Comment[gl]=O Xestor de Móbiles de KDE
+Comment[he]=מנהל התקנים ניידים עבור KDE
+Comment[hi]=एक केडीई मोबाइल उपकरण प्रबंधक
+Comment[hu]=KDE-alapú mobiltelefon-kezelő
+Comment[is]=KDE stjórnforrit fyrir lófatölvur og farsíma
+Comment[it]=Un gestore di dispositivi portatili di KDE
+Comment[ja]=KDE モバイル機器マネージャ
+Comment[ka]=KDE-ს მობილურ მოწყობილობათა მმართველი
+Comment[kk]=KDE-нің қалта құрылғылар менеджері
+Comment[km]=កម្មវិធី​គ្រប់គ្រង​ឧបករណ៍​ចល័ត KDE
+Comment[lt]=KDE mobiliųjų įrenginių tvarkyklė
+Comment[mk]=Менаџер на мобилни уреди во KDE
+Comment[ms]=Pengurus Peranti Mudah Alih KDE
+Comment[nb]=En KDE-håndterer for mobile enheter
+Comment[nds]=En Pleger för Mobilreedschappen
+Comment[ne]=केडीई मोबाइल यन्त्र प्रबन्धक
+Comment[nl]=Beheer van mobiele apparaten in KDE
+Comment[nn]=Ein einingshandterar for mobiltelefon i KDE
+Comment[pl]=Program obsługujący urządzenia przenośne dla KDE
+Comment[pt]=Um Gestor de Dispositivos Móveis do KDE
+Comment[pt_BR]=Um Gerenciador de Dispositivos Móveis para o KDE
+Comment[ro]=Un manager KDE pentru dispozitive mobile
+Comment[ru]=Менеджер мобильных устройств KDE
+Comment[sk]=KDE správca prenosných zariadení
+Comment[sl]=Upravitelj prenosnih naprav v KDE
+Comment[sr]=KDE-ов менаџер мобилних уређаја
+Comment[sr@Latn]=KDE-ov menadžer mobilnih uređaja
+Comment[sv]=KDE:s hantering av mobilenheter
+Comment[ta]=ஒரு கேடிஇ நடமாடும் சாதனத்தின் மேலாளர்
+Comment[tg]=Мудири дастгоҳи мобилии KDE
+Comment[tr]=KDE Taşınabilir Aygıtlar Yöneticisi
+Comment[uk]=Менеджер мобільних пристроїв KDE
+Comment[zh_CN]=KDE 移动设备管理器
+Comment[zh_TW]=KDE 行動裝置管理員
+
+X-KDE-StartupNotify=false
+X-DCOP-ServiceType=Unique
+# X-KDE-autostart-after=panel
+# X-KDE-Library=kmobile_panelapplet
+# X-KDE-UniqueApplet=true
+# # X-KDE-autostart-condition=kmobilerc:General:AutoStart:true
+Categories=Qt;KDE;Utility;
diff --git a/kmobile/kmobile.h b/kmobile/kmobile.h
new file mode 100644
index 000000000..059934c61
--- /dev/null
+++ b/kmobile/kmobile.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2003 Helge Deller <deller@kde.org>
+ */
+
+#ifndef _KMOBILE_H_
+#define _KMOBILE_H_
+
+#include <kapplication.h>
+#include <kmainwindow.h>
+#include <ktrader.h>
+
+#include "kmobileview.h"
+
+class KToggleAction;
+class SystemTray;
+
+/**
+ * This class serves as the main window for KMobile. It handles the
+ * menus, toolbars, and status bars.
+ *
+ * @short Main window class
+ */
+class KMobile : public KMainWindow
+{
+ Q_OBJECT
+public:
+ /**
+ * Default Constructor
+ */
+ KMobile();
+
+ /**
+ * Default Destructor
+ */
+ virtual ~KMobile();
+
+ KMobileView * mainView() const { return m_view; };
+
+protected:
+ /**
+ * This function is called when it is time for the app to save its
+ * properties for session management purposes.
+ */
+ void saveProperties(KConfig *);
+
+ /**
+ * This function is called when this app is restored. The KConfig
+ * object points to the session management config file that was saved
+ * with @ref saveProperties
+ */
+ void readProperties(KConfig *);
+
+public slots:
+
+ void saveAll();
+ void restoreAll();
+
+private slots:
+ void dockApplication();
+ void slotQuit();
+ void showMinimized();
+
+ void fileSave();
+ void optionsShowToolbar();
+ void optionsShowStatusbar();
+ void optionsConfigureKeys();
+ void optionsConfigureToolbars();
+
+ void addDevice();
+ void removeDevice();
+ void configDevice();
+
+ void renameDevice();
+
+ void optionsPreferences();
+
+ void newToolbarConfig();
+
+ void changeStatusbar(const QString& text);
+
+private:
+ void setupAccel();
+ void setupActions();
+
+ bool queryExit();
+ bool queryClose();
+
+private:
+ KConfig *m_config;
+
+ KMobileView *m_view;
+ SystemTray *m_systemTray;
+
+ KToggleAction *m_toolbarAction;
+ KToggleAction *m_statusbarAction;
+};
+
+#endif // _KMOBILE_H_
diff --git a/kmobile/kmobile.lsm b/kmobile/kmobile.lsm
new file mode 100644
index 000000000..018b20c9e
--- /dev/null
+++ b/kmobile/kmobile.lsm
@@ -0,0 +1,16 @@
+Begin3
+Title: kmobile -- KDE Mobile Devices Manager
+Version: 0.1
+Entered-date:
+Description:
+Keywords: KDE Qt
+Author: Helge Deller <deller@kde.org>
+Maintained-by: Helge Deller <deller@kde.org>
+Home-page:
+Alternate-site:
+Primary-site: ftp://ftp.kde.org/pub/kde/unstable/apps/utils
+ xxxxxx kmobile-0.1.tar.gz
+ xxx kmobile-0.1.lsm
+Platform: Linux. Needs KDE
+Copying-policy: GPL/LGPL
+End
diff --git a/kmobile/kmobile_selectiondialog.ui b/kmobile/kmobile_selectiondialog.ui
new file mode 100644
index 000000000..907e35b9b
--- /dev/null
+++ b/kmobile/kmobile_selectiondialog.ui
@@ -0,0 +1,115 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>KMobile_SelectionDialog</class>
+<widget class="KDialog">
+ <property name="name">
+ <cstring>KMobile_SelectionDialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>424</width>
+ <height>311</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Select Mobile Device</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>helpText</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;Select mobile device:&lt;/b&gt;</string>
+ </property>
+ </widget>
+ <widget class="QIconView" row="1" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>iconView</cstring>
+ </property>
+ <property name="resizeMode">
+ <enum>Adjust</enum>
+ </property>
+ </widget>
+ <widget class="Line" row="2" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="3" column="0">
+ <property name="name">
+ <cstring>addButton</cstring>
+ </property>
+ <property name="text">
+ <string>Add &amp;New Device...</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="3" column="2">
+ <property name="name">
+ <cstring>selectButton</cstring>
+ </property>
+ <property name="text">
+ <string>S&amp;elect</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer row="3" column="1" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>181</width>
+ <height>41</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton" row="4" column="2">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>C&amp;ancel</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kdialog.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/kmobile/kmobileclient.cpp b/kmobile/kmobileclient.cpp
new file mode 100644
index 000000000..6da1b919e
--- /dev/null
+++ b/kmobile/kmobileclient.cpp
@@ -0,0 +1,235 @@
+/* This file is part of the KDE KMobile library
+ Copyright (C) 2003-2005 Helge Deller <deller@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include <qstringlist.h>
+
+#include <ktrader.h>
+#include <klocale.h>
+#include <kdebug.h>
+
+#include "kmobileclient.h"
+
+#define KMOBILECLIENT_DEBUG_AREA 0
+#define PRINT_DEBUG kdDebug(KMOBILECLIENT_DEBUG_AREA) << "KMobileClient: "
+
+KMobileClient::KMobileClient()
+ : DCOPClient()
+{
+ // initialize Application and Object of remote DCOP-aware KMobile application
+ m_kmobileApp = "kmobile";
+ m_kmobileObj = "kmobileIface";
+
+ bool ok = attach();
+ PRINT_DEBUG << QString("attached to DCOP server %1\n").arg(ok?"sucessful.":"failed.");
+
+// m_clientAppId = registerAs("kmobileclient");
+// PRINT_DEBUG << QString("registered as DCOP client %1\n").arg(m_clientAppId);
+
+ isKMobileAvailable();
+}
+
+KMobileClient::~KMobileClient()
+{
+ detach();
+ PRINT_DEBUG << QString("detached from server\n");
+}
+
+
+bool KMobileClient::isKMobileAvailable()
+{
+ bool available = isApplicationRegistered(m_kmobileApp);
+ PRINT_DEBUG << QString("KMobile DCOP server: %1\n").arg(available?"available.":"not available");
+ if (!available) {
+ startKMobileApplication();
+ // check again...
+ available = isApplicationRegistered(m_kmobileApp);
+ }
+ return available;
+}
+
+bool KMobileClient::startKMobileApplication()
+{
+ QByteArray data;
+ QDataStream arg(data, IO_WriteOnly);
+ QStringList params;
+ params << "--minimized";
+ arg << QString("kmobile") << params;
+ QCString replyType;
+ QByteArray replyData;
+ bool ok = call("klauncher", "klauncher", "kdeinit_exec_wait(QString,QStringList)", data, replyType, replyData);
+ PRINT_DEBUG << QString("DCOP-CALL to klauncher: %1\n").arg(ok?"ok.":"failed.");
+ return ok;
+}
+
+
+/**
+ * DCOP - IMPLEMENTATION
+ */
+
+#define KMOBILECLIENT_USE_EVENTLOOP true
+#define KMOBILECLIENT_TIMEOUT (4*1000) // 4 seconds
+
+
+#define PREPARE( FUNC, PARAMS ) \
+ QByteArray data; \
+ QDataStream arg(data, IO_WriteOnly); \
+ arg << PARAMS; \
+ QCString replyType; \
+ QByteArray replyData; \
+ bool ok = call(m_kmobileApp, m_kmobileObj, FUNC, data, replyType, replyData, KMOBILECLIENT_USE_EVENTLOOP, KMOBILECLIENT_TIMEOUT); \
+ PRINT_DEBUG << QString("DCOP-CALL to %1: %2\n").arg(FUNC).arg(ok?"ok.":"FAILED.")
+
+#define RETURN_TYPE( FUNC, PARAMS, RETURN_TYPE ) \
+ PREPARE( FUNC, PARAMS ); \
+ QDataStream reply(replyData, IO_ReadOnly); \
+ RETURN_TYPE ret; \
+ if (ok) \
+ reply >> ret; \
+ return ret;
+
+#define RETURN_TYPE_DEFAULT( FUNC, PARAMS, RETURN_TYPE, RETURN_DEFAULT ) \
+ PREPARE( FUNC, PARAMS ); \
+ QDataStream reply(replyData, IO_ReadOnly); \
+ RETURN_TYPE ret = RETURN_DEFAULT; \
+ if (ok) \
+ reply >> ret; \
+ return ret;
+
+#define RETURN_QSTRING( FUNC, PARAMS ) \
+ RETURN_TYPE( FUNC, PARAMS, QString )
+
+#define RETURN_BOOL( FUNC, PARAMS ) \
+ RETURN_TYPE_DEFAULT( FUNC, PARAMS, bool, false )
+
+#define RETURN_INT( FUNC, PARAMS ) \
+ RETURN_TYPE_DEFAULT( FUNC, PARAMS, int , 0 )
+
+
+
+QStringList KMobileClient::deviceNames()
+{
+ if (!isKMobileAvailable())
+ return QStringList();
+ RETURN_TYPE( "deviceNames()", QString::fromLatin1(""), QStringList );
+}
+
+void KMobileClient::removeDevice( QString deviceName )
+{
+ PREPARE( "removeDevice(QString)", deviceName );
+ Q_UNUSED(ok);
+}
+
+void KMobileClient::configDevice( QString deviceName )
+{
+ PREPARE( "configDevice(QString)", deviceName );
+ Q_UNUSED(ok);
+}
+
+
+bool KMobileClient::connectDevice( QString deviceName )
+{
+ RETURN_BOOL( "connectDevice(QString)", deviceName );
+}
+
+bool KMobileClient::disconnectDevice( QString deviceName )
+{
+ RETURN_BOOL( "disconnectDevice(QString)", deviceName );
+}
+
+bool KMobileClient::connected( QString deviceName )
+{
+ RETURN_BOOL( "connected(QString)", deviceName );
+}
+
+
+QString KMobileClient::deviceClassName( QString deviceName )
+{
+ RETURN_QSTRING( "deviceClassName(QString)", deviceName );
+}
+
+QString KMobileClient::deviceName( QString deviceName )
+{
+ RETURN_QSTRING( "deviceName(QString)", deviceName );
+}
+
+QString KMobileClient::revision( QString deviceName )
+{
+ RETURN_QSTRING( "revision(QString)", deviceName );
+}
+
+int KMobileClient::classType( QString deviceName )
+{
+ RETURN_INT( "classType(QString)", deviceName );
+}
+
+int KMobileClient::capabilities( QString deviceName )
+{
+ RETURN_INT( "capabilities(QString)", deviceName );
+}
+
+QString KMobileClient::nameForCap( QString deviceName, int cap )
+{
+ RETURN_QSTRING( "nameForCap(QString,int)", deviceName << cap );
+}
+
+QString KMobileClient::iconFileName( QString deviceName )
+{
+ RETURN_QSTRING( "iconFileName(QString)", deviceName );
+}
+
+int KMobileClient::numAddresses( QString deviceName )
+{
+ RETURN_INT( "numAddresses(QString)", deviceName );
+}
+
+QString KMobileClient::readAddress( QString deviceName, int index )
+{
+ RETURN_QSTRING( "readAddress(QString,int)", deviceName << index );
+}
+
+bool KMobileClient::storeAddress( QString deviceName, int index, QString vcard, bool append )
+{
+ RETURN_BOOL( "storeAddress(QString,int,QString,bool)", deviceName << index << vcard << append );
+}
+
+int KMobileClient::numCalendarEntries( QString deviceName )
+{
+ RETURN_INT( "numCalendarEntries(QString)", deviceName );
+}
+
+int KMobileClient::numNotes( QString deviceName )
+{
+ RETURN_INT( "numNotes(QString)", deviceName );
+}
+
+QString KMobileClient::readNote( QString deviceName, int index )
+{
+ RETURN_QSTRING( "readNote(QString,int)", deviceName << index );
+}
+
+bool KMobileClient::storeNote( QString deviceName, int index, QString note )
+{
+ RETURN_BOOL( "storeNote(QString,int,QString)", deviceName << index << note );
+}
+
+
+
+#undef PRINT_DEBUG
+
+#include "kmobileclient.moc"
diff --git a/kmobile/kmobileclient.h b/kmobile/kmobileclient.h
new file mode 100644
index 000000000..ca4b5c182
--- /dev/null
+++ b/kmobile/kmobileclient.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2003-2005 Helge Deller <deller@kde.org>
+ */
+
+#ifndef _KMOBILECLIENT_H_
+#define _KMOBILECLIENT_H_
+
+#include <dcopclient.h>
+#include <kdepimmacros.h>
+
+class KDE_EXPORT KMobileClient : public DCOPClient
+{
+ Q_OBJECT
+public:
+ KMobileClient();
+ virtual ~KMobileClient();
+
+ QCString appId() const { return m_clientAppId; };
+
+ bool isKMobileAvailable();
+ bool startKMobileApplication();
+
+ /**
+ * DCOP implementation
+ */
+ QStringList deviceNames();
+
+ void removeDevice( QString deviceName );
+ void configDevice( QString deviceName );
+
+ bool connectDevice( QString deviceName );
+ bool disconnectDevice( QString deviceName );
+ bool connected( QString deviceName );
+
+ QString deviceClassName( QString deviceName );
+ QString deviceName( QString deviceName );
+ QString revision( QString deviceName );
+ int classType( QString deviceName );
+
+ int capabilities( QString deviceName );
+ QString nameForCap( QString deviceName, int cap );
+
+ QString iconFileName( QString deviceName );
+
+ int numAddresses( QString deviceName );
+ QString readAddress( QString deviceName, int index );
+ bool storeAddress( QString deviceName, int index, QString vcard, bool append );
+
+ int numCalendarEntries( QString deviceName );
+
+ int numNotes( QString deviceName );
+ QString readNote( QString deviceName, int index );
+ bool storeNote( QString deviceName, int index, QString note );
+
+private:
+ QCString m_clientAppId;
+ QCString m_kmobileApp;
+ QCString m_kmobileObj;
+
+};
+
+#endif // _KMOBILECLIENT_H_
diff --git a/kmobile/kmobiledevice.cpp b/kmobile/kmobiledevice.cpp
new file mode 100644
index 000000000..dc3039f2b
--- /dev/null
+++ b/kmobile/kmobiledevice.cpp
@@ -0,0 +1,470 @@
+/* This file is part of the KDE KMobile library
+ Copyright (C) 2003 Helge Deller <deller@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <time.h>
+#include <errno.h>
+#include <signal.h>
+#include <fcntl.h>
+
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qfile.h>
+
+#include <klibloader.h>
+#include <kstandarddirs.h>
+#include "kmobiledevice.h"
+#include <kmessagebox.h>
+#include <kconfig.h>
+
+#include <kio/global.h>
+#include <kdebug.h>
+#include <klocale.h>
+
+#define KMOBILEDEVICE_DEBUG_AREA 5730
+#define PRINT_DEBUG kdDebug(KMOBILEDEVICE_DEBUG_AREA) << "KMobileDevice: "
+
+/**
+ * The base plugin class of all mobile device drivers.
+ */
+
+KMobileDevice::KMobileDevice(QObject *obj, const char *name, const QStringList &args)
+ : KLibFactory(obj,name),
+ m_config(0L), d(0L)
+{
+ setClassType(Unclassified);
+ setCapabilities(hasNothing);
+ m_deviceName = i18n("Unknown Device");
+ m_deviceRevision = i18n("n/a"); /* not available */
+ m_connectionName = i18n("Unknown Connection");
+
+ // set the config file name
+ m_configFileName = args[0];
+ if (m_configFileName.isEmpty())
+ m_config = new KConfig();
+ else
+ m_config = new KConfig(m_configFileName);
+ PRINT_DEBUG << QString("name of config file is %1\n").arg(m_configFileName);
+}
+
+KMobileDevice::~KMobileDevice()
+{
+ delete m_config;
+}
+
+
+bool KMobileDevice::connected()
+{
+ return m_connected;
+}
+
+// returns e.g. "Nokia mobile phone", "MP3 Player", "Handspring Organizer"
+QString KMobileDevice::deviceClassName() const
+{
+ return m_deviceClassName;
+}
+
+// returns real device name, e.g. "Nokia 6310" or "Rio MP3 Player"
+QString KMobileDevice::deviceName() const
+{
+ return m_deviceName;
+}
+
+QString KMobileDevice::revision() const
+{
+ return m_deviceRevision;
+}
+
+bool KMobileDevice::isSlowDevice() const
+{
+ return false;
+}
+
+bool KMobileDevice::isReadOnly() const
+{
+ return false;
+}
+
+bool KMobileDevice::configDialog( QWidget *parent )
+{
+ KMessageBox::information( parent,
+ i18n("This device does not need any configuration."),
+ deviceName() );
+ return true;
+}
+
+void KMobileDevice::setClassType( enum ClassType ct )
+{
+ m_classType = ct;
+ m_deviceClassName = defaultClassName(ct);
+}
+
+enum KMobileDevice::ClassType KMobileDevice::classType() const
+{
+ return m_classType;
+}
+
+QString KMobileDevice::iconFileName() const
+{
+ return defaultIconFileName( classType() );
+}
+
+QString KMobileDevice::defaultIconFileName( ClassType ct )
+{
+ QString name;
+ switch (ct) {
+ case Phone: name = "mobile_phone"; break;
+ case Organizer: name = "mobile_organizer"; break;
+ case Camera: name = "mobile_camera"; break;
+ case MusicPlayer: name = "mobile_mp3player"; break;
+ case Unclassified:
+ default: name = KMOBILE_ICON_UNKNOWN; break;
+ }
+ return name;
+}
+
+QString KMobileDevice::defaultClassName( ClassType ct )
+{
+ QString name;
+ switch (ct) {
+ case Phone: name = i18n("Cellular Mobile Phone"); break;
+ case Organizer: name = i18n("Organizer"); break;
+ case Camera: name = i18n("Digital Camera"); break;
+ case MusicPlayer: name = i18n("Music/MP3 Player"); break;
+ case Unclassified:
+ default: name = i18n("Unclassified Device"); break;
+ }
+ return name;
+}
+
+void KMobileDevice::setCapabilities( int caps )
+{
+ m_caps = caps;
+}
+
+int KMobileDevice::capabilities() const
+{
+ return m_caps;
+}
+
+const QString KMobileDevice::nameForCap(int cap) const
+{
+ switch (cap) {
+ case hasAddressBook: return i18n("Contacts");
+ case hasCalendar: return i18n("Calendar");
+ case hasNotes: return i18n("Notes");
+ case hasFileStorage: return i18n("Files");
+ default: return i18n("Unknown");
+ }
+}
+
+// returns an error string for the given error code
+QString KMobileDevice::buildErrorString(KIO::Error err, const QString &errorText) const
+{
+ return KIO::buildErrorString( err, errorText);
+}
+
+/*
+ * Addressbook / Phonebook support
+ */
+int KMobileDevice::numAddresses()
+{
+ return 0;
+}
+
+int KMobileDevice::readAddress( int, KABC::Addressee & )
+{
+ return KIO::ERR_UNSUPPORTED_ACTION;
+}
+
+int KMobileDevice::storeAddress( int, const KABC::Addressee &, bool )
+{
+ return KIO::ERR_UNSUPPORTED_ACTION;
+}
+
+/*
+ * Calendar support
+ */
+int KMobileDevice::numCalendarEntries()
+{
+ return 0;
+}
+
+int KMobileDevice::readCalendarEntry( int, KCal::Event & )
+{
+ return KIO::ERR_UNSUPPORTED_ACTION;
+}
+
+int KMobileDevice::storeCalendarEntry( int, const KCal::Event & )
+{
+ return KIO::ERR_UNSUPPORTED_ACTION;
+}
+
+/*
+ * Notes support
+ */
+int KMobileDevice::numNotes()
+{
+ return 0;
+}
+
+int KMobileDevice::readNote( int, QString & )
+{
+ return KIO::ERR_UNSUPPORTED_ACTION;
+}
+
+int KMobileDevice::storeNote( int, const QString & )
+{
+ return KIO::ERR_UNSUPPORTED_ACTION;
+}
+
+/*
+ * File storage support
+ * @param fileName path and name of a file in the mobile device, e.g. "/MYFILE.TXT", "/mp3/song1.mp3"
+ */
+
+static
+void addAtom(KIO::UDSEntry& entry, unsigned int ID, long l, const QString& s = QString::null)
+{
+ KIO::UDSAtom atom;
+ atom.m_uds = ID;
+ atom.m_long = l;
+ atom.m_str = s;
+ entry.append(atom);
+}
+
+void KMobileDevice::createDirEntry(KIO::UDSEntry& entry, const QString& name, const QString& url, const QString& mime) const
+{
+ entry.clear();
+ addAtom(entry, KIO::UDS_NAME, 0, name);
+ addAtom(entry, KIO::UDS_FILE_TYPE, S_IFDIR);
+ addAtom(entry, KIO::UDS_ACCESS, 0500);
+ addAtom(entry, KIO::UDS_MIME_TYPE, 0, mime);
+ addAtom(entry, KIO::UDS_URL, 0, url);
+ PRINT_DEBUG << QString("createDirEntry: File: %1 MIME: %2 URL: %3\n").arg(name).arg(mime).arg(url);
+// addAtom(entry, KIO::UDS_SIZE, 0);
+ addAtom(entry, KIO::UDS_GUESSED_MIME_TYPE, 0, mime);
+}
+
+void KMobileDevice::createFileEntry(KIO::UDSEntry& entry, const QString& name, const QString& url, const QString& mime,
+ const unsigned long size) const
+{
+ entry.clear();
+ addAtom(entry, KIO::UDS_NAME, 0, name);
+ addAtom(entry, KIO::UDS_FILE_TYPE, S_IFREG);
+ addAtom(entry, KIO::UDS_URL, 0, url);
+ addAtom(entry, KIO::UDS_ACCESS, 0400);
+ addAtom(entry, KIO::UDS_MIME_TYPE, 0, mime);
+ if (size) addAtom(entry, KIO::UDS_SIZE, size);
+ addAtom(entry, KIO::UDS_GUESSED_MIME_TYPE, 0, mime);
+ PRINT_DEBUG << QString("createFileEntry: File: %1, Size: %2, MIME: %3\n").arg(name).arg(size).arg(mime);
+}
+
+
+void KMobileDevice::listDir( const QString & )
+{
+ emit error(KIO::ERR_CANNOT_ENTER_DIRECTORY,QString::null);
+}
+
+void KMobileDevice::mkdir( const QString &, int )
+{
+ emit error(KIO::ERR_COULD_NOT_MKDIR, QString::null);
+}
+
+void KMobileDevice::rename( const QString &, const QString &, bool )
+{
+ emit error(KIO::ERR_UNSUPPORTED_ACTION, QString::null);
+}
+
+void KMobileDevice::symlink( const QString &, const QString &, bool )
+{
+ emit error(KIO::ERR_UNSUPPORTED_ACTION, QString::null);
+}
+
+void KMobileDevice::del( const QString &, bool )
+{
+ emit error(KIO::ERR_UNSUPPORTED_ACTION, QString::null);
+}
+
+void KMobileDevice::stat( const QString & )
+{
+ emit error(KIO::ERR_UNSUPPORTED_ACTION, QString::null);
+}
+
+void KMobileDevice::chmod( const QString &, int )
+{
+ emit error(KIO::ERR_UNSUPPORTED_ACTION, QString::null);
+}
+
+void KMobileDevice::get( const QString & )
+{
+ emit error(KIO::ERR_UNSUPPORTED_ACTION, QString::null);
+}
+
+void KMobileDevice::put( const QString &, int, bool, bool )
+{
+ emit error(KIO::ERR_UNSUPPORTED_ACTION, QString::null);
+}
+
+void KMobileDevice::mimetype( const QString & )
+{
+ emit error(KIO::ERR_UNSUPPORTED_ACTION, QString::null);
+}
+
+void KMobileDevice::special( const QByteArray & )
+{
+ emit error(KIO::ERR_UNSUPPORTED_ACTION, QString::null);
+}
+
+
+
+
+/*
+ * device locking/unlocking functions
+ */
+
+#ifdef HAVE_BAUDBOY_H
+// Header shipped with newer RedHat distributions.
+// We have to use this here, because /var/lock is owned by root:lock
+// and no one is in this group. Only the binary /usr/sbin/lockdev is
+// owned by this group and has the setgid flag set. This binary is called
+// in ttylock etc ...
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <fcntl.h>
+# include <baudboy.h>
+# include <cstdlib>
+#else
+# ifdef HAVE_LOCKDEV_H
+// Library shipped with newer RedHat and Debian(?) distributions.
+// Use this if bauddev is not available.
+# include <lockdev.h>
+# include <sys/types.h>
+# include <unistd.h>
+# else
+// If lockdev.h is also unavailable do locking
+// like described in the serial HOWTO.
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <unistd.h>
+# include <qfile.h>
+# include <signal.h>
+# include <errno.h>
+# endif
+#endif
+
+#define DEVICE_LOCK_PATH_PREFIX "/var/lock/LCK.."
+
+bool KMobileDevice::lockDevice(const QString &device, QString &err_reason)
+{
+#ifdef HAVE_BAUDBOY_H
+ return ttylock(device.local8bit()) == EXIT_SUCCESS;
+#else
+# ifdef HAVE_LOCKDEV_H
+ return !dev_lock(device.local8bit());
+# else
+ int pid = -1;
+ QStringList all = QStringList::split('/', device);
+ if (!all.count()) {
+ err_reason = i18n("Invalid device (%1)").arg(device);
+ return false;
+ }
+ QString lockName = DEVICE_LOCK_PATH_PREFIX + all[all.count()-1];
+ QFile file(lockName);
+ if (file.exists() && file.open(IO_ReadOnly)) {
+ if (file.size() == 0) {
+ err_reason = i18n("Unable to read lockfile %s. Please check for reason and "
+ "remove the lockfile by hand.").arg(lockName);
+ PRINT_DEBUG << err_reason;
+ return false;
+ }
+ if (file.size() == 4 && sizeof(int)==4) {
+ file.readLine((char *)(&pid), 4); /* Kermit-style lockfile */
+ } else {
+ QTextStream ts(&file);
+ ts >> pid; /* Ascii lockfile */
+ }
+ file.close();
+
+ if (pid > 0 && kill((pid_t)pid, 0) < 0 && errno == ESRCH) {
+ PRINT_DEBUG << QString("Lockfile %1 is stale. Overriding it..\n").arg(lockName);
+ sleep(1);
+ if (!file.remove()) {
+ PRINT_DEBUG << QString("Overriding failed, please check the permissions\n");
+ PRINT_DEBUG << QString("Cannot lock device %1\n").arg(device);
+ err_reason = i18n("Lockfile %1 is stale. Please check permissions.").arg(lockName);
+ return false;
+ }
+ } else {
+ err_reason = i18n("Device %1 already locked.").arg(device);
+ return false;
+ }
+ }
+
+ /* Try to create a new file, with 0644 mode */
+ int fd = open(lockName.local8Bit(), O_CREAT | O_EXCL | O_WRONLY, 0644);
+ if (fd == -1) {
+ if (errno == EEXIST)
+ err_reason = i18n("Device %1 seems to be locked by unknown process.").arg(device);
+ else if (errno == EACCES)
+ err_reason = i18n("Please check permission on lock directory.");
+ else if (errno == ENOENT)
+ err_reason = i18n("Cannot create lockfile %1. Please check for existence of path.").arg(lockName);
+ else
+ err_reason = i18n("Could not create lockfile %1. Error-Code is %2.").arg(lockName).arg(errno);
+ return false;
+ }
+ QString lockText;
+ lockText = QString("%1 kmobile\n").arg(getpid(),10);
+ write(fd, lockText.utf8(), lockText.utf8().length());
+ close(fd);
+
+ PRINT_DEBUG << QString("%1: Device %2 locked with lockfile %3.\n")
+ .arg(deviceName()).arg(device).arg(lockName);
+
+ err_reason = QString::null;
+
+ return true;
+# endif
+#endif
+}
+
+bool KMobileDevice::unlockDevice(const QString &device)
+{
+#ifdef HAVE_BAUDBOY_H
+ return ttyunlock(device.local8bit()) == EXIT_SUCCESS;
+#else
+# ifdef HAVE_LOCKDEV_H
+ return 0 <= dev_unlock(device.local8bit(), getpid());
+# else
+ QStringList all = QStringList::split('/', device);
+ if (!all.count()) return false;
+ QString lockName = DEVICE_LOCK_PATH_PREFIX + all[all.count()-1];
+ QFile file(lockName);
+ if (!file.exists())
+ return true;
+ return file.remove();
+# endif
+#endif
+}
+
+#include "kmobiledevice.moc"
diff --git a/kmobile/kmobiledevice.h b/kmobile/kmobiledevice.h
new file mode 100644
index 000000000..5fbcad6d2
--- /dev/null
+++ b/kmobile/kmobiledevice.h
@@ -0,0 +1,504 @@
+/* This file is part of the KDE kmobile library.
+ Copyright (C) 2003 Helge Deller <deller@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef LIB_KMOBILEDEVICE_H
+#define LIB_KMOBILEDEVICE_H
+
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qmutex.h>
+
+#include <kdepimmacros.h>
+#include <klibloader.h>
+
+#include <kabc/addressee.h>
+#include <kabc/addresseelist.h>
+
+#include <kio/global.h>
+#include <kio/authinfo.h>
+
+#include <libkcal/event.h>
+
+class KConfig;
+
+#define KMOBILE_MIMETYPE_DEVICE "kdedevice/mobiledevice"
+#define KMOBILE_MIMETYPE_DEVICE_KONQUEROR(name) QString("kdedevice/kmobile_%1").arg(name)
+#define KMOBILE_MIMETYPE_INODE "inode/"
+#define KMOBILE_ICON_UNKNOWN "mobile_unknown"
+
+/**
+ * @short Represents the base class for dynamically loaded mobile device drivers.
+ *
+ * KMobileDevice is the base class for all hardware device drivers.
+ * Every derived class has to add additional functionality.
+ *
+ * For a KMobileSomeDevice driver you have to write the following code:
+ * <pre>
+ * K_EXPORT_COMPONENT_FACTORY( libkmobile_somedevice, KMobileSomeDevice() );
+ * QObject *KMobileSomeDevice::createObject( QObject *parent, const char *name,
+ * const char *, const QStringList &args )
+ * {
+ * return new KMobileSomeDevice( parent, name, args );
+ * }
+ * </pre>
+ *
+ * @see KLibFactory
+ * @author Helge Deller <deller@kde.org>
+ */
+
+class KDE_EXPORT KMobileDevice : public KLibFactory
+{
+Q_OBJECT
+ friend class KMobileView;
+
+public:
+ /**
+ * Construct a new KMobileDevice.
+ *
+ * @param obj The parent object. This is usually 0.
+ * @param name The object name. For session management and window management to work.
+ * @param args Additional commandline parameters - the first entry has the config file name.
+ */
+ KMobileDevice(QObject *obj, const char *name, const QStringList &args );
+ virtual ~KMobileDevice();
+
+
+ /**
+ * Connect to the device.
+ *
+ * @param parent The parent widget. It will be used as parent for message boxes.
+ */
+ virtual bool connectDevice( QWidget *parent = 0 ) = 0;
+
+ /**
+ * Disconnect from the device.
+ *
+ * @param parent The parent widget. It will be used as parent for message boxes.
+ */
+ virtual bool disconnectDevice( QWidget *parent = 0 ) = 0;
+
+ /**
+ * Returns true, if the device is currently connected and the link is online.
+ */
+ virtual bool connected();
+
+ /**
+ * Returns the classname, to which the device belongs. Examples are e.g.
+ * "Nokia mobile phone", "MP3 Player", "Handspring Organizer"
+ */
+ virtual QString deviceClassName() const;
+
+ /**
+ * Returns the real devices name, e.g. "Nokia 6310" or "Rio MP3 Player"
+ */
+ virtual QString deviceName() const;
+
+ /**
+ * Returns the hardware revision of the devices, e.g. "Revision 1.2"
+ */
+ virtual QString revision() const;
+
+ /**
+ * Returns an unique ID for the device, e.g. IMEI number on phones, or serial number.
+ * The returned String is used to have a unique identification for syncronisation.
+ */
+ virtual QString deviceUniqueID() = 0;
+
+ /**
+ * Returns true, if the device is connected via a slow connection.
+ * Good examples for slow connections are serial or infrared ports.
+ */
+ virtual bool isSlowDevice() const;
+
+ /**
+ * Returns true, if this is a read-only device.
+ */
+ virtual bool isReadOnly() const;
+
+ /**
+ * Pop-up a device-specific configuration dialog.
+ *
+ * @param parent The parent widget. It will be used as parent for the configuration dialog.
+ */
+ virtual bool configDialog(QWidget *parent);
+
+ // The ClassType may be used e.g. to select an suitable icon
+ enum ClassType {
+ Unclassified = 0,
+ Phone = 1,
+ Organizer = 2,
+ Camera = 3,
+ MusicPlayer = 4, // e.g. MP3Players, CDPlayers
+ LastClassType = MusicPlayer
+ };
+ enum ClassType classType() const;
+
+ // you may provide your own icon() implementation to display
+ // an appropriate Pixmap (e.g. a Palm Pilot or a Zaurus image).
+ virtual QString iconFileName() const;
+
+ // the default Icon set
+ static QString defaultIconFileName( ClassType ct = Unclassified );
+ static QString defaultClassName( ClassType ct = Unclassified );
+
+ // The capabilities of this device (bitmapped value)
+ enum Capabilities {
+ hasNothing = 0, // not supported
+ hasAddressBook = 1, // mobile phones, organizers, ...
+ hasCalendar = 2, // organizers, mobile phones, ...
+ hasNotes = 4, // organizers, mobile phones, ...
+ hasFileStorage = 8, // organizers, handhelds, mp3-player, ...
+ hasAnyCapability = 0xffff // used to select devices independent of the capatibilities
+ };
+ int capabilities() const;
+ const QString nameForCap(int cap) const;
+
+ // returns an error string for the given error code
+ // See KIO::buildErrorString()
+ QString buildErrorString(KIO::Error err, const QString &errorText) const;
+
+public:
+ /*
+ * Addressbook / Phonebook support
+ */
+ virtual int numAddresses();
+ virtual int readAddress( int index, KABC::Addressee &adr );
+ virtual int storeAddress( int index, const KABC::Addressee &adr, bool append = false );
+
+ /*
+ * Calendar support
+ */
+ virtual int numCalendarEntries();
+ virtual int readCalendarEntry( int index, KCal::Event &entry );
+ virtual int storeCalendarEntry( int index, const KCal::Event &entry );
+
+ /*
+ * Notes support
+ */
+ virtual int numNotes();
+ virtual int readNote( int index, QString &note );
+ virtual int storeNote( int index, const QString &note );
+
+
+
+ /*
+ **********************
+ * FILE STORAGE SUPPORT
+ **********************
+ * mostly compatible to the kioslave base class <kio/slavebase.h>
+ */
+
+ /**
+ * helper functions for the kmobile device drivers
+ */
+ void createDirEntry(KIO::UDSEntry& entry, const QString& name,
+ const QString& url, const QString& mime) const;
+ void createFileEntry(KIO::UDSEntry& entry, const QString& name,
+ const QString& url, const QString& mime,
+ const unsigned long size = 0) const;
+ /**
+ * Lists the contents of @p path.
+ * The slave should emit ERR_CANNOT_ENTER_DIRECTORY if it doesn't exist,
+ * if we don't have enough permissions, or if it is a file
+ * It should also emit @ref #totalFiles as soon as it knows how many
+ * files it will list.
+ */
+ virtual void listDir( const QString &url );
+
+ /**
+ * Create a directory
+ * @param path path to the directory to create
+ * @param permissions the permissions to set after creating the directory
+ * (-1 if no permissions to be set)
+ * The slave emits ERR_COULD_NOT_MKDIR if failure.
+ */
+ virtual void mkdir( const QString &url, int permissions );
+
+ /**
+ * Rename @p oldname into @p newname.
+ * If the slave returns an error ERR_UNSUPPORTED_ACTION, the job will
+ * ask for copy + del instead.
+ * @param src where to move the file from
+ * @param dest where to move the file to
+ * @param overwrite if true, any existing file will be overwritten
+ */
+ virtual void rename( const QString &src, const QString &dest, bool overwrite );
+
+ /**
+ * Creates a symbolic link named @p dest, pointing to @p target, which
+ * may be a relative or an absolute path.
+ * @param target The string that will become the "target" of the link (can be relative)
+ * @param dest The symlink to create.
+ * @param overwrite whether to automatically overwrite if the dest exists
+ */
+ virtual void symlink( const QString &target, const QString &dest, bool overwrite );
+
+ /**
+ * Delete a file or directory.
+ * @param path file/directory to delete
+ * @param isfile if true, a file should be deleted.
+ * if false, a directory should be deleted.
+ */
+ virtual void del( const QString &url, bool isfile);
+
+ /**
+ * Finds all details for one file or directory.
+ * The information returned is the same as what @ref #listDir returns,
+ * but only for one file or directory.
+ */
+ virtual void stat( const QString &url );
+
+ /**
+ * Change permissions on @p path
+ * The slave emits ERR_DOES_NOT_EXIST or ERR_CANNOT_CHMOD
+ */
+ virtual void chmod( const QString &url, int permissions );
+
+ /**
+ * get, aka read.
+ * @param url the full url for this request. Host, port and user of the URL
+ * can be assumed to be the same as in the last setHost() call.
+ * The slave emits the data through @ref #data
+ */
+ virtual void get( const QString &url );
+
+ /**
+ * put, aka write.
+ * @param path where to write the file (decoded)
+ * @param permissions may be -1. In this case no special permission mode is set.
+ * @param overwrite if true, any existing file will be overwritten.
+ * If the file indeed already exists, the slave should NOT apply the
+ * permissions change to it.
+ * @param resume
+ */
+ virtual void put( const QString &url, int permissions, bool overwrite, bool resume );
+
+ /**
+ * Finds mimetype for one file or directory.
+ *
+ * This method should either emit 'mimeType' or it
+ * should send a block of data big enough to be able
+ * to determine the mimetype.
+ *
+ * If the slave doesn't reimplement it, a @ref #get will
+ * be issued, i.e. the whole file will be downloaded before
+ * determining the mimetype on it - this is obviously not a
+ * good thing in most cases.
+ */
+ virtual void mimetype( const QString &url );
+
+ /**
+ * Used for any command that is specific to this slave (protocol)
+ * Examples are : HTTP POST, mount and unmount (kio_file)
+ *
+ * @param data packed data; the meaning is completely dependent on the
+ * slave, but usually starts with an int for the command number.
+ * Document your slave's commands, at least in its header file.
+ */
+ virtual void special( const QByteArray & );
+
+signals:
+ /**
+ * Call this from stat() to express details about an object, the
+ * UDSEntry customarily contains the atoms describing file name, size,
+ * mimetype, etc.
+ * @param _entry The UDSEntry containing all of the object attributes.
+ */
+ void statEntry( const KIO::UDSEntry &_entry );
+
+ /**
+ * internal function to be called by the slave.
+ * It collects entries and emits them via listEntries
+ * when enough of them are there or a certain time
+ * frame exceeded (to make sure the app gets some
+ * items in time but not too many items one by one
+ * as this will cause a drastic performance penalty)
+ * @param ready set to true after emitting all items. _entry is not
+ * used in this case
+ */
+ void listEntry( const KIO::UDSEntry& _entry, bool ready);
+
+ /**
+ * Internal function to transmit meta data to the application.
+ */
+ void sendMetaData();
+
+ /**
+ * Prompt the user for Authorization info (login & password).
+ *
+ * Use this function to request authorization information from
+ * the end user. You can also pass an error message which explains
+ * why a previous authorization attempt failed. Here is a very
+ * simple example:
+ *
+ * <pre>
+ * KIO::AuthInfo authInfo;
+ * if ( openPassDlg( authInfo ) )
+ * {
+ * kdDebug() << QString::fromLatin1("User: ")
+ * << authInfo.username << endl;
+ * kdDebug() << QString::fromLatin1("Password: ")
+ * << QString::fromLatin1("Not displayed here!") << endl;
+ * }
+ * </pre>
+ *
+ * You can also preset some values like the username, caption or
+ * comment as follows:
+ *
+ * <pre>
+ * KIO::AuthInfo authInfo;
+ * authInfo.caption= "Acme Password Dialog";
+ * authInfo.username= "Wile E. Coyote";
+ * QString errorMsg = "You entered an incorrect password.";
+ * if ( openPassDlg( authInfo, errorMsg ) )
+ * {
+ * kdDebug() << QString::fromLatin1("User: ")
+ * << authInfo.username << endl;
+ * kdDebug() << QString::fromLatin1("Password: ")
+ * << QString::fromLatin1("Not displayed here!") << endl;
+ * }
+ * </pre>
+ *
+ * NOTE: A call to this function can fail and return @p false,
+ * if the UIServer could not be started for whatever reason.
+ *
+ * @param info See @ref AuthInfo.
+ * @param errorMsg Error message to show
+ * @return @p TRUE if user clicks on "OK", @p FALSE otherwsie.
+ * @since 3.1
+ */
+ bool openPassDlg( KIO::AuthInfo& info, const QString &errorMsg );
+
+ /**
+ * Call this in @ref #mimetype, when you know the mimetype.
+ * See @ref #mimetype about other ways to implement it.
+ */
+ void mimeType( const QString &_type );
+
+ /**
+ * Call to signal an error.
+ * This also finishes the job, no need to call finished.
+ *
+ * If the Error code is KIO::ERR_SLAVE_DEFINED then the
+ * _text should contain the complete translated text of
+ * of the error message. This message will be displayed
+ * in an KTextBrowser which allows rich text complete
+ * with hyper links. Email links will call the default
+ * mailer, "exec:/command arg1 arg2" will be forked and
+ * all other links will call the default browser.
+ *
+ * @see KIO::Error
+ * @see KTextBrowser
+ * @param _errid the error code from KIO::Error
+ * @param _text the rich text error message
+ */
+ void error( int _errid, const QString &_text );
+
+ /**
+ * Call to signal a warning, to be displayed in a dialog box.
+ */
+ void warning( const QString &msg );
+
+ /**
+ * Call to signal a message, to be displayed if the application wants to,
+ * for instance in a status bar. Usual examples are "connecting to host xyz", etc.
+ */
+ void infoMessage( const QString &msg );
+
+ /**
+ * Call to signal successful completion of any command
+ * (besides openConnection and closeConnection)
+ */
+ void finished();
+
+
+ enum MessageBoxType { QuestionYesNo = 1, WarningYesNo = 2, WarningContinueCancel = 3,
+ WarningYesNoCancel = 4, Information = 5, SSLMessageBox = 6 };
+
+ /**
+ * Call this to show a message box from the slave (it will in fact be handled
+ * by kio_uiserver, so that the progress info dialog for the slave is hidden
+ * while this message box is shown)
+ * @param type type of message box: QuestionYesNo, WarningYesNo, WarningContinueCancel...
+ * @param text Message string. May contain newlines.
+ * @param caption Message box title.
+ * @param buttonYes The text for the first button.
+ * The default is i18n("&Yes").
+ * @param buttonNo The text for the second button.
+ * The default is i18n("&No").
+ * Note: for ContinueCancel, buttonYes is the continue button and buttonNo is unused.
+ * and for Information, none is used.
+ * @return a button code, as defined in KMessageBox, or 0 on communication error.
+ */
+ int messageBox( MessageBoxType type, const QString &text,
+ const QString &caption = QString::null,
+ const QString &buttonYes = QString::null,
+ const QString &buttonNo = QString::null );
+
+ /**
+ * Call this in @ref #get and @ref #copy, to give the total size
+ * of the file
+ * Call in @ref listDir too, when you know the total number of items.
+ */
+ void totalSize( KIO::filesize_t _bytes );
+ /**
+ * Call this during @ref #get and @ref #copy, once in a while,
+ * to give some info about the current state.
+ * Don't emit it in @ref #listDir, @ref #listEntries speaks for itself.
+ */
+ void processedSize( KIO::filesize_t _bytes );
+
+
+signals:
+ void connectionChanged( bool conn_established );
+
+protected:
+ // only available to sub-classed device drivers:
+ void setClassType( enum ClassType ct );
+ void setCapabilities( int caps );
+ KConfig *config() const { return m_config; };
+ QString configFileName() const { return m_configFileName; };
+
+
+ /**
+ * Lock/Unlock serial ports and other devices
+ * @param device Name of a device port (e.g. /dev/ttyS1, ttyS1, /dev/ircomm0)
+ * Returns true, if device could be locked or unlocked
+ */
+ bool lockDevice(const QString &device, QString &err_reason);
+ bool unlockDevice(const QString &device);
+
+protected:
+ QMutex m_mutex; // mutex to syncronize DCOP accesses to this device
+ QString m_configFileName;
+ KConfig *m_config; // this is where this device should store it's configuration
+ enum ClassType m_classType;
+ QString m_deviceClassName; // e.g. "Nokia mobile phone", "MP3 Player", "Handspring Organizer"
+ QString m_deviceName; // e.g. "Nokia 6310", "Opie"
+ QString m_deviceRevision; // e.g. "Revision 1.2" or "n/a"
+ QString m_connectionName; // e.g. "IRDA", "USB", "Cable", "gnokii", "gammu", ...
+ int m_caps; // see enum Capabilities
+ bool m_connected;
+
+private:
+ class KMobileDevicePrivate *d;
+};
+
+#endif /* LIB_KMOBILEDEVICE_H */
+
diff --git a/kmobile/kmobileiface.h b/kmobile/kmobileiface.h
new file mode 100644
index 000000000..9447c667c
--- /dev/null
+++ b/kmobile/kmobileiface.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2003 Helge Deller <deller@kde.org>
+ */
+
+#ifndef _KMOBILEIFACE_H_
+#define _KMOBILEIFACE_H_
+
+#include <dcopobject.h>
+#include <qstringlist.h>
+
+class QStringList;
+
+class kmobileIface : virtual public DCOPObject
+{
+ K_DCOP
+public:
+
+k_dcop:
+ virtual QStringList deviceNames() = 0;
+
+ virtual void removeDevice( QString deviceName ) = 0;
+ virtual void configDevice( QString deviceName ) = 0;
+
+ virtual bool connectDevice( QString deviceName ) = 0;
+ virtual bool disconnectDevice( QString deviceName ) = 0;
+ virtual bool connected( QString deviceName ) = 0;
+
+ virtual QString deviceClassName( QString deviceName ) = 0;
+ virtual QString deviceName( QString deviceName ) = 0;
+ virtual QString revision( QString deviceName ) = 0;
+ virtual int classType( QString deviceName ) = 0;
+
+ virtual int capabilities( QString deviceName ) = 0;
+ virtual QString nameForCap( QString deviceName, int cap ) = 0;
+
+ virtual QString iconFileName( QString deviceName ) = 0;
+
+ virtual int numAddresses( QString deviceName ) = 0;
+ virtual QString readAddress( QString deviceName, int index ) = 0;
+ virtual bool storeAddress( QString deviceName, int index, QString vcard, bool append ) = 0;
+
+ virtual int numCalendarEntries( QString deviceName ) = 0;
+
+ virtual int numNotes( QString deviceName ) = 0;
+ virtual QString readNote( QString deviceName, int index ) = 0;
+ virtual bool storeNote( QString deviceName, int index, QString note ) = 0;
+
+ /*
+ * DCOP functions for the devices:/ kioslave
+ */
+k_dcop:
+ virtual QStringList kio_devices_deviceInfo(QString deviceName) = 0;
+};
+
+#endif // _KMOBILEIFACE_H_
diff --git a/kmobile/kmobileitem.cpp b/kmobile/kmobileitem.cpp
new file mode 100644
index 000000000..0cf61fec7
--- /dev/null
+++ b/kmobile/kmobileitem.cpp
@@ -0,0 +1,195 @@
+/* This file is part of the KDE KMobile library
+ Copyright (C) 2003 Helge Deller <deller@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include <qobject.h>
+
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <kconfig.h>
+
+#include "kmobileitem.h"
+
+
+#define PRINT_DEBUG kdDebug() << "KMobileItem: "
+
+KMobileItem::KMobileItem(QIconView *parent, KConfig *_config, KService::Ptr service)
+ : QObject(parent), QIconViewItem(parent), m_dev(0L)
+{
+ config = _config;
+
+ Q_CHECK_PTR(service);
+ if (service) {
+ setText(service->name());
+ m_deviceDesktopFile = service->desktopEntryName();
+ m_deviceConfigFile = QString("kmobile_%1_rc").arg(text());
+ m_deviceConfigFile = m_deviceConfigFile.replace(' ', "");
+ m_iconName = service->icon();
+ };
+
+ if (m_iconName.isEmpty())
+ m_iconName = KMOBILE_ICON_UNKNOWN;
+
+ setPixmap(getIcon());
+ setRenameEnabled(true);
+}
+
+/* restore this item from the config file */
+KMobileItem::KMobileItem(QIconView *parent, KConfig *_config, int reload_index)
+ : QObject(parent), QIconViewItem(parent), m_dev(0L)
+{
+ config = _config;
+
+ if (!configLoad(reload_index)) {
+ delete this;
+ return;
+ }
+
+ setPixmap(getIcon());
+ setRenameEnabled(true);
+}
+
+KMobileItem::~KMobileItem()
+{
+ delete m_dev;
+}
+
+
+void KMobileItem::configSave() const
+{
+ config->setGroup( config_SectionName() );
+ config->writeEntry( "Name", text() );
+ config->writeEntry( "Config", m_deviceConfigFile );
+ config->writeEntry( "DesktopFile", m_deviceDesktopFile );
+ config->writeEntry( "IconName", m_iconName );
+ config->sync();
+}
+
+bool KMobileItem::configLoad(int idx)
+{
+ config->setGroup( config_SectionName(idx) );
+ setText( config->readEntry("Name") );
+ m_deviceConfigFile = config->readEntry( "Config" );
+ m_deviceDesktopFile = config->readEntry( "DesktopFile" );
+ m_iconName = config->readEntry( "IconName" );
+
+ if (text().isEmpty() || m_deviceConfigFile.isEmpty() ||
+ m_deviceDesktopFile.isEmpty() || m_iconName.isEmpty() )
+ return false;
+
+ return true;
+}
+
+QPixmap KMobileItem::getIcon() const
+{
+ return KGlobal::instance()->iconLoader()->loadIcon(m_iconName, KIcon::Desktop );
+}
+
+QString KMobileItem::config_SectionName(int idx) const
+{
+ if (idx == -1) idx = index();
+ return QString("MobileDevice_%1").arg(idx);
+}
+
+/* this MimeType is used by konqueror */
+QString KMobileItem::getKonquMimeType() const
+{
+ return KMOBILE_MIMETYPE_DEVICE_KONQUEROR(text());
+}
+
+/* provide MimeType for konqueror */
+void KMobileItem::writeKonquMimeFile() const
+{
+ // strip path and file extension of icon name
+ QString icon = m_iconName;
+ int p = icon.findRev('/');
+ if (p>=0) icon = icon.mid(p+1);
+ p = icon.find('.');
+ if (p>=0) icon = icon.left(p);
+
+ QString comment;
+ if (m_dev)
+ comment = m_dev->deviceClassName();
+ if (comment.isEmpty())
+ comment = KMobileDevice::defaultClassName(KMobileDevice::Unclassified);
+
+ KConfig conf( getKonquMimeType()+".desktop", false, true, "mime" );
+ conf.setDesktopGroup();
+ conf.writeEntry("Encoding", "UTF-8");
+ conf.writeEntry("Comment", comment );
+ conf.writeEntry("Type", "MimeType");
+ conf.writeEntry("Icon", icon );
+ conf.writeEntry("MimeType", getKonquMimeType());
+ conf.writeEntry("Patterns", "" );
+ conf.sync();
+}
+
+
+/*
+ * get a list of all services providing a libkmobile device driver
+ */
+KTrader::OfferList KMobileItem::getMobileDevicesList()
+{
+ KTrader::OfferList offers = KTrader::self()->query(KMOBILE_MIMETYPE_DEVICE);
+ return offers;
+}
+
+
+KService::Ptr KMobileItem::getServicePtr() const
+{
+ KTrader::OfferList list = getMobileDevicesList();
+ KTrader::OfferListIterator it;
+ KService::Ptr ptr;
+ for ( it = list.begin(); it != list.end(); ++it ) {
+ KService::Ptr ptr = *it;
+ if (ptr->desktopEntryName() == m_deviceDesktopFile)
+ return ptr;
+ }
+ PRINT_DEBUG << QString("Service for library '%1' not found in KService list\n")
+ .arg(m_deviceDesktopFile);
+ return 0L;
+}
+
+/*
+ * loads & initializes the device and returns a pointer to it.
+ */
+bool KMobileItem::driverAvailable()
+{
+ if (m_dev)
+ return true;
+
+ KService::Ptr ptr = getServicePtr();
+ if (!ptr)
+ return false;
+
+ PRINT_DEBUG << QString("Loading library %1\n").arg(ptr->library());
+ KLibFactory *factory = KLibLoader::self()->factory( ptr->library().utf8() );
+ if (!factory)
+ return false;
+
+ m_dev = static_cast<KMobileDevice *>(factory->create(this, ptr->name().utf8(),
+ "KMobileDevice", QStringList(m_deviceConfigFile)));
+ PRINT_DEBUG << QString("Got KMobileDevice object at 0x%1, configfile=%2\n")
+ .arg((unsigned long)m_dev, 0, 16).arg(m_deviceConfigFile);
+
+ return (m_dev != 0);
+}
+
+#include "kmobileitem.moc"
+
diff --git a/kmobile/kmobileitem.h b/kmobile/kmobileitem.h
new file mode 100644
index 000000000..b23a8f1e0
--- /dev/null
+++ b/kmobile/kmobileitem.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2003 Helge Deller <deller@kde.org>
+ */
+
+#ifndef _KMOBILEITEM_H_
+#define _KMOBILEITEM_H_
+
+#include <qiconview.h>
+#include <qpixmap.h>
+#include <ktrader.h>
+#include "kmobiledevice.h"
+
+class KMobileItem : public QObject, public QIconViewItem
+{
+ Q_OBJECT
+ friend class KMobileView;
+public:
+ KMobileItem(QIconView *parent, KConfig *config, KService::Ptr service);
+ KMobileItem(QIconView *parent, KConfig *config, int reload_index);
+ virtual ~KMobileItem();
+
+ void configSave() const;
+ bool configLoad(int index);
+
+ QString config_SectionName( int idx = -1 ) const;
+ QPixmap getIcon() const;
+
+ static KTrader::OfferList getMobileDevicesList();
+
+protected:
+ QString getKonquMimeType() const;
+ void writeKonquMimeFile() const;
+
+
+ KService::Ptr getServicePtr() const;
+ bool driverAvailable();
+ KMobileDevice *m_dev;
+
+signals:
+
+private slots:
+
+private:
+ KConfig *config;
+
+ QString m_deviceConfigFile;
+ QString m_deviceDesktopFile;
+
+ QString m_iconName;
+};
+
+#endif // _KMOBILEITEM_H_
diff --git a/kmobile/kmobileui.rc b/kmobile/kmobileui.rc
new file mode 100644
index 000000000..95af1dd3b
--- /dev/null
+++ b/kmobile/kmobileui.rc
@@ -0,0 +1,29 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="kmobile" version="1">
+ <MenuBar>
+ <Menu name="file" noMerge="1"><text>&amp;File</text>
+ <Action name="file_close"/>
+ <Separator/>
+ <Action name="file_quit"/>
+ </Menu>
+ <Menu name="Device">
+ <text>&amp;Device</text>
+ <Action name="device_add" />
+ <Action name="device_remove" />
+ <Separator/>
+ <Action name="device_rename" />
+ <Action name="device_changeicon" />
+ <Separator/>
+ <Action name="device_configure" />
+ </Menu>
+ </MenuBar>
+ <ToolBar noMerge="1" name="mainToolBar" fullWidth="true" >
+ <text>Main Toolbar</text>
+ <Action name="file_save" />
+ <Separator/>
+ <Action name="device_add" />
+ <Action name="device_remove" />
+ <Separator/>
+ <Action name="device_configure"/>
+ </ToolBar>
+</kpartgui>
diff --git a/kmobile/kmobileview.cpp b/kmobile/kmobileview.cpp
new file mode 100644
index 000000000..dca825abf
--- /dev/null
+++ b/kmobile/kmobileview.cpp
@@ -0,0 +1,439 @@
+/* This file is part of the KDE KMobile library
+ Copyright (C) 2003 Helge Deller <deller@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include <qiconview.h>
+#include <qstringlist.h>
+
+#include <ktrader.h>
+#include <klibloader.h>
+#include <klocale.h>
+#include <kabc/vcardconverter.h>
+#include <kprocess.h>
+#include <kdebug.h>
+#include <kconfig.h>
+
+#include "kmobileview.h"
+#include "kmobileitem.h"
+
+
+KMobileView::KMobileView(QWidget *parent, KConfig *_config)
+ : DCOPObject("kmobileIface"), QIconView(parent)
+{
+ m_config = _config;
+ setSelectionMode(QIconView::Single);
+ setResizeMode(QIconView::Adjust);
+ setAutoArrange(true);
+ connect(this, SIGNAL(doubleClicked(QIconViewItem *)),
+ SLOT(slotDoubleClicked(QIconViewItem *)));
+}
+
+KMobileView::~KMobileView()
+{
+}
+
+bool KMobileView::addNewDevice(KConfig *config, KService::Ptr service)
+{
+ kdDebug() << "New mobile device item:\n";
+ kdDebug() << QString("LIBRARY: '%1', NAME: '%2', ICON: '%3', COMMENT: '%4'\n")
+ .arg(service->library()).arg(service->name()).arg(service->icon())
+ .arg(service->comment());
+
+ KMobileItem *it;
+ it = new KMobileItem(this, config, service);
+ bool available = it->driverAvailable();
+ it->configSave();
+ it->writeKonquMimeFile();
+ return available;
+}
+
+void KMobileView::saveAll()
+{
+ m_config->setGroup( "Main" );
+ m_config->writeEntry( "Entries", count() );
+ for ( QIconViewItem *item = firstItem(); item; item = item->nextItem() ) {
+ KMobileItem *it = static_cast<KMobileItem *>(item);
+ it->driverAvailable();
+ it->configSave();
+ it->writeKonquMimeFile();
+ }
+ m_config->sync();
+ emit signalChangeStatusbar( i18n("Configuration saved") );
+}
+
+void KMobileView::restoreAll()
+{
+ m_config->setGroup( "Main" );
+ int num = m_config->readNumEntry( "Entries" );
+ for (int i=0; i<num; ++i) {
+ KMobileItem *it;
+ it = new KMobileItem(this, m_config, i);
+ it->driverAvailable();
+ it->writeKonquMimeFile();
+ }
+ emit signalChangeStatusbar( i18n("Configuration restored") );
+}
+
+KMobileItem *KMobileView::findDevice( const QString &deviceName ) const
+{
+ for ( QIconViewItem *item = firstItem(); item; item = item->nextItem() ) {
+ if (item->text() == deviceName)
+ return static_cast<KMobileItem *>(item);
+ }
+ return 0L;
+}
+
+bool KMobileView::startKonqueror( const QString &devName )
+{
+ KProcess *proc = new KProcess;
+ *proc << "kfmclient" << "openProfile" << "webbrowsing" << "mobile:/"+devName;
+ return proc->start();
+}
+
+void KMobileView::slotDoubleClicked( QIconViewItem * item )
+{
+ startKonqueror(item->text());
+}
+
+
+/**
+ * DCOP - Implementation
+ */
+
+#define MUTEX_LOCK(dev) { dev->m_mutex.lock()
+#define MUTEX_UNLOCK(dev) dev->m_mutex.unlock(); }
+
+
+QStringList KMobileView::deviceNames()
+{
+ QStringList names;
+ for ( QIconViewItem *item = firstItem(); item; item = item->nextItem() ) {
+ names.append(item->text());
+ }
+ return names;
+}
+
+void KMobileView::removeDevice( QString deviceName )
+{
+ delete findDevice(deviceName);
+ emit signalChangeStatusbar( i18n("%1 removed").arg(deviceName) );
+}
+
+void KMobileView::configDevice( QString deviceName )
+{
+ KMobileItem *dev = findDevice(deviceName);
+ if (!dev || !dev->driverAvailable())
+ return;
+ MUTEX_LOCK(dev->m_dev);
+ dev->m_dev->configDialog(this);
+ MUTEX_UNLOCK(dev->m_dev);
+}
+
+
+bool KMobileView::connectDevice( QString deviceName )
+{
+ KMobileItem *dev = findDevice(deviceName);
+ if (!dev || !dev->driverAvailable())
+ return false;
+ bool connected;
+ MUTEX_LOCK(dev->m_dev);
+ connected = dev->m_dev->connectDevice();
+ MUTEX_UNLOCK(dev->m_dev);
+ emit signalChangeStatusbar(
+ connected ? i18n("Connection to %1 established").arg(deviceName)
+ : i18n("Connection to %1 failed").arg(deviceName) );
+ return connected;
+}
+
+bool KMobileView::disconnectDevice( QString deviceName )
+{
+ KMobileItem *dev = findDevice(deviceName);
+ if (!dev || !dev->driverAvailable())
+ return true;
+ bool disconnected;
+ MUTEX_LOCK(dev->m_dev);
+ disconnected = dev->m_dev->disconnectDevice();
+ MUTEX_UNLOCK(dev->m_dev);
+ emit signalChangeStatusbar(
+ disconnected ? i18n("%1 disconnected").arg(deviceName)
+ : i18n("Disconnection of %1 failed").arg(deviceName) );
+ return disconnected;
+}
+
+bool KMobileView::connected( QString deviceName )
+{
+ KMobileItem *dev = findDevice(deviceName);
+ if (!dev || !dev->driverAvailable())
+ return false;
+ bool conn;
+ MUTEX_LOCK(dev->m_dev);
+ conn = dev->m_dev->connected();
+ MUTEX_UNLOCK(dev->m_dev);
+ return conn;
+}
+
+
+QString KMobileView::deviceClassName( QString deviceName )
+{
+ KMobileItem *dev = findDevice(deviceName);
+ if (!dev || !dev->driverAvailable())
+ return QString::null;
+ QString cn;
+ MUTEX_LOCK(dev->m_dev);
+ cn = dev->m_dev->deviceClassName();
+ MUTEX_UNLOCK(dev->m_dev);
+ return cn;
+}
+
+QString KMobileView::deviceName( QString deviceName )
+{
+ KMobileItem *dev = findDevice(deviceName);
+ if (!dev || !dev->driverAvailable())
+ return QString::null;
+ QString dn;
+ MUTEX_LOCK(dev->m_dev);
+ dn = dev->m_dev->deviceName();
+ MUTEX_UNLOCK(dev->m_dev);
+ return dn;
+}
+
+QString KMobileView::revision( QString deviceName )
+{
+ KMobileItem *dev = findDevice(deviceName);
+ if (!dev || !dev->driverAvailable())
+ return QString::null;
+ QString rev;
+ MUTEX_LOCK(dev->m_dev);
+ rev = dev->m_dev->revision();
+ MUTEX_UNLOCK(dev->m_dev);
+ return rev;
+}
+
+int KMobileView::classType( QString deviceName )
+{
+ KMobileItem *dev = findDevice(deviceName);
+ if (!dev || !dev->driverAvailable())
+ return KMobileDevice::Unclassified;
+ int ct;
+ MUTEX_LOCK(dev->m_dev);
+ ct = dev->m_dev->classType();
+ MUTEX_UNLOCK(dev->m_dev);
+ return ct;
+}
+
+int KMobileView::capabilities( QString deviceName )
+{
+ KMobileItem *dev = findDevice(deviceName);
+ if (!dev || !dev->driverAvailable())
+ return KMobileDevice::hasNothing;
+ int cap;
+ MUTEX_LOCK(dev->m_dev);
+ cap = dev->m_dev->capabilities();
+ MUTEX_UNLOCK(dev->m_dev);
+ return cap;
+}
+
+QString KMobileView::nameForCap( QString deviceName, int cap )
+{
+ KMobileItem *dev = findDevice(deviceName);
+ if (!dev || !dev->driverAvailable())
+ return QString::null;
+ QString nc;
+ MUTEX_LOCK(dev->m_dev);
+ nc = dev->m_dev->nameForCap(cap);
+ MUTEX_UNLOCK(dev->m_dev);
+ return nc;
+}
+
+QString KMobileView::iconFileName( QString deviceName )
+{
+ KMobileItem *dev = findDevice(deviceName);
+ if (!dev || !dev->driverAvailable())
+ return QString::null;
+ QString fn;
+ MUTEX_LOCK(dev->m_dev);
+ fn = dev->m_dev->iconFileName();
+ MUTEX_UNLOCK(dev->m_dev);
+ return fn;
+}
+
+int KMobileView::numAddresses( QString deviceName )
+{
+ KMobileItem *dev = findDevice(deviceName);
+ if (!dev || !dev->driverAvailable())
+ return 0;
+ int num;
+ MUTEX_LOCK(dev->m_dev);
+ num = dev->m_dev->numAddresses();
+ MUTEX_UNLOCK(dev->m_dev);
+ return num;
+}
+
+QString KMobileView::readAddress( QString deviceName, int index )
+{
+ KMobileItem *dev = findDevice(deviceName);
+ if (!dev || !dev->driverAvailable())
+ return QString::null;
+
+ int err;
+ KABC::Addressee adr;
+ MUTEX_LOCK(dev->m_dev);
+ err = dev->m_dev->readAddress(index, adr);
+ MUTEX_UNLOCK(dev->m_dev);
+ if (err)
+ return QString::null;
+
+ KABC::VCardConverter converter;
+ QString str = converter.createVCard(adr);
+ if (str.isEmpty())
+ return QString::null;
+
+ emit signalChangeStatusbar( i18n("Read addressbook entry %1 from %2")
+ .arg(index).arg(deviceName) );
+
+ return str;
+}
+
+bool KMobileView::storeAddress( QString deviceName, int index, QString vcard, bool append )
+{
+ KMobileItem *dev = findDevice(deviceName);
+ if (!dev || !dev->driverAvailable())
+ return false;
+
+ KABC::VCardConverter converter;
+ KABC::Addressee adr = converter.parseVCard(vcard);
+ if (adr.isEmpty())
+ return false;
+
+ int err;
+ MUTEX_LOCK(dev->m_dev);
+ err = dev->m_dev->storeAddress(index, adr, append);
+ MUTEX_UNLOCK(dev->m_dev);
+ emit signalChangeStatusbar(
+ err ? i18n("Storing contact %1 on %2 failed").arg(index).arg(deviceName)
+ : i18n("Contact %1 stored on %2").arg(index).arg(deviceName) );
+ return (err == 0);
+}
+
+int KMobileView::numCalendarEntries( QString deviceName )
+{
+ KMobileItem *dev = findDevice(deviceName);
+ if (!dev || !dev->driverAvailable())
+ return 0;
+ int num;
+ MUTEX_LOCK(dev->m_dev);
+ num = dev->m_dev->numCalendarEntries();
+ MUTEX_UNLOCK(dev->m_dev);
+ return num;
+}
+
+int KMobileView::numNotes( QString deviceName )
+{
+ KMobileItem *dev = findDevice(deviceName);
+ if (!dev || !dev->driverAvailable())
+ return 0;
+ int num;
+ MUTEX_LOCK(dev->m_dev);
+ num = dev->m_dev->numNotes();
+ MUTEX_UNLOCK(dev->m_dev);
+ return num;
+}
+
+QString KMobileView::readNote( QString deviceName, int index )
+{
+ KMobileItem *dev = findDevice(deviceName);
+ if (!dev || !dev->driverAvailable())
+ return QString::null;
+
+ QString note;
+ int err;
+ MUTEX_LOCK(dev->m_dev);
+ err = dev->m_dev->readNote(index, note);
+ MUTEX_UNLOCK(dev->m_dev);
+ if (err)
+ return QString::null;
+ emit signalChangeStatusbar( i18n("Read note %1 from %2")
+ .arg(index).arg(deviceName) );
+ return note;
+}
+
+bool KMobileView::storeNote( QString deviceName, int index, QString note )
+{
+ KMobileItem *dev = findDevice(deviceName);
+ if (!dev || !dev->driverAvailable())
+ return false;
+
+ int err;
+ MUTEX_LOCK(dev->m_dev);
+ err = dev->m_dev->storeNote(index, note);
+ MUTEX_UNLOCK(dev->m_dev);
+ if (err)
+ return false;
+ emit signalChangeStatusbar( i18n("Stored note %1 to %2")
+ .arg(index).arg(deviceName) );
+ return true;
+}
+
+
+
+/*
+ * DCOP Implementation for the devices:/ kioslave
+ */
+
+/*
+ * returns the information for the given deviceName for usage in the
+ * the devices kioslave. The QStringList returned is comparable to the
+ * format of /etc/fstab file. Please refer to the devices kioslave for
+ * further information.
+ * If deviceName is empty, this functions returns information for all
+ * active mobile devices.
+ * (function is only used by the devices kioslave - don't use elsewhere !)
+ */
+QStringList KMobileView::kio_devices_deviceInfo(QString deviceName)
+{
+ QStringList mobiles = deviceNames();
+ if (mobiles.count() == 0)
+ return mobiles;
+
+ QStringList mountList;
+ for ( QStringList::Iterator it = mobiles.begin(); it != mobiles.end(); ++it ) {
+ QString name = *it;
+
+ if (deviceName.isEmpty())
+ mountList << name;
+ else
+ if (deviceName!=name)
+ continue;
+
+ KMobileItem *dev = findDevice(name);
+ QString mime = dev ? dev->getKonquMimeType() : KMOBILE_MIMETYPE_DEVICE;
+
+ mountList << name;
+ mountList << " ";
+ mountList << QString("mobile:/%1").arg(name); // KIO::encodeFileName()
+ mountList << mime;
+ mountList << "true"; // mountState
+ mountList << "---";
+ if (!deviceName.isEmpty())
+ break;
+ }
+ return mountList;
+}
+
+
+#include "kmobileview.moc"
diff --git a/kmobile/kmobileview.h b/kmobile/kmobileview.h
new file mode 100644
index 000000000..4e18793cc
--- /dev/null
+++ b/kmobile/kmobileview.h
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2003 Helge Deller <deller@kde.org>
+ */
+
+#ifndef _KMOBILEVIEW_H_
+#define _KMOBILEVIEW_H_
+
+#include <qiconview.h>
+
+#include "kmobileiface.h"
+
+#include <kdepimmacros.h>
+class KConfig;
+class KMobileItem;
+
+/**
+ * This is the main view class for kmobile.
+ *
+ * @short Main view
+ * @author Helge Deller <deller@kde.org>
+ * @version 0.1
+ */
+class KDE_EXPORT KMobileView : public QIconView, public kmobileIface
+{
+ Q_OBJECT
+public:
+ KMobileView(QWidget *parent, KConfig *_config);
+ virtual ~KMobileView();
+
+ bool addNewDevice(KConfig *config, KService::Ptr service);
+ bool startKonqueror(const QString &devName);
+
+ /**
+ * DCOP implementation
+ */
+ QStringList deviceNames();
+
+ void removeDevice( QString deviceName );
+ void configDevice( QString deviceName );
+
+ bool connectDevice( QString deviceName );
+ bool disconnectDevice( QString deviceName );
+ bool connected( QString deviceName );
+
+ QString deviceClassName( QString deviceName );
+ QString deviceName( QString deviceName );
+ QString revision( QString deviceName );
+ int classType( QString deviceName );
+
+ int capabilities( QString deviceName );
+ QString nameForCap( QString deviceName, int cap );
+
+ QString iconFileName( QString deviceName );
+
+ int numAddresses( QString deviceName );
+ QString readAddress( QString deviceName, int index );
+ bool storeAddress( QString deviceName, int index, QString vcard, bool append );
+
+ int numCalendarEntries( QString deviceName );
+
+ int numNotes( QString deviceName );
+ QString readNote( QString deviceName, int index );
+ bool storeNote( QString deviceName, int index, QString note );
+
+ /* devices kioslave support: */
+ QStringList kio_devices_deviceInfo(QString deviceName);
+
+public:
+ void saveAll();
+ void restoreAll();
+
+protected:
+ KMobileItem * findDevice( const QString &deviceName ) const;
+
+protected slots:
+ void slotDoubleClicked( QIconViewItem * item );
+
+signals:
+ /**
+ * Use this signal to change the content of the statusbar
+ */
+ void signalChangeStatusbar(const QString& text);
+
+private:
+ KConfig *m_config;
+
+};
+
+#endif // _KMOBILEVIEW_H_
diff --git a/kmobile/libkmobile.desktop b/kmobile/libkmobile.desktop
new file mode 100644
index 000000000..6f195ed94
--- /dev/null
+++ b/kmobile/libkmobile.desktop
@@ -0,0 +1,51 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=kdedevice/mobiledevice
+Name=KDE Mobile Device Lowlevel Hardware Driver
+Name[af]=KDE draagbare toestel laevlak hardeware toestel
+Name[bs]=KDE hardverski drajver niskog nivoa za mobilne uređaje
+Name[ca]=Manegador KDE de dispositius de maquinari mòbil de baix nivell
+Name[cs]=KDE nízkoúrovňový ovladač mobilních zářízení
+Name[cy]=Gyrrydd Caledwedd Lefel Isel KDE ar gyfer Dyfeisiau Symudol
+Name[da]=KDE Mobil-enhed Lavt niveau hardware-driver
+Name[de]=Lowlevel-Treiber für mobile Geräte
+Name[el]=Οδηγός χαμηλού επιπέδου φορητής συσκευής του KDE
+Name[es]=Manejador de dispositivos hardware móviles de bajo nivel para KDE
+Name[et]=KDE mobiilide riistvara süvataseme draiver
+Name[eu]=KDE-ren dispositibo mugikorren behe-mailako hardware kontrolatzailea
+Name[fa]=گردانندۀ سخت‌افزاری سطح پایین دستگاه تلفن همراه KDE
+Name[fi]=KDE:n matkapuhelimen matalan tason laiteajuri
+Name[fr]=Pilote matériel de bas niveau des périphériques mobiles pour KDE
+Name[fy]=Hardware-stjoerprogramma foar mobile apparaten
+Name[ga]=Tiománaí crua-earraí íseal-leibhéil do ghléasanna móibíleacha KDE
+Name[gl]=Controlador de Hardware de Baixo Nivel dun Dispositivo Móbil de KDE
+Name[hi]=केडीई मोबाइल उपकरण लो-लेवल हार्डवेयर ड्राइवर
+Name[hu]=Alacsony szintű KDE-s eszközmeghajtó mobiltelefonok kezeléséhez
+Name[is]=Hrár KDE vélbúnaðarrekill fyrir farsíma og lófatölvur
+Name[it]=KDE driver hardware di basso livello per dispositivi portatili
+Name[ja]=KDE モバイル機器低レベルハードウェアドライバ
+Name[ka]=KDE მობილური მოწყობილობის დაბალდონიანი ხისტი დრაივერი
+Name[kk]=KDE-нің қалта құрылғы жабдықтың төмен деңгейлі драйвері
+Name[km]=កម្មវិធី​បញ្ជា​ផ្នែករឹង​កម្រិត​ទាប​របស់​ឧបករណ៍​ចល័ត KDE
+Name[lt]=KDE mobiliųjų įrenginių žemo lygmens aparatinės įrangos tvarkyklė
+Name[ms]=Pemacu Perkakasan Tahap Rendah Peranti Mudah Alih KDE
+Name[nb]=KDE lavnivå maskinvaredriver for mobile enheter
+Name[nds]=Sietstoop-Driever för Mobilreedschappen
+Name[ne]=केडीई मोबाइल यन्त्रको न्यूनस्तर हार्डवेयर ड्राइभर
+Name[nl]=Hardware-stuurprogramma voor mobiele apparaten
+Name[nn]=Lågnivå maskinvaredrivar for mobileiningar i KDE
+Name[pl]=Niskopoziomowy sterownik sprzętu urządzenia przenośnego dla KDE
+Name[pt]=Controlador de Baixo-Nível de Dispositivos Móveis do KDE
+Name[pt_BR]=Driver de Hardware de Baixo Nível de Dispositivos Móveis do KDE
+Name[ru]=Низкоуровневый драйвер работы с мобильными устройствами в KDE
+Name[sk]=Nízkoúrovňový ovládač prenosných zariadení pre KDE
+Name[sl]=Nizkonivojski gonilnik KDE za stojno opremo prenosnih naprav
+Name[sr]=KDE-ов управљачки програм ниског нивоа за мобилне уређаје
+Name[sr@Latn]=KDE-ov upravljački program niskog nivoa za mobilne uređaje
+Name[sv]=KDE:s lågnivådrivrutin för mobilenheter
+Name[ta]=KAB நடமாடும் சாதனம் கீழ்நிலை வன்பொருள் இயக்கி
+Name[tg]=Драйвери пастдараҷавии кор бо дастгоҳи мобилӣ дар KDE
+Name[tr]=KDE Taşınabilir Aygıt Düşük Seviye Donanım Sürücüsü
+Name[uk]=Мобільний пристрій KDE драйвер працюючий з пристроєм напряму
+Name[zh_CN]=KDE 移动设备低级硬件驱动程序
+Name[zh_TW]=KDE 行動裝置低階硬體驅動程式
diff --git a/kmobile/main.cpp b/kmobile/main.cpp
new file mode 100644
index 000000000..1b03f9716
--- /dev/null
+++ b/kmobile/main.cpp
@@ -0,0 +1,65 @@
+/* This file is part of the KDE KMobile library
+ Copyright (C) 2003 Helge Deller <deller@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include "kmobile.h"
+#include <kuniqueapplication.h>
+#include <dcopclient.h>
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <klocale.h>
+
+static const char description[] =
+ I18N_NOOP("KDE mobile devices manager");
+
+static const char version[] = "0.1";
+
+static KCmdLineOptions options[] =
+{
+ { "minimized", I18N_NOOP( "Minimize on startup to system tray" ), 0 },
+ KCmdLineLastOption
+};
+
+int main(int argc, char **argv)
+{
+ KAboutData about("kmobile", I18N_NOOP("KMobile"), version, description,
+ KAboutData::License_GPL, "(C) 2003-2005 Helge Deller", 0, 0, "deller@kde.org");
+ about.addAuthor( "Helge Deller", 0, "deller@kde.org" );
+ KCmdLineArgs::init(argc, argv, &about);
+ KCmdLineArgs::addCmdLineOptions(options);
+ KUniqueApplication app;
+
+ // register ourselves as a dcop client
+ app.dcopClient()->registerAs(app.name(), false);
+
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
+ // see if we are starting with session management
+ if (app.isRestored())
+ {
+ RESTORE(KMobile);
+ }
+ else
+ {
+ KMobile *widget = new KMobile;
+ if (!args->isSet("minimized"))
+ widget->show();
+ }
+
+ return app.exec();
+}
diff --git a/kmobile/pref.cpp b/kmobile/pref.cpp
new file mode 100644
index 000000000..1d463cb34
--- /dev/null
+++ b/kmobile/pref.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2003 Helge Deller <deller@kde.org>
+ */
+
+#include "pref.h"
+
+#include <klocale.h>
+
+#include <qlayout.h>
+#include <qlabel.h>
+
+KMobilePreferences::KMobilePreferences()
+ : KDialogBase(TreeList, i18n("Preferences"),
+ Help|Default|Ok|Apply|Cancel, Ok)
+{
+ // this is the base class for your preferences dialog. it is now
+ // a Treelist dialog.. but there are a number of other
+ // possibilities (including Tab, Swallow, and just Plain)
+ QFrame *frame;
+ frame = addPage(i18n("First Page"), i18n("Page One Options"));
+ m_pageOne = new KMobilePrefPageOne(frame);
+
+ frame = addPage(i18n("Second Page"), i18n("Page Two Options"));
+ m_pageTwo = new KMobilePrefPageTwo(frame);
+}
+
+KMobilePrefPageOne::KMobilePrefPageOne(QWidget *parent)
+ : QFrame(parent)
+{
+ QHBoxLayout *layout = new QHBoxLayout(this);
+ layout->setAutoAdd(true);
+
+ new QLabel(i18n("Add something here"), this);
+}
+
+KMobilePrefPageTwo::KMobilePrefPageTwo(QWidget *parent)
+ : QFrame(parent)
+{
+ QHBoxLayout *layout = new QHBoxLayout(this);
+ layout->setAutoAdd(true);
+
+ new QLabel(i18n("Add something here"), this);
+}
+#include "pref.moc"
diff --git a/kmobile/pref.h b/kmobile/pref.h
new file mode 100644
index 000000000..b8786a855
--- /dev/null
+++ b/kmobile/pref.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2003 Helge Deller <deller@kde.org>
+ */
+
+#ifndef _KMOBILEPREF_H_
+#define _KMOBILEPREF_H_
+
+#include <kdialogbase.h>
+#include <qframe.h>
+
+class KMobilePrefPageOne;
+class KMobilePrefPageTwo;
+
+class KMobilePreferences : public KDialogBase
+{
+ Q_OBJECT
+public:
+ KMobilePreferences();
+
+private:
+ KMobilePrefPageOne *m_pageOne;
+ KMobilePrefPageTwo *m_pageTwo;
+};
+
+class KMobilePrefPageOne : public QFrame
+{
+ Q_OBJECT
+public:
+ KMobilePrefPageOne(QWidget *parent = 0);
+};
+
+class KMobilePrefPageTwo : public QFrame
+{
+ Q_OBJECT
+public:
+ KMobilePrefPageTwo(QWidget *parent = 0);
+};
+
+#endif // _KMOBILEPREF_H_
diff --git a/kmobile/systemtray.cpp b/kmobile/systemtray.cpp
new file mode 100644
index 000000000..b057086e4
--- /dev/null
+++ b/kmobile/systemtray.cpp
@@ -0,0 +1,106 @@
+/* This file is part of the KDE KMobile library.
+ Copyright (C) 2003 Helge Deller <deller@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <kiconloader.h>
+#include <kpopupmenu.h>
+#include <kpassivepopup.h>
+#include <kaction.h>
+#include <kmainwindow.h>
+#include <kiconeffect.h>
+#include <kdebug.h>
+
+#include <qhbox.h>
+#include <qpushbutton.h>
+#include <qtooltip.h>
+#include <qpainter.h>
+
+#include "systemtray.h"
+
+#include "kmobile.h"
+#include "kmobileview.h"
+
+
+SystemTray::SystemTray(KMainWindow *parent, const char *name) : KSystemTray(parent, name)
+
+{
+ m_appPix = KGlobal::instance()->iconLoader()->loadIcon("kmobile", KIcon::Small);
+ setPixmap(m_appPix);
+
+ setToolTip();
+
+ m_actionCollection = parent->actionCollection();
+ KAction *addAction = m_actionCollection->action("device_add");
+
+ KPopupMenu* menu = contextMenu();
+ addAction->plug(menu);
+ menu->insertSeparator();
+}
+
+SystemTray::~SystemTray()
+{
+
+}
+
+#define SYSTEMTRAY_STARTID 1000
+
+void SystemTray::contextMenuAboutToShow(KPopupMenu *menu)
+{
+ KMobile *main = static_cast<KMobile *>(parent());
+
+ const int pos = 3;
+ while (menu->idAt(pos)>=SYSTEMTRAY_STARTID &&
+ menu->idAt(pos)<=(SYSTEMTRAY_STARTID+1000))
+ menu->removeItemAt(pos);
+
+ // create menu entries for each mobile device and add it's icon
+ QStringList list = main->mainView()->deviceNames();
+ for (unsigned int no=0; no<list.count(); no++) {
+ QString devName = list[no];
+ QString iconName = main->mainView()->iconFileName(devName);
+ QPixmap pm = KGlobal::instance()->iconLoader()->loadIcon(iconName, KIcon::Small);
+ menu->insertItem(pm, devName, SYSTEMTRAY_STARTID+no, 3+no);
+ menu->connectItem(SYSTEMTRAY_STARTID+no, this, SLOT(menuItemSelected()));
+ }
+ connect(menu, SIGNAL(activated(int)), this, SLOT(menuItemActivated(int)));
+}
+
+void SystemTray::menuItemSelected()
+{
+ if (m_menuID<SYSTEMTRAY_STARTID || m_menuID>SYSTEMTRAY_STARTID+1000)
+ return;
+ QString devName = contextMenu()->text(m_menuID);
+ KMobile *main = static_cast<KMobile *>(parent());
+ main->mainView()->startKonqueror(devName);
+}
+
+void SystemTray::menuItemActivated(int id)
+{
+ m_menuID = id;
+}
+
+void SystemTray::setToolTip(const QString &tip)
+{
+ if (tip.isEmpty())
+ QToolTip::add(this, "KMobile");
+ else
+ QToolTip::add(this, tip);
+}
+
+#include "systemtray.moc"
+
+// vim: ts=8
diff --git a/kmobile/systemtray.h b/kmobile/systemtray.h
new file mode 100644
index 000000000..2a4cae924
--- /dev/null
+++ b/kmobile/systemtray.h
@@ -0,0 +1,53 @@
+/* This file is part of the KDE kmobile library.
+ Copyright (C) 2003 Helge Deller <deller@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef SYSTEMTRAY_H
+#define SYSTEMTRAY_H
+
+#include <ksystemtray.h>
+
+class KMainWindow;
+class KAction;
+
+class SystemTray : public KSystemTray
+{
+ Q_OBJECT
+
+public:
+ SystemTray(KMainWindow *parent = 0, const char *name = 0);
+ virtual ~SystemTray();
+
+protected slots:
+ void menuItemActivated(int id);
+ void menuItemSelected();
+
+protected:
+ void contextMenuAboutToShow( KPopupMenu* menu );
+
+private:
+ void setToolTip(const QString &tip = QString::null);
+
+ QPixmap m_appPix;
+ QLabel *m_currentLabel;
+
+ KActionCollection *m_actionCollection;
+ int m_menuID;
+};
+
+#endif // SYSTEMTRAY_H
diff --git a/kmobile/testlibkmobile.cpp b/kmobile/testlibkmobile.cpp
new file mode 100644
index 000000000..f89d3871f
--- /dev/null
+++ b/kmobile/testlibkmobile.cpp
@@ -0,0 +1,40 @@
+/*
+ * Test program for the KDE KMobile Library
+ * Copyright (C) 2003 Helge Deller <deller@kde.org>
+ */
+
+#include <kapplication.h>
+#include <dcopclient.h>
+#include <qdatastream.h>
+#include <qstring.h>
+#include <kdebug.h>
+
+int main(int argc, char **argv)
+{
+ bool ok;
+
+ KApplication app(argc, argv, "kmobile_client", false);
+
+ // get our DCOP client and attach so that we may use it
+ DCOPClient *client = app.dcopClient();
+ client->attach();
+
+ QByteArray data;
+ QDataStream ds(data, IO_WriteOnly);
+// ds << QString("a");
+
+ QCString replyType;
+ QByteArray replyData;
+ ok = client->call("kmobile", "kmobileIface", "deviceNames()", data, replyType, replyData);
+
+ QDataStream reply(replyData, IO_ReadOnly);
+ QStringList deviceNames;
+ reply >> deviceNames;
+
+ kdDebug() << QString("%1\n").arg(ok?"Ok":"Failure");
+ kdDebug() << QString("Number of currently registered drivers: %1\n").arg(deviceNames.count());
+ for (int i=0; i<deviceNames.count(); i++)
+ kdDebug() << QString("Device %1: %2\n").arg(i+1).arg(deviceNames[i]);
+
+ // return app.exec();
+}