Commit 7ce7a21c authored by Boudewijn Rempt's avatar Boudewijn Rempt

Implementing saving a tag desktop file.

If a value is set, the translations are gone, otherwise they
are kept.
parent 1b9b27d2
......@@ -150,7 +150,7 @@ QString KisTagLoader::name() const
return d->name;
}
void KisTagLoader::setName(QString &name) const
void KisTagLoader::setName(const QString &name) const
{
d->map.setEntry(s_group, s_name, name, KEntryMap::EntryDirty);
d->name = name;
......
......@@ -43,7 +43,7 @@ public:
virtual ~KisTagLoader();
QString name() const;
void setName(QString &name) const;
void setName(const QString &name) const;
QString url() const;
void setUrl(const QString &url) const;
......
......@@ -19,6 +19,7 @@
#include "TestTagLoader.h"
#include <QTest>
#include <QBuffer>
#include <KisTagLoader.h>
#include <KisResourceLoader.h>
......@@ -34,7 +35,6 @@ void TestTagLoader ::testLoadTag()
KisTagLoader tagLoader;
QFile f(QString(FILES_DATA_DIR) + "paintoppresets/test.desktop");
qDebug() << f.fileName();
QVERIFY(f.exists());
f.open(QFile::ReadOnly);
......@@ -66,6 +66,28 @@ void TestTagLoader ::testLoadTag()
void TestTagLoader::testSaveTag()
{
KisTagLoader tagLoader;
QFile f(QString(FILES_DATA_DIR) + "paintoppresets/test.desktop");
QVERIFY(f.exists());
f.open(QFile::ReadOnly);
QVERIFY(f.isOpen());
bool r = tagLoader.load(f);
QVERIFY(r);
tagLoader.setName(QString("Test"));
QByteArray ba;
QBuffer buf(&ba);
buf.open(QBuffer::WriteOnly);
tagLoader.save(buf);
buf.close();
QVERIFY(ba == QByteArray("[Desktop Entry]\nComment[nl_NL]=Jouw favoriete penseel presets\nComment=Your favorite brush presets\nName=Test\nType=Tag\nURL=* Favorites\n"));
}
......
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