summaryrefslogtreecommitdiffstats
path: root/kmobile/devices/skeleton
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch)
tree67208f7c145782a7e90b123b982ca78d88cc2c87 /kmobile/devices/skeleton
downloadtdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz
tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmobile/devices/skeleton')
-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
4 files changed, 355 insertions, 0 deletions
diff --git a/kmobile/devices/skeleton/Makefile.am b/kmobile/devices/skeleton/Makefile.am
new file mode 100644
index 00000000..7003bbc6
--- /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 00000000..06f59c10
--- /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 00000000..122e2af2
--- /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 00000000..eb0d7db0
--- /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