KAuth::HelperSupport

KAuth::HelperSupport Namespace Reference

Functions

KAUTHCORE_EXPORT int callerUid ()
 
void helperDebugHandler (QtMsgType type, const QMessageLogContext &context, const QString &msgStr)
 
KAUTHCORE_EXPORT int helperMain (int argc, char **argv, const char *id, QObject *responder)
 
KAUTHCORE_EXPORT bool isStopped ()
 
KAUTHCORE_EXPORT void progressStep (int step)
 
KAUTHCORE_EXPORT void progressStep (const QVariantMap &data)
 

Detailed Description

Support class with some KAUTHCORE_EXPORT methods useful to the helper's code.

This class provides the API to write the helper tool that executes your actions. You don't create instances of HelperSupport. Instead, you use its KAUTHCORE_EXPORT methods.

This them you can notify the application of progress in your action's execution and you can check if the application asked you to terminate it.

Since
4.4

Function Documentation

int KAuth::HelperSupport::callerUid ( )

Obtains the caller user id if available.

This method offers a way to obtain the unprivileged client's UID if possible. For example when a DBus-based backend is used this will resolve the caller of the DBus method and obtain its process' UID.

Since
5.74
Returns
caller UID or -1 when not available

Definition at line 161 of file kauthhelpersupport.cpp.

int KAuth::HelperSupport::helperMain ( int  argc,
char **  argv,
const char *  id,
QObject responder 
)

Method that implements the main function of the helper tool.

Do not call directly

This method is called in the proper way by the code generated by the KAUTH_HELPER_MAIN(), which creates a main() function for the helper tool. macro. You shouldn't call this method directly.

Parameters
argcThe argc parameter from the main() function.
argvThe argv parameter from the main() function.
idThe helper ID as passed to the macro
responderThe responder object for the helper. The macro passes a default-constructed, heap-allocated object of the class specified as the last macro parameter

Definition at line 69 of file kauthhelpersupport.cpp.

bool KAuth::HelperSupport::isStopped ( )

Check if the caller asked the helper to stop the execution.

This method will return true if the helper has been asked to stop the execution of the current action. If this happens, your helper should return (NOT exit). The meaning of the data you return in this case is application-dependent.

It's good practice to check it regularly if you have a long-running action

See also
ExecuteJob::kill
Returns
true if the helper has been asked to stop, false otherwise

Definition at line 156 of file kauthhelpersupport.cpp.

void KAuth::HelperSupport::progressStep ( int  step)

Send a progressStep signal to the caller application.

You can use this method to notify progress information about the action execution. When you call this method, the KAuth::ExecuteJob object associated with the current action will emit the KJob::percent(KJob*, unsigned long) signal. The meaning of the integer passed here is totally application dependent, but you'll want to use it as a sort of percentage. If you need to be more expressive, use the other overload which takes a QVariantMap

Parameters
stepThe progress indicator

Definition at line 146 of file kauthhelpersupport.cpp.

void KAuth::HelperSupport::progressStep ( const QVariantMap &  data)

Send a progressStep signal to the caller application.

You can use this method to notify progress information about the action execution. When you call this method, the KAuth::ExecuteJob object associated with the current action will emit the progressStep(QVariantMap) signal. The meaning of the data passed here is totally application dependent.

If you only need a simple percentage value, use the other overload which takes an int.

Parameters
dataThe progress data

Definition at line 151 of file kauthhelpersupport.cpp.

This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Sep 23 2021 22:52:48 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.