Context Class Reference
from PyKDE4.polkitqt import *
Inherits: QObject
Namespace: PolkitQt
Detailed Description
\class Context context.h Context
Convenience class for Qt/KDE applications
This class is a singleton that provides makes easy the usage of PolKitContext and PolKitTracker. It emits configChanged() whenever PolicyKit files change (e.g. the PolicyKit.conf or .policy files) or when ConsoleKit reports activities changes.
- Note:
- This class is a singleton, its constructor is private. Call Context.instance() to get an instance of the Context object. Do not delete Context.instance(), cleanup will be done automatically.
Signals | |
configChanged () | |
consoleKitDBChanged () | |
Methods | |
__init__ (self, PolkitQt.Context a0) | |
__init__ (self, PolKitContext context, QObject parent=0) | |
configChanged (self) | |
consoleKitDBChanged (self) | |
PolKitContext | getPolKitContext (self) |
PolKitTracker | getPolKitTracker (self) |
bool | hasError (self) |
QString | lastError (self) |
Static Methods | |
PolkitQt.Context | instance (PolKitContext context=0) |
Method Documentation
__init__ | ( | self, | ||
PolkitQt.Context | a0 | |||
) |
__init__ | ( | self, | ||
PolKitContext | context, | |||
QObject | parent=0 | |||
) |
configChanged | ( | self ) |
This signal will be emitted when a configuration file gets changed (e.g. /etc/PolicyKit/PolicyKit.conf or .policy files). Connect to this signal if you want to track down actions.
- Note:
- If you use Action you'll probably prefer to use the dataChanged() signal to track Actions changes.
- Signal syntax:
QObject.connect(source, SIGNAL("configChanged()"), target_slot)
consoleKitDBChanged | ( | self ) |
This signal is emitted when ConsoleKit configuration changes. This might happen when a session becomes active or inactive.
If you want to track your actions directly you should connect to this signal, as this might change the return value PolicyKit will give you.
- Note:
- If you use Action you'll probably prefer to use the dataChanged() signal to track Action changes.
- Signal syntax:
QObject.connect(source, SIGNAL("consoleKitDBChanged()"), target_slot)
PolKitContext getPolKitContext | ( | self ) |
Returns the current instance of PolKitContext. If you are handling it through Polkit-qt (which is quite likely, since you are calling this function), DO NOT use any PolicyKit API's specific method that modifies the instance on it, unless you're completely aware of what you're doing and of the possible consequencies. Use this instance only to gather information.
DEPRECATION WARNING: This function uses a type that will be removed in PolicyKit 1.0. Please don't use this function in your application unless strictly needed, or you will have to update it when polkit-qt 1.0 will come out
- Returns:
- the current PolKitContext instance
PolKitTracker getPolKitTracker | ( | self ) |
Returns the current instance of PolKitTracker. If you are handling it through Polkit-qt (which is quite likely, since you are calling this function), DO NOT use any PolicyKit API's specific method that modifies the instance on it, unless you're completely aware of what you're doing and of the possible consequencies. Use this instance only to gather information.
DEPRECATION WARNING: This function uses a type that will be removed in PolicyKit 1.0. Please don't use this function in your application unless strictly needed, or you will have to update it when polkit-qt 1.0 will come out
- Returns:
- the current PolKitTracker instance
bool hasError | ( | self ) |
You should always call this method first, since if an error is detected, the library will retry to initialize itself.
- Returns:
- true if the library is ready, false if an error occurred
PolkitQt.Context instance | ( | PolKitContext | context=0 | |
) |
Returns the instance of Context
Returns the current instance of Context. Call this function whenever you need to access the Context class.
- Note:
- Context is a singleton. Memory is handled by polkit-qt, so you just need to call this function to get a working instance of Context. Don't delete the object after having used it.
- Parameters:
-
context use this if you want to set an explicit PolKitContext. If you don't know what this implies, simply ignore the parameter. In case you want to use it, be sure of streaming it the first time you call this function, otherwise it will have no effect. DEPRECATION WARNING: This function uses a type that will be removed in PolicyKit 1.0. Please don't use this function in your application unless strictly needed, or you will have to update it when polkit-qt 1.0 will come out
- Returns:
- The current context instance
QString lastError | ( | self ) |
- Returns:
- the last error message