1 #ifndef NEPOMUKINTEGRATION_H 2 #define NEPOMUKINTEGRATION_H 3 4 #include <QtCore/QThread> 5 #include <QtCore/QMutex> 6 #include <QtCore/QTimer> 7 8 //For DEBUG_WIN: 9 #include "global.h" 10 #include "debugwindow.h" 11 12 class QString; 13 class QUrl; 14 class BasketScene; 15 16 class nepomukIntegration : public QObject 17 { 18 Q_OBJECT 19 public: 20 static void updateMetadata(BasketScene * basket); 21 static void deleteMetadata(const QString &fullPath); 22 static bool doDelete(const QString &fullPath); 23 private: 24 static nepomukIntegration *instance; 25 static QMutex instanceMutex; 26 27 nepomukIntegration(BasketScene * basket, int idleTime); ~nepomukIntegration()28 ~nepomukIntegration() { 29 //I hope deletion is handled automatically 30 //delete workerThread; 31 //delete cleanupIdle; 32 DEBUG_WIN << "nepomukUpdater object destructed"; 33 } 34 35 int idleTime; 36 QThread workerThread; 37 QTimer cleanupTimer; 38 QMutex mutex; 39 QList<BasketScene *> basketList; 40 bool isDoingUpdate; 41 QList<KUrl> requestedIndexList; 42 bool isCleaningupRequestedIndexes; 43 void queueBasket(BasketScene * basket); 44 void queueIndexRequest(KUrl file); 45 signals: 46 void updateCompleted(QString basketFolderName, bool successful); 47 //void indexCleanupCompleted(KUrl file); 48 private slots: 49 void doUpdate(); 50 void checkQueue(); 51 void cleanupRequestedIndexes(); 52 void cleanup(); 53 54 }; 55 56 #endif // NEPOMUKINTEGRATION_H 57