diff --git a/CMakeLists.txt b/CMakeLists.txt index 3476f51a..3fdae58f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -712,7 +712,9 @@ set_target_properties(nheko # # Add qml files # - +if(QT_KNOWN_POLICY_QTP0004) + qt_policy(SET QTP0004 NEW) +endif() set(QML_SOURCES resources/qml/Root.qml resources/qml/ChatPage.qml diff --git a/src/MxcImageProvider.cpp b/src/MxcImageProvider.cpp index d4dd2f16..ba4c4dd0 100644 --- a/src/MxcImageProvider.cpp +++ b/src/MxcImageProvider.cpp @@ -299,12 +299,10 @@ MxcImageProvider::download(const QString &id, "/media_cache", fileName); QDir().mkpath(fileInfo.absolutePath()); + QFile f(fileInfo.absoluteFilePath()); - if (fileInfo.exists()) { + if (fileInfo.exists() && f.open(QIODevice::ReadOnly)) { if (encryptionInfo) { - QFile f(fileInfo.absoluteFilePath()); - f.open(QIODevice::ReadOnly); - QByteArray fileData = f.readAll(); auto tempData = mtx::crypto::to_string( mtx::crypto::decrypt_file(fileData.toStdString(), encryptionInfo.value())); diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp index 823ffe20..ce2a8f84 100644 --- a/src/timeline/RoomlistModel.cpp +++ b/src/timeline/RoomlistModel.cpp @@ -977,6 +977,10 @@ FilteredRoomlistModel::getRoomById(const QString &id) const void FilteredRoomlistModel::updateHiddenTagsAndSpaces() { +#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0) + beginFilterChange(); +#endif + hiddenTags.clear(); hiddenSpaces.clear(); hideDMs = false; @@ -991,7 +995,11 @@ FilteredRoomlistModel::updateHiddenTagsAndSpaces() hideDMs = true; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0) + endFilterChange(); +#else invalidateFilter(); +#endif } bool diff --git a/src/timeline/RoomlistModel.h b/src/timeline/RoomlistModel.h index c3f485ef..7dfeb707 100644 --- a/src/timeline/RoomlistModel.h +++ b/src/timeline/RoomlistModel.h @@ -212,6 +212,10 @@ public slots: void updateFilterTag(QString tagId) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0) + beginFilterChange(); +#endif + if (tagId.startsWith(QLatin1String("tag:"))) { filterType = FilterBy::Tag; filterStr = tagId.mid(4); @@ -227,7 +231,11 @@ public slots: filterStr.clear(); } +#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0) + endFilterChange(); +#else invalidateFilter(); +#endif } void updateHiddenTagsAndSpaces(); diff --git a/src/timeline/TimelineFilter.cpp b/src/timeline/TimelineFilter.cpp index 8e323ff6..b9e93859 100644 --- a/src/timeline/TimelineFilter.cpp +++ b/src/timeline/TimelineFilter.cpp @@ -41,7 +41,13 @@ TimelineFilter::startFiltering() { incrementalSearchIndex = 0; emit isFilteringChanged(); + +#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0) + endFilterChange(); +#else invalidateFilter(); +#endif + beginResetModel(); endResetModel(); @@ -181,6 +187,10 @@ void TimelineFilter::setSource(TimelineModel *s) { if (auto orig = this->source(); orig != s) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0) + beginFilterChange(); +#endif + cachedCount = 0; incrementalSearchIndex = 0; @@ -215,7 +225,12 @@ TimelineFilter::setSource(TimelineModel *s) emit sourceChanged(); emit isFilteringChanged(); + +#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0) + endFilterChange(); +#else invalidateFilter(); +#endif } }