mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-16 09:03:51 -05:00
added new column for owner name/ID
This commit is contained in:
parent
756ded0b5d
commit
e369ba3504
3 changed files with 35 additions and 22 deletions
|
|
@ -398,7 +398,8 @@ IdDialog::IdDialog(QWidget *parent)
|
||||||
/* Setup tree */
|
/* Setup tree */
|
||||||
//ui->idTreeWidget->sortByColumn(RsIdentityListModel::COLUMN_THREAD_NAME, Qt::AscendingOrder);
|
//ui->idTreeWidget->sortByColumn(RsIdentityListModel::COLUMN_THREAD_NAME, Qt::AscendingOrder);
|
||||||
|
|
||||||
ui->idTreeWidget->setColumnHidden(RsIdentityListModel::COLUMN_THREAD_OWNER, true);
|
ui->idTreeWidget->setColumnHidden(RsIdentityListModel::COLUMN_THREAD_OWNER_ID, true);
|
||||||
|
ui->idTreeWidget->setColumnHidden(RsIdentityListModel::COLUMN_THREAD_OWNER_NAME, true);
|
||||||
ui->idTreeWidget->setColumnHidden(RsIdentityListModel::COLUMN_THREAD_ID, true);
|
ui->idTreeWidget->setColumnHidden(RsIdentityListModel::COLUMN_THREAD_ID, true);
|
||||||
|
|
||||||
ui->idTreeWidget->setItemDelegate(new RSElidedItemDelegate());
|
ui->idTreeWidget->setItemDelegate(new RSElidedItemDelegate());
|
||||||
|
|
@ -2054,7 +2055,8 @@ void IdDialog::headerContextMenuRequested(QPoint)
|
||||||
};
|
};
|
||||||
|
|
||||||
addEntry(tr("Id"),RsIdentityListModel::COLUMN_THREAD_ID);
|
addEntry(tr("Id"),RsIdentityListModel::COLUMN_THREAD_ID);
|
||||||
addEntry(tr("Owner"),RsIdentityListModel::COLUMN_THREAD_OWNER);
|
addEntry(tr("Owner Id"),RsIdentityListModel::COLUMN_THREAD_OWNER_ID);
|
||||||
|
addEntry(tr("Owner Name"),RsIdentityListModel::COLUMN_THREAD_OWNER_NAME);
|
||||||
addEntry(tr("Reputation"),RsIdentityListModel::COLUMN_THREAD_REPUTATION);
|
addEntry(tr("Reputation"),RsIdentityListModel::COLUMN_THREAD_REPUTATION);
|
||||||
|
|
||||||
//addEntry(tr("Name"),RsIdentityListModel::COLUMN_THREAD_NAME);
|
//addEntry(tr("Name"),RsIdentityListModel::COLUMN_THREAD_NAME);
|
||||||
|
|
@ -2357,7 +2359,7 @@ void IdDialog::sendMsg()
|
||||||
for(const auto& id : lst)
|
for(const auto& id : lst)
|
||||||
nMsgDialog->addRecipient(MessageComposer::TO, id);
|
nMsgDialog->addRecipient(MessageComposer::TO, id);
|
||||||
|
|
||||||
nMsgDialog->show();
|
nMsgDialog->show();
|
||||||
nMsgDialog->activateWindow();
|
nMsgDialog->activateWindow();
|
||||||
|
|
||||||
/* window will destroy itself! */
|
/* window will destroy itself! */
|
||||||
|
|
@ -2393,8 +2395,8 @@ void IdDialog::negativePerson()
|
||||||
for(const auto& id : lst)
|
for(const auto& id : lst)
|
||||||
rsReputations->setOwnOpinion(id, RsOpinion::NEGATIVE);
|
rsReputations->setOwnOpinion(id, RsOpinion::NEGATIVE);
|
||||||
|
|
||||||
updateIdentity();
|
updateIdentity();
|
||||||
updateIdList();
|
updateIdList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IdDialog::neutralPerson()
|
void IdDialog::neutralPerson()
|
||||||
|
|
@ -2404,8 +2406,8 @@ void IdDialog::neutralPerson()
|
||||||
for(const auto& id : lst)
|
for(const auto& id : lst)
|
||||||
rsReputations->setOwnOpinion(id, RsOpinion::NEUTRAL);
|
rsReputations->setOwnOpinion(id, RsOpinion::NEUTRAL);
|
||||||
|
|
||||||
updateIdentity();
|
updateIdentity();
|
||||||
updateIdList();
|
updateIdList();
|
||||||
}
|
}
|
||||||
void IdDialog::positivePerson()
|
void IdDialog::positivePerson()
|
||||||
{
|
{
|
||||||
|
|
@ -2414,8 +2416,8 @@ void IdDialog::positivePerson()
|
||||||
for(const auto& id : lst)
|
for(const auto& id : lst)
|
||||||
rsReputations->setOwnOpinion(id, RsOpinion::POSITIVE);
|
rsReputations->setOwnOpinion(id, RsOpinion::POSITIVE);
|
||||||
|
|
||||||
updateIdentity();
|
updateIdentity();
|
||||||
updateIdList();
|
updateIdList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IdDialog::addtoContacts()
|
void IdDialog::addtoContacts()
|
||||||
|
|
@ -2425,7 +2427,7 @@ void IdDialog::addtoContacts()
|
||||||
for(const auto& id : lst)
|
for(const auto& id : lst)
|
||||||
rsIdentity->setAsRegularContact(id,true);
|
rsIdentity->setAsRegularContact(id,true);
|
||||||
|
|
||||||
updateIdList();
|
updateIdList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IdDialog::removefromContacts()
|
void IdDialog::removefromContacts()
|
||||||
|
|
@ -2435,7 +2437,7 @@ void IdDialog::removefromContacts()
|
||||||
for(const auto& id : lst)
|
for(const auto& id : lst)
|
||||||
rsIdentity->setAsRegularContact(id,false);
|
rsIdentity->setAsRegularContact(id,false);
|
||||||
|
|
||||||
updateIdList();
|
updateIdList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IdDialog::on_closeInfoFrameButton_Invite_clicked()
|
void IdDialog::on_closeInfoFrameButton_Invite_clicked()
|
||||||
|
|
|
||||||
|
|
@ -300,13 +300,16 @@ QVariant RsIdentityListModel::headerData(int section, Qt::Orientation /*orientat
|
||||||
{
|
{
|
||||||
case COLUMN_THREAD_NAME: return tr("Name");
|
case COLUMN_THREAD_NAME: return tr("Name");
|
||||||
case COLUMN_THREAD_ID: return tr("Id");
|
case COLUMN_THREAD_ID: return tr("Id");
|
||||||
case COLUMN_THREAD_REPUTATION: return tr("Reputation");
|
case COLUMN_THREAD_REPUTATION: return QVariant();
|
||||||
case COLUMN_THREAD_OWNER: return tr("Owner");
|
case COLUMN_THREAD_OWNER_ID: return tr("Owner Id");
|
||||||
default:
|
case COLUMN_THREAD_OWNER_NAME: return tr("Owner");
|
||||||
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
if(role == Qt::DecorationRole && section == COLUMN_THREAD_REPUTATION)
|
||||||
|
return QIcon(":/icons/flag-green.png");
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant RsIdentityListModel::data(const QModelIndex &index, int role) const
|
QVariant RsIdentityListModel::data(const QModelIndex &index, int role) const
|
||||||
|
|
@ -480,11 +483,12 @@ QVariant RsIdentityListModel::sizeHintRole(const EntryIndex& e,int col) const
|
||||||
case COLUMN_THREAD_NAME: return QVariant( QSize(x_factor * 70 , y_factor*14*1.1f ));
|
case COLUMN_THREAD_NAME: return QVariant( QSize(x_factor * 70 , y_factor*14*1.1f ));
|
||||||
case COLUMN_THREAD_ID: return QVariant( QSize(x_factor * 175, y_factor*14*1.1f ));
|
case COLUMN_THREAD_ID: return QVariant( QSize(x_factor * 175, y_factor*14*1.1f ));
|
||||||
case COLUMN_THREAD_REPUTATION: return QVariant( QSize(x_factor * 20 , y_factor*14*1.1f ));
|
case COLUMN_THREAD_REPUTATION: return QVariant( QSize(x_factor * 20 , y_factor*14*1.1f ));
|
||||||
case COLUMN_THREAD_OWNER: return QVariant( QSize(x_factor * 70 , y_factor*14*1.1f ));
|
case COLUMN_THREAD_OWNER_NAME: return QVariant( QSize(x_factor * 70 , y_factor*14*1.1f ));
|
||||||
|
case COLUMN_THREAD_OWNER_ID: return QVariant( QSize(x_factor * 70 , y_factor*14*1.1f ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant RsIdentityListModel::treePathRole(const EntryIndex& entry,int column) const
|
QVariant RsIdentityListModel::treePathRole(const EntryIndex& entry,int /*column*/) const
|
||||||
{
|
{
|
||||||
if(entry.type == ENTRY_TYPE_CATEGORY)
|
if(entry.type == ENTRY_TYPE_CATEGORY)
|
||||||
return QString::number((int)entry.category_index);
|
return QString::number((int)entry.category_index);
|
||||||
|
|
@ -498,7 +502,8 @@ QVariant RsIdentityListModel::sortRole(const EntryIndex& entry,int column) const
|
||||||
case COLUMN_THREAD_REPUTATION: return decorationRole(entry,column);
|
case COLUMN_THREAD_REPUTATION: return decorationRole(entry,column);
|
||||||
|
|
||||||
case COLUMN_THREAD_ID:
|
case COLUMN_THREAD_ID:
|
||||||
case COLUMN_THREAD_OWNER:
|
case COLUMN_THREAD_OWNER_ID:
|
||||||
|
case COLUMN_THREAD_OWNER_NAME:
|
||||||
case COLUMN_THREAD_NAME: [[__fallthrough__]];
|
case COLUMN_THREAD_NAME: [[__fallthrough__]];
|
||||||
default:
|
default:
|
||||||
return displayRole(entry,column);
|
return displayRole(entry,column);
|
||||||
|
|
@ -632,7 +637,12 @@ QVariant RsIdentityListModel::displayRole(const EntryIndex& e, int col) const
|
||||||
{
|
{
|
||||||
case COLUMN_THREAD_NAME: return QVariant(QString::fromUtf8(det.mNickname.c_str()));
|
case COLUMN_THREAD_NAME: return QVariant(QString::fromUtf8(det.mNickname.c_str()));
|
||||||
case COLUMN_THREAD_ID: return QVariant(QString::fromStdString(det.mId.toStdString()) );
|
case COLUMN_THREAD_ID: return QVariant(QString::fromStdString(det.mId.toStdString()) );
|
||||||
case COLUMN_THREAD_OWNER: if(det.mPgpId.isNull())
|
case COLUMN_THREAD_OWNER_NAME: if(det.mPgpId.isNull())
|
||||||
|
return QVariant();
|
||||||
|
else
|
||||||
|
return QVariant(QString::fromStdString(rsPeers->getGPGName(det.mPgpId)) );
|
||||||
|
|
||||||
|
case COLUMN_THREAD_OWNER_ID: if(det.mPgpId.isNull())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
else
|
else
|
||||||
return QVariant(QString::fromStdString(det.mPgpId.toStdString()) );
|
return QVariant(QString::fromStdString(det.mPgpId.toStdString()) );
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,10 @@ public:
|
||||||
enum Columns {
|
enum Columns {
|
||||||
COLUMN_THREAD_NAME = 0x00,
|
COLUMN_THREAD_NAME = 0x00,
|
||||||
COLUMN_THREAD_ID = 0x01,
|
COLUMN_THREAD_ID = 0x01,
|
||||||
COLUMN_THREAD_OWNER = 0x02,
|
COLUMN_THREAD_OWNER_NAME = 0x02,
|
||||||
COLUMN_THREAD_REPUTATION = 0x03,
|
COLUMN_THREAD_OWNER_ID = 0x03,
|
||||||
COLUMN_THREAD_NB_COLUMNS = 0x04
|
COLUMN_THREAD_REPUTATION = 0x04,
|
||||||
|
COLUMN_THREAD_NB_COLUMNS = 0x05
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Roles{ SortRole = Qt::UserRole+1,
|
enum Roles{ SortRole = Qt::UserRole+1,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue