vpnui/vpndialogmanager/src/vpndialogmanager.cpp
changeset 0 33413c0669b9
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2008-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 "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:   VPN dialog manager
       
    15 *
       
    16 */
       
    17 
       
    18 #include <vpnecomnotifier.rsg>
       
    19 #include "vpnnotifierdefs.h"
       
    20 #include "vpndialogshower.h"
       
    21 #include "vpndialogmanager.h"
       
    22 
       
    23 #include "logvpncommon.h"
       
    24 
       
    25 
       
    26 // At ordinal 1, a factory method used to produce cvpndialogmanager instances
       
    27 EXPORT_C MVpnDialogManager* NewDialogManagerL()
       
    28     {
       
    29     LOG_("-> NewDialogManagerL()");
       
    30     LOG_("<- NewDialogManagerL()");
       
    31     return new (ELeave) CVpnDialogManager;
       
    32     }
       
    33 
       
    34 MVpnDialog* CVpnDialogManager::LaunchDialogL(MVpnNotifierCallback* aNotifier, TInt aDialogId,
       
    35                                                TInt aNoteDialogId, const TDesC8& aInput)
       
    36     {
       
    37     CVpnDialogShower* shower = GetDialogShowerL();
       
    38     LOG_1("-> CVpnDialogManager::LaunchDialogL() dialog ID is: %d", aDialogId);
       
    39     LOG_1(" Note dialog ID: %d", aNoteDialogId);
       
    40 
       
    41     // If note dialog id hasn't been specified, then we're going
       
    42     // to display a more complex query dialog
       
    43     if (aNoteDialogId == 0) 
       
    44         {
       
    45         switch (aDialogId)
       
    46             {
       
    47 
       
    48             // VPN related dialogs
       
    49             case TVpnDialog::EUserIdentity:
       
    50                 return shower->GetUserIdentityDlgL(aNotifier, aInput);
       
    51             case TVpnDialog::EPolicyUpdateConfirmation:
       
    52                 return shower->GetPolicyUpdateConfirmationDlgL(aNotifier, aInput);
       
    53 
       
    54             // Policy installer's dialogs
       
    55             case TVpnDialog::EPolicyInstallConfirmation:
       
    56                 LOG_1(" Showing pol import conf %d", aDialogId);
       
    57                 return shower->GetPolicyImportConfirmationDlgL(aNotifier, aInput);
       
    58             case TVpnDialog::EPolicyInstallInProgress:
       
    59                 return shower->GetPolicyImportProgressDlgL(aNotifier, aInput);
       
    60             case TVpnDialog::EGenericProgress:
       
    61                 return shower->GetGenericProgressDlgL(aNotifier, aInput);
       
    62             case TVpnDialog::EPKCS12Password:
       
    63                 return shower->GetPKCS12PasswordDlgL(aNotifier);
       
    64             case TVpnDialog::EDeviceLockConfirmation:
       
    65                 LOG_1(" Showing dev lock pol import conf %d", aDialogId);
       
    66                 return shower->GetDevLockConfirmationDlgL(aNotifier, aInput);
       
    67 
       
    68             // KMD Dialogs
       
    69             case TKmdDialog::EUserPwd:
       
    70                 return shower->GetUserPwdDlgL(aNotifier, aInput);
       
    71             case TKmdDialog::ESecurIdPin:
       
    72                 return shower->GetSecurIdDlgL(aNotifier, aInput);
       
    73             case TKmdDialog::ESecurIdNextPin:
       
    74                 return shower->GetSecurIdNextDlgL(aNotifier, aInput);
       
    75 
       
    76             default:
       
    77                 LOG_(" Default case, return NULL");
       
    78                 return NULL;
       
    79             }
       
    80         }
       
    81     else 
       
    82         {
       
    83         // Display the desired note
       
    84         LOG_(" Showing note dialog");
       
    85         return ShowNoteDialogL(aNotifier, aNoteDialogId);
       
    86         }
       
    87     }
       
    88 
       
    89 TInt CVpnDialogManager::GetNoteTextId(TInt aNoteDialogId)
       
    90     {
       
    91     LOG_("CVpnDialogManager::GetNoteTextId()");
       
    92     switch (aNoteDialogId)
       
    93         {
       
    94         // ACU note dialogs
       
    95         case TVpnNoteDialog::EWrongServerIdentityCode:
       
    96             return R_ACU_WRONG_SERVER_IDENTITY_CODE;
       
    97         case TVpnNoteDialog::ENextServerIdentity:
       
    98             return R_ACU_NEXT_SERVER_IDENTITY;
       
    99         case TVpnNoteDialog::EAuthenticationFailed:
       
   100             return R_ACU_AUTH_FAILED;
       
   101         case TVpnNoteDialog::EInvalidServerCert:
       
   102             return R_ACU_INVALID_SERVER_CERT;
       
   103         case TVpnNoteDialog::EInvalidClientCert:
       
   104             return R_ACU_INVALID_CLIENT_CERT;
       
   105         // VPN related note dialogs
       
   106         case TVpnNoteDialog::EPolicyUpdateSucceeded:
       
   107             return R_VPN_POLICY_UPDATE_SUCCEEDED;
       
   108         case TVpnNoteDialog::EPolicyUpdateFailed:
       
   109             return R_VPN_POLICY_UPDATE_FAILED;
       
   110         case TVpnNoteDialog::EPolicyDeleteSucceeded:
       
   111             return R_VPN_POLICY_DELETE_SUCCEEDED;
       
   112         case TVpnNoteDialog::EVpnUserNameMissing:
       
   113             return R_VPN_USER_NAME_MISSING;
       
   114         case TVpnNoteDialog::EVpnFqdnMissing:
       
   115             return R_VPN_FQDN_MISSING;
       
   116         case TVpnNoteDialog::EVpnCannotForceDeviceLock:
       
   117             return R_VPN_STR_CANNOT_FORCE_DEVICE_LOCK;
       
   118         case TVpnNoteDialog::EPolicyInstallationFailed:
       
   119             return R_VPN_POLICY_INSTALLATION_FAILED;
       
   120         // Policy installer notes
       
   121         case TVpnNoteDialog::EVpnPolicyInstalled:
       
   122             return R_VPN_CONF_POLICY_IMPORT_COMPLETE;
       
   123         case TVpnNoteDialog::EVpnWrongPKCS12Password:
       
   124             return R_VPN_STR_WRONG_PKCS12_PASSWORD_STR;
       
   125         // Kmd note dialogs
       
   126         case TVpnNoteDialog::EKmdAuthenticationFailed:
       
   127         	return R_KMD_CRACK_AUTH_FAILED;
       
   128         default:
       
   129             LOG_(" Calling CVpnDialogManagerBase::GetNoteTextId()");
       
   130             return CVpnDialogManager::GetNoteTextId(aNoteDialogId);
       
   131         }
       
   132     }
       
   133 
       
   134 CVpnDialogShower* CVpnDialogManager::GetDialogShowerL()
       
   135     {
       
   136     LOG_("-> CVpnDialogManager::GetDialogShowerL()");
       
   137     if (iDialogShower)
       
   138         {
       
   139         LOG_("<- CVpnDialogManager::GetDialogShowerL() (old shower reused)");
       
   140         return iDialogShower;
       
   141         }
       
   142     else
       
   143         {
       
   144         iDialogShower = new (ELeave) CVpnDialogShower();
       
   145         LOG_("<- CVpnDialogManager::GetDialogShowerL() (new shower instantiated)");
       
   146         return iDialogShower;
       
   147         }
       
   148     }
       
   149 
       
   150 MVpnDialog* CVpnDialogManager::ShowNoteDialogL(MVpnNotifierCallback* aNotifier, TInt aNoteDialogId)
       
   151     {
       
   152     LOG_("-> CVpnDialogManager::ShowNoteDialogL()");
       
   153     LOG_("<- CVpnDialogManager::ShowNoteDialogL()");
       
   154     return GetDialogShowerL()->ShowNoteDialogL(aNotifier, GetNoteTextId(aNoteDialogId));    
       
   155     }
       
   156 
       
   157 CVpnDialogManager::~CVpnDialogManager()
       
   158     {
       
   159     LOG_("-> CVpnDialogManager::~CVpnDialogManager()");
       
   160     delete iDialogShower;
       
   161     LOG_("<- CVpnDialogManager::~CVpnDialogManager()");
       
   162     }
       
   163