~ubuntu-branches/ubuntu/quantal/kde-runtime/quantal

« back to all changes in this revision

Viewing changes to nepomuk/services/fileindexer/fileindexer.h

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2012-06-03 21:50:00 UTC
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: package-import@ubuntu.com-20120603215000-vn7oarsq0ynrydj5
Tags: upstream-4.8.80
Import upstream version 4.8.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* This file is part of the KDE Project
2
 
   Copyright (c) 2008-2010 Sebastian Trueg <trueg@kde.org>
3
 
   Copyright (c) 2010 Vishesh Handa <handa.vish@gmail.com>
4
 
 
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 version 2 as published by the Free Software Foundation.
8
 
 
9
 
   This library is distributed in the hope that it will be useful,
10
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 
   Library General Public License for more details.
13
 
 
14
 
   You should have received a copy of the GNU Library General Public License
15
 
   along with this library; see the file COPYING.LIB.  If not, write to
16
 
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
 
   Boston, MA 02110-1301, USA.
18
 
*/
19
 
 
20
 
#ifndef _NEPOMUK_STRIGI_SERVICE_H_
21
 
#define _NEPOMUK_STRIGI_SERVICE_H_
22
 
 
23
 
#include <Nepomuk/Service>
24
 
#include <QtCore/QTimer>
25
 
#include <QtCore/QThread>
26
 
 
27
 
namespace Strigi {
28
 
    class IndexManager;
29
 
}
30
 
 
31
 
namespace Nepomuk {
32
 
 
33
 
    class IndexScheduler;
34
 
 
35
 
    /**
36
 
     * Service controlling the strigidaemon
37
 
     */
38
 
    class FileIndexer : public Nepomuk::Service
39
 
    {
40
 
        Q_OBJECT
41
 
        Q_CLASSINFO("D-Bus Interface", "org.kde.nepomuk.Strigi")
42
 
 
43
 
    public:
44
 
        FileIndexer( QObject* parent = 0, const QList<QVariant>& args = QList<QVariant>() );
45
 
        ~FileIndexer();
46
 
 
47
 
    Q_SIGNALS:
48
 
        void statusStringChanged();
49
 
        void statusChanged(); //vHanda: Can't we just use statusStringChanged? or should that be renamed
50
 
        void indexingFolder( const QString& path );
51
 
        void indexingStarted();
52
 
        void indexingStopped();
53
 
 
54
 
    public Q_SLOTS:
55
 
        /**
56
 
         * \return A user readable status string. Includes the currently indexed folder.
57
 
         */
58
 
        QString userStatusString() const;
59
 
 
60
 
        /**
61
 
         * Simplified status string without details.
62
 
         */
63
 
        QString simpleUserStatusString() const;
64
 
 
65
 
        bool isSuspended() const;
66
 
        bool isIndexing() const;
67
 
 
68
 
        void resume() const;
69
 
        void suspend() const;
70
 
        void setSuspended( bool );
71
 
 
72
 
        QString currentFolder() const;
73
 
        QString currentFile() const;
74
 
 
75
 
        /**
76
 
         * Update folder \a path if it is configured to be indexed.
77
 
         */
78
 
        void updateFolder( const QString& path, bool recursive, bool forced );
79
 
 
80
 
        /**
81
 
         * Update all folders configured to be indexed.
82
 
         */
83
 
        void updateAllFolders( bool forced );
84
 
 
85
 
        /**
86
 
         * Index a folder independent of its configuration status.
87
 
         */
88
 
        void indexFolder( const QString& path, bool recursive, bool forced );
89
 
 
90
 
        /**
91
 
         * Index a specific file
92
 
         */
93
 
        void indexFile( const QString& path, bool forced );
94
 
 
95
 
    private Q_SLOTS:
96
 
        void finishInitialization();
97
 
        void updateWatches();
98
 
        void slotIdleTimeoutReached();
99
 
        void slotIdleTimerResume();
100
 
        void slotIndexingDone();
101
 
 
102
 
    private:
103
 
        void updateStrigiConfig();
104
 
        QString userStatusString( bool simple ) const;
105
 
 
106
 
        IndexScheduler* m_indexScheduler;
107
 
        QThread* m_schedulingThread;
108
 
    };
109
 
}
110
 
 
111
 
#endif