MCPcopy Create free account
hub / github.com/KDE/kdevelop / isValid

Method isValid

plugins/projectfilter/projectfilter.cpp:28–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28bool ProjectFilter::isValid( const Path &path, const bool isFolder ) const
29{
30 if (!isFolder && path == m_projectFile) {
31 // do not show the project file
32 ///TODO: enable again once the project page is ready for consumption
33 return false;
34 } else if (isFolder && path == m_project) {
35 // always show the project root
36 return true;
37 }
38
39 if (isFolder && path.isLocalFile() && QFile::exists(path.toLocalFile() + QLatin1String("/.kdev_ignore"))) {
40 return false;
41 }
42
43 // from here on the user can configure what he wants to see or not.
44
45 // we operate on the path relative to the project base
46 // by prepending a slash we can filter hidden files with the pattern "*/.*"
47
48 const QString relativePath = makeRelative(path);
49
50 if (isFolder && relativePath.endsWith(QLatin1String("/.kdev4"))) {
51 return false;
52 }
53
54 bool isValid = true;
55 for (const Filter& filter : m_filters) {
56 if (isFolder && !(filter.targets & Filter::Folders)) {
57 continue;
58 } else if (!isFolder && !(filter.targets & Filter::Files)) {
59 continue;
60 }
61 if ((!isValid && filter.type == Filter::Inclusive) || (isValid && filter.type == Filter::Exclusive)) {
62 const bool match = filter.pattern.exactMatch( relativePath );
63 if (filter.type == Filter::Inclusive) {
64 isValid = match;
65 } else {
66 isValid = !match;
67 }
68 }
69 }
70 return isValid;
71}
72
73QString ProjectFilter::makeRelative(const Path& path) const
74{

Callers 15

indexFromConfigStringMethod · 0.45
indexToConfigStringMethod · 0.45
paintMethod · 0.45
locateCurrentDocumentMethod · 0.45
dataMethod · 0.45
branchNameReadyMethod · 0.45
popupContextMenuMethod · 0.45
keyPressEventMethod · 0.45
updateKompareModelMethod · 0.45
seekFileMethod · 0.45
textRemovedMethod · 0.45
documentReloadedMethod · 0.45

Calls 3

isLocalFileMethod · 0.80
toLocalFileMethod · 0.80
endsWithMethod · 0.80

Tested by 2

matchMethod · 0.36
benchMethod · 0.36