kandy

mobilegui.h
1/*
2 This file is part of Kandy.
3
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
20 As a special exception, permission is given to link this program
21 with any edition of TQt, and distribute the resulting executable,
22 without including the source code for TQt in the source distribution.
23*/
24#ifndef MOBILEGUI_H
25#define MOBILEGUI_H
26
27#include <kandyiface.h>
28
29#include "mobilegui_base.h"
30#include "kandyprefs.h"
31#include "tqvaluevector.h"
32
33
34class CommandScheduler;
35class ATCommand;
36class AddressSyncer;
37
38
39class MobileGui : public MobileGui_base, virtual public KandyIface
40{
41 TQ_OBJECT
42
43
44 public:
45 MobileGui( CommandScheduler *, KandyPrefs *kprefs, TQWidget* parent=0,
46 const char* name=0, WFlags fl=0 );
47 ~MobileGui();
48
49 void exit();
50
51 signals:
52 void sendCommand( const TQString & );
53 void phonebookRead();
54
55 void statusMessage( const TQString & );
56 void transienStatusMessage( const TQString & );
57 void connectModem();
58 void disconnectModem();
59
60 public slots:
61 void readModelInformation();
62 void readPhonebook();
63 void savePhonebook();
64 void refreshStatus();
65 void writePhonebook();
66 void readKabc();
67 void writeKabc();
68 void setClock();
69 void mergePhonebooks();
70 void syncPhonebooks();
71 void termAddOutput( const char *line );
72 void toggleConnection();
73 void deleteMobPhonebook();
74
75 protected slots:
76 void processResult( ATCommand * );
77
78 private:
79 /* Links to related classes */
80 CommandScheduler *mScheduler;
81 AddressSyncer *mSyncer;
82 KandyPrefs *mPrefs;
83 TQWidget *mparent;
84
85 /* String Formatting Routines */
86 TQString quote( const TQString & );
87 TQString dequote( const TQString & );
88 void formatPBName( TQString *, TQString );
89 TQString noSpaces( const TQString & );
90 int firstFreeIndex();
91 TQString string2GSM( const TQString & );
92 TQString GSM2String( const TQString & );
93 TQString decodeSuffix( const TQString & );
94 TQString stripWhiteSpaces( const TQString & );
95
96 /* Routines for GUI updates */
97 void updateKabBook();
98 void updateMobileBook();
99 void disconnectGUI();
100
101 /* Phone specific items */
102 TQString mMobManufacturer;
103 TQString mMobModel;
104 unsigned int mPBStartIndex;
105 unsigned int mPBLength;
106 unsigned int mPBNameLength;
107 TQValueVector<bool> mPBIndexOccupied;
108 bool mMobHasFD;
109 bool mMobHasLD;
110 bool mMobHasME;
111 bool mMobHasMT;
112 bool mMobHasTA;
113 bool mMobHasOW;
114 bool mMobHasMC;
115 bool mMobHasRC;
116
117 /* Routines and Flags for asynchronous control flow */
118 TQString mLastWriteId;
119 bool mComingFromToggleConnection;
120 bool mComingFromReadPhonebook;
121 bool mComingFromSyncPhonebooks;
122 bool mComingFromExit;
123 void writePhonebookPostProcessing();
124
125 /* Routines and elements for current state of phone books */
126 enum ABState { UNLOADED, LOADED, MODIFIED };
127 ABState mKabState, mMobState;
128 void setKabState( ABState );
129 void warnKabState( ABState );
130 void setMobState( ABState );
131 bool warnMobState( ABState );
132
133 /* Misc */
134 void fillPhonebook( ATCommand * );
135};
136
137#endif // MOBILEGUI_H
This class provides an abstraction of an AT command.
Definition: atcommand.h:54