iaupdate/IAD/ui/src/iaupdatedialogutil.cpp
changeset 29 26b6f0522fd8
parent 25 98b66e4fb0be
child 30 398876c4ffa7
child 33 8110bf1194d1
equal deleted inserted replaced
25:98b66e4fb0be 29:26b6f0522fd8
     1 /*
       
     2 * Copyright (c) 2007-2008 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:    
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 
       
    22 #include "iaupdatedialogutil.h"
       
    23 #include "iaupdatedebug.h"
       
    24 #include <iaupdate.rsg>
       
    25 
       
    26 #include <aknmessagequerydialog.h>      // CAknMessageQueryDialog
       
    27 #include <aknnotewrappers.h>    // CAknInformationNote
       
    28 #include <StringLoader.h>
       
    29 
       
    30 
       
    31 /*******************************************************************************
       
    32  * class TIAUpdateDialogParam
       
    33  *******************************************************************************/
       
    34 
       
    35 
       
    36 // -------------------------------------------------------------------------------
       
    37 // TIAUpdateDialogParam::TIAUpdateDialogParam
       
    38 //
       
    39 // -------------------------------------------------------------------------------
       
    40 //
       
    41 TIAUpdateDialogParam::TIAUpdateDialogParam()
       
    42  : iCountSuccessfull( KErrNotFound ), iCountCancelled( KErrNotFound ),
       
    43    iCountFailed( KErrNotFound ), iResourceId( KErrNotFound ), iNode( NULL ), 
       
    44    iLinkObserver( NULL )
       
    45     {
       
    46     }
       
    47 
       
    48 
       
    49 /*******************************************************************************
       
    50  * class IAUpdateDialogUtil
       
    51  *******************************************************************************/
       
    52 
       
    53 
       
    54 //------------------------------------------------------------------------------
       
    55 // IAUpdateDialogUtil::ShowMessageQueryL
       
    56 //
       
    57 //------------------------------------------------------------------------------
       
    58 //
       
    59 void IAUpdateDialogUtil::ShowMessageQueryL(const TDesC& aTitle, const TDesC& aText)
       
    60 	{
       
    61 	TPtrC ptr = aText;
       
    62 	CAknMessageQueryDialog* query = CAknMessageQueryDialog::NewL( ptr );
       
    63 	query->PrepareLC( R_IAUPDATE_MESSAGE_QUERY );
       
    64 
       
    65 	if ( aTitle.Length() != 0 )
       
    66 		{
       
    67 		CAknPopupHeadingPane* headingPane = query->Heading();
       
    68 		headingPane->SetTextL( aTitle );
       
    69 		}
       
    70 	query->RunLD();
       
    71 	}
       
    72 
       
    73 
       
    74 //------------------------------------------------------------------------------
       
    75 // IAUpdateDialogUtil::ShowMessageQueryL
       
    76 //
       
    77 //------------------------------------------------------------------------------
       
    78 //
       
    79 void IAUpdateDialogUtil::ShowMessageQueryL( const TDesC& aTitle, TInt aResource )
       
    80 	{
       
    81 	HBufC* hBuf = StringLoader::LoadLC( aResource );
       
    82 	ShowMessageQueryL( aTitle, hBuf->Des() );
       
    83 	CleanupStack::PopAndDestroy( hBuf );
       
    84 	}
       
    85 
       
    86 
       
    87 //------------------------------------------------------------------------------
       
    88 // IAUpdateDialogUtil::ShowInformationQueryL
       
    89 //
       
    90 //------------------------------------------------------------------------------
       
    91 //
       
    92 void IAUpdateDialogUtil::ShowInformationQueryL(const TDesC& aText)
       
    93 	{
       
    94 	CAknQueryDialog* queryDialog = new (ELeave) CAknQueryDialog;
       
    95 	queryDialog->ExecuteLD(R_IAUPDATE_INFORMATION_QUERY, aText);
       
    96 	}
       
    97 
       
    98 
       
    99 //------------------------------------------------------------------------------
       
   100 // IAUpdateDialogUtil::ShowInformationQueryL
       
   101 //
       
   102 //------------------------------------------------------------------------------
       
   103 //
       
   104 void IAUpdateDialogUtil::ShowInformationQueryL(TInt aResource)
       
   105 	{
       
   106 	HBufC* hBuf = StringLoader::LoadLC(aResource);
       
   107 	ShowInformationQueryL( hBuf->Des() );
       
   108 	CleanupStack::PopAndDestroy( hBuf );
       
   109 	}
       
   110 
       
   111 //------------------------------------------------------------------------------
       
   112 // IAUpdateDialogUtil::ShowConfirmationQueryL
       
   113 //
       
   114 //------------------------------------------------------------------------------
       
   115 //
       
   116 TInt IAUpdateDialogUtil::ShowConfirmationQueryL( const TDesC& aText, 
       
   117                                           TInt aSoftkeyResourceId )
       
   118 	{
       
   119 	CAknQueryDialog* queryDialog = CAknQueryDialog::NewL( 
       
   120 	                               CAknQueryDialog::EConfirmationTone );
       
   121 
       
   122     queryDialog->PrepareLC( R_IAUPDATE_CONFIRMATION_QUERY );
       
   123     queryDialog->SetPromptL( aText );
       
   124     queryDialog->ButtonGroupContainer().SetCommandSetL( aSoftkeyResourceId );
       
   125     return ( queryDialog->RunLD() );
       
   126 	}
       
   127 
       
   128 //------------------------------------------------------------------------------
       
   129 // IAUpdateDialogUtil::ShowConfirmationQueryL
       
   130 //
       
   131 //------------------------------------------------------------------------------
       
   132 //
       
   133 TInt IAUpdateDialogUtil::ShowConfirmationQueryL( TInt aResource, 
       
   134                                           TInt aSoftkeyResourceId )
       
   135 	{
       
   136 	HBufC* hBuf = StringLoader::LoadLC( aResource) ;
       
   137 	TInt ret = ShowConfirmationQueryL( *hBuf, aSoftkeyResourceId );
       
   138 	CleanupStack::PopAndDestroy( hBuf );
       
   139 	return ret;
       
   140 	}
       
   141 
       
   142 
       
   143 
       
   144 
       
   145 // -----------------------------------------------------------------------------
       
   146 // IAUpdateDialogUtil::Panic
       
   147 //
       
   148 // -----------------------------------------------------------------------------
       
   149 //
       
   150 void IAUpdateDialogUtil::Panic( TInt aReason ) 
       
   151     {
       
   152 	_LIT(KPanicCategory, "IAUpdateDialogUtil");
       
   153 	
       
   154 	User::Panic(KPanicCategory, aReason); 
       
   155     }
       
   156     
       
   157 //  End of File