vpnui/vpndialogmanager/src/vpndialogshower.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:   Implementation of VPN dialog classes
       
    15 *
       
    16 */
       
    17 
       
    18 #include <e32std.h>
       
    19 #include <e32base.h>
       
    20 #include <eikenv.h>
       
    21 #include <bautils.h>
       
    22 #include <eikseced.h>
       
    23 #include <aknlists.h>
       
    24 #include <aknselectionlist.h>
       
    25 #include <eikclb.h> 
       
    26 #include <eiktxlbm.h>  //CEikTextListBoxModel
       
    27 #include <eikbtgpc.h>  //CEikButtonGroupContainer
       
    28 #include <eikrutil.h>  //EikResourceUtils
       
    29 #include <eikclbd.h>   //CColumnListBoxData
       
    30 #include <eiklabel.h>  //CEikLabel
       
    31 #include <eikcapc.h>  // for CEikCaptionedControl
       
    32 #include <avkon.rsg>
       
    33 #include <StringLoader.h>
       
    34 #include <AknProgressDialog.h>
       
    35 
       
    36 #include <vpnecomnotifier.rsg>
       
    37 
       
    38 #include "vpndialogshower.h"
       
    39 #include "vpnnotifierdefs.h"
       
    40 
       
    41 #include "logvpncommon.h"
       
    42 
       
    43 #include <layoutmetadata.cdl.h>
       
    44 
       
    45 
       
    46 CVpnInfoDialog* CVpnDialogShower::ShowNoteDialogL(MVpnNotifierCallback* aNotifier, TInt aTextId)
       
    47     {
       
    48     CVpnInfoDialog* dlg = new(ELeave)CVpnInfoDialog(aNotifier);
       
    49     HBufC* text = CEikonEnv::Static()->AllocReadResourceLC(aTextId);
       
    50     (static_cast<CAknInformationNote*>(dlg))->SetTimeout(CAknNoteDialog::ELongTimeout); 
       
    51     dlg->ExecuteLD(*text);
       
    52     CleanupStack::PopAndDestroy(); // text
       
    53     return dlg;
       
    54     }
       
    55 
       
    56 
       
    57 // CVpnDialogShower
       
    58 
       
    59 CVpnDialog* CVpnDialogShower::GetUserIdentityDlgL(MVpnNotifierCallback* aNotifier, const TDesC8& aInput)
       
    60     {
       
    61     LOG_("-> CVpnDialogShower::GetUserIdentityDlgL()");
       
    62     CVpnUserIdentityDlg* dialog = new (ELeave) CVpnUserIdentityDlg(aNotifier, aInput);
       
    63     dialog->ExecuteLD(R_VPN_USER_IDENTITY_QUERY);
       
    64     LOG_("<- CVpnDialogShower::GetUserIdentityDlgL()");
       
    65     return dialog;
       
    66     }
       
    67     
       
    68 CVpnDialog* CVpnDialogShower::GetPolicyUpdateConfirmationDlgL(MVpnNotifierCallback* aNotifier, const TDesC8& /*aInput*/)
       
    69     {
       
    70     CVpnDialog* dialog = new (ELeave) CVpnDialog(aNotifier);
       
    71     dialog->ExecuteLD(R_VPN_POLICY_UPDATE_CONFIRMATION_QUERY);
       
    72     return dialog;
       
    73     }
       
    74 
       
    75 CVpnDialog* CVpnDialogShower::GetPKCS12PasswordDlgL(MVpnNotifierCallback* aNotifier)
       
    76     {
       
    77     LOG_("-> CVpnDialogShower::GetPKCS12PasswordDlgL()");
       
    78     LOG_(" Instantiating dialog");
       
    79     CPKCS12PasswordDlg * dialog = new (ELeave) CPKCS12PasswordDlg(aNotifier);
       
    80     LOG_(" Executing dialog");
       
    81     dialog->ExecuteLD(R_VPN_PKCS12_PASSWORD_QUERY);
       
    82     LOG_("<- CVpnDialogShower::GetPKCS12PasswordDlgL()");
       
    83     return dialog;
       
    84     }
       
    85 
       
    86 // CKmdDialogShower
       
    87 
       
    88 CVpnMultiLineDialog* CVpnDialogShower::GetUserPwdDlgL(MVpnNotifierCallback* aNotifier, const TDesC8& aInput)
       
    89     {
       
    90     iValue1 = KNullDesC;
       
    91     iValue2 = KNullDesC;
       
    92     CKmdDlg* dialog = CKmdDlg::NewL(aNotifier, iValue1, iValue2, aInput, CAknQueryDialog::ENoTone);
       
    93     dialog->ExecuteLD(R_KMD_CRACK_UNPW_QUERY);
       
    94     return dialog;
       
    95     }
       
    96 
       
    97 CVpnMultiLineDialog* CVpnDialogShower::GetSecurIdDlgL(MVpnNotifierCallback* aNotifier, const TDesC8& aInput)
       
    98     {
       
    99     iValue1 = KNullDesC;
       
   100     iValue2 = KNullDesC;
       
   101     CKmdDlg* dialog = CKmdDlg::NewL(aNotifier, iValue1, iValue2, aInput, CAknQueryDialog::ENoTone);
       
   102     dialog->ExecuteLD(R_KMD_CRACK_SID_QUERY);
       
   103     return dialog;
       
   104     }
       
   105 
       
   106 CVpnMultiLineDialog* CVpnDialogShower::GetSecurIdNextDlgL(MVpnNotifierCallback* aNotifier, const TDesC8& aInput)
       
   107     {
       
   108     iValue1 = KNullDesC;
       
   109     iValue2 = KNullDesC;
       
   110     CKmdDlg* dialog = CKmdDlg::NewL(aNotifier, iValue1, iValue2, aInput, CAknQueryDialog::ENoTone);
       
   111     dialog->ExecuteLD(R_KMD_CRACK_SID_NEXT_QUERY);
       
   112     return dialog;
       
   113     }
       
   114 
       
   115 /**
       
   116    Creates the "Import policy 'XXX'?" dialog. The install filename in aInput has been
       
   117    passed on by VPNPolIns.
       
   118  */
       
   119 CVpnDialog* CVpnDialogShower::GetPolicyImportConfirmationDlgL(MVpnNotifierCallback* aNotifier, const TDesC8& aInput)
       
   120     {
       
   121     LOG_("-> CVpnDialogShower::GetPolicyImportConfirmationDlgL");
       
   122 
       
   123     HBufC* tempBuf = HBufC::NewLC(aInput.Length());
       
   124     tempBuf->Des().Copy(aInput);
       
   125 
       
   126     HBufC* str = StringLoader::LoadLC(R_VPN_STR_QUEST_IMPORT_POLICY_STR, *tempBuf);
       
   127 
       
   128     CVpnDialog* dialog = new (ELeave) CVpnDialog(aNotifier);
       
   129     dialog->PrepareLC(R_VPN_QUEST_IMPORT_POLICY);
       
   130     dialog->SetPromptL(*str);
       
   131     dialog->RunLD();
       
   132 
       
   133     CleanupStack::PopAndDestroy(2); // str, tempBuf
       
   134 
       
   135     LOG_("<- CVpnDialogShower::GetPolicyImportConfirmationDlgL");
       
   136     return dialog;
       
   137     }
       
   138 
       
   139 CVpnDialog* CVpnDialogShower::GetDevLockConfirmationDlgL(MVpnNotifierCallback* aNotifier, 
       
   140                                                          const TDesC8& aInput)
       
   141     {
       
   142     LOG_("-> CVpnDialogShower::GetDevLockConfirmationDlgL");
       
   143 
       
   144     HBufC* tempBuf = HBufC::NewLC(aInput.Length());
       
   145     tempBuf->Des().Copy(aInput);
       
   146 
       
   147     LOG_1(" Dialog string resource ID: 0x%x", R_VPN_STR_QUEST_APPLY_DEVLOCK_STR);
       
   148     LOG_1(" Dialog resource ID: 0x%x", R_VPN_QUEST_APPLY_DEVLOCK);
       
   149     HBufC* str = StringLoader::LoadLC(R_VPN_STR_QUEST_APPLY_DEVLOCK_STR, *tempBuf);
       
   150 
       
   151     CVpnDialog* dialog = new (ELeave) CVpnDialog(aNotifier);
       
   152     dialog->PrepareLC(R_VPN_QUEST_APPLY_DEVLOCK);
       
   153     dialog->SetPromptL(*str);
       
   154     dialog->RunLD();
       
   155 
       
   156     CleanupStack::PopAndDestroy(2); // str, tempBuf
       
   157 
       
   158     LOG_("<- CVpnDialogShower::GetDevLockConfirmationDlgL");
       
   159     return dialog;
       
   160     }
       
   161 
       
   162 /**
       
   163  * Implementation of the wait dialog for policy installation process
       
   164  *
       
   165  */
       
   166 CVpnWaitDialog* CVpnDialogShower::GetPolicyImportProgressDlgL(MVpnNotifierCallback* aNotifier, const TDesC8& /*aInput*/)
       
   167     {
       
   168     LOG_("-> CVpnDialogShower::GetPolicyImportProgressDlgL()");
       
   169     
       
   170     CVpnWaitDialog* dialog = new ( ELeave ) CVpnWaitDialog(aNotifier);
       
   171     dialog->SetTone( CAknNoteDialog::ENoTone );
       
   172     dialog->SetCallback( this );
       
   173     dialog->ExecuteLD(R_VPN_WAIT_IMPORT_POLICY);
       
   174 
       
   175     LOG_("<- CVpnDialogShower::GetPolicyImportProgressDlgL()");
       
   176     return dialog;
       
   177     }
       
   178 
       
   179 CVpnWaitDialog* CVpnDialogShower::GetGenericProgressDlgL(MVpnNotifierCallback* aNotifier, const TDesC8& /*aInput*/)
       
   180     {
       
   181     LOG_("-> CVpnDialogShower::GetGenericProgressDlgL()");
       
   182     
       
   183     CVpnWaitDialog* dialog = new ( ELeave ) CVpnWaitDialog(aNotifier);
       
   184     dialog->SetTone( CAknNoteDialog::ENoTone );
       
   185     dialog->SetCallback( this );
       
   186     dialog->ExecuteLD(R_VPN_WAIT_PROCESSING);
       
   187 
       
   188     LOG_1(" Dialog 0x%08x", dialog);
       
   189     
       
   190     LOG_("<- CVpnDialogShower::GetGenericProgressDlgL()");
       
   191     return dialog;
       
   192     }
       
   193 
       
   194 
       
   195 // CVpnUserIdentityDlg
       
   196 
       
   197 CVpnUserIdentityDlg::CVpnUserIdentityDlg(MVpnNotifierCallback* aNotifier, const TDesC8& aInput) : CVpnDialog(aNotifier)
       
   198     {
       
   199     iInput.Set(aInput);
       
   200     }
       
   201 
       
   202 void CVpnUserIdentityDlg::PreLayoutDynInitL()
       
   203     {
       
   204     if (iInput.Length() > 0)
       
   205         {
       
   206         HBufC* dialogInput = VpnNotifierUtil::To16BitL(iInput);
       
   207         CleanupStack::PushL(dialogInput);
       
   208         
       
   209         TInt paramSepOffset = dialogInput->Locate(KDialogParamSep);
       
   210         TInt domainNameLength = paramSepOffset;
       
   211         TInt proposedUserIdentityLength = dialogInput->Length() - paramSepOffset - 1; // 1 for separator
       
   212         
       
   213         if (paramSepOffset <= 0 || domainNameLength <= 0 || proposedUserIdentityLength <= 0)
       
   214             {
       
   215             User::Leave(KErrArgument);
       
   216             }
       
   217 
       
   218         TPtrC domainName(dialogInput->Left(paramSepOffset));
       
   219         TPtrC proposedUserIdentity(dialogInput->Mid(paramSepOffset + 1));
       
   220 
       
   221         HBufC* prompt = StringLoader::LoadLC(R_VPN_USER_IDENTITY, domainName);
       
   222         
       
   223         CAknQueryControl* control = static_cast<CAknQueryControl*>(Control(EEikCidPassword));
       
   224         control->SetPromptL(*prompt);
       
   225         control->SetTextL(proposedUserIdentity);
       
   226         
       
   227         CleanupStack::PopAndDestroy(2); // prompt, dialogInput 
       
   228         }
       
   229     }
       
   230 
       
   231 void CVpnUserIdentityDlg::GetOutputL(TVpnDialogOutput& aOutput, TInt /*aButtonId*/)
       
   232     {
       
   233     CAknQueryControl* control = static_cast<CAknQueryControl*>(Control(EEikCidPassword));
       
   234 
       
   235     TBuf<64> userIdentity;
       
   236     control->GetText(userIdentity);
       
   237     
       
   238     HBufC8* userIdentity8 = VpnNotifierUtil::To8BitL(userIdentity);
       
   239     CleanupStack::PushL(userIdentity8);
       
   240     aOutput.iOutBuf.Copy(*userIdentity8);
       
   241     CleanupStack::PopAndDestroy(userIdentity8);
       
   242     }
       
   243     
       
   244     
       
   245     
       
   246 CPKCS12PasswordDlg::CPKCS12PasswordDlg(MVpnNotifierCallback* aNotifier) : CVpnDialog(aNotifier)
       
   247     {
       
   248     LOG_("-> CVpnDialogShower::CPKCS12PasswordDlg()");
       
   249     LOG_("<- CVpnDialogShower::CPKCS12PasswordDlg()");
       
   250     }
       
   251 
       
   252 void CPKCS12PasswordDlg::GetOutputL(TVpnDialogOutput& aOutput, TInt /*aButtonId*/)
       
   253     {
       
   254     LOG_("-> CVpnDialogShower::GetOutputL()");
       
   255 
       
   256     CAknQueryControl* control = static_cast<CAknQueryControl*>(Control(EEikCidPassword));
       
   257 
       
   258     TBuf<64> password;
       
   259     control->GetText(password);
       
   260 
       
   261     LOG_1(" Password: '%S'", &password);
       
   262 
       
   263     HBufC8* password8 = VpnNotifierUtil::To8BitL(password);
       
   264     CleanupStack::PushL(password8);
       
   265     aOutput.iOutBuf.Copy(*password8);
       
   266     CleanupStack::PopAndDestroy(password8);
       
   267 
       
   268     LOG_("<- CVpnDialogShower::GetOutputL()");
       
   269     }
       
   270 
       
   271 // CVpnDialog
       
   272 CVpnDialog::CVpnDialog(MVpnNotifierCallback* aNotifier) : iNotifier(aNotifier)
       
   273     {
       
   274     }
       
   275 
       
   276 void CVpnDialog::CancelL()
       
   277     {
       
   278     TryExitL(EEikBidCancel);
       
   279     }
       
   280 
       
   281 TBool CVpnDialog::OkToExitL(TInt aButtonId)
       
   282     {
       
   283 
       
   284     if (aButtonId == EAknSoftkeyOptions)
       
   285         {
       
   286         DisplayMenuL(); //CAknDialog method
       
   287         return EFalse;
       
   288         }
       
   289 
       
   290     if (aButtonId == EEikBidCancel ||
       
   291         aButtonId == EAknSoftkeyBack ||
       
   292         aButtonId == EAknSoftkeyNo)
       
   293         {
       
   294         if (AllowCancel())
       
   295             {
       
   296             iNotifier->DialogComplete(KErrCancel);
       
   297             }
       
   298         else
       
   299             {
       
   300             return EFalse;
       
   301             }
       
   302         }
       
   303     else
       
   304         {
       
   305         TVpnDialogOutput dlgOutput;
       
   306         GetOutputL(dlgOutput, aButtonId);
       
   307         iNotifier->DialogCompleteL(KErrNone, dlgOutput);
       
   308         }
       
   309     return ETrue;
       
   310     }
       
   311 
       
   312 TBool CVpnDialog::AllowCancel()
       
   313     {
       
   314     return ETrue;
       
   315     }
       
   316     
       
   317 void CVpnDialog::GetOutputL(TVpnDialogOutput& /*aOutput*/, TInt /*aButtonId*/)
       
   318     {
       
   319     }
       
   320 
       
   321 
       
   322 CVpnWaitDialog::CVpnWaitDialog(MVpnNotifierCallback* aNotifier) : CAknWaitDialog(NULL, ETrue), 
       
   323                                                             iNotifier(aNotifier)
       
   324     {
       
   325     }
       
   326 
       
   327 void CVpnWaitDialog::CancelL()
       
   328     {
       
   329     TryExitL(EEikBidCancel);
       
   330     }
       
   331 
       
   332 TBool CVpnWaitDialog::OkToExitL(TInt aButtonId)
       
   333     {
       
   334 
       
   335     if (aButtonId == EAknSoftkeyOptions)
       
   336         {
       
   337         return EFalse;
       
   338         }
       
   339 
       
   340     if (aButtonId == EEikBidCancel ||
       
   341         aButtonId == EAknSoftkeyBack ||
       
   342         aButtonId == EAknSoftkeyNo)
       
   343         {
       
   344         if (AllowCancel())
       
   345             {
       
   346             iNotifier->DialogComplete(KErrCancel);
       
   347             }
       
   348         else
       
   349             {
       
   350             return EFalse;
       
   351             }
       
   352         }
       
   353     else
       
   354         {
       
   355         TVpnDialogOutput dlgOutput;
       
   356         GetOutputL(dlgOutput, aButtonId);
       
   357         iNotifier->DialogCompleteL(KErrNone, dlgOutput);
       
   358         }
       
   359     return ETrue;
       
   360     }
       
   361 
       
   362 TBool CVpnWaitDialog::AllowCancel()
       
   363     {
       
   364     return ETrue;
       
   365     }
       
   366 
       
   367 void CVpnWaitDialog::GetOutputL(TVpnDialogOutput& /*aOutput*/, TInt /*aButtonId*/)
       
   368     {
       
   369     }
       
   370 
       
   371 // CVpnMultiLineDialog
       
   372 CVpnMultiLineDialog::CVpnMultiLineDialog(MVpnNotifierCallback* aNotifier, const TTone& aTone)
       
   373 : CAknMultiLineDataQueryDialog(aTone), iNotifier(aNotifier)
       
   374     {
       
   375     }
       
   376 
       
   377 
       
   378 CVpnMultiLineDialog* CVpnMultiLineDialog::NewL(MVpnNotifierCallback* aNotifier, TDes& aData1, TDes& aData2, TTone aTone)
       
   379     {
       
   380     CVpnMultiLineDialog* self = new (ELeave) CVpnMultiLineDialog(aNotifier, aTone);
       
   381     CleanupStack::PushL(self);
       
   382 
       
   383     // Set the query data for first and second line
       
   384     // Must call CAknMultiLineDataQueryDialog::SetDataL method
       
   385     // during second phase construction (NewL method).
       
   386     self->SetDataL(aData1,aData2);
       
   387 
       
   388     CleanupStack::Pop(self);
       
   389     return self;
       
   390     }
       
   391 
       
   392 void CVpnMultiLineDialog::CancelL()
       
   393     {
       
   394     TryExitL(EEikBidCancel);
       
   395     }
       
   396 
       
   397 TBool CVpnMultiLineDialog::OkToExitL(TInt aButtonId)
       
   398     {
       
   399     	if (!CAknMultiLineDataQueryDialog::OkToExitL(aButtonId))
       
   400        	   	{
       
   401         	return EFalse;
       
   402         	}  
       
   403     if (aButtonId == EEikBidCancel)
       
   404         {
       
   405         if (AllowCancel())
       
   406             {
       
   407             iNotifier->DialogComplete(KErrCancel);
       
   408             }
       
   409         else
       
   410             {
       
   411             return EFalse;
       
   412             }
       
   413         }
       
   414     else
       
   415         {
       
   416         TVpnDialogOutput dlgOutput;
       
   417         GetOutputL(dlgOutput, aButtonId);
       
   418         iNotifier->DialogCompleteL(KErrNone, dlgOutput);
       
   419         }
       
   420     return ETrue;
       
   421     }
       
   422 
       
   423 TBool CVpnMultiLineDialog::AllowCancel()
       
   424     {
       
   425     return ETrue;
       
   426     }
       
   427 
       
   428 void CVpnMultiLineDialog::GetOutputL(TVpnDialogOutput& /*aOutput*/, TInt /*aButtonId*/)
       
   429     {
       
   430     }
       
   431 
       
   432 // CVpnInfoDialog class
       
   433 CVpnInfoDialog::CVpnInfoDialog(MVpnNotifierCallback* aNotifier)
       
   434 : iNotifier(aNotifier)
       
   435     {
       
   436     }
       
   437 
       
   438 CVpnInfoDialog::~CVpnInfoDialog()
       
   439     {
       
   440     TIPSecDialogOutput dlgOutput;
       
   441     TRAPD(err, GetOutputL(dlgOutput, EEikBidCancel));
       
   442     if ( iNotifier )
       
   443     	TRAP(err, iNotifier->DialogCompleteL(KErrNone, dlgOutput));
       
   444     }
       
   445     
       
   446 void CVpnInfoDialog::CancelL()
       
   447     {
       
   448     TryExitL(EEikBidCancel);
       
   449     }
       
   450 
       
   451 TBool CVpnInfoDialog::OkToExitL(TInt aButtonId)
       
   452     {
       
   453     if (aButtonId == EEikBidCancel)
       
   454         {
       
   455         if (AllowCancel())
       
   456             {
       
   457             iNotifier->DialogComplete(KErrCancel);
       
   458             }
       
   459         else
       
   460             {
       
   461             return EFalse;
       
   462             }
       
   463         }
       
   464     if (aButtonId == EAknSoftkeyEmpty)
       
   465         {
       
   466         return ETrue;
       
   467         }
       
   468     else
       
   469         {
       
   470         TVpnDialogOutput dlgOutput;
       
   471         GetOutputL(dlgOutput, aButtonId);
       
   472         iNotifier->DialogCompleteL(KErrNone, dlgOutput);
       
   473         }
       
   474     return ETrue;
       
   475     }
       
   476 
       
   477 TBool CVpnInfoDialog::AllowCancel()
       
   478     {
       
   479     return ETrue;
       
   480     }
       
   481 
       
   482 // Useless? Shouldn't leave in any case.
       
   483 void CVpnInfoDialog::GetOutputL(TVpnDialogOutput& /*aOutput*/, TInt /*aButtonId*/)
       
   484     {
       
   485 
       
   486     }
       
   487 
       
   488 // CKmdDlg
       
   489 
       
   490 CKmdDlg::CKmdDlg(MVpnNotifierCallback* aNotifier, const TTone& aTone) : CVpnMultiLineDialog(aNotifier, aTone)
       
   491     {
       
   492     }
       
   493 
       
   494 CKmdDlg::CKmdDlg(MVpnNotifierCallback* aNotifier, const TDesC8& aInput, const TTone& aTone)
       
   495 : CVpnMultiLineDialog(aNotifier, aTone)
       
   496     {
       
   497     iInput.Set(aInput);
       
   498     }
       
   499 
       
   500 CKmdDlg* CKmdDlg::NewL(MVpnNotifierCallback* aNotifier, TDes& aData1, TDes& aData2, TTone aTone)
       
   501     {
       
   502     CKmdDlg* self = new (ELeave) CKmdDlg(aNotifier, aTone);
       
   503     CleanupStack::PushL(self);
       
   504     // Set the query data for first and second line
       
   505     // Must call CAknMultiLineDataQueryDialog::SetDataL method
       
   506     // during second phase construction (NewL method).
       
   507     self->SetDataL(aData1, aData2);
       
   508     CleanupStack::Pop();
       
   509     return self;
       
   510     }
       
   511 
       
   512 CKmdDlg* CKmdDlg::NewL(MVpnNotifierCallback* aNotifier, TDes& aData1, TDes& aData2, const TDesC8& aInput, TTone aTone)
       
   513     {
       
   514     CKmdDlg* self = new (ELeave) CKmdDlg(aNotifier, aInput, aTone);
       
   515     CleanupStack::PushL(self);
       
   516     // Set the query data for first and second line
       
   517     // Must call CAknMultiLineDataQueryDialog::SetDataL method
       
   518     // during second phase construction (NewL method).
       
   519     self->SetDataL(aData1, aData2);
       
   520     CleanupStack::Pop();
       
   521     return self;
       
   522     }
       
   523 
       
   524 void CKmdDlg::PreLayoutDynInitL()
       
   525     {
       
   526     SetMaxLengthOfFirstEditor(KMaxAuthenticationInputLength);
       
   527     SetMaxLengthOfSecondEditor(KMaxAuthenticationInputLength);
       
   528     
       
   529     CAknMultiLineDataQueryDialog::PreLayoutDynInitL();
       
   530     
       
   531     CAknQueryControl* usernameControl = static_cast<CAknQueryControl*>(Control(EEikCidPassword));
       
   532     
       
   533     if (iInput.Length() > 0)
       
   534         {
       
   535         HBufC16* usernameTextH16 = VpnNotifierUtil::To16BitL(iInput);
       
   536         CleanupStack::PushL(usernameTextH16);
       
   537         usernameControl->SetTextL(*usernameTextH16);
       
   538         CleanupStack::PopAndDestroy(); // usernameTextH16
       
   539         if (Layout_Meta_Data::IsLandscapeOrientation())
       
   540         	{
       
   541         	MakeLeftSoftkeyVisible(ETrue);
       
   542         	}
       
   543         }
       
   544     }
       
   545 
       
   546 void CKmdDlg::SetInitialCurrentLine()
       
   547     {
       
   548     CAknMultiLineDataQueryDialog::SetInitialCurrentLine();
       
   549     if (!Layout_Meta_Data::IsLandscapeOrientation())
       
   550 		{
       
   551 		CEikCaptionedControl* passwordLine(NULL);
       
   552 	    if (iInput.Length() > 0)
       
   553         	{
       
   554         	passwordLine = Line(EEikCidPasswordConfirm);
       
   555         	}
       
   556     	else
       
   557         	{
       
   558         	passwordLine = Line(EEikCidPassword);
       
   559         	}
       
   560         ASSERT(passwordLine);	
       
   561         TRAP_IGNORE( TryChangeFocusToL(passwordLine->iId) );	
       
   562     	}
       
   563 
       
   564 	HandleResourceChange(KEikDynamicLayoutVariantSwitch);
       
   565     }
       
   566 
       
   567 void CKmdDlg::GetOutputL(TVpnDialogOutput& aOutput, TInt /*aButtonId*/)
       
   568     {
       
   569     CAknQueryControl* firstControl = static_cast<CAknQueryControl*>(Control(EEikCidPassword));
       
   570     firstControl->GetText(aOutput.iOutBuf);
       
   571 
       
   572     CAknQueryControl* secondControl = static_cast<CAknQueryControl*>(Control(EEikCidPasswordConfirm));
       
   573     secondControl->GetText(aOutput.iOutBuf2);
       
   574     }