summaryrefslogtreecommitdiffstats
path: root/kdesudo/kdesudo.h
blob: 0c5904711f85511ca9fff55b927b374b8dc0d4de (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
/***************************************************************************
                          kdesudo.cpp  -  description
                             -------------------
    begin                : Sam Feb 15 15:42:12 CET 2003
    copyright            : (C) 2003 by Robert Gruber <rgruber@users.sourceforge.net>
                           (C) 2007 by Martin Böhm <martin.bohm@kubuntu.org>
                                       Anthony Mercatante <tonio@kubuntu.org>
                                       Canonical Ltd (Jonathan Riddell <jriddell@ubuntu.com>)

 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KDESUDO_H
#define KDESUDO_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <kapp.h>
#include <qwidget.h>
#include <kpassdlg.h>
#include <qstring.h>
#include <qtextcodec.h>
#include <kprocess.h>
class KCookie;

/*
* KdeSudo is the base class of the project
*
* It inherits KPasswordDialog and overrrides the
* slot slotOK()
*
* @author Robert Gruber <rgruber@users.sourceforge.net>
* @version 2.4
*/

class KdeSudo : public KPasswordDialog
{
	Q_OBJECT 
	public:
	/*
	* Default construtor
	*/
	KdeSudo(QWidget* parent=0, const char *name=0, const QString& icon=QString(), const QString& generic=QString(), bool withIgnoreButton=false);

	/*
	* Default destructor
	*/
	~KdeSudo();
	enum ResultCodes { AsUser = 10 };

public slots: // Public slots
	/*
	* This slot gets exectuted if sudo creates some output
	*/
	void receivedOut(KProcess*proc, char*buffer, int buflen);
	/*
	* This slot gets exectuted when sudo exits
	*/
	void procExited(KProcess *proc);
	/*
	* This slot overrides the slot from KPasswordDialog
	* @see KPasswordDialog
	*/
	void slotOk();
	void slotUser1();
	QString validArg(QString arg);

private: // Private attributes
	KProcess * p;
	bool bError;
	bool newDcop;
	bool keepPwd;
	bool emptyPwd;
	bool useTerm;
	bool noExec;
	bool unCleaned;
	QString m_tmpname;
	QString iceauthorityFile;
	QString dcopServer;
	QString kdeSycoca;
	KCookie* m_pCookie;
	void blockSigChild();
	void unblockSigChild();
};

#endif