00001 
00002 
00003 
00004 
00005 
00006 #ifndef __TXUT_H__
00007 #define __TXUT_H__
00008 
00009 #include <e32std.h>
00010 #include <msvapi.h>             
00011 
00012 
00013 
00014 LOCAL_D const TInt KUidMsgTypeTextValue = 0x10005247; 
00015 LOCAL_D const TUid KUidMsgTypeText = { KUidMsgTypeTextValue};
00016 LOCAL_D const TUid KTxtMtmTechnologyTypeUid     = {KUidMsgTypeTextValue };
00017 
00018 LOCAL_D const TUid KUidMsvMtmTextServerDLL      ={0x101FDA9C};
00019 LOCAL_D const TUid KUidMsvMtmTextClientDLL      ={0x101FDA9B};
00020 LOCAL_D const TUid KUidMsvMtmTextUiDLL          ={0x101FDA9D};
00021 LOCAL_D const TUid KUidMsvMtmTextUiDataDLL      ={0x101FDA9E};
00022 LOCAL_D const TUid KUidTextMtmVersion1          ={ KUidMsgTypeTextValue};
00023 
00024 
00025 LOCAL_D const TInt KUidTxtMTMSettingsValue = 0x1000525A; 
00026 LOCAL_D const TUid KUidTxtMTMSettings={KUidTxtMTMSettingsValue};
00027 LOCAL_D const TInt KMaxTextMessageSize = 0xFFFF;
00028 
00029 
00030 
00031 
00032 
00033 class TTxtProgress 
00034         {
00035 public:
00036         TInt            iTotalMsgs;
00037         TInt            iMsgsProcessed;
00038         TInt            iErrorCode;     
00039         TMsvId          iNewId;         
00040         };
00041 
00042 
00043 
00044 
00045 typedef TPckgBuf<TTxtProgress> TTxtProgressBuf;
00046 
00047 
00048 
00049 
00050 class TxtUtils
00051         {
00052 public: 
00053         
00054         IMPORT_C static void GetEntryFileNameL(TFileName& aFileName, TMsvEntry& aEntry);
00055     
00056     IMPORT_C static void FindFileL(const TDesC& aFileName, const TDesC& aLocation, TFileName& aRetVal);
00057         };
00058 
00059 
00060 
00061 
00062 
00063 class TMTMTxtSettings 
00064         {
00065 public:
00066         IMPORT_C void StoreL(CMsvStore& aMsvStore) const;
00067         IMPORT_C void RestoreL(const CMsvStore& aMessageStore );
00068         IMPORT_C void ExternalizeL( RMsvWriteStream& aWriteStream ) const;
00069         IMPORT_C void InternalizeL( RMsvReadStream& aReadStream );
00070 
00071 public:
00072         TPtrC RootFolder() const;
00073         void SetRootFolder(const TDesC& aRootFolder);
00074 
00075 private:
00076         TFileName iRootFolder;
00077  
00078 
00079         };
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087 class CMsvOpWait: public CActive
00088         {
00089 public:
00090         IMPORT_C static CMsvOpWait* NewLC(TInt aPriority=EPriorityStandard);
00091         IMPORT_C ~CMsvOpWait();
00092         IMPORT_C void Start();
00093 
00094 protected:
00095         CMsvOpWait(TInt aPriority);
00096 
00097 protected:
00098     
00099         virtual void RunL();
00100         virtual void DoCancel();
00101         };
00102 
00103 
00104 
00105 
00106 
00107 
00108 class CMsvCompOperation : public CMsvOperation
00109         {
00110 public:
00111         IMPORT_C static CMsvCompOperation* NewL(CMsvSession& aMsvSession, TUid aMtm, const TDesC8& aProgress, TMsvId aService, TRequestStatus& aObserverRequestStatus, TInt aErr=KErrNone);
00112         IMPORT_C ~CMsvCompOperation();
00113 
00114 public:
00115     
00116         virtual const TDesC8& ProgressL();
00117 
00118 private:
00119         CMsvCompOperation(CMsvSession& aSession, TRequestStatus& aObserverRequestStatus);
00120         void ConstructL(TUid aMtm, TInt aError, const TDesC8& aProgress, TMsvId aService);
00121 
00122 private:
00123         
00124         virtual void DoCancel();
00125         virtual void RunL();
00126 
00127 private:
00128         HBufC8* iProgress;
00129         };
00130 
00131 
00132 
00133 
00134 
00135 inline void TMTMTxtSettings::SetRootFolder(const TDesC& aRootFolder) 
00136         {
00137         iRootFolder = aRootFolder;
00138         }
00139 
00140 inline TPtrC TMTMTxtSettings::RootFolder() const 
00141         { 
00142         return iRootFolder; 
00143         }
00144 
00145 class CRepository;
00146 
00151 class CMTMTxtSettings: public CBase
00152         {
00153 public:
00154         IMPORT_C static CMTMTxtSettings* NewL();
00155         ~CMTMTxtSettings();
00156         
00157         IMPORT_C void LoadSettingsL(TMsvId aServiceId, TMTMTxtSettings& aSettings) const;
00158         IMPORT_C void SaveSettingsL(TMsvId aServiceId, const TMTMTxtSettings& aSettings);
00159         IMPORT_C void DeleteSettingsL(TMsvId aServiceId);
00160         
00161         IMPORT_C TMsvId DefaultServiceL() const;
00162         IMPORT_C void SetDefaultServiceL(TMsvId aService);
00163         IMPORT_C void DeleteDefaultServiceSettingL();
00164         
00165 private:
00166         void ConstructL();      
00167         void CreateOrSetL(TUint aKey, const TDesC& aValue);
00168         void CreateOrSetL(TUint aKey, TInt aValue);
00169         TUint32 FindAccountL(TMsvId aService) const;
00170         TUint GetNextAccountSlotL();
00171         void DeleteSettingL(TUint32 settingId);
00172         
00173 private:
00174         CRepository* iRepository;
00175         };
00176 #endif // __TXUT_H__
00177