Example #1
0
QString Application::UserDataDirectory()
{
    QString qstr;
#ifdef _WINDOWS
    LPITEMIDLIST pidl;

    if (SHGetFolderLocation(0, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, &pidl) != S_OK)
        return "";

    WCHAR str[MAX_PATH+1] = {};
    SHGetPathFromIDListW(pidl, str);
    CoTaskMemFree(pidl);

    qstr = WStringToQString(str) + "\\" + ApplicationName();
#else
    ///\todo Convert to QString instead of std::string.
    char *ppath = 0;
    ppath = getenv("HOME");
    if (ppath == 0)
        throw Exception("Failed to get HOME environment variable.");

    qstr = QString(ppath) + "/." + ApplicationName();
#endif

    // Apply trailing slash
    if (!qstr.endsWith(QDir::separator()))
        qstr += QDir::separator();
    return qstr;
}
Example #2
0
BOOL CMsregDllApp::UserIsBonusEnabled(void)
{
	BOOL fResult = FALSE;

	CString csRegistrationCode;

	TRY
	{
		csRegistrationCode = UserIniFile().GetString(ApplicationName(), MSREGUSRINI_Application_RegistrationCode);

		if (csRegistrationCode == MODEM_REGISTRATION_CODE)
		{
			fResult = TRUE;
		}
		else
		{
			if (!csRegistrationCode.IsEmpty())
			{
				// 6/6/97 (FF) Switched to scheme where registration code is last four digits of
				// Parent Part Number reversed.
				CString csParentPartNumber;
				TRY
				{
					csParentPartNumber = GetApp()->IniFile().GetString(MSREGINI_Section_Configuration, MSREGINI_Configuration_ParentPartNumber);
					if (csParentPartNumber.GetLength() >= 4)
					{
						csParentPartNumber.MakeReverse();
						csParentPartNumber = csParentPartNumber.Left(4);
						Util::Trim(csRegistrationCode);
						if (csRegistrationCode == csParentPartNumber)
						{
							fResult = TRUE;
						}
					}
				}
				END_TRY

#if 0
				unsigned long lKey = (unsigned long)IniFile().GetLong(MSREGINI_Section_Configuration, MSREGINI_Configuration_Key, 0);
				if (lKey == KeyFromString(csRegistrationCode))
				{
					fResult = TRUE;
				}
#endif

			}
		}
	}
Example #3
0
QString Application::UserDocumentsDirectory()
{
    QString qstr;
#ifdef _WINDOWS
    LPITEMIDLIST pidl;

    if (SHGetFolderLocation(0, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL, 0, &pidl) != S_OK)
        return "";

    WCHAR str[MAX_PATH+1] = {};
    SHGetPathFromIDListW(pidl, str);
    CoTaskMemFree(pidl);

    qstr = WStringToQString(str) + '\\' + ApplicationName();
#else
    ///\todo Review. Is this desirable?
    qstr = UserDataDirectory();
#endif

    // Apply trailing slash
    if (!qstr.endsWith(QDir::separator()))
        qstr += QDir::separator();
    return qstr;
}
Example #4
0
BOOL CMsregDllApp::UserIsRegistered(void)
{
	return UserIniFile().GetInteger(ApplicationName(), MSREGUSRINI_Application_Registered, 0);
}