~ubuntu-branches/ubuntu/vivid/kdesudo/vivid

« back to all changes in this revision

Viewing changes to kdesudo/kdesudo.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Mercatante
  • Date: 2008-07-16 17:08:30 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20080716170830-bem298ajm207fua9
Tags: 3.2-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include <config.h>
26
26
#endif
27
27
 
28
 
#include <kapp.h>
29
28
#include <qwidget.h>
30
 
#include <kpassdlg.h>
31
29
#include <qstring.h>
32
30
#include <qtextcodec.h>
33
31
#include <kprocess.h>
34
 
class KCookie;
 
32
#include <kpassworddialog.h>
 
33
#include <knewpassworddialog.h>
35
34
 
 
35
#include "kcookie.h"
36
36
/*
37
37
* KdeSudo is the base class of the project
38
38
*
39
 
* It inherits KPasswordDialog and overrrides the
40
 
* slot slotOK()
41
 
*
42
 
* @author Robert Gruber <rgruber@users.sourceforge.net>
43
 
* @version 2.4
 
39
* @version 3.1
44
40
*/
45
41
 
46
 
class KdeSudo : public KPasswordDialog
47
 
{
 
42
/* buffer is used when reading from the KProcess child */
 
43
#define BUFSIZE 1024
 
44
 
 
45
class KdeSudo : QObject {
48
46
        Q_OBJECT 
49
47
        public:
50
 
        /*
51
 
        * Default construtor
52
 
        */
53
 
        KdeSudo(QWidget* parent=0, const char *name=0, const QString& icon=QString(), const QString& generic=QString(), bool withIgnoreButton=false);
 
48
                KdeSudo( const QString& icon = QString(),
 
49
                const QString& generic = QString()
 
50
        );
54
51
 
55
 
        /*
56
 
        * Default destructor
57
 
        */
58
52
        ~KdeSudo();
 
53
 
59
54
        enum ResultCodes { AsUser = 10 };
60
55
 
61
 
public slots: // Public slots
62
 
        /*
63
 
        * This slot gets exectuted if sudo creates some output
64
 
        */
65
 
        void receivedOut(KProcess*proc, char*buffer, int buflen);
66
 
        /*
67
 
        * This slot gets exectuted when sudo exits
68
 
        */
69
 
        void procExited(KProcess *proc);
70
 
        /*
71
 
        * This slot overrides the slot from KPasswordDialog
72
 
        * @see KPasswordDialog
73
 
        */
74
 
        void slotOk();
75
 
        void slotUser1();
76
 
        QString validArg(QString arg);
77
 
 
78
 
private: // Private attributes
79
 
        KProcess * p;
80
 
        bool bError;
81
 
        bool newDcop;
82
 
        bool keepPwd;
83
 
        bool emptyPwd;
84
 
        bool useTerm;
85
 
        bool noExec;
86
 
        bool unCleaned;
87
 
        QString m_tmpname;
88
 
        QString iceauthorityFile;
89
 
        QString dcopServer;
90
 
        KCookie* m_pCookie;
91
 
        void blockSigChild();
92
 
        void unblockSigChild();
 
56
        public slots:
 
57
 
 
58
                /*
 
59
                * This slot gets executed if sudo creates some output
 
60
                * -- well, in theory it should. Even though the code
 
61
                *  seems to be doing what the API says, it doesn't
 
62
                *  yet do what we need.
 
63
                */
 
64
                void parseOutput();
 
65
        
 
66
                /*
 
67
                * This slot gets exectuted when sudo exits
 
68
                */
 
69
                void procExited();
 
70
        
 
71
                /*
 
72
                * This slot overrides the slot from KPasswordDialog
 
73
                * @see KPasswordDialog
 
74
                */
 
75
                void pushPassword(const QString&);
 
76
                void slotUser1();
 
77
                QString validArg(QString arg);
 
78
 
 
79
        private:
 
80
                void error(const QString&);
 
81
                KProcess *p;
 
82
                bool bError;
 
83
                // bool newDcop; // deprecated
 
84
                bool keepPwd;
 
85
                bool emptyPwd;
 
86
                bool useTerm;
 
87
                bool noExec;
 
88
                bool unCleaned;
 
89
                QString m_tmpName;
 
90
                QString iceauthorityFile;
 
91
                KDESu::KDESuPrivate::KCookie* m_pCookie;
 
92
                void blockSigChild();
 
93
                void unblockSigChild();
 
94
 
 
95
                KPasswordDialog* m_dialog;
93
96
};
94
97
 
95
 
#endif
 
98
#endif // KDESUDO_H