diff --git a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp index 2ecf442e4..832970833 100644 --- a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp @@ -86,6 +86,18 @@ const int SearchDialog::FILETYPE_IDX_DIRECTORY = 8; QMap * SearchDialog::FileTypeExtensionMap = new QMap(); bool SearchDialog::initialised = false; +struct SearchDialog::FileDetail +{ +public: + RsPeerId id; + std::string name; + RsFileHash hash; + std::string path; + uint64_t size; + uint32_t mtime; + uint32_t rank; +}; + /** Constructor */ SearchDialog::SearchDialog(QWidget *parent) : MainPage(parent), @@ -265,6 +277,8 @@ void SearchDialog::handleEvent_main_thread(std::shared_ptr event) f.hash = fe->mResults[i].fHash; f.name = fe->mResults[i].fName; f.size = fe->mResults[i].fSize; + f.mtime = 0; // zero what's not available, otherwise we'll get some random values displayed. + f.rank = 0; updateFiles(fe->mRequestId,f); } @@ -966,7 +980,7 @@ void SearchDialog::searchKeywords(const QString& keywords) } } -void SearchDialog::updateFiles(qulonglong search_id,FileDetail file) +void SearchDialog::updateFiles(qulonglong search_id,const FileDetail& file) { searchResultsQueue.push_back(std::pair(search_id,file)) ; @@ -1320,8 +1334,8 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s item->setText(SR_SIZE_COL, QString::number(file.size)); item->setData(SR_SIZE_COL, ROLE_SORT, (qulonglong) file.size); - item->setText(SR_AGE_COL, QString::number(file.age)); - item->setData(SR_AGE_COL, ROLE_SORT, file.age); + item->setText(SR_AGE_COL, QString::number(file.mtime)); + item->setData(SR_AGE_COL, ROLE_SORT, file.mtime); item->setTextAlignment( SR_SIZE_COL, Qt::AlignRight ); int friendSource = 0; int anonymousSource = 0; @@ -1396,21 +1410,21 @@ void SearchDialog::resultsToTree(const QString& txt,qulonglong searchId, const s std::list::const_iterator it; for(it = results.begin(); it != results.end(); ++it) - if (it->type == DIR_TYPE_FILE) { + if (it->type == DIR_TYPE_FILE) + { FileDetail fd; fd.id = it->id; fd.name = it->name; fd.hash = it->hash; fd.path = it->path; fd.size = it->size; - fd.age = it->mtime; + fd.mtime= it->mtime; fd.rank = 0; insertFile(searchId,fd, FRIEND_SEARCH); - } else if (it->type == DIR_TYPE_DIR) { -// insertDirectory(txt, searchId, *it, NULL); + } + else if (it->type == DIR_TYPE_DIR) insertDirectory(txt, searchId, *it); - } ui.searchResultWidget->setSortingEnabled(true); } diff --git a/retroshare-gui/src/gui/FileTransfer/SearchDialog.h b/retroshare-gui/src/gui/FileTransfer/SearchDialog.h index 5661f6246..8aa7bac64 100644 --- a/retroshare-gui/src/gui/FileTransfer/SearchDialog.h +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.h @@ -43,6 +43,7 @@ class SearchDialog : public MainPage Q_PROPERTY(QColor textColorLowSources READ textColorLowSources WRITE setTextColorLowSources) Q_PROPERTY(QColor textColorHighSources READ textColorHighSources WRITE setTextColorHighSources) + struct FileDetail; // useful structure to store search results. public: /** Default Constructor */ SearchDialog(QWidget *parent = 0); @@ -63,8 +64,7 @@ public: void setTextColorLowSources(QColor color) { mTextColorLowSources = color; } void setTextColorHighSources(QColor color) { mTextColorHighSources = color; } -public slots: - void updateFiles(qulonglong request_id,FileDetail file) ; + void updateFiles(qulonglong request_id, const FileDetail& file) ; private slots: diff --git a/retroshare-gui/src/gui/RSHumanReadableDelegate.h b/retroshare-gui/src/gui/RSHumanReadableDelegate.h index 3e9a3e412..18943c1dc 100644 --- a/retroshare-gui/src/gui/RSHumanReadableDelegate.h +++ b/retroshare-gui/src/gui/RSHumanReadableDelegate.h @@ -91,7 +91,8 @@ class RSHumanReadableAgeDelegate: public RSHumanReadableDelegate QStyleOptionViewItem opt(option) ; setPainterOptions(painter,opt,index) ; - painter->drawText(opt.rect, Qt::AlignCenter, misc::timeRelativeToNow(index.data().toLongLong())) ; + if(index.data().toLongLong() > 0) // no date is present. + painter->drawText(opt.rect, Qt::AlignCenter, misc::timeRelativeToNow(index.data().toLongLong())) ; } }; diff --git a/retroshare-gui/src/gui/notifyqt.h b/retroshare-gui/src/gui/notifyqt.h index 0f9ae11e2..5782ef5b7 100644 --- a/retroshare-gui/src/gui/notifyqt.h +++ b/retroshare-gui/src/gui/notifyqt.h @@ -117,7 +117,6 @@ class NotifyQt: public QObject, public NotifyClient void chatStatusChanged(const ChatId&,const QString&) const ; void chatCleared(const ChatId&) const ; void peerHasNewCustomStateString(const QString& /* peer_id */, const QString& /* status_string */) const ; - void gotTurtleSearchResult(qulonglong search_id,FileDetail file) const ; void peerHasNewAvatar(const QString& peer_id) const ; void ownAvatarChanged() const ; void ownStatusMessageChanged() const ; diff --git a/retroshare-gui/src/gui/settings/TransferPage.cpp b/retroshare-gui/src/gui/settings/TransferPage.cpp index c0cf3608f..4b704ddd3 100644 --- a/retroshare-gui/src/gui/settings/TransferPage.cpp +++ b/retroshare-gui/src/gui/settings/TransferPage.cpp @@ -46,6 +46,8 @@ TransferPage::TransferPage(QWidget * parent, Qt::WindowFlags flags) ui._max_tr_up_per_sec_SB->setMinimum(max_tr_low); ui._max_tr_up_per_sec_SB->setMaximum(max_tr_high); + whileBlocking(ui._trustFriendNodesWithBannedFiles_CB)->setChecked(rsFiles->trustFriendNodesWithBannedFiles()); + QObject::connect(ui._queueSize_SB,SIGNAL(valueChanged(int)),this,SLOT(updateQueueSize(int))) ; QObject::connect(ui._max_up_SB,SIGNAL(valueChanged(int)),this,SLOT(updateMaxUploadSlots(int))) ; QObject::connect(ui._defaultStrategy_CB,SIGNAL(activated(int)),this,SLOT(updateDefaultStrategy(int))) ; @@ -53,6 +55,7 @@ TransferPage::TransferPage(QWidget * parent, Qt::WindowFlags flags) QObject::connect(ui._diskSpaceLimit_SB,SIGNAL(valueChanged(int)),this,SLOT(updateDiskSizeLimit(int))) ; QObject::connect(ui._max_tr_up_per_sec_SB, SIGNAL( valueChanged( int ) ), this, SLOT( updateMaxTRUpRate(int) ) ); QObject::connect(ui._filePermDirectDL_CB,SIGNAL(activated(int)),this,SLOT(updateFilePermDirectDL(int))); + QObject::connect(ui._trustFriendNodesWithBannedFiles_CB,SIGNAL(toggled(bool)),this,SLOT(toggleTrustFriendNodesWithBannedFiles(bool))) ; QObject::connect(ui.incomingButton, SIGNAL(clicked( bool ) ), this , SLOT( setIncomingDirectory() ) ); QObject::connect(ui.autoDLColl_CB, SIGNAL(toggled(bool)), this, SLOT(updateAutoDLColl())); @@ -94,7 +97,10 @@ void TransferPage::updateIgnoreLists() std::cerr << " suffixes: " ; for(auto it(ls.begin());it!=ls.end();++it) std::cerr << "\"" << *it << "\" " ; std::cerr << std::endl; #endif } - +void TransferPage::toggleTrustFriendNodesWithBannedFiles(bool b) +{ + rsFiles->setTrustFriendNodesWithBannedFiles(b); +} void TransferPage::updateMaxTRUpRate(int b) { rsTurtle->setMaxTRForwardRate(b) ; diff --git a/retroshare-gui/src/gui/settings/TransferPage.h b/retroshare-gui/src/gui/settings/TransferPage.h index 1a88d29d5..a2a0a1061 100644 --- a/retroshare-gui/src/gui/settings/TransferPage.h +++ b/retroshare-gui/src/gui/settings/TransferPage.h @@ -58,7 +58,8 @@ class TransferPage: public ConfigPage void updateAutoDLColl(); void setPartialsDirectory(); void toggleAutoCheckDirectories(bool); - void updateFontSize(); + void toggleTrustFriendNodesWithBannedFiles(bool); + void updateFontSize(); void updateAutoCheckDirectories() ; void updateAutoScanDirectoriesPeriod() ; diff --git a/retroshare-gui/src/gui/settings/TransferPage.ui b/retroshare-gui/src/gui/settings/TransferPage.ui index b1e7b7630..7ab2b9493 100644 --- a/retroshare-gui/src/gui/settings/TransferPage.ui +++ b/retroshare-gui/src/gui/settings/TransferPage.ui @@ -547,7 +547,7 @@ p, li { white-space: pre-wrap; } - + Trust friend nodes with banned files diff --git a/retroshare-gui/src/main.cpp b/retroshare-gui/src/main.cpp index 3361597c8..e33fe795d 100644 --- a/retroshare-gui/src/main.cpp +++ b/retroshare-gui/src/main.cpp @@ -536,11 +536,9 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO); // avoid clashes between infos from threads. // - qRegisterMetaType("FileDetail") ; qRegisterMetaType("RsPeerId") ; std::cerr << "connecting signals and slots" << std::endl ; -// QObject::connect(notify,SIGNAL(gotTurtleSearchResult(qulonglong,FileDetail)),w->transfersDialog->searchDialog ,SLOT(updateFiles(qulonglong,FileDetail))) ; QObject::connect(notify,SIGNAL(deferredSignatureHandlingRequested()),notify,SLOT(handleSignatureEvent()),Qt::QueuedConnection) ; QObject::connect(notify,SIGNAL(chatLobbyTimeShift(int)),notify,SLOT(handleChatLobbyTimeShift(int)),Qt::QueuedConnection) ; QObject::connect(notify,SIGNAL(diskFull(int,int)) ,w ,SLOT(displayDiskSpaceWarning(int,int))) ;