玉兔远程控制
0.1.0-bate11
Toggle main menu visibility
载入中...
搜索中...
未找到
Plugins
WebBrowser
PasswordStore.h
1
// Author: Kang Lin <kl222@126.com>
2
3
#pragma once
4
5
#include <QObject>
6
#include <QVariantMap>
7
#include "ParameterWebBrowser.h"
8
9
/*
10
CPasswordStore using QtKeychain.
11
12
Notes:
13
- Stores credentials in the system keychain using QtKeychain.
14
- Credentials are stored as a small JSON object under a single key per host:
15
{ "username": "...", "password": "..." }
16
- getCredentials() blocks briefly waiting for the keychain response (with a timeout).
17
This mirrors the previous synchronous QSettings behavior. In a production app you
18
may prefer asynchronous APIs or to move keychain access to a worker thread.
19
- Requires QtKeychain to be available and linked into the project.
20
*/
21
class
CPasswordStore :
public
QObject
22
{
23
Q_OBJECT
24
public
:
25
explicit
CPasswordStore(
CParameterWebBrowser
* pPara, QObject *parent =
nullptr
);
26
~CPasswordStore();
27
// From JS: returns { "username": "...", "password":"..." } or empty map
28
Q_INVOKABLE QVariantMap getCredentials(
const
QString &host);
29
// From JS: save credentials for host
30
Q_INVOKABLE
void
saveCredentials(
const
QString &host,
const
QString &username,
const
QString &password);
31
Q_SIGNALS:
32
void
credentialsSaved(
const
QString &host);
33
void
sigCredentialsReady(
const
QString &host,
const
QVariantMap& credentials);
34
private
:
35
CParameterWebBrowser
* m_pPara;
36
};
CParameterWebBrowser
定义
ParameterWebBrowser.h:12
作者:康林 (kl222@126.com)
版权所有(c) 康林工作室 保留所有权力