3 * This file is part of the KDE project, module kdesu.
4 * Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
6 * This is free software; you can use this library under the GNU Library
7 * General Public License, version 2. See the file "COPYING.LIB" for the
8 * exact licensing terms.
11 #ifndef __Stub_h_Included__
12 #define __Stub_h_Included__
14 #include <QtCore/QByteRef>
15 #include <QtCore/QList>
19 #include <kdesu/kdesu_export.h>
23 namespace KDESuPrivate
{ class KCookie
; }
26 /** \class StubProcess stub.h kdesu/stub.h
27 * Chat with kdesu_stub.
29 * StubProcess extends PtyProcess with functionality to chat with kdesu_stub.
32 class KDESU_EXPORT StubProcess
: public PtyProcess
41 void setCommand(const QByteArray
&command
);
44 * Set the target user.
46 void setUser(const QByteArray
&user
);
49 * Set to "X only mode": Sycoca is not built and kdeinit is not launched.
51 void setXOnly(bool xonly
);
54 * Set the priority of the process. The priority value must be between 0
55 * and 100, 0 being the lowest priority. This value is mapped to the
56 * scheduler and system dependant priority range of the OS.
58 void setPriority(int prio
);
61 * Different schedulers. SchedNormal is the normal Unix timesharing
62 * scheduler, while SchedRealtime is a POSIX.1b realtime scheduler.
64 enum Scheduler
{ SchedNormal
, SchedRealtime
};
67 * Set the scheduler type.
69 void setScheduler(int sched
);
74 * Exchange all parameters with kdesu_stub.
76 int ConverseStub(int check
);
79 * This virtual function can be overloaded when special behavior is
80 * desired. By default, it returns the value returned by KCookie.
82 virtual QByteArray
display();
87 virtual QByteArray
displayAuth();
94 KDESuPrivate::KCookie
*m_pCookie
;
97 QByteArray
commaSeparatedList(const QList
<QByteArray
> &);
100 virtual void virtual_hook( int id
, void* data
);
102 class StubProcessPrivate
;
103 StubProcessPrivate
* const d
;
108 #endif // __Stub_h_Included__