Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Public Attributes | Protected Member Functions
CChooseActionDlg Class Reference

#include <HelperAppDlg.h>

Collaboration diagram for CChooseActionDlg:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { IDD = IDD_CHOOSE_ACTION_DIALOG }

Public Member Functions

 CChooseActionDlg (nsIHelperAppLauncher *aLauncher, CWnd *pParent=NULL)

Public Attributes

CStatic m_ContentType
int m_ActionChosen
CString m_OpenWithAppName
nsCOMPtr< nsIHelperAppLauncherm_HelperAppLauncher

Protected Member Functions

virtual void DoDataExchange (CDataExchange *pDX)
virtual BOOL OnInitDialog ()
afx_msg void OnChooseAppClicked ()
virtual void OnOK ()
virtual void OnCancel ()
afx_msg void OnOpenUsingRadioBtnClicked ()
afx_msg void OnSaveToDiskRadioBtnClicked ()
void EnableAppName (BOOL bEnable)
void EnableChooseBtn (BOOL bEnable)
void InitWithPreferredAction (nsIMIMEInfo *aMimeInfo)
void SelectSaveToDiskOption ()
void SelectOpenUsingAppOption ()
void UpdateAppNameField (CString &appName)

Detailed Description

Definition at line 118 of file HelperAppDlg.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
IDD 

Definition at line 123 of file HelperAppDlg.h.


Constructor & Destructor Documentation

CChooseActionDlg::CChooseActionDlg ( nsIHelperAppLauncher aLauncher,
CWnd *  pParent = NULL 
)

Definition at line 289 of file HelperAppDlg.cpp.

    : CDialog(CChooseActionDlg::IDD, pParent)
{
    m_HelperAppLauncher = aLauncher;
}

Member Function Documentation

void CChooseActionDlg::DoDataExchange ( CDataExchange *  pDX) [protected, virtual]

Definition at line 295 of file HelperAppDlg.cpp.

void CChooseActionDlg::EnableAppName ( BOOL  bEnable) [protected]

Definition at line 417 of file HelperAppDlg.cpp.

{
    CStatic *pAppName = (CStatic *)GetDlgItem(IDC_APP_NAME);
    if(pAppName)
    {
        pAppName->EnableWindow(bEnable);
    }
}

Here is the caller graph for this function:

void CChooseActionDlg::EnableChooseBtn ( BOOL  bEnable) [protected]

Definition at line 408 of file HelperAppDlg.cpp.

{
    CButton *pChooseBtn = (CButton *)GetDlgItem(IDC_CHOOSE_APP);
    if(pChooseBtn)
    {
        pChooseBtn->EnableWindow(bEnable);
    }
}

Here is the caller graph for this function:

Definition at line 344 of file HelperAppDlg.cpp.

