Ejemplo n.º 1
0
bool ItemLibrarySortedModel::setElementVisible(int libId, bool visible)
{
    int pos = findElement(libId);
    if (m_elementOrder.at(pos).visible == visible)
        return false;

    int visiblePos = visibleElementPosition(libId);
    if (visible)
        privateInsert(visiblePos, (m_elementModels.value(libId)));
    else
        privateRemove(visiblePos);

    m_elementOrder[pos].visible = visible;
    return true;
}
Ejemplo n.º 2
0
void RegistryKey::privateRemove (HKEY hKey, const char *pSubKey)
{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx (hKey, pSubKey, 0, KEY_ALL_ACCESS, &hKeyChild);
    if (lRes != ERROR_SUCCESS)
	throw AppException (WHERE, ERR_WINDOWS_FMT, "RegOpenKeyEx", GetLastError ());

    // Enumerate all of the decendents of this child.
    FILETIME time;
    char szBuffer[256];
    DWORD dwSize = 256;
    LONG rval;
    while ((rval = RegEnumKeyEx (hKeyChild, 0, szBuffer, &dwSize, NULL,
	                 NULL, NULL, &time)) == ERROR_SUCCESS) {
	// Delete the decendents of this child.
	try {
	    privateRemove (hKeyChild, szBuffer);
	}
	catch (const std::exception&) {
	    // Cleanup before exiting.
	    RegCloseKey (hKeyChild);
	    throw;
	}

	dwSize = 256 ;
    }

    if (rval != ERROR_NO_MORE_ITEMS)
	throw AppException (WHERE, ERR_WINDOWS_FMT, "RegEnumKeyEx", GetLastError ());

    // Close the child.
    RegCloseKey (hKeyChild);

    // Delete this child.
    if (RegDeleteKey (hKey, pSubKey) != ERROR_SUCCESS)
	throw AppException (WHERE, ERR_WINDOWS_FMT, "RegDeleteKey", GetLastError ());
}
Ejemplo n.º 3
0
void RegistryKey::remove (const char *pSubKey)
{
    privateRemove (mhKey, pSubKey);
}