Commit 02757c9f authored by Agata Cacko's avatar Agata Cacko

Fix list of tags per resources in right-click

The right-click menu in the brush presets docker
should show both tags you can assign the preset to
and tags you can delete it from. For that, it needs
a current list of tags.
This commit ensures the list is there and correct.
parent 6e51a9cc
......@@ -196,7 +196,7 @@ KisResourceItemChooser::KisResourceItemChooser(const QString &resourceType, bool
d->viewModeButton = new QToolButton(this);
d->viewModeButton->setPopupMode(QToolButton::InstantPopup);
d->viewModeButton->setVisible(false);
d->tagManager = new KisResourceTaggingManager(KisTagModelProvider::tagModel(resourceType), d->tagFilterProxyModel, this);
d->tagManager = new KisResourceTaggingManager(resourceType, d->tagFilterProxyModel, this);
d->storagePopupButton = new KisStorageChooserWidget(this);
......
......@@ -37,6 +37,7 @@
#include <KoResource.h>
#include <KisResourceModel.h>
#include <KisResourceModelProvider.h>
#include <KisTagFilterResourceProxyModel.h>
#include <KisTagModel.h>
#include <KisTagModelProvider.h>
......@@ -77,10 +78,11 @@ public:
QPointer<KisTagFilterResourceProxyModel> model;
KisTagModel* tagModel;
KisResourceModel* resourceSourceModel;
};
KisResourceTaggingManager::KisResourceTaggingManager(KisTagModel* tagModel, KisTagFilterResourceProxyModel *model, QWidget *parent)
KisResourceTaggingManager::KisResourceTaggingManager(QString resourceType, KisTagFilterResourceProxyModel *model, QWidget *parent)
: QObject(parent)
, d(new Private())
......@@ -88,7 +90,10 @@ KisResourceTaggingManager::KisResourceTaggingManager(KisTagModel* tagModel, KisT
d->model = model;
d->tagFilter = new KisTagFilterWidget(parent);
d->tagModel = tagModel;
d->tagModel = KisTagModelProvider::tagModel(resourceType);
d->resourceSourceModel = KisResourceModelProvider::resourceModel(resourceType);
d->tagChooser = new KisTagChooserWidget(d->tagModel, parent);
connect(d->tagChooser, SIGNAL(tagChosen(KisTagSP)), this, SLOT(tagChooserIndexChanged(KisTagSP)));
......@@ -409,9 +414,8 @@ void KisResourceTaggingManager::contextMenuRequested(KoResourceSP resource, cons
void KisResourceTaggingManager::contextMenuRequested(KoResourceSP currentResource, QPoint pos)
{
ENTER_FUNCTION();
// d->model->assignedTagsList(currentResource)
if (currentResource) {
contextMenuRequested(currentResource, QList<KisTagSP>(), pos);
contextMenuRequested(currentResource, d->resourceSourceModel->tagsForResource(currentResource->resourceId()).toList(), pos);
}
}
......
......@@ -57,7 +57,7 @@ class KisResourceTaggingManager : public QObject
public:
explicit KisResourceTaggingManager(KisTagModel* tagModel, KisTagFilterResourceProxyModel *model, QWidget *parent);
explicit KisResourceTaggingManager(QString resourceType, KisTagFilterResourceProxyModel *model, QWidget *parent);
~KisResourceTaggingManager() override;
void showTaggingBar(bool show);
QStringList availableTags() const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment