diff -r f345bda72bc4 -r 43e37759235e Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/txtmtmeditorop_8cpp_source.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/txtmtmeditorop_8cpp_source.html Tue Mar 30 16:16:55 2010 +0100 @@ -0,0 +1,199 @@ + + + + +TB9.2 Example Applications: examples/ForumNokia/S60_3rd_Edition_TextMTM_Example/modules/UI/src/txtmtmeditorop.cpp Source File + + + + + +

examples/ForumNokia/S60_3rd_Edition_TextMTM_Example/modules/UI/src/txtmtmeditorop.cpp

00001 //
+00002 // © 2004 Nokia Corporation.  All rights reserved.
+00003 //
+00004 
+00005 // class include
+00006 #include "txtmtmeditorop.h"
+00007 
+00008 //system include
+00009 #include <aknquerydialog.h> // CAknTextQueryDialog
+00010 #include <apparc.h>    // CApaApplication
+00011 #include <msvids.h>    // KMsvLocalServiceIndexEntryId
+00012 #include <msvuids.h>   // KUidMsvMessageEntry
+00013 #include <eikenv.h>
+00014 #include <coemain.h>
+00015 #include <eikproc.h>
+00016 #include <eikdoc.h>
+00017 #include <apacln.h>
+00018 #include <s32mem.h>
+00019 #include "txtviewerservice.h"
+00020 #include <apgcli.h>
+00021 // user include
+00022 #include "txtupan.h"
+00023 #include <aknnotewrappers.h>
+00024 #include "txtu.h"
+00025 
+00026 #include "txtcmds.hrh"
+00027 // constants
+00028 const TInt KTxtMtmEditorOpBufStoreSize = 127;
+00029 
+00030 
+00031 CTxtMtmEditorOperation* CTxtMtmEditorOperation::NewL(const TMsvId& aId, TOpenMode aMode, CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus, CTextMtmUi& aMtmUi)
+00032     {
+00033     CTxtMtmEditorOperation* self = new (ELeave) CTxtMtmEditorOperation(aId, aMode, aMsvSession, aObserverRequestStatus, aMtmUi);
+00034     CleanupStack::PushL(self);
+00035     self->ConstructL();
+00036     CleanupStack::Pop(self);
+00037     return self;
+00038     }
+00039 
+00040 
+00041 CTxtMtmEditorOperation::CTxtMtmEditorOperation(const TMsvId& aId, TOpenMode aMode, CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus,CTextMtmUi& aMtmUi)
+00042  : CMsvOperation(aMsvSession, EPriorityStandard, aObserverRequestStatus),iId(aId),iMode(aMode), iMtmUi(aMtmUi)
+00043     {
+00044     CActiveScheduler::Add(this);
+00045     }
+00046 
+00047 
+00048 void CTxtMtmEditorOperation::ConstructL()
+00049     {
+00050         // Use RLibrary object to get hands on the DLL
+00051     RLibrary library;
+00052 
+00053     _LIT(KDllName,"txtu.DLL");
+00054  
+00055     // Dynamically load DLL
+00056     User::LeaveIfError(library.Load(KDllName));
+00057 
+00058         // Make the handle process wide to avoid Cone 36 in debug builds
+00059     RLibrary dup = library;
+00060         
+00061         TInt err;
+00062         
+00063     err=library.Duplicate(RThread());
+00064         
+00065         if (err==KErrNone)
+00066         {
+00067         dup.Close(); 
+00068         }
+00069 
+00070         //Set the observer to pending state
+00071     iObserverRequestStatus = KRequestPending;
+00072     
+00073     //Set us to pending state
+00074     iStatus = KRequestPending;
+00075 
+00076         //Set us active
+00077     SetActive();
+00078 
+00079         //Launch the editor
+00080     LaunchEditorL();
+00081     }
+00082 
+00083 
+00084 CTxtMtmEditorOperation::~CTxtMtmEditorOperation()
+00085     {
+00086     Cancel();
+00087     }
+00088 
+00089 
+00090 const TDesC8& CTxtMtmEditorOperation::ProgressL()
+00091     {
+00092     iProgressBuf() = iProgress;
+00093     return iProgressBuf;
+00094     }
+00095 
+00096 
+00097 const TDesC8& CTxtMtmEditorOperation::FinalProgress()
+00098     {
+00099     __ASSERT_ALWAYS(!IsActive(), User::Panic(KTEXTMTMUIPanic, ETextMtmUiOperationActive));
+00100     iProgressBuf() = iProgress;
+00101     return iProgressBuf;
+00102     }
+00103 
+00104 
+00105 TInt CTxtMtmEditorOperation::RunError(TInt aError)
+00106     {  
+00107         // Complete the requesting active object
+00108     iProgress.iError = aError;
+00109     TRequestStatus* stat = &iObserverRequestStatus;
+00110     User::RequestComplete(stat, aError);
+00111     return KErrNone;
+00112     }
+00113 
+00114 
+00115 void CTxtMtmEditorOperation::DoCancel()
+00116     {
+00117     delete iMonitor;
+00118 
+00119     iService.Close();
+00120     
+00121         // Complete in order to continue Cancel's WaitForRequest
+00122     TRequestStatus* stat1 = &iStatus;
+00123     User::RequestComplete(stat1, KErrCancel);
+00124 
+00125         // Complete observer
+00126     TRequestStatus* stat2 = &iObserverRequestStatus;
+00127     User::RequestComplete(stat2, KErrCancel);
+00128     }
+00129 
+00130 
+00131 void CTxtMtmEditorOperation::RunL()
+00132     {
+00133     User::LeaveIfError(iStatus.Int());
+00134 
+00135     switch(iProgress.iState)
+00136         {
+00137         case TTxtMtmEditorOpProgress::EEditorLaunched:
+00138             iProgress.iState = TTxtMtmEditorOpProgress::EEditorLaunched;
+00139                         TRequestStatus* stat = &iObserverRequestStatus;
+00140                 User::RequestComplete(stat, iStatus.Int());
+00141             break;            
+00142         default:
+00143             break;
+00144         }
+00145     }
+00146 
+00147 
+00148 void CTxtMtmEditorOperation::HandleServerAppExit( TInt aReason )
+00149         {
+00150         TRequestStatus* stat = &iStatus;
+00151     User::RequestComplete(stat, KErrNone);
+00152 
+00153         MAknServerAppExitObserver::HandleServerAppExit( aReason );      
+00154         
+00155         delete iMonitor;
+00156         iService.Close();
+00157         }
+00158 
+00159 
+00160 void CTxtMtmEditorOperation::LaunchEditorL()
+00161     {
+00162         TEditorParameters aParams;
+00163     
+00164     aParams.iEntry = iId;
+00165                 
+00166         if (iMode==EEdit) aParams.iOpenedForEditing=ETrue;
+00167                 else aParams.iOpenedForEditing=EFalse;
+00168         
+00169         TUid uid = TUid::Uid(0xA00058BD);
+00170                 
+00171     iService.ConnectChainedAppL( uid );
+00172         
+00173         iMonitor = CApaServerAppExitMonitor::NewL(
+00174             iService,
+00175             *this,
+00176             CActive::EPriorityStandard);
+00177 
+00178         iProgress.iState=TTxtMtmEditorOpProgress::EEditorLaunched;     
+00179 
+00180     iService.OpenL( aParams);
+00181     }
+00182     
+00183         
+
+
Generated by  + +doxygen 1.6.2
+ +