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

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

00001 // TXTU.CPP
+00002 //
+00003 // © 2004 Nokia Corporation.  All rights reserved.
+00004 
+00005 // class includes
+00006 #include "txtu.h"
+00007 
+00008 // system includes
+00009 #include <aknquerydialog.h> // CAknTextQueryDialog
+00010 #include <aknglobalnote.h>  // CAknInformationNote
+00011 #include <aknnotewrappers.h>
+00012 #include <apffndr.h>        // CApaScanningAppFinder
+00013 #include <bautils.h>
+00014 #include <eikdialg.h>
+00015 #include <eikenv.h>         // CEikonEnv
+00016 #include <eikon.hrh>        // EEikBidCancel, EEikBidTab
+00017 #include <eikon.rsg>
+00018 #include <eikrted.h>        // CEikRichTextEditor
+00019 #include <msvids.h>         // messaging
+00020 #include <msvuids.h>        // messaging
+00021 #include <stringloader.h>   // StringLoader
+00022 #include <txtrich.h>        // CRichText
+00023 #include <mncnnotification.h> 
+00024 
+00025 #include <txtu.rsg>
+00026 #include "../../Client/inc/TXCLIENT.H"
+00027 #include "TXTU.HRH"
+00028 
+00029 // User includes
+00030 #include "txtcmds.hrh"    //commands accepted by the server side mtms
+00031 #include "txtmtmcreateop.h" // CTxtMtmCreateOperation
+00032 #include "txtmtmeditop.h"   // CTxtMtmEditRemoteOperation
+00033 #include "txtmtmeditorop.h"
+00034 #include "txtucmds.hrh"
+00035 #include "txtupan.h"
+00036 #include "txtu.hrh"
+00037 
+00038  
+00039 #include <aknnotewrappers.h>
+00040 
+00041 
+00042 // Constants
+00043 const TInt KPriorityLessThanStandard =  CActive::EPriorityStandard-1;
+00044 _LIT(KTxtuMtmUiResourceFile,"txtu.rsc");
+00045 _LIT(KTxtuMtmUiResourcePath, "\\resource\\messaging\\");
+00046 _LIT(KTextMTMMsgPath, "C:\\data\\TextMTMService\\");
+00047 _LIT(KTextMtmCPrompt, "C:\\");
+00048 _LIT(KTextMtmName, "TextMTM name");
+00049 _LIT(KOnlyOneTextMtmAllowed, "Only one TextMTM is allowed.");
+00050 
+00051 //
+00052 // CTextMtmUi: User Interface MTM
+00053 //
+00054 
+00055 
+00056 // ----------------------------------------------------------------------------
+00057 //
+00058 //      Construction and destruction
+00059 //
+00060 // ----------------------------------------------------------------------------
+00061 
+00062 
+00063 // ----------------------------------------------------------------------------
+00064 CTextMtmUi* CTextMtmUi::NewL(CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll)
+00065         {
+00066 
+00067         CTextMtmUi* self=new(ELeave) CTextMtmUi(aBaseMtm, aRegisteredMtmDll);
+00068         CleanupStack::PushL(self);
+00069         self->TxtConstructL();
+00070         CleanupStack::Pop();
+00071         return self;
+00072         }
+00073 
+00074 
+00075 // ----------------------------------------------------------------------------
+00076 CTextMtmUi::CTextMtmUi(CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll)
+00077         :       CBaseMtmUi(aBaseMtm, aRegisteredMtmDll)
+00078         {
+00079         }
+00080 
+00081 
+00082 // ----------------------------------------------------------------------------
+00083 CTextMtmUi::~CTextMtmUi()
+00084         {
+00085     // remove the resource file we added to the CCoeEnv
+00086         iCoeEnv->DeleteResourceFile(iNewResourceFileOffset);
+00087     delete iResourceFileName;
+00088         }
+00089 
+00090 
+00091 // ----------------------------------------------------------------------------
+00092 void CTextMtmUi::TxtConstructL()
+00093         {
+00094         
+00095 
+00096         
+00097         // Get resource file name
+00098         TFileName resourceFileName;
+00099     TxtUtils::FindFileL(KTxtuMtmUiResourceFile, KTxtuMtmUiResourcePath, resourceFileName);
+00100     iResourceFileName = resourceFileName.AllocL();
+00101 
+00102         // Now try to find a resource file that matches the particular locale, if one
+00103     // exists and the locale has been set
+00104         BaflUtils::NearestLanguageFile(iCoeEnv->FsSession(), resourceFileName);
+00105 
+00106         // Add the resource file to the CCoeEnv
+00107     TRAPD(ret, iNewResourceFileOffset=iCoeEnv->AddResourceFileL(resourceFileName));
+00108 
+00109         if (ret != KErrExtended)        // This leave code means that the resource file is being used by 2 DLLs in the same process
+00110         
+00111                 User::LeaveIfError(ret);
+00112         
+00113         
+00114         CBaseMtmUi::ConstructL();
+00115         }
+00116 
+00117 
+00118 // ----------------------------------------------------------------------------
+00119 CMsvOperation* CTextMtmUi::CancelL(TRequestStatus& /*aStatus*/, const CMsvEntrySelection& /*aSelection*/)
+00120         {
+00121         User::Leave(KErrNotSupported); // no cancelling
+00122         return NULL;
+00123         }
+00124 
+00125 
+00126 // ----------------------------------------------------------------------------
+00127 // Resource file loading
+00128 //
+00129 void CTextMtmUi::GetResourceFileName(TFileName& aFileName) const
+00130         {
+00131         aFileName= *iResourceFileName;
+00132         }
+00133 
+00134 // ----------------------------------------------------------------------------
+00135 //
+00136 //      Entry manipulation
+00137 //
+00138 // ----------------------------------------------------------------------------
+00139 
+00140 
+00141 // ----------------------------------------------------------------------------
+00142 // Open
+00143 //
+00144 CMsvOperation* CTextMtmUi::OpenL(TRequestStatus& aStatus)
+00145         {
+00146         __ASSERT_DEBUG(iBaseMtm.Entry().Entry().iType==KUidMsvMessageEntry, Panic(ETextMtmUiOnlyWorksWithMessageEntries));
+00147         TMsvId parent = iBaseMtm.Entry().Entry().Parent();
+00148         iServiceId = iBaseMtm.Entry().Entry().iServiceId;       
+00149         // We allow only the ones in drafts to be edited
+00150         if (parent==KMsvDraftEntryIdValue)      
+00151                 return EditL(aStatus);
+00152         else return ViewL(aStatus);
+00153         }
+00154 
+00155 
+00156 // ----------------------------------------------------------------------------
+00157 // Open selection
+00158 //
+00159 CMsvOperation* CTextMtmUi::OpenL(TRequestStatus& aStatus, const CMsvEntrySelection& aSelection)
+00160         {
+00161         __ASSERT_DEBUG(aSelection.Count(), Panic(ETextMtmUiEmptySelection));
+00162         iBaseMtm.SwitchCurrentEntryL(aSelection.At(0));
+00163         return OpenL(aStatus);
+00164         }
+00165 
+00166 
+00167 // ----------------------------------------------------------------------------
+00168 // Close
+00169 //
+00170 CMsvOperation* CTextMtmUi::CloseL(TRequestStatus& aStatus)
+00171         {
+00172         __ASSERT_DEBUG(iBaseMtm.Entry().Entry().iType==KUidMsvMessageEntry, Panic(ETextMtmUiOnlyWorksWithMessageEntries));
+00173 
+00174         // Nothing to do for this MTM
+00175         TPckgBuf<TMsvLocalOperationProgress> progress;
+00176         SetProgressSuccess(progress,iBaseMtm.Entry().Entry().Id());
+00177 
+00178         CMsvCompletedOperation* op=CMsvCompletedOperation::NewL(Session(), Type(),
+00179                 progress, KMsvLocalServiceIndexEntryId,aStatus);
+00180         return op;
+00181         }
+00182 
+00183 
+00184 // ----------------------------------------------------------------------------
+00185 // Close selection
+00186 //
+00187 CMsvOperation* CTextMtmUi::CloseL(TRequestStatus& aStatus, const CMsvEntrySelection& aSelection)
+00188         {
+00189         __ASSERT_DEBUG(aSelection.Count(), Panic(ETextMtmUiEmptySelection));
+00190         iBaseMtm.SwitchCurrentEntryL(aSelection.At(0));
+00191         return CloseL(aStatus);
+00192         }
+00193 
+00194 
+00195 // ----------------------------------------------------------------------------
+00196 CMsvOperation* CTextMtmUi::CreateL(const TMsvEntry& aEntry, CMsvEntry& aParent, TRequestStatus& aStatus)
+00197         {
+00198         
+00199         if ( aEntry.iType == KUidMsvMessageEntry )
+00200         {
+00201         CTextMtmClient* client = static_cast<CTextMtmClient*>(&iBaseMtm);
+00202         TRAPD( error, client->DefaultServiceL();)
+00203                 // We won't allow to create a message entry if there is no default service 
+00204         // (i.e. service has not yet been created).
+00205         if (error == KErrNotFound)
+00206                 {
+00207                 CAknQueryDialog* dlg = CAknQueryDialog::NewL();
+00208                 dlg->ExecuteLD(R_CONF_QUERY_OK_EMPTY);
+00209                 TPckgBuf<TMsvLocalOperationProgress> progress;
+00210                 SetProgressSuccess(progress, iBaseMtm.Entry().Entry().Id());
+00211                 return CMsvCompOperation::NewL(Session(), Type(), progress, 
+00212                                 iServiceId, aStatus);
+00213                 }
+00214 
+00215         }
+00216         else
+00217             {
+00218                 CTextMtmClient* client = static_cast<CTextMtmClient*>(&iBaseMtm);
+00219 
+00220                 // Set default service 
+00221                 client->ChangeDefaultServiceL(iBaseMtm.Entry().Entry().iServiceId);
+00222                         
+00223                 
+00224             }
+00225             
+00226     return CTxtMtmCreateOperation::NewL(aEntry, aParent, Session(), *this, aStatus);
+00227         
+00228         }
+00229 
+00230 
+00231 // ----------------------------------------------------------------------------
+00232 CMsvOperation* CTextMtmUi::EditL(TRequestStatus& aStatus)
+00233 // Edit
+00234         {
+00235         TUid type = iBaseMtm.Entry().Entry().iType;
+00236         iServiceId = iBaseMtm.Entry().Entry().iServiceId;       
+00237         __ASSERT_DEBUG(type==KUidMsvMessageEntry || type==KUidMsvServiceEntry,
+00238                 Panic(ETextMtmUiWrongEntryType));
+00239 
+00240         if ( type == KUidMsvMessageEntry )
+00241                 return MessageEditL(aStatus);
+00242         else
+00243                 return ServiceEditL(aStatus);
+00244         }
+00245 
+00246 
+00247 // ----------------------------------------------------------------------------
+00248 // Message editing
+00249 //
+00250 CMsvOperation* CTextMtmUi::MessageEditL(TRequestStatus& aStatus)
+00251         
+00252         {
+00253         // If the entry is local, then just launch the editor
+00254         // application.
+00255 
+00256         
+00257         if ( iServiceId == KMsvLocalServiceIndexEntryId )
+00258                 {
+00259                 return LaunchEditorApplicationL(aStatus, 
+00260                         iBaseMtm.Entry().Entry().Id(), ETrue);
+00261                 }
+00262 
+00263         
+00264         // Otherwise, we just create a completed operation and
+00265         // return that. Other option here would be to copy a remote
+00266         // entry to local folder and start editing.   
+00267         
+00268 
+00269         CMsvOperation* op=NULL;
+00270 
+00271         TPckgBuf<TMsvLocalOperationProgress> progress;
+00272         SetProgressSuccess(progress, iBaseMtm.Entry().Entry().Id());
+00273         op = CMsvCompOperation::NewL(Session(), Type(), progress, 
+00274                                         iServiceId, aStatus);
+00275                         
+00276         return op;
+00277 
+00278 
+00279         }
+00280 
+00281 
+00282 // ----------------------------------------------------------------------------
+00283 // Service edit
+00284 //
+00285 // We only hit this function when a new service is created
+00286 //
+00287 //
+00288 CMsvOperation* CTextMtmUi::ServiceEditL(TRequestStatus& aStatus)
+00289         {
+00290         
+00291         aStatus = KRequestPending;
+00292 
+00293         CTextMtmClient* client = static_cast<CTextMtmClient*>(&iBaseMtm);
+00294 
+00295         TBuf<30> mtmName = iBaseMtm.Entry().Entry().iDetails;
+00296         CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL(mtmName);
+00297         CleanupStack::PushL(dlg);
+00298         dlg->SetPromptL(KTextMtmName);
+00299         CleanupStack::Pop(dlg);
+00300         if (dlg->ExecuteLD(R_DATAQUERY_DIALOG))
+00301             {
+00302         // Change default service to the service we edit 
+00303         // Implementation will store settings to Central Repository 
+00304         client->ChangeDefaultServiceL(iBaseMtm.Entry().Entry().iServiceId);
+00305         TMsvEntry entry = iBaseMtm.Entry().Entry();
+00306         entry.iDetails.Set(mtmName);
+00307         iBaseMtm.Entry().ChangeL(entry);
+00308             }
+00309 
+00310     // return completed operation
+00311     CMsvOperation* op=NULL;
+00312         TPckgBuf<TMsvLocalOperationProgress> progress;
+00313         SetProgressSuccess(progress, iBaseMtm.Entry().Entry().Id());
+00314         op = CMsvCompOperation::NewL(Session(), Type(), progress, 
+00315                                 iServiceId, aStatus);
+00316         
+00317     return op;
+00318         }
+00319 
+00320 // ----------------------------------------------------------------------------
+00321 // Edit selection
+00322 //
+00323 CMsvOperation* CTextMtmUi::EditL(TRequestStatus& aStatus, const CMsvEntrySelection& aSelection)
+00324         {
+00325         __ASSERT_DEBUG(aSelection.Count(), Panic(ETextMtmUiEmptySelection));
+00326         iBaseMtm.SwitchCurrentEntryL(aSelection.At(0));
+00327         return EditL(aStatus);
+00328         }
+00329 
+00330 
+00331 // ----------------------------------------------------------------------------
+00332 // View
+00333 //
+00334 CMsvOperation* CTextMtmUi::ViewL(TRequestStatus& aStatus)
+00335         {
+00336         __ASSERT_DEBUG(iBaseMtm.Entry().Entry().iType==KUidMsvMessageEntry, Panic(ETextMtmUiOnlyWorksWithMessageEntries));
+00337         //__ASSERT_ALWAYS(iServiceId == KMsvLocalServiceIndexEntryId, Panic( ETextMtmUiNotLocalEntry));
+00338 
+00339     TMsvEntry tEntry = iBaseMtm.Entry().Entry();
+00340 
+00341         // Set the entry status to "read" now that we are about to view it
+00342     if (iServiceId == KMsvLocalServiceIndexEntryId)
+00343         {
+00344         tEntry.SetUnread(EFalse);
+00345         iBaseMtm.Entry().ChangeL(tEntry);                       
+00346         CallNewMessagesL();
+00347         }
+00348     
+00349     return LaunchViewerApplicationL(aStatus, iBaseMtm.Entry().Entry().Id());
+00350 
+00351         }
+00352 
+00353 
+00354 // ----------------------------------------------------------------------------
+00355 // View selection
+00356 //
+00357 CMsvOperation* CTextMtmUi::ViewL(TRequestStatus& aStatus, const CMsvEntrySelection& aSelection)
+00358         {
+00359         __ASSERT_DEBUG(aSelection.Count(), Panic(ETextMtmUiEmptySelection));
+00360         iBaseMtm.SwitchCurrentEntryL(aSelection.At(0));
+00361         return ViewL(aStatus);
+00362         }
+00363 
+00364 
+00365 // ----------------------------------------------------------------------------
+00366 // Deletes selected entries
+00367 //
+00368 CMsvOperation* CTextMtmUi::DeleteFromL(const CMsvEntrySelection& aSelection,
+00369                                                                            TRequestStatus& aStatus)
+00370         {
+00371         __ASSERT_DEBUG(aSelection.Count(), Panic(ETextMtmUiEmptySelection));
+00372 
+00373         ValidateSelectionL(BaseMtm().Entry(),aSelection);
+00374         return BaseMtm().Entry().DeleteL(aSelection, aStatus);
+00375         }
+00376 
+00377 
+00378 // ----------------------------------------------------------------------------
+00379 CMsvOperation* CTextMtmUi::DeleteServiceL(const TMsvEntry& aService, TRequestStatus& aStatus)
+00380         {
+00381         // remove settings from cenrep
+00382         CTextMtmClient& mtm = static_cast<CTextMtmClient&>(BaseMtm());
+00383         mtm.Settings().DeleteSettingsL(aService.Id());
+00384         return CBaseMtmUi::DeleteServiceL(aService, aStatus);
+00385         }
+00386 
+00387 
+00388 // ----------------------------------------------------------------------------
+00389 // Copies entries in selection to the current context
+00390 //
+00391 
+00392 CMsvOperation* CTextMtmUi::CopyToL(const CMsvEntrySelection& aSelection,
+00393                                                                                         TRequestStatus& aStatus)
+00394         {
+00395 
+00396         return DoCopyMoveToL(aSelection, aStatus, ETrue);
+00397         }
+00398 
+00399 
+00400 // ----------------------------------------------------------------------------
+00401 // Moves entries in selection to the current context
+00402 //
+00403 
+00404 CMsvOperation* CTextMtmUi::MoveToL(const CMsvEntrySelection& aSelection,
+00405                                                                                         TRequestStatus& aStatus)
+00406         {
+00407         return DoCopyMoveToL(aSelection, aStatus, EFalse);
+00408         }
+00409 
+00410 
+00411 // ----------------------------------------------------------------------------
+00412 // Copies entries in selection from current context to aTargetId id
+00413 //
+00414 CMsvOperation* CTextMtmUi::CopyFromL(const CMsvEntrySelection& aSelection,
+00415                                                                          TMsvId aTargetId, TRequestStatus& aStatus)
+00416         {
+00417         return DoCopyMoveFromL(aSelection, aTargetId, aStatus, ETrue);
+00418         }
+00419 
+00420 
+00421 // ----------------------------------------------------------------------------
+00422 // Moves entries in selection from current context to aTargetId id
+00423 //
+00424 CMsvOperation* CTextMtmUi::MoveFromL(const CMsvEntrySelection& aSelection,
+00425                                                                          TMsvId aTargetId, TRequestStatus& aStatus)
+00426         {
+00427         return DoCopyMoveFromL(aSelection, aTargetId, aStatus, EFalse);
+00428         }
+00429 
+00430 
+00431 // ----------------------------------------------------------------------------
+00432 // Does copy/move of entries in selection from current context to aTargetId id
+00433 //
+00434 CMsvOperation* CTextMtmUi::DoCopyMoveFromL(const CMsvEntrySelection& aSelection,
+00435                                                                          TMsvId aTargetId, TRequestStatus& aStatus, TBool aCopy)
+00436         {
+00437         __ASSERT_DEBUG(aSelection.Count(), Panic(ETextMtmUiEmptySelection));
+00438 
+00439         const TMsvEntry& context=BaseMtm().Entry().Entry();
+00440         __ASSERT_ALWAYS(context.iType.iUid==KUidMsvServiceEntryValue ||
+00441                 context.iType.iUid==KUidMsvFolderEntryValue, Panic(ETextMtmUiWrongEntryType));
+00442 
+00443         ValidateSelectionL(BaseMtm().Entry(),aSelection);
+00444 
+00445         // Call the CMsvEntry copy/move functions: this will in turn call the Message Server
+00446         CMsvOperation* op=NULL;
+00447         if (aCopy)
+00448                 op=BaseMtm().Entry().CopyL(aSelection, aTargetId, aStatus);
+00449         else
+00450                 op=BaseMtm().Entry().MoveL(aSelection, aTargetId, aStatus);
+00451 
+00452         return op;
+00453         }
+00454 
+00455 
+00456 // ----------------------------------------------------------------------------
+00457 // Perform a copy/move (depending on value of aAction)
+00458 //
+00459 CMsvOperation* CTextMtmUi::DoCopyMoveToL(const CMsvEntrySelection& aSelection,
+00460                                                                                         TRequestStatus& aStatus, TBool aCopy)
+00461         {
+00462         __ASSERT_DEBUG(aSelection.Count(), Panic(ETextMtmUiEmptySelection));
+00463 
+00464         const TMsvEntry& context=BaseMtm().Entry().Entry();
+00465         __ASSERT_ALWAYS(context.iType.iUid==KUidMsvServiceEntryValue ||
+00466                 context.iType.iUid==KUidMsvFolderEntryValue, Panic(ETextMtmUiWrongEntryType));
+00467 
+00468         // Find selection parent
+00469         CMsvEntry* sourceEntry=Session().GetEntryL(aSelection.At(0));
+00470         CleanupStack::PushL(sourceEntry);
+00471 
+00472         TMsvId parent=sourceEntry->Entry().Parent();
+00473         sourceEntry->SetEntryL(parent);
+00474 
+00475         ValidateSelectionL(*sourceEntry,aSelection);
+00476 
+00477         // Call the CMsvEntry copy/move function: this will in turn call the Message Server
+00478         CMsvOperation* op=NULL;
+00479         if (aCopy)
+00480                 op=sourceEntry->CopyL(aSelection, context.Id(), aStatus);
+00481         else
+00482                 op=sourceEntry->MoveL(aSelection, context.Id(), aStatus);
+00483 
+00484         CleanupStack::PopAndDestroy();// sourceEntry
+00485 
+00486         return op;
+00487         }
+00488 
+00489 
+00490 // ----------------------------------------------------------------------------
+00491 // Check selection and confirm it contains only messages. Server-side doesn't handle folders
+00492 //
+00493 void CTextMtmUi::ValidateSelectionL(const CMsvEntry& aParent,
+00494                                                                                                  const CMsvEntrySelection& aSelection)
+00495         {
+00496         // We have a ready-made way of getting a list of the message children to check against
+00497         CMsvEntrySelection* msgChildren=aParent.ChildrenWithTypeL(KUidMsvMessageEntry);
+00498         CleanupStack::PushL(msgChildren);
+00499 
+00500         // Check each aSelection entry is a child message
+00501         const TInt nChildren=aSelection.Count();
+00502         for (TInt i=0; i<nChildren; i++)
+00503                 if ( msgChildren->Find(aSelection[i] ) == KErrNotFound )
+00504                         User::Leave(KErrNotSupported);
+00505         CleanupStack::PopAndDestroy(msgChildren);
+00506         }
+00507 
+00508 
+00509 
+00510 // ----------------------------------------------------------------------------
+00511 // Call MTM-specific function synchronously
+00512 //
+00513 void CTextMtmUi::InvokeSyncFunctionL(TInt aFunctionId, const CMsvEntrySelection& aSelection,
+00514                                                                          TDes8& aParameter)
+00515 // Call MTM-specific function synchronously
+00516         {
+00517         if (aFunctionId==ETxtuCommandRefreshMBox)
+00518                 {
+00519                 CBaseMtmUi::InvokeSyncFunctionL(KTXTMTMRefresh, aSelection, aParameter);
+00520         iServiceId = aSelection[0];
+00521         CallNewMessagesL();
+00522                 }
+00523         else 
+00524                 {
+00525                 CBaseMtmUi::InvokeSyncFunctionL(aFunctionId, aSelection, aParameter);
+00526                 }
+00527         }
+00528 
+00529 // ----------------------------------------------------------------------------
+00530 // Call MTM-specific function asynchronously
+00531 //
+00532 CMsvOperation* CTextMtmUi::InvokeAsyncFunctionL(TInt aFunctionId, const CMsvEntrySelection& aSelection,
+00533                                                                                                 TRequestStatus& aCompletionStatus, TDes8& aParameter)
+00534         {
+00535         if (aFunctionId==ETxtuCommandMessage)
+00536                 {
+00537                 return CBaseMtmUi::InvokeAsyncFunctionL(KTXTMTMMessageCommand, aSelection, aCompletionStatus, aParameter);
+00538                 }
+00539         else 
+00540         return CBaseMtmUi::InvokeAsyncFunctionL(aFunctionId, aSelection, aCompletionStatus, aParameter);
+00541         }
+00542 
+00543 
+00544 void CTextMtmUi::CallNewMessagesL() 
+00545     {
+00546     MNcnNotification* notification = NULL;
+00547 
+00548     CDesCArrayFlat* dummyArray = new (ELeave) CDesCArrayFlat( 1 );
+00549     CleanupStack::PushL( dummyArray );
+00550 
+00551     //Connect to NCN
+00552     TRAP_IGNORE( notification =
+00553         MNcnNotification::CreateMNcnNotificationL() );
+00554 
+00555     if ( notification )
+00556         {
+00557         notification->NewMessages(
+00558             iServiceId,  MNcnNotification::EIndicationNormal , *dummyArray );
+00559         }
+00560   
+00561     CleanupStack::PopAndDestroy( dummyArray );
+00562     dummyArray = NULL;
+00563     delete notification;
+00564     notification = NULL;    
+00565     } 
+00566 
+00567 
+00568 // ----------------------------------------------------------------------------
+00569 // Reply to message - no UI support
+00570 //
+00571 CMsvOperation* CTextMtmUi::ReplyL(TMsvId /*aDestination*/, TMsvPartList /*aPartlist*/, TRequestStatus& /*aCompletionStatus*/)
+00572         {
+00573         User::Leave(KErrNotSupported);
+00574         return NULL;
+00575         }
+00576 
+00577 
+00578 // ----------------------------------------------------------------------------
+00579 // Forwarded message - no UI support
+00580 //
+00581 CMsvOperation* CTextMtmUi::ForwardL(TMsvId /*aDestination*/, TMsvPartList /*aPartlist*/, TRequestStatus& /*aCompletionStatus*/)
+00582         {
+00583         User::Leave(KErrNotSupported);
+00584         return NULL;
+00585         }
+00586 
+00587 
+00588 // ----------------------------------------------------------------------------
+00589 //      Progress information
+00590 //
+00591 TInt CTextMtmUi::GetProgress(const TDesC8& aProgress, TBuf<EProgressStringMaxLen>& aReturnString,
+00592                 TInt& aTotalEntryCount, TInt& aEntriesDone,TInt& aCurrentEntrySize, TInt& aCurrentBytesTrans) const
+00593         {
+00594         TTxtProgressBuf paramPack;
+00595         // check that the progress descriptor passed to this method is valid
+00596     if (aProgress.Length() != paramPack.Length())
+00597                 return KErrBadDescriptor;
+00598 
+00599         // extract the progress information from the progress buffer
+00600         paramPack.Copy(aProgress);
+00601         TTxtProgress progress=paramPack();
+00602 
+00603     // clear the return string
+00604         aReturnString.Zero();
+00605 
+00606         // write error information into the return string
+00607         if (progress.iErrorCode==KErrNone)
+00608         {
+00609         HBufC* text = StringLoader::LoadL(R_TEXTMTM_PROGRESS_OK_TEXT, iCoeEnv );
+00610                 aReturnString.Append(*text);
+00611         delete text;
+00612         }
+00613         else
+00614                 {
+00615         HBufC* text = StringLoader::LoadL(R_TEXTMTM_PROGRESS_ERROR_TEXT, iCoeEnv );
+00616                 aReturnString.Append(*text);
+00617         delete text;
+00618                 aReturnString.AppendNum(progress.iErrorCode);
+00619                 }
+00620 
+00621         // Populate method parameters with information extracted from progress structure
+00622         aTotalEntryCount=progress.iTotalMsgs;
+00623         aEntriesDone=progress.iMsgsProcessed;
+00624 
+00625         // TTxtProgress doesn't hold anything about these attributes, so zero them
+00626         aCurrentEntrySize=0;
+00627         aCurrentBytesTrans=0;
+00628 
+00629         return KErrNone;
+00630         }
+00631 
+00632 
+00633 // ----------------------------------------------------------------------------
+00634 // Specific to CTextMtmUi
+00635 //
+00636 CMsvOperation* CTextMtmUi::LaunchEditorApplicationL(TRequestStatus& aStatus, TMsvId aId, TBool /*aReadOnly*/)
+00637         {
+00638         CTxtMtmEditorOperation* op = CTxtMtmEditorOperation::NewL(aId,CTxtMtmEditorOperation::EEdit,Session(),aStatus, *this);
+00639         return op;
+00640         }
+00641 
+00642 
+00643 // ----------------------------------------------------------------------------
+00644 // Specific to CTextMtmUi
+00645 //
+00646 CMsvOperation* CTextMtmUi::LaunchViewerApplicationL(TRequestStatus& aStatus, TMsvId aId)
+00647         {
+00648 
+00649         CTxtMtmEditorOperation* op = CTxtMtmEditorOperation::NewL(aId,CTxtMtmEditorOperation::EView,Session(),aStatus, *this);
+00650         return op;
+00651         }
+00652 
+00653 
+00654 // ----------------------------------------------------------------------------
+00655 // Little utility function to set progress info
+00656 //
+00657 void CTextMtmUi::SetProgressSuccess(TPckgBuf<TMsvLocalOperationProgress>& aProgress,TMsvId aId)
+00658         {
+00659         aProgress().iTotalNumberOfEntries=1;
+00660         aProgress().iNumberCompleted=1;
+00661         aProgress().iId=aId;
+00662 
+00663         }
+00664 
+00665 
+00666 
+
+
Generated by  + +doxygen 1.6.2
+ +