krb5 commit: KfW GUI -- clean up 'About' dialog

Benjamin Kaduk kaduk at MIT.EDU
Mon Aug 27 11:52:25 EDT 2012


https://github.com/krb5/krb5/commit/3b976d4c094f0d0589468fda5f4debbb50345f20
commit 3b976d4c094f0d0589468fda5f4debbb50345f20
Author: Kevin Wasserman <kevin.wasserman at painless-security.com>
Date:   Thu Jun 28 18:16:21 2012 -0400

    KfW GUI -- clean up 'About' dialog
    
    By default, hide the debug list of loaded modules; change LeashView.cpp
    and recompile to get the list.
    
    Signed-off-by: Kevin Wasserman <kevin.wasserman at painless-security.com>
    
    ticket: 7291 (new)
    queue: kfw
    target_version: 1.10.4
    tags: pullup

 src/windows/leash/LeashAboutBox.cpp |   43 +++++++++++++++++++++++++++-------
 src/windows/leash/LeashAboutBox.h   |    1 +
 src/windows/leash/LeashView.cpp     |    2 +
 3 files changed, 37 insertions(+), 9 deletions(-)

diff --git a/src/windows/leash/LeashAboutBox.cpp b/src/windows/leash/LeashAboutBox.cpp
index 8c6f7f4..d8e3fde 100644
--- a/src/windows/leash/LeashAboutBox.cpp
+++ b/src/windows/leash/LeashAboutBox.cpp
@@ -33,6 +33,7 @@ static char THIS_FILE[] = __FILE__;
 
 CLeashAboutBox::CLeashAboutBox(CWnd* pParent /*=NULL*/)
 	: CDialog(CLeashAboutBox::IDD, pParent)
+        , m_bListModules(FALSE)
 {
     m_missingFileError = FALSE;
 
@@ -244,20 +245,44 @@ BOOL CLeashAboutBox::OnInitDialog()
     CDialog::OnInitDialog();
 
     // XXX - we need to add some sensible behavior on error.
+    // We need to get the version info and display it...
     SetVersionInfo(IDC_ABOUT_VERSION, IDC_ABOUT_COPYRIGHT);
 
     if (!CLeashApp::m_hToolHelp32 && !CLeashApp::m_hPsapi)
         m_missingFileError = TRUE;
 
-    m_radio_LeashDLLs.SetCheck(TRUE);
-    OnLeashModules();
-
-    // We need to get the version info and display it...
-    HighlightFirstItem();
-
-    if (!CLeashApp::m_hPsapi)
-        GetDlgItem(IDC_PROPERTIES)->EnableWindow(FALSE);
-
+    if (m_bListModules) {
+        m_radio_LeashDLLs.SetCheck(TRUE);
+        OnLeashModules();
+
+        HighlightFirstItem();
+
+        if (!CLeashApp::m_hPsapi)
+            GetDlgItem(IDC_PROPERTIES)->EnableWindow(FALSE);
+    } else {
+        m_radio_LeashDLLs.ShowWindow(SW_HIDE);
+        GetDlgItem(IDC_NOT_LOADED_MODULES)->ShowWindow(SW_HIDE);
+        GetDlgItem(IDC_ALL_MODULES)->ShowWindow(SW_HIDE);
+        GetDlgItem(IDC_PROPERTIES)->ShowWindow(SW_HIDE);
+        GetDlgItem(IDC_STATIC_MODULES_LOADED)->ShowWindow(SW_HIDE);
+        GetDlgItem(IDC_STATIC_NO_OF_MODULES)->ShowWindow(SW_HIDE);
+        m_LB_DLLsLoaded.ShowWindow(SW_HIDE);
+        // shrink window, move 'OK' button
+        const int hideDiff = 175;
+        RECT okRect;
+        CWnd* pOK = GetDlgItem(IDOK);
+        pOK->GetWindowRect(&okRect);
+        ScreenToClient(&okRect);
+        pOK->SetWindowPos(0, okRect.left, okRect.top - hideDiff,
+                          0, 0, SWP_NOZORDER | SWP_NOSIZE);
+        RECT dlgRect;
+        GetWindowRect( &dlgRect );
+
+        SetWindowPos(0,0,0,
+                     dlgRect.right-dlgRect.left,
+                     dlgRect.bottom-dlgRect.top - hideDiff,
+                     SWP_NOZORDER|SWP_NOMOVE);
+    }
     return TRUE;  // return TRUE unless you set the focus to a control
     // EXCEPTION: OCX Property Pages should return FALSE
 }
diff --git a/src/windows/leash/LeashAboutBox.h b/src/windows/leash/LeashAboutBox.h
index 34e1dac..c6dbfc1 100644
--- a/src/windows/leash/LeashAboutBox.h
+++ b/src/windows/leash/LeashAboutBox.h
@@ -45,6 +45,7 @@ public:
     CButton	m_radio_LeashDLLs;
     CListBox	m_LB_DLLsLoaded;
     CString	m_fileItem;
+    BOOL        m_bListModules;
     //}}AFX_DATA
 
 
diff --git a/src/windows/leash/LeashView.cpp b/src/windows/leash/LeashView.cpp
index cfa985c..34b6b7d 100644
--- a/src/windows/leash/LeashView.cpp
+++ b/src/windows/leash/LeashView.cpp
@@ -2110,6 +2110,8 @@ LRESULT CLeashView::OnTrayIcon(WPARAM wParam, LPARAM lParam)
 VOID CLeashView::OnAppAbout()
 {
     CLeashAboutBox leashAboutBox;
+    // To debug loaded dlls:
+    // leashAboutBox.m_bListModules = TRUE;
     leashAboutBox.DoModal();
 }
 


More information about the cvs-krb5 mailing list