2011-10-27 16:15:46 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* Copyright (C) 2011 Frank Osterfeld <frank.osterfeld@gmail.com> *
|
|
|
|
* *
|
|
|
|
* 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. For licensing and distribution *
|
|
|
|
* details, check the accompanying file 'COPYING'. *
|
|
|
|
*****************************************************************************/
|
2011-10-27 16:14:37 +00:00
|
|
|
#ifndef KEYCHAIN_P_H
|
|
|
|
#define KEYCHAIN_P_H
|
|
|
|
|
2011-10-27 16:15:46 +00:00
|
|
|
#include <QCoreApplication>
|
2012-04-05 14:16:22 +00:00
|
|
|
#include <QObject>
|
2011-12-09 19:47:11 +00:00
|
|
|
#include <QPointer>
|
|
|
|
#include <QSettings>
|
2011-10-27 16:15:46 +00:00
|
|
|
|
2012-05-07 16:21:22 +00:00
|
|
|
#if defined (Q_OS_UNIX) && (!defined(Q_WS_DARWIN))
|
|
|
|
|
|
|
|
#include <QDBusPendingCallWatcher>
|
|
|
|
|
|
|
|
#include "kwallet_interface.h"
|
|
|
|
#endif
|
|
|
|
|
2011-10-27 16:14:37 +00:00
|
|
|
#include "keychain.h"
|
|
|
|
|
2011-10-27 19:17:54 +00:00
|
|
|
namespace QKeychain {
|
2012-04-05 14:16:22 +00:00
|
|
|
|
|
|
|
class Job::Private : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
Private( const QString& service_ )
|
|
|
|
: error( NoError )
|
|
|
|
, service( service_ )
|
|
|
|
, autoDelete( true ) {}
|
|
|
|
|
|
|
|
QKeychain::Error error;
|
|
|
|
QString errorString;
|
|
|
|
QString service;
|
|
|
|
bool autoDelete;
|
|
|
|
QPointer<QSettings> settings;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ReadPasswordJob::Private : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2012-05-08 08:47:38 +00:00
|
|
|
explicit Private( ReadPasswordJob* qq ) : q( qq ), walletHandle( 0 ), dataType( Text ) {}
|
2012-04-05 14:16:22 +00:00
|
|
|
void doStart();
|
|
|
|
ReadPasswordJob* const q;
|
|
|
|
QByteArray data;
|
|
|
|
QString key;
|
2012-05-08 08:47:38 +00:00
|
|
|
int walletHandle;
|
|
|
|
enum DataType {
|
|
|
|
Binary,
|
|
|
|
Text
|
|
|
|
};
|
|
|
|
DataType dataType;
|
|
|
|
|
|
|
|
#if defined (Q_OS_UNIX) && (!defined(Q_WS_DARWIN))
|
|
|
|
org::kde::KWallet* iface;
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void kwalletOpenFinished( QDBusPendingCallWatcher* watcher );
|
|
|
|
void kwalletEntryTypeFinished( QDBusPendingCallWatcher* watcher );
|
|
|
|
void kwalletReadFinished( QDBusPendingCallWatcher* watcher );
|
|
|
|
#endif
|
|
|
|
|
2012-04-05 14:16:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class WritePasswordJob::Private : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit Private( WritePasswordJob* qq ) : q( qq ), mode( Delete ) {}
|
|
|
|
void doStart();
|
|
|
|
enum Mode {
|
|
|
|
Delete,
|
|
|
|
Text,
|
|
|
|
Binary
|
|
|
|
};
|
|
|
|
WritePasswordJob* const q;
|
|
|
|
Mode mode;
|
|
|
|
QString key;
|
|
|
|
QByteArray binaryData;
|
|
|
|
QString textData;
|
2012-05-07 16:21:22 +00:00
|
|
|
|
|
|
|
#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
|
2012-04-05 14:16:22 +00:00
|
|
|
};
|
|
|
|
|
2012-05-07 14:56:52 +00:00
|
|
|
class DeletePasswordJob::Private : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit Private( DeletePasswordJob* qq ) : q( qq ) {}
|
|
|
|
void doStart();
|
|
|
|
DeletePasswordJob* const q;
|
|
|
|
QString key;
|
|
|
|
private Q_SLOTS:
|
|
|
|
void jobFinished( QKeychain::Job* );
|
|
|
|
};
|
|
|
|
|
2011-10-27 19:17:54 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 16:14:37 +00:00
|
|
|
#endif // KEYCHAIN_P_H
|