From 5069a1a10e4175c90eee3cb5f3443a29ddf04808 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 18 Feb 2023 17:01:29 +0100 Subject: [PATCH] fixed filtering of files in channels --- .../src/gui/gxschannels/GxsChannelFilesStatusWidget.cpp | 4 ++++ .../src/gui/gxschannels/GxsChannelPostFilesModel.cpp | 4 +--- .../src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelFilesStatusWidget.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelFilesStatusWidget.cpp index aae58540b..66eb0f793 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelFilesStatusWidget.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelFilesStatusWidget.cpp @@ -306,6 +306,10 @@ void GxsChannelFilesStatusWidget::resume() void GxsChannelFilesStatusWidget::cancel() { + // When QMessgeBox asks for cancel confirmtion, this makes the widget lose focus => since it is an editor widget, + // it gets destroyed by the parent list widget => subsequent code after the QMessageBox runs over a deleted object => crash + // In summary: no QMessageBox here when the Status widget is used as an editor. + if(!mUsedAsEditor) if ((QMessageBox::question(this, "", tr("Are you sure that you want to cancel and delete the file?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No)) == QMessageBox::No) { return; diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostFilesModel.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostFilesModel.cpp index be2f288ac..a0db07085 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostFilesModel.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostFilesModel.cpp @@ -295,7 +295,7 @@ void RsGxsChannelPostFilesModel::setFilter(const QStringList& strings, uint32_t& { preMods(); - initEmptyHierarchy(); + mFilteredFiles.clear(); if(strings.empty()) { @@ -317,8 +317,6 @@ void RsGxsChannelPostFilesModel::setFilter(const QStringList& strings, uint32_t& } count = mFilteredFiles.size(); - std::cerr << "After filtering: " << count << " posts remain." << std::endl; - if (rowCount()>0) { beginInsertRows(QModelIndex(),0,rowCount()-1); diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui index cc98c8e56..8de933c1c 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui @@ -194,7 +194,7 @@ - 1 + 2 @@ -402,7 +402,7 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">Description</span></p></body></html>