2 * This file is part of the Nepomuk KDE project.
3 * Copyright (C) 2006-2007 Sebastian Trueg <trueg@kde.org>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #ifndef _NEPOMUK_STRIGI_CONFIG_H_
22 #define _NEPOMUK_STRIGI_CONFIG_H_
24 #include <QtCore/QObject>
25 #include <QtCore/QStringList>
32 * Parser and writer class for Strigidaemon config
35 * The default Strigi config file can be found at
36 * ~/.strigi/daemon.conf.
38 class StrigiConfigFile
: public QObject
44 StrigiConfigFile( const QString
& filename
);
47 void setFilename( const QString
& filename
);
53 * A Strigi repository. Normally there is only one.
57 QString
name() const { return m_name
; }
58 QString
type() const { return m_type
; }
59 QString
indexDir() const { return m_indexDir
; }
60 bool writeable() const { return m_writeable
; }
61 QString
urlBase() const { return m_urlBase
; }
62 QStringList
indexedDirectories() const { return m_indexedDirectories
; }
63 int pollingInterval() const { return m_pollingInterval
; }
65 bool isValid() const { return !m_type
.isEmpty(); }
67 void setType( const QString
& type
) { m_type
= type
; }
68 void setName( const QString
& name
) { m_name
= name
; }
69 void setIndexDir( const QString
& dir
) { m_indexDir
= dir
; }
70 void setWriteable( bool writeable
) { m_writeable
= writeable
; }
71 void setUrlBase( const QString
& urlBase
) { m_urlBase
= urlBase
; }
72 void addIndexedDirectory( const QString
& dir
) { m_indexedDirectories
<< dir
; }
73 void setIndexedDirectories( const QStringList
& dirs
) { m_indexedDirectories
= dirs
; }
74 void setPollingInterval( int pollingInterval
) { m_pollingInterval
= pollingInterval
; }
82 QStringList m_indexedDirectories
;
83 int m_pollingInterval
;
87 QStringList
excludeFilters() const;
88 QStringList
includeFilters() const;
89 QList
<Repository
> repositories() const;
92 * In most cases (or even always) there is only
93 * one repository. This method will return the
94 * first repository in the list or create a default
95 * one and insert it if the list is empty.
97 * This will also create default filters if none are
98 * specified AND no repository is configured.
100 Repository
& defaultRepository();
101 const Repository
& defaultRepository() const;
104 * ~/.strigi/daemon.conf
106 static QString
defaultStrigiConfigFilePath();
111 void setUseDBus( bool b
);
112 void setExcludeFilters( const QStringList
& filters
);
113 void addExcludeFilter( const QString
& filter
);
114 void setIncludeFilters( const QStringList
& filters
);
115 void addInludeFilter( const QString
& filter
);
116 void setRepositories( const QList
<Repository
>& repos
);
117 void addRepository( const Repository
& repo
);
120 bool readConfig( const QDomElement
& );
121 Repository
readRepositoryConfig( const QDomElement
& );
122 bool readFilterConfig( const QDomElement
& filterElement
);
127 QStringList m_excludeFilters
;
128 QStringList m_includeFilters
;
129 QList
<Repository
> m_repositories
;
133 QTextStream
& operator<<( QTextStream
& s
, const Nepomuk::StrigiConfigFile
& scf
);