some more win32'fication to fix non-ascii filename handling
[kdelibs.git] / kdesu / stub.h
blob33e17b9b02a2607435ddba9e55d23539b9151c3a
1 /* vi: ts=8 sts=4 sw=4
3 * This file is part of the KDE project, module kdesu.
4 * Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
5 *
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.
9 */
11 #ifndef __Stub_h_Included__
12 #define __Stub_h_Included__
14 #include <QtCore/QByteRef>
15 #include <QtCore/QList>
17 #include "process.h"
19 #include <kdesu/kdesu_export.h>
21 namespace KDESu {
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
34 public:
35 StubProcess();
36 ~StubProcess();
38 /**
39 * Set the command.
41 void setCommand(const QByteArray &command);
43 /**
44 * Set the target user.
46 void setUser(const QByteArray &user);
48 /**
49 * Set to "X only mode": Sycoca is not built and kdeinit is not launched.
51 void setXOnly(bool xonly);
53 /**
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);
60 /**
61 * Different schedulers. SchedNormal is the normal Unix timesharing
62 * scheduler, while SchedRealtime is a POSIX.1b realtime scheduler.
64 enum Scheduler { SchedNormal, SchedRealtime };
66 /**
67 * Set the scheduler type.
69 void setScheduler(int sched);
71 protected:
73 /**
74 * Exchange all parameters with kdesu_stub.
76 int ConverseStub(int check);
78 /**
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();
83 #ifdef Q_WS_X11
84 /**
85 * See display.
87 virtual QByteArray displayAuth();
88 #endif
89 bool m_bXOnly;
90 int m_Priority;
91 int m_Scheduler;
92 QByteArray m_Command;
93 QByteArray m_User;
94 KDESuPrivate::KCookie *m_pCookie;
96 private:
97 QByteArray commaSeparatedList(const QList<QByteArray> &);
99 protected:
100 virtual void virtual_hook( int id, void* data );
101 private:
102 class StubProcessPrivate;
103 StubProcessPrivate * const d;
108 #endif // __Stub_h_Included__