mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
generic: adjust to authorization changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
27b1b53595
commit
1212fc79f7
40 changed files with 285 additions and 459 deletions
|
@ -36,7 +36,6 @@
|
|||
#include <KToggleAction>
|
||||
#include <KIO/NetAccess>
|
||||
#include <KToolInvocation>
|
||||
#include <kauthorized.h>
|
||||
#include <KMenu>
|
||||
#include <KInputDialog>
|
||||
#include <KProtocolInfo>
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include <kservice.h>
|
||||
#include <kaboutdata.h>
|
||||
#include <kpluginfactory.h>
|
||||
#include <kauthorized.h>
|
||||
|
||||
K_PLUGIN_FACTORY(KateKonsoleFactory, registerPlugin<KateKonsolePlugin>();)
|
||||
K_EXPORT_PLUGIN(KateKonsoleFactory(KAboutData("katekonsole","katekonsoleplugin",ki18n("Konsole"), "0.1", ki18n("Embedded Konsole"), KAboutData::License_LGPL_V2)) )
|
||||
|
|
|
@ -27,21 +27,17 @@
|
|||
#include <kiconloader.h>
|
||||
#include <ktexteditor/document.h>
|
||||
#include <ktexteditor/view.h>
|
||||
|
||||
#include <kparts/part.h>
|
||||
#include <kaction.h>
|
||||
#include <kactioncollection.h>
|
||||
|
||||
#include <kurl.h>
|
||||
#include <klocale.h>
|
||||
#include <kdebug.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <KToolInvocation>
|
||||
|
||||
#include <kpluginfactory.h>
|
||||
#include <kpluginloader.h>
|
||||
#include <kaboutdata.h>
|
||||
#include <kauthorized.h>
|
||||
|
||||
K_PLUGIN_FACTORY(KateMailFilesFactory, registerPlugin<KateMailFilesPlugin>();)
|
||||
K_EXPORT_PLUGIN(KateMailFilesFactory(KAboutData("katemailfilesplugin","katemailfilesplugin",ki18n("Mail Files"), "0.1", ki18n("Support mailing files"), KAboutData::License_LGPL_V2)) )
|
||||
|
|
|
@ -34,9 +34,7 @@
|
|||
#include <klineedit.h>
|
||||
#include <kinputdialog.h>
|
||||
#include <kprocess.h>
|
||||
|
||||
#include <kpluginfactory.h>
|
||||
#include <kauthorized.h>
|
||||
#include <kactioncollection.h>
|
||||
|
||||
#include <qapplication.h>
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
#include <KAboutData>
|
||||
#include <KApplication>
|
||||
#include <KAuthorized>
|
||||
#include <KCmdLineArgs>
|
||||
#include <KCModuleInfo>
|
||||
#include <KCMultiDialog>
|
||||
|
@ -65,8 +64,6 @@ static void listModules()
|
|||
it != services.end(); ++it)
|
||||
{
|
||||
const KService::Ptr s = (*it);
|
||||
if (!KAuthorized::authorizeControlModule(s->menuId()))
|
||||
continue;
|
||||
m_modules.append(s);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include <kconfig.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kauthhelpersupport.h>
|
||||
#include <QProcess>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
|
@ -159,7 +158,7 @@ ClockHelper::CH_Error ClockHelper::tzreset()
|
|||
return NoError;
|
||||
}
|
||||
|
||||
ActionReply ClockHelper::save(const QVariantMap &args)
|
||||
int ClockHelper::save(const QVariantMap &args)
|
||||
{
|
||||
bool _ntp = args.value("ntp").toBool();
|
||||
bool _date = args.value("date").toBool();
|
||||
|
@ -179,13 +178,7 @@ ActionReply ClockHelper::save(const QVariantMap &args)
|
|||
if( _tzreset )
|
||||
ret |= tzreset();
|
||||
|
||||
if (ret == NoError) {
|
||||
return ActionReply::SuccessReply;
|
||||
} else {
|
||||
ActionReply reply(ActionReply::HelperError);
|
||||
reply.setErrorCode(ret);
|
||||
return reply;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
KDE4_AUTH_HELPER_MAIN("org.kde.kcontrol.kcmclock", ClockHelper)
|
||||
K_AUTH_MAIN("org.kde.kcontrol.kcmclock", ClockHelper)
|
||||
|
|
|
@ -21,11 +21,9 @@
|
|||
#ifndef CLOCK_HELPER_H
|
||||
#define CLOCK_HELPER_H
|
||||
|
||||
#include <kauthactionreply.h>
|
||||
#include <kauthorization.h>
|
||||
|
||||
using namespace KAuth;
|
||||
|
||||
class ClockHelper : public QObject
|
||||
class ClockHelper : public KAuthorization
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -39,7 +37,7 @@ class ClockHelper : public QObject
|
|||
};
|
||||
|
||||
public slots:
|
||||
ActionReply save(const QVariantMap &map);
|
||||
int save(const QVariantMap &map);
|
||||
|
||||
private:
|
||||
CH_Error ntp(const QStringList& ntpServers, bool ntpEnabled);
|
||||
|
|
|
@ -32,14 +32,13 @@
|
|||
#include <kpluginloader.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kauthorization.h>
|
||||
|
||||
#include "moc_main.cpp"
|
||||
|
||||
#include "dtime.h"
|
||||
#include "helper.h"
|
||||
|
||||
#include <kauthaction.h>
|
||||
|
||||
K_PLUGIN_FACTORY(KlockModuleFactory, registerPlugin<KclockModule>();)
|
||||
K_EXPORT_PLUGIN(KlockModuleFactory("kcmkclock"))
|
||||
|
||||
|
@ -76,7 +75,11 @@ KclockModule::KclockModule(QWidget *parent, const QVariantList &)
|
|||
|
||||
setButtons(Help|Apply);
|
||||
|
||||
setNeedsAuthorization(true);
|
||||
|
||||
if (!KAuthorization::isAuthorized("org.kde.kcontrol.kcmclock")) {
|
||||
setUseRootOnlyMessage(true);
|
||||
setRootOnlyMessage(i18n("You are not allowed to save the configuration"));
|
||||
}
|
||||
}
|
||||
|
||||
void KclockModule::save()
|
||||
|
@ -86,19 +89,17 @@ void KclockModule::save()
|
|||
QVariantMap helperargs;
|
||||
dtime->save( helperargs );
|
||||
|
||||
Action *action = authAction();
|
||||
action->setArguments(helperargs);
|
||||
int reply = KAuthorization::execute(
|
||||
"org.kde.kcontrol.kcmclock", "save", helperargs
|
||||
);
|
||||
|
||||
ActionReply reply = action->execute();
|
||||
|
||||
if (reply.failed()) {
|
||||
if (reply.type() == ActionReply::KAuthError) {
|
||||
KMessageBox::error(this, i18n("Unable to authenticate/execute the action: %1, %2", reply.errorCode(), reply.errorDescription()));
|
||||
if (reply != KAuthorization::NoError) {
|
||||
if (reply < KAuthorization::NoError) {
|
||||
KMessageBox::error(this, i18n("Unable to authenticate/execute the action: %1", KAuthorization::errorString(reply)));
|
||||
} else {
|
||||
dtime->processHelperErrors(reply.errorCode());
|
||||
dtime->processHelperErrors(reply);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
QDBusMessage msg = QDBusMessage::createSignal("/org/kde/kcmshell_clock", "org.kde.kcmshell_clock", "clockUpdated");
|
||||
QDBusConnection::sessionBus().send(msg);
|
||||
}
|
||||
|
|
|
@ -26,8 +26,7 @@
|
|||
#include <QtCore/qdir.h>
|
||||
#include <QtCore/qcoreapplication.h>
|
||||
|
||||
#include <kauthaction.h>
|
||||
#include <kauthhelpersupport.h>
|
||||
#include <kauthorization.h>
|
||||
#include <KDebug>
|
||||
#include <kio/global.h>
|
||||
#include <kde_file.h>
|
||||
|
@ -947,24 +946,22 @@ bool FontInst::findFont(const QString &family, quint32 style, EFolder folder,
|
|||
|
||||
int FontInst::performAction(const QVariantMap &args)
|
||||
{
|
||||
KAuth::Action action("org.kde.fontinst.manage");
|
||||
|
||||
action.setHelperID("org.kde.fontinst");
|
||||
action.setArguments(args);
|
||||
KFI_DBUG << "Call " << args["method"].toString() << " on helper";
|
||||
itsFontListTimer->stop();
|
||||
itsConnectionsTimer->stop();
|
||||
KAuth::ActionReply reply = action.execute();
|
||||
int reply = KAuthorization::execute(
|
||||
"org.kde.fontinst", "manage", args
|
||||
);
|
||||
|
||||
switch(reply.type())
|
||||
switch(reply)
|
||||
{
|
||||
case KAuth::ActionReply::KAuthError:
|
||||
KFI_DBUG << "KAuth failed - error code:" << reply.errorCode();
|
||||
case KAuthorization::AuthorizationError:
|
||||
KFI_DBUG << "KAuth failed - error code:" << reply;
|
||||
return KIO::ERR_COULD_NOT_AUTHENTICATE;
|
||||
case KAuth::ActionReply::HelperError:
|
||||
KFI_DBUG << "Helper failed - error code:" << reply.errorCode();
|
||||
return (int)reply.errorCode();
|
||||
case KAuth::ActionReply::Success:
|
||||
case KAuthorization::HelperError:
|
||||
KFI_DBUG << "Helper failed - error code:" << reply;
|
||||
return reply;
|
||||
case KAuthorization::NoError:
|
||||
KFI_DBUG << "Success!";
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include <QtCore/qtextcodec.h>
|
||||
#include <QtCore/qcoreapplication.h>
|
||||
#include <kio/global.h>
|
||||
#include <kauthhelpersupport.h>
|
||||
#include <kde_file.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
@ -40,7 +39,7 @@
|
|||
|
||||
#define KFI_DBUG kDebug() << time(0L)
|
||||
|
||||
KDE4_AUTH_HELPER_MAIN("org.kde.fontinst", KFI::Helper)
|
||||
K_AUTH_MAIN("org.kde.fontinst", KFI::Helper)
|
||||
|
||||
namespace KFI
|
||||
{
|
||||
|
@ -109,7 +108,7 @@ Helper::~Helper()
|
|||
theFontFolder.saveDisabled();
|
||||
}
|
||||
|
||||
ActionReply Helper::manage(const QVariantMap &args)
|
||||
int Helper::manage(const QVariantMap &args)
|
||||
{
|
||||
int result=KIO::ERR_UNSUPPORTED_ACTION;
|
||||
QString method=args["method"].toString();
|
||||
|
@ -134,11 +133,9 @@ ActionReply Helper::manage(const QVariantMap &args)
|
|||
KFI_DBUG << "Uknown action";
|
||||
|
||||
if(FontInst::STATUS_OK==result)
|
||||
return ActionReply::SuccessReply;
|
||||
return KAuthorization::NoError;
|
||||
|
||||
ActionReply reply(ActionReply::HelperError);
|
||||
reply.setErrorCode(result);
|
||||
return reply;
|
||||
return result;
|
||||
}
|
||||
|
||||
int Helper::install(const QVariantMap &args)
|
||||
|
|
|
@ -24,29 +24,27 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QSet>
|
||||
#include <kauthactionreply.h>
|
||||
|
||||
using namespace KAuth;
|
||||
#include <kauthorization.h>
|
||||
|
||||
namespace KFI
|
||||
{
|
||||
|
||||
class Helper : public QObject
|
||||
class Helper : public KAuthorization
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
Helper();
|
||||
~Helper();
|
||||
|
||||
public Q_SLOTS:
|
||||
public Q_SLOTS:
|
||||
|
||||
ActionReply manage(const QVariantMap &args);
|
||||
int manage(const QVariantMap &args);
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
int install(const QVariantMap &args);
|
||||
int uninstall(const QVariantMap &args);
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
#include <KUrl>
|
||||
#include <KConfigGroup>
|
||||
|
||||
using namespace KAuth;
|
||||
|
||||
K_PLUGIN_FACTORY(WorkspaceOptionsModuleFactory, registerPlugin<WorkspaceOptionsModule>();)
|
||||
K_EXPORT_PLUGIN(WorkspaceOptionsModuleFactory("kcmworkspaceoptions"))
|
||||
|
||||
|
|
|
@ -24,12 +24,12 @@
|
|||
#include <kdebug.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <klocale.h>
|
||||
#include <kauthaction.h>
|
||||
#include <kimageio.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <kstyle.h>
|
||||
#include <kglobalsettings.h>
|
||||
#include <kauthorization.h>
|
||||
#include <kaboutdata.h>
|
||||
#include <kpluginfactory.h>
|
||||
#include <kpluginloader.h>
|
||||
|
@ -62,7 +62,10 @@ KCMGreeter::KCMGreeter(QWidget* parent, const QVariantList& args)
|
|||
about->addAuthor(ki18n("Ivailo Monev"), KLocalizedString(), "xakepa10@gmail.com");
|
||||
setAboutData(about);
|
||||
|
||||
setNeedsAuthorization(true);
|
||||
if (!KAuthorization::isAuthorized("org.kde.kcontrol.kcmkgreeter")) {
|
||||
setUseRootOnlyMessage(true);
|
||||
setRootOnlyMessage(i18n("You are not allowed to save the configuration"));
|
||||
}
|
||||
|
||||
load();
|
||||
|
||||
|
@ -146,19 +149,20 @@ void KCMGreeter::load()
|
|||
|
||||
void KCMGreeter::save()
|
||||
{
|
||||
KAuth::Action kgreeteraction("org.kde.kcontrol.kcmkgreeter.save");
|
||||
kgreeteraction.setHelperID("org.kde.kcontrol.kcmkgreeter");
|
||||
kgreeteraction.addArgument("font", fontchooser->font().toString());
|
||||
kgreeteraction.addArgument("style", stylesbox->itemData(stylesbox->currentIndex()).toString());
|
||||
kgreeteraction.addArgument("colorscheme", colorsbox->itemData(colorsbox->currentIndex()).toString());
|
||||
kgreeteraction.addArgument("cursortheme", cursorbox->itemData(cursorbox->currentIndex()).toString());
|
||||
kgreeteraction.addArgument("background", backgroundrequester->url().path());
|
||||
kgreeteraction.addArgument("rectangle", rectanglerequester->url().path());
|
||||
KAuth::ActionReply kgreeterreply = kgreeteraction.execute();
|
||||
// qDebug() << kgreeterreply.errorCode() << kgreeterreply.errorDescription();
|
||||
QVariantMap kgreeterarguments;
|
||||
kgreeterarguments.insert("font", fontchooser->font().toString());
|
||||
kgreeterarguments.insert("style", stylesbox->itemData(stylesbox->currentIndex()).toString());
|
||||
kgreeterarguments.insert("colorscheme", colorsbox->itemData(colorsbox->currentIndex()).toString());
|
||||
kgreeterarguments.insert("cursortheme", cursorbox->itemData(cursorbox->currentIndex()).toString());
|
||||
kgreeterarguments.insert("background", backgroundrequester->url().path());
|
||||
kgreeterarguments.insert("rectangle", rectanglerequester->url().path());
|
||||
int kgreeterreply = KAuthorization::execute(
|
||||
"org.kde.kcontrol.kcmkgreeter", "save", kgreeterarguments
|
||||
);
|
||||
// qDebug() << kgreeterreply;
|
||||
|
||||
if (kgreeterreply != KAuth::ActionReply::SuccessReply) {
|
||||
KMessageBox::error(this, kgreeterreply.errorDescription());
|
||||
if (kgreeterreply != KAuthorization::NoError) {
|
||||
KMessageBox::error(this, i18n("Could not save settings"));
|
||||
}
|
||||
|
||||
enableTest(true);
|
||||
|
|
|
@ -19,16 +19,16 @@
|
|||
#include "kgreeterhelper.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <kauthhelpersupport.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
#include "config-workspace.h"
|
||||
|
||||
ActionReply KGreeterHelper::save(const QVariantMap ¶meters)
|
||||
int KGreeterHelper::save(const QVariantMap ¶meters)
|
||||
{
|
||||
if (!parameters.contains("font") || !parameters.contains("style")
|
||||
|| !parameters.contains("colorscheme") || !parameters.contains("cursortheme")
|
||||
|| !parameters.contains("background") || !parameters.contains("rectangle")) {
|
||||
return KAuth::ActionReply::HelperErrorReply;
|
||||
return KAuthorization::HelperError;
|
||||
}
|
||||
|
||||
QString colorscheme = parameters.value("colorscheme").toString();
|
||||
|
@ -48,13 +48,11 @@ ActionReply KGreeterHelper::save(const QVariantMap ¶meters)
|
|||
kgreetersettings.setValue("greeter/background", parameters.value("background"));
|
||||
kgreetersettings.setValue("greeter/rectangle", parameters.value("rectangle"));
|
||||
if (kgreetersettings.status() != QSettings::NoError) {
|
||||
KAuth::ActionReply errorreply(KAuth::ActionReply::HelperError);
|
||||
errorreply.setErrorDescription("Could not save settings");
|
||||
errorreply.setErrorCode(1);
|
||||
return errorreply;
|
||||
kWarning() << "Could not save settings";
|
||||
return KAuthorization::HelperError;
|
||||
}
|
||||
|
||||
return KAuth::ActionReply::SuccessReply;
|
||||
return KAuthorization::NoError;
|
||||
}
|
||||
|
||||
KDE4_AUTH_HELPER_MAIN("org.kde.kcontrol.kcmkgreeter", KGreeterHelper)
|
||||
K_AUTH_MAIN("org.kde.kcontrol.kcmkgreeter", KGreeterHelper)
|
||||
|
|
|
@ -19,16 +19,13 @@
|
|||
#ifndef KGREETERHELPER_H
|
||||
#define KGREETERHELPER_H
|
||||
|
||||
#include <kauthactionreply.h>
|
||||
#include <kauthorization.h>
|
||||
|
||||
// methods return type must be ActionReply otherwise QMetaObject::invokeMethod() fails
|
||||
using namespace KAuth;
|
||||
|
||||
class KGreeterHelper : public QObject
|
||||
class KGreeterHelper : public KAuthorization
|
||||
{
|
||||
Q_OBJECT
|
||||
public slots:
|
||||
ActionReply save(const QVariantMap ¶meters);
|
||||
int save(const QVariantMap ¶meters);
|
||||
};
|
||||
|
||||
#endif // KGREETERHELPER_H
|
||||
|
|
|
@ -9,7 +9,6 @@ Actions=NewWindow;
|
|||
X-DocPath=konsole/index.html
|
||||
X-DBUS-StartupType=Multi
|
||||
X-KDE-StartupNotify=true
|
||||
X-KDE-AuthorizeAction=shell_access
|
||||
|
||||
Name=Konsole
|
||||
Name[af]=Konsole
|
||||
|
|
|
@ -3,7 +3,6 @@ Type=Service
|
|||
X-KDE-ServiceTypes=KonqPopupMenu/Plugin
|
||||
MimeType=inode/directory;
|
||||
Actions=openTerminalHere;
|
||||
X-KDE-AuthorizeAction=shell_access
|
||||
|
||||
[Desktop Action openTerminalHere]
|
||||
TryExec=konsole
|
||||
|
|
|
@ -10,8 +10,6 @@ X-KDE-BrowserView-Toggable=true
|
|||
X-KDE-BrowserView-ToggableView-Orientation=horizontal
|
||||
X-KDE-BrowserView-FollowActive=true
|
||||
|
||||
X-KDE-AuthorizeAction=shell_access
|
||||
|
||||
Name=Terminal Emulator
|
||||
Name[af]=Terminaal Emulasie
|
||||
Name[ar]=محاكي طرفية
|
||||
|
|
|
@ -3,7 +3,6 @@ Type=Service
|
|||
X-KDE-ServiceTypes=KonqPopupMenu/Plugin
|
||||
MimeType=application/x-executable;
|
||||
Actions=runInKonsole;
|
||||
X-KDE-AuthorizeAction=shell_access
|
||||
|
||||
[Desktop Action runInKonsole]
|
||||
TryExec=konsole
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <KAction>
|
||||
#include <KActionCollection>
|
||||
#include <KCrash>
|
||||
#include <KAuthorized>
|
||||
#include <KLocale>
|
||||
#include <KWindowSystem>
|
||||
|
||||
|
@ -128,12 +127,10 @@ void KRunnerApp::initialize()
|
|||
a->setGlobalShortcut(KShortcut(Qt::CTRL+Qt::Key_Escape));
|
||||
connect(a, SIGNAL(triggered(bool)), SLOT(showTaskManager()));
|
||||
|
||||
if (KAuthorized::authorize(QLatin1String("switch_user"))) {
|
||||
a = m_actionCollection->addAction(QLatin1String("Switch User"));
|
||||
a->setText(i18n("Switch User"));
|
||||
a->setGlobalShortcut(KShortcut(Qt::ALT+Qt::CTRL+Qt::Key_Insert));
|
||||
connect(a, SIGNAL(triggered(bool)), SLOT(switchUser()));
|
||||
}
|
||||
|
||||
//Setup the interface after we have set up the actions
|
||||
switch (KRunnerSettings::interface()) {
|
||||
|
|
|
@ -64,7 +64,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include <kaction.h>
|
||||
#include <kactioncollection.h>
|
||||
#include <kauthorized.h>
|
||||
#include <klocale.h>
|
||||
#include <kglobal.h>
|
||||
#include <kconfig.h>
|
||||
|
@ -1015,7 +1014,6 @@ void KSMServer::wmChanged()
|
|||
|
||||
void KSMServer::setupShortcuts()
|
||||
{
|
||||
if (KAuthorized::authorize("logout")) {
|
||||
KActionCollection* actionCollection = new KActionCollection(this);
|
||||
KAction* a;
|
||||
a = actionCollection->addAction("Log Out");
|
||||
|
@ -1037,7 +1035,6 @@ void KSMServer::setupShortcuts()
|
|||
a->setText(i18n("Reboot Without Confirmation"));
|
||||
a->setGlobalShortcut(KShortcut(Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_PageUp));
|
||||
connect(a, SIGNAL(triggered(bool)), SLOT(rebootWithoutConfirmation()));
|
||||
}
|
||||
}
|
||||
|
||||
void KSMServer::defaultLogout()
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include <kstandarddirs.h>
|
||||
#include <kconfig.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <kauthorized.h>
|
||||
#include <kmimetype.h>
|
||||
#include <kuser.h>
|
||||
#include <kde_file.h>
|
||||
|
@ -347,15 +346,6 @@ bool KShortUriFilter::filterUri( KUriFilterData& data ) const
|
|||
u.setRef(ref);
|
||||
u.setQuery(query);
|
||||
|
||||
if (!KAuthorized::authorizeUrlAction( QLatin1String("open"), KUrl(), u))
|
||||
{
|
||||
// No authorization, we pretend it's a file will get
|
||||
// an access denied error later on.
|
||||
setFilteredUri( data, u );
|
||||
setUriType( data, KUriFilterData::LocalFile );
|
||||
return true;
|
||||
}
|
||||
|
||||
// Can be abs path to file or directory, or to executable with args
|
||||
bool isDir = S_ISDIR( buff.st_mode );
|
||||
if( !isDir && access ( QFile::encodeName(path).data(), X_OK) == 0 )
|
||||
|
@ -477,14 +467,6 @@ bool KShortUriFilter::filterUri( KUriFilterData& data ) const
|
|||
u.setPath(path);
|
||||
u.setRef(ref);
|
||||
|
||||
if (!KAuthorized::authorizeUrlAction( QL1S("open"), KUrl(), u))
|
||||
{
|
||||
// No authorization, we pretend it exists and will get
|
||||
// an access denied error later on.
|
||||
setFilteredUri( data, u );
|
||||
setUriType( data, KUriFilterData::LocalFile );
|
||||
return true;
|
||||
}
|
||||
//kDebug(7023) << "fileNotFound -> ERROR";
|
||||
setErrorMsg( data, i18n( "<qt>The file or folder <b>%1</b> does not exist.</qt>", data.uri().prettyUrl() ) );
|
||||
setUriType( data, KUriFilterData::Error );
|
||||
|
|
|
@ -68,7 +68,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <QLabel>
|
||||
#include <QMenu>
|
||||
#include <QVBoxLayout>
|
||||
#include <kauthorized.h>
|
||||
#include <kactioncollection.h>
|
||||
#include <kaction.h>
|
||||
|
||||
|
@ -137,8 +136,6 @@ bool UserActionsMenu::isMenuClient(const Client *c) const
|
|||
|
||||
void UserActionsMenu::show(const QRect &pos, const QWeakPointer<Client> &cl)
|
||||
{
|
||||
if (!KAuthorized::authorizeKAction("kwin_rmb"))
|
||||
return;
|
||||
if (cl.isNull())
|
||||
return;
|
||||
if (isShown()) // recursion
|
||||
|
@ -215,9 +212,9 @@ QStringList configModules(bool controlCenter)
|
|||
{
|
||||
QStringList args;
|
||||
args << "kwindecoration";
|
||||
if (controlCenter)
|
||||
if (controlCenter) {
|
||||
args << "kwinoptions";
|
||||
else if (KAuthorized::authorizeControlModule("kde-kwinoptions.desktop"))
|
||||
} else {
|
||||
args << "kwinactions" << "kwinfocus" << "kwinmoving" << "kwinadvanced"
|
||||
<< "kwinrules" << "kwincompositing"
|
||||
#ifdef KWIN_BUILD_TABBOX
|
||||
|
@ -227,6 +224,7 @@ QStringList configModules(bool controlCenter)
|
|||
<< "kwinscreenedges"
|
||||
#endif
|
||||
;
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
|
@ -318,8 +316,7 @@ void UserActionsMenu::init()
|
|||
action = advancedMenu->addAction(i18n("S&pecial Application Settings..."));
|
||||
action->setIcon(KIcon("preferences-system-windows-actions"));
|
||||
action->setData(Options::ApplicationRulesOp);
|
||||
if (!KGlobal::config()->isImmutable() &&
|
||||
!KAuthorized::authorizeControlModules(configModules(true)).isEmpty()) {
|
||||
if (!KGlobal::config()->isImmutable()) {
|
||||
advancedMenu->addSeparator();
|
||||
action = advancedMenu->addAction(i18nc("Entry in context menu of window decoration to open the configuration module of KWin",
|
||||
"Window &Manager Settings..."));
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include <kstandarddirs.h>
|
||||
// For doDrop
|
||||
#include <kicon.h>
|
||||
#include <kauthorized.h>
|
||||
#include <kglobal.h>
|
||||
#include <kglobalsettings.h>
|
||||
#include <kdebug.h>
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include <kconfiggroup.h>
|
||||
#include <ksettings.h>
|
||||
#include <kdesktopfile.h>
|
||||
#include <kauthorized.h>
|
||||
#include <kglobal.h>
|
||||
#include <kacceleratormanager.h>
|
||||
|
||||
|
|
|
@ -23,19 +23,18 @@
|
|||
#include "helper.h"
|
||||
#include "processes_local_p.h"
|
||||
|
||||
#include <kauthhelpersupport.h>
|
||||
|
||||
KSysGuardProcessListHelper::KSysGuardProcessListHelper()
|
||||
{
|
||||
qRegisterMetaType<QList<long long> >();
|
||||
}
|
||||
|
||||
/* The functions here run as ROOT. So be careful. DO NOT TRUST THE INPUTS TO BE SANE. */
|
||||
#define GET_PID(i) parameters.value(QString("pid%1").arg(i), -1).toLongLong(); if(pid < 0) return KAuth::ActionReply::HelperErrorReply;
|
||||
#define GET_PID(i) parameters.value(QString("pid%1").arg(i), -1).toLongLong(); if(pid < 0) return KAuthorization::HelperError;
|
||||
|
||||
KAuth::ActionReply KSysGuardProcessListHelper::renice(QVariantMap parameters) {
|
||||
int KSysGuardProcessListHelper::renice(QVariantMap parameters)
|
||||
{
|
||||
if(!parameters.contains("nicevalue") || !parameters.contains("pidcount"))
|
||||
return KAuth::ActionReply::HelperErrorReply;
|
||||
return KAuthorization::HelperError;
|
||||
|
||||
KSysGuard::ProcessesLocal processes;
|
||||
int niceValue = parameters.value("nicevalue").toInt();
|
||||
|
@ -45,15 +44,17 @@ KAuth::ActionReply KSysGuardProcessListHelper::renice(QVariantMap parameters) {
|
|||
qlonglong pid = GET_PID(i);
|
||||
success = processes.setNiceness(pid, niceValue) && success;
|
||||
}
|
||||
if(success)
|
||||
return KAuth::ActionReply::SuccessReply;
|
||||
else
|
||||
return KAuth::ActionReply::HelperErrorReply;
|
||||
if (success) {
|
||||
return KAuthorization::NoError;
|
||||
}
|
||||
return KAuthorization::HelperError;
|
||||
}
|
||||
|
||||
KAuth::ActionReply KSysGuardProcessListHelper::changecpuscheduler(QVariantMap parameters) {
|
||||
if(!parameters.contains("cpuScheduler") || !parameters.contains("cpuSchedulerPriority") || !parameters.contains("pidcount"))
|
||||
return KAuth::ActionReply::HelperErrorReply;
|
||||
int KSysGuardProcessListHelper::changecpuscheduler(QVariantMap parameters)
|
||||
{
|
||||
if (!parameters.contains("cpuScheduler") || !parameters.contains("cpuSchedulerPriority") || !parameters.contains("pidcount")) {
|
||||
return KAuthorization::HelperError;
|
||||
}
|
||||
|
||||
KSysGuard::ProcessesLocal processes;
|
||||
int cpuScheduler = parameters.value("cpuScheduler").toInt();
|
||||
|
@ -65,11 +66,11 @@ KAuth::ActionReply KSysGuardProcessListHelper::changecpuscheduler(QVariantMap pa
|
|||
qlonglong pid = GET_PID(i);
|
||||
success = processes.setScheduler(pid, cpuScheduler, cpuSchedulerPriority) && success;
|
||||
}
|
||||
if(success)
|
||||
return KAuth::ActionReply::SuccessReply;
|
||||
else
|
||||
return KAuth::ActionReply::HelperErrorReply;
|
||||
if (success) {
|
||||
return KAuthorization::NoError;
|
||||
}
|
||||
return KAuthorization::HelperError;
|
||||
|
||||
}
|
||||
KDE4_AUTH_HELPER_MAIN("org.kde.ksysguard.processlisthelper", KSysGuardProcessListHelper)
|
||||
K_AUTH_MAIN("org.kde.ksysguard.processlisthelper", KSysGuardProcessListHelper)
|
||||
|
||||
|
|
|
@ -20,21 +20,19 @@
|
|||
|
||||
*/
|
||||
|
||||
#include <kauthactionreply.h>
|
||||
#include <QObject>
|
||||
|
||||
using namespace KAuth;
|
||||
#include <kauthorization.h>
|
||||
|
||||
/* The functions here run as ROOT. So be careful. */
|
||||
|
||||
class KSysGuardProcessListHelper : public QObject {
|
||||
class KSysGuardProcessListHelper : public KAuthorization
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
public:
|
||||
KSysGuardProcessListHelper();
|
||||
|
||||
public Q_SLOTS:
|
||||
ActionReply renice(QVariantMap parameters);
|
||||
ActionReply changecpuscheduler(QVariantMap parameters);
|
||||
public Q_SLOTS:
|
||||
int renice(QVariantMap parameters);
|
||||
int changecpuscheduler(QVariantMap parameters);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE( QList<long long> )
|
||||
|
|
|
@ -46,9 +46,7 @@
|
|||
|
||||
#include <signal.h> //For SIGTERM
|
||||
|
||||
#include <kauthaction.h>
|
||||
#include <kauthactionreply.h>
|
||||
#include <kauthhelpersupport.h>
|
||||
#include <kauthorization.h>
|
||||
#include <kaction.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
|
@ -187,9 +185,6 @@ struct KSysGuardProcessListPrivate {
|
|||
/** The number rows and their children for the given parent in the mFilterModel model */
|
||||
int totalRowCount(const QModelIndex &parent) const;
|
||||
|
||||
/** Helper function to setup 'action' with the given pids */
|
||||
void setupKAuthAction(KAuth::Action *action, const QList<long long> & pids) const;
|
||||
|
||||
/** fire a timer event if we are set to use our internal timer*/
|
||||
void fireTimerEvent();
|
||||
|
||||
|
@ -389,16 +384,6 @@ int KSysGuardProcessListPrivate::totalRowCount(const QModelIndex &parent ) const
|
|||
return total;
|
||||
}
|
||||
|
||||
void KSysGuardProcessListPrivate::setupKAuthAction(KAuth::Action *action, const QList<long long> & pids) const
|
||||
{
|
||||
action->setHelperID("org.kde.ksysguard.processlisthelper");
|
||||
|
||||
int processCount = pids.count();
|
||||
for(int i = 0; i < processCount; i++) {
|
||||
action->addArgument(QString("pid%1").arg(i), pids[i]);
|
||||
}
|
||||
action->addArgument("pidcount", processCount);
|
||||
}
|
||||
void KSysGuardProcessList::selectionChanged()
|
||||
{
|
||||
int numSelected = d->mUi->treeView->selectionModel()->selectedRows().size();
|
||||
|
@ -1010,18 +995,24 @@ bool KSysGuardProcessList::reniceProcesses(const QList<long long> &pids, int nic
|
|||
if(unreniced_pids.isEmpty()) return true; //All processes were reniced successfully
|
||||
if(!d->mModel.isLocalhost()) return false; //We can't use kauth to renice non-localhost processes
|
||||
|
||||
QVariantMap actionarguments;
|
||||
int processCount = unreniced_pids.count();
|
||||
for(int i = 0; i < processCount; i++) {
|
||||
actionarguments.insert(QString("pid%1").arg(i), unreniced_pids[i]);
|
||||
}
|
||||
actionarguments.insert("pidcount", processCount);
|
||||
actionarguments.insert("nicevalue", niceValue);
|
||||
int reply = KAuthorization::execute(
|
||||
"org.kde.ksysguard.processlisthelper", "renice", actionarguments
|
||||
);
|
||||
|
||||
KAuth::Action action("org.kde.ksysguard.processlisthelper.renice");
|
||||
action.setParentWidget(window());
|
||||
d->setupKAuthAction(&action, unreniced_pids);
|
||||
action.addArgument("nicevalue", niceValue);
|
||||
KAuth::ActionReply reply = action.execute();
|
||||
|
||||
if (reply == KAuth::ActionReply::SuccessReply) {
|
||||
if (reply == KAuthorization::NoError) {
|
||||
updateList();
|
||||
} else if (reply != KAuth::ActionReply::UserCancelled && reply != KAuth::ActionReply::AuthorizationDenied) {
|
||||
KMessageBox::sorry(this, i18n("You do not have the permission to renice the process and there "
|
||||
"was a problem trying to run as root. Error %1 %2", reply.errorCode(), reply.errorDescription()));
|
||||
} else if (reply == KAuthorization::AuthorizationError) {
|
||||
KMessageBox::sorry(this, i18n("You do not have the permission to crenice the process."));
|
||||
return false;
|
||||
} else {
|
||||
KMessageBox::sorry(this, i18n("There was a problem trying to renice the process"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -1135,18 +1126,25 @@ bool KSysGuardProcessList::changeCpuScheduler(const QList< long long> &pids, KSy
|
|||
if(unchanged_pids.isEmpty()) return true;
|
||||
if(!d->mModel.isLocalhost()) return false; //We can't use KAuth to affect non-localhost processes
|
||||
|
||||
KAuth::Action action("org.kde.ksysguard.processlisthelper.changecpuscheduler");
|
||||
action.setParentWidget(window());
|
||||
d->setupKAuthAction(&action, unchanged_pids);
|
||||
action.addArgument("cpuScheduler", (int)newCpuSched);
|
||||
action.addArgument("cpuSchedulerPriority", newCpuSchedPriority);
|
||||
KAuth::ActionReply reply = action.execute();
|
||||
QVariantMap actionarguments;
|
||||
int processCount = unchanged_pids.count();
|
||||
for(int i = 0; i < processCount; i++) {
|
||||
actionarguments.insert(QString("pid%1").arg(i), unchanged_pids[i]);
|
||||
}
|
||||
actionarguments.insert("pidcount", processCount);
|
||||
actionarguments.insert("cpuScheduler", (int)newCpuSched);
|
||||
actionarguments.insert("cpuSchedulerPriority", newCpuSchedPriority);
|
||||
int reply = KAuthorization::execute(
|
||||
"org.kde.ksysguard.processlisthelper", "changecpuscheduler", actionarguments
|
||||
);
|
||||
|
||||
if (reply == KAuth::ActionReply::SuccessReply) {
|
||||
if (reply == KAuthorization::NoError) {
|
||||
updateList();
|
||||
} else if (reply != KAuth::ActionReply::UserCancelled && reply != KAuth::ActionReply::AuthorizationDenied) {
|
||||
KMessageBox::sorry(this, i18n("You do not have the permission to change the CPU Scheduler for the process and there "
|
||||
"was a problem trying to run as root. Error %1 %2", reply.errorCode(), reply.errorDescription()));
|
||||
} else if (reply == KAuthorization::AuthorizationError) {
|
||||
KMessageBox::sorry(this, i18n("You do not have the permission to change the CPU Scheduler for the process."));
|
||||
return false;
|
||||
} else {
|
||||
KMessageBox::sorry(this, i18n("There was a problem trying to change the CPU Scheduler for the process"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <QtGui/QCheckBox>
|
||||
|
||||
// KDE
|
||||
#include <kauthorized.h>
|
||||
#include <khistorycombobox.h>
|
||||
#include <kdesktopfile.h>
|
||||
#include <klineedit.h>
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include <QFileInfo>
|
||||
|
||||
// KDE
|
||||
#include <KAuthorized>
|
||||
#include <KConfigGroup>
|
||||
#include <KDebug>
|
||||
#include <KIcon>
|
||||
|
@ -119,29 +118,22 @@ void LeaveModel::updateModel()
|
|||
QStandardItem *sessionOptions = new QStandardItem(i18n("Session"));
|
||||
|
||||
// Logout
|
||||
const bool canLogout = KAuthorized::authorizeKAction("logout") && KAuthorized::authorize("logout");
|
||||
if (canLogout) {
|
||||
QStandardItem *logoutOption = createStandardItem("leave:/logoutonly");
|
||||
sessionOptions->appendRow(logoutOption);
|
||||
}
|
||||
|
||||
// Lock
|
||||
if (KAuthorized::authorizeKAction("lock_screen")) {
|
||||
QStandardItem *lockOption = createStandardItem("leave:/lock");
|
||||
sessionOptions->appendRow(lockOption);
|
||||
}
|
||||
|
||||
// Save Session
|
||||
if (canLogout) {
|
||||
KConfigGroup c(KSharedConfig::openConfig("ksmserverrc", KConfig::NoGlobals), "General");
|
||||
if (c.readEntry("loginMode") == "restoreSavedSession") {
|
||||
QStandardItem *saveSessionOption = createStandardItem("leave:/savesession");
|
||||
sessionOptions->appendRow(saveSessionOption);
|
||||
}
|
||||
}
|
||||
|
||||
// Switch User
|
||||
if (KDisplayManager().isSwitchable() && KAuthorized::authorize(QLatin1String("switch_user"))) {
|
||||
if (KDisplayManager().isSwitchable()) {
|
||||
QStandardItem *switchUserOption = createStandardItem("leave:/switch");
|
||||
sessionOptions->appendRow(switchUserOption);
|
||||
}
|
||||
|
@ -170,7 +162,6 @@ void LeaveModel::updateModel()
|
|||
addSystemSession = true;
|
||||
}
|
||||
|
||||
if (canLogout) {
|
||||
if (KWorkSpace::canShutDown(KWorkSpace::ShutdownConfirmDefault, KWorkSpace::ShutdownTypeReboot)) {
|
||||
// Restart
|
||||
QStandardItem *restartOption = createStandardItem("leave:/restart");
|
||||
|
@ -184,7 +175,6 @@ void LeaveModel::updateModel()
|
|||
systemOptions->appendRow(shutDownOption);
|
||||
addSystemSession = true;
|
||||
}
|
||||
}
|
||||
|
||||
appendRow(sessionOptions);
|
||||
if (addSystemSession) {
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <QSignalMapper>
|
||||
#include <QtCore/qtimer.h>
|
||||
|
||||
#include <KAuthorized>
|
||||
#include <KDebug>
|
||||
#include <KIcon>
|
||||
#include <KMenu>
|
||||
|
@ -167,13 +166,9 @@ QAction *ContextMenu::action(const QString &name)
|
|||
} else if (name == "_run_command") {
|
||||
return m_runCommandAction;
|
||||
} else if (name == "_lock_screen") {
|
||||
if (KAuthorized::authorizeKAction("lock_screen")) {
|
||||
return m_lockScreenAction;
|
||||
}
|
||||
} else if (name == "_logout") {
|
||||
if (KAuthorized::authorizeKAction("logout")) {
|
||||
return m_logoutAction;
|
||||
}
|
||||
} else {
|
||||
//FIXME: remove action: make removal of current activity possible
|
||||
return c->action(name);
|
||||
|
@ -190,10 +185,6 @@ void ContextMenu::runCommand()
|
|||
|
||||
void ContextMenu::lockScreen()
|
||||
{
|
||||
if (!KAuthorized::authorizeKAction("lock_screen")) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString interface("org.freedesktop.ScreenSaver");
|
||||
org::freedesktop::ScreenSaver screensaver(interface, "/ScreenSaver",
|
||||
QDBusConnection::sessionBus());
|
||||
|
@ -220,10 +211,6 @@ void ContextMenu::startLogout()
|
|||
|
||||
void ContextMenu::logout()
|
||||
{
|
||||
if (!KAuthorized::authorizeKAction("logout")) {
|
||||
return;
|
||||
}
|
||||
|
||||
KWorkSpace::requestShutDown();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#include <QDBusMessage>
|
||||
#include <QDBusPendingReply>
|
||||
|
||||
#include <KAuthorized>
|
||||
|
||||
// kde-workspace/libs
|
||||
#include <kworkspace/kworkspace.h>
|
||||
|
||||
|
@ -49,16 +47,12 @@ void PowerManagementJob::start()
|
|||
//kDebug() << "starting operation ... " << operation;
|
||||
|
||||
if (operation == "lockScreen") {
|
||||
if (KAuthorized::authorizeKAction("lock_screen")) {
|
||||
#warning TODO: error check
|
||||
const QString interface("org.freedesktop.ScreenSaver");
|
||||
QDBusInterface screensaver(interface, "/ScreenSaver");
|
||||
screensaver.asyncCall("Lock");
|
||||
setResult(true);
|
||||
return;
|
||||
}
|
||||
kDebug() << "operation denied " << operation;
|
||||
setResult(false);
|
||||
return;
|
||||
} else if (operation == "suspend" || operation == "suspendToRam") {
|
||||
if (!Solid::PowerManagement::supportedSleepStates().contains(Solid::PowerManagement::SuspendState)) {
|
||||
setResult(false);
|
||||
|
|
|
@ -43,9 +43,6 @@ enforced security
|
|||
|
||||
This is security that doesn't rely on plasmoid developers. Mostly it's about disabling access to features via the scripting API, so that plasmoids using that API absolutely cannot use the disabled features.
|
||||
|
||||
it'd be nice if we could use KAuthorized to enforce some stuff on the c++ applets... I tried, but didn't get anywhere.
|
||||
|
||||
|
||||
misc
|
||||
----
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
|
||||
#include "sessionrunner.h"
|
||||
|
||||
|
||||
#include <KAuthorized>
|
||||
#include <KDebug>
|
||||
#include <KLocale>
|
||||
#include <KMessageBox>
|
||||
|
@ -38,18 +36,13 @@ SessionRunner::SessionRunner(QObject *parent, const QVariantList &args)
|
|||
setIgnoredTypes(Plasma::RunnerContext::Directory | Plasma::RunnerContext::File |
|
||||
Plasma::RunnerContext::NetworkLocation);
|
||||
|
||||
m_canLogout = KAuthorized::authorizeKAction("logout") && KAuthorized::authorize("logout");
|
||||
if (m_canLogout) {
|
||||
addSyntax(Plasma::RunnerSyntax(i18nc("log out command", "logout"),
|
||||
i18n("Logs out, exiting the current desktop session")));
|
||||
addSyntax(Plasma::RunnerSyntax(i18nc("shutdown computer command", "shutdown"),
|
||||
i18n("Turns off the computer")));
|
||||
}
|
||||
|
||||
if (KAuthorized::authorizeKAction("lock_screen") && m_canLogout) {
|
||||
addSyntax(Plasma::RunnerSyntax(i18nc("lock screen command", "lock"),
|
||||
i18n("Locks the current sessions and starts the screen saver")));
|
||||
}
|
||||
|
||||
Plasma::RunnerSyntax rebootSyntax(i18nc("restart computer command", "restart"), i18n("Reboots the computer"));
|
||||
rebootSyntax.addExampleQuery(i18nc("restart computer command", "reboot"));
|
||||
|
@ -76,10 +69,6 @@ SessionRunner::~SessionRunner()
|
|||
|
||||
void SessionRunner::matchCommands(QList<Plasma::QueryMatch> &matches, const QString& term)
|
||||
{
|
||||
if (!m_canLogout) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (term.compare(i18nc("log out command","logout"), Qt::CaseInsensitive) == 0 ||
|
||||
term.compare(i18n("log out"), Qt::CaseInsensitive) == 0) {
|
||||
Plasma::QueryMatch match(this);
|
||||
|
@ -107,7 +96,6 @@ void SessionRunner::matchCommands(QList<Plasma::QueryMatch> &matches, const QStr
|
|||
match.setRelevance(0.9);
|
||||
matches << match;
|
||||
} else if (term.compare(i18nc("lock screen command","lock"), Qt::CaseInsensitive) == 0) {
|
||||
if (KAuthorized::authorizeKAction("lock_screen")) {
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setText(i18n("Lock the screen"));
|
||||
match.setIcon(KIcon("system-lock-screen"));
|
||||
|
@ -116,7 +104,6 @@ void SessionRunner::matchCommands(QList<Plasma::QueryMatch> &matches, const QStr
|
|||
match.setRelevance(0.9);
|
||||
matches << match;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SessionRunner::match(Plasma::RunnerContext &context)
|
||||
|
@ -155,8 +142,7 @@ void SessionRunner::match(Plasma::RunnerContext &context)
|
|||
term.compare(i18n("switch user"), Qt::CaseInsensitive) == 0 ||
|
||||
term.compare(i18n("new session"), Qt::CaseInsensitive) == 0;
|
||||
|
||||
if (switchUser &&
|
||||
KAuthorized::authorizeKAction("start_new_session") && dm.isSwitchable()) {
|
||||
if (switchUser && dm.isSwitchable()) {
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::ExactMatch);
|
||||
match.setIcon(KIcon("system-switch-user"));
|
||||
|
|
|
@ -46,7 +46,6 @@ class SessionRunner : public Plasma::AbstractRunner
|
|||
|
||||
QString m_triggerWord;
|
||||
KDisplayManager dm;
|
||||
bool m_canLogout;
|
||||
};
|
||||
|
||||
K_EXPORT_PLASMA_RUNNER(sessions, SessionRunner)
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include <QTimer>
|
||||
#include <QtCore/qsharedpointer.h>
|
||||
|
||||
#include <KAuthorized>
|
||||
#include <KDebug>
|
||||
#include <KIconLoader>
|
||||
|
||||
|
@ -175,19 +174,15 @@ void DesktopToolBox::init()
|
|||
this, SLOT(updateTheming()));
|
||||
Plasma::ToolTipManager::self()->registerWidget(this);
|
||||
|
||||
if (KAuthorized::authorizeKAction("logout")) {
|
||||
QAction *action = new QAction(i18n("Leave..."), this);
|
||||
action->setIcon(KIcon("system-shutdown"));
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(startLogout()));
|
||||
addTool(action);
|
||||
}
|
||||
|
||||
if (KAuthorized::authorizeKAction("lock_screen")) {
|
||||
QAction *action = new QAction(i18n("Lock Screen"), this);
|
||||
action = new QAction(i18n("Lock Screen"), this);
|
||||
action->setIcon(KIcon("system-lock-screen"));
|
||||
connect(action, SIGNAL(triggered(bool)), this, SLOT(lockScreen()));
|
||||
addTool(action);
|
||||
}
|
||||
}
|
||||
|
||||
QSize DesktopToolBox::cornerSize() const
|
||||
|
@ -780,10 +775,6 @@ void DesktopToolBox::lockScreen()
|
|||
setShowing(false);
|
||||
}
|
||||
|
||||
if (!KAuthorized::authorizeKAction("lock_screen")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const QString interface("org.freedesktop.ScreenSaver");
|
||||
QDBusInterface screensaver(interface, "/ScreenSaver");
|
||||
screensaver.asyncCall("Lock");
|
||||
|
@ -813,10 +804,6 @@ void DesktopToolBox::startLogout()
|
|||
|
||||
void DesktopToolBox::logout()
|
||||
{
|
||||
if (!KAuthorized::authorizeKAction("logout")) {
|
||||
return;
|
||||
}
|
||||
|
||||
KWorkSpace::requestShutDown();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <kstandarddirs.h>
|
||||
#include <kdesktopfileactions.h>
|
||||
#include <kpassworddialog.h>
|
||||
#include <kauthaction.h>
|
||||
#include <kauthorization.h>
|
||||
#include <kpluginfactory.h>
|
||||
#include <kpluginloader.h>
|
||||
#include <solid/block.h>
|
||||
|
@ -53,21 +53,18 @@ static int doMount(const QString &deviceuuid, const QString &devicenode, const Q
|
|||
return int(Solid::ErrorType::OperationFailed);
|
||||
}
|
||||
|
||||
KAuth::Action mountaction("org.kde.soliduiserver.mountunmounthelper.mount");
|
||||
mountaction.setHelperID("org.kde.soliduiserver.mountunmounthelper");
|
||||
mountaction.addArgument("device", devicenode);
|
||||
mountaction.addArgument("mountpoint", mountpoint);
|
||||
mountaction.addArgument("fstype", devicefstype);
|
||||
KAuth::ActionReply mountreply = mountaction.execute();
|
||||
// qDebug() << "mount" << mountreply.errorCode() << mountreply.errorDescription();
|
||||
QVariantMap mountarguments;
|
||||
mountarguments.insert("device", devicenode);
|
||||
mountarguments.insert("mountpoint", mountpoint);
|
||||
mountarguments.insert("fstype", devicefstype);
|
||||
int mountreply = KAuthorization::execute(
|
||||
"org.kde.soliduiserver.mountunmounthelper", "mount", mountarguments
|
||||
);
|
||||
// qDebug() << "mount" << mountreply;
|
||||
|
||||
if (mountreply == KAuth::ActionReply::SuccessReply) {
|
||||
if (mountreply == KAuthorization::NoError) {
|
||||
return int(Solid::ErrorType::NoError);
|
||||
}
|
||||
|
||||
if (mountreply == KAuth::ActionReply::UserCancelled) {
|
||||
return int(Solid::ErrorType::UserCanceled);
|
||||
} else if (mountreply == KAuth::ActionReply::AuthorizationDenied) {
|
||||
} else if (mountreply == KAuthorization::AuthorizationError) {
|
||||
return int(Solid::ErrorType::UnauthorizedOperation);
|
||||
}
|
||||
return int(Solid::ErrorType::OperationFailed);
|
||||
|
@ -75,19 +72,16 @@ static int doMount(const QString &deviceuuid, const QString &devicenode, const Q
|
|||
|
||||
static int doUnmount(const QString &devicemountpoint)
|
||||
{
|
||||
KAuth::Action unmountaction("org.kde.soliduiserver.mountunmounthelper.unmount");
|
||||
unmountaction.setHelperID("org.kde.soliduiserver.mountunmounthelper");
|
||||
unmountaction.addArgument("mountpoint", devicemountpoint);
|
||||
KAuth::ActionReply unmountreply = unmountaction.execute();
|
||||
// qDebug() << "unmount" << unmountreply.errorCode() << unmountreply.errorDescription();
|
||||
QVariantMap unmountarguments;
|
||||
unmountarguments.insert("mountpoint", devicemountpoint);
|
||||
int unmountreply = KAuthorization::execute(
|
||||
"org.kde.soliduiserver.mountunmounthelper", "unmount", unmountarguments
|
||||
);
|
||||
// qDebug() << "unmount" << unmountreply;
|
||||
|
||||
if (unmountreply == KAuth::ActionReply::SuccessReply) {
|
||||
if (unmountreply == KAuthorization::NoError) {
|
||||
return int(Solid::ErrorType::NoError);
|
||||
}
|
||||
|
||||
if (unmountreply == KAuth::ActionReply::UserCancelled) {
|
||||
return int(Solid::ErrorType::UserCanceled);
|
||||
} else if (unmountreply == KAuth::ActionReply::AuthorizationDenied) {
|
||||
} else if (unmountreply == KAuthorization::AuthorizationError) {
|
||||
return int(Solid::ErrorType::UnauthorizedOperation);
|
||||
}
|
||||
return int(Solid::ErrorType::OperationFailed);
|
||||
|
@ -201,20 +195,18 @@ int SolidUiServer::mountDevice(const QString &udi)
|
|||
return int(Solid::ErrorType::UserCanceled);
|
||||
}
|
||||
|
||||
KAuth::Action cryptopenaction("org.kde.soliduiserver.mountunmounthelper.cryptopen");
|
||||
cryptopenaction.setHelperID("org.kde.soliduiserver.mountunmounthelper");
|
||||
cryptopenaction.addArgument("device", devicenode);
|
||||
cryptopenaction.addArgument("name", deviceuuid);
|
||||
cryptopenaction.addArgument("password", passworddialog.password().toLocal8Bit().toHex());
|
||||
KAuth::ActionReply cryptopenreply = cryptopenaction.execute();
|
||||
QVariantMap cryptopenarguments;
|
||||
cryptopenarguments.insert("device", devicenode);
|
||||
cryptopenarguments.insert("name", deviceuuid);
|
||||
cryptopenarguments.insert("password", passworddialog.password().toLocal8Bit().toHex());
|
||||
int cryptopenreply = KAuthorization::execute(
|
||||
"org.kde.soliduiserver.mountunmounthelper", "cryptopen", cryptopenarguments
|
||||
);
|
||||
// qDebug() << "cryptopen" << cryptopenreply;
|
||||
|
||||
// qDebug() << "cryptopen" << cryptopenreply.errorCode() << cryptopenreply.errorDescription();
|
||||
|
||||
if (cryptopenreply == KAuth::ActionReply::UserCancelled) {
|
||||
return int(Solid::ErrorType::UserCanceled);
|
||||
} else if (cryptopenreply == KAuth::ActionReply::AuthorizationDenied) {
|
||||
if (cryptopenreply == KAuthorization::AuthorizationError) {
|
||||
return int(Solid::ErrorType::UnauthorizedOperation);
|
||||
} else if (cryptopenreply != KAuth::ActionReply::SuccessReply) {
|
||||
} else if (cryptopenreply != KAuthorization::NoError) {
|
||||
return int(Solid::ErrorType::OperationFailed);
|
||||
}
|
||||
|
||||
|
@ -228,10 +220,11 @@ int SolidUiServer::mountDevice(const QString &udi)
|
|||
|
||||
const int mountresult = doMount(deviceuuid, devicenode, storagevolume->fsType());
|
||||
if (mountresult != int(Solid::ErrorType::NoError) && didcryptopen) {
|
||||
KAuth::Action cryptcloseaction("org.kde.soliduiserver.mountunmounthelper.cryptclose");
|
||||
cryptcloseaction.setHelperID("org.kde.soliduiserver.mountunmounthelper");
|
||||
cryptcloseaction.addArgument("name", deviceuuid);
|
||||
cryptcloseaction.execute();
|
||||
QVariantMap cryptclosearguments;
|
||||
cryptclosearguments.insert("name", deviceuuid);
|
||||
(void)KAuthorization::execute(
|
||||
"org.kde.soliduiserver.mountunmounthelper", "cryptclose", cryptclosearguments
|
||||
);
|
||||
}
|
||||
return mountresult;
|
||||
}
|
||||
|
@ -251,18 +244,16 @@ int SolidUiServer::unmountDevice(const QString &udi)
|
|||
}
|
||||
|
||||
if (storagevolume->usage() == Solid::StorageVolume::Encrypted) {
|
||||
KAuth::Action cryptcloseaction("org.kde.soliduiserver.mountunmounthelper.cryptclose");
|
||||
cryptcloseaction.setHelperID("org.kde.soliduiserver.mountunmounthelper");
|
||||
cryptcloseaction.addArgument("name", storagevolume->uuid());
|
||||
KAuth::ActionReply cryptclosereply = cryptcloseaction.execute();
|
||||
QVariantMap cryptclosearguments;
|
||||
cryptclosearguments.insert("name", storagevolume->uuid());
|
||||
int cryptclosereply = KAuthorization::execute(
|
||||
"org.kde.soliduiserver.mountunmounthelper", "cryptclose", cryptclosearguments
|
||||
);
|
||||
// qDebug() << "cryptclose" << cryptclosereply;
|
||||
|
||||
// qDebug() << "cryptclose" << cryptclosereply.errorCode() << cryptclosereply.errorDescription();
|
||||
|
||||
if (cryptclosereply == KAuth::ActionReply::UserCancelled) {
|
||||
return int(Solid::ErrorType::UserCanceled);
|
||||
} else if (cryptclosereply == KAuth::ActionReply::AuthorizationDenied) {
|
||||
if (cryptclosereply == KAuthorization::AuthorizationError) {
|
||||
return int(Solid::ErrorType::UnauthorizedOperation);
|
||||
} else if (cryptclosereply != KAuth::ActionReply::SuccessReply) {
|
||||
} else if (cryptclosereply != KAuthorization::NoError) {
|
||||
return int(Solid::ErrorType::OperationFailed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include "soliduiserver_helper.h"
|
||||
|
||||
#include <kauthhelpersupport.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
|
@ -31,18 +30,16 @@
|
|||
# include <errno.h>
|
||||
#endif
|
||||
|
||||
KAuth::ActionReply SolidUiServerHelper::cryptopen(const QVariantMap ¶meters)
|
||||
int SolidUiServerHelper::cryptopen(const QVariantMap ¶meters)
|
||||
{
|
||||
if (!parameters.contains("device") || !parameters.contains("name") || !parameters.contains("password")) {
|
||||
return KAuth::ActionReply::HelperErrorReply;
|
||||
return KAuthorization::HelperError;
|
||||
}
|
||||
|
||||
const QString cryptbin = KStandardDirs::findRootExe("cryptsetup");
|
||||
if (cryptbin.isEmpty()) {
|
||||
KAuth::ActionReply errorreply(KAuth::ActionReply::HelperError);
|
||||
errorreply.setErrorDescription("cryptsetup is missing");
|
||||
errorreply.setErrorCode(1);
|
||||
return errorreply;
|
||||
kWarning() << "cryptsetup is missing";
|
||||
return KAuthorization::HelperError;
|
||||
}
|
||||
|
||||
const QString device = parameters.value("device").toString();
|
||||
|
@ -57,30 +54,26 @@ KAuth::ActionReply SolidUiServerHelper::cryptopen(const QVariantMap ¶meters)
|
|||
cryptproc.waitForFinished();
|
||||
|
||||
if (cryptproc.exitCode() == 0) {
|
||||
return KAuth::ActionReply::SuccessReply;
|
||||
return KAuthorization::NoError;
|
||||
}
|
||||
QString crypterror = cryptproc.readAllStandardError();
|
||||
if (crypterror.isEmpty()) {
|
||||
crypterror = cryptproc.readAllStandardOutput();
|
||||
}
|
||||
KAuth::ActionReply errorreply(KAuth::ActionReply::HelperError);
|
||||
errorreply.setErrorDescription(crypterror);
|
||||
errorreply.setErrorCode(cryptproc.exitCode());
|
||||
return errorreply;
|
||||
kWarning() << crypterror;
|
||||
return KAuthorization::HelperError;
|
||||
}
|
||||
|
||||
KAuth::ActionReply SolidUiServerHelper::cryptclose(const QVariantMap ¶meters)
|
||||
int SolidUiServerHelper::cryptclose(const QVariantMap ¶meters)
|
||||
{
|
||||
if (!parameters.contains("name")) {
|
||||
return KAuth::ActionReply::HelperErrorReply;
|
||||
return KAuthorization::HelperError;
|
||||
}
|
||||
|
||||
const QString cryptbin = KStandardDirs::findRootExe("cryptsetup");
|
||||
if (cryptbin.isEmpty()) {
|
||||
KAuth::ActionReply errorreply(KAuth::ActionReply::HelperError);
|
||||
errorreply.setErrorDescription("cryptsetup is missing");
|
||||
errorreply.setErrorCode(1);
|
||||
return errorreply;
|
||||
kWarning() << "cryptsetup is missing";
|
||||
return KAuthorization::HelperError;
|
||||
}
|
||||
|
||||
const QString name = parameters.value("name").toString();
|
||||
|
@ -91,23 +84,21 @@ KAuth::ActionReply SolidUiServerHelper::cryptclose(const QVariantMap ¶meters
|
|||
cryptproc.waitForFinished();
|
||||
|
||||
if (cryptproc.exitCode() == 0) {
|
||||
return KAuth::ActionReply::SuccessReply;
|
||||
return KAuthorization::NoError;
|
||||
}
|
||||
QString crypterror = cryptproc.readAllStandardError();
|
||||
if (crypterror.isEmpty()) {
|
||||
crypterror = cryptproc.readAllStandardOutput();
|
||||
}
|
||||
KAuth::ActionReply errorreply(KAuth::ActionReply::HelperError);
|
||||
errorreply.setErrorDescription(crypterror);
|
||||
errorreply.setErrorCode(cryptproc.exitCode());
|
||||
return errorreply;
|
||||
kWarning() << crypterror;
|
||||
return KAuthorization::HelperError;
|
||||
}
|
||||
|
||||
KAuth::ActionReply SolidUiServerHelper::mount(const QVariantMap ¶meters)
|
||||
int SolidUiServerHelper::mount(const QVariantMap ¶meters)
|
||||
{
|
||||
if (!parameters.contains("device") || !parameters.contains("mountpoint")
|
||||
|| !parameters.contains("fstype")) {
|
||||
return KAuth::ActionReply::HelperErrorReply;
|
||||
return KAuthorization::HelperError;
|
||||
}
|
||||
|
||||
const QString device = parameters.value("device").toString();
|
||||
|
@ -138,14 +129,11 @@ KAuth::ActionReply SolidUiServerHelper::mount(const QVariantMap ¶meters)
|
|||
0, NULL
|
||||
);
|
||||
if (mountresult == 0) {
|
||||
return KAuth::ActionReply::SuccessReply;
|
||||
return KAuthorization::NoError;
|
||||
}
|
||||
const int savederrno = errno;
|
||||
// qDebug() << Q_FUNC_INFO << qt_error_string(savederrno);
|
||||
KAuth::ActionReply errorreply(KAuth::ActionReply::HelperError);
|
||||
errorreply.setErrorDescription(qt_error_string(savederrno));
|
||||
errorreply.setErrorCode(savederrno);
|
||||
return errorreply;
|
||||
kWarning() << qt_error_string(savederrno);
|
||||
return KAuthorization::HelperError;
|
||||
}
|
||||
#endif // Q_OS_LINUX
|
||||
|
||||
|
@ -156,22 +144,20 @@ KAuth::ActionReply SolidUiServerHelper::mount(const QVariantMap ¶meters)
|
|||
mountproc.waitForFinished();
|
||||
|
||||
if (mountproc.exitCode() == 0) {
|
||||
return KAuth::ActionReply::SuccessReply;
|
||||
return KAuthorization::NoError;
|
||||
}
|
||||
QString mounterror = mountproc.readAllStandardError();
|
||||
if (mounterror.isEmpty()) {
|
||||
mounterror = mountproc.readAllStandardOutput();
|
||||
}
|
||||
KAuth::ActionReply errorreply(KAuth::ActionReply::HelperError);
|
||||
errorreply.setErrorDescription(mounterror);
|
||||
errorreply.setErrorCode(mountproc.exitCode());
|
||||
return errorreply;
|
||||
kWarning() << mounterror;
|
||||
return KAuthorization::HelperError;
|
||||
}
|
||||
|
||||
KAuth::ActionReply SolidUiServerHelper::unmount(const QVariantMap ¶meters)
|
||||
int SolidUiServerHelper::unmount(const QVariantMap ¶meters)
|
||||
{
|
||||
if (!parameters.contains("mountpoint")) {
|
||||
return KAuth::ActionReply::HelperErrorReply;
|
||||
return KAuthorization::HelperError;
|
||||
}
|
||||
|
||||
const QString mountpoint = parameters.value("mountpoint").toString();
|
||||
|
@ -180,13 +166,11 @@ KAuth::ActionReply SolidUiServerHelper::unmount(const QVariantMap ¶meters)
|
|||
const QByteArray mountpointbytes = mountpoint.toLocal8Bit();;
|
||||
const int umountresult = ::umount2(mountpointbytes.constData(), MNT_DETACH);
|
||||
if (umountresult == 0) {
|
||||
return KAuth::ActionReply::SuccessReply;
|
||||
return KAuthorization::NoError;
|
||||
}
|
||||
const int savederrno = errno;
|
||||
KAuth::ActionReply errorreply(KAuth::ActionReply::HelperError);
|
||||
errorreply.setErrorDescription(qt_error_string(savederrno));
|
||||
errorreply.setErrorCode(savederrno);
|
||||
return errorreply;
|
||||
kWarning() << qt_error_string(savederrno);
|
||||
return KAuthorization::HelperError;
|
||||
#else
|
||||
const QStringList umountargs = QStringList() << mountpoint;
|
||||
QProcess umountproc;
|
||||
|
@ -195,17 +179,15 @@ KAuth::ActionReply SolidUiServerHelper::unmount(const QVariantMap ¶meters)
|
|||
umountproc.waitForFinished();
|
||||
|
||||
if (umountproc.exitCode() == 0) {
|
||||
return KAuth::ActionReply::SuccessReply;
|
||||
return KAuthorization::NoError;
|
||||
}
|
||||
QString umounterror = umountproc.readAllStandardError();
|
||||
if (umounterror.isEmpty()) {
|
||||
umounterror = umountproc.readAllStandardOutput();
|
||||
}
|
||||
KAuth::ActionReply errorreply(KAuth::ActionReply::HelperError);
|
||||
errorreply.setErrorDescription(umounterror);
|
||||
errorreply.setErrorCode(umountproc.exitCode());
|
||||
return errorreply;
|
||||
kWarning() << umounterror;
|
||||
return KAuthorization::HelperError;
|
||||
#endif // Q_OS_LINUX
|
||||
}
|
||||
|
||||
KDE4_AUTH_HELPER_MAIN("org.kde.soliduiserver.mountunmounthelper", SolidUiServerHelper)
|
||||
K_AUTH_MAIN("org.kde.soliduiserver.mountunmounthelper", SolidUiServerHelper)
|
||||
|
|
|
@ -19,20 +19,16 @@
|
|||
#ifndef SOLIDUISERVER_HELPER_H
|
||||
#define SOLIDUISERVER_HELPER_H
|
||||
|
||||
#include <kauthactionreply.h>
|
||||
#include <QObject>
|
||||
#include <kauthorization.h>
|
||||
|
||||
// methods return type must be ActionReply otherwise QMetaObject::invokeMethod() fails
|
||||
using namespace KAuth;
|
||||
|
||||
class SolidUiServerHelper : public QObject
|
||||
class SolidUiServerHelper : public KAuthorization
|
||||
{
|
||||
Q_OBJECT
|
||||
public Q_SLOTS:
|
||||
ActionReply cryptopen(const QVariantMap ¶meters);
|
||||
ActionReply cryptclose(const QVariantMap ¶meters);
|
||||
ActionReply mount(const QVariantMap ¶meters);
|
||||
ActionReply unmount(const QVariantMap ¶meters);
|
||||
int cryptopen(const QVariantMap ¶meters);
|
||||
int cryptclose(const QVariantMap ¶meters);
|
||||
int mount(const QVariantMap ¶meters);
|
||||
int unmount(const QVariantMap ¶meters);
|
||||
};
|
||||
|
||||
#endif // SOLIDUISERVER_HELPER_H
|
||||
|
|
|
@ -35,14 +35,12 @@
|
|||
#include <KAboutData>
|
||||
#include <KPageWidget>
|
||||
#include <KPushButton>
|
||||
#include <KAuthorized>
|
||||
#include <KMessageBox>
|
||||
#include <KCModuleInfo>
|
||||
#include <KCModuleProxy>
|
||||
#include <KStandardGuiItem>
|
||||
#include <KDialogButtonBox>
|
||||
#include <KUrl>
|
||||
#include <kauthaction.h>
|
||||
|
||||
#include "MenuItem.h"
|
||||
|
||||
|
@ -156,10 +154,6 @@ void ModuleView::addModule( KCModuleInfo *module )
|
|||
kWarning() << "ModuleInfo has no associated KService" ;
|
||||
return;
|
||||
}
|
||||
if ( !KAuthorized::authorizeControlModule( module->service()->menuId() ) ) {
|
||||
kWarning() << "Not authorised to load module" ;
|
||||
return;
|
||||
}
|
||||
if( module->service()->noDisplay() ) {
|
||||
return;
|
||||
}
|
||||
|
@ -263,7 +257,6 @@ bool ModuleView::resolveChanges(KCModuleProxy * currentProxy)
|
|||
void ModuleView::closeModules()
|
||||
{
|
||||
d->pageChangeSupressed = true;
|
||||
d->mApply->setAuthAction( 0 ); // Ensure KAuth knows that authentication is now pointless...
|
||||
QMap<KPageWidgetItem*, KCModuleInfo*>::iterator page = d->mModules.begin();
|
||||
QMap<KPageWidgetItem*, KCModuleInfo*>::iterator pageEnd = d->mModules.end();
|
||||
for ( ; page != pageEnd; ++page ) {
|
||||
|
@ -341,23 +334,15 @@ void ModuleView::activeModuleChanged(KPageWidgetItem * current, KPageWidgetItem
|
|||
void ModuleView::stateChanged()
|
||||
{
|
||||
KCModuleProxy * activeModule = d->mPages.value( d->mPageWidget->currentPage() );
|
||||
KAuth::Action * moduleAction = 0;
|
||||
bool change = false;
|
||||
if( activeModule ) {
|
||||
change = activeModule->changed();
|
||||
|
||||
disconnect( d->mApply, SIGNAL(authorized(KAuth::Action*)), this, SLOT(moduleSave()) );
|
||||
disconnect( d->mApply, SIGNAL(clicked()), this, SLOT(moduleSave()) );
|
||||
if( activeModule->realModule()->authAction() ) {
|
||||
connect( d->mApply, SIGNAL(authorized(KAuth::Action*)), this, SLOT(moduleSave()) );
|
||||
moduleAction = activeModule->realModule()->authAction();
|
||||
} else {
|
||||
connect( d->mApply, SIGNAL(clicked()), this, SLOT(moduleSave()) );
|
||||
}
|
||||
}
|
||||
|
||||
updatePageIconHeader( d->mPageWidget->currentPage() );
|
||||
d->mApply->setAuthAction( moduleAction );
|
||||
d->mApply->setEnabled( change );
|
||||
d->mReset->setEnabled( change );
|
||||
emit moduleChanged( change );
|
||||
|
|
Loading…
Add table
Reference in a new issue