"Fossies" - the Fresh Open Source Software Archive

Member "UXP-2019.06.08/other-licenses/7zstub/src/CPP/7zip/UI/FileManager/PasswordDialog.cpp" (8 Jun 2019, 1166 Bytes) of package /linux/www/UXP-2019.06.08.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // PasswordDialog.cpp
    2 
    3 #include "StdAfx.h"
    4 
    5 #include "PasswordDialog.h"
    6 
    7 #ifdef LANG
    8 #include "LangUtils.h"
    9 #endif
   10 
   11 #ifdef LANG
   12 static const UInt32 kLangIDs[] =
   13 {
   14   IDT_PASSWORD_ENTER,
   15   IDX_PASSWORD_SHOW
   16 };
   17 #endif
   18 
   19 void CPasswordDialog::ReadControls()
   20 {
   21   _passwordEdit.GetText(Password);
   22   ShowPassword = IsButtonCheckedBool(IDX_PASSWORD_SHOW);
   23 }
   24 
   25 void CPasswordDialog::SetTextSpec()
   26 {
   27   _passwordEdit.SetPasswordChar(ShowPassword ? 0: TEXT('*'));
   28   _passwordEdit.SetText(Password);
   29 }
   30 
   31 bool CPasswordDialog::OnInit()
   32 {
   33   #ifdef LANG
   34   LangSetWindowText(*this, IDD_PASSWORD);
   35   LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
   36   #endif
   37   _passwordEdit.Attach(GetItem(IDE_PASSWORD_PASSWORD));
   38   CheckButton(IDX_PASSWORD_SHOW, ShowPassword);
   39   SetTextSpec();
   40   return CModalDialog::OnInit();
   41 }
   42 
   43 bool CPasswordDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
   44 {
   45   if (buttonID == IDX_PASSWORD_SHOW)
   46   {
   47     ReadControls();
   48     SetTextSpec();
   49     return true;
   50   }
   51   return CDialog::OnButtonClicked(buttonID, buttonHWND);
   52 }
   53 
   54 void CPasswordDialog::OnOK()
   55 {
   56   ReadControls();
   57   CModalDialog::OnOK();
   58 }