meetingui/meetingrequestutils/src/CMREditBeforeSendingViewForm.cpp
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Form to edit meeting request description field
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "CMREditBeforeSendingViewForm.h"
       
    23 #include "meetingrequestutils.hrh" 	//common constants
       
    24 #include "MRHelpers.h"
       
    25 #include <MeetingRequestUids.hrh>
       
    26 #include "icalui.hlp.hrh"			// help resources
       
    27 #include <meetingrequestutilsuires.rsg>
       
    28 #include <avkon.hrh>
       
    29 #include <aknquerydialog.h>
       
    30 #include <stringloader.h>
       
    31 #include <calentry.h> 		//CCalEntry (Calendar entry API V2)
       
    32 #include <caluser.h> 		//caluser and attendee
       
    33 #include <featmgr.h>
       
    34 #include <hlplch.h>
       
    35 
       
    36 // CONSTANTS
       
    37 /// Unnamed namespace for local definitions
       
    38 namespace {
       
    39 
       
    40 enum TPanicCode
       
    41     {
       
    42     };
       
    43 
       
    44 _LIT( KPanicMsg, "CEditBeforeSendingViewForm" );
       
    45 
       
    46 void Panic( TPanicCode aReason )
       
    47     {
       
    48     User::Panic( KPanicMsg, aReason );
       
    49     }
       
    50     
       
    51 }  // namespace
       
    52 
       
    53 // ============================= LOCAL FUNCTIONS ===============================
       
    54 
       
    55 
       
    56 CEditBeforeSendingViewForm* CEditBeforeSendingViewForm::NewL(
       
    57     TMode aMode,
       
    58     const CCalEntry& aEntry,
       
    59     TDes& aText )
       
    60 	{
       
    61 	CEditBeforeSendingViewForm* self =
       
    62 	    new( ELeave ) CEditBeforeSendingViewForm( aMode, aEntry, aText );
       
    63 	CleanupStack::PushL( self );
       
    64 	self->ConstructL();
       
    65 	CleanupStack::Pop( self );
       
    66 	return self;
       
    67 	}
       
    68 
       
    69 CEditBeforeSendingViewForm::CEditBeforeSendingViewForm(
       
    70     TMode aMode,
       
    71     const CCalEntry& aEntry,
       
    72     TDes& aText )
       
    73     : iMode( aMode ),
       
    74       iEntry( aEntry ),
       
    75       iText( aText )
       
    76     {
       
    77     }
       
    78 
       
    79 void CEditBeforeSendingViewForm::ConstructL()
       
    80     {
       
    81     CAknDialog::ConstructL( R_EDIT_BEFORE_SENDING_VIEW_MENUBAR );
       
    82     }
       
    83 
       
    84 CEditBeforeSendingViewForm::~CEditBeforeSendingViewForm()
       
    85     {
       
    86     delete iInvitedAttendees;
       
    87     }
       
    88 
       
    89 TBool CEditBeforeSendingViewForm::OkToExitL( TInt aButtonId )
       
    90     {
       
    91 
       
    92     TBool retVal( EFalse );
       
    93     switch ( aButtonId )
       
    94     	{
       
    95     	case EAknSoftkeyOptions:
       
    96 			{
       
    97 			// we want to dynamically handle the opening of options menu
       
    98 			CAknDialog::DisplayMenuL();
       
    99 		 	retVal = EFalse;
       
   100 		 	break;
       
   101 			}
       
   102     	case EAknSoftkeyExit:
       
   103     		{    		
       
   104     		retVal = ETrue;
       
   105     		break;
       
   106     		}
       
   107 		case EAknSoftkeyCancel:
       
   108 			{
       
   109 			CAknQueryDialog* queryDlg = CAknQueryDialog::NewL();
       
   110     		if(queryDlg->ExecuteLD( R_EDIT_BEFORE_SENDING_CANCEL_RESPONSE_QUERY ) )
       
   111     		    {    		    
       
   112     			retVal = ETrue;
       
   113     		    }
       
   114     		else
       
   115     		    {    		    
       
   116     			retVal = EFalse;
       
   117     		    }
       
   118 			break;
       
   119 			}
       
   120     	case EEditBeforeSendingCmdSend:
       
   121     		{
       
   122     		retVal = ETrue;
       
   123     		break;
       
   124     		}
       
   125     	}
       
   126     return retVal;
       
   127     }
       
   128     
       
   129 void CEditBeforeSendingViewForm::ProcessCommandL( TInt aCommandId )
       
   130 	{
       
   131 	HideMenu();
       
   132 	switch ( aCommandId )
       
   133 		{
       
   134 		case EEditBeforeSendingCmdSend:
       
   135 			{
       
   136 			SaveFormDataL();
       
   137 			TryExitL( aCommandId );
       
   138 			break;
       
   139 			}
       
   140 		case EAknCmdHelp:
       
   141 			{
       
   142 			if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) 
       
   143         		{
       
   144         		HlpLauncher::LaunchHelpApplicationL(
       
   145             	iCoeEnv->WsSession(), iAvkonAppUi->AppHelpContextL() );
       
   146                 }
       
   147 			break;
       
   148 			}
       
   149 		case EAknCmdExit:
       
   150 			{
       
   151 			TryExitL( aCommandId );
       
   152 			break;
       
   153 			}
       
   154 				
       
   155 		}
       
   156 	}
       
   157 
       
   158 void CEditBeforeSendingViewForm::PreLayoutDynInitL()
       
   159     {
       
   160     SetEditableL( ETrue );
       
   161     LoadFormDataL();
       
   162     }
       
   163 
       
   164 void CEditBeforeSendingViewForm::PostLayoutDynInitL()
       
   165 	{
       
   166 	}
       
   167 
       
   168 TBool CEditBeforeSendingViewForm::SaveFormDataL()
       
   169     {
       
   170     CEikEdwin* ctrl = static_cast<CEikEdwin*> ( Control( EDescriptionEditor ) );
       
   171     ctrl->GetText( iText );
       
   172     return ETrue;
       
   173     }
       
   174 
       
   175 void CEditBeforeSendingViewForm::LoadFormDataL()
       
   176     {
       
   177     TPtrC toAddr;
       
   178 	if (iMode == EEditResponse )
       
   179 		{
       
   180 		toAddr.Set( MRHelpers::AddressWithoutMailtoPrefix( 
       
   181                     iEntry.OrganizerL()->Address() ) );
       
   182 		}
       
   183 	else
       
   184 		{
       
   185 		delete iInvitedAttendees;
       
   186 		iInvitedAttendees = NULL;
       
   187 		iInvitedAttendees =
       
   188 		    StringLoader::LoadL( R_QTN_CALE_TO_INVITED_ATTENDEES );
       
   189         toAddr.Set( *iInvitedAttendees );
       
   190 		}
       
   191     CEikEdwin* toEditor = static_cast<CEikEdwin*> ( Control( EToEditor ) );
       
   192     toEditor->SetTextL( &toAddr );
       
   193 
       
   194     CEikEdwin* subjectEditor =
       
   195         static_cast<CEikEdwin*> ( Control( ESubjectEditor ) );
       
   196     subjectEditor->SetTextL( ( &( iEntry.SummaryL() ) ) );
       
   197     }
       
   198 
       
   199 void CEditBeforeSendingViewForm::DynInitMenuPaneL( TInt aResourceId,
       
   200 												   CEikMenuPane* aMenuPane )
       
   201 	{
       
   202 	switch( aResourceId )
       
   203 		{
       
   204 		case R_EDIT_BEFORE_SENDING_VIEW_OPTIONS:
       
   205 		    {		    
       
   206 			DynInitMainMenuL( aMenuPane );
       
   207 			break;
       
   208 		    }
       
   209 		default:
       
   210 		    {		    
       
   211 			break;
       
   212 		    }
       
   213 		}
       
   214 	}
       
   215 
       
   216 void CEditBeforeSendingViewForm::DynInitMainMenuL( CEikMenuPane* /*aMenuPane*/ )
       
   217 	{
       
   218 	}
       
   219 	
       
   220 // ---------------------------------------------------------
       
   221 // CEditBeforeSendingViewForm::GetHelpContext
       
   222 // Gets help context
       
   223 // ---------------------------------------------------------
       
   224 //
       
   225 void CEditBeforeSendingViewForm::GetHelpContext(
       
   226     TCoeHelpContext& aContext ) const
       
   227     {
       
   228     aContext.iMajor = TUid::Uid( KMeetingRequestViewersDllUID3 );
       
   229 
       
   230     // Help resources specified in HRH file.
       
   231     if ( iMode == EEditResponse )
       
   232     	{
       
   233     	aContext.iContext = KCALE_HLP_EDIT_RESPONSE;
       
   234     	}
       
   235     else if ( iMode == EEditCancellation )
       
   236     	{
       
   237     	aContext.iContext = KCALE_HLP_EDIT_CANCEL;
       
   238     	}
       
   239     }
       
   240 
       
   241 
       
   242 //  End of File