kandy

mobilegui.h

00001 /*
00002     This file is part of Kandy.
00003 
00004     Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
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     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019 
00020     As a special exception, permission is given to link this program
00021     with any edition of Qt, and distribute the resulting executable,
00022     without including the source code for Qt in the source distribution.
00023 */
00024 #ifndef MOBILEGUI_H
00025 #define MOBILEGUI_H
00026 
00027 #include <kandyiface.h>
00028 
00029 #include "mobilegui_base.h"
00030 #include "kandyprefs.h"
00031 #include "qvaluevector.h"
00032 
00033 
00034 class CommandScheduler;
00035 class ATCommand;
00036 class AddressSyncer;
00037 
00038 
00039 class MobileGui : public MobileGui_base, virtual public KandyIface
00040 { 
00041   Q_OBJECT
00042 
00043   public:
00044     MobileGui( CommandScheduler *, KandyPrefs *kprefs, QWidget* parent=0,
00045                const char* name=0, WFlags fl=0 );
00046     ~MobileGui();
00047 
00048     void exit();
00049 
00050   signals:
00051     void sendCommand( const QString & );
00052     void phonebookRead();
00053 
00054     void statusMessage( const QString & );
00055     void transientStatusMessage( const QString & );
00056     void connectModem();
00057     void disconnectModem();
00058 
00059   public slots:
00060     void readModelInformation();
00061     void readPhonebook();
00062     void savePhonebook();
00063     void refreshStatus();
00064     void writePhonebook();
00065     void readKabc();
00066     void writeKabc();
00067     void setClock();
00068     void mergePhonebooks();
00069     void syncPhonebooks();
00070     void termAddOutput( const char *line );
00071     void toggleConnection();
00072     void deleteMobPhonebook();
00073 
00074   protected slots:
00075     void processResult( ATCommand * );
00076 
00077   private:
00078     /* Links to related classes */
00079     CommandScheduler *mScheduler;
00080     AddressSyncer *mSyncer;
00081     KandyPrefs *mPrefs;
00082     QWidget *mparent;
00083     
00084     /* String Formatting Routines */
00085     QString quote( const QString & );
00086     QString dequote( const QString & );
00087     void formatPBName( QString *, QString );
00088     QString noSpaces( const QString & );
00089     int firstFreeIndex();
00090     QString string2GSM( const QString & );
00091     QString GSM2String( const QString & );
00092     QString decodeSuffix( const QString & );
00093     QString stripWhiteSpaces( const QString & );
00094 
00095     /* Routines for GUI updates  */
00096     void updateKabBook();
00097     void updateMobileBook();
00098     void disconnectGUI();
00099     
00100     /* Phone specific items */
00101     QString mMobManufacturer;
00102     QString mMobModel;
00103     unsigned int mPBStartIndex;
00104     unsigned int mPBLength;
00105     unsigned int mPBNameLength;
00106     QValueVector<bool> mPBIndexOccupied;
00107     bool mMobHasFD;
00108     bool mMobHasLD;
00109     bool mMobHasME;
00110     bool mMobHasMT;
00111     bool mMobHasTA;
00112     bool mMobHasOW;
00113     bool mMobHasMC;
00114     bool mMobHasRC;
00115 
00116     /* Routines and Flags for asynchronous control flow */
00117     QString mLastWriteId;
00118     bool mComingFromToggleConnection;
00119     bool mComingFromReadPhonebook;
00120     bool mComingFromSyncPhonebooks;
00121     bool mComingFromExit;
00122     void writePhonebookPostProcessing();
00123 
00124     /* Routines and elements for current state of phone books */
00125     enum ABState { UNLOADED, LOADED, MODIFIED };
00126     ABState mKabState, mMobState;
00127     void setKabState( ABState );
00128     void warnKabState( ABState );
00129     void setMobState( ABState );
00130     bool warnMobState( ABState );
00131 
00132     /* Misc */
00133     void fillPhonebook( ATCommand * );
00134 };
00135 
00136 #endif // MOBILEGUI_H
KDE Home | KDE Accessibility Home | Description of Access Keys