Added subscribe flags to GroupTreeWidget.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5906 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-11-28 12:31:14 +00:00
parent 25de47c6f9
commit ef9ebf4cf3
4 changed files with 32 additions and 31 deletions

View file

@ -37,12 +37,13 @@
#define COLUMN_COUNT 2
#define COLUMN_DATA COLUMN_NAME
#define ROLE_ID Qt::UserRole
#define ROLE_NAME Qt::UserRole + 1
#define ROLE_DESCRIPTION Qt::UserRole + 2
#define ROLE_POPULARITY Qt::UserRole + 3
#define ROLE_LASTPOST Qt::UserRole + 4
#define ROLE_SEARCH_SCORE Qt::UserRole + 5
#define ROLE_ID Qt::UserRole
#define ROLE_NAME Qt::UserRole + 1
#define ROLE_DESCRIPTION Qt::UserRole + 2
#define ROLE_POPULARITY Qt::UserRole + 3
#define ROLE_LASTPOST Qt::UserRole + 4
#define ROLE_SEARCH_SCORE Qt::UserRole + 5
#define ROLE_SUBSCRIBE_FLAGS Qt::UserRole + 6
#define COMBO_NAME_INDEX 0
#define COMBO_DESC_INDEX 1
@ -299,6 +300,8 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
item->setToolTip(COLUMN_NAME, tooltip);
item->setToolTip(COLUMN_POPULARITY, tooltip);
item->setData(COLUMN_DATA, ROLE_SUBSCRIBE_FLAGS, itemInfo.subscribeFlags);
/* Set color */
QBrush brush;
if (itemInfo.privatekey) {
@ -390,6 +393,16 @@ QTreeWidgetItem *GroupTreeWidget::activateId(const QString &id, bool focus)
return item;
}
int GroupTreeWidget::subscribeFlags(const QString &id)
{
QTreeWidgetItem *item = getItemFromId(id);
if (item == NULL) {
return 0;
}
return item->data(COLUMN_DATA, ROLE_SUBSCRIBE_FLAGS).toInt();
}
void GroupTreeWidget::calculateScore(QTreeWidgetItem *item, const QString &filterText)
{
if (item) {