[Pkg-owncloud-commits] [qtkeychain] 32/115: Start DBus-based KWAllet backend
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sat Mar 15 19:25:43 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository qtkeychain.
commit 9993e3293aa224b6968eb9917cfa56b4eb3cc17b
Author: Frank Osterfeld <frank.osterfeld at kdab.com>
Date: Mon May 7 18:21:22 2012 +0200
Start DBus-based KWAllet backend
---
CMakeLists.txt | 11 ++-
keychain_dbus.cpp | 42 +++++++-
keychain_p.h | 15 +++
org.kde.KWallet.xml | 276 ++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 341 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 711655c..472110b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,8 +4,13 @@ project(qtkeychain)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake/Modules")
include(GNUInstallDirs)
-find_package(Qt4 COMPONENTS QtCore REQUIRED)
-include_directories(${QT_INCLUDES})
+if(UNIX AND NOT APPLE)
+ find_package(Qt4 COMPONENTS QtCore QtDBus REQUIRED)
+else()
+ find_package(Qt4 COMPONENTS QtCore REQUIRED)
+endif()
+
+include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
list(APPEND qtkeychain_LIBRARIES ${QT_QTCORE_LIBRARY})
set(qtkeychain_SOURCES
@@ -34,6 +39,8 @@ endif()
if(UNIX AND NOT APPLE)
list(APPEND qtkeychain_SOURCES keychain_dbus.cpp)
+ qt4_add_dbus_interface(qtkeychain_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/org.kde.KWallet.xml kwallet_interface KWalletInterface)
+ list(APPEND qtkeychain_LIBRARIES ${QT_QTDBUS_LIBRARY})
endif()
QT4_WRAP_CPP(qtkeychain_MOC_OUTFILES keychain.h keychain_p.h)
diff --git a/keychain_dbus.cpp b/keychain_dbus.cpp
index f5bef73..63e7b44 100644
--- a/keychain_dbus.cpp
+++ b/keychain_dbus.cpp
@@ -17,5 +17,45 @@ void ReadPasswordJob::Private::doStart() {
}
void WritePasswordJob::Private::doStart() {
- q->emitFinishedWithError( NotImplemented, QString() );
+ iface = new org::kde::KWallet( QLatin1String("org.kde.kwalletd"), QLatin1String("/modules/kwalletd"), QDBusConnection::sessionBus(), this );
+ const QDBusPendingReply<int> reply = iface->open( QLatin1String("kdewallet"), 0, q->service() );
+ QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher( reply, this );
+ connect( watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(kwalletOpenFinished(QDBusPendingCallWatcher*)) );
+ //q->emitFinishedWithError( NotImplemented, QString() );
+}
+
+void WritePasswordJob::Private::kwalletOpenFinished( QDBusPendingCallWatcher* watcher ) {
+ watcher->deleteLater();
+ QDBusPendingReply<int> reply = *watcher;
+ if ( reply.isError() ) {
+ const QDBusError err = reply.error();
+ q->emitFinishedWithError( OtherError, tr("Could not open wallet: %1; %2").arg( QDBusError::errorString( err.type() ), err.message() ) );
+ return;
+ }
+
+ const int handle = reply.value();
+
+ QDBusPendingReply<int> nextReply;
+
+ if ( !textData.isEmpty() )
+ nextReply = iface->writePassword( handle, q->service(), key, textData, q->service() );
+ else if ( !binaryData.isEmpty() )
+ nextReply = iface->writeEntry( handle, q->service(), key, binaryData, q->service() );
+ else
+ nextReply = iface->removeEntry( handle, q->service(), key, q->service() );
+
+ QDBusPendingCallWatcher* nextWatcher = new QDBusPendingCallWatcher( nextReply, this );
+ connect( nextWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(kwalletWriteFinished(QDBusPendingCallWatcher*)) );
+}
+
+void WritePasswordJob::Private::kwalletWriteFinished( QDBusPendingCallWatcher* watcher ) {
+ watcher->deleteLater();
+ QDBusPendingReply<int> reply = *watcher;
+ if ( reply.isError() ) {
+ const QDBusError err = reply.error();
+ q->emitFinishedWithError( OtherError, tr("Could not open wallet: %1; %2").arg( QDBusError::errorString( err.type() ), err.message() ) );
+ return;
+ }
+
+ q->emitFinished();
}
diff --git a/keychain_p.h b/keychain_p.h
index a7ae1cb..7b0ad0b 100644
--- a/keychain_p.h
+++ b/keychain_p.h
@@ -14,6 +14,13 @@
#include <QPointer>
#include <QSettings>
+#if defined (Q_OS_UNIX) && (!defined(Q_WS_DARWIN))
+
+#include <QDBusPendingCallWatcher>
+
+#include "kwallet_interface.h"
+#endif
+
#include "keychain.h"
namespace QKeychain {
@@ -58,6 +65,14 @@ public:
QString key;
QByteArray binaryData;
QString textData;
+
+#if defined (Q_OS_UNIX) && (!defined(Q_WS_DARWIN))
+ org::kde::KWallet* iface;
+
+private Q_SLOTS:
+ void kwalletOpenFinished( QDBusPendingCallWatcher* watcher );
+ void kwalletWriteFinished( QDBusPendingCallWatcher* watcher );
+#endif
};
class DeletePasswordJob::Private : public QObject {
diff --git a/org.kde.KWallet.xml b/org.kde.KWallet.xml
new file mode 100644
index 0000000..548c2f8
--- /dev/null
+++ b/org.kde.KWallet.xml
@@ -0,0 +1,276 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.kde.KWallet">
+ <signal name="walletListDirty">
+ </signal>
+ <signal name="walletCreated">
+ <arg name="wallet" type="s" direction="out"/>
+ </signal>
+ <signal name="walletOpened">
+ <arg name="wallet" type="s" direction="out"/>
+ </signal>
+ <signal name="walletAsyncOpened">
+ <arg name="tId" type="i" direction="out"/>
+ <arg name="handle" type="i" direction="out"/>
+ </signal>
+ <signal name="walletDeleted">
+ <arg name="wallet" type="s" direction="out"/>
+ </signal>
+ <signal name="walletClosed">
+ <arg name="wallet" type="s" direction="out"/>
+ </signal>
+ <signal name="walletClosed">
+ <arg name="handle" type="i" direction="out"/>
+ </signal>
+ <signal name="allWalletsClosed">
+ </signal>
+ <signal name="folderListUpdated">
+ <arg name="wallet" type="s" direction="out"/>
+ </signal>
+ <signal name="folderUpdated">
+ <arg type="s" direction="out"/>
+ <arg type="s" direction="out"/>
+ </signal>
+ <signal name="applicationDisconnected">
+ <arg name="wallet" type="s" direction="out"/>
+ <arg name="application" type="s" direction="out"/>
+ </signal>
+ <method name="isEnabled">
+ <arg type="b" direction="out"/>
+ </method>
+ <method name="open">
+ <arg type="i" direction="out"/>
+ <arg name="wallet" type="s" direction="in"/>
+ <arg name="wId" type="x" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="openPath">
+ <arg type="i" direction="out"/>
+ <arg name="path" type="s" direction="in"/>
+ <arg name="wId" type="x" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="openAsync">
+ <arg type="i" direction="out"/>
+ <arg name="wallet" type="s" direction="in"/>
+ <arg name="wId" type="x" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ <arg name="handleSession" type="b" direction="in"/>
+ </method>
+ <method name="openPathAsync">
+ <arg type="i" direction="out"/>
+ <arg name="path" type="s" direction="in"/>
+ <arg name="wId" type="x" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ <arg name="handleSession" type="b" direction="in"/>
+ </method>
+ <method name="close">
+ <arg type="i" direction="out"/>
+ <arg name="wallet" type="s" direction="in"/>
+ <arg name="force" type="b" direction="in"/>
+ </method>
+ <method name="close">
+ <arg type="i" direction="out"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="force" type="b" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="sync">
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ <annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
+ </method>
+ <method name="deleteWallet">
+ <arg type="i" direction="out"/>
+ <arg name="wallet" type="s" direction="in"/>
+ </method>
+ <method name="isOpen">
+ <arg type="b" direction="out"/>
+ <arg name="wallet" type="s" direction="in"/>
+ </method>
+ <method name="isOpen">
+ <arg type="b" direction="out"/>
+ <arg name="handle" type="i" direction="in"/>
+ </method>
+ <method name="users">
+ <arg type="as" direction="out"/>
+ <arg name="wallet" type="s" direction="in"/>
+ </method>
+ <method name="changePassword">
+ <arg name="wallet" type="s" direction="in"/>
+ <arg name="wId" type="x" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="wallets">
+ <arg type="as" direction="out"/>
+ </method>
+ <method name="folderList">
+ <arg type="as" direction="out"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="hasFolder">
+ <arg type="b" direction="out"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="createFolder">
+ <arg type="b" direction="out"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="removeFolder">
+ <arg type="b" direction="out"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="entryList">
+ <arg type="as" direction="out"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="readEntry">
+ <arg type="ay" direction="out"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="key" type="s" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="readMap">
+ <arg type="ay" direction="out"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="key" type="s" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="readPassword">
+ <arg type="s" direction="out"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="key" type="s" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="readEntryList">
+ <arg type="a{sv}" direction="out"/>
+ <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="key" type="s" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="readMapList">
+ <arg type="a{sv}" direction="out"/>
+ <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="key" type="s" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="readPasswordList">
+ <arg type="a{sv}" direction="out"/>
+ <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="key" type="s" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="renameEntry">
+ <arg type="i" direction="out"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="oldName" type="s" direction="in"/>
+ <arg name="newName" type="s" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="writeEntry">
+ <arg type="i" direction="out"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="key" type="s" direction="in"/>
+ <arg name="value" type="ay" direction="in"/>
+ <arg name="entryType" type="i" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="writeEntry">
+ <arg type="i" direction="out"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="key" type="s" direction="in"/>
+ <arg name="value" type="ay" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="writeMap">
+ <arg type="i" direction="out"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="key" type="s" direction="in"/>
+ <arg name="value" type="ay" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="writePassword">
+ <arg type="i" direction="out"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="key" type="s" direction="in"/>
+ <arg name="value" type="s" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="hasEntry">
+ <arg type="b" direction="out"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="key" type="s" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="entryType">
+ <arg type="i" direction="out"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="key" type="s" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="removeEntry">
+ <arg type="i" direction="out"/>
+ <arg name="handle" type="i" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="key" type="s" direction="in"/>
+ <arg name="appid" type="s" direction="in"/>
+ </method>
+ <method name="disconnectApplication">
+ <arg type="b" direction="out"/>
+ <arg name="wallet" type="s" direction="in"/>
+ <arg name="application" type="s" direction="in"/>
+ </method>
+ <method name="reconfigure">
+ </method>
+ <method name="folderDoesNotExist">
+ <arg type="b" direction="out"/>
+ <arg name="wallet" type="s" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ </method>
+ <method name="keyDoesNotExist">
+ <arg type="b" direction="out"/>
+ <arg name="wallet" type="s" direction="in"/>
+ <arg name="folder" type="s" direction="in"/>
+ <arg name="key" type="s" direction="in"/>
+ </method>
+ <method name="closeAllWallets">
+ </method>
+ <method name="networkWallet">
+ <arg type="s" direction="out"/>
+ </method>
+ <method name="localWallet">
+ <arg type="s" direction="out"/>
+ </method>
+ <method name="pamOpen">
+ <arg name="wallet" type="s" direction="in"/>
+ <arg name="passwordHash" type="ay" direction="in"/>
+ <arg name="sessionTimeout" type="i" direction="in"/>
+ <annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
+ </method>
+ </interface>
+</node>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/qtkeychain.git
More information about the Pkg-owncloud-commits
mailing list