10#include <QProcessEnvironment>
12#include <QStandardPaths>
14#include <QTableWidget>
37 , m_tagSelectionWidget(widget)
38 , m_editable(editable)
65 if (resourceIds.count() == 0) {
101 if (tagsp.isNull()) {
105 }
else if (!tagsp->active()) {
107 int response = QMessageBox::question(0, i18nc(
"Dialog title",
"Overwrite tag?"), i18nc(
"Question to the user in a dialog about creating a tag",
108 "A tag with this unique name already exists. Do you want to replace it?"),
109 i18nc(
"Option in a dialog to discard the previously existing tag and creating a new one in its place",
"Replace (overwrite) tag"),
110 i18nc(
"Option in a dialog to undelete (reactivate) existing tag with its old assigned resources",
"Restore previous tag"), i18n(
"Cancel"));
114 }
else if (response == 1) {
135 QMap<QString, int> tagsCounts;
136 for (
int i = 0; i <
m_tagModel->rowCount(); i++) {
143 if (!tagsCounts.contains(tagUrl)) {
144 tagsCounts.insert(tagUrl, 0);
155 tagsCounts[tag->url()] += 1;
161 for (
int i = 0; i <
m_tagModel->rowCount(); i++) {
169 KoID tag(tagUrl, tagName);
172 }
else if (tagsCounts[tagUrl] > 0) {
185 , m_tagSelectionWidget(widget)
186 , m_editable(editable)
204 Q_FOREACH(
KoID tag, tagList) {
206 selectedTags << tagSP->id();
252 typedef QPair<QString, QString> resourceTypePair;
271 for (
int i = 0; i < model->rowCount(); i++) {
272 QModelIndex idx = model->index(i, 0);
275 if (tag.isNull() || tag->id() < 0) {
279 KoID custom =
KoID(tag->url(), tag->name());
283 notSelected << custom;
286 notSelected << custom;
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
KisTagSP tagForUrl(const QString &url) const override
Retrieve a tag by url.
The KisTagResourceModel class makes it possible to retrieve the resources for certain tags or the tag...
#define KIS_ASSERT_RECOVER_RETURN(cond)
const QString LayerStyles
const QString SeExprScripts
const QString PaintOpPresets