mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 10:22:49 +00:00
generic: adjust to KAuthorization changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
c8991662be
commit
1e2511421c
8 changed files with 62 additions and 41 deletions
|
@ -57,6 +57,34 @@ static QString findNtpUtility()
|
|||
return QString();
|
||||
}
|
||||
|
||||
ClockHelper::ClockHelper(const char* const helper, QObject *parent)
|
||||
: KAuthorization(helper, parent)
|
||||
{
|
||||
}
|
||||
|
||||
int ClockHelper::save(const QVariantMap &args)
|
||||
{
|
||||
bool _ntp = args.value("ntp").toBool();
|
||||
bool _date = args.value("date").toBool();
|
||||
bool _tz = args.value("tz").toBool();
|
||||
bool _tzreset = args.value("tzreset").toBool();
|
||||
|
||||
KComponentData data( "kcmdatetimehelper" );
|
||||
|
||||
int ret = NoError; // error code
|
||||
// The order here is important
|
||||
if( _ntp )
|
||||
ret |= ntp( args.value("ntpServers").toStringList(), args.value("ntpEnabled").toBool());
|
||||
if( _date )
|
||||
ret |= date( args.value("newdate").toString(), args.value("olddate").toString() );
|
||||
if( _tz )
|
||||
ret |= tz( args.value("tzone").toString() );
|
||||
if( _tzreset )
|
||||
ret |= tzreset();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ClockHelper::CH_Error ClockHelper::ntp( const QStringList& ntpServers, bool ntpEnabled )
|
||||
{
|
||||
// write to the system config file
|
||||
|
@ -142,27 +170,4 @@ ClockHelper::CH_Error ClockHelper::tzreset()
|
|||
return NoError;
|
||||
}
|
||||
|
||||
int ClockHelper::save(const QVariantMap &args)
|
||||
{
|
||||
bool _ntp = args.value("ntp").toBool();
|
||||
bool _date = args.value("date").toBool();
|
||||
bool _tz = args.value("tz").toBool();
|
||||
bool _tzreset = args.value("tzreset").toBool();
|
||||
|
||||
KComponentData data( "kcmdatetimehelper" );
|
||||
|
||||
int ret = NoError; // error code
|
||||
// The order here is important
|
||||
if( _ntp )
|
||||
ret |= ntp( args.value("ntpServers").toStringList(), args.value("ntpEnabled").toBool());
|
||||
if( _date )
|
||||
ret |= date( args.value("newdate").toString(), args.value("olddate").toString() );
|
||||
if( _tz )
|
||||
ret |= tz( args.value("tzone").toString() );
|
||||
if( _tzreset )
|
||||
ret |= tzreset();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
K_AUTH_MAIN("org.kde.kcontrol.kcmclock", ClockHelper)
|
||||
|
|
|
@ -27,23 +27,25 @@ class ClockHelper : public KAuthorization
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum CH_Error {
|
||||
NoError = 0,
|
||||
CallError = 1,
|
||||
TimezoneError = 2,
|
||||
NTPError = 4,
|
||||
DateError = 8
|
||||
};
|
||||
public:
|
||||
enum CH_Error {
|
||||
NoError = 0,
|
||||
CallError = 1,
|
||||
TimezoneError = 2,
|
||||
NTPError = 4,
|
||||
DateError = 8
|
||||
};
|
||||
|
||||
public slots:
|
||||
int save(const QVariantMap &map);
|
||||
ClockHelper(const char* const helper, QObject *parent = nullptr);
|
||||
|
||||
private:
|
||||
CH_Error ntp(const QStringList& ntpServers, bool ntpEnabled);
|
||||
CH_Error date(const QString& newdate, const QString& olddate);
|
||||
CH_Error tz(const QString& selectedzone);
|
||||
CH_Error tzreset();
|
||||
public slots:
|
||||
int save(const QVariantMap &map);
|
||||
|
||||
private:
|
||||
CH_Error ntp(const QStringList& ntpServers, bool ntpEnabled);
|
||||
CH_Error date(const QString& newdate, const QString& olddate);
|
||||
CH_Error tz(const QString& selectedzone);
|
||||
CH_Error tzreset();
|
||||
};
|
||||
|
||||
#endif // CLOCK_HELPER_H
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
|
||||
#include "config-workspace.h"
|
||||
|
||||
KGreeterHelper::KGreeterHelper(const char* const helper, QObject *parent)
|
||||
: KAuthorization(helper, parent)
|
||||
{
|
||||
}
|
||||
|
||||
int KGreeterHelper::save(const QVariantMap ¶meters)
|
||||
{
|
||||
if (!parameters.contains("font") || !parameters.contains("style")
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
class KGreeterHelper : public KAuthorization
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
KGreeterHelper(const char* const helper, QObject *parent = nullptr);
|
||||
public slots:
|
||||
int save(const QVariantMap ¶meters);
|
||||
};
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
#include "helper.h"
|
||||
#include "processes_local_p.h"
|
||||
|
||||
KSysGuardProcessListHelper::KSysGuardProcessListHelper()
|
||||
KSysGuardProcessListHelper::KSysGuardProcessListHelper(const char* const helper, QObject *parent)
|
||||
: KAuthorization(helper, parent)
|
||||
{
|
||||
qRegisterMetaType<QList<long long> >();
|
||||
}
|
||||
|
|
|
@ -28,8 +28,7 @@ class KSysGuardProcessListHelper : public KAuthorization
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
KSysGuardProcessListHelper();
|
||||
|
||||
KSysGuardProcessListHelper(const char* const helper, QObject *parent = nullptr);
|
||||
public Q_SLOTS:
|
||||
int renice(QVariantMap parameters);
|
||||
int changecpuscheduler(QVariantMap parameters);
|
||||
|
|
|
@ -30,6 +30,11 @@
|
|||
# include <errno.h>
|
||||
#endif
|
||||
|
||||
SolidUiServerHelper::SolidUiServerHelper(const char* const helper, QObject *parent)
|
||||
: KAuthorization(helper, parent)
|
||||
{
|
||||
}
|
||||
|
||||
int SolidUiServerHelper::cryptopen(const QVariantMap ¶meters)
|
||||
{
|
||||
if (!parameters.contains("device") || !parameters.contains("name") || !parameters.contains("password")) {
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
class SolidUiServerHelper : public KAuthorization
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SolidUiServerHelper(const char* const helper, QObject *parent = nullptr);
|
||||
public Q_SLOTS:
|
||||
int cryptopen(const QVariantMap ¶meters);
|
||||
int cryptclose(const QVariantMap ¶meters);
|
||||
|
|
Loading…
Add table
Reference in a new issue