Home · All Namespaces · All Classes |
00001 /*************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 00004 ** All rights reserved. 00005 ** Contact: Nokia Corporation (directui@nokia.com) 00006 ** 00007 ** This file is part of mhome. 00008 ** 00009 ** If you have questions regarding the use of this file, please contact 00010 ** Nokia at directui@nokia.com. 00011 ** 00012 ** This library is free software; you can redistribute it and/or 00013 ** modify it under the terms of the GNU Lesser General Public 00014 ** License version 2.1 as published by the Free Software Foundation 00015 ** and appearing in the file LICENSE.LGPL included in the packaging 00016 ** of this file. 00017 ** 00018 ****************************************************************************/ 00019 00020 #ifndef LAUNCHERBUTTONDATASTORE_H 00021 #define LAUNCHERBUTTONDATASTORE_H 00022 00023 #include <QSharedPointer> 00024 #include <QHash> 00025 #include <QStringList> 00026 #include <QFileSystemWatcher> 00027 #include <QTimer> 00028 #include <QFileInfoList> 00029 #include <QSet> 00030 00031 class MDataStore; 00032 class LauncherPage; 00033 class LauncherButton; 00034 class MDesktopEntry; 00035 00050 class LauncherDataStore : public QObject 00051 { 00052 Q_OBJECT 00053 00054 public: 00062 LauncherDataStore(MDataStore* dataStore, const QStringList &directories); 00063 00067 virtual ~LauncherDataStore(); 00068 00072 QHash<QString, QVariant> dataForAllDesktopEntries(); 00073 00080 void updateDataForDesktopEntry(const QString &entryPath, const QVariant &data); 00081 00087 void updateDataForDesktopEntries(const QHash<QString, QString> &newValues); 00088 00094 void removeDataForDesktopEntry(const QString &entryPath); 00095 00105 static QString entryPathToKey(const QString &entryPath); 00106 00116 static QString keyToEntryPath(const QString &key); 00117 00118 signals: 00122 void dataStoreChanged(); 00123 00127 void desktopEntryChanged(const QString &); 00128 00134 void desktopEntryAdded(const QString &); 00135 00141 void desktopEntryRemoved(const QString &); 00142 00143 public slots: 00150 void updateDesktopEntry(const QString &desktopEntryPath); 00151 00152 private slots: 00161 void updateDataFromDesktopEntryFiles(); 00162 00170 void processUpdateQueue(); 00171 00172 private: 00176 void startProcessingUpdateQueue(); 00177 00185 virtual bool isDesktopEntryValid(const MDesktopEntry &entry, const QStringList &acceptedTypes); 00186 00195 void addFilePathToWatcher(const QString &filePath); 00196 00202 bool isInQueue(const QString &key); 00203 00205 QFileSystemWatcher watcher; 00206 00208 QStringList supportedDesktopEntryFileTypes; 00209 00211 MDataStore *store; 00212 00214 bool updatePending; 00215 00217 QTimer processUpdateQueueTimer; 00218 00220 QFileInfoList updateQueue; 00221 00223 QStringList directories; 00224 00226 QStringList invalidEntries; 00227 00228 #ifdef UNIT_TEST 00229 friend class Ut_LauncherDataStore; 00230 #endif 00231 }; 00232 00233 00234 00235 #endif
Copyright © 2011 Nokia Corporation | Generated on Thu Jul 7 2011 22:14:50 Doxygen 1.7.1 |
MeeGo Touch |