summaryrefslogtreecommitdiffstats
path: root/src/windows/leash/AfsProperties.cpp
diff options
context:
space:
mode:
authorSam Hartman <hartmans@mit.edu>2011-09-28 21:02:14 +0000
committerSam Hartman <hartmans@mit.edu>2011-09-28 21:02:14 +0000
commitcaef99b21536d9e8c2f9c637fcf020b4e082db5d (patch)
treeb360ec8449876ea170691685cde758d9849fc8ef /src/windows/leash/AfsProperties.cpp
parent8481c14298a1886f63bec0d7cdfd800a86b4c127 (diff)
downloadkrb5-caef99b21536d9e8c2f9c637fcf020b4e082db5d.tar.gz
krb5-caef99b21536d9e8c2f9c637fcf020b4e082db5d.tar.xz
krb5-caef99b21536d9e8c2f9c637fcf020b4e082db5d.zip
Initial import of KFW 3.2.2 Leash32 code
Signed-off-by: Alexey Melnikov <aamelnikov@gmail.com> git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25278 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/windows/leash/AfsProperties.cpp')
-rw-r--r--src/windows/leash/AfsProperties.cpp123
1 files changed, 123 insertions, 0 deletions
diff --git a/src/windows/leash/AfsProperties.cpp b/src/windows/leash/AfsProperties.cpp
new file mode 100644
index 000000000..dabcdfd91
--- /dev/null
+++ b/src/windows/leash/AfsProperties.cpp
@@ -0,0 +1,123 @@
+// AfsProperties.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "leash.h"
+#include "AfsProperties.h"
+
+/* This should be set to something other than 0 or 1 (the valid values) */
+#define INVALID_AFS_STATUS_VALUE 2
+#define IS_INVALID_AFS_STATUS_VALUE(x) ((x != 0) && (x != 1))
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CAfsProperties dialog
+
+
+CAfsProperties::CAfsProperties(CWnd* pParent /*=NULL*/)
+ : CDialog(CAfsProperties::IDD, pParent)
+{
+ m_newAfsStatus = 0;
+ m_oldAfsStatus = 0;
+
+ //{{AFX_DATA_INIT(CAfsProperties)
+ // NOTE: the ClassWizard will add member initialization here
+ //}}AFX_DATA_INIT
+}
+
+
+void CAfsProperties::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CAfsProperties)
+ // NOTE: the ClassWizard will add DDX an3d DDV calls here
+ //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(CAfsProperties, CDialog)
+ //{{AFX_MSG_MAP(CAfsProperties)
+ ON_BN_CLICKED(IDC_BUTTON_AFS_PROPERTIES, OnButtonAfsProperties)
+ ON_BN_CLICKED(IDC_RADIO_AFS_ENABLED, OnRadioAfsEnabled)
+ ON_BN_CLICKED(IDC_RADIO_AFS_DISABLED, OnRadioAfsDisabled)
+ ON_COMMAND(ID_HELP, OnHelp)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CAfsProperties message handlers
+
+BOOL
+CAfsProperties::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ // Get State* of Destroy Tickets On Exit
+ m_pApp = AfxGetApp();
+
+ m_oldAfsStatus = m_pApp->GetProfileInt("Settings", "AfsStatus",
+ INVALID_AFS_STATUS_VALUE);
+ if (IS_INVALID_AFS_STATUS_VALUE(m_oldAfsStatus))
+ {
+ // set the default
+ m_pApp->WriteProfileInt("Settings", "AfsStatus", 1);
+ m_oldAfsStatus = 1;
+ }
+
+ m_newAfsStatus = m_oldAfsStatus;
+
+ int enabled = (m_oldAfsStatus != 0);
+ if (enabled)
+ CheckDlgButton(IDC_RADIO_AFS_ENABLED, TRUE);
+ else
+ CheckDlgButton(IDC_RADIO_AFS_DISABLED, TRUE);
+
+ return TRUE;
+}
+
+void CAfsProperties::OnButtonAfsProperties()
+{
+ if (32 >= (LRESULT) ShellExecute (NULL, NULL, "AFS_CONFIG.EXE", NULL,
+ NULL, SW_SHOW))
+ {
+ MessageBox("Can't find file AFS_CONFIG.EXE", "Error", MB_OK);
+ }
+}
+
+void CAfsProperties::OnOK()
+{
+ if (m_oldAfsStatus != m_newAfsStatus)
+ {
+ if (!m_pApp->WriteProfileInt("Settings", "AfsStatus", m_newAfsStatus))
+ {
+ MessageBox("There was an error putting your entry into the "
+ "Registry!", "Error", MB_OK);
+ }
+ }
+
+ CDialog::OnOK();
+}
+
+void CAfsProperties::OnRadioAfsEnabled()
+{
+ m_newAfsStatus = 1;
+}
+
+void CAfsProperties::OnRadioAfsDisabled()
+{
+ m_newAfsStatus = 0;
+}
+
+void CAfsProperties::OnHelp()
+{
+#ifdef CALL_HTMLHELP
+ AfxGetApp()->HtmlHelp(HID_AFS_PROPERTIES_COMMAND);
+#else
+ AfxGetApp()->WinHelp(HID_AFS_PROPERTIES_COMMAND);
+#endif
+}