mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-13 07:38:54 -05:00
commit
f65a761c9d
6 changed files with 57 additions and 30 deletions
|
|
@ -1457,7 +1457,8 @@ void SearchDialog::copyResultLink()
|
||||||
QList<QTreeWidgetItem*> itemsForCopy = ui.searchResultWidget->selectedItems();
|
QList<QTreeWidgetItem*> itemsForCopy = ui.searchResultWidget->selectedItems();
|
||||||
QTreeWidgetItem * item;
|
QTreeWidgetItem * item;
|
||||||
|
|
||||||
std::map<RsFileHash,RetroShareLink> url_map;
|
std::set<RsFileHash> already_seen_hashes;
|
||||||
|
QList<RetroShareLink> urls ;
|
||||||
|
|
||||||
for (auto item:itemsForCopy)
|
for (auto item:itemsForCopy)
|
||||||
{
|
{
|
||||||
|
|
@ -1466,7 +1467,7 @@ void SearchDialog::copyResultLink()
|
||||||
QString fhash = item->text(SR_HASH_COL);
|
QString fhash = item->text(SR_HASH_COL);
|
||||||
RsFileHash hash(fhash.toStdString());
|
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 << "SearchDialog::copyResultLink() Calling set retroshare link";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
@ -1477,18 +1478,16 @@ void SearchDialog::copyResultLink()
|
||||||
RetroShareLink link = RetroShareLink::createFile(fname, fsize, fhash);
|
RetroShareLink link = RetroShareLink::createFile(fname, fsize, fhash);
|
||||||
|
|
||||||
if (link.valid())
|
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)
|
if(!urls.empty())
|
||||||
{
|
RSLinkClipboard::copyLinks(urls) ;
|
||||||
std::cerr << "new link added to clipboard: " << link.second.toString().toStdString() << std::endl ;
|
|
||||||
urls.push_back(link.second);
|
|
||||||
}
|
|
||||||
|
|
||||||
RSLinkClipboard::copyLinks(urls) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchDialog::sendLinkTo( )
|
void SearchDialog::sendLinkTo( )
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public:
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
PostedDialog::PostedDialog(QWidget *parent):
|
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!
|
// Needs to be asynced because this function is likely to be called by another thread!
|
||||||
rsEvents->registerEventsHandler(
|
rsEvents->registerEventsHandler(
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,8 @@ static const uint32_t DELAY_BETWEEN_GROUP_STATISTICS_UPDATE = 120; // do not upd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *parent,bool allow_dist_sync)
|
GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl,const QString& settings_name, QWidget *parent,bool allow_dist_sync)
|
||||||
: MainPage(parent)
|
: MainPage(parent),mSettingsName(settings_name)
|
||||||
{
|
{
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
ui = new Ui::GxsGroupFrameDialog();
|
ui = new Ui::GxsGroupFrameDialog();
|
||||||
|
|
@ -166,7 +166,6 @@ void GxsGroupFrameDialog::initUi()
|
||||||
}
|
}
|
||||||
|
|
||||||
// load settings
|
// load settings
|
||||||
mSettingsName = settingsGroupName();
|
|
||||||
processSettings(true);
|
processSettings(true);
|
||||||
|
|
||||||
if (groupFrameSettingsType() != GroupFrameSettings::Nothing) {
|
if (groupFrameSettingsType() != GroupFrameSettings::Nothing) {
|
||||||
|
|
@ -1178,20 +1177,49 @@ void GxsGroupFrameDialog::updateGroupStatisticsReal(const RsGxsGroupId &groupId)
|
||||||
|
|
||||||
void GxsGroupFrameDialog::getServiceStatistics(GxsServiceStatistic& stats) const
|
void GxsGroupFrameDialog::getServiceStatistics(GxsServiceStatistic& stats) const
|
||||||
{
|
{
|
||||||
stats = GxsServiceStatistic(); // clears everything
|
if(!mCachedGroupStats.empty())
|
||||||
|
{
|
||||||
|
stats = GxsServiceStatistic(); // clears everything
|
||||||
|
|
||||||
for(auto& it: mCachedGroupStats)
|
for(auto& it: mCachedGroupStats)
|
||||||
{
|
{
|
||||||
const GxsGroupStatistic& s(it.second);
|
const GxsGroupStatistic& s(it.second);
|
||||||
|
|
||||||
stats.mNumMsgs += s.mNumMsgs;
|
stats.mNumMsgs += s.mNumMsgs;
|
||||||
stats.mNumGrps += 1;
|
stats.mNumGrps += 1;
|
||||||
stats.mSizeOfMsgs += s.mTotalSizeOfMsgs;
|
stats.mSizeOfMsgs += s.mTotalSizeOfMsgs;
|
||||||
stats.mNumThreadMsgsNew += s.mNumThreadMsgsNew;
|
stats.mNumThreadMsgsNew += s.mNumThreadMsgsNew;
|
||||||
stats.mNumThreadMsgsUnread += s.mNumThreadMsgsUnread;
|
stats.mNumThreadMsgsUnread += s.mNumThreadMsgsUnread;
|
||||||
stats.mNumChildMsgsNew += s.mNumChildMsgsNew ;
|
stats.mNumChildMsgsNew += s.mNumChildMsgsNew ;
|
||||||
stats.mNumChildMsgsUnread += s.mNumChildMsgsUnread ;
|
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
|
TurtleRequestId GxsGroupFrameDialog::distantSearch(const QString& search_string) // this should be overloaded in the child class
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
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();
|
virtual ~GxsGroupFrameDialog();
|
||||||
|
|
||||||
bool navigate(const RsGxsGroupId &groupId, const RsGxsMessageId& msgId);
|
bool navigate(const RsGxsGroupId &groupId, const RsGxsMessageId& msgId);
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
GxsChannelDialog::GxsChannelDialog(QWidget *parent):
|
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!
|
// Needs to be asynced because this function is called by another thread!
|
||||||
rsEvents->registerEventsHandler(
|
rsEvents->registerEventsHandler(
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public:
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
GxsForumsDialog::GxsForumsDialog(QWidget *parent) :
|
GxsForumsDialog::GxsForumsDialog(QWidget *parent) :
|
||||||
GxsGroupFrameDialog(rsGxsForums, parent), mEventHandlerId(0)
|
GxsGroupFrameDialog(rsGxsForums, settingsGroupName(),parent), mEventHandlerId(0)
|
||||||
{
|
{
|
||||||
mCountChildMsgs = true;
|
mCountChildMsgs = true;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue