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

kmobiletools

enginedata.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002    Copyright (C) 2007
00003    by Marco Gulino <marco@kmobiletools.org>
00004    by Matthias Lechner <matthias@lmme.de>
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010 
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the
00020    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021    Boston, MA 02110-1301, USA.
00022  ***************************************************************************/
00023 #include "enginedata.h"
00024 
00025 #include "engine.h"
00026 #include "smslist.h"
00027 #include "contactslist.h"
00028 #include <kabc/addressee.h>
00029 
00030 using namespace KMobileTools;
00031 
00032 class EngineDataPrivate {
00033     public:
00034         EngineDataPrivate() : engine(NULL), i_manufacturer(KMobileTools::Engine::Unknown) {}
00035         KMobileTools::Engine *engine;
00036         bool b_connected;                           // phone connected?
00037         int i_signalStrength;                       // signal strength in percent
00038         int i_charge;                               // charge in percent
00039         EngineData::ChargeType m_chargeType;        // charge type
00040         bool b_ringing;                             // phone is ringing?
00041         QString s_networkName;                      // network name
00042         QString s_manufacturer;                     // manufacturer raw string
00043         int i_manufacturer;                         // enum value?
00044         QString s_model;                            // phone model
00045         QString s_imei;                             // phone imei code
00046         QString s_smscenter;                        // SMS Center number
00047         QString s_revision;                         // Firmware revision
00048         KCal::Event::List *p_calendar;              // Internal Calendar Events List
00049         ContactsList* p_addresseeList;              // Phonebook Contacts List
00050         SMSList *p_smsList;                         // List of SMS fetched from the phone
00051 };
00052 
00053 EngineData::EngineData(KMobileTools::Engine *parentEngine)
00054     : QObject(parentEngine), d(new EngineDataPrivate)
00055 {
00056     d->engine=parentEngine;
00057     if(d->engine)
00058         d->p_smsList=new SMSList(d->engine->objectName() );
00059     d->p_addresseeList = new ContactsList();
00060     d->p_calendar=new KCal::Event::List();
00061 
00062     connect( d->p_smsList, SIGNAL( added( const QString & ) ), SIGNAL( smsAdded( const QString & ) ) );
00063     connect( d->p_smsList, SIGNAL( removed( const QString & ) ), SIGNAL( smsDeleted( const QString & ) ) ); 
00064     connect( d->p_smsList, SIGNAL( modified( const QString & ) ), SIGNAL( smsModified( const QString & ) ) );
00065 
00066 }
00067 
00068 EngineData::~EngineData()
00069 {
00070     delete d->p_smsList;
00071     delete d->p_calendar;
00072     delete d->p_addresseeList;
00073     delete d;
00074 }
00075 
00076 //KMobileTools::Engine *EngineData::engine() { return d->engine; }
00077 
00078 #include "enginedata.moc"
00079 
00080 QString EngineData::manufacturer() const {
00081     return d->s_manufacturer;
00082 }
00083 
00084 void EngineData::setManufacturer( const QString &s ) {
00085     d->s_manufacturer=s;
00086 }
00087 
00088 void EngineData::setManufacturerID( int i ) {
00089     d->i_manufacturer=i;
00090 }
00091 
00092 int EngineData::manufacturerID() const {
00093     return d->i_manufacturer;
00094 }
00095 
00096 void EngineData::setModel( const QString &s ) {
00097     d->s_model=s;
00098 }
00099 
00100 QString EngineData::model() const {
00101     return d->s_model;
00102 }
00103 
00104 void EngineData::setIMEI( const QString &s ) {
00105     d->s_imei=s;
00106 }
00107 
00108 QString EngineData::imei() const {
00109     return d->s_imei;
00110 }
00111 
00112 void EngineData::setSMSCenter( const QString &s ){
00113     d->s_smscenter=s;
00114 }
00115 
00116 QString EngineData::smsCenter() const {
00117     return d->s_smscenter;
00118 }
00119 
00120 void EngineData::setRevision( const QString &s ) {
00121     d->s_revision=s;
00122 }
00123 
00124 QString EngineData::revision() const {
00125     return d->s_revision;
00126 }
00127 
00128 void EngineData::setCalendar( KCal::Event::List* calendar ) {
00129     d->p_calendar = calendar;
00130     emit calendarChanged();
00131 }
00132 
00133 const KCal::Event::List *EngineData::calendar() {
00134     return d->p_calendar;
00135 }
00136 
00137 const SMSList* EngineData::smsList() const {
00138     return d->p_smsList;
00139 }
00140 
00141 void EngineData::setSMSList( SMSList *smsList ) {
00142     d->p_smsList->sync( smsList );
00143 }
00144 
00145 ContactsList *EngineData::contactsList() const { return d->p_addresseeList; }
00146 
00147 void EngineData::setContactsList( ContactsList* cl ) {
00148     d->p_addresseeList=cl;
00149     emit phoneBookChanged();
00150 }
00151 
00152 void EngineData::setPhoneConnected( bool b ) {
00153     // did the connection state change?
00154     if( d->b_connected != b ) {
00155         if( b )
00156             emit connected();
00157         else
00158             emit disconnected();
00159     }
00160 
00161     d->b_connected=b;
00162 }
00163 bool EngineData::phoneConnected() const {
00164     return d->b_connected;
00165 }
00166 
00167 int EngineData::signalStrength() const {
00168     return d->i_signalStrength;
00169 }
00170 
00171 void EngineData::setSignalStrength( int signalStrength ) {
00172     if( signalStrength != d->i_signalStrength )
00173         emit signalStrengthChanged( signalStrength );
00174 
00175     d->i_signalStrength = signalStrength;
00176 }
00177 
00178 int EngineData::charge() const {
00179     return d->i_charge;
00180 }
00181 
00182 void EngineData::setCharge( int charge ) {
00183     if( charge != d->i_charge )
00184         emit chargeChanged( charge );
00185 
00186     d->i_charge = charge;
00187 }
00188 
00189 int EngineData::chargeType() const {
00190     return d->m_chargeType;
00191 }
00192 
00193 void EngineData::setChargeType( ChargeType chargeType ) {
00194     if( chargeType != d->m_chargeType )
00195         emit chargeTypeChanged( chargeType );
00196 
00197     d->m_chargeType = chargeType;
00198 }
00199 
00200 bool EngineData::phoneRinging() const {
00201     return d->b_ringing;
00202 }
00203 
00204 void EngineData::setPhoneRinging( bool ringing ) {
00205     if( ringing != d->b_ringing )
00206         emit EngineData::ringing( ringing );
00207 
00208     d->b_ringing = ringing;
00209 }
00210 
00211 QString EngineData::networkName() const {
00212     return d->s_networkName;
00213 }
00214 
00215 void EngineData::setNetworkName( const QString& networkName ) {
00216     if( networkName != d->s_networkName )
00217         emit networkNameChanged( networkName );
00218 
00219     d->s_networkName = networkName;
00220 }

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
  • 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