kmobiletools
fakeengine.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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,
00043 public KMobileTools::Ifaces::Status,
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
00060
00061 int signalStrength() const;
00062 int charge() const;
00063 KMobileTools::Status::PowerSupplyType powerSupplyType() const;
00064 bool ringing() const;
00065
00066
00067
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
00078
00079 KMobileTools::AddressbookEntry::MemorySlots availableMemorySlots() const;
00080 KMobileTools::Addressbook addressbook() const;
00081
00082
00083
00084
00085 QList<QWizardPage*> pageList() const;
00086
00087 public Q_SLOTS:
00088 void connectDevice();
00089 void disconnectDevice();
00090
00091
00092
00093
00094 void fetchStatusInformation();
00095
00096
00097
00098
00099 void fetchInformation();
00100
00101
00102
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
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
00123
00124 void informationFetched();
00125 void networkNameChanged( const QString& );
00126
00127
00128
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
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