mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-17 13:24:15 -05:00
fixed serialisation bug and added new GUI bits
This commit is contained in:
parent
3fbbc57a1f
commit
bca89c63c6
@ -102,7 +102,7 @@ uint32_t RsGxsIdLocalInfoItem::serial_size()
|
|||||||
s += 4 ; // number of items
|
s += 4 ; // number of items
|
||||||
s += mTimeStamps.size() * (RsGxsId::SIZE_IN_BYTES + 8) ;
|
s += mTimeStamps.size() * (RsGxsId::SIZE_IN_BYTES + 8) ;
|
||||||
s += 4 ; // number of contacts
|
s += 4 ; // number of contacts
|
||||||
s += mContacts.size() * (RsGxsId::SIZE_IN_BYTES + 8) ;
|
s += mContacts.size() * RsGxsId::SIZE_IN_BYTES ;
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -271,6 +271,7 @@ bool p3IdService::loadList(std::list<RsItem*>& items)
|
|||||||
for(std::map<RsGxsId,time_t>::const_iterator it2 = lii->mTimeStamps.begin();it2!=lii->mTimeStamps.end();++it2)
|
for(std::map<RsGxsId,time_t>::const_iterator it2 = lii->mTimeStamps.begin();it2!=lii->mTimeStamps.end();++it2)
|
||||||
mKeysTS.insert(*it2) ;
|
mKeysTS.insert(*it2) ;
|
||||||
|
|
||||||
|
std::cerr << "p3IdService::loadList(): read " << lii->mContacts.size() << " contacts." << std::endl;
|
||||||
mContacts = lii->mContacts ;
|
mContacts = lii->mContacts ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,6 +435,12 @@ void IdDialog::insertIdList(uint32_t token)
|
|||||||
|
|
||||||
int accept = ui->filterComboBox->itemData(ui->filterComboBox->currentIndex()).toInt();
|
int accept = ui->filterComboBox->itemData(ui->filterComboBox->currentIndex()).toInt();
|
||||||
|
|
||||||
|
contactsItem = new QTreeWidgetItem();
|
||||||
|
contactsItem->setText(0, tr("Contacts"));
|
||||||
|
|
||||||
|
allItem = new QTreeWidgetItem();
|
||||||
|
allItem->setText(0, tr("All"));
|
||||||
|
|
||||||
RsGxsIdGroup data;
|
RsGxsIdGroup data;
|
||||||
std::vector<RsGxsIdGroup> datavector;
|
std::vector<RsGxsIdGroup> datavector;
|
||||||
std::vector<RsGxsIdGroup>::iterator vit;
|
std::vector<RsGxsIdGroup>::iterator vit;
|
||||||
@ -486,9 +492,25 @@ void IdDialog::insertIdList(uint32_t token)
|
|||||||
data = (*vit);
|
data = (*vit);
|
||||||
|
|
||||||
item = NULL;
|
item = NULL;
|
||||||
|
|
||||||
|
ui->idTreeWidget->insertTopLevelItem(0, contactsItem );
|
||||||
|
ui->idTreeWidget->insertTopLevelItem(0, allItem);
|
||||||
|
|
||||||
if (fillIdListItem(*vit, item, ownPgpId, accept))
|
if (fillIdListItem(*vit, item, ownPgpId, accept))
|
||||||
{
|
{
|
||||||
ui->idTreeWidget->addTopLevelItem(item);
|
RsIdentityDetails details;
|
||||||
|
std::string keyId = item->text(RSID_COL_KEYID).toStdString();
|
||||||
|
rsIdentity->getIdDetails(RsGxsId(keyId), details);
|
||||||
|
|
||||||
|
if(details.mFlags & RS_IDENTITY_FLAGS_IS_A_CONTACT)
|
||||||
|
{
|
||||||
|
contactsItem->addChild(item);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
allItem->addChild(item);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -952,6 +974,7 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
|
|||||||
if (item) {
|
if (item) {
|
||||||
uint32_t item_flags = item->data(RSID_COL_KEYID,Qt::UserRole).toUInt() ;
|
uint32_t item_flags = item->data(RSID_COL_KEYID,Qt::UserRole).toUInt() ;
|
||||||
|
|
||||||
|
|
||||||
if(!(item_flags & RSID_FILTER_OWNED_BY_YOU))
|
if(!(item_flags & RSID_FILTER_OWNED_BY_YOU))
|
||||||
{
|
{
|
||||||
if(own_identities.size() <= 1)
|
if(own_identities.size() <= 1)
|
||||||
@ -983,6 +1006,26 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
|
|||||||
}
|
}
|
||||||
|
|
||||||
contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send message to this person"), this, SLOT(sendMsg()));
|
contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send message to this person"), this, SLOT(sendMsg()));
|
||||||
|
|
||||||
|
RsIdentityDetails details;
|
||||||
|
std::string keyId = item->text(RSID_COL_KEYID).toStdString();
|
||||||
|
|
||||||
|
rsIdentity->getIdDetails(RsGxsId(keyId), details);
|
||||||
|
|
||||||
|
QAction *addContact = contextMnu.addAction(QIcon(), tr("Add to Contacts"), this, SLOT(addtoContacts()));
|
||||||
|
QAction *removeContact = contextMnu.addAction(QIcon(), tr("Remove from Contacts"), this, SLOT(removefromContacts()));
|
||||||
|
|
||||||
|
|
||||||
|
if(details.mFlags & RS_IDENTITY_FLAGS_IS_A_CONTACT)
|
||||||
|
{
|
||||||
|
addContact->setVisible(false);
|
||||||
|
removeContact->setVisible(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
addContact->setVisible(true);
|
||||||
|
removeContact->setVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1041,3 +1084,36 @@ void IdDialog::sendMsg()
|
|||||||
/* window will destroy itself! */
|
/* window will destroy itself! */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IdDialog::addtoContacts()
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
|
||||||
|
if (!item)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Id = item->text(RSID_COL_KEYID).toStdString();
|
||||||
|
|
||||||
|
rsIdentity->setAsRegularContact(RsGxsId(Id),true);
|
||||||
|
|
||||||
|
requestIdDetails();
|
||||||
|
requestIdList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IdDialog::removefromContacts()
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
|
||||||
|
if (!item)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Id = item->text(RSID_COL_KEYID).toStdString();
|
||||||
|
|
||||||
|
rsIdentity->setAsRegularContact(RsGxsId(Id),false);
|
||||||
|
|
||||||
|
requestIdDetails();
|
||||||
|
requestIdList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -75,6 +75,10 @@ private slots:
|
|||||||
/** Create the context popup menu and it's submenus */
|
/** Create the context popup menu and it's submenus */
|
||||||
void IdListCustomPopupMenu( QPoint point );
|
void IdListCustomPopupMenu( QPoint point );
|
||||||
|
|
||||||
|
void addtoContacts();
|
||||||
|
void removefromContacts();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void processSettings(bool load);
|
void processSettings(bool load);
|
||||||
|
|
||||||
@ -99,6 +103,9 @@ private:
|
|||||||
|
|
||||||
RsGxsGroupId mId;
|
RsGxsGroupId mId;
|
||||||
|
|
||||||
|
QTreeWidgetItem *contactsItem;
|
||||||
|
QTreeWidgetItem *allItem;
|
||||||
|
|
||||||
/* UI - Designer */
|
/* UI - Designer */
|
||||||
Ui::IdDialog *ui;
|
Ui::IdDialog *ui;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user