[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [ksecretservice] client: SecretItem properties are now accessed
From: Valentin Rusu <kde () rusu ! info>
Date: 2011-08-01 0:04:38
Message-ID: 20110801000438.D80F9A60A6 () git ! kde ! org
[Download RAW message or body]
Git commit 0542b3c3297939a3bd9085ef0d235dc18f24a24f by Valentin Rusu.
Committed on 01/08/2011 at 02:03.
Pushed by vrusu into branch 'master'.
SecretItem properties are now accessed asynchronously
M +16 -14 client/ksecretsserviceitem.cpp
M +12 -12 client/ksecretscollectionjobs.h
M +6 -6 client/ksecretscollectionjobs_p.h
M +25 -0 client/ksecretsserviceitemjobs_p.h
M +72 -0 client/ksecretsserviceitemjobs.cpp
M +13 -13 client/ksecretsservicecollection.cpp
M +17 -14 client/ksecretsserviceitem.h
M +15 -15 client/ksecretsservicecollection.h
M +15 -15 client/ksecretscollectionjobs.cpp
M +32 -0 client/ksecretsserviceitemjobs.h
M +5 -3 client/tests/ksecretsservice-test.cpp
http://commits.kde.org/ksecretservice/0542b3c3297939a3bd9085ef0d235dc18f24a24f
diff --git a/client/ksecretscollectionjobs.cpp b/client/ksecretscollectionjobs.cpp
index 8b2a831..8555b4c 100644
--- a/client/ksecretscollectionjobs.cpp
+++ b/client/ksecretscollectionjobs.cpp
@@ -639,27 +639,27 @@ QList< SecretItemPrivate > ReadItemsJobPrivate::readItems() const
return result;
}
-ReadPropertyJob::ReadPropertyJob( Collection *coll, const char *propName, QObject *parent ) :
+ReadCollectionPropertyJob::ReadCollectionPropertyJob( Collection *coll, const char *propName, QObject \
*parent ) : CollectionJob( coll, parent ),
- d( new ReadPropertyJobPrivate( coll->d.data(), this ) ),
+ d( new ReadCollectionPropertyJobPrivate( coll->d.data(), this ) ),
propertyReadMember(0)
{
d->propertyName = propName;
}
-ReadPropertyJob::ReadPropertyJob( Collection *coll, void (Collection::*propReadMember)( ReadPropertyJob* \
), QObject *parent ) : +ReadCollectionPropertyJob::ReadCollectionPropertyJob( Collection *coll, void \
(Collection::*propReadMember)( ReadCollectionPropertyJob* ), QObject *parent ) : CollectionJob( coll, \
parent ),
- d( new ReadPropertyJobPrivate( coll->d.data(), this ) ),
+ d( new ReadCollectionPropertyJobPrivate( coll->d.data(), this ) ),
propertyReadMember( propReadMember )
{
}
-void ReadPropertyJob::start()
+void ReadCollectionPropertyJob::start()
{
startFindCollection(); // this will trigger onFindCollectionFinished
}
-void ReadPropertyJob::onFindCollectionFinished()
+void ReadCollectionPropertyJob::onFindCollectionFinished()
{
if ( propertyReadMember ) {
(collection()->*propertyReadMember)( this );
@@ -670,49 +670,49 @@ void ReadPropertyJob::onFindCollectionFinished()
}
}
-const QVariant& ReadPropertyJob::propertyValue() const
+const QVariant& ReadCollectionPropertyJob::propertyValue() const
{
return d->value;
}
-ReadPropertyJobPrivate::ReadPropertyJobPrivate( CollectionPrivate *cp, ReadPropertyJob *job ) :
+ReadCollectionPropertyJobPrivate::ReadCollectionPropertyJobPrivate( CollectionPrivate *cp, \
ReadCollectionPropertyJob *job ) : collectionPrivate( cp ),
readPropertyJob( job )
{
}
-void ReadPropertyJobPrivate::startReadingProperty()
+void ReadCollectionPropertyJobPrivate::startReadingProperty()
{
value = collectionPrivate->collectionInterface()->property( propertyName );
readPropertyJob->finishedOk();
}
-WritePropertyJob::WritePropertyJob( Collection *coll, const char *propName, const QVariant& value, \
QObject *parent ) : +WriteCollectionPropertyJob::WriteCollectionPropertyJob( Collection *coll, const char \
*propName, const QVariant& value, QObject *parent ) : CollectionJob( coll, parent ),
- d( new WritePropertyJobPrivate( coll->d.data(), this ) )
+ d( new WriteCollectionPropertyJobPrivate( coll->d.data(), this ) )
{
d->propertyName = propName;
d->value = value;
}
-void WritePropertyJob::start()
+void WriteCollectionPropertyJob::start()
{
startFindCollection(); // this will trigger onFindCollectionFinished
}
-void WritePropertyJob::onFindCollectionFinished()
+void WriteCollectionPropertyJob::onFindCollectionFinished()
{
d->startWritingProperty();
}
-WritePropertyJobPrivate::WritePropertyJobPrivate( CollectionPrivate *cp, WritePropertyJob *job ) :
+WriteCollectionPropertyJobPrivate::WriteCollectionPropertyJobPrivate( CollectionPrivate *cp, \
WriteCollectionPropertyJob *job ) : collectionPrivate( cp ),
writePropertyJob( job )
{
}
-void WritePropertyJobPrivate::startWritingProperty()
+void WriteCollectionPropertyJobPrivate::startWritingProperty()
{
value = collectionPrivate->collectionInterface()->setProperty( propertyName, value );
writePropertyJob->finishedOk();
diff --git a/client/ksecretscollectionjobs.h b/client/ksecretscollectionjobs.h
index f0d89f8..1a9fc5b 100644
--- a/client/ksecretscollectionjobs.h
+++ b/client/ksecretscollectionjobs.h
@@ -35,8 +35,8 @@ class SearchItemsJobPrivate;
class CreateItemJobPrivate;
class SearchSecretsJobPrivate;
class ReadItemsJobPrivate;
-class ReadPropertyJobPrivate;
-class WritePropertyJobPrivate;
+class ReadCollectionPropertyJobPrivate;
+class WriteCollectionPropertyJobPrivate;
namespace KSecretsService {
@@ -201,9 +201,9 @@ private:
QSharedPointer< ReadItemsJobPrivate > d;
};
-class ReadPropertyJob : public CollectionJob {
- explicit ReadPropertyJob( Collection *collection, const char *propName, QObject *parent =0 );
- explicit ReadPropertyJob( Collection *collection, void (Collection::*propReadMember)( \
ReadPropertyJob* ), QObject *parent =0 ); +class ReadCollectionPropertyJob : public CollectionJob {
+ explicit ReadCollectionPropertyJob( Collection *collection, const char *propName, QObject *parent =0 \
); + explicit ReadCollectionPropertyJob( Collection *collection, void (Collection::*propReadMember)( \
ReadCollectionPropertyJob* ), QObject *parent =0 ); friend class Collection; // only Collection class \
can instantiated us public:
@@ -212,21 +212,21 @@ public:
const QVariant& propertyValue() const;
private:
- friend class ::ReadPropertyJobPrivate;
- QSharedPointer< ReadPropertyJobPrivate > d;
- void (Collection::*propertyReadMember)( ReadPropertyJob* );
+ friend class ::ReadCollectionPropertyJobPrivate;
+ QSharedPointer< ReadCollectionPropertyJobPrivate > d;
+ void (Collection::*propertyReadMember)( ReadCollectionPropertyJob* );
};
-class WritePropertyJob : public CollectionJob {
+class WriteCollectionPropertyJob : public CollectionJob {
public:
- explicit WritePropertyJob( Collection *collection, const char *propName, const QVariant& value, \
QObject *parent =0 ); + explicit WriteCollectionPropertyJob( Collection *collection, const char \
*propName, const QVariant& value, QObject *parent =0 );
virtual void start();
virtual void onFindCollectionFinished();
private:
- friend class ::WritePropertyJobPrivate;
- QSharedPointer< WritePropertyJobPrivate > d;
+ friend class ::WriteCollectionPropertyJobPrivate;
+ QSharedPointer< WriteCollectionPropertyJobPrivate > d;
};
diff --git a/client/ksecretscollectionjobs_p.h b/client/ksecretscollectionjobs_p.h
index b40e1b7..9d69490 100644
--- a/client/ksecretscollectionjobs_p.h
+++ b/client/ksecretscollectionjobs_p.h
@@ -181,26 +181,26 @@ public:
CollectionPrivate *collectionPrivate;
};
-class ReadPropertyJobPrivate : public QObject {
+class ReadCollectionPropertyJobPrivate : public QObject {
public:
- explicit ReadPropertyJobPrivate( CollectionPrivate* cp, ReadPropertyJob* );
+ explicit ReadCollectionPropertyJobPrivate( CollectionPrivate* cp, ReadCollectionPropertyJob* );
void startReadingProperty();
CollectionPrivate *collectionPrivate;
- ReadPropertyJob *readPropertyJob;
+ ReadCollectionPropertyJob *readPropertyJob;
const char *propertyName;
QVariant value;
};
-class WritePropertyJobPrivate : public QObject {
+class WriteCollectionPropertyJobPrivate : public QObject {
public:
- explicit WritePropertyJobPrivate( CollectionPrivate *cp, WritePropertyJob* );
+ explicit WriteCollectionPropertyJobPrivate( CollectionPrivate *cp, WriteCollectionPropertyJob* );
void startWritingProperty();
CollectionPrivate *collectionPrivate;
- WritePropertyJob *writePropertyJob;
+ WriteCollectionPropertyJob *writePropertyJob;
const char *propertyName;
QVariant value;
};
diff --git a/client/ksecretsservicecollection.cpp b/client/ksecretsservicecollection.cpp
index 6f06d54..52ee60e 100644
--- a/client/ksecretsservicecollection.cpp
+++ b/client/ksecretsservicecollection.cpp
@@ -87,29 +87,29 @@ ReadItemsJob* Collection::items() const
return new ReadItemsJob( const_cast< Collection* >(this) );
}
-ReadPropertyJob* Collection::isLocked() const
+ReadCollectionPropertyJob* Collection::isLocked() const
{
- return new ReadPropertyJob( const_cast< Collection* >(this), "Locked" );
+ return new ReadCollectionPropertyJob( const_cast< Collection* >(this), "Locked" );
}
-ReadPropertyJob* Collection::label() const
+ReadCollectionPropertyJob* Collection::label() const
{
- return new ReadPropertyJob( const_cast< Collection* >(this), "Label" );
+ return new ReadCollectionPropertyJob( const_cast< Collection* >(this), "Label" );
}
-ReadPropertyJob* Collection::createdTime() const
+ReadCollectionPropertyJob* Collection::createdTime() const
{
- return new ReadPropertyJob( const_cast< Collection* >(this), "Created" );
+ return new ReadCollectionPropertyJob( const_cast< Collection* >(this), "Created" );
}
-ReadPropertyJob* Collection::modifiedTime() const
+ReadCollectionPropertyJob* Collection::modifiedTime() const
{
- return new ReadPropertyJob( const_cast< Collection* >(this), "Modified" );
+ return new ReadCollectionPropertyJob( const_cast< Collection* >(this), "Modified" );
}
-WritePropertyJob* Collection::setLabel(const QString& label)
+WriteCollectionPropertyJob* Collection::setLabel(const QString& label)
{
- return new WritePropertyJob( this, "Label", QVariant( label ) );
+ return new WriteCollectionPropertyJob( this, "Label", QVariant( label ) );
}
@@ -174,12 +174,12 @@ OrgFreedesktopSecretCollectionInterface *CollectionPrivate::collectionInterface(
return collectionIf;
}
-ReadPropertyJob* Collection::isValid()
+ReadCollectionPropertyJob* Collection::isValid()
{
- return new ReadPropertyJob( this, &Collection::readIsValid, this );
+ return new ReadCollectionPropertyJob( this, &Collection::readIsValid, this );
}
-void Collection::readIsValid( ReadPropertyJob *readPropertyJob)
+void Collection::readIsValid( ReadCollectionPropertyJob *readPropertyJob)
{
readPropertyJob->d->value = d->isValid();
}
diff --git a/client/ksecretsservicecollection.h b/client/ksecretsservicecollection.h
index fe28009..22ce6a8 100644
--- a/client/ksecretsservicecollection.h
+++ b/client/ksecretsservicecollection.h
@@ -40,8 +40,8 @@ class CreateItemJob;
class SearchSecretsJob;
class SearchItemsJob;
class ReadItemsJob;
-class ReadPropertyJob;
-class WritePropertyJob;
+class ReadCollectionPropertyJob;
+class WriteCollectionPropertyJob;
class Collection : public QObject {
Q_OBJECT
@@ -131,37 +131,37 @@ public:
/**
* Retrieve the lock status of this collection
- * @Note returned ReadPropertyJob::propertyValue is boolean
+ * @Note returned ReadCollectionPropertyJob::propertyValue is boolean
*/
- ReadPropertyJob* isLocked() const;
+ ReadCollectionPropertyJob* isLocked() const;
/**
* Retrieve this collection's label
- * @Note returned ReadPropertyJob::propertyValue is QString
+ * @Note returned ReadCollectionPropertyJob::propertyValue is QString
*/
- ReadPropertyJob* label() const;
+ ReadCollectionPropertyJob* label() const;
/**
* Get the creation timestamps of this collection
- * @Note returned ReadPropertyJob::propertyValue is a time_t
+ * @Note returned ReadCollectionPropertyJob::propertyValue is a time_t
*/
- ReadPropertyJob* createdTime() const;
+ ReadCollectionPropertyJob* createdTime() const;
/**
* Get the last modified timestamp of this collection
- * @Note returned ReadPropertyJob::propertyValue is a time_t
+ * @Note returned ReadCollectionPropertyJob::propertyValue is a time_t
*/
- ReadPropertyJob* modifiedTime() const;
+ ReadCollectionPropertyJob* modifiedTime() const;
/**
* Change this collection's label
*/
- WritePropertyJob* setLabel( const QString &label );
+ WriteCollectionPropertyJob* setLabel( const QString &label );
/**
* @return true if the collection was actually found or created into the KSecretsService \
infrastructure
*/
- ReadPropertyJob* isValid();
+ ReadCollectionPropertyJob* isValid();
Q_SIGNALS:
void itemCreated( const SecretItem& );
@@ -182,10 +182,10 @@ private:
friend class SearchSecretsJob;
friend class SearchItemsJob;
friend class ReadItemsJob;
- friend class ReadPropertyJob;
- friend class WritePropertyJob;
+ friend class ReadCollectionPropertyJob;
+ friend class WriteCollectionPropertyJob;
- void readIsValid( ReadPropertyJob* );
+ void readIsValid( ReadCollectionPropertyJob* );
QSharedPointer< CollectionPrivate > d;
};
diff --git a/client/ksecretsserviceitem.cpp b/client/ksecretsserviceitem.cpp
index 154e722..a6a916b 100644
--- a/client/ksecretsserviceitem.cpp
+++ b/client/ksecretsserviceitem.cpp
@@ -60,39 +60,41 @@ SetSecretItemSecretJob* SecretItem::setSecret(const Secret& secret)
return new SetSecretItemSecretJob( this, secret );
}
-QStringStringMap SecretItem::attributes() const
+ReadItemPropertyJob * SecretItem::attributes() const
{
- return d->itemIf->attributes();
+ return new ReadItemPropertyJob( const_cast<SecretItem*>(this), "Attributes" );
}
-void SecretItem::setAttributes(const QMap< QString, QString >& attributes)
+WriteItemPropertyJob * SecretItem::setAttributes(const QMap< QString, QString >& attributes)
{
- d->itemIf->setAttributes( attributes );
+ QVariant value;
+ value.setValue<QMap<QString, QString > >(attributes);
+ return new WriteItemPropertyJob( const_cast<SecretItem*>(this), "Attributes", value );
}
-bool SecretItem::isLocked() const
+ReadItemPropertyJob * SecretItem::isLocked() const
{
- return d->itemIf->locked();
+ return new ReadItemPropertyJob( const_cast<SecretItem*>(this), "Locked" );
}
-QString SecretItem::label() const
+ReadItemPropertyJob * SecretItem::label() const
{
- return d->itemIf->label();
+ return new ReadItemPropertyJob( const_cast<SecretItem*>(this), "Label" );
}
-QDateTime SecretItem::createdTime() const
+ReadItemPropertyJob * SecretItem::createdTime() const
{
- return QDateTime::fromTime_t( d->itemIf->created() );
+ return new ReadItemPropertyJob( const_cast<SecretItem*>(this), "Created" );
}
-QDateTime SecretItem::modifiedTime() const
+ReadItemPropertyJob * SecretItem::modifiedTime() const
{
- return QDateTime::fromTime_t( d->itemIf->modified() );
+ return new ReadItemPropertyJob( const_cast<SecretItem*>(this), "Modified" );
}
-void SecretItem::setLabel(const QString& label)
+WriteItemPropertyJob * SecretItem::setLabel(const QString& label)
{
- d->itemIf->setLabel( label );
+ return new WriteItemPropertyJob( this, "Label", QVariant( label ) );
}
SecretItemPrivate::SecretItemPrivate() :
diff --git a/client/ksecretsserviceitem.h b/client/ksecretsserviceitem.h
index d6684a1..34ff6e0 100644
--- a/client/ksecretsserviceitem.h
+++ b/client/ksecretsserviceitem.h
@@ -35,6 +35,8 @@ typedef QMap< QString, QString > QStringStringMap;
class GetSecretItemSecretJob;
class SetSecretItemSecretJob;
class SecretItemDeleteJob;
+class ReadItemPropertyJob;
+class WriteItemPropertyJob;
/**
* KSecretsService aims to let application store sensitive pieces of information as SecretItem(s).
@@ -65,46 +67,47 @@ public:
SetSecretItemSecretJob* setSecret( const Secret &secret );
/**
- * FIXME: This methods accesses a dbus property. should it be asynchronous ?
+ * @note returned ReadItemPropertyJob::value is a QMap< QString, QString>
*/
- QMap< QString, QString> attributes() const;
+ ReadItemPropertyJob * attributes() const;
/**
- * FIXME: This methods accesses a dbus property. should it be asynchronous ?
* @param attributes a map containing the new attributes; it must contain at least one attribute, \
under the name "Label"
*/
- void setAttributes( const QMap< QString, QString > &attributes );
+ WriteItemPropertyJob * setAttributes( const QMap< QString, QString > &attributes );
/**
- * FIXME: This methods accesses a dbus property. should it be asynchronous ?
+ * @note returned ReadItemPropertyJob::value is a bool
*/
- bool isLocked() const;
+ ReadItemPropertyJob * isLocked() const;
/**
- * FIXME: This methods accesses a dbus property. should it be asynchronous ?
+ * @note returned ReadItemPropertyJob::value is a QString
*/
- QString label() const;
+ ReadItemPropertyJob * label() const;
/**
- * FIXME: This methods accesses a dbus property. should it be asynchronous ?
+ * @note returned ReadItemPropertyJob::value is a time_t
*/
- QDateTime createdTime() const;
+ ReadItemPropertyJob * createdTime() const;
/**
- * FIXME: This methods accesses a dbus property. should it be asynchronous ?
+ * @note returned ReadItemPropertyJob::value is a time_t
*/
- QDateTime modifiedTime() const;
+ ReadItemPropertyJob * modifiedTime() const;
/**
- * FIXME: This methods accesses a dbus property. should it be asynchronous ?
+ * Sets the item's label
*/
- void setLabel( const QString &label );
+ WriteItemPropertyJob * setLabel( const QString &label );
private:
friend class SecretItemPrivate;
friend class GetSecretItemSecretJob;
friend class SetSecretItemSecretJob;
friend class SecretItemDeleteJob;
+ friend class ReadItemPropertyJob;
+ friend class WriteItemPropertyJob;
QSharedPointer< SecretItemPrivate > d;
};
diff --git a/client/ksecretsserviceitemjobs.cpp b/client/ksecretsserviceitemjobs.cpp
index 3f3c391..23f84cb 100644
--- a/client/ksecretsserviceitemjobs.cpp
+++ b/client/ksecretsserviceitemjobs.cpp
@@ -212,5 +212,77 @@ void SecretItemDeleteJobPrivate::deletePromptFinished( KJob* j)
}
}
+
+ReadItemPropertyJob::ReadItemPropertyJob( SecretItem *item, const char *propName ) :
+ SecretItemJob( item ),
+ d( new ReadItemPropertyJobPrivate( item->d.data(), this ) ),
+ propertyReadMember(0)
+{
+ d->propertyName = propName;
+}
+
+ReadItemPropertyJob::ReadItemPropertyJob( SecretItem *item, void (SecretItem::*propReadMember)( \
ReadItemPropertyJob* ) ) : + SecretItemJob( item ),
+ d( new ReadItemPropertyJobPrivate( item->d.data(), this ) ),
+ propertyReadMember( propReadMember )
+{
+}
+
+void ReadItemPropertyJob::start()
+{
+ if ( propertyReadMember ) {
+ (secretItem->*propertyReadMember)( this );
+ finished( NoError );
+ }
+ else {
+ d->startReadingProperty();
+ }
+}
+
+const QVariant& ReadItemPropertyJob::propertyValue() const
+{
+ return d->value;
+}
+
+ReadItemPropertyJobPrivate::ReadItemPropertyJobPrivate( SecretItemPrivate *it, ReadItemPropertyJob *job \
) : + itemPrivate( it ),
+ readPropertyJob( job )
+{
+}
+
+void ReadItemPropertyJobPrivate::startReadingProperty()
+{
+ value = itemPrivate->itemIf->property( propertyName );
+ readPropertyJob->finished( SecretItemJob::NoError );
+}
+
+
+WriteItemPropertyJob::WriteItemPropertyJob( SecretItem *item, const char *propName, const QVariant& \
value ) : + SecretItemJob( item ),
+ d( new WriteItemPropertyJobPrivate( item->d.data(), this ) )
+{
+ d->propertyName = propName;
+ d->value = value;
+}
+
+void WriteItemPropertyJob::start()
+{
+ d->startWritingProperty();
+}
+
+WriteItemPropertyJobPrivate::WriteItemPropertyJobPrivate( SecretItemPrivate *cp, WriteItemPropertyJob \
*job ) : + itemPrivate( cp ),
+ writePropertyJob( job )
+{
+}
+
+void WriteItemPropertyJobPrivate::startWritingProperty()
+{
+ value = itemPrivate->itemIf->setProperty( propertyName, value );
+ writePropertyJob->finished( SecretItemJob::NoError );
+}
+
+
+
#include "ksecretsserviceitemjobs.moc"
#include "ksecretsserviceitemjobs_p.moc"
diff --git a/client/ksecretsserviceitemjobs.h b/client/ksecretsserviceitemjobs.h
index 3306671..a78efaa 100644
--- a/client/ksecretsserviceitemjobs.h
+++ b/client/ksecretsserviceitemjobs.h
@@ -30,6 +30,8 @@
class GetSecretItemSecretJobPrivate;
class SetSecretItemSecretJobPrivate;
class SecretItemDeleteJobPrivate;
+class ReadItemPropertyJobPrivate;
+class WriteItemPropertyJobPrivate;
namespace KSecretsService {
@@ -99,6 +101,36 @@ private:
QSharedPointer< SecretItemDeleteJobPrivate > d;
};
+class ReadItemPropertyJob : public SecretItemJob {
+ Q_OBJECT
+ Q_DISABLE_COPY(ReadItemPropertyJob)
+public:
+ ReadItemPropertyJob( SecretItem *, const char *propName);
+ ReadItemPropertyJob( SecretItem *, void (SecretItem::*propReadMember)( ReadItemPropertyJob * ) );
+
+ virtual void start();
+ const QVariant& propertyValue() const;
+
+private:
+ friend class ::ReadItemPropertyJobPrivate;
+ QSharedPointer<ReadItemPropertyJobPrivate> d;
+ void (SecretItem::*propertyReadMember)( ReadItemPropertyJob * );
+};
+
+class WriteItemPropertyJob : public SecretItemJob {
+ Q_OBJECT
+ Q_DISABLE_COPY(WriteItemPropertyJob)
+public:
+ explicit WriteItemPropertyJob(SecretItem* item, const char *propName, const QVariant &value);
+
+ virtual void start();
+
+private:
+ friend class ::WriteItemPropertyJobPrivate;
+ QSharedPointer<WriteItemPropertyJobPrivate> d;
+};
+
+
}; // namespace
#endif // KSECRETSSERVICEITEMJOBS_H
diff --git a/client/ksecretsserviceitemjobs_p.h b/client/ksecretsserviceitemjobs_p.h
index af2f8f8..896135b 100644
--- a/client/ksecretsserviceitemjobs_p.h
+++ b/client/ksecretsserviceitemjobs_p.h
@@ -90,4 +90,29 @@ public:
WId promptWinId;
};
+class ReadItemPropertyJobPrivate : public QObject {
+public:
+ explicit ReadItemPropertyJobPrivate( SecretItemPrivate*, ReadItemPropertyJob* );
+
+ void startReadingProperty();
+
+ SecretItemPrivate *itemPrivate;
+ ReadItemPropertyJob *readPropertyJob;
+ const char *propertyName;
+ QVariant value;
+};
+
+class WriteItemPropertyJobPrivate : public QObject {
+public:
+ explicit WriteItemPropertyJobPrivate( SecretItemPrivate*, WriteItemPropertyJob* );
+
+ void startWritingProperty();
+
+ SecretItemPrivate *itemPrivate;
+ WriteItemPropertyJob *writePropertyJob;
+ const char *propertyName;
+ QVariant value;
+};
+
+
#endif // KSECRETSSERVICEITEMJOBS_P_H
diff --git a/client/tests/ksecretsservice-test.cpp b/client/tests/ksecretsservice-test.cpp
index 24b48b3..e5a3075 100644
--- a/client/tests/ksecretsservice-test.cpp
+++ b/client/tests/ksecretsservice-test.cpp
@@ -64,7 +64,7 @@ void KSecretServiceTest::initTestCase()
void KSecretServiceTest::testCreateAndDelete()
{
Collection *createdColl = Collection::findCollection( 0, "test collection" );
- ReadPropertyJob *isValidJob = createdColl->isValid();
+ ReadCollectionPropertyJob *isValidJob = createdColl->isValid();
QVERIFY2( isValidJob->exec(), qPrintable( isValidJob->errorText() ) );
Collection *existingColl = Collection::findCollection( 0, "test collection", Collection::OpenOnly );
@@ -82,7 +82,7 @@ void KSecretServiceTest::testRenameCollection()
KJob *renameJob = coll->renameCollection( "test name2" );
renameJob->exec();
QVERIFY2( (renameJob->error() == 0), qPrintable( renameJob->errorText() ) );
- ReadPropertyJob *readLabelJob = coll->label();
+ ReadCollectionPropertyJob *readLabelJob = coll->label();
QVERIFY2( readLabelJob->exec(), qPrintable( readLabelJob->errorText() ) );
QVERIFY2( (readLabelJob->propertyValue() == "test name2"), "Collection won't change it's name!" );
@@ -162,7 +162,9 @@ void KSecretServiceTest::testItems()
QVERIFY2( createItemJob->exec(), qPrintable( createItemJob->errorText() ) );
SecretItem * createdItem = createItemJob->item();
- QVERIFY( createdItem->label() == "test label" );
+ ReadItemPropertyJob * readLabelJob = createdItem->label();
+ QVERIFY( readLabelJob->exec() );
+ QVERIFY( readLabelJob->propertyValue() == "test label" );
KSecretsService::GetSecretItemSecretJob *getSecretJob = createdItem->getSecret();
QVERIFY2( getSecretJob->exec(), qPrintable( getSecretJob->errorText() ) );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic