• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kmobiletools

fakeengine.h

Go to the documentation of this file.
00001 /***************************************************************************
00002    Copyright (C) 2007 by Matthias Lechner <matthias@lmme.de>
00003 
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2 of the License, or
00007    (at your option) any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.
00013 
00014    You should have received a copy of the GNU General Public License
00015    along with this program; if not, write to the
00016    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018  ***************************************************************************/
00019 
00020 #ifndef KMOBILETOOLSFAKEENGINE_H
00021 #define KMOBILETOOLSFAKEENGINE_H
00022 
00023 #include <QtCore/QObject>
00024 #include <QtGui/QTextEdit>
00025 #include <QtCore/QMutex>
00026 #include <QtCore/QStringList>
00027 #include <KLibFactory>
00028 
00029 #include <libkmobiletools/enginexp.h>
00030 #include <libkmobiletools/contactslist.h>
00031 #include <libkmobiletools/jobxp.h>
00032 
00033 #include <libkmobiletools/ifaces/status.h>
00034 #include <libkmobiletools/ifaces/information.h>
00035 #include <libkmobiletools/ifaces/addressbook.h>
00036 #include <libkmobiletools/ifaces/wizardprovider.h>
00037 #include <libkmobiletools/ifaces/jobprovider.h>
00038 
00042 class FakeEngine : public KMobileTools::EngineXP, // base class
00043                    public KMobileTools::Ifaces::Status,         // interfaces
00044                    public KMobileTools::Ifaces::Information,
00045                    public KMobileTools::Ifaces::Addressbook,
00046                    public KMobileTools::Ifaces::WizardProvider,
00047                    public KMobileTools::Ifaces::JobProvider
00048 {
00049     Q_OBJECT
00050     Q_INTERFACES(KMobileTools::Ifaces::Status KMobileTools::Ifaces::Information)
00051     Q_INTERFACES(KMobileTools::Ifaces::Addressbook KMobileTools::Ifaces::WizardProvider)
00052     Q_INTERFACES(KMobileTools::Ifaces::JobProvider)
00053 
00054 public:
00055     FakeEngine( QObject *parent, const QString& deviceName );
00056     virtual ~FakeEngine();
00057 
00058     //
00059     // Status interface implementation
00060     //
00061     int signalStrength() const;
00062     int charge() const;
00063     KMobileTools::Status::PowerSupplyType powerSupplyType() const;
00064     bool ringing() const;
00065 
00066     //
00067     // Information interface implementation
00068     //
00069     QString networkName() const;
00070     QString manufacturer() const;
00071     KMobileTools::Information::Manufacturer manufacturerID() const;
00072     QString model() const;
00073     QString imei() const;
00074     QString revision() const;
00075 
00076     //
00077     // Addressbook interface implementation
00078     //
00079     KMobileTools::AddressbookEntry::MemorySlots availableMemorySlots() const;
00080     KMobileTools::Addressbook addressbook() const;
00081 
00082     //
00083     // WizardProvider interface implementation
00084     //
00085     QList<QWizardPage*> pageList() const;
00086 
00087 public Q_SLOTS:
00088     void connectDevice();
00089     void disconnectDevice();
00090 
00091     //
00092     // Status interface implementation
00093     //
00094     void fetchStatusInformation();
00095 
00096     //
00097     // Information interface implementation
00098     //
00099     void fetchInformation();
00100 
00101     //
00102     // Addressbook interface implementation
00103     //
00104     void fetchAddressbook();
00105 
00106     void addAddressee( const KMobileTools::AddressbookEntry& addressee );
00107     void editAddressee( const KMobileTools::AddressbookEntry& oldAddressee,
00108                         const KMobileTools::AddressbookEntry& newAddressee );
00109     void removeAddressee( const KMobileTools::AddressbookEntry& addressee );
00110 
00111 Q_SIGNALS:
00112     //
00113     // Status interface implementation
00114     //
00115     void statusInformationFetched();
00116     void signalStrengthChanged( int );
00117     void chargeChanged( int );
00118     void chargeTypeChanged( KMobileTools::Status::PowerSupplyType );
00119     void phoneRinging( bool );
00120 
00121     //
00122     // Information interface implementation
00123     //
00124     void informationFetched();
00125     void networkNameChanged( const QString& );
00126 
00127     //
00128     // Addressbook interface implementation
00129     //
00130     void addressbookFetched();
00131     void addresseeAdded( const KMobileTools::AddressbookEntry& addressee );
00132 
00133     void addresseeEdited( const KMobileTools::AddressbookEntry& oldAddressee,
00134                           const KMobileTools::AddressbookEntry& newAddressee );
00135 
00136     void addresseeRemoved( const KMobileTools::AddressbookEntry& addressee );
00137 
00138     //
00139     // JobProvider interface implementation
00140     //
00141     void jobCreated( KMobileTools::JobXP* job );
00142 
00143 private:
00144     void populateAddressbook();
00145 
00146     bool m_initialized;
00147 
00148     bool m_statusInformationFetched;
00149     bool m_informationFetched;
00150     bool m_addressbookFetched;
00151 
00152     QWidget* m_widget;
00153     QTextEdit* m_status;
00154     void status( const QString& statusInformation );
00155 
00156     QMutex m_displayMutex;
00157     QMutex m_mutex;
00158 
00159     KMobileTools::Addressbook m_addressbook;
00160 
00161     KMobileTools::Addressbook m_addedAddressees;
00162     QStringList m_removedAddressees;
00163 
00164 };
00165 
00166 class FakeEngineFactory : public KPluginFactory
00167 {
00168    Q_OBJECT
00169 public:
00170     FakeEngineFactory();
00171     virtual ~FakeEngineFactory();
00172 
00173     virtual QObject *create(
00174         const char *iface, QWidget *parentWidget, QObject *parent, const QVariantList &args, const QString &keyword );
00175 };
00176 
00177 #endif

kmobiletools

Skip menu "kmobiletools"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  •   doc
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal