Back to index

lightning-sunbird  0.9+nobinonly
Functions
ProfilesDlg.cpp File Reference
#include "stdafx.h"
#include <afxpriv.h>
#include "Testembed.h"
#include "ProfilesDlg.h"
#include "nsIProfile.h"
#include "nsIServiceManager.h"

Go to the source code of this file.

Functions

static void ValidateProfileName (const CString &profileName, CDataExchange *pDX)

Function Documentation

static void ValidateProfileName ( const CString &  profileName,
CDataExchange *  pDX 
) [static]

Definition at line 20 of file ProfilesDlg.cpp.

{
    USES_CONVERSION;

    nsresult rv;
    PRBool exists = FALSE;

    {
        //NS_WITH_SERVICE(nsIProfile, profileService, NS_PROFILE_CONTRACTID, &rv);
           nsCOMPtr<nsIProfile> profileService(do_GetService(NS_PROFILE_CONTRACTID));
        rv = profileService->ProfileExists(T2W(profileName), &exists);
    }

    if (NS_SUCCEEDED(rv) && exists)
    {
        CString errMsg;

        errMsg.Format(_T("Error: A profile named \"%s\" already exists."), (const char *)profileName);
        AfxMessageBox( errMsg, MB_ICONEXCLAMATION );
        errMsg.Empty();
        pDX->Fail();
    }

    if (profileName.FindOneOf("\\/") != -1)
    {
        AfxMessageBox( _T("Error: A profile name cannot contain the characters \"\\\" or \"/\"."), MB_ICONEXCLAMATION );
        pDX->Fail();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function: