Changeset View
Changeset View
Standalone View
Standalone View
krusader/FileSystem/krquery.cpp
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Line(s) | 98 | { | |||
---|---|---|---|---|---|
114 | group = old.group; | 114 | group = old.group; | ||
115 | perm = old.perm; | 115 | perm = old.perm; | ||
116 | type = old.type; | 116 | type = old.type; | ||
117 | customType = old.customType; | 117 | customType = old.customType; | ||
118 | inArchive = old.inArchive; | 118 | inArchive = old.inArchive; | ||
119 | recurse = old.recurse; | 119 | recurse = old.recurse; | ||
120 | followLinksP = old.followLinksP; | 120 | followLinksP = old.followLinksP; | ||
121 | whereToSearch = old.whereToSearch; | 121 | whereToSearch = old.whereToSearch; | ||
122 | excludedFolderNames = old.excludedFolderNames; | ||||
122 | whereNotToSearch = old.whereNotToSearch; | 123 | whereNotToSearch = old.whereNotToSearch; | ||
123 | origFilter = old.origFilter; | 124 | origFilter = old.origFilter; | ||
124 | 125 | | |||
125 | codec = old.codec; | 126 | codec = old.codec; | ||
126 | 127 | | |||
127 | encodedEnterArray = old.encodedEnterArray; | 128 | encodedEnterArray = old.encodedEnterArray; | ||
128 | encodedEnter = encodedEnterArray.data(); | 129 | encodedEnter = encodedEnterArray.data(); | ||
129 | encodedEnterLen = encodedEnterArray.size(); | 130 | encodedEnterLen = encodedEnterArray.size(); | ||
▲ Show 20 Lines • Show All 606 Lines • ▼ Show 20 Line(s) | |||||
736 | { | 737 | { | ||
737 | bNull = false; | 738 | bNull = false; | ||
738 | type = typeIn; | 739 | type = typeIn; | ||
739 | customType = customList; | 740 | customType = customList; | ||
740 | } | 741 | } | ||
741 | 742 | | |||
742 | bool KRQuery::isExcluded(const QUrl &url) | 743 | bool KRQuery::isExcluded(const QUrl &url) | ||
743 | { | 744 | { | ||
744 | for (int i = 0; i < whereNotToSearch.count(); ++i) | 745 | for (QUrl &item : whereNotToSearch) | ||
745 | if (whereNotToSearch[i].isParentOf(url) || | 746 | if (item.isParentOf(url) || url.matches(item, QUrl::StripTrailingSlash)) | ||
746 | url.matches(whereNotToSearch[i], QUrl::StripTrailingSlash)) | | |||
747 | return true; | 747 | return true; | ||
748 | 748 | | |||
749 | if (!matchDirName(url.fileName())) | 749 | // Exclude folder names that are configured in settings | ||
750 | QString filename = url.fileName(); | ||||
751 | for (QString &item : excludedFolderNames) | ||||
752 | if (filename == item) | ||||
753 | return true; | ||||
754 | | ||||
755 | if (!matchDirName(filename)) | ||||
750 | return true; | 756 | return true; | ||
751 | 757 | | |||
martinkostolny: Just a suggestion for simplification:
```
const QString basename = url.fileName();
for (const… | |||||
abika: +1 | |||||
752 | return false; | 758 | return false; | ||
753 | } | 759 | } | ||
754 | 760 | | |||
755 | void KRQuery::setSearchInDirs(const QList<QUrl> &urls) | 761 | void KRQuery::setSearchInDirs(const QList<QUrl> &urls) | ||
756 | { | 762 | { | ||
757 | whereToSearch.clear(); | 763 | whereToSearch.clear(); | ||
758 | for (int i = 0; i < urls.count(); ++i) { | 764 | for (int i = 0; i < urls.count(); ++i) { | ||
759 | QString url = urls[i].url(); | 765 | QString url = urls[i].url(); | ||
760 | QUrl completed = QUrl::fromUserInput(KUrlCompletion::replacedPath(url, true, true), | 766 | QUrl completed = QUrl::fromUserInput(KUrlCompletion::replacedPath(url, true, true), | ||
761 | QString(), QUrl::AssumeLocalFile); | 767 | QString(), QUrl::AssumeLocalFile); | ||
762 | whereToSearch.append(completed); | 768 | whereToSearch.append(completed); | ||
763 | } | 769 | } | ||
764 | } | 770 | } | ||
765 | 771 | | |||
766 | void KRQuery::setDontSearchInDirs(const QList<QUrl> &urls) | 772 | void KRQuery::setDontSearchInDirs(const QList<QUrl> &urls) | ||
767 | { | 773 | { | ||
768 | whereNotToSearch.clear(); | 774 | whereNotToSearch.clear(); | ||
769 | for (int i = 0; i < urls.count(); ++i) { | 775 | for (int i = 0; i < urls.count(); ++i) { | ||
770 | QString url = urls[i].url(); | 776 | QString url = urls[i].url(); | ||
771 | QUrl completed = QUrl::fromUserInput(KUrlCompletion::replacedPath(url, true, true), | 777 | QUrl completed = QUrl::fromUserInput(KUrlCompletion::replacedPath(url, true, true), | ||
772 | QString(), QUrl::AssumeLocalFile); | 778 | QString(), QUrl::AssumeLocalFile); | ||
773 | whereNotToSearch.append(completed); | 779 | whereNotToSearch.append(completed); | ||
774 | } | 780 | } | ||
775 | } | 781 | } | ||
782 | void KRQuery::setExcludeFolderNames(const QStringList &paths) | ||||
783 | { | ||||
784 | excludedFolderNames.clear(); | ||||
785 | excludedFolderNames.append(paths); | ||||
786 | } |
Just a suggestion for simplification: