Add Created column to Browser Integration at Database settings

This commit is contained in:
varjolintu 2020-03-02 10:18:33 +02:00 committed by Jonathan White
parent a6c3c118a7
commit e6186b07e1
4 changed files with 10 additions and 4 deletions

View File

@ -338,6 +338,8 @@ QString BrowserService::storeKey(const QString& key)
hideWindow();
db->metadata()->customData()->set(ASSOCIATE_KEY_PREFIX + id, key);
db->metadata()->customData()->set(QString("%1_%2").arg(CustomData::Created, id),
Clock::currentDateTime().toString(Qt::SystemLocaleShortDate));
return id;
}

View File

@ -20,7 +20,8 @@
#include "core/Global.h"
const QString CustomData::LastModified = "_LAST_MODIFIED";
const QString CustomData::LastModified = QStringLiteral("_LAST_MODIFIED");
const QString CustomData::Created = QStringLiteral("_CREATED");
CustomData::CustomData(QObject* parent)
: QObject(parent)

View File

@ -47,6 +47,7 @@ public:
bool operator!=(const CustomData& other) const;
static const QString LastModified;
static const QString Created;
signals:
void customDataModified();

View File

@ -120,14 +120,16 @@ void DatabaseSettingsWidgetBrowser::toggleRemoveButton(const QItemSelection& sel
void DatabaseSettingsWidgetBrowser::updateModel()
{
m_customDataModel->clear();
m_customDataModel->setHorizontalHeaderLabels({tr("Key"), tr("Value")});
m_customDataModel->setHorizontalHeaderLabels({tr("Key"), tr("Value"), tr("Created")});
for (const QString& key : customData()->keys()) {
if (key.startsWith(BrowserService::ASSOCIATE_KEY_PREFIX)) {
QString strippedKey = key;
strippedKey.remove(BrowserService::ASSOCIATE_KEY_PREFIX);
m_customDataModel->appendRow(QList<QStandardItem*>() << new QStandardItem(strippedKey)
<< new QStandardItem(customData()->value(key)));
auto created = customData()->value(QString("%1_%2").arg(CustomData::Created, strippedKey));
m_customDataModel->appendRow(QList<QStandardItem*>()
<< new QStandardItem(strippedKey)
<< new QStandardItem(customData()->value(key)) << new QStandardItem(created));
}
}