OSDN Git Service

Fix GitHub issue #574: BUG: Doesn't respect "Don't ask this question again" checkbox...
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Tue, 26 Jan 2021 12:48:19 +0000 (21:48 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Tue, 26 Jan 2021 12:48:19 +0000 (21:48 +0900)
Src/Common/MessageBoxDialog.cpp
Src/Common/MessageBoxDialog.h
Src/DirDoc.cpp

index edf4948..f3d8951 100644 (file)
@@ -84,7 +84,7 @@ IMPLEMENT_DYNAMIC(CMessageBoxDialog, CDialog)
  *     given, the application name will be used as the title of the dialog.
  */
  CMessageBoxDialog::CMessageBoxDialog ( CWnd* pParent, CString strMessage, 
-       CString strTitle, UINT nStyle, UINT nHelp ) 
+       CString strTitle, UINT nStyle, UINT nHelp, const CString& strRegistryKey ) 
        : CDialog ( CMessageBoxDialog::IDD, pParent )
        , m_strMessage(strMessage)
        , m_strTitle(strTitle.IsEmpty() ? AfxGetAppName() : strTitle)
@@ -94,7 +94,7 @@ IMPLEMENT_DYNAMIC(CMessageBoxDialog, CDialog)
        , m_nTimeoutSeconds(0)
        , m_bTimeoutDisabled(false)
        , m_nTimeoutTimer(0)
-       , m_strRegistryKey(_T(""))
+       , m_strRegistryKey(strRegistryKey)
        , m_nDefaultButton(IDC_STATIC)
        , m_nEscapeButton(IDC_STATIC)
        , m_sDialogUnit(CSize(0, 0))
@@ -135,11 +135,11 @@ IMPLEMENT_DYNAMIC(CMessageBoxDialog, CDialog)
  *     application name will be used as the title of the dialog.
  */
 CMessageBoxDialog::CMessageBoxDialog ( CWnd* pParent, UINT nMessageID,
-       UINT nTitleID, UINT nStyle, UINT nHelp ) 
+       UINT nTitleID, UINT nStyle, UINT nHelp, const CString& strRegistryKey ) 
        : CMessageBoxDialog(pParent, 
                LoadResString(nMessageID).c_str(), 
                nTitleID == 0 ? AfxGetAppName() : LoadResString(nTitleID).c_str(), 
-               nStyle, nHelp )
+               nStyle, nHelp, strRegistryKey )
 {
 }
 
index 4419de7..1e4f516 100644 (file)
@@ -97,11 +97,11 @@ public:
 
        // Constructor of the class for direct providing of the message strings.
        CMessageBoxDialog ( CWnd* pParent, CString strMessage, 
-               CString strTitle = _T(""), UINT nStyle = MB_OK, UINT nHelp = 0 );
+               CString strTitle = _T(""), UINT nStyle = MB_OK, UINT nHelp = 0, const CString& strRegistryKey = _T("") );
 
        // Constructor of the class for loading the strings from the resources.
        CMessageBoxDialog ( CWnd* pParent, UINT nMessageID, UINT nTitleID = 0,
-               UINT nStyle = MB_OK, UINT nHelp = 0 );
+               UINT nStyle = MB_OK, UINT nHelp = 0, const CString& strRegistryKey = _T("") );
 
        // Default destructor of the class.
        virtual ~CMessageBoxDialog ( );
index 0ed5bbc..1b1f300 100644 (file)
@@ -917,7 +917,12 @@ bool CDirDoc::CompareFilesIfFilesAreLarge(int nFiles, const FileLocation ifilelo
                        }
                }
        }
-       int ans = AfxMessageBox(msg.c_str(), MB_YESNOCANCEL | MB_ICONQUESTION | MB_DONT_ASK_AGAIN);
+       CMessageBoxDialog dlg(
+               m_pDirView ? m_pDirView->GetParentFrame() : nullptr,
+               msg.c_str(), _T(""),
+               MB_YESNOCANCEL | MB_ICONQUESTION | MB_DONT_ASK_AGAIN, 0U,
+               _T("CompareLargeFiles"));
+       int ans = dlg.DoModal();
        if (ans == IDCANCEL)
                return true;
        else if (ans == IDNO)