• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Nepomuk-Core

  • sources
  • kde-4.12
  • kdelibs
  • nepomuk-core
  • services
  • fileindexer
indexscheduler.h
Go to the documentation of this file.
1 /* This file is part of the KDE Project
2  Copyright (c) 2008-2010 Sebastian Trueg <trueg@kde.org>
3  Copyright (c) 2012 Vishesh Handa <me@vhanda.in>
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_FILEINDEXER_INDEX_SCHEDULER_H_
21 #define _NEPOMUK_FILEINDEXER_INDEX_SCHEDULER_H_
22 
23 #include "basicindexingqueue.h" // Required for UpdateDirFlags
24 #include "removablemediacache.h"
25 #include <QDateTime>
26 
27 namespace Nepomuk2 {
28 
29  class IndexCleaner;
30  class FileIndexingQueue;
31  class EventMonitor;
32 
39  class IndexScheduler : public QObject
40  {
41  Q_OBJECT
42 
43  public:
52  enum State {
53  State_Normal = 0,
54  State_UserIdle = 1,
55  State_OnBattery = 2,
56  State_LowDiskSpace = 3,
57  State_Suspended = 4,
58  State_Cleaning = 5
59  };
60 
61  IndexScheduler( QObject* parent=0 );
62  ~IndexScheduler();
63 
64  bool isSuspended() const;
65  bool isIndexing() const;
66  bool isCleaning() const;
67 
71  QString userStatusString() const;
72 
80  State currentStatus() const;
81 
90  QUrl currentUrl() const;
91 
96  UpdateDirFlags currentFlags() const;
97 
98  public Q_SLOTS:
99  void suspend();
100  void resume();
101 
102  void setSuspended( bool );
103 
115  void updateDir( const QString& path, UpdateDirFlags flags = NoUpdateFlags );
116 
120  void updateAll( bool forceUpdate = false );
121 
125  void analyzeFile( const QString& path );
126 
127  Q_SIGNALS:
128  // Indexing State
129  void indexingStarted();
130  void indexingStopped();
131  void indexingStateChanged( bool indexing );
132 
133  void basicIndexingDone();
134  void fileIndexingDone();
135 
136  // Emitted on calling suspend/resume
137  void indexingSuspended( bool suspended );
138 
139  void statusStringChanged();
140  private Q_SLOTS:
141  // Config
142  void slotConfigFiltersChanged();
143  void slotIncludeFolderListChanged(const QStringList& added, const QStringList& removed);
144  void slotExcludeFolderListChanged(const QStringList& added, const QStringList& removed);
145 
146  void slotCleaningDone();
147 
148  void slotBeginIndexingFile(const QUrl& url);
149  void slotEndIndexingFile(const QUrl& url);
150  void slotEndBasicIndexingFile();
151 
152  void slotStartedIndexing();
153  void slotFinishedIndexing();
154 
155  // Event Monitor integration
156  void slotScheduleIndexing();
157 
158  void slotTeardownRequested(const Nepomuk2::RemovableMediaCache::Entry* entry);
159  void emitStatusStringChanged();
160  private:
161  void queueAllFoldersForUpdate( bool forceUpdate = false );
162 
163  // emits indexingStarted or indexingStopped based on parameter. Makes sure
164  // no signal is emitted twice
165  void setIndexingStarted( bool started );
166 
167  void restartCleaner();
168 
169  bool m_indexing;
170 
171  IndexCleaner* m_cleaner;
172 
173  // Queues
174  BasicIndexingQueue* m_basicIQ;
175  FileIndexingQueue* m_fileIQ;
176 
177  EventMonitor* m_eventMonitor;
178 
179  State m_state;
180 
181  QDateTime m_lastBasicIndexingFile;
182  int m_basicIndexingFileCount;
183 
184  QString m_oldStatus;
185  };
186 }
187 
188 
189 #endif
190 
Nepomuk2::IndexScheduler::fileIndexingDone
void fileIndexingDone()
Nepomuk2::IndexScheduler::suspend
void suspend()
Definition: indexscheduler.cpp:121
Nepomuk2::IndexScheduler::setSuspended
void setSuspended(bool)
Definition: indexscheduler.cpp:145
Nepomuk2::FileIndexingQueue
Definition: fileindexingqueue.h:31
Nepomuk2::IndexScheduler
The IndexScheduler is responsible for controlling the indexing queues and reacting to events...
Definition: indexscheduler.h:39
Nepomuk2::IndexScheduler::currentFlags
UpdateDirFlags currentFlags() const
The UpdateDirFlags of the the current url that is being indexed.
Definition: indexscheduler.cpp:176
Nepomuk2::IndexScheduler::State_Suspended
Definition: indexscheduler.h:57
QObject
Nepomuk2::IndexScheduler::State_Cleaning
Definition: indexscheduler.h:58
removablemediacache.h
Nepomuk2::IndexScheduler::basicIndexingDone
void basicIndexingDone()
basicindexingqueue.h
Nepomuk2::IndexScheduler::indexingSuspended
void indexingSuspended(bool suspended)
Nepomuk2::IndexScheduler::State_LowDiskSpace
Definition: indexscheduler.h:56
Nepomuk2::IndexScheduler::updateDir
void updateDir(const QString &path, UpdateDirFlags flags=NoUpdateFlags)
Slot to connect to certain event systems like KDirNotify or KDirWatch.
Definition: indexscheduler.cpp:212
Nepomuk2::RemovableMediaCache::Entry
Definition: removablemediacache.h:53
Nepomuk2::IndexScheduler::~IndexScheduler
~IndexScheduler()
Definition: indexscheduler.cpp:116
Nepomuk2::NoUpdateFlags
No flags, only used to make code more readable.
Definition: basicindexingqueue.h:34
Nepomuk2::BasicIndexingQueue
This class represents a simple queue that iterates over the file system tree and indexes each file wh...
Definition: basicindexingqueue.h:60
Nepomuk2::IndexScheduler::State_UserIdle
Definition: indexscheduler.h:54
Nepomuk2::IndexScheduler::updateAll
void updateAll(bool forceUpdate=false)
Updates all configured folders.
Definition: indexscheduler.cpp:218
Nepomuk2::IndexScheduler::State_Normal
Definition: indexscheduler.h:53
Nepomuk2::IndexScheduler::resume
void resume()
Definition: indexscheduler.cpp:133
Nepomuk2::IndexScheduler::isIndexing
bool isIndexing() const
Definition: indexscheduler.cpp:163
Nepomuk2::IndexScheduler::currentUrl
QUrl currentUrl() const
The current uri being indexed.
Definition: indexscheduler.cpp:168
Nepomuk2::IndexScheduler::indexingStateChanged
void indexingStateChanged(bool indexing)
Nepomuk2::IndexScheduler::statusStringChanged
void statusStringChanged()
Nepomuk2::IndexScheduler::userStatusString
QString userStatusString() const
A user readable description of the scheduler's status.
Definition: indexscheduler.cpp:424
Nepomuk2::EventMonitor
Definition: eventmonitor.h:32
Nepomuk2::IndexScheduler::State
State
Represents the current state of the indexer.
Definition: indexscheduler.h:52
Nepomuk2::IndexScheduler::isSuspended
bool isSuspended() const
Definition: indexscheduler.cpp:153
Nepomuk2::IndexScheduler::currentStatus
State currentStatus() const
Returns the internal stateof the indexer as enum.
Definition: indexscheduler.cpp:448
Nepomuk2::IndexScheduler::State_OnBattery
Definition: indexscheduler.h:55
Nepomuk2::IndexScheduler::IndexScheduler
IndexScheduler(QObject *parent=0)
Definition: indexscheduler.cpp:45
Nepomuk2::IndexScheduler::isCleaning
bool isCleaning() const
Definition: indexscheduler.cpp:158
Nepomuk2::IndexCleaner
Definition: indexcleaner.h:35
Nepomuk2::IndexScheduler::indexingStopped
void indexingStopped()
Nepomuk2::IndexScheduler::analyzeFile
void analyzeFile(const QString &path)
Analyze the one file without conditions.
Definition: indexscheduler.cpp:297
Nepomuk2::IndexScheduler::indexingStarted
void indexingStarted()
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Nepomuk-Core

Skip menu "Nepomuk-Core"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal