Commit de2491b1 authored by Cyrille Berger's avatar Cyrille Berger

* add the interface for filtering metadata

* don't edit directly the metadata store, which allow to cancel the editing

svn path=/trunk/koffice/; revision=689571
parent 40adc713
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_meta_data_filter.h"
\ No newline at end of file
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
namespace KisMetaData {
class Store;
class Filter {
public:
virtual filter(KisMetaData::Store*) = 0;
};
}
......@@ -22,6 +22,7 @@
#include "kis_meta_data_entry.h"
#include "kis_meta_data_schema.h"
#include "kis_meta_data_value.h"
using namespace KisMetaData;
......@@ -50,12 +51,18 @@ Store::~Store()
void Store::copyFrom(const Store* store)
{
// const Entry& entry;
// foreach(entry, store->entries)
for(QHash<QString, Entry>::const_iterator entryIt = store->begin();
entryIt != store->end(); ++entryIt)
{
// if(entry.value()->type() != KisMetaData::Value::Invalid)
const Entry& entry = entryIt.value();
if(entry.value().type() != KisMetaData::Value::Invalid)
{
// Entry& thisEntry = getEntry( );
if(hasEntry(entry.qualifiedName()))
{
getEntry( entry.qualifiedName() ).value() = entry.value();
} else {
addEntry(entry);
}
}
}
}
......
......@@ -43,7 +43,7 @@ KisMetaDataEditor::KisMetaDataEditor(QWidget* parent, KisMetaData::Store* origin
KPageDialog(parent), d(new Private)
{
d->originalStore = originalStore;
d->store = originalStore;// new KisMetaData::Store(*originalStore);
d->store = new KisMetaData::Store(*originalStore);
QStringList files = KGlobal::dirs()->findAllResources("data", "kritaplugins/metadataeditor/*.rc");
......@@ -146,13 +146,13 @@ KisMetaDataEditor::~KisMetaDataEditor()
{
delete e;
}
// delete d->store;
delete d->store;
delete d;
}
void KisMetaDataEditor::accept ()
{
KPageDialog::accept();
d->store->debugDump();
d->originalStore->copyFrom(d->store);
}
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