mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed display of warning in posting into forums without proper credentials
This commit is contained in:
parent
9dc7328dc7
commit
7d8001b60d
@ -135,6 +135,8 @@ static void loadPrivateIdsCallback(GxsIdDetailsType type, const RsIdentityDetail
|
|||||||
QString text = GxsIdDetails::getNameForType(type, details);
|
QString text = GxsIdDetails::getNameForType(type, details);
|
||||||
QString id = QString::fromStdString(details.mId.toStdString());
|
QString id = QString::fromStdString(details.mId.toStdString());
|
||||||
|
|
||||||
|
std::cerr << "chooser: in callback. details.mId=" << details.mId << ", name=" << details.mNickname << " count before=" << chooser->count()<< std::endl;
|
||||||
|
|
||||||
/* Find and replace text of exisiting item */
|
/* Find and replace text of exisiting item */
|
||||||
int index = chooser->findData(id);
|
int index = chooser->findData(id);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
@ -144,6 +146,7 @@ static void loadPrivateIdsCallback(GxsIdDetailsType type, const RsIdentityDetail
|
|||||||
chooser->addItem(text, id);
|
chooser->addItem(text, id);
|
||||||
index = chooser->count() - 1;
|
index = chooser->count() - 1;
|
||||||
}
|
}
|
||||||
|
std::cerr << "chooser: in callback. count after=" << chooser->count()<< std::endl;
|
||||||
|
|
||||||
QList<QIcon> icons;
|
QList<QIcon> icons;
|
||||||
|
|
||||||
@ -194,21 +197,47 @@ bool GxsIdChooser::isInConstraintSet(const RsGxsId& id) const
|
|||||||
}
|
}
|
||||||
void GxsIdChooser::setEntryEnabled(int indx,bool enabled)
|
void GxsIdChooser::setEntryEnabled(int indx,bool enabled)
|
||||||
{
|
{
|
||||||
bool disable = !enabled ;
|
removeItem(indx) ;
|
||||||
|
|
||||||
QSortFilterProxyModel* model = qobject_cast<QSortFilterProxyModel*>(QComboBox::model());
|
// bool disable = !enabled ;
|
||||||
//QStandardItem* item = model->item(index);
|
//
|
||||||
|
// QSortFilterProxyModel* model = qobject_cast<QSortFilterProxyModel*>(QComboBox::model());
|
||||||
|
// //QStandardItem* item = model->item(index);
|
||||||
|
//
|
||||||
|
// QModelIndex ii = model->index(indx,0);
|
||||||
|
//
|
||||||
|
// // visually disable by greying out - works only if combobox has been painted already and palette returns the wanted color
|
||||||
|
// //model->setFlags(ii,disable ? (model->flags(ii) & ~(Qt::ItemIsSelectable|Qt::ItemIsEnabled)) : (Qt::ItemIsSelectable|Qt::ItemIsEnabled));
|
||||||
|
//
|
||||||
|
// uint32_t v = enabled?(1|32):(0);
|
||||||
|
//
|
||||||
|
// std::cerr << "GxsIdChooser::setEnabledEntry: i=" << indx << ", v=" << v << std::endl;
|
||||||
|
//
|
||||||
|
// // clear item data in order to use default color
|
||||||
|
// //model->setData(ii,disable ? (QComboBox::palette().color(QPalette::Disabled, QPalette::Text)) : QVariant(), Qt::TextColorRole);
|
||||||
|
// model->setData(ii,QVariant(v),Qt::UserRole-1) ;
|
||||||
|
//
|
||||||
|
// std::cerr << "model data after operation: " << model->data(ii,Qt::UserRole-1).toUInt() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
QModelIndex ii = model->index(indx,0);
|
uint32_t GxsIdChooser::countEnabledEntries() const
|
||||||
|
{
|
||||||
|
return count() ;
|
||||||
|
|
||||||
// visually disable by greying out - works only if combobox has been painted already and palette returns the wanted color
|
// uint32_t res = 0 ;
|
||||||
//model->setFlags(ii,disable ? (model->flags(ii) & ~(Qt::ItemIsSelectable|Qt::ItemIsEnabled)) : (Qt::ItemIsSelectable|Qt::ItemIsEnabled));
|
// QSortFilterProxyModel* model = qobject_cast<QSortFilterProxyModel*>(QComboBox::model());
|
||||||
|
//
|
||||||
uint32_t v = enabled?(1|32):(0);
|
// for(uint32_t i=0;i<model->rowCount();++i)
|
||||||
|
// {
|
||||||
// clear item data in order to use default color
|
// QModelIndex ii = model->index(i,0);
|
||||||
//model->setData(ii,disable ? (QComboBox::palette().color(QPalette::Disabled, QPalette::Text)) : QVariant(), Qt::TextColorRole);
|
// uint32_t v = model->data(ii,Qt::UserRole-1).toUInt() ;
|
||||||
model->setData(ii,QVariant(v),Qt::UserRole-1) ;
|
//
|
||||||
|
// std::cerr << "GxsIdChooser::countEnabledEntries(): i=" << i << ", v=" << v << std::endl;
|
||||||
|
// if(v > 0)
|
||||||
|
// ++res ;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return res ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsIdChooser::loadPrivateIds()
|
void GxsIdChooser::loadPrivateIds()
|
||||||
|
@ -62,6 +62,8 @@ public:
|
|||||||
|
|
||||||
void setIdConstraintSet(const std::set<RsGxsId>& s) ;
|
void setIdConstraintSet(const std::set<RsGxsId>& s) ;
|
||||||
bool isInConstraintSet(const RsGxsId& id) const ;
|
bool isInConstraintSet(const RsGxsId& id) const ;
|
||||||
|
|
||||||
|
uint32_t countEnabledEntries() const ;
|
||||||
signals:
|
signals:
|
||||||
// emitted after first load of own ids
|
// emitted after first load of own ids
|
||||||
void idsLoaded();
|
void idsLoaded();
|
||||||
|
@ -507,7 +507,7 @@ void CreateGxsForumMsg::loadForumCircleInfo(const uint32_t& token)
|
|||||||
ui.idChooser->setFlags(IDCHOOSER_NO_CREATE | ui.idChooser->flags()) ; // since there's a circle involved, no ID creation can be needed
|
ui.idChooser->setFlags(IDCHOOSER_NO_CREATE | ui.idChooser->flags()) ; // since there's a circle involved, no ID creation can be needed
|
||||||
|
|
||||||
RsGxsId tmpid ;
|
RsGxsId tmpid ;
|
||||||
if(ui.idChooser->getChosenId(tmpid) == GxsIdChooser::None)
|
if(ui.idChooser->countEnabledEntries() == 0)
|
||||||
{
|
{
|
||||||
QMessageBox::information(NULL,tr("No compatible ID for this forum"),tr("Sorry, but this forum is restricted to a circle that contains none of your identities. As a consequence you cannot post in this forum, since your posts could not be propagated.")) ;
|
QMessageBox::information(NULL,tr("No compatible ID for this forum"),tr("Sorry, but this forum is restricted to a circle that contains none of your identities. As a consequence you cannot post in this forum, since your posts could not be propagated.")) ;
|
||||||
close() ;
|
close() ;
|
||||||
|
Loading…
Reference in New Issue
Block a user