1 /*
2  *    This file is part of the KDE project
3  *    Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
4  *    Copyright (c) 2007 Jan Hambrecht <jaham@gmx.net>
5  *    Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
6  *    Copyright (C) 2011 Srikanth Tiyyagura <srikanth.tulasiram@gmail.com>
7  *    Copyright (c) 2011 José Luis Vergara <pentalis@gmail.com>
8  *    Copyright (c) 2013 Sascha Suelzer <s.suelzer@gmail.com>
9  *
10  *    This library is free software; you can redistribute it and/or
11  *    modify it under the terms of the GNU Library General Public
12  *    License as published by the Free Software Foundation; either
13  *    version 2 of the License, or (at your option) any later version.
14  *
15  *    This library is distributed in the hope that it will be useful,
16  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  *    Library General Public License for more details.
19  *
20  *    You should have received a copy of the GNU Library General Public License
21  *    along with this library; see the file COPYING.LIB.  If not, write to
22  *    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23  *    Boston, MA 02110-1301, USA.
24  */
25 
26 #ifndef KORESOURCETAGGINGMANAGER_H
27 #define KORESOURCETAGGINGMANAGER_H
28 
29 #include <QObject>
30 
31 class QWidget;
32 class QStringList;
33 class QString;
34 class QPoint;
35 
36 class KoTagFilterWidget;
37 class KoTagChooserWidget;
38 class KoResourceModel;
39 class KoResource;
40 
41 class KoResourceTaggingManager : public QObject
42 {
43     Q_OBJECT
44 
45 public:
46     explicit KoResourceTaggingManager(KoResourceModel* model, QWidget* parent);
47     ~KoResourceTaggingManager() override;
48     void showTaggingBar(bool show);
49     QStringList availableTags() const;
50     QString currentTag();
51     void contextMenuRequested(KoResource* currentResource, QPoint pos);
52     void allowTagModification( bool set );
53     bool allowTagModification();
54     KoTagFilterWidget* tagFilterWidget();
55     KoTagChooserWidget* tagChooserWidget();
56 private Q_SLOTS:
57     void undeleteTag(const QString& tagToUndelete);
58     void purgeTagUndeleteList();
59     void contextCreateNewTag(KoResource* resource, const QString& tag);
60     void contextCreateNewTag(const QString& tag);
61     void syncTagBoxEntryRemoval(const QString& tag);
62     void syncTagBoxEntryAddition(const QString& tag);
63     void syncTagBoxEntries();
64     void tagSaveButtonPressed();
65     void contextRemoveTagFromResource(KoResource* resource, const QString& tag);
66     void contextAddTagToResource(KoResource* resource, const QString& tag);
67     void renameTag(const QString &oldName, const QString &newName);
68     void tagChooserIndexChanged(const QString& lineEditText);
69     void tagSearchLineEditTextChanged(const QString& lineEditText);
70     void removeTagFromComboBox(const QString& tag);
71 
72 private:
73     void contextMenuRequested(KoResource* resource, const QStringList& resourceTags, const QPoint& pos);
74     void enableContextMenu(bool enable);
75     void removeResourceTag(KoResource* resource, const QString& tagName);
76     void addResourceTag(KoResource* resource, const QString& tagName);
77     void updateTaggedResourceView();
78     class Private;
79     Private* const d;
80 };
81 
82 
83 #endif // KORESOURCETAGGINGINTERFACE_H
84