[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [ksecrets] src/api/ksecrets: Move listCollections from Collection to Service
From: Valentin Rusu <kde () rusu ! info>
Date: 2015-08-06 15:30:06
Message-ID: E1ZNN7O-0001Aw-Mb () scm ! kde ! org
[Download RAW message or body]
Git commit a0573cf34855c8bbb4ff31369f777d4abccb9ab9 by Valentin Rusu.
Committed on 05/08/2015 at 16:32.
Pushed by vrusu into branch 'master'.
Move listCollections from Collection to Service
M +0 -11 src/api/ksecrets/ksecretscollection.cpp
M +14 -30 src/api/ksecrets/ksecretscollection.h
M +0 -1 src/api/ksecrets/ksecretscollection_p.h
M +14 -0 src/api/ksecrets/ksecretsservice.cpp
M +27 -23 src/api/ksecrets/ksecretsservice.h
M +1 -0 src/api/ksecrets/ksecretsservice_p.h
http://commits.kde.org/ksecrets/a0573cf34855c8bbb4ff31369f777d4abccb9ab9
diff --git a/src/api/ksecrets/ksecretscollection.cpp b/src/api/ksecrets/ksecretscollection.cpp
index f9b0b8c..8bb5659 100644
--- a/src/api/ksecrets/ksecretscollection.cpp
+++ b/src/api/ksecrets/ksecretscollection.cpp
@@ -39,11 +39,6 @@ Collection::Collection()
Collection::~Collection() {}
-QFuture<QList<CollectionPtr> > Collection::listCollections()
-{
- return QtConcurrent::run(&CollectionPrivate::listCollections);
-}
-
Collection::Status Collection::status() const { return d->collectionStatus; }
QFuture<bool> Collection::deleteCollection()
@@ -183,12 +178,6 @@ bool CollectionPrivate::lock()
return true;
}
-QList<CollectionPtr> CollectionPrivate::listCollections()
-{
- // TODO
- return QList<CollectionPtr>();
-}
-
bool CollectionPrivate::deleteCollection()
{
// TODO
diff --git a/src/api/ksecrets/ksecretscollection.h b/src/api/ksecrets/ksecretscollection.h
index 769ba02..cc7346d 100644
--- a/src/api/ksecrets/ksecretscollection.h
+++ b/src/api/ksecrets/ksecretscollection.h
@@ -59,28 +59,18 @@ public:
* @see statusChanged()
*/
enum Status {
- Invalid
- = 0, /// the collection objet is freshly initialized and none of
- /// it's methods have been called
- Pending
- = 1, /// one of the collection methods was called but this object
- /// is yet to be connected to the backed
- FoundExisting
- = 2, /// this object is connected to an existing backend connection
- NewlyCreated
- = 3, /// this object is connected to a newly created connection
- NotFound = 4, /// the collection was not found
- Deleted = 5 /// the collection was deleted. Calling methods in such a
- /// collection would lead to unpredictable results
+ Invalid = 0, /// the collection objet is freshly initialized and none of
+ /// it's methods have been called
+ Pending = 1, /// one of the collection methods was called but this object
+ /// is yet to be connected to the backed
+ FoundExisting = 2, /// this object is connected to an existing backend connection
+ NewlyCreated = 3, /// this object is connected to a newly created connection
+ NotFound = 4, /// the collection was not found
+ Deleted = 5 /// the collection was deleted. Calling methods in such a
+ /// collection would lead to unpredictable results
};
/**
- * Use this method to find out the names of all known secret service
- * collections on the running system
- */
- static QFuture<QList<CollectionPtr> > listCollections();
-
- /**
* This will get the actual findStatus of this collection
* @return Status
*/
@@ -137,20 +127,17 @@ public:
* @return QFuture whose method results() will bring all the items found
*
*/
- QFuture<QList<SecretItemPtr> > searchItems(
- const AttributesMap& attributes);
+ QFuture<QList<SecretItemPtr> > searchItems(const AttributesMap& attributes);
QFuture<QList<SecretItemPtr> > searchItems(const QString& label);
- QFuture<QList<SecretItemPtr> > searchItems(
- const QString& label, const AttributesMap& attributes);
+ QFuture<QList<SecretItemPtr> > searchItems(const QString& label, const AttributesMap& \
attributes);
/**
* Use this method to get several secrets without getting through getting
* items
*/
- QFuture<QList<SecretPtr> > searchSecrets(
- const StringStringMap& attributes);
+ QFuture<QList<SecretPtr> > searchSecrets(const StringStringMap& attributes);
/**
* Create a new item inside the current collection
@@ -166,9 +153,7 @@ public:
*
* @see SecretItem
*/
- QFuture<bool> createItem(const QString& label, const Secret& secret,
- const AttributesMap& attributes = AttributesMap(),
- CreateItemOptions options = DoNotReplaceExistingItem);
+ QFuture<bool> createItem(const QString& label, const Secret& secret, const AttributesMap& \
attributes = AttributesMap(), CreateItemOptions options = DoNotReplaceExistingItem);
/**
* Retrieve items stored inside this collection
@@ -249,8 +234,7 @@ Q_SIGNALS:
void itemChanged(const KSecrets::SecretItem&);
protected:
- friend class ServicePrivate; // collections are instantiated from the
- // service only
+ friend class ServicePrivate; // collections are instantiated from the service only
explicit Collection();
private:
diff --git a/src/api/ksecrets/ksecretscollection_p.h b/src/api/ksecrets/ksecretscollection_p.h
index b989f08..281990b 100644
--- a/src/api/ksecrets/ksecretscollection_p.h
+++ b/src/api/ksecrets/ksecretscollection_p.h
@@ -41,7 +41,6 @@ class CollectionPrivate {
const WId& promptParentId() const;
void setStatus(Collection::Status);
bool lock();
- static QList<CollectionPtr> listCollections();
bool deleteCollection();
bool renameCollection(const QString&);
QList<SecretItemPtr> searchItems(const AttributesMap&);
diff --git a/src/api/ksecrets/ksecretsservice.cpp b/src/api/ksecrets/ksecretsservice.cpp
index 5c3218f..d319121 100644
--- a/src/api/ksecrets/ksecretsservice.cpp
+++ b/src/api/ksecrets/ksecretsservice.cpp
@@ -26,17 +26,26 @@
#include <QtConcurrent/QtConcurrent>
namespace KSecrets {
+
typedef QSharedPointer<Collection> CollectionPtr;
+
CollectionPtr ServicePrivate::findCollection(const QString& collName,
Service::FindCollectionOptions opts,
const QVariantMap& collProps,
QWidget* promptParent)
{
+
// TODO
return CollectionPtr(new Collection, &QObject::deleteLater);
}
+QList<CollectionPtr> ServicePrivate::listCollections()
+{
+ // TODO
+ return QList<CollectionPtr>();
+}
+
Service::~Service()
{
}
@@ -49,5 +58,10 @@ QFuture<CollectionPtr> Service::findCollection(const QString& \
collectionName, Fi options, collectionProperties, promptParent);
}
+QFuture<QList<CollectionPtr> > Service::listCollections()
+{
+ return QtConcurrent::run(&ServicePrivate::listCollections);
+}
+
#include "ksecretsservice.moc"
} // namespace
diff --git a/src/api/ksecrets/ksecretsservice.h b/src/api/ksecrets/ksecretsservice.h
index a1be890..1f6bdb7 100644
--- a/src/api/ksecrets/ksecretsservice.h
+++ b/src/api/ksecrets/ksecretsservice.h
@@ -40,34 +40,38 @@ class ServicePrivate;
*
* We encourage you to first read the Free Desktop draft about
* <a href="http://standards.freedesktop.org/secret-service/">Secret Service</a>
- *
- *
*/
class KSECRETS_EXPORT Service : public QObject {
- Q_OBJECT
- Q_DISABLE_COPY(Service)
- public:
- virtual ~Service();
+ Q_OBJECT
+ Q_DISABLE_COPY(Service)
+public:
+ virtual ~Service();
+
+ /**
+ * Options used when findCollection method is called
+ */
+ enum FindCollectionOptions {
+ OpenOnly = 0, /// this will only try to open the collection without
+ /// creating it if not found
+ CreateCollection = 1, /// the collection will be created if not found
+ LookIntoKWallet = 2 /// Specify this if your application was ported from KWallet to \
KSecrets + };
- /**
- * Options used when findCollection method is called
- */
- enum FindCollectionOptions {
- OpenOnly = 0, /// this will only try to open the collection without
- /// creating it if not found
- CreateCollection = 1, /// the collection will be created if not found
- LookIntoKWallet = 2 /// Specify this if your application was ported from KWallet to \
KSecrets
- };
+ /**
+ */
+ static QFuture<CollectionPtr> findCollection(const QString& collectionName,
+ FindCollectionOptions options = CreateCollection,
+ const QVariantMap& collectionProperties = QVariantMap(),
+ QWidget* promptParent = 0);
- /**
- */
- static QFuture<CollectionPtr> findCollection(const QString& collectionName,
- FindCollectionOptions options = CreateCollection,
- const QVariantMap& collectionProperties = QVariantMap(),
- QWidget* promptParent = 0);
+ /**
+ * Use this method to find out the names of all known secret service
+ * collections on the running system
+ */
+ static QFuture<QList<CollectionPtr> > listCollections();
- private:
- QSharedPointer<ServicePrivate> d;
+private:
+ QSharedPointer<ServicePrivate> d;
};
} // namespace
diff --git a/src/api/ksecrets/ksecretsservice_p.h b/src/api/ksecrets/ksecretsservice_p.h
index 799796a..79b1404 100644
--- a/src/api/ksecrets/ksecretsservice_p.h
+++ b/src/api/ksecrets/ksecretsservice_p.h
@@ -35,6 +35,7 @@ class ServicePrivate {
const QVariantMap& collProps,
QWidget* promptParent);
+ static QList<CollectionPtr> listCollections();
Service* service;
};
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic