summaryrefslogtreecommitdiffstats
path: root/pica-client/askpassword.h
blob: 6f331f55e80456c8666b1db67a1de85610b1a199 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
	(c) Copyright  2012 - 2018 Anton Sviridenko
	https://picapica.im

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, version 3.

	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.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef ASKPASSWORD_H
#define ASKPASSWORD_H

#include <QObject>
#include <QMap>
#include <QMutex>

class AskPassword : public QObject
{
	Q_OBJECT
public:
	explicit AskPassword(QObject *parent = 0);
	~AskPassword();
	static int ask_password_cb(char *buf, int size, int rwflag, void *userdata);
	static void setInvalidPassword();
	static void clear();

private:
	void emit_sig();
	static QMutex passwd_mutex;
	static char current_password[256];
	static int is_cancelled;
	static int is_invalid;
	static int is_set;

signals:
	void password_requested();

public slots:
	void password_dialog();
};

#endif // ASKPASSWORD_H