Back to index

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

#include <ProfilesDlg.h>

Collaboration diagram for CProfilesDlg:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { IDD = IDD_PROFILES }
enum  { IDD = IDD_PROFILES }

Public Member Functions

 CProfilesDlg (CWnd *pParent=NULL)
 CProfilesDlg (CWnd *pParent=NULL)

Public Attributes

CListBox m_ProfileList
BOOL m_bAtStartUp
BOOL m_bAskAtStartUp
nsAutoString m_SelectedProfile
nsEmbedString m_SelectedProfile

Protected Member Functions

virtual void DoDataExchange (CDataExchange *pDX)
virtual BOOL OnInitDialog ()
afx_msg void OnNewProfile ()
afx_msg void OnRenameProfile ()
afx_msg void OnDeleteProfile ()
virtual void DoDataExchange (CDataExchange *pDX)
virtual BOOL OnInitDialog ()
afx_msg void OnNewProfile ()
afx_msg void OnRenameProfile ()
afx_msg void OnDeleteProfile ()
afx_msg void OnDblclkProfile ()

Detailed Description

Definition at line 81 of file ProfilesDlg.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
IDD 

Definition at line 89 of file ProfilesDlg.h.

anonymous enum
Enumerator:
IDD 

Definition at line 118 of file ProfilesDlg.h.


Constructor & Destructor Documentation

CProfilesDlg::CProfilesDlg ( CWnd *  pParent = NULL)

Definition at line 132 of file ProfilesDlg.cpp.

       : CDialog(CProfilesDlg::IDD, pParent)
{
       //{{AFX_DATA_INIT(CProfilesDlg)
    m_bAtStartUp = TRUE;
       m_bAskAtStartUp = TRUE;
       //}}AFX_DATA_INIT
}
CProfilesDlg::CProfilesDlg ( CWnd *  pParent = NULL)

Member Function Documentation

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

Definition at line 142 of file ProfilesDlg.cpp.

{
       CDialog::DoDataExchange(pDX);
       //{{AFX_DATA_MAP(CProfilesDlg)
       DDX_Control(pDX, IDC_LIST1, m_ProfileList);
       DDX_Check(pDX, IDC_CHECK_ASK_AT_START, m_bAskAtStartUp);
       //}}AFX_DATA_MAP

    if (pDX->m_bSaveAndValidate)
    {
        USES_CONVERSION;

        int itemIndex = m_ProfileList.GetCurSel();
        if (itemIndex != LB_ERR)
        {
            CString itemText;
            m_ProfileList.GetText(itemIndex, itemText);
            m_SelectedProfile.Assign(T2W(itemText));
        }
    }
}
virtual void CProfilesDlg::DoDataExchange ( CDataExchange *  pDX) [protected, virtual]

Definition at line 330 of file ProfilesDlg.cpp.

{
    OnOK();
}

Definition at line 270 of file ProfilesDlg.cpp.

{
    int itemIndex = m_ProfileList.GetCurSel();

    ASSERT(itemIndex != LB_ERR);
    if (itemIndex == LB_ERR)
        return;

    CString selectedProfile;
    m_ProfileList.GetText(itemIndex, selectedProfile);
    
    nsresult rv;
    //NS_WITH_SERVICE(nsIProfile, profileService, NS_PROFILE_CONTRACTID, &rv);
    nsCOMPtr<nsIProfile> profileService(do_GetService(NS_PROFILE_CONTRACTID,&rv));

       ASSERT(NS_SUCCEEDED(rv));
    if (NS_SUCCEEDED(rv))
    {
        USES_CONVERSION;

           rv = profileService->DeleteProfile(T2W(selectedProfile), PR_TRUE);
        ASSERT(NS_SUCCEEDED(rv));
        if (NS_SUCCEEDED(rv))
        {
            int itemCount = m_ProfileList.DeleteString(itemIndex);
            if (itemCount == 0)
                GetDlgItem(IDOK)->EnableWindow(FALSE);
        }
    }  
}

Here is the call graph for this function:

afx_msg void CProfilesDlg::OnDeleteProfile ( ) [protected]
BOOL CProfilesDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 176 of file ProfilesDlg.cpp.

{
    USES_CONVERSION;

       CDialog::OnInitDialog();
       
    nsCAutoString   cStr;        
    nsXPIDLString   curProfileName;

    // Fill the list of profiles
    nsresult rv;
    //NS_WITH_SERVICE(nsIProfile, profileService, NS_PROFILE_CONTRACTID, &rv);
    nsCOMPtr<nsIProfile> profileService(do_GetService(NS_PROFILE_CONTRACTID));
    profileService->GetCurrentProfile(getter_Copies(curProfileName));

    PRInt32     selectedRow = 0;
    PRUint32    listLen;
    PRUnichar   **profileList;
    rv = profileService->GetProfileList(&listLen, &profileList);

    for (PRUint32 index = 0; index < listLen; index++)
    {
        CString tmpStr(W2T(profileList[index]));
        m_ProfileList.AddString(tmpStr);
        if (nsCRT::strcmp(profileList[index], curProfileName.get()) == 0)
            selectedRow = index;
    }

    m_ProfileList.SetCurSel(selectedRow);

       if (m_bAtStartUp)
    {
        GetDlgItem(IDCANCEL)->EnableWindow(FALSE);
    }
       
       return TRUE;  // return TRUE unless you set the focus to a control
                     // EXCEPTION: OCX Property Pages should return FALSE
}

Here is the call graph for this function:

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

Definition at line 215 of file ProfilesDlg.cpp.

{
       CNewProfileDlg dialog;

    if (dialog.DoModal() == IDOK)
    {
        nsresult rv;

        //NS_WITH_SERVICE(nsIProfile, profileService, NS_PROFILE_CONTRACTID, &rv);
           nsCOMPtr<nsIProfile> profileService(do_GetService(NS_PROFILE_CONTRACTID,&rv));
        ASSERT(NS_SUCCEEDED(rv));
        if (NS_SUCCEEDED(rv))
        {
            USES_CONVERSION;

                  rv = profileService->CreateNewProfile(T2W(dialog.m_Name), nsnull, nsnull, PR_FALSE);
            ASSERT(NS_SUCCEEDED(rv));
            if (NS_SUCCEEDED(rv))
            {
                int item = m_ProfileList.AddString(dialog.m_Name);
                m_ProfileList.SetCurSel(item);
                GetDlgItem(IDOK)->EnableWindow(TRUE);
            }
        }
    }
}

Here is the call graph for this function:

afx_msg void CProfilesDlg::OnNewProfile ( ) [protected]

Definition at line 242 of file ProfilesDlg.cpp.

{
       CRenameProfileDlg dialog;

    int itemIndex = m_ProfileList.GetCurSel();
    ASSERT(itemIndex != LB_ERR);
    if (itemIndex == LB_ERR)
        return;

    m_ProfileList.GetText(itemIndex, dialog.m_CurrentName);

    if (dialog.DoModal() == IDOK)
    {
        USES_CONVERSION;

        nsresult rv;

        //NS_WITH_SERVICE(nsIProfile, profileService, NS_PROFILE_CONTRACTID, &rv);
           nsCOMPtr<nsIProfile> profileService(do_GetService(NS_PROFILE_CONTRACTID,&rv));
        ASSERT(NS_SUCCEEDED(rv));
        if (NS_SUCCEEDED(rv))
        {
            rv = profileService->RenameProfile(T2W(dialog.m_CurrentName), T2W(dialog.m_NewName));
            ASSERT(NS_SUCCEEDED(rv));
        }
    }  
}

Here is the call graph for this function:

afx_msg void CProfilesDlg::OnRenameProfile ( ) [protected]

Member Data Documentation

Definition at line 92 of file ProfilesDlg.h.

Definition at line 91 of file ProfilesDlg.h.

Definition at line 90 of file ProfilesDlg.h.

Definition at line 95 of file ProfilesDlg.h.

Definition at line 124 of file ProfilesDlg.h.


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