summaryrefslogtreecommitdiffstats
path: root/kdesktop/lock/lockdlg.h
blob: 3f8500a42da3b4df7331b85b796704ae6a82a9fd (plain)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//===========================================================================
//
// This file is part of the TDE project
//
// Copyright (c) 1999 Martin R. Jones <mjones@kde.org>
// Copyright (c) 2003 Oswald Buddenhagen <ossi@kde.org>
// Copyright (c) 2010 - 2015 Timothy Pearson <kb9vqf@pearsoncomputing.net>
//

#ifndef __LOCKDLG_H__
#define __LOCKDLG_H__

#include <kgreeterplugin.h>

#include <tqdialog.h>
#include <tqstringlist.h>
#include <tqdatetime.h>

#include "lockprocess.h"

struct GreeterPluginHandle;
class LockProcess;
class TQFrame;
class TQGridLayout;
class TQLabel;
class KPushButton;
class TQListView;

//===========================================================================
//
// Simple dialog for entering a password.
// It does not handle password validation.
//
class PasswordDlg : public TQDialog, public KGreeterPluginHandler
{
	TQ_OBJECT

	public:
		PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin);
		PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin, TQDateTime lockStartDateTime);
		~PasswordDlg();
		void init(GreeterPluginHandle *plugin);
		virtual void show();
		
		// from KGreetPluginHandler
		virtual void gplugReturnText( const char *text, int tag );
		virtual void gplugReturnBinary( const char *data );
		virtual void gplugSetUser( const TQString & );
		virtual void gplugStart();
		virtual void gplugActivity();
		virtual void gplugMsgBox( TQMessageBox::Icon type, const TQString &text );

		virtual void attemptCardLogin();
		virtual void resetCardLogin();
	
	protected:
		virtual void timerEvent(TQTimerEvent *);
		virtual bool eventFilter(TQObject *, TQEvent *);
	
	private slots:
		void slotSwitchUser();
		void slotSessionActivated();
		void slotStartNewSession();
		void slotOK();
		void layoutClicked();
		void slotActivity();
	
	protected slots:
		virtual void reject();
	
	private:
		void setLayoutText( const TQString &txt );
		void capsLocked();
		void updateLabel();
		int Reader (void *buf, int count);
		bool GRead (void *buf, int count);
		bool GWrite (const void *buf, int count);
		bool GSendInt (int val);
		bool GSendStr (const char *buf);
		bool GSendArr (int len, const char *buf);
		bool GRecvInt (int *val);
		bool GRecvArr (char **buf);
		void handleVerify();
		void reapVerify();
		void cantCheck();
		GreeterPluginHandle *mPlugin;
		KGreeterPlugin *greet;
		TQFrame      *frame;
		TQGridLayout *frameLayout;
		TQLabel      *mStatusLabel;
		KPushButton *mNewSessButton, *ok, *cancel;
		TQPushButton *mLayoutButton;
		int         mFailedTimerId;
		int         mTimeoutTimerId;
		int         mCapsLocked;
		bool        mUnlockingFailed;
		bool        validUserCardInserted;
		bool        showInfoMessages;
		TQStringList layoutsList;
		TQStringList::iterator currLayout;
		int         sPid, sFd;
		TQListView   *lv;
		bool         mCardLoginInProgress;
		TQDateTime   m_lockStartDT;
};

#endif