wlansecuritysettings/wifiprotectedsetup/pluginsrc/wifiprotselectnetworkdlg.cpp
changeset 0 c8830336c852
child 2 1c7bc153c08e
equal deleted inserted replaced
-1:000000000000 0:c8830336c852
       
     1 /*
       
     2 * Copyright (c) 2001-2009 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 the License "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: Implementation of class CWiFiProtSelectNetworkDlg.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 //system includes
       
    21 #include <uikon/eiksrvui.h>
       
    22 #include <StringLoader.h>
       
    23 #include <wifiprotplugin.rsg>
       
    24 #include <badesca.h>
       
    25 
       
    26 //user includes
       
    27 #include "wifiprotselectnetworkdlg.h"
       
    28 #include "wifiprotdlgsplugin.h"
       
    29 #include "wifiprotplugin.hrh"
       
    30 // ========================== MEMBER FUNCTIONS ==============================
       
    31 //
       
    32 // --------------------------------------------------------------------------
       
    33 // CWiFiProtSelectNetworkDlg::CWiFiProtSelectNetworkDlg
       
    34 // --------------------------------------------------------------------------
       
    35 //
       
    36 CWiFiProtSelectNetworkDlg::CWiFiProtSelectNetworkDlg(
       
    37                                         TRequestStatus& aStatus ,
       
    38                                         TInt& aSelected ,
       
    39                                         CDesCArrayFlat* aItems,
       
    40                                         CArrayPtr<CGulIcon>* aIcons ):
       
    41                                            CAknListQueryDialog( &aSelected ),
       
    42                                            iRequestStatus( aStatus ),
       
    43                                            iSelected( aSelected ),
       
    44                                            iIcons( aIcons ),
       
    45                                            iItems( aItems )
       
    46     {
       
    47     iRequestStatus = KRequestPending;
       
    48     }
       
    49     
       
    50     
       
    51 // --------------------------------------------------------------------------
       
    52 // CWiFiProtSelectNetworkDlg::~CWiFiProtSelectNetworkDlg
       
    53 // --------------------------------------------------------------------------
       
    54 //
       
    55 CWiFiProtSelectNetworkDlg::~CWiFiProtSelectNetworkDlg()
       
    56     {
       
    57   
       
    58     STATIC_CAST( CEikServAppUi*, 
       
    59                 CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse );
       
    60     delete iIcons;
       
    61     delete iItems;
       
    62     }
       
    63 
       
    64 // --------------------------------------------------------------------------
       
    65 // void CSelectDestinationDlg::PrepareAndRunLD
       
    66 // --------------------------------------------------------------------------
       
    67 //
       
    68 void CWiFiProtSelectNetworkDlg::PrepareAndRunLD()
       
    69     {
       
    70     PrepareLC(R_CONN_LIST_QUERY);
       
    71     // Set the description field on the query
       
    72     HBufC* desc = StringLoader::LoadLC(
       
    73                  R_QTN_NETW_CONSET_WPS_DETAIL_SELECT_NETWORK );
       
    74     //ownership transferred                 
       
    75     SetItemTextArray( iItems ); 
       
    76     iItems = NULL;
       
    77     //ownership transferred
       
    78     SetIconArrayL( iIcons );
       
    79     iIcons = NULL;
       
    80 
       
    81     MessageBox()->SetMessageTextL( desc );
       
    82     CleanupStack::PopAndDestroy( desc );                
       
    83     RunLD();
       
    84     }
       
    85 
       
    86 
       
    87 // --------------------------------------------------------------------------
       
    88 // CWiFiProtSelectNetworkDlg::OkToExitL
       
    89 // --------------------------------------------------------------------------
       
    90 //
       
    91 TBool CWiFiProtSelectNetworkDlg::OkToExitL( TInt aButtonId )
       
    92     {
       
    93     TInt status = KErrCancel;
       
    94     if ( aButtonId == EAknSoftkeyOk
       
    95       || aButtonId == EAknSoftkeyYes
       
    96       || aButtonId == EAknSoftkeyDone
       
    97       || aButtonId == EAknSoftkeySelect )
       
    98         {
       
    99         // This should be done automatically
       
   100         // I have no idea why iSelected isn't updated
       
   101         iSelected = ListBox()->CurrentItemIndex();
       
   102         status = KErrNone;
       
   103         }
       
   104     TRequestStatus* pS = &iRequestStatus;                
       
   105     User::RequestComplete( pS, status ); 
       
   106 
       
   107     return ETrue;
       
   108     }
       
   109         
       
   110 // --------------------------------------------------------------------------
       
   111 // CWiFiProtSelectNetworkDlg::PreLayoutDynInitL()
       
   112 // --------------------------------------------------------------------------
       
   113 //
       
   114 void CWiFiProtSelectNetworkDlg::PreLayoutDynInitL()
       
   115     {
       
   116     CAknListQueryDialog::PreLayoutDynInitL();
       
   117     STATIC_CAST( CEikServAppUi*, 
       
   118                 CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );
       
   119                 
       
   120     }
       
   121     
       
   122 // --------------------------------------------------------------------------
       
   123 // void CSelectDestinationDlg::HandleResourceChange
       
   124 // --------------------------------------------------------------------------
       
   125 //
       
   126 void CWiFiProtSelectNetworkDlg::HandleResourceChange( TInt aType )
       
   127     {
       
   128     if ( aType == KAknsMessageSkinChange )
       
   129         {
       
   130         CAknListQueryDialog::HandleResourceChange( aType );
       
   131 
       
   132         TRAP_IGNORE( SetIconArrayL( iIcons ) );
       
   133 
       
   134         SizeChanged();
       
   135         }
       
   136     else
       
   137         {
       
   138         if ( aType == KEikDynamicLayoutVariantSwitch )
       
   139             {
       
   140             TRect mainPaneRect;
       
   141             AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
       
   142                                                mainPaneRect );
       
   143 
       
   144             TAknLayoutRect layoutRect;
       
   145             layoutRect.LayoutRect( TRect( TPoint( 0, 0 ), 
       
   146                                    mainPaneRect.Size() ),
       
   147                                    AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) );
       
   148 
       
   149             ListBox()->SetRect( layoutRect.Rect() );
       
   150             }
       
   151 
       
   152         // Base call
       
   153         CAknListQueryDialog::HandleResourceChange( aType );
       
   154         }
       
   155     }    
       
   156 // End of File