Verified Commit 8b0f0e99 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

Browser: allow modifying existing attributes

parent b4d6a7cf
Pipeline #22926 passed with stage
in 8 minutes and 19 seconds
......@@ -393,20 +393,16 @@ void BrowserWidget::setItem(const Akonadi::Item &item)
Attribute::List list = item.attributes();
delete mAttrModel;
mAttrModel = new QStandardItemModel(list.count(), 2);
QStringList labels;
labels << QStringLiteral("Attribute") << QStringLiteral("Value");
mAttrModel = new QStandardItemModel();
QStringList labels{QStringLiteral("Attribute"), QStringLiteral("Value")};
mAttrModel->setHorizontalHeaderLabels(labels);
for (int i = 0; i < list.count(); ++i) {
QModelIndex index = mAttrModel->index(i, 0);
Q_ASSERT(index.isValid());
mAttrModel->setData(index, QString::fromLatin1(list[i]->type()));
index = mAttrModel->index(i, 1);
Q_ASSERT(index.isValid());
mAttrModel->setData(index, QString::fromLatin1(list[i]->serialized()));
mAttrModel->itemFromIndex(index)->setFlags(Qt::ItemIsEditable | mAttrModel->flags(index));
for (const auto *attr : list) {
auto type = new QStandardItem(QString::fromLatin1(attr->type()));
type->setEditable(false);
mAttrModel->appendRow({type, new QStandardItem(QString::fromLatin1(attr->serialized()))});
}
contentUi.attrView->setModel(mAttrModel);
connect(mAttrModel, &QStandardItemModel::itemChanged, this, &BrowserWidget::contentViewChanged);
if (mMonitor) {
mMonitor->deleteLater(); // might be the one calling us
......
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