00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #if !defined(__E32BASE_H__)
00018 #include <e32base.h>
00019 #endif
00020 #if !defined(__E32CONS_H__)
00021 #include <e32cons.h>
00022 #endif
00023 #if !defined(__MSVAPI_H__)
00024 #include <msvapi.h>
00025 #endif
00026
00027 LOCAL_D CConsoleBase* console;
00028 LOCAL_C void consoleUIInstallL();
00029 LOCAL_C void DoInstallL();
00030
00031
00032 #ifdef __WINS__
00033 _LIT(KMTMDataFullName,"z:\\Resource\\messaging\\mtm\\txtmtm.RSC");
00034 #else
00035 _LIT(KMTMDataFullName,"Z:\\Resource\\messaging\\mtm\\txtmtm.RSC");
00036 #endif
00037
00038
00039 _LIT(KTxtPressAnyKey," [press any key to exit]");
00040
00041
00042 class TDummyObserver : public MMsvSessionObserver
00043 {
00044 public:
00045 void HandleSessionEventL(TMsvSessionEvent , TAny* , TAny* , TAny* ) {};
00046 };
00047
00048 LOCAL_C void DoInstallL()
00049
00050 {
00051 TDummyObserver ob;
00052 CMsvSession* session = CMsvSession::OpenSyncL(ob);
00053 CleanupStack::PushL(session);
00054 TInt err=session->DeInstallMtmGroup(KMTMDataFullName);
00055 if (err!=KErrNone && err!=KErrNotFound)
00056 User::LeaveIfError(err);
00057 User::LeaveIfError(session->InstallMtmGroup(KMTMDataFullName));
00058
00059 CleanupStack::PopAndDestroy();
00060 }
00061
00062 LOCAL_C void consoleUIInstallL()
00063
00064 {
00065 _LIT(KTxtTitle,"TextMTM installed");
00066 _LIT(KFormatFailed,"failed: leave code=%d");
00067
00068
00069 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
00070 CleanupStack::PushL(scheduler);
00071 CActiveScheduler::Install(scheduler);
00072
00073 console=Console::NewL(KTxtTitle,TSize(KConsFullScreen,KConsFullScreen));
00074 CleanupStack::PushL(console);
00075
00076
00077 TRAPD(error,DoInstallL());
00078 if (error)
00079 console->Printf(KFormatFailed, error);
00080 else
00081 console->Printf(KTxtTitle);
00082 console->Printf(KTxtPressAnyKey);
00083 console->Getch();
00084 CleanupStack::PopAndDestroy(2);
00085
00086
00087 }
00088
00089 GLDEF_C TInt E32Main()
00090 {
00091 __UHEAP_MARK;
00092 CTrapCleanup* cleanup=CTrapCleanup::New();
00093 TRAPD(error,consoleUIInstallL());
00094 delete cleanup;
00095 __UHEAP_MARKEND;
00096 return error;
00097 }