Commit 7fb30201 authored by Wolthera van Hövell's avatar Wolthera van Hövell 📚

BUG:410490 Set date for bundle creation to use ISODate.

This will allow for the date to be displayed as a localized format.

For bundles using the old format, Krita will convert these appropriately.
parent 86d3c31f
...@@ -280,7 +280,7 @@ bool KisResourceBundle::save() ...@@ -280,7 +280,7 @@ bool KisResourceBundle::save()
{ {
if (filename().isEmpty()) return false; if (filename().isEmpty()) return false;
addMeta("updated", QDate::currentDate().toString("dd/MM/yyyy")); addMeta("updated", QDateTime::currentDateTime().toString(Qt::ISODate));
QDir bundleDir = KoResourcePaths::saveLocation("data", "bundles"); QDir bundleDir = KoResourcePaths::saveLocation("data", "bundles");
bundleDir.cdUp(); bundleDir.cdUp();
...@@ -1046,7 +1046,7 @@ void KisResourceBundle::recreateBundle(QScopedPointer<KoStore> &oldStore) ...@@ -1046,7 +1046,7 @@ void KisResourceBundle::recreateBundle(QScopedPointer<KoStore> &oldStore)
KoHashGenerator *generator = KoHashGeneratorProvider::instance()->getGenerator("MD5"); KoHashGenerator *generator = KoHashGeneratorProvider::instance()->getGenerator("MD5");
KisResourceBundleManifest newManifest; KisResourceBundleManifest newManifest;
addMeta("updated", QDate::currentDate().toString("dd/MM/yyyy")); addMeta("updated", QDateTime::currentDateTime().toString(Qt::ISODate));
Q_FOREACH (KisResourceBundleManifest::ResourceReference ref, m_manifest.files()) { Q_FOREACH (KisResourceBundleManifest::ResourceReference ref, m_manifest.files()) {
// Wrong manifest entry found, skip it // Wrong manifest entry found, skip it
......
...@@ -269,8 +269,16 @@ void DlgBundleManager::itemSelected(QListWidgetItem *current, QListWidgetItem *) ...@@ -269,8 +269,16 @@ void DlgBundleManager::itemSelected(QListWidgetItem *current, QListWidgetItem *)
m_ui->lblWebsite->setText(metrics.elidedText(bundle->getMeta("website"), Qt::ElideRight, m_ui->lblWebsite->width())); m_ui->lblWebsite->setText(metrics.elidedText(bundle->getMeta("website"), Qt::ElideRight, m_ui->lblWebsite->width()));
m_ui->lblWebsite->setToolTip(bundle->getMeta("website")); m_ui->lblWebsite->setToolTip(bundle->getMeta("website"));
m_ui->lblDescription->setPlainText(bundle->getMeta("description")); m_ui->lblDescription->setPlainText(bundle->getMeta("description"));
m_ui->lblCreated->setText(bundle->getMeta("created")); if (QDateTime::fromString(bundle->getMeta("created")).isValid()) {
m_ui->lblUpdated->setText(bundle->getMeta("updated")); m_ui->lblCreated->setText(QDateTime::fromString(bundle->getMeta("created")).toString());
} else {
m_ui->lblCreated->setText(QDate::fromString(bundle->getMeta("created"), "dd/MM/yyyy").toString());
}
if (QDateTime::fromString(bundle->getMeta("updated")).isValid()) {
m_ui->lblCreated->setText(QDateTime::fromString(bundle->getMeta("updated")).toString());
} else {
m_ui->lblCreated->setText(QDate::fromString(bundle->getMeta("updated"), "dd/MM/yyyy").toString());
}
m_ui->lblPreview->setPixmap(QPixmap::fromImage(bundle->image().scaled(128, 128, Qt::KeepAspectRatio, Qt::SmoothTransformation))); m_ui->lblPreview->setPixmap(QPixmap::fromImage(bundle->image().scaled(128, 128, Qt::KeepAspectRatio, Qt::SmoothTransformation)));
m_ui->listBundleContents->clear(); m_ui->listBundleContents->clear();
......
...@@ -204,7 +204,7 @@ KisResourceBundle *ResourceManager::saveBundle(const DlgCreateBundle &dlgCreateB ...@@ -204,7 +204,7 @@ KisResourceBundle *ResourceManager::saveBundle(const DlgCreateBundle &dlgCreateB
} }
newBundle->addMeta("fileName", bundlePath); newBundle->addMeta("fileName", bundlePath);
newBundle->addMeta("created", QDate::currentDate().toString("dd/MM/yyyy")); newBundle->addMeta("created", QDate::currentDate().toString(Qt::ISODate));
if (!newBundle->save()) { if (!newBundle->save()) {
QMessageBox::critical(viewManager()->mainWindow(), i18nc("@title:window", "Krita"), i18n("Could not create the new bundle.")); QMessageBox::critical(viewManager()->mainWindow(), i18nc("@title:window", "Krita"), i18n("Could not create the new bundle."));
......
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