~ubuntu-branches/ubuntu/lucid/kdebase-runtime/lucid

« back to all changes in this revision

Viewing changes to nepomuk/services/strigi/strigiserviceconfig.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-03-29 18:14:36 UTC
  • mto: This revision was merged to the branch mainline in revision 109.
  • Revision ID: james.westby@ubuntu.com-20100329181436-fb4m27cpigph5apt
Tags: upstream-4.4.2
ImportĀ upstreamĀ versionĀ 4.4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#define _NEPOMUK_STRIGI_SERVICE_CONFIG_H_
21
21
 
22
22
#include <QtCore/QObject>
 
23
#include <QtCore/QList>
 
24
#include <QtCore/QRegExp>
23
25
 
24
26
#include <kconfig.h>
25
27
#include <kio/global.h>
39
41
        static StrigiServiceConfig* self();
40
42
 
41
43
        /**
42
 
         * The folders to search for files to analyze
43
 
         */
44
 
        QStringList folders() const;
45
 
 
46
 
        /**
47
 
         * The folders that should be excluded.
 
44
         * A cleaned up list of all include and exclude folders
 
45
         * with their respective include/exclude flag sorted by
 
46
         * path. None of the paths have trailing slashes.
 
47
         */
 
48
        QList<QPair<QString, bool> > folders() const;
 
49
 
 
50
        /**
 
51
         * The folders to search for files to analyze. Cached and cleaned up.
 
52
         */
 
53
        QStringList includeFolders() const;
 
54
 
 
55
        /**
 
56
         * The folders that should be excluded. Cached and cleaned up.
48
57
         * It is perfectly possible to include subfolders again.
49
58
         */
50
59
        QStringList excludeFolders() const;
51
60
 
52
61
        QStringList excludeFilters() const;
53
 
        QStringList includeFilters() const;
 
62
 
 
63
        QList<QRegExp> excludeFilterRegExps() const { return m_excludeFilterRegExpCache; }
54
64
 
55
65
        bool indexHiddenFolders() const;
56
66
 
67
77
        bool isInitialRun() const;
68
78
 
69
79
        /**
70
 
         * Check if the folder should be indexed based on 
 
80
         * Check if the folder should be indexed based on
71
81
         * folders() and excludeFolders()
72
82
         */
73
 
        bool shouldFolderBeIndexed( const QString& );
 
83
        bool shouldFolderBeIndexed( const QString& ) const;
 
84
 
 
85
        /**
 
86
         * Check \p fileName for all exclude filters. This does
 
87
         * not take file paths into account.
 
88
         */
 
89
        bool shouldFileBeIndexed( const QString& fileName ) const;
74
90
 
75
91
    Q_SIGNALS:
76
92
        void configChanged();
81
97
    private:
82
98
        StrigiServiceConfig();
83
99
 
 
100
        /**
 
101
         * Check if \p path is in the list of folders to be indexed taking
 
102
         * include and exclude folders into account.
 
103
         * \p exact is set to true if \p path is a top level folder from
 
104
         * the include or exclude list.
 
105
         */
 
106
        bool folderInFolderList( const QString& path, bool& exact ) const;
 
107
        void buildFolderCache();
 
108
        void buildExcludeFilterRegExpCache();
 
109
 
84
110
        KConfig m_config;
 
111
 
 
112
        /// Caching cleaned up list (no duplicates, no useless entries, etc.)
 
113
        QList<QPair<QString, bool> > m_folderCache;
 
114
 
 
115
        /// cache of regexp objects for all exclude filters
 
116
        /// to prevent regexp parsing over and over
 
117
        QList<QRegExp> m_excludeFilterRegExpCache;
85
118
    };
86
119
}
87
120