Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes
AppLauncherDlg Class Reference
Collaboration diagram for AppLauncherDlg:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 AppLauncherDlg ()
virtual ~AppLauncherDlg ()
int Show (nsIHelperAppLauncher *aLauncher, HWND hwndParent)

Public Attributes

PRPackedBool mSaveToDisk
nsCAutoString mOpenWith

Private Member Functions

void OnInitDialog ()
void OnOK ()
void OnCancel ()
void OnChooseApp ()

Static Private Member Functions

static BOOL CALLBACK LaunchProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)

Private Attributes

HWND mHwndDlg
nsCOMPtr< nsIHelperAppLaunchermHelperAppLauncher

Detailed Description

Definition at line 60 of file HelperAppDlg.cpp.


Constructor & Destructor Documentation

Definition at line 83 of file HelperAppDlg.cpp.

Definition at line 87 of file HelperAppDlg.cpp.

{
}

Member Function Documentation

BOOL CALLBACK AppLauncherDlg::LaunchProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
) [static, private]

Definition at line 186 of file HelperAppDlg.cpp.

{
    AppLauncherDlg *pThis = NULL;
    if (uMsg == WM_INITDIALOG)
    {
        pThis = (AppLauncherDlg *) lParam;
        NS_WARN_IF_FALSE(pThis, "need a pointer to this!");
        pThis->mHwndDlg = hwndDlg;
        SetWindowLong(hwndDlg, DWL_USER, lParam);
    }
    else
    {
        pThis = (AppLauncherDlg *) GetWindowLong(hwndDlg, DWL_USER);
    }
    switch (uMsg)
    {
    case WM_INITDIALOG:
        pThis->OnInitDialog();
        return TRUE;
    case WM_COMMAND:
        if (HIWORD(wParam) == BN_CLICKED)
        {
            NS_WARN_IF_FALSE(pThis, "Should be non-null!");
            switch (LOWORD(wParam))
            {
            case IDC_CHOOSE:
                pThis->OnChooseApp();
                break;
            case IDOK:
                pThis->OnOK();
                break;
            case IDCANCEL:
                pThis->OnCancel();
                break;
            }
        }
        return TRUE;
    }
    return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 147 of file HelperAppDlg.cpp.

{
    EndDialog(mHwndDlg, IDCANCEL);
}

Here is the caller graph for this function:

Definition at line 152 of file HelperAppDlg.cpp.

{
    USES_CONVERSION;

    TCHAR szPath[MAX_PATH + 1];
    memset(szPath, 0, sizeof(szPath));

    TCHAR *lpszFilter =
        _T("EXE Files Only (*.exe)\0*.exe\0"
           "All Files (*.*)\0*.*\0\0");

    OPENFILENAME ofn;
    memset(&ofn, 0, sizeof(ofn));
#if _WIN32_WINNT >= 0x0500
    ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
#else
    ofn.lStructSize = sizeof(ofn);
#endif
    ofn.Flags = OFN_FILEMUSTEXIST;
    ofn.lpstrFilter = lpszFilter;
    ofn.lpstrDefExt = _T("exe");
    ofn.lpstrFile = szPath;
    ofn.nMaxFile = MAX_PATH;

    if (GetOpenFileName(&ofn))
    {
        USES_CONVERSION;
        mOpenWith = T2A(szPath);
        SetDlgItemText(mHwndDlg, IDC_APPLICATION, szPath);
        CheckRadioButton(mHwndDlg, IDC_OPENWITHAPP, IDC_SAVETOFILE, IDC_OPENWITHAPP);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 104 of file HelperAppDlg.cpp.

{
    USES_CONVERSION;
    nsCOMPtr<nsIMIMEInfo> mimeInfo;
    nsCAutoString url;
    if (mHelperAppLauncher)
    {
        mHelperAppLauncher->GetMIMEInfo(getter_AddRefs(mimeInfo));
        nsCOMPtr<nsIURI> uri;
        mHelperAppLauncher->GetSource(getter_AddRefs(uri));
        uri->GetSpec(url);
    }
    nsMIMEInfoHandleAction prefAction = nsIMIMEInfo::saveToDisk;
    nsAutoString appName;
    nsCAutoString contentType;
    if (mimeInfo)
    {
        mimeInfo->GetPreferredAction(&prefAction);
        mimeInfo->GetApplicationDescription(appName);
        mimeInfo->GetMIMEType(contentType);
    }
    if (prefAction == nsIMIMEInfo::saveToDisk)
    {
        CheckRadioButton(mHwndDlg, IDC_OPENWITHAPP, IDC_SAVETOFILE, IDC_SAVETOFILE);
    }
    else
    {
        CheckRadioButton(mHwndDlg, IDC_OPENWITHAPP, IDC_SAVETOFILE, IDC_OPENWITHAPP);
    }
    SetDlgItemText(mHwndDlg, IDC_URL,
        url.IsEmpty() ? _T("") : A2CT(url.get()));
    SetDlgItemText(mHwndDlg, IDC_APPLICATION,
        appName.IsEmpty() ? _T("<No Application>") : W2CT(appName.get()));
    SetDlgItemText(mHwndDlg, IDC_CONTENTTYPE,
        contentType.IsEmpty() ? _T("") : A2CT(contentType.get()));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AppLauncherDlg::OnOK ( ) [private]

Definition at line 141 of file HelperAppDlg.cpp.

{
    mSaveToDisk = IsDlgButtonChecked(mHwndDlg, IDC_SAVETOFILE) ? TRUE : FALSE;
    EndDialog(mHwndDlg, IDOK);
}

Here is the caller graph for this function:

int AppLauncherDlg::Show ( nsIHelperAppLauncher aLauncher,
HWND  hwndParent 
)

Definition at line 92 of file HelperAppDlg.cpp.

{
    HINSTANCE hInstResource = _Module.m_hInstResource;

    mHelperAppLauncher = aLauncher;

    INT result = DialogBoxParam(hInstResource,
        MAKEINTRESOURCE(IDD_HELPERAPP), hwndParent, LaunchProc, (LPARAM) this);
    
    return result;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 80 of file HelperAppDlg.cpp.

Definition at line 79 of file HelperAppDlg.cpp.

Definition at line 69 of file HelperAppDlg.cpp.

Definition at line 68 of file HelperAppDlg.cpp.


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