Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 81565f17 authored by Laurent Montel's avatar Laurent Montel 😁

Implement readOnly method

parent f15ee2bc
cmake_minimum_required(VERSION 3.0)
set(PIM_VERSION "5.6.43")
set(PIM_VERSION "5.6.44")
project(Akonadi VERSION ${PIM_VERSION})
......
......@@ -46,6 +46,7 @@ public:
Akonadi::Tag::List mTags;
TagView *mTagView = nullptr;
Akonadi::TagModel *mModel = nullptr;
QToolButton *mEditButton = nullptr;
};
TagView::TagView(QWidget *parent)
......@@ -83,13 +84,13 @@ TagWidget::TagWidget(QWidget *parent)
connect(d->mTagView, &TagView::clearTags, this, &TagWidget::clearTags);
layout->addWidget(d->mTagView);
QToolButton *editButton = new QToolButton(this);
editButton->setText(i18n("..."));
layout->addWidget(editButton, Qt::AlignRight);
d->mEditButton = new QToolButton(this);
d->mEditButton->setText(i18n("..."));
layout->addWidget(d->mEditButton, Qt::AlignRight);
layout->setStretch(0, 10);
connect(editButton, &QToolButton::clicked, this, &TagWidget::editTags);
connect(d->mEditButton, &QToolButton::clicked, this, &TagWidget::editTags);
connect(d->mModel, &Akonadi::TagModel::populated, this, &TagWidget::updateView);
}
......@@ -119,6 +120,12 @@ Akonadi::Tag::List TagWidget::selection() const
return d->mTags;
}
void TagWidget::setReadOnly(bool readOnly)
{
d->mEditButton->setEnabled(!readOnly);
//d->mTagView is always readOnly => not change it.
}
void TagWidget::editTags()
{
QScopedPointer<Akonadi::TagSelectionDialog> dlg(new TagSelectionDialog(this));
......
......@@ -60,6 +60,7 @@ public:
Akonadi::Tag::List selection() const;
void clearTags();
void setReadOnly(bool readOnly);
Q_SIGNALS:
void selectionChanged(const Akonadi::Tag::List &tags);
......
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