[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [KSecretService] 05c2241: Move the temporary backend into its own
From: Michael Leupold <lemma () confuego ! org>
Date: 2010-11-09 19:14:25
Message-ID: 20101109191425.E45B5A60D9 () git ! kde ! org
[Download RAW message or body]
A backend/temporary/temporaryitem.h [License: GPL(v2)]
A backend/temporary/temporaryitem.cpp [License: GPL(v2)]
A backend/temporary/temporarycollectionmanager.h [License: GPL(v2)]
A backend/temporary/temporarycollectionmanager.cpp [License: GPL(v2)]
A backend/temporary/temporarycollection.h [License: GPL(v2)]
A backend/temporary/temporarycollection.cpp [License: GPL(v2)]
commit 05c22413abd53d34d23cf688537b7b6c31a59987
Author: Michael Leupold <lemma@confuego.org>
Date: Tue Jul 27 12:14:25 2010 +0000
Move the temporary backend into its own subdirectory to unclutter a bit.
svn path=/trunk/playground/base/ksecretservice/; revision=1155477
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e09c3c4..2b24eb9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,10 +21,10 @@ SET (ksecretservice_backend_SRCS
backend/backenditem.cpp
backend/backendmaster.cpp
backend/asynccall.cpp
- backend/temporarycollection.cpp
- backend/temporarycollectionmanager.cpp
- backend/temporaryitem.cpp
backend/securebuffer.cpp
+ backend/temporary/temporarycollection.cpp
+ backend/temporary/temporarycollectionmanager.cpp
+ backend/temporary/temporaryitem.cpp
backend/ksecret/ksecretfile.cpp
backend/ksecret/ksecretcollectionmanager.cpp
backend/ksecret/ksecretcollection.cpp
diff --git a/backend/temporary/temporarycollection.cpp \
b/backend/temporary/temporarycollection.cpp new file mode 100644
index 0000000..d8cddba
--- /dev/null
+++ b/backend/temporary/temporarycollection.cpp
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2010, Michael Leupold <lemma@confuego.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License or (at your option) version 3 or any later version
+ * accepted by the membership of KDE e.V. (or its successor approved
+ * by the membership of KDE e.V.), which shall act as a proxy
+ * defined in Section 14 of version 3 of the license.
+ *
+ * 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 General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "temporarycollection.h"
+#include "temporaryitem.h"
+
+#include <secrettool.h>
+
+TemporaryCollection::TemporaryCollection(const QString &id, BackendCollectionManager \
*parent) + : BackendCollection(parent)
+{
+ m_id = id;
+ QDateTime now = QDateTime::currentDateTime();
+ m_created = now;
+ m_modified = now;
+}
+
+TemporaryCollection::~TemporaryCollection()
+{
+}
+
+QString TemporaryCollection::id() const
+{
+ return m_id;
+}
+
+BackendReturn<QString> TemporaryCollection::label() const
+{
+ return m_label;
+}
+
+BackendReturn<void> TemporaryCollection::setLabel(const QString &label)
+{
+ m_label = label;
+ emit collectionChanged(this);
+ return BackendReturn<void>();
+}
+
+QDateTime TemporaryCollection::created() const
+{
+ return m_created;
+}
+
+QDateTime TemporaryCollection::modified() const
+{
+ return m_modified;
+}
+
+bool TemporaryCollection::isLocked() const
+{
+ // temporary collection can't be locked
+ return false;
+}
+
+BackendReturn<QList<BackendItem*> > TemporaryCollection::items() const
+{
+ return m_items;
+}
+
+BackendReturn<QList<BackendItem*> > TemporaryCollection::searchItems(
+ const QMap<QString, QString> &attributes) const
+{
+ TemporaryItem *titem;
+ QList<BackendItem*> foundItems;
+ Q_FOREACH(BackendItem *item, m_items) {
+ titem = qobject_cast<TemporaryItem*>(item);
+ if (titem && titem->matches(attributes)) {
+ foundItems.append(item);
+ }
+ }
+ return foundItems;
+}
+
+bool TemporaryCollection::isCallImmediate(AsyncCall::AsyncType type) const
+{
+ Q_UNUSED(type);
+ return true;
+}
+
+BackendReturn<bool> TemporaryCollection::unlock()
+{
+ return true;
+}
+
+BackendReturn<bool> TemporaryCollection::lock()
+{
+ return BackendReturn<bool>(false, ErrorNotSupported);
+}
+
+BackendReturn<bool> TemporaryCollection::deleteCollection()
+{
+ emit collectionDeleted(this);
+ deleteLater();
+ return true;
+}
+
+BackendReturn<BackendItem*> TemporaryCollection::createItem(const QString &label,
+ const QMap<QString, \
QString> &attributes, + \
const QCA::SecureArray &secret, + \
bool replace, bool locked) +{
+ Q_UNUSED(locked);
+
+ TemporaryItem *item = 0;
+ bool replacing = false;
+
+ // check for duplicates
+ BackendReturn<QList<BackendItem*> > foundItems = searchItems(attributes);
+ if (!foundItems.isError() && foundItems.value().size() > 0) {
+ QList<BackendItem*> oldlist = foundItems.value();
+ Q_FOREACH(BackendItem *olditem, oldlist) {
+ if (olditem->attributes().value() == attributes) {
+ if (replace) {
+ // replacing an existing item
+ item = qobject_cast<TemporaryItem*>(olditem);
+ replacing = true;
+ } else {
+ // item existing but should not be replaced
+ return BackendReturn<BackendItem*>(0, ErrorAlreadyExists);
+ }
+ break;
+ }
+ }
+ }
+
+ if (!item) {
+ item = new TemporaryItem(createId(), this);
+ }
+ item->setLabel(label);
+ item->setAttributes(attributes);
+ item->setSecret(secret);
+
+ if (replacing) {
+ emit itemChanged(item);
+ } else {
+ m_items.append(item);
+ // new item, signals need to be wired
+ connect(item, SIGNAL(itemDeleted(BackendItem*)), \
SLOT(slotItemDeleted(BackendItem*))); + connect(item, \
SIGNAL(itemChanged(BackendItem*)), SIGNAL(itemChanged(BackendItem*))); + emit \
itemCreated(item); + }
+
+ return item;
+}
+
+BackendReturn<bool> TemporaryCollection::changeAuthentication()
+{
+ // TODO: an error might actually be better
+ return false;
+}
+
+void TemporaryCollection::slotItemDeleted(BackendItem *item)
+{
+ m_items.removeAll(item);
+ emit itemDeleted(item);
+}
+
+#include "temporarycollection.moc"
diff --git a/backend/temporary/temporarycollection.h \
b/backend/temporary/temporarycollection.h new file mode 100644
index 0000000..1c942e6
--- /dev/null
+++ b/backend/temporary/temporarycollection.h
@@ -0,0 +1,184 @@
+/*
+ * Copyright 2010, Michael Leupold <lemma@confuego.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License or (at your option) version 3 or any later version
+ * accepted by the membership of KDE e.V. (or its successor approved
+ * by the membership of KDE e.V.), which shall act as a proxy
+ * defined in Section 14 of version 3 of the license.
+ *
+ * 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 General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TEMPORARYCOLLECTION_H
+#define TEMPORARYCOLLECTION_H
+
+#include "../backendcollection.h"
+
+/**
+ * A temporary collection stored in memory.
+ */
+class TemporaryCollection : public BackendCollection
+{
+ Q_OBJECT
+
+public:
+ /**
+ * Constructor
+ *
+ * @param id the new collection's identifier
+ * @param parent the collection manager that created this collection
+ */
+ TemporaryCollection(const QString &id, BackendCollectionManager *parent);
+
+ /**
+ * Destructor
+ */
+ virtual ~TemporaryCollection();
+
+ /**
+ * The unique identifier for this collection.
+ */
+ virtual QString id() const;
+
+ /**
+ * The human-readable label for this collection.
+ * @todo error
+ */
+ virtual BackendReturn<QString> label() const;
+
+ /**
+ * Set this collection's human-readable label.
+ *
+ * @todo error
+ * @param label the new label for this collection
+ */
+ virtual BackendReturn<void> setLabel(const QString &label);
+
+ /**
+ * The time this collection was created.
+ */
+ virtual QDateTime created() const;
+
+ /**
+ * The time this collection was last modified.
+ */
+ virtual QDateTime modified() const;
+
+ /**
+ * Check whether this collection is locked.
+ *
+ * @return true if the collection is locked, false if the collection is
+ * unlocked.
+ */
+ virtual bool isLocked() const;
+
+ /**
+ * List all items inside this backend.
+ *
+ * @return a list containing all items inside this backend. An empty list
+ * either means that no items were found or that an error occurred
+ * (eg. collection needs unlocking before listing the items).
+ * @todo error
+ */
+ virtual BackendReturn<QList<BackendItem*> > items() const;
+
+ /**
+ * Return all items whose attributes match the search terms.
+ *
+ * @param attributes attributes against which the items should be matched
+ * @return a list of items matching the attributes. An empty list either means \
that + * no items were found or that an error occurred (eg. collection \
needs + * unlocking before listing the items).
+ * @todo error
+ */
+ virtual BackendReturn<QList<BackendItem*> > searchItems(
+ const QMap<QString, QString> &attributes) const;
+
+ /**
+ * Check if a type of call can be handled immediately
+ * (synchronously) without requiring an async call.
+ *
+ * @param type the type of call to check
+ * @return true if the type of call can be handled
+ * immediately, false if an async call is
+ * required.
+ * @remarks always returns true as all calls on temporary
+ * items are immediate
+ */
+ virtual bool isCallImmediate(AsyncCall::AsyncType type) const;
+
+ /**
+ * Unlock this collection.
+ *
+ * @return true if the collection is now unlocked, false if unlocking
+ * failed.
+ */
+ virtual BackendReturn<bool> unlock();
+
+ /**
+ * Lock this collection.
+ *
+ * @return true if the collection is now locked, false if locking
+ * failed (the collection couldn't be locked or unlocking is not
+ * supported by this backend).
+ */
+ virtual BackendReturn<bool> lock();
+
+ /**
+ * Delete this collection.
+ *
+ * @return true if the collection was deleted, false if it wasn't.
+ */
+ virtual BackendReturn<bool> deleteCollection();
+
+ /**
+ * Create an item.
+ *
+ * @param label label to assign to the new item
+ * @param attributes attributes to store for the new item
+ * @param secret the secret to store
+ * @param replace if true, an existing item with the same attributes
+ * will be replaced, if false no item will be created
+ * if one with the same attributes already exists
+ * @param locked if true, the item will be locked after creation
+ * @return the item created or 0 if an error occurred.
+ */
+ virtual BackendReturn<BackendItem*> createItem(const QString &label,
+ const QMap<QString, QString> \
&attributes, + const \
QCA::SecureArray &secret, bool replace, + \
bool locked); +
+ /**
+ * Change this collection's authentication.
+ *
+ * @return Always false as TemporaryCollection doesn't support authentication
+ */
+ virtual BackendReturn<bool> changeAuthentication();
+
+private Q_SLOTS:
+ /**
+ * Remove an item from our list of known items.
+ *
+ * @param item Item to remove
+ */
+ void slotItemDeleted(BackendItem *item);
+
+private:
+ QString m_id;
+ QString m_label;
+ QDateTime m_created;
+ QDateTime m_modified;
+
+ QList<BackendItem*> m_items;
+};
+
+#endif
diff --git a/backend/temporary/temporarycollectionmanager.cpp \
b/backend/temporary/temporarycollectionmanager.cpp new file mode 100644
index 0000000..008cdc6
--- /dev/null
+++ b/backend/temporary/temporarycollectionmanager.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2010, Michael Leupold <lemma@confuego.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License or (at your option) version 3 or any later version
+ * accepted by the membership of KDE e.V. (or its successor approved
+ * by the membership of KDE e.V.), which shall act as a proxy
+ * defined in Section 14 of version 3 of the license.
+ *
+ * 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 General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "temporarycollectionmanager.h"
+#include "temporarycollection.h"
+
+#include <secrettool.h>
+
+TemporaryCollectionManager::TemporaryCollectionManager(QObject *parent)
+ : BackendCollectionManager(parent)
+{
+}
+
+TemporaryCollectionManager::~TemporaryCollectionManager()
+{
+}
+
+bool TemporaryCollectionManager::isCallImmediate(AsyncCall::AsyncType type) const
+{
+ Q_UNUSED(type);
+ return true;
+}
+
+BackendReturn<BackendCollection *> TemporaryCollectionManager::createCollection(
+ const QString &label, bool locked)
+{
+ Q_UNUSED(locked);
+
+ TemporaryCollection *coll = new TemporaryCollection(createId(), this);
+ coll->setLabel(label);
+
+ // connect signals
+ connect(coll, SIGNAL(collectionDeleted(BackendCollection*)),
+ SIGNAL(collectionDeleted(BackendCollection*)));
+ emit collectionCreated(coll);
+
+ return coll;
+}
+
+#include "temporarycollectionmanager.moc"
diff --git a/backend/temporary/temporarycollectionmanager.h \
b/backend/temporary/temporarycollectionmanager.h new file mode 100644
index 0000000..0ca2835
--- /dev/null
+++ b/backend/temporary/temporarycollectionmanager.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2010, Michael Leupold <lemma@confuego.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License or (at your option) version 3 or any later version
+ * accepted by the membership of KDE e.V. (or its successor approved
+ * by the membership of KDE e.V.), which shall act as a proxy
+ * defined in Section 14 of version 3 of the license.
+ *
+ * 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 General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TEMPORARYCOLLECTIONMANAGER_H
+#define TEMPORARYCOLLECTIONMANAGER_H
+
+#include "../backendcollectionmanager.h"
+
+class TemporaryCollection;
+
+/**
+ * Manager for temporary collections.
+ */
+class TemporaryCollectionManager : public BackendCollectionManager
+{
+ Q_OBJECT
+
+public:
+ friend class TemporaryCollection;
+
+ /**
+ * Constructor
+ */
+ TemporaryCollectionManager(QObject *parent = 0);
+
+ /**
+ * Destructor
+ */
+ virtual ~TemporaryCollectionManager();
+
+ /**
+ * Check if a type of call can be handled immediately
+ * (synchronously) without requiring an async call.
+ *
+ * @param type the type of call to check
+ * @return true if the type of call can be handled
+ * immediately, false if an async call is
+ * required.
+ * @remarks always returns true as all calls on temporary
+ * items are immediate
+ */
+ virtual bool isCallImmediate(AsyncCall::AsyncType type) const;
+
+ /**
+ * Create a new collection.
+ *
+ * @param label the label of the new collection
+ * @param lock ignored. Temporary collections can't be locked.
+ * @return the collection or 0 on error
+ */
+ virtual BackendReturn<BackendCollection*> createCollection(const QString &label, \
bool locked); +};
+
+#endif
diff --git a/backend/temporary/temporaryitem.cpp \
b/backend/temporary/temporaryitem.cpp new file mode 100644
index 0000000..0449164
--- /dev/null
+++ b/backend/temporary/temporaryitem.cpp
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2010, Michael Leupold <lemma@confuego.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License or (at your option) version 3 or any later version
+ * accepted by the membership of KDE e.V. (or its successor approved
+ * by the membership of KDE e.V.), which shall act as a proxy
+ * defined in Section 14 of version 3 of the license.
+ *
+ * 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 General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "temporaryitem.h"
+#include "temporarycollection.h"
+
+TemporaryItem::TemporaryItem(const QString &id, TemporaryCollection *parent)
+ : BackendItem(parent), m_id(id)
+{
+ QDateTime now = QDateTime::currentDateTime();
+ m_created = now;
+ m_modified = now;
+}
+
+TemporaryItem::~TemporaryItem()
+{
+}
+
+QString TemporaryItem::id() const
+{
+ return m_id;
+}
+
+BackendReturn<QString> TemporaryItem::label() const
+{
+ return m_label;
+}
+
+BackendReturn<void> TemporaryItem::setLabel(const QString &label)
+{
+ m_label = label;
+ markAsModified();
+ return BackendReturn<void>();
+}
+
+BackendReturn<QCA::SecureArray> TemporaryItem::secret() const
+{
+ return m_secret;
+}
+
+BackendReturn<void> TemporaryItem::setSecret(const QCA::SecureArray &secret)
+{
+ m_secret = secret;
+ markAsModified();
+ return BackendReturn<void>();
+}
+
+BackendReturn<QMap<QString, QString> > TemporaryItem::attributes() const
+{
+ return m_attributes;
+}
+
+BackendReturn<void> TemporaryItem::setAttributes(const QMap<QString, QString> \
&attributes) +{
+ m_attributes = attributes;
+ markAsModified();
+ return BackendReturn<void>();
+}
+
+QDateTime TemporaryItem::created() const
+{
+ return m_created;
+}
+
+QDateTime TemporaryItem::modified() const
+{
+ return m_modified;
+}
+
+bool TemporaryItem::isLocked() const
+{
+ return false;
+}
+
+bool TemporaryItem::isCallImmediate(AsyncCall::AsyncType type) const
+{
+ Q_UNUSED(type);
+ return true;
+}
+
+BackendReturn<bool> TemporaryItem::unlock()
+{
+ return true;
+}
+
+BackendReturn<bool> TemporaryItem::lock()
+{
+ return BackendReturn<bool>(false, ErrorNotSupported);
+}
+
+BackendReturn<bool> TemporaryItem::deleteItem()
+{
+ emit itemDeleted(this);
+ deleteLater();
+ return true;
+}
+
+BackendReturn<bool> TemporaryItem::changeAuthentication()
+{
+ // TODO: error might be better
+ return false;
+}
+
+bool TemporaryItem::matches(const QMap<QString, QString> &attributes)
+{
+ QMap<QString, QString>::const_iterator it = attributes.constBegin();
+ QMap<QString, QString>::const_iterator end = attributes.constEnd();
+ for ( ; it != end; ++it) {
+ if (!m_attributes.contains(it.key()) ||
+ m_attributes.value(it.key()) != it.value()) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void TemporaryItem::markAsModified()
+{
+ m_modified = QDateTime::currentDateTime();
+ emit itemChanged(this);
+}
+
+#include "temporaryitem.moc"
diff --git a/backend/temporary/temporaryitem.h b/backend/temporary/temporaryitem.h
new file mode 100644
index 0000000..2817219
--- /dev/null
+++ b/backend/temporary/temporaryitem.h
@@ -0,0 +1,187 @@
+/*
+ * Copyright 2010, Michael Leupold <lemma@confuego.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License or (at your option) version 3 or any later version
+ * accepted by the membership of KDE e.V. (or its successor approved
+ * by the membership of KDE e.V.), which shall act as a proxy
+ * defined in Section 14 of version 3 of the license.
+ *
+ * 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 General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TEMPORARYITEM_H
+#define TEMPORARYITEM_H
+
+#include "../backenditem.h"
+
+class TemporaryCollection;
+
+class TemporaryItem : public BackendItem
+{
+ Q_OBJECT
+
+public:
+ friend class TemporaryCollection;
+
+ /**
+ * Constructor.
+ *
+ * @param id unique identifier of the new item
+ * @param collection collection that created this item
+ */
+ TemporaryItem(const QString &id, TemporaryCollection *parent);
+
+ /**
+ * Destructor.
+ */
+ ~TemporaryItem();
+
+ /**
+ * The unique identifer for this item.
+ */
+ virtual QString id() const;
+
+ /**
+ * The human-readable label for this item.
+ * @todo error
+ */
+ virtual BackendReturn<QString> label() const;
+
+ /**
+ * Set the human-readable label for this item.
+ *
+ * @param label the new label for this item
+ * @todo error
+ */
+ virtual BackendReturn<void> setLabel(const QString &label);
+
+ /**
+ * Get the secret stored inside this item.
+ *
+ * @return the secret
+ * @todo this will most likely become non-const as that might make sense
+ * with certain backends me reckons.
+ */
+ virtual BackendReturn<QCA::SecureArray> secret() const;
+
+ /**
+ * Set the secret stored inside this item.
+ *
+ * @param secret the secret to store
+ */
+ virtual BackendReturn<void> setSecret(const QCA::SecureArray &secret);
+
+ /**
+ * The attributes of the item.
+ *
+ * @return the item's attributes
+ */
+ virtual BackendReturn<QMap<QString, QString> > attributes() const;
+
+ /**
+ * Set the attributes of this item.
+ *
+ * @param attributes attributes to assign to this item
+ */
+ virtual BackendReturn<void> setAttributes(const QMap<QString, QString> \
&attributes); +
+ /**
+ * The time this item was created.
+ */
+ virtual QDateTime created() const;
+
+ /**
+ * The time this item was last modified.
+ */
+ virtual QDateTime modified() const;
+
+ /**
+ * Check whether this item is locked.
+ *
+ * @return always returns false as temporary items can't be locked.
+ */
+ virtual bool isLocked() const;
+
+ /**
+ * Check if a type of call can be handled immediately
+ * (synchronously) without requiring an async call.
+ *
+ * @param type the type of call to check
+ * @return true if the type of call can be handled
+ * immediately, false if an async call is
+ * required.
+ * @remarks always returns true as all calls on temporary
+ * items are immediate
+ */
+ virtual bool isCallImmediate(AsyncCall::AsyncType type) const;
+
+ /**
+ * Unlock this item.
+ *
+ * @return true if the item was unlocked successfully, false if unlocking failed
+ * or an error occurred.
+ * @remarks this is only called by processCall. To set an unlock call
+ * erroneous, use the Base::setError() call.
+ */
+ virtual BackendReturn<bool> unlock();
+
+ /**
+ * Lock this item.
+ *
+ * @return true if the item was locked successfully, false if locking failed
+ * or an error occurred.
+ * @remarks this is only called by processCall. To set a lock call
+ * erroneous, use the Base::setError() call.
+ */
+ virtual BackendReturn<bool> lock();
+
+ /**
+ * Delete this item.
+ *
+ * @return true if the item was deleted, false if it wasn't or an error occurred.
+ * @remarks this is only called by processCall. To set a delete call
+ * erroneous, use the Base::setError() call.
+ */
+ virtual BackendReturn<bool> deleteItem();
+
+ /**
+ * Change this item's authentication.
+ *
+ * @return always false as TemporaryItem doesn't support authentication
+ */
+ virtual BackendReturn<bool> changeAuthentication();
+
+ /**
+ * Check whether this item matches the attributes given.
+ *
+ * @param attributes attributes to match against
+ * @return true if this item matches the attributes, false
+ * if the item doesn't match the attributes.
+ */
+ bool matches(const QMap<QString, QString> &attributes);
+
+private:
+ /**
+ * Mark this item as modified and emit the \sa itemChanged signal.
+ */
+ void markAsModified();
+
+ QString m_id;
+ QString m_label;
+ QDateTime m_created;
+ QDateTime m_modified;
+ QMap<QString, QString> m_attributes;
+
+ QCA::SecureArray m_secret;
+};
+
+#endif
diff --git a/backend/temporarycollection.cpp b/backend/temporarycollection.cpp
deleted file mode 100644
index d8cddba..0000000
--- a/backend/temporarycollection.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright 2010, Michael Leupold <lemma@confuego.org>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * 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 General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "temporarycollection.h"
-#include "temporaryitem.h"
-
-#include <secrettool.h>
-
-TemporaryCollection::TemporaryCollection(const QString &id, BackendCollectionManager \
*parent)
- : BackendCollection(parent)
-{
- m_id = id;
- QDateTime now = QDateTime::currentDateTime();
- m_created = now;
- m_modified = now;
-}
-
-TemporaryCollection::~TemporaryCollection()
-{
-}
-
-QString TemporaryCollection::id() const
-{
- return m_id;
-}
-
-BackendReturn<QString> TemporaryCollection::label() const
-{
- return m_label;
-}
-
-BackendReturn<void> TemporaryCollection::setLabel(const QString &label)
-{
- m_label = label;
- emit collectionChanged(this);
- return BackendReturn<void>();
-}
-
-QDateTime TemporaryCollection::created() const
-{
- return m_created;
-}
-
-QDateTime TemporaryCollection::modified() const
-{
- return m_modified;
-}
-
-bool TemporaryCollection::isLocked() const
-{
- // temporary collection can't be locked
- return false;
-}
-
-BackendReturn<QList<BackendItem*> > TemporaryCollection::items() const
-{
- return m_items;
-}
-
-BackendReturn<QList<BackendItem*> > TemporaryCollection::searchItems(
- const QMap<QString, QString> &attributes) const
-{
- TemporaryItem *titem;
- QList<BackendItem*> foundItems;
- Q_FOREACH(BackendItem *item, m_items) {
- titem = qobject_cast<TemporaryItem*>(item);
- if (titem && titem->matches(attributes)) {
- foundItems.append(item);
- }
- }
- return foundItems;
-}
-
-bool TemporaryCollection::isCallImmediate(AsyncCall::AsyncType type) const
-{
- Q_UNUSED(type);
- return true;
-}
-
-BackendReturn<bool> TemporaryCollection::unlock()
-{
- return true;
-}
-
-BackendReturn<bool> TemporaryCollection::lock()
-{
- return BackendReturn<bool>(false, ErrorNotSupported);
-}
-
-BackendReturn<bool> TemporaryCollection::deleteCollection()
-{
- emit collectionDeleted(this);
- deleteLater();
- return true;
-}
-
-BackendReturn<BackendItem*> TemporaryCollection::createItem(const QString &label,
- const QMap<QString, \
QString> &attributes,
- const QCA::SecureArray \
&secret,
- bool replace, bool \
locked)
-{
- Q_UNUSED(locked);
-
- TemporaryItem *item = 0;
- bool replacing = false;
-
- // check for duplicates
- BackendReturn<QList<BackendItem*> > foundItems = searchItems(attributes);
- if (!foundItems.isError() && foundItems.value().size() > 0) {
- QList<BackendItem*> oldlist = foundItems.value();
- Q_FOREACH(BackendItem *olditem, oldlist) {
- if (olditem->attributes().value() == attributes) {
- if (replace) {
- // replacing an existing item
- item = qobject_cast<TemporaryItem*>(olditem);
- replacing = true;
- } else {
- // item existing but should not be replaced
- return BackendReturn<BackendItem*>(0, ErrorAlreadyExists);
- }
- break;
- }
- }
- }
-
- if (!item) {
- item = new TemporaryItem(createId(), this);
- }
- item->setLabel(label);
- item->setAttributes(attributes);
- item->setSecret(secret);
-
- if (replacing) {
- emit itemChanged(item);
- } else {
- m_items.append(item);
- // new item, signals need to be wired
- connect(item, SIGNAL(itemDeleted(BackendItem*)), \
SLOT(slotItemDeleted(BackendItem*)));
- connect(item, SIGNAL(itemChanged(BackendItem*)), \
SIGNAL(itemChanged(BackendItem*)));
- emit itemCreated(item);
- }
-
- return item;
-}
-
-BackendReturn<bool> TemporaryCollection::changeAuthentication()
-{
- // TODO: an error might actually be better
- return false;
-}
-
-void TemporaryCollection::slotItemDeleted(BackendItem *item)
-{
- m_items.removeAll(item);
- emit itemDeleted(item);
-}
-
-#include "temporarycollection.moc"
diff --git a/backend/temporarycollection.h b/backend/temporarycollection.h
deleted file mode 100644
index 1e92fe4..0000000
--- a/backend/temporarycollection.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright 2010, Michael Leupold <lemma@confuego.org>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * 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 General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef TEMPORARYCOLLECTION_H
-#define TEMPORARYCOLLECTION_H
-
-#include "backendcollection.h"
-
-/**
- * A temporary collection stored in memory.
- */
-class TemporaryCollection : public BackendCollection
-{
- Q_OBJECT
-
-public:
- /**
- * Constructor
- *
- * @param id the new collection's identifier
- * @param parent the collection manager that created this collection
- */
- TemporaryCollection(const QString &id, BackendCollectionManager *parent);
-
- /**
- * Destructor
- */
- virtual ~TemporaryCollection();
-
- /**
- * The unique identifier for this collection.
- */
- virtual QString id() const;
-
- /**
- * The human-readable label for this collection.
- * @todo error
- */
- virtual BackendReturn<QString> label() const;
-
- /**
- * Set this collection's human-readable label.
- *
- * @todo error
- * @param label the new label for this collection
- */
- virtual BackendReturn<void> setLabel(const QString &label);
-
- /**
- * The time this collection was created.
- */
- virtual QDateTime created() const;
-
- /**
- * The time this collection was last modified.
- */
- virtual QDateTime modified() const;
-
- /**
- * Check whether this collection is locked.
- *
- * @return true if the collection is locked, false if the collection is
- * unlocked.
- */
- virtual bool isLocked() const;
-
- /**
- * List all items inside this backend.
- *
- * @return a list containing all items inside this backend. An empty list
- * either means that no items were found or that an error occurred
- * (eg. collection needs unlocking before listing the items).
- * @todo error
- */
- virtual BackendReturn<QList<BackendItem*> > items() const;
-
- /**
- * Return all items whose attributes match the search terms.
- *
- * @param attributes attributes against which the items should be matched
- * @return a list of items matching the attributes. An empty list either means \
that
- * no items were found or that an error occurred (eg. collection needs
- * unlocking before listing the items).
- * @todo error
- */
- virtual BackendReturn<QList<BackendItem*> > searchItems(
- const QMap<QString, QString> &attributes) const;
-
- /**
- * Check if a type of call can be handled immediately
- * (synchronously) without requiring an async call.
- *
- * @param type the type of call to check
- * @return true if the type of call can be handled
- * immediately, false if an async call is
- * required.
- * @remarks always returns true as all calls on temporary
- * items are immediate
- */
- virtual bool isCallImmediate(AsyncCall::AsyncType type) const;
-
- /**
- * Unlock this collection.
- *
- * @return true if the collection is now unlocked, false if unlocking
- * failed.
- */
- virtual BackendReturn<bool> unlock();
-
- /**
- * Lock this collection.
- *
- * @return true if the collection is now locked, false if locking
- * failed (the collection couldn't be locked or unlocking is not
- * supported by this backend).
- */
- virtual BackendReturn<bool> lock();
-
- /**
- * Delete this collection.
- *
- * @return true if the collection was deleted, false if it wasn't.
- */
- virtual BackendReturn<bool> deleteCollection();
-
- /**
- * Create an item.
- *
- * @param label label to assign to the new item
- * @param attributes attributes to store for the new item
- * @param secret the secret to store
- * @param replace if true, an existing item with the same attributes
- * will be replaced, if false no item will be created
- * if one with the same attributes already exists
- * @param locked if true, the item will be locked after creation
- * @return the item created or 0 if an error occurred.
- */
- virtual BackendReturn<BackendItem*> createItem(const QString &label,
- const QMap<QString, QString> \
&attributes,
- const QCA::SecureArray &secret, \
bool replace,
- bool locked);
-
- /**
- * Change this collection's authentication.
- *
- * @return Always false as TemporaryCollection doesn't support authentication
- */
- virtual BackendReturn<bool> changeAuthentication();
-
-private Q_SLOTS:
- /**
- * Remove an item from our list of known items.
- *
- * @param item Item to remove
- */
- void slotItemDeleted(BackendItem *item);
-
-private:
- QString m_id;
- QString m_label;
- QDateTime m_created;
- QDateTime m_modified;
-
- QList<BackendItem*> m_items;
-};
-
-#endif
diff --git a/backend/temporarycollectionmanager.cpp \
b/backend/temporarycollectionmanager.cpp deleted file mode 100644
index 008cdc6..0000000
--- a/backend/temporarycollectionmanager.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2010, Michael Leupold <lemma@confuego.org>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * 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 General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "temporarycollectionmanager.h"
-#include "temporarycollection.h"
-
-#include <secrettool.h>
-
-TemporaryCollectionManager::TemporaryCollectionManager(QObject *parent)
- : BackendCollectionManager(parent)
-{
-}
-
-TemporaryCollectionManager::~TemporaryCollectionManager()
-{
-}
-
-bool TemporaryCollectionManager::isCallImmediate(AsyncCall::AsyncType type) const
-{
- Q_UNUSED(type);
- return true;
-}
-
-BackendReturn<BackendCollection *> TemporaryCollectionManager::createCollection(
- const QString &label, bool locked)
-{
- Q_UNUSED(locked);
-
- TemporaryCollection *coll = new TemporaryCollection(createId(), this);
- coll->setLabel(label);
-
- // connect signals
- connect(coll, SIGNAL(collectionDeleted(BackendCollection*)),
- SIGNAL(collectionDeleted(BackendCollection*)));
- emit collectionCreated(coll);
-
- return coll;
-}
-
-#include "temporarycollectionmanager.moc"
diff --git a/backend/temporarycollectionmanager.h \
b/backend/temporarycollectionmanager.h deleted file mode 100644
index bad48a5..0000000
--- a/backend/temporarycollectionmanager.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2010, Michael Leupold <lemma@confuego.org>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * 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 General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef TEMPORARYCOLLECTIONMANAGER_H
-#define TEMPORARYCOLLECTIONMANAGER_H
-
-#include "backendcollectionmanager.h"
-
-class TemporaryCollection;
-
-/**
- * Manager for temporary collections.
- */
-class TemporaryCollectionManager : public BackendCollectionManager
-{
- Q_OBJECT
-
-public:
- friend class TemporaryCollection;
-
- /**
- * Constructor
- */
- TemporaryCollectionManager(QObject *parent = 0);
-
- /**
- * Destructor
- */
- virtual ~TemporaryCollectionManager();
-
- /**
- * Check if a type of call can be handled immediately
- * (synchronously) without requiring an async call.
- *
- * @param type the type of call to check
- * @return true if the type of call can be handled
- * immediately, false if an async call is
- * required.
- * @remarks always returns true as all calls on temporary
- * items are immediate
- */
- virtual bool isCallImmediate(AsyncCall::AsyncType type) const;
-
- /**
- * Create a new collection.
- *
- * @param label the label of the new collection
- * @param lock ignored. Temporary collections can't be locked.
- * @return the collection or 0 on error
- */
- virtual BackendReturn<BackendCollection*> createCollection(const QString &label, \
bool locked);
-};
-
-#endif
diff --git a/backend/temporaryitem.cpp b/backend/temporaryitem.cpp
deleted file mode 100644
index 0449164..0000000
--- a/backend/temporaryitem.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright 2010, Michael Leupold <lemma@confuego.org>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * 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 General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "temporaryitem.h"
-#include "temporarycollection.h"
-
-TemporaryItem::TemporaryItem(const QString &id, TemporaryCollection *parent)
- : BackendItem(parent), m_id(id)
-{
- QDateTime now = QDateTime::currentDateTime();
- m_created = now;
- m_modified = now;
-}
-
-TemporaryItem::~TemporaryItem()
-{
-}
-
-QString TemporaryItem::id() const
-{
- return m_id;
-}
-
-BackendReturn<QString> TemporaryItem::label() const
-{
- return m_label;
-}
-
-BackendReturn<void> TemporaryItem::setLabel(const QString &label)
-{
- m_label = label;
- markAsModified();
- return BackendReturn<void>();
-}
-
-BackendReturn<QCA::SecureArray> TemporaryItem::secret() const
-{
- return m_secret;
-}
-
-BackendReturn<void> TemporaryItem::setSecret(const QCA::SecureArray &secret)
-{
- m_secret = secret;
- markAsModified();
- return BackendReturn<void>();
-}
-
-BackendReturn<QMap<QString, QString> > TemporaryItem::attributes() const
-{
- return m_attributes;
-}
-
-BackendReturn<void> TemporaryItem::setAttributes(const QMap<QString, QString> \
&attributes)
-{
- m_attributes = attributes;
- markAsModified();
- return BackendReturn<void>();
-}
-
-QDateTime TemporaryItem::created() const
-{
- return m_created;
-}
-
-QDateTime TemporaryItem::modified() const
-{
- return m_modified;
-}
-
-bool TemporaryItem::isLocked() const
-{
- return false;
-}
-
-bool TemporaryItem::isCallImmediate(AsyncCall::AsyncType type) const
-{
- Q_UNUSED(type);
- return true;
-}
-
-BackendReturn<bool> TemporaryItem::unlock()
-{
- return true;
-}
-
-BackendReturn<bool> TemporaryItem::lock()
-{
- return BackendReturn<bool>(false, ErrorNotSupported);
-}
-
-BackendReturn<bool> TemporaryItem::deleteItem()
-{
- emit itemDeleted(this);
- deleteLater();
- return true;
-}
-
-BackendReturn<bool> TemporaryItem::changeAuthentication()
-{
- // TODO: error might be better
- return false;
-}
-
-bool TemporaryItem::matches(const QMap<QString, QString> &attributes)
-{
- QMap<QString, QString>::const_iterator it = attributes.constBegin();
- QMap<QString, QString>::const_iterator end = attributes.constEnd();
- for ( ; it != end; ++it) {
- if (!m_attributes.contains(it.key()) ||
- m_attributes.value(it.key()) != it.value()) {
- return false;
- }
- }
-
- return true;
-}
-
-void TemporaryItem::markAsModified()
-{
- m_modified = QDateTime::currentDateTime();
- emit itemChanged(this);
-}
-
-#include "temporaryitem.moc"
diff --git a/backend/temporaryitem.h b/backend/temporaryitem.h
deleted file mode 100644
index f7b3a7d..0000000
--- a/backend/temporaryitem.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright 2010, Michael Leupold <lemma@confuego.org>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * 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 General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef TEMPORARYITEM_H
-#define TEMPORARYITEM_H
-
-#include "backenditem.h"
-
-class TemporaryCollection;
-
-class TemporaryItem : public BackendItem
-{
- Q_OBJECT
-
-public:
- friend class TemporaryCollection;
-
- /**
- * Constructor.
- *
- * @param id unique identifier of the new item
- * @param collection collection that created this item
- */
- TemporaryItem(const QString &id, TemporaryCollection *parent);
-
- /**
- * Destructor.
- */
- ~TemporaryItem();
-
- /**
- * The unique identifer for this item.
- */
- virtual QString id() const;
-
- /**
- * The human-readable label for this item.
- * @todo error
- */
- virtual BackendReturn<QString> label() const;
-
- /**
- * Set the human-readable label for this item.
- *
- * @param label the new label for this item
- * @todo error
- */
- virtual BackendReturn<void> setLabel(const QString &label);
-
- /**
- * Get the secret stored inside this item.
- *
- * @return the secret
- * @todo this will most likely become non-const as that might make sense
- * with certain backends me reckons.
- */
- virtual BackendReturn<QCA::SecureArray> secret() const;
-
- /**
- * Set the secret stored inside this item.
- *
- * @param secret the secret to store
- */
- virtual BackendReturn<void> setSecret(const QCA::SecureArray &secret);
-
- /**
- * The attributes of the item.
- *
- * @return the item's attributes
- */
- virtual BackendReturn<QMap<QString, QString> > attributes() const;
-
- /**
- * Set the attributes of this item.
- *
- * @param attributes attributes to assign to this item
- */
- virtual BackendReturn<void> setAttributes(const QMap<QString, QString> \
&attributes);
-
- /**
- * The time this item was created.
- */
- virtual QDateTime created() const;
-
- /**
- * The time this item was last modified.
- */
- virtual QDateTime modified() const;
-
- /**
- * Check whether this item is locked.
- *
- * @return always returns false as temporary items can't be locked.
- */
- virtual bool isLocked() const;
-
- /**
- * Check if a type of call can be handled immediately
- * (synchronously) without requiring an async call.
- *
- * @param type the type of call to check
- * @return true if the type of call can be handled
- * immediately, false if an async call is
- * required.
- * @remarks always returns true as all calls on temporary
- * items are immediate
- */
- virtual bool isCallImmediate(AsyncCall::AsyncType type) const;
-
- /**
- * Unlock this item.
- *
- * @return true if the item was unlocked successfully, false if unlocking failed
- * or an error occurred.
- * @remarks this is only called by processCall. To set an unlock call
- * erroneous, use the Base::setError() call.
- */
- virtual BackendReturn<bool> unlock();
-
- /**
- * Lock this item.
- *
- * @return true if the item was locked successfully, false if locking failed
- * or an error occurred.
- * @remarks this is only called by processCall. To set a lock call
- * erroneous, use the Base::setError() call.
- */
- virtual BackendReturn<bool> lock();
-
- /**
- * Delete this item.
- *
- * @return true if the item was deleted, false if it wasn't or an error occurred.
- * @remarks this is only called by processCall. To set a delete call
- * erroneous, use the Base::setError() call.
- */
- virtual BackendReturn<bool> deleteItem();
-
- /**
- * Change this item's authentication.
- *
- * @return always false as TemporaryItem doesn't support authentication
- */
- virtual BackendReturn<bool> changeAuthentication();
-
- /**
- * Check whether this item matches the attributes given.
- *
- * @param attributes attributes to match against
- * @return true if this item matches the attributes, false
- * if the item doesn't match the attributes.
- */
- bool matches(const QMap<QString, QString> &attributes);
-
-private:
- /**
- * Mark this item as modified and emit the \sa itemChanged signal.
- */
- void markAsModified();
-
- QString m_id;
- QString m_label;
- QDateTime m_created;
- QDateTime m_modified;
- QMap<QString, QString> m_attributes;
-
- QCA::SecureArray m_secret;
-};
-
-#endif
diff --git a/backend/tests/backendtest.cpp b/backend/tests/backendtest.cpp
index 8d9dae0..355420a 100644
--- a/backend/tests/backendtest.cpp
+++ b/backend/tests/backendtest.cpp
@@ -20,7 +20,7 @@
#include "backendtest.h"
#include <backendmaster.h>
-#include <temporarycollectionmanager.h>
+#include <temporary/temporarycollectionmanager.h>
#include <backendcollection.h>
#include <backenditem.h>
diff --git a/daemon/tests/servicetest.cpp b/daemon/tests/servicetest.cpp
index cc4b110..a6cf383 100644
--- a/daemon/tests/servicetest.cpp
+++ b/daemon/tests/servicetest.cpp
@@ -21,7 +21,7 @@
#include "servicetest.h"
#include "backend/backendmaster.h"
-#include "backend/temporarycollectionmanager.h"
+#include "backend/temporary/temporarycollectionmanager.h"
#include "tempblockingcollectionmanager.h"
#include "daemon/service.h"
#include "daemon/dbus/dbustypes.h"
diff --git a/daemon/tests/tempblockingcollection.h \
b/daemon/tests/tempblockingcollection.h index 9127256..bd5df65 100644
--- a/daemon/tests/tempblockingcollection.h
+++ b/daemon/tests/tempblockingcollection.h
@@ -21,7 +21,7 @@
#ifndef TEMPBLOCKINGCOLLECTION_H
#define TEMPBLOCKINGCOLLECTION_H
-#include "backend/temporarycollection.h"
+#include "backend/temporary/temporarycollection.h"
// implement a temporary collection that blocks every call.
class TempBlockingCollection : public TemporaryCollection
diff --git a/daemon/tests/tempblockingcollectionmanager.h \
b/daemon/tests/tempblockingcollectionmanager.h index 8db1d53..22f914d 100644
--- a/daemon/tests/tempblockingcollectionmanager.h
+++ b/daemon/tests/tempblockingcollectionmanager.h
@@ -21,7 +21,7 @@
#ifndef TEMPBLOCKINGCOLLECTIONMANAGER_H
#define TEMPBLOCKINGCOLLECTIONMANAGER_H
-#include "backend/temporarycollectionmanager.h"
+#include "backend/temporary/temporarycollectionmanager.h"
class TempBlockingCollection;
diff --git a/daemon/tests/tempblockingitem.h b/daemon/tests/tempblockingitem.h
index 2966586..6df1990 100644
--- a/daemon/tests/tempblockingitem.h
+++ b/daemon/tests/tempblockingitem.h
@@ -21,7 +21,7 @@
#ifndef TEMPBLOCKINGITEM_H
#define TEMPBLOCKINGITEM_H
-#include "backend/temporaryitem.h"
+#include "backend/temporary/temporaryitem.h"
class TempBlockingCollection;
diff --git a/main.cpp b/main.cpp
index a3c410a..0d9dd92 100644
--- a/main.cpp
+++ b/main.cpp
@@ -26,7 +26,7 @@
#include <QtCrypto/QtCrypto>
#include "backend/backendmaster.h"
-#include "backend/temporarycollectionmanager.h"
+#include "backend/temporary/temporarycollectionmanager.h"
#include "daemon/service.h"
int main(int argc, char **argv)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic