Merge pull request #2663 from csoler/v0.6-BugFixing_20

Bug fixing
This commit is contained in:
csoler 2023-01-04 21:36:47 +01:00 committed by GitHub
commit f65a761c9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 57 additions and 30 deletions

View File

@ -1457,7 +1457,8 @@ void SearchDialog::copyResultLink()
QList<QTreeWidgetItem*> itemsForCopy = ui.searchResultWidget->selectedItems();
QTreeWidgetItem * item;
std::map<RsFileHash,RetroShareLink> url_map;
std::set<RsFileHash> already_seen_hashes;
QList<RetroShareLink> urls ;
for (auto item:itemsForCopy)
{
@ -1466,7 +1467,7 @@ void SearchDialog::copyResultLink()
QString fhash = item->text(SR_HASH_COL);
RsFileHash hash(fhash.toStdString());
if(!hash.isNull())
if(!hash.isNull() && (already_seen_hashes.end() == already_seen_hashes.find(hash)))
{
std::cerr << "SearchDialog::copyResultLink() Calling set retroshare link";
std::cerr << std::endl;
@ -1477,18 +1478,16 @@ void SearchDialog::copyResultLink()
RetroShareLink link = RetroShareLink::createFile(fname, fsize, fhash);
if (link.valid())
url_map[hash] = link;
{
std::cerr << "new link added to clipboard: " << link.toString().toStdString() << std::endl ;
urls.push_back(link);
already_seen_hashes.insert(hash);
}
}
}
QList<RetroShareLink> urls ;
for(auto link:url_map)
{
std::cerr << "new link added to clipboard: " << link.second.toString().toStdString() << std::endl ;
urls.push_back(link.second);
}
RSLinkClipboard::copyLinks(urls) ;
if(!urls.empty())
RSLinkClipboard::copyLinks(urls) ;
}
void SearchDialog::sendLinkTo( )

View File

@ -43,7 +43,7 @@ public:
/** Constructor */
PostedDialog::PostedDialog(QWidget *parent):
GxsGroupFrameDialog(rsPosted, parent), mEventHandlerId(0)
GxsGroupFrameDialog(rsPosted, settingsGroupName(),parent), mEventHandlerId(0)
{
// Needs to be asynced because this function is likely to be called by another thread!
rsEvents->registerEventsHandler(

View File

@ -70,8 +70,8 @@ static const uint32_t DELAY_BETWEEN_GROUP_STATISTICS_UPDATE = 120; // do not upd
*/
/** Constructor */
GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *parent,bool allow_dist_sync)
: MainPage(parent)
GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl,const QString& settings_name, QWidget *parent,bool allow_dist_sync)
: MainPage(parent),mSettingsName(settings_name)
{
/* Invoke the Qt Designer generated object setup routine */
ui = new Ui::GxsGroupFrameDialog();
@ -166,7 +166,6 @@ void GxsGroupFrameDialog::initUi()
}
// load settings
mSettingsName = settingsGroupName();
processSettings(true);
if (groupFrameSettingsType() != GroupFrameSettings::Nothing) {
@ -1178,20 +1177,49 @@ void GxsGroupFrameDialog::updateGroupStatisticsReal(const RsGxsGroupId &groupId)
void GxsGroupFrameDialog::getServiceStatistics(GxsServiceStatistic& stats) const
{
stats = GxsServiceStatistic(); // clears everything
if(!mCachedGroupStats.empty())
{
stats = GxsServiceStatistic(); // clears everything
for(auto& it: mCachedGroupStats)
{
const GxsGroupStatistic& s(it.second);
for(auto& it: mCachedGroupStats)
{
const GxsGroupStatistic& s(it.second);
stats.mNumMsgs += s.mNumMsgs;
stats.mNumGrps += 1;
stats.mSizeOfMsgs += s.mTotalSizeOfMsgs;
stats.mNumThreadMsgsNew += s.mNumThreadMsgsNew;
stats.mNumThreadMsgsUnread += s.mNumThreadMsgsUnread;
stats.mNumChildMsgsNew += s.mNumChildMsgsNew ;
stats.mNumChildMsgsUnread += s.mNumChildMsgsUnread ;
}
stats.mNumMsgs += s.mNumMsgs;
stats.mNumGrps += 1;
stats.mSizeOfMsgs += s.mTotalSizeOfMsgs;
stats.mNumThreadMsgsNew += s.mNumThreadMsgsNew;
stats.mNumThreadMsgsUnread += s.mNumThreadMsgsUnread;
stats.mNumChildMsgsNew += s.mNumChildMsgsNew ;
stats.mNumChildMsgsUnread += s.mNumChildMsgsUnread ;
}
// Also save the service statistics in conf file, so that we can display it right away at start.
Settings->beginGroup(mSettingsName);
Settings->setValue("NumMsgs", stats.mNumMsgs );
Settings->setValue("NumGrps", stats.mNumGrps );
Settings->setValue("SizeOfMessages", stats.mSizeOfMsgs );
Settings->setValue("NumThreadMsgsNew", stats.mNumThreadMsgsNew );
Settings->setValue("NumThreadMsgsUnread",stats.mNumThreadMsgsUnread);
Settings->setValue("NumChildMsgsNew", stats.mNumChildMsgsNew );
Settings->setValue("NumChildMsgsUnread", stats.mNumChildMsgsUnread );
Settings->endGroup();
}
else // Get statistics from settings if no cache is already present: allows to display at start.
{
Settings->beginGroup(mSettingsName);
stats.mNumMsgs = Settings->value("NumMsgs",QVariant(0)).toInt();
stats.mNumGrps = Settings->value("NumGrps",QVariant(0)).toInt();
stats.mSizeOfMsgs = Settings->value("SizeOfMessages",QVariant(0)).toInt();
stats.mNumThreadMsgsNew = Settings->value("NumThreadMsgsNew",QVariant(0)).toInt();
stats.mNumThreadMsgsUnread = Settings->value("NumThreadMsgsUnread",QVariant(0)).toInt();
stats.mNumChildMsgsNew = Settings->value("NumChildMsgsNew",QVariant(0)).toInt();
stats.mNumChildMsgsUnread = Settings->value("NumChildMsgsUnread",QVariant(0)).toInt();
Settings->endGroup();
}
}
TurtleRequestId GxsGroupFrameDialog::distantSearch(const QString& search_string) // this should be overloaded in the child class

View File

@ -71,7 +71,7 @@ public:
};
public:
GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *parent = 0,bool allow_dist_sync=false);
GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, const QString& settings_name,QWidget *parent = 0,bool allow_dist_sync=false);
virtual ~GxsGroupFrameDialog();
bool navigate(const RsGxsGroupId &groupId, const RsGxsMessageId& msgId);

View File

@ -49,7 +49,7 @@
/** Constructor */
GxsChannelDialog::GxsChannelDialog(QWidget *parent):
GxsGroupFrameDialog(rsGxsChannels, parent, true), mEventHandlerId(0)
GxsGroupFrameDialog(rsGxsChannels, settingsGroupName(),parent, true), mEventHandlerId(0)
{
// Needs to be asynced because this function is called by another thread!
rsEvents->registerEventsHandler(

View File

@ -40,7 +40,7 @@ public:
/** Constructor */
GxsForumsDialog::GxsForumsDialog(QWidget *parent) :
GxsGroupFrameDialog(rsGxsForums, parent), mEventHandlerId(0)
GxsGroupFrameDialog(rsGxsForums, settingsGroupName(),parent), mEventHandlerId(0)
{
mCountChildMsgs = true;