aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKåre Särs <[email protected]>2015-03-15 08:49:52 +0200
committerKåre Särs <[email protected]>2015-03-15 08:49:52 +0200
commit28b22c918d456042d9ec88447e2081fae42a8ffd (patch)
tree1be0057dfa00c8f7ce17bf05efe777bd32d7acc9
parentab3d216843314ee1e901bc35f960fb9740539eaf (diff)
Fix "include binary files" in search.
-rw-r--r--addons/search/FolderFilesList.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/addons/search/FolderFilesList.cpp b/addons/search/FolderFilesList.cpp
index 5baf060..f77699f 100644
--- a/addons/search/FolderFilesList.cpp
+++ b/addons/search/FolderFilesList.cpp
@@ -24,6 +24,8 @@
#include <QFileInfo>
#include <QFileInfoList>
#include <QDebug>
+#include <QMimeDatabase>
+#include <QMimeType>
FolderFilesList::FolderFilesList(QObject *parent) : QThread(parent) {}
@@ -87,8 +89,11 @@ void FolderFilesList::checkNextItem(const QFileInfo &item)
return;
}
if (item.isFile()) {
- if (!m_binary && false /* KMimeType::isBinaryData(item.absoluteFilePath()) FIXME KF5 */) {
- return;
+ if (!m_binary) {
+ QMimeType mimeType = QMimeDatabase().mimeTypeForFile(item);
+ if (!mimeType.inherits(QStringLiteral("text/plain"))) {
+ return;
+ }
}
m_files << item.absoluteFilePath();
}