{
    // Retrieve and set the specified default action
    //
    nsMIMEInfoHandleAction prefAction = nsIMIMEInfo::saveToDisk;
    aMimeInfo->GetPreferredAction(&prefAction);
    if(prefAction == nsIMIMEInfo::saveToDisk)
    {
        SelectSaveToDiskOption();
        return;
    }

    // OpenWithApp is the preferred action - select it
    //
    SelectOpenUsingAppOption();

    // See if we can get the appname
    //
    nsAutoString appDesc;
    nsresult rv = aMimeInfo->GetApplicationDescription(appDesc);
    if(NS_SUCCEEDED(rv)) 
    {
        USES_CONVERSION;
        m_OpenWithAppName = W2CT(appDesc.get());

        // Update with the app name
        //
        UpdateAppNameField(m_OpenWithAppName);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CChooseActionDlg::OnCancel ( ) [protected, virtual]

Definition at line 479 of file HelperAppDlg.cpp.

Definition at line 438 of file HelperAppDlg.cpp.

{      
    TCHAR *lpszFilter =
        _T("EXE Files Only (*.exe)|*.exe|")
        _T("All Files (*.*)|*.*||");

    CFileDialog cf(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
                    lpszFilter, this);
    if(cf.DoModal() == IDOK)
    {
        m_OpenWithAppName = cf.GetPathName(); // Will be like: c:\tmp\junk.exe

        UpdateAppNameField(m_OpenWithAppName);
    }
}

Here is the call graph for this function:

BOOL CChooseActionDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 302 of file HelperAppDlg.cpp.

{
       CDialog::OnInitDialog();

    // Get the mimeInfo from nsIHelperAppLauncher
    //
    nsCOMPtr<nsIMIMEInfo> mimeInfo;
    if(m_HelperAppLauncher)
        m_HelperAppLauncher->GetMIMEInfo(getter_AddRefs(mimeInfo));

    if(mimeInfo) 
    {
        // Retrieve and set the Mime type of the content we're downloading
        // in the content type field of the dialog box
        //
        nsCAutoString mimeType;
        nsresult rv = mimeInfo->GetMIMEType(mimeType);
        if(NS_SUCCEEDED(rv)) 
        {
            CStatic *pMimeType = (CStatic *)GetDlgItem(IDC_CONTENT_TYPE);
            if(pMimeType)
            {
                USES_CONVERSION;
                pMimeType->SetWindowText(A2CT(mimeType.get()));
            }
        }

        // See if we can get the preferred action from the mime info
        // and init the controls accordingly
        //
        InitWithPreferredAction(mimeInfo);
    }
    else
        SelectSaveToDiskOption();
    
    return FALSE;  // return TRUE unless you set the focus to a control
}

Here is the call graph for this function:

void CChooseActionDlg::OnOK ( ) [protected, virtual]

Definition at line 454 of file HelperAppDlg.cpp.

{      
    CButton *pRadioOpenWithApp = (CButton *)GetDlgItem(IDC_OPEN_USING);

    if(pRadioOpenWithApp->GetCheck())
    {
        // Do not allow to leave the dialog if the OpenWithAnApp option 
        // is selected and the the name of the app is unknown/empty
        //
        if(m_OpenWithAppName.IsEmpty())
        {
            ::MessageBox(this->m_hWnd,
                _T("You have chosen to open the content with an external application, but,\nno application has been specified.\n\nPlease click the Choose... button to select an application"),
                _T("MfcEmbed"), MB_OK);
            return;
        }
        else
            m_ActionChosen = CONTENT_LAUNCH_WITH_APP;
    }
    else
        m_ActionChosen = CONTENT_SAVE_TO_DISK;

    CDialog::OnOK();
}

Definition at line 426 of file HelperAppDlg.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 432 of file HelperAppDlg.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 395 of file HelperAppDlg.cpp.

{
    CButton *pRadioOpenUsing = (CButton *)GetDlgItem(IDC_OPEN_USING);
    if(pRadioOpenUsing)
    {
        pRadioOpenUsing->SetCheck(1);

        pRadioOpenUsing->SetFocus();

        OnOpenUsingRadioBtnClicked();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 382 of file HelperAppDlg.cpp.

{
    CButton *pRadioSaveToDisk = (CButton *)GetDlgItem(IDC_SAVE_TO_DISK);
    if(pRadioSaveToDisk)
    {
        pRadioSaveToDisk->SetCheck(1);

        pRadioSaveToDisk->SetFocus();

        OnSaveToDiskRadioBtnClicked();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CChooseActionDlg::UpdateAppNameField ( CString &  appName) [protected]

Definition at line 375 of file HelperAppDlg.cpp.

{
    CStatic *pAppName = (CStatic *)GetDlgItem(IDC_APP_NAME);
    if(pAppName)
        pAppName->SetWindowText(appName);    
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 126 of file HelperAppDlg.h.

Definition at line 124 of file HelperAppDlg.h.

Definition at line 128 of file HelperAppDlg.h.

Definition at line 127 of file HelperAppDlg.h.


The documentation for this class was generated from the following files: