/** @return the role as string */
QString PartitionRole::toString() const
{
	if (roles() & Unallocated)
		return i18nc("@item partition role", "unallocated");

	if (roles() & Logical)
		return i18nc("@item partition role", "logical");

	if (roles() & Extended)
		return i18nc("@item partition role", "extended");

	if (roles() & Primary)
		return i18nc("@item partition role", "primary");

	return i18nc("@item partition role", "none");
}
/** @return a short descriptive text or, in case the Partition has StateNone, its device node. */
QString Partition::deviceNode() const
{
	if (roles().has(PartitionRole::None) || roles().has(PartitionRole::Unallocated))
		return i18nc("@item partition name", "unallocated");

	if (state() == StateNew)
		return i18nc("@item partition name", "New Partition");

	if (state() == StateRestore)
		return i18nc("@item partition name", "Restored Partition");

	if (state() == StateCopy)
		return i18nc("@item partition name", "Copy of %1", partitionPath());

	return partitionPath();
}
Exemple #3
0
QHash<int, QByteArray> SalesModel::roleNames() const
{
    QHash<int, QByteArray> roles( ItemModel::roleNames());
    roles[DateRole] = "date";
    roles[BuyPriceRole] = "buyPrice";
    roles[ProfitRole] = "profit";
    return roles;
}
void ChessFieldModel::update_model()
{
    QList<std::pair<QString,QString> >::iterator iter = m_list.begin();
    for(int i=0; iter != m_list.end(); i++, iter++) {
        ChessPiece cp = m_chess_board.get_board_piece(7 - i / 8, i % 8);
        iter->second = m_chess_piece_images[to_int(cp)];
    }
    QVector<int> roles(1, IMAGE_PATH);
    emit dataChanged(index(0), index(m_list.size()-1), roles);
}
 EnginioReply *remove(int row)
 {
     QJsonObject oldObject = _data.at(row).toObject();
     EnginioReply* id = _enginio->remove(oldObject, _operation);
     _dataChanged.insert(id, qMakePair(row, oldObject));
     QVector<int> roles(1);
     roles.append(SyncedRole);
     emit q->dataChanged(q->index(row), q->index(row) , roles);
     return id;
 }
/** @return the sectors used in the Partition's FileSystem or, in case of an extended partition, the sum of used sectors of the Partition's children */
qint64 Partition::sectorsUsed() const
{
	if (!roles().has(PartitionRole::Extended))
		return fileSystem().sectorsUsed();

	qint64 result = 0;
	foreach (const Partition* p, children())
		if (!p->roles().has(PartitionRole::Unallocated))
			result += p->length();

	return result;
}
void ChessFieldModel::update_cells(std::shared_ptr<ChessMove> move)
{
    QVector<int> roles(1, IMAGE_PATH);
    const int count = move->changed_cells_count();
    auto cells = move->get_changed_cells();

    for(int i=0; i<count; i++) {
        ChessPiece cp = cells[i].second;
        int ind = from_board_to_list(cells[i].first);
        m_list[ind].second = m_chess_piece_images[to_int(cp)];
        emit dataChanged(index(ind), index(ind), roles);
    }
}
/** Adjusts the numbers of logical Partitions for an extended Partition.

	This is required if a logical Partition is deleted or inserted because logicals must be numberd from
	5 onwards without a gap. So if the user deletes Partition number 7 and there is a number 8, 8 becomes the
	"new" 7. And since this happens somewhere in the middle of a DeleteOperation, we have to adjust to that so the
	next Job still finds the Partition it wants to deal with.

	@param deletedNumber the number of a deleted logical or -1 if none has been deleted
	@param insertedNumber the number of an inserted logical or -1 if none has been inserted
*/
void Partition::adjustLogicalNumbers(qint32 deletedNumber, qint32 insertedNumber)
{
	if (!roles().has(PartitionRole::Extended))
		return;

	foreach (Partition* p, children())
	{
		QString path = p->partitionPath();
		path.remove(QRegExp(QStringLiteral("([0-9]+$)")));
		if (deletedNumber > 4 && p->number() > deletedNumber)
			p->setPartitionPath(path + QString::number(p->number() - 1));
		else if (insertedNumber > 4 && p->number() >= insertedNumber)
			p->setPartitionPath(path + QString::number(p->number() + 1));
	}
dlgReassignDropOwned::dlgReassignDropOwned(frmMain *win, pgConn *conn,
  pgRole *role, wxString dbrestriction)
{
	wxString query;

	connection=conn;
	parent=win;
	
	wxWindowBase::SetFont(settings->GetSystemFont());
    LoadResource(win, wxT("dlgReassignDropOwned"));
    
    cbRoles->Clear();
    query = wxT("SELECT rolname FROM pg_roles WHERE rolname<>") + conn->qtDbString(role->GetName()) + wxT(" ORDER BY rolname");
    pgSetIterator roles(connection, query);
    while (roles.RowsLeft())
    {
        cbRoles->Append(roles.GetVal(wxT("rolname")));
    }
    cbRoles->SetSelection(0);
    cbRoles->Enable(cbRoles->GetStrings().Count() > 0);
	
    cbDatabases->Clear();
    query = wxT("SELECT DISTINCT datname FROM pg_database WHERE datallowconn");
    if (!dbrestriction.IsEmpty())
    {
        query += wxT(" AND datname NOT IN (") + dbrestriction + wxT(")");
    }
    query += wxT(" ORDER BY datname");

    pgSetIterator databases(connection, query);
    while (databases.RowsLeft())
    {
        cbDatabases->Append(databases.GetVal(wxT("datname")));
    }
    cbDatabases->SetSelection(0);
}
Exemple #10
0
void pgRole::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
    if (!expandedKids)
    {
        expandedKids=true;
        wxString rolesquery;

        if (GetConnection()->BackendMinimumVersion(8, 2))
            rolesquery = wxT("SELECT rolname, admin_option,\n") 
                         wxT(" pg_catalog.shobj_description(r.oid, 'pg_authid') AS description\n");
        else
            rolesquery = wxT("SELECT rolname, admin_option\n"); 

        rolesquery += wxT("  FROM pg_roles r\n") 
                      wxT("  JOIN pg_auth_members ON r.oid=roleid\n") 
                      wxT(" WHERE member=") + GetOidStr() + wxT("\n") 
                      wxT(" ORDER BY rolname");

        pgSetIterator roles(GetConnection(), rolesquery);

        while (roles.RowsLeft())
        {
            wxString role=roles.GetVal(wxT("rolname"));
            if (roles.GetBool(wxT("admin_option")))
                role += PGROLE_ADMINOPTION;

            rolesIn.Add(role);
        }
    }
    if (properties)
    {
        CreateListColumns(properties);

        properties->AppendItem(_("Name"), GetName());
        properties->AppendItem(_("OID"), GetOid());
        properties->AppendItem(_("Account expires"), DateToAnsiStr(GetAccountExpires()));
        properties->AppendItem(_("Can login?"), BoolToYesNo(GetCanLogin()));
        properties->AppendItem(_("Superuser?"), BoolToYesNo(GetSuperuser()));
        properties->AppendItem(_("Create databases?"), BoolToYesNo(GetCreateDatabase()));
        properties->AppendItem(_("Create roles?"), BoolToYesNo(GetCreateRole()));
        properties->AppendItem(_("Update catalogs?"), BoolToYesNo(GetUpdateCatalog()));
        properties->AppendItem(_("Inherits?"), BoolToYesNo(GetInherits()));
        if (server->GetConnection()->BackendMinimumVersion(9, 1))
        {
            properties->AppendItem(_("Replication?"), BoolToYesNo(GetReplication()));
        }

        wxString strConnLimit;
        strConnLimit.Printf(wxT("%ld"), GetConnectionLimit()); 
        properties->AppendItem(_("Connection Limit"), strConnLimit);

        properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));

        wxString roleList;

        size_t index;
        for (index=0 ; index < rolesIn.GetCount() ; index++)
        {
            if (!roleList.IsEmpty())
                roleList += wxT(", ");
            roleList += rolesIn.Item(index);
        }
        properties->AppendItem(_("Member of"), roleList);

        for (index=0; index < configList.GetCount() ; index++)
        {
            wxString item=configList.Item(index);
            properties->AppendItem(item.BeforeFirst('='), item.AfterFirst('='));
        }
    }
}
Exemple #11
0
int dlgRole::Go(bool modal)
{

// In wxMac, the text deletion of "calenderBox" is not raising the EVT_CALENDAR_SEL_CHANGED, EVT_DATE_CHANGED events properly.
// Hence, raising these events with wxEVT_CHILD_FOCUS events.
//
#ifdef __WXMAC__

	datValidUntil->Connect(wxEVT_CHILD_FOCUS, wxCommandEventHandler(dlgRole::OnChange), NULL, this);
	timValidUntil->Connect(wxEVT_CHILD_FOCUS, wxCommandEventHandler(dlgRole::OnChange), NULL, this);

#endif

	if (connection->BackendMinimumVersion(9, 0))
	{
		cbVarDbname->Append(wxT(""));
		AddDatabases(cbVarDbname);
	}
	else
	{
		cbVarDbname->Enable(false);
	}

	if (connection->BackendMinimumVersion(9, 2))
	{
		seclabelPage->SetConnection(connection);
		seclabelPage->SetObject(role);
		this->Connect(EVT_SECLABELPANEL_CHANGE, wxCommandEventHandler(dlgRole::OnChange));
	}
	else
		seclabelPage->Disable();

	wxString roleSql =
	    wxT("SELECT rolname\n")
	    wxT("  FROM pg_roles r\n");

	varInfo.Add(wxT("role"));
	cbVarname->Append(wxT("role"));

	pgSet *set;
	set = connection->ExecuteSet(wxT("SELECT name, vartype, min_val, max_val\n")
	                             wxT("  FROM pg_settings WHERE context in ('user', 'superuser')"));

	if (set)
	{
		while (!set->Eof())
		{
			cbVarname->Append(set->GetVal(0));
			varInfo.Add(set->GetVal(wxT("vartype")) + wxT(" ") +
			            set->GetVal(wxT("min_val")) + wxT(" ") +
			            set->GetVal(wxT("max_val")));
			set->MoveNext();
		}
		delete set;

		cbVarname->SetSelection(0);

		if (connection->BackendMinimumVersion(9, 0))
		{
			cbVarDbname->SetSelection(0);
		}

		SetupVarEditor(0);
	}

	if (role)
	{
		wxArrayString roles = role->GetRolesIn();
		size_t i;
		for (i = 0 ; i < roles.GetCount() ; i++)
			lbRolesIn->Append(roles.Item(i));

		roleSql +=
		    wxT("  LEFT JOIN pg_auth_members ON r.oid=roleid AND member = ") + role->GetOidStr() + wxT("\n")
		    wxT(" WHERE r.oid <> ") + role->GetOidStr() + wxT("\n")
		    wxT("   AND roleid IS NULL");

		// Edit Mode
		if (role->GetServer()->GetSuperUser() || role->GetServer()->GetCreateRole())
			readOnly = false;
		else
			readOnly = true;

		chkCreateDB->SetValue(role->GetCreateDatabase());
		chkCreateRole->SetValue(role->GetCreateRole());
		chkSuperuser->SetValue(role->GetSuperuser());
		chkInherits->SetValue(role->GetInherits());
		if (!connection->BackendMinimumVersion(9, 5))
			chkUpdateCat->SetValue(role->GetUpdateCatalog());
		else
			chkUpdateCat->Disable();
		chkCanLogin->SetValue(role->GetCanLogin());
		chkReplication->SetValue(role->GetReplication());
		if (role->GetAccountExpires().IsValid() && role->GetAccountExpires().GetValue() != -1)
		{
			datValidUntil->SetValue(role->GetAccountExpires().GetDateOnly());
			timValidUntil->SetTime(role->GetAccountExpires());
		}
		else
		{
			wxDateTime empty;
			datValidUntil->SetValue(empty);
		}
		txtConnectionLimit->SetValue(NumToStr(role->GetConnectionLimit()));
		txtComment->SetValue(role->GetComment());

		size_t index;
		wxString dbname;
		wxString parameter;
		wxString value;
		for (index = 0 ; index < role->GetVariables().GetCount() ; index += 3)
		{
			dbname = role->GetVariables().Item(index);
			parameter = role->GetVariables().Item(index + 1);
			value = role->GetVariables().Item(index + 2);

			lstVariables->AppendItem(0, dbname, parameter, value);
		}

		timValidUntil->Enable(!readOnly && role->GetAccountExpires().IsValid());

		if (readOnly)
		{
			chkCanLogin->Disable();
			chkCreateDB->Disable();
			chkCreateRole->Disable();
			chkSuperuser->Disable();
			chkInherits->Disable();
			chkUpdateCat->Disable();
			chkReplication->Disable();
			datValidUntil->Disable();
			timValidUntil->Disable();
			btnAddRole->Disable();
			btnDelRole->Disable();
			cbVarname->Disable();
			cbVarDbname->Disable();
			txtValue->Disable();
			txtConnectionLimit->Disable();
			btnRemove->Disable();
			/* Its own password can be changed. */
			if (connection->GetUser() != role->GetName())
			{
				txtPasswd->Disable();
				txtRePasswd->Disable();
				btnAdd->Disable();
			}
			else
			{
				txtPasswd->Enable();
				txtRePasswd->Enable();
				btnAdd->Enable();
			}
		}
	}
	else
	{
		chkCanLogin->Disable();
		wxDateTime empty;
		datValidUntil->SetValue(empty);
		timValidUntil->Disable();
	}

	// Role comments are only appropriate in 8.2+
	if (!connection->BackendMinimumVersion(8, 2))
		txtComment->Disable();

	// Replication roles added in 9.1
	if (!connection->BackendMinimumVersion(9, 1))
	{
		chkReplication->Disable();
	}


	if (!settings->GetShowUsersForPrivileges())
	{
		if (role)
			roleSql += wxT("\n   AND NOT rolcanlogin");
		else
			roleSql += wxT("\n WHERE NOT rolcanlogin");
	}
	roleSql += wxT("\n ORDER BY rolname");

	pgSetIterator roles(connection, roleSql);

	while (roles.RowsLeft())
		lbRolesNotIn->Append(roles.GetVal(wxT("rolname")));

	return dlgProperty::Go(modal);
}
Exemple #12
0
int dlgRole::Go(bool modal)
{
    wxString roleSql=
        wxT("SELECT rolname\n")
        wxT("  FROM pg_roles r\n");

        varInfo.Add(wxT("role"));
        cbVarname->Append(wxT("role"));

        pgSet *set;
        set=connection->ExecuteSet(wxT("SELECT name, vartype, min_val, max_val\n")
                wxT("  FROM pg_settings WHERE context in ('user', 'superuser')"));

        if (set)
        {
            while (!set->Eof())
            {
                cbVarname->Append(set->GetVal(0));
                varInfo.Add(set->GetVal(wxT("vartype")) + wxT(" ") + 
                            set->GetVal(wxT("min_val")) + wxT(" ") +
                            set->GetVal(wxT("max_val")));
                set->MoveNext();
            }
            delete set;

            cbVarname->SetSelection(0);
            SetupVarEditor(0);
        }

    if (role)
    {
        wxArrayString roles=role->GetRolesIn();
        size_t i;
        for (i=0 ; i < roles.GetCount() ; i++)
            lbRolesIn->Append(roles.Item(i));

        roleSql += 
            wxT("  LEFT JOIN pg_auth_members ON r.oid=roleid AND member = ") + role->GetOidStr() + wxT("\n")
            wxT(" WHERE r.oid <> ") + role->GetOidStr() + wxT("\n")
            wxT("   AND roleid IS NULL");

        // Edit Mode
        if (role->GetServer()->GetSuperUser() || role->GetServer()->GetCreateRole()) 
			readOnly=false;
		else
			readOnly=true;

        chkCreateDB->SetValue(role->GetCreateDatabase());
        chkCreateRole->SetValue(role->GetCreateRole());
        chkSuperuser->SetValue(role->GetSuperuser());
        chkInherits->SetValue(role->GetInherits());
        chkUpdateCat->SetValue(role->GetUpdateCatalog());
        chkCanLogin->SetValue(role->GetCanLogin());
        chkReplication->SetValue(role->GetReplication());
        datValidUntil->SetValue(role->GetAccountExpires());
        timValidUntil->SetTime(role->GetAccountExpires());
        txtConnectionLimit->SetValue(NumToStr(role->GetConnectionLimit()));
        txtComment->SetValue(role->GetComment());

        size_t index;
        for (index = 0 ; index < role->GetConfigList().GetCount() ; index++)
        {
            wxString item=role->GetConfigList().Item(index);
            lstVariables->AppendItem(0, item.BeforeFirst('='), item.AfterFirst('='));
        }

        timValidUntil->Enable(!readOnly && role->GetAccountExpires().IsValid());

        if (readOnly)
        {
            chkCanLogin->Disable();
            chkCreateDB->Disable();
            chkCreateRole->Disable();
            chkSuperuser->Disable();
            chkInherits->Disable();
            chkUpdateCat->Disable();
            chkReplication->Disable();
            datValidUntil->Disable();
            timValidUntil->Disable();
            btnAddRole->Disable();
            btnDelRole->Disable();
            cbVarname->Disable();
            txtValue->Disable();
            txtConnectionLimit->Disable();
            btnRemove->Disable();
	    /* Its own password can be changed. */
	    if (connection->GetUser() != role->GetName())
	    {
		txtPasswd->Disable();
		txtRePasswd->Disable();
		btnAdd->Disable();
	    }
	    else
	    {
		txtPasswd->Enable();
		txtRePasswd->Enable();
		btnAdd->Enable();
	    }
        }
    }
    else
    {
        chkCanLogin->Disable();
        wxDateTime empty;
        datValidUntil->SetValue(empty);
        timValidUntil->Disable();
    }

    // Role comments are only appropriate in 8.2+
    if (!connection->BackendMinimumVersion(8, 2))
        txtComment->Disable();

    // Replication roles added in 9.1
    if (!connection->BackendMinimumVersion(9, 1))
	{
		chkReplication->Disable();
	}


    if (!settings->GetShowUsersForPrivileges())
    {
        if (role)
            roleSql += wxT("\n   AND NOT rolcanlogin");
        else
            roleSql += wxT("\n WHERE NOT rolcanlogin");
    }
    roleSql += wxT("\n ORDER BY rolname");

    pgSetIterator roles(connection, roleSql);

    while (roles.RowsLeft())
        lbRolesNotIn->Append(roles.GetVal(wxT("rolname")));

    return dlgProperty::Go(modal);
}
void OcFeedsModelNew::feedsRequested(const QList<int> &updated, const QList<int> &newFeeds, const QList<int> &deleted)
{
    if (updated.isEmpty() && newFeeds.isEmpty() && deleted.isEmpty())
        return;

    QSqlQuery query;

    if (!updated.isEmpty()) {

        QLOG_INFO() << "Feeds model: updating changed feeds";

        for (int i = 0; i < updated.size(); ++i)
        {
            int idx = findIndex(updated.at(i), 0);

            if (!query.exec(QString("SELECT title, iconSource, iconWidth, iconHeight, folderId, localUnreadCount, FROM feeds WHERE id = %1").arg(updated.at(i)))) {
                QLOG_ERROR() << "Feeds model: failed to select data for changed feeds from database: " << query.lastError().text();
            }

            query.next();

            int fId = query.value(4).toInt();

            // check if updated feed is still child of these folder
            if ((idx != -999) && (fId == folderId())) {

                QLOG_DEBUG() << "Feeds model: updating feed at index " << idx;

                m_items.at(i)->title = query.value(0).toString();
                m_items.at(i)->iconSource = query.value(1).toString();
                m_items.at(i)->iconWidth = query.value(2).toInt();
                m_items.at(i)->iconHeight = query.value(3).toInt();

                QVector<int> roles(1, TitleRole);
                roles.append(IconSourceRole);
                roles.append(IconWidthRole);
                roles.append(IconHeightRole);

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
                emit dataChanged(index(idx), index(idx), roles);
#else
                emit dataChanged(index(idx), index(idx));
#endif
            } else if ((idx != -999) && (fId != folderId())) {

                // the updated feed is no longer child of these folder

                QLOG_DEBUG() << "Feeds model: removing feed at index " << idx << " because it is no longer child of this folder";

                beginRemoveRows(QModelIndex(), idx, idx);

                delete m_items.takeAt(i);

                endRemoveRows();
            } else if ((idx == -999) && (fId == folderId())) {

                // the feed has been moved to this folder

                QLOG_DEBUG() << "Feeds model: adding feed that has been moved to this folder";

                beginInsertRows(QModelIndex(), rowCount(), rowCount());

                OcFeedObject *fobj = new OcFeedObject(updated.at(i),
                                                      0,
                                                      query.value(0).toString(),
                                                      query.value(5).toInt(),
                                                      query.value(1).toString(),
                                                      query.value(2).toInt(),
                                                      query.value(3).toInt());
                m_items.append(fobj);

                endInsertRows();
            }
        }
    }


    if (!newFeeds.isEmpty()) {

        QString feedList("(");
        for (int i = 0; i < newFeeds.size(); ++i) {
            feedList.append(QString::number(newFeeds.at(i)));
            feedList.append(", ");
        }
        feedList.chop(2);
        feedList.append(")");

        int length = 0;

        if (!query.exec(QString("SELECT COUNT(id) FROM feeds WHERE folderId = %1 AND id IN %2").arg(folderId()).arg(feedList))) {
            QLOG_ERROR() << "Feeds model: failed to select count of new feeds in this folder from database: " << query.lastError().text();
        }

        query.next();

        length = query.value(0).toInt();

        if (length > 0) {

            QLOG_INFO() << "Feeds model: adding new feeds";

            if (!query.exec(QString("SELECT id, title, localUnreadCount, iconSource, iconWidth, iconHeight WHERE folderId = %1 AND id IN %2").arg(folderId()).arg(feedList))) {
                QLOG_ERROR() << "Feeds model: failed to select data for newly added feeds from database: " << query.lastError().text();
            }

            beginInsertRows(QModelIndex(), rowCount(), (rowCount() + length - 1));

            while(query.next()) {

                OcFeedObject *fobj = new OcFeedObject(query.value(0).toInt(),
                                                      0,
                                                      query.value(1).toString(),
                                                      query.value(2).toInt(),
                                                      query.value(3).toString(),
                                                      query.value(4).toInt(),
                                                      query.value(5).toInt());
                m_items.append(fobj);
            }

            endInsertRows();

            endInsertRows();
        }
    }


    if (!deleted.isEmpty()) {

        for (int i = 0; i < deleted.size(); ++i) {

            int idx = findIndex(deleted.at(i), 0);

            if (idx != -999) {

                QLOG_INFO() << "Feeds model: removing deleted feed at index " << idx;

                beginRemoveRows(QModelIndex(), idx, idx);

                delete m_items.takeAt(idx);

                endRemoveRows();
            }
        }
    }

    queryAndSetTotalUnread();
}
Exemple #14
0
void pgRole::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	if (!expandedKids)
	{
		expandedKids = true;
		wxString rolesquery;

		if (GetConnection()->BackendMinimumVersion(8, 2))
			rolesquery = wxT("SELECT rolname, admin_option,\n")
			             wxT(" pg_catalog.shobj_description(r.oid, 'pg_authid') AS description\n");
		else
			rolesquery = wxT("SELECT rolname, admin_option\n");

		rolesquery += wxT("  FROM pg_roles r\n")
		              wxT("  JOIN pg_auth_members ON r.oid=roleid\n")
		              wxT(" WHERE member=") + GetOidStr() + wxT("\n")
		              wxT(" ORDER BY rolname");

		pgSetIterator roles(GetConnection(), rolesquery);

		while (roles.RowsLeft())
		{
			wxString role = roles.GetVal(wxT("rolname"));
			if (roles.GetBool(wxT("admin_option")))
				role += PGROLE_ADMINOPTION;

			rolesIn.Add(role);
		}

		// Get configuration
		wxString query;
		if (GetConnection()->BackendMinimumVersion(9, 0))
		{
			query = wxT("WITH configs AS ")
			        wxT("(SELECT datname, unnest(setconfig) AS config")
			        wxT(" FROM pg_db_role_setting s")
			        wxT(" LEFT JOIN pg_database d ON d.oid=s.setdatabase")
			        wxT(" WHERE s.setrole=") + NumToStr(GetOid()) + wxT(")\n")
			        wxT("SELECT datname, split_part(config, '=', 1) AS variable, replace(config, split_part(config, '=', 1) || '=', '') AS value\n")
			        wxT("FROM configs");
		}
		else
		{
			wxString query_myrole = wxT("SELECT rolconfig FROM pg_roles WHERE oid=") + NumToStr(GetOid());
			query = wxT("SELECT '' AS datname, split_part(config, '=', 1) AS variable,\n")
			        wxT("       replace(config,split_part(config, '=', 1) || '=', '') AS value\n")
			        wxT("FROM (\n")
			        wxT("    SELECT\n")
			        wxT("      (\n")
			        wxT("      SELECT rolconfig[i]\n")
			        wxT("      FROM pg_roles\n")
			        wxT("      WHERE oid=") + NumToStr(GetOid()) + wxT("\n")
			        wxT("      ) AS config\n")
			        wxT("    FROM generate_series(array_lower((") + query_myrole + wxT("),1), array_upper((") + query_myrole + wxT("),1)) AS i\n")
			        wxT("     ) configs");
		}
		pgSet *configs = GetConnection()->ExecuteSet(query);
		if (configs)
		{
			while (!configs->Eof())
			{
				variables.Add(configs->GetVal(wxT("datname")));
				variables.Add(configs->GetVal(wxT("variable")));
				variables.Add(configs->GetVal(wxT("value")));
				configs->MoveNext();
			}
			delete configs;
		}
	}
	if (properties)
	{
		CreateListColumns(properties);

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("OID"), GetOid());
		properties->AppendItem(_("Account expires"), DateToAnsiStr(GetAccountExpires()));
		properties->AppendItem(_("Can login?"), BoolToYesNo(GetCanLogin()));
		properties->AppendItem(_("Superuser?"), BoolToYesNo(GetSuperuser()));
		properties->AppendItem(_("Create databases?"), BoolToYesNo(GetCreateDatabase()));
		properties->AppendItem(_("Create roles?"), BoolToYesNo(GetCreateRole()));

		if (!server->GetConnection()->BackendMinimumVersion(9, 5))
			properties->AppendItem(_("Update catalogs?"), BoolToYesNo(GetUpdateCatalog()));
		properties->AppendItem(_("Inherits?"), BoolToYesNo(GetInherits()));
		if (server->GetConnection()->BackendMinimumVersion(9, 1))
		{
			properties->AppendItem(_("Replication?"), BoolToYesNo(GetReplication()));
		}

		wxString strConnLimit;
		strConnLimit.Printf(wxT("%ld"), GetConnectionLimit());
		properties->AppendItem(_("Connection Limit"), strConnLimit);

		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));

		wxString roleList;

		size_t index;
		for (index = 0 ; index < rolesIn.GetCount() ; index++)
		{
			if (!roleList.IsEmpty())
				roleList += wxT(", ");
			roleList += rolesIn.Item(index);
		}
		properties->AppendItem(_("Member of"), roleList);

		wxString dbname;
		wxString parameter;
		wxString value;
		for (index = 0; index < variables.GetCount() ; index += 3)
		{
			dbname = variables.Item(index);
			parameter = variables.Item(index + 1);
			value = variables.Item(index + 2);

			if (dbname.Length() == 0)
			{
				properties->AppendItem(parameter, value);
			}
			else
			{
				properties->AppendItem(parameter + wxT(" (database ") + dbname + wxT(")"), value);
			}
		}

		if (!GetLabels().IsEmpty())
		{
			wxArrayString seclabels = GetProviderLabelArray();
			if (seclabels.GetCount() > 0)
			{
				for (unsigned int index = 0 ; index < seclabels.GetCount() - 1 ; index += 2)
				{
					properties->AppendItem(seclabels.Item(index), seclabels.Item(index + 1));
				}
			}
		}
	}
}