mmsharing/mmshui/src/musuidialogutil.cpp
branchRCL_3
changeset 33 bc78a40cd63c
parent 0 f0cf47e981f9
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
       
     1 /*
       
     2 * Copyright (c) 2006 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 #include "musuidialogutil.h"
       
    20 #include <musui.rsg>
       
    21 
       
    22 #include <AknGlobalConfirmationQuery.h>
       
    23 #include <aknnotewrappers.h>
       
    24 #include <AknGlobalNote.h>
       
    25 #include <aknlistquerydialog.h>
       
    26 #include <StringLoader.h>
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 TBool MusUiDialogUtil::ShowGlobalConfirmationQueryDialogL( const TDesC& aPrompt )
       
    33     {
       
    34 	CAknGlobalConfirmationQuery* dlg = CAknGlobalConfirmationQuery::NewLC();
       
    35 	TRequestStatus status;
       
    36 	dlg->ShowConfirmationQueryL( status, aPrompt, R_AVKON_SOFTKEYS_YES_NO );
       
    37 	User::WaitForRequest( status );
       
    38 	CleanupStack::PopAndDestroy( dlg );
       
    39     return ( status == EAknSoftkeyYes ) ? ETrue : EFalse;
       
    40     }
       
    41 
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 void MusUiDialogUtil::ShowInformationDialogL( const TDesC& aPrompt )
       
    48     {
       
    49     CAknInformationNote* dlg = new ( ELeave ) CAknInformationNote( ETrue );
       
    50     dlg->ExecuteLD( aPrompt );
       
    51     }
       
    52 
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 void MusUiDialogUtil::ShowInformationDialogL( TInt aResourceId )
       
    59     {
       
    60     HBufC* dlgPrompt = StringLoader::LoadLC( aResourceId );
       
    61     ShowInformationDialogL( *dlgPrompt );
       
    62     CleanupStack::PopAndDestroy( dlgPrompt );
       
    63     }
       
    64 
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 void MusUiDialogUtil::ShowGlobalInformationDialogL( const TDesC& aMessage )
       
    71     {
       
    72     TRequestStatus status;
       
    73     CAknGlobalNote* dlg= CAknGlobalNote::NewLC();
       
    74     dlg->ShowNoteL( status, EAknGlobalInformationNote, aMessage );
       
    75     User::WaitForRequest( status );
       
    76     CleanupStack::PopAndDestroy( dlg );
       
    77     }
       
    78 
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 void MusUiDialogUtil::ShowGlobalInformationDialogL( TInt aResourceId )
       
    85     {
       
    86     HBufC* dlgPrompt = StringLoader::LoadLC( aResourceId );
       
    87 	ShowGlobalInformationDialogL( *dlgPrompt );
       
    88     CleanupStack::PopAndDestroy( dlgPrompt );
       
    89     }
       
    90 
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 void MusUiDialogUtil::ShowGlobalErrorDialogL( const TDesC& aMessage )
       
    97     {
       
    98     CAknGlobalNote* dlg = CAknGlobalNote::NewLC();
       
    99     dlg->ShowNoteL( EAknGlobalErrorNote, aMessage );
       
   100     CleanupStack::PopAndDestroy( dlg );
       
   101     }
       
   102 
       
   103 
       
   104 // -----------------------------------------------------------------------------
       
   105 //
       
   106 // -----------------------------------------------------------------------------
       
   107 //
       
   108 void MusUiDialogUtil::ShowGlobalErrorDialogL( TInt aResourceId )
       
   109     {
       
   110     HBufC* dlgPrompt = StringLoader::LoadLC( aResourceId );
       
   111     ShowGlobalErrorDialogL( *dlgPrompt );
       
   112     CleanupStack::PopAndDestroy( dlgPrompt );
       
   113     }
       
   114 
       
   115 
       
   116 // -----------------------------------------------------------------------------
       
   117 //
       
   118 // -----------------------------------------------------------------------------
       
   119 //
       
   120 void MusUiDialogUtil::ShowGlobalErrorModalDialogL( const TDesC& aMessage )
       
   121     {
       
   122     CAknGlobalNote* dlg = CAknGlobalNote::NewLC();
       
   123     TRequestStatus status;
       
   124     dlg->ShowNoteL( status , EAknGlobalErrorNote, aMessage );
       
   125     User::WaitForRequest( status );
       
   126     CleanupStack::PopAndDestroy( dlg );
       
   127     }
       
   128 
       
   129 
       
   130 // -----------------------------------------------------------------------------
       
   131 //
       
   132 // -----------------------------------------------------------------------------
       
   133 //
       
   134 void MusUiDialogUtil::ShowGlobalErrorModalDialogL( TInt aResourceId )
       
   135     {
       
   136     HBufC* dlgPrompt = StringLoader::LoadLC( aResourceId );
       
   137     ShowGlobalErrorModalDialogL( *dlgPrompt );
       
   138     CleanupStack::PopAndDestroy( dlgPrompt );
       
   139     }
       
   140 
       
   141 
       
   142 // -----------------------------------------------------------------------------
       
   143 //
       
   144 // -----------------------------------------------------------------------------
       
   145 //
       
   146 TBool MusUiDialogUtil::SelectAddressDialogL( CDesCArray* aAddressArray,
       
   147                                              TDes& aSelectedAddress )
       
   148     {
       
   149     __ASSERT_ALWAYS( aAddressArray, User::Leave( KErrArgument ) );
       
   150     __ASSERT_ALWAYS( aAddressArray->Count() > 0, User::Leave( KErrArgument ) );
       
   151     
       
   152     TInt selectedIndex( 0 );
       
   153     CAknListQueryDialog* dlg = new ( ELeave ) CAknListQueryDialog( &selectedIndex );
       
   154     dlg->PrepareLC( R_MUS_LIVESHARINGVIEW_ADDRESS_QUERY );
       
   155     dlg->SetItemTextArray( aAddressArray );
       
   156     dlg->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   157     TInt dlgResponse( dlg->RunLD() );
       
   158     aSelectedAddress = (*aAddressArray)[ selectedIndex ];
       
   159     delete aAddressArray;
       
   160     aAddressArray = NULL;
       
   161     return dlgResponse;
       
   162     }
       
   163 
       
   164 
       
   165 // -----------------------------------------------------------------------------
       
   166 //
       
   167 // -----------------------------------------------------------------------------
       
   168 //
       
   169 TBool MusUiDialogUtil::ShowTextQueryDialogL( const TDesC& aPrompt, TDes& aValue )
       
   170     {
       
   171     CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL( aValue );
       
   172     CleanupStack::PushL( dlg );
       
   173     dlg->SetPromptL( aPrompt );
       
   174     CleanupStack::Pop( dlg );
       
   175     return dlg->ExecuteLD( R_MUS_TEXT_QUERY_DIALOG );
       
   176     }
       
   177 
       
   178 
       
   179 // -----------------------------------------------------------------------------
       
   180 //
       
   181 // -----------------------------------------------------------------------------
       
   182 //
       
   183 TBool MusUiDialogUtil::ShowTextQueryDialogL( TInt aPromptResourceId, TDes& aValue )
       
   184     {
       
   185     TBool retval( EFalse );
       
   186     HBufC* dlgPrompt = StringLoader::LoadLC( aPromptResourceId );
       
   187     retval = ShowTextQueryDialogL( *dlgPrompt, aValue );
       
   188     CleanupStack::PopAndDestroy( dlgPrompt );
       
   189     return retval;
       
   190     }
       
   191 
       
   192 
       
   193 // end of file