Warning, file /office/calligra/libs/widgets/KoResourceTagStore.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the KDE project 0002 0003 Copyright (c) 2011 Sven Langkamp <sven.langkamp@gmail.com> 0004 Copyright (c) 2011 Srikanth Tiyyagura <srikanth.tulasiram@gmail.com> 0005 0006 This library is free software; you can redistribute it and/or 0007 modify it under the terms of the GNU Lesser General Public 0008 License as published by the Free Software Foundation; either 0009 version 2.1 of the License, or (at your option) any later version. 0010 0011 This library is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 Lesser General Public License for more details. 0015 0016 You should have received a copy of the GNU Lesser General Public 0017 License along with this library; if not, write to the Free Software 0018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 0019 */ 0020 0021 #ifndef KORESOURCETAGSTORE_H 0022 #define KORESOURCETAGSTORE_H 0023 0024 0025 #include <WidgetsDebug.h> 0026 #include "kowidgets_export.h" 0027 0028 class KoResourceServerBase; 0029 class KoResource; 0030 class QStringList; 0031 class QString; 0032 0033 /** 0034 * KoResourceTagging allows to add and delete tags to resources and also search resources using tags 0035 */ 0036 class KOWIDGETS_EXPORT KoResourceTagStore 0037 { 0038 public: 0039 0040 /** 0041 * Constructs a KoResourceTagging object 0042 * 0043 */ 0044 explicit KoResourceTagStore(KoResourceServerBase *resourceServer); 0045 ~KoResourceTagStore(); 0046 0047 QStringList assignedTagsList(const KoResource *resource) const; 0048 0049 /// remote the given resource from the tagstore 0050 void removeResource(const KoResource *resource); 0051 0052 /// Add the given tag to the tag store. The resource can be empty, in which case 0053 /// the tag is added but unused 0054 void addTag(KoResource* resource, const QString& tag); 0055 0056 /// Remove the given tag for the given resource. 0057 void delTag(KoResource* resource, const QString& tag); 0058 0059 void delTag(const QString& tag); 0060 0061 /// @return a list of all the tags in this store 0062 QStringList tagNamesList() const; 0063 0064 /// Return a list of filenames for the given tag 0065 QStringList searchTag(const QString& query) const; 0066 0067 void loadTags(); 0068 void serializeTags(); 0069 0070 private: 0071 friend class KoResourceTaggingTest; 0072 0073 void readXMLFile(const QString &tagstore); 0074 void writeXMLFile(const QString &tagstore); 0075 0076 /// To check whether the resource belongs to the present server or not 0077 bool isServerResource(const QString &resourceName) const; 0078 0079 /// If resource filenames have no extensions, then we add "-krita.extension". 0080 QString adjustedFileName(const QString &fileName) const; 0081 0082 /// Removes the adjustements before going to the server 0083 QStringList removeAdjustedFileNames(QStringList fileNamesList) const; 0084 0085 class Private; 0086 Private * const d; 0087 }; 0088 0089 0090 #endif // KORESOURCETAGSTORE_H