generic: drop most of the KIOSK functionality

This commit is contained in:
Ivailo Monev 2015-05-19 05:23:35 +00:00
parent 4a7ee7d515
commit bbea8b2acc
17 changed files with 49 additions and 184 deletions

View file

@ -157,12 +157,6 @@ bool KDesktopFile::isAuthorizedDesktopFile(const QString& path)
return true; return true;
} }
// Forbid desktop files outside of standard locations if kiosk is set so
if (!KAuthorized::authorize(QLatin1String("run_desktop_files"))) {
kWarning() << "Access to '" << path << "' denied because of 'run_desktop_files' restriction." << endl;
return false;
}
// Not otherwise permitted, so only allow if the file is executable, or if // Not otherwise permitted, so only allow if the file is executable, or if
// owned by root (uid == 0) // owned by root (uid == 0)
QFileInfo entryInfo( path ); QFileInfo entryInfo( path );

View file

@ -145,28 +145,21 @@ void KHelpMenuPrivate::createActions(KHelpMenu* q)
return; return;
mActionsCreated = true; mActionsCreated = true;
if (mShowWhatsThis && KAuthorized::authorizeKAction("help_whats_this")) { if (mShowWhatsThis) {
mWhatsThisAction = KStandardAction::whatsThis(q, SLOT(contextHelpActivated()), q); mWhatsThisAction = KStandardAction::whatsThis(q, SLOT(contextHelpActivated()), q);
} }
const KAboutData *aboutData = mAboutData ? mAboutData : KGlobal::mainComponent().aboutData(); const KAboutData *aboutData = mAboutData ? mAboutData : KGlobal::mainComponent().aboutData();
if (KAuthorized::authorizeKAction("help_report_bug") && aboutData && !aboutData->bugAddress().isEmpty()) { if (aboutData && !aboutData->bugAddress().isEmpty()) {
mReportBugAction = KStandardAction::reportBug(q, SLOT(reportBug()), q); mReportBugAction = KStandardAction::reportBug(q, SLOT(reportBug()), q);
} }
if (KAuthorized::authorizeKAction("switch_application_language")) { if((KGlobal::dirs()->findAllResources("locale", QString::fromLatin1("*/entry.desktop"))).count() > 0) {
if((KGlobal::dirs()->findAllResources("locale", QString::fromLatin1("*/entry.desktop"))).count() > 0) { mSwitchApplicationLanguageAction = KStandardAction::create(KStandardAction::SwitchApplicationLanguage, q, SLOT(switchApplicationLanguage()), q);
mSwitchApplicationLanguageAction = KStandardAction::create(KStandardAction::SwitchApplicationLanguage, q, SLOT(switchApplicationLanguage()), q);
}
} }
if (KAuthorized::authorizeKAction("help_about_app")) { mAboutAppAction = KStandardAction::aboutApp(q, SLOT(aboutApplication()), q);
mAboutAppAction = KStandardAction::aboutApp(q, SLOT(aboutApplication()), q); mAboutKDEAction = KStandardAction::aboutKDE(q, SLOT(aboutKDE()), q);
}
if (KAuthorized::authorizeKAction("help_about_kde")) {
mAboutKDEAction = KStandardAction::aboutKDE(q, SLOT(aboutKDE()), q);
}
} }
// Used in the non-xml-gui case, like kfind or ksnapshot's help button. // Used in the non-xml-gui case, like kfind or ksnapshot's help button.

View file

@ -405,9 +405,6 @@ void KLineEdit::setCompletionMode( KGlobalSettings::Completion mode )
if ( echoMode() != QLineEdit::Normal ) if ( echoMode() != QLineEdit::Normal )
mode = KGlobalSettings::CompletionNone; // Override the request. mode = KGlobalSettings::CompletionNone; // Override the request.
if ( kapp && !KAuthorized::authorize("lineedit_text_completion") )
mode = KGlobalSettings::CompletionNone;
if ( mode == KGlobalSettings::CompletionPopupAuto || if ( mode == KGlobalSettings::CompletionPopupAuto ||
mode == KGlobalSettings::CompletionAuto || mode == KGlobalSettings::CompletionAuto ||
mode == KGlobalSettings::CompletionMan ) mode == KGlobalSettings::CompletionMan )
@ -1200,7 +1197,7 @@ QMenu* KLineEdit::createStandardContextMenu()
// If a completion object is present and the input // If a completion object is present and the input
// widget is not read-only, show the Text Completion // widget is not read-only, show the Text Completion
// menu item. // menu item.
if ( compObj() && !isReadOnly() && KAuthorized::authorize("lineedit_text_completion") ) if ( compObj() && !isReadOnly() )
{ {
QMenu *subMenu = popup->addMenu( KIcon("text-completion"), i18nc("@title:menu", "Text Completion") ); QMenu *subMenu = popup->addMenu( KIcon("text-completion"), i18nc("@title:menu", "Text Completion") );
connect( subMenu, SIGNAL(triggered(QAction*)), connect( subMenu, SIGNAL(triggered(QAction*)),

View file

@ -246,10 +246,7 @@ void KToolBar::Private::init(bool readConfig, bool _isMainToolBar)
q->mainWindow(), SLOT(setSettingsDirty())); q->mainWindow(), SLOT(setSettingsDirty()));
} }
if (!KAuthorized::authorize("movable_toolbars")) q->setMovable(!KToolBar::toolBarsLocked());
q->setMovable(false);
else
q->setMovable(!KToolBar::toolBarsLocked());
connect(q, SIGNAL(movableChanged(bool)), connect(q, SIGNAL(movableChanged(bool)),
q, SLOT(slotMovableChanged(bool))); q, SLOT(slotMovableChanged(bool)));
@ -1045,8 +1042,6 @@ int KToolBar::iconSizeDefault() const
void KToolBar::slotMovableChanged(bool movable) void KToolBar::slotMovableChanged(bool movable)
{ {
if (movable && !KAuthorized::authorize("movable_toolbars"))
setMovable(false);
} }
void KToolBar::dragEnterEvent(QDragEnterEvent *event) void KToolBar::dragEnterEvent(QDragEnterEvent *event)

View file

@ -251,8 +251,7 @@ void ToolBarHandler::setupActions()
// We have no XML file associated with our action collection, so load settings from KConfig // We have no XML file associated with our action collection, so load settings from KConfig
actionCollection()->readSettings(); // #233712 actionCollection()->readSettings(); // #233712
if ( KAuthorized::authorizeKAction( "options_show_toolbar" ) ) plugActionList( actionListName, d->actions );
plugActionList( actionListName, d->actions );
d->connectToActionContainers(); d->connectToActionContainers();
} }

View file

@ -677,40 +677,6 @@ void WebPage::slotGeometryChangeRequested(const QRect & rect)
bool WebPage::checkLinkSecurity(const QNetworkRequest &req, NavigationType type) const bool WebPage::checkLinkSecurity(const QNetworkRequest &req, NavigationType type) const
{ {
// Check whether the request is authorized or not...
if (!KAuthorized::authorizeUrlAction("redirect", mainFrame()->url(), req.url())) {
//kDebug() << "*** Failed security check: base-url=" << mainFrame()->url() << ", dest-url=" << req.url();
QString buttonText, title, message;
int response = KMessageBox::Cancel;
KUrl linkUrl (req.url());
if (type == QWebPage::NavigationTypeLinkClicked) {
message = i18n("<qt>This untrusted page links to<br/><b>%1</b>."
"<br/>Do you want to follow the link?</qt>", linkUrl.url());
title = i18n("Security Warning");
buttonText = i18nc("follow link despite of security warning", "Follow");
} else {
title = i18n("Security Alert");
message = i18n("<qt>Access by untrusted page to<br/><b>%1</b><br/> denied.</qt>",
Qt::escape(linkUrl.prettyUrl()));
}
if (buttonText.isEmpty()) {
KMessageBox::error( 0, message, title);
} else {
// Dangerous flag makes the Cancel button the default
response = KMessageBox::warningContinueCancel(0, message, title,
KGuiItem(buttonText),
KStandardGuiItem::cancel(),
QString(), // no don't ask again info
KMessageBox::Notify | KMessageBox::Dangerous);
}
return (response == KMessageBox::Continue);
}
return true; return true;
} }

View file

@ -935,12 +935,6 @@ void KFileWidget::slotOk()
KIO::StatJob *statJob = KIO::stat(url, KIO::HideProgressInfo); KIO::StatJob *statJob = KIO::stat(url, KIO::HideProgressInfo);
bool res = KIO::NetAccess::synchronousRun(statJob, this); bool res = KIO::NetAccess::synchronousRun(statJob, this);
if (!KAuthorized::authorizeUrlAction("open", KUrl(), url)) {
QString msg = KIO::buildErrorString(KIO::ERR_ACCESS_DENIED, d->url.prettyUrl());
KMessageBox::error(this, msg);
return;
}
// if we are on local mode, make sure we haven't got a remote base url // if we are on local mode, make sure we haven't got a remote base url
if ((mode & KFile::LocalOnly) && !d->mostLocalUrl(d->url).isLocalFile()) { if ((mode & KFile::LocalOnly) && !d->mostLocalUrl(d->url).isLocalFile()) {
KMessageBox::sorry(this, KMessageBox::sorry(this,

View file

@ -448,7 +448,7 @@ void KBookmarkMenu::refill()
void KBookmarkMenu::addOpenInTabs() void KBookmarkMenu::addOpenInTabs()
{ {
if( !m_pOwner || !m_pOwner->supportsTabs() || !KAuthorized::authorizeKAction("bookmarks") ) if( !m_pOwner || !m_pOwner->supportsTabs() )
return; return;
QString title = i18n( "Open Folder in Tabs" ); QString title = i18n( "Open Folder in Tabs" );
@ -464,7 +464,7 @@ void KBookmarkMenu::addOpenInTabs()
void KBookmarkMenu::addAddBookmarksList() void KBookmarkMenu::addAddBookmarksList()
{ {
if( !m_pOwner || !m_pOwner->enableOption(KBookmarkOwner::ShowAddBookmark) || !m_pOwner->supportsTabs() || !KAuthorized::authorizeKAction("bookmarks") ) if( !m_pOwner || !m_pOwner->enableOption(KBookmarkOwner::ShowAddBookmark) || !m_pOwner->supportsTabs() )
return; return;
if (d->bookmarksToFolder == 0) { if (d->bookmarksToFolder == 0) {
@ -481,7 +481,7 @@ void KBookmarkMenu::addAddBookmarksList()
void KBookmarkMenu::addAddBookmark() void KBookmarkMenu::addAddBookmark()
{ {
if( !m_pOwner || !m_pOwner->enableOption(KBookmarkOwner::ShowAddBookmark) || !KAuthorized::authorizeKAction("bookmarks") ) if( !m_pOwner || !m_pOwner->enableOption(KBookmarkOwner::ShowAddBookmark) )
return; return;
if (d->addAddBookmark == 0) { if (d->addAddBookmark == 0) {
@ -499,7 +499,7 @@ void KBookmarkMenu::addAddBookmark()
void KBookmarkMenu::addEditBookmarks() void KBookmarkMenu::addEditBookmarks()
{ {
if( ( m_pOwner && !m_pOwner->enableOption(KBookmarkOwner::ShowEditBookmark) ) || !KAuthorized::authorizeKAction("bookmarks") ) if( ( m_pOwner && !m_pOwner->enableOption(KBookmarkOwner::ShowEditBookmark) ) )
return; return;
KAction * m_paEditBookmarks = m_actionCollection->addAction(KStandardAction::EditBookmarks, "edit_bookmarks", KAction * m_paEditBookmarks = m_actionCollection->addAction(KStandardAction::EditBookmarks, "edit_bookmarks",
@ -510,7 +510,7 @@ void KBookmarkMenu::addEditBookmarks()
void KBookmarkMenu::addNewFolder() void KBookmarkMenu::addNewFolder()
{ {
if( !m_pOwner || !m_pOwner->enableOption(KBookmarkOwner::ShowAddBookmark) || !KAuthorized::authorizeKAction("bookmarks")) if( !m_pOwner || !m_pOwner->enableOption(KBookmarkOwner::ShowAddBookmark) )
return; return;
if (d->newBookmarkFolder == 0) { if (d->newBookmarkFolder == 0) {

View file

@ -556,7 +556,6 @@ void KOpenWithDialogPrivate::setMimeType(const KUrl::List &_urls)
void KOpenWithDialogPrivate::init(const QString &_text, const QString &_value) void KOpenWithDialogPrivate::init(const QString &_text, const QString &_value)
{ {
bool bReadOnly = !KAuthorized::authorize("shell_access");
m_terminaldirty = false; m_terminaldirty = false;
view = 0; view = 0;
m_pService = 0; m_pService = 0;
@ -572,30 +571,21 @@ void KOpenWithDialogPrivate::init(const QString &_text, const QString &_value)
label->setWordWrap(true); label->setWordWrap(true);
topLayout->addWidget(label); topLayout->addWidget(label);
if (!bReadOnly) // init the history combo and insert it into the URL-Requester
{ KHistoryComboBox *combo = new KHistoryComboBox();
// init the history combo and insert it into the URL-Requester KLineEdit *lineEdit = new KLineEdit(q);
KHistoryComboBox *combo = new KHistoryComboBox(); lineEdit->setClearButtonShown(true);
KLineEdit *lineEdit = new KLineEdit(q); combo->setLineEdit(lineEdit);
lineEdit->setClearButtonShown(true); combo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
combo->setLineEdit(lineEdit); combo->setDuplicatesEnabled( false );
combo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon); KConfigGroup cg( KGlobal::config(), QString::fromLatin1("Open-with settings") );
combo->setDuplicatesEnabled( false ); int max = cg.readEntry( "Maximum history", 15 );
KConfigGroup cg( KGlobal::config(), QString::fromLatin1("Open-with settings") ); combo->setMaxCount( max );
int max = cg.readEntry( "Maximum history", 15 ); int mode = cg.readEntry( "CompletionMode", int(KGlobalSettings::completionMode()));
combo->setMaxCount( max ); combo->setCompletionMode((KGlobalSettings::Completion)mode);
int mode = cg.readEntry( "CompletionMode", int(KGlobalSettings::completionMode())); const QStringList list = cg.readEntry( "History", QStringList() );
combo->setCompletionMode((KGlobalSettings::Completion)mode); combo->setHistoryItems( list, true );
const QStringList list = cg.readEntry( "History", QStringList() ); edit = new KUrlRequester( combo, mainWidget );
combo->setHistoryItems( list, true );
edit = new KUrlRequester( combo, mainWidget );
}
else
{
edit = new KUrlRequester( mainWidget );
edit->lineEdit()->setReadOnly(true);
edit->button()->hide();
}
edit->setText( _value ); edit->setText( _value );
edit->setWhatsThis(i18n( edit->setWhatsThis(i18n(
@ -635,9 +625,7 @@ void KOpenWithDialogPrivate::init(const QString &_text, const QString &_value)
q, SLOT(_k_slotDbClick())); q, SLOT(_k_slotDbClick()));
terminal = new QCheckBox( i18n("Run in &terminal"), mainWidget ); terminal = new QCheckBox( i18n("Run in &terminal"), mainWidget );
if (bReadOnly) QObject::connect(terminal, SIGNAL(toggled(bool)), q, SLOT(slotTerminalToggled(bool)));
terminal->hide();
QObject::connect(terminal, SIGNAL(toggled(bool)), q, SLOT(slotTerminalToggled(bool)));
topLayout->addWidget(terminal); topLayout->addWidget(terminal);
@ -660,7 +648,7 @@ void KOpenWithDialogPrivate::init(const QString &_text, const QString &_value)
KConfigGroup confGroup( KGlobal::config(), QString::fromLatin1("General") ); KConfigGroup confGroup( KGlobal::config(), QString::fromLatin1("General") );
QString preferredTerminal = confGroup.readPathEntry("TerminalApplication", QString::fromLatin1("konsole")); QString preferredTerminal = confGroup.readPathEntry("TerminalApplication", QString::fromLatin1("konsole"));
if (bReadOnly || preferredTerminal != "konsole") if (preferredTerminal != "konsole")
nocloseonexit->hide(); nocloseonexit->hide();
nocloseonexitLayout->addWidget( nocloseonexit ); nocloseonexitLayout->addWidget( nocloseonexit );

View file

@ -927,9 +927,6 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
button->setText(i18n("File Type Options")); button->setText(i18n("File Type Options"));
connect( button, SIGNAL(clicked()), SLOT(slotEditFileType())); connect( button, SIGNAL(clicked()), SLOT(slotEditFileType()));
if (!KAuthorized::authorizeKAction("editfiletype"))
button->hide();
} }
if ( !magicMimeComment.isEmpty() && magicMimeComment != mimeComment ) if ( !magicMimeComment.isEmpty() && magicMimeComment != mimeComment )
@ -3388,9 +3385,7 @@ bool KDesktopPropsPlugin::supports( const KFileItemList& _items )
} }
KDesktopFile config(url.toLocalFile()); KDesktopFile config(url.toLocalFile());
return config.hasApplicationType() && return config.hasApplicationType();
KAuthorized::authorize("run_desktop_files") &&
KAuthorized::authorize("shell_access");
} }
#include "moc_kpropertiesdialog.cpp" #include "moc_kpropertiesdialog.cpp"

View file

@ -430,7 +430,7 @@ int KFileItemActions::addServiceActionsTo(QMenu* mainMenu)
// static // static
KService::List KFileItemActions::associatedApplications(const QStringList& mimeTypeList, const QString& traderConstraint) KService::List KFileItemActions::associatedApplications(const QStringList& mimeTypeList, const QString& traderConstraint)
{ {
if (!KAuthorized::authorizeKAction("openwith") || mimeTypeList.isEmpty()) { if (mimeTypeList.isEmpty()) {
return KService::List(); return KService::List();
} }
@ -496,10 +496,6 @@ static KService::Ptr preferredService(const QString& mimeType, const QString& co
void KFileItemActions::addOpenWithActionsTo(QMenu* topMenu, const QString& traderConstraint) void KFileItemActions::addOpenWithActionsTo(QMenu* topMenu, const QString& traderConstraint)
{ {
if (!KAuthorized::authorizeKAction("openwith")) {
return;
}
d->m_traderConstraint = traderConstraint; d->m_traderConstraint = traderConstraint;
KService::List offers = associatedApplications(d->m_mimeTypeList, traderConstraint); KService::List offers = associatedApplications(d->m_mimeTypeList, traderConstraint);

View file

@ -117,7 +117,6 @@ bool KRun::isExecutableFile(const KUrl& url, const QString &mimetype)
bool KRun::runUrl(const KUrl& u, const QString& _mimetype, QWidget* window, bool tempFile, bool runExecutables, const QString& suggestedFileName, const QByteArray& asn) bool KRun::runUrl(const KUrl& u, const QString& _mimetype, QWidget* window, bool tempFile, bool runExecutables, const QString& suggestedFileName, const QByteArray& asn)
{ {
bool noRun = false; bool noRun = false;
bool noAuth = false;
if (_mimetype == QLatin1String("inode/directory-locked")) { if (_mimetype == QLatin1String("inode/directory-locked")) {
KMessageBoxWrapper::error(window, KMessageBoxWrapper::error(window,
i18n("<qt>Unable to enter <b>%1</b>.\nYou do not have access rights to this location.</qt>", Qt::escape(u.prettyUrl()))); i18n("<qt>Unable to enter <b>%1</b>.\nYou do not have access rights to this location.</qt>", Qt::escape(u.prettyUrl())));
@ -130,13 +129,8 @@ bool KRun::runUrl(const KUrl& u, const QString& _mimetype, QWidget* window, bool
} }
else if (isExecutableFile(u, _mimetype)) { else if (isExecutableFile(u, _mimetype)) {
if (u.isLocalFile() && runExecutables) { if (u.isLocalFile() && runExecutables) {
if (KAuthorized::authorize("shell_access")) { return (KRun::runCommand(KShell::quoteArg(u.toLocalFile()), QString(), QString(), window, asn, u.directory())); // just execute the url as a command
return (KRun::runCommand(KShell::quoteArg(u.toLocalFile()), QString(), QString(), window, asn, u.directory())); // just execute the url as a command // ## TODO implement deleting the file if tempFile==true
// ## TODO implement deleting the file if tempFile==true
}
else {
noAuth = true;
}
} }
else if (_mimetype == QLatin1String("application/x-executable")) { else if (_mimetype == QLatin1String("application/x-executable")) {
noRun = true; noRun = true;
@ -146,10 +140,6 @@ bool KRun::runUrl(const KUrl& u, const QString& _mimetype, QWidget* window, bool
if (!runExecutables) { if (!runExecutables) {
noRun = true; noRun = true;
} }
if (!KAuthorized::authorize("shell_access")) {
noAuth = true;
}
} }
if (noRun) { if (noRun) {
@ -158,11 +148,6 @@ bool KRun::runUrl(const KUrl& u, const QString& _mimetype, QWidget* window, bool
"For safety it will not be started.</qt>", Qt::escape(u.prettyUrl()))); "For safety it will not be started.</qt>", Qt::escape(u.prettyUrl())));
return false; return false;
} }
if (noAuth) {
KMessageBoxWrapper::error(window,
i18n("<qt>You do not have permission to run <b>%1</b>.</qt>", Qt::escape(u.prettyUrl())));
return false;
}
KUrl::List lst; KUrl::List lst;
lst.append(u); lst.append(u);
@ -182,12 +167,6 @@ bool KRun::runUrl(const KUrl& u, const QString& _mimetype, QWidget* window, bool
bool KRun::displayOpenWithDialog(const KUrl::List& lst, QWidget* window, bool tempFiles, bool KRun::displayOpenWithDialog(const KUrl::List& lst, QWidget* window, bool tempFiles,
const QString& suggestedFileName, const QByteArray& asn) const QString& suggestedFileName, const QByteArray& asn)
{ {
if (!KAuthorized::authorizeKAction("openwith")) {
KMessageBox::sorry(window,
i18n("You are not authorized to select an application to open this file."));
return false;
}
KOpenWithDialog l(lst, i18n("Open with:"), QString(), window); KOpenWithDialog l(lst, i18n("Open with:"), QString(), window);
l.setWindowModality(Qt::WindowModal); l.setWindowModality(Qt::WindowModal);
if (l.exec()) { if (l.exec()) {
@ -868,12 +847,6 @@ static bool makeFileExecutable(const QString &fileName)
// to make the file executable or we failed to make it executable. // to make the file executable or we failed to make it executable.
static bool makeServiceExecutable(const KService& service, QWidget* window) static bool makeServiceExecutable(const KService& service, QWidget* window)
{ {
if (!KAuthorized::authorize("run_desktop_files")) {
kWarning() << "No authorization to execute " << service.entryPath();
KMessageBox::sorry(window, i18n("You are not authorized to execute this service."));
return false; // Don't circumvent the Kiosk
}
KGuiItem continueItem = KStandardGuiItem::cont(); KGuiItem continueItem = KStandardGuiItem::cont();
SecureMessageDialog *baseDialog = new SecureMessageDialog(window); SecureMessageDialog *baseDialog = new SecureMessageDialog(window);
@ -1120,16 +1093,6 @@ void KRun::init()
d->startTimer(); d->startTimer();
return; return;
} }
if (!KAuthorized::authorizeUrlAction("open", KUrl(), d->m_strURL)) {
QString msg = KIO::buildErrorString(KIO::ERR_ACCESS_DENIED, d->m_strURL.prettyUrl());
d->m_showingDialog = true;
KMessageBoxWrapper::error(d->m_window, msg);
d->m_showingDialog = false;
d->m_bFault = true;
d->m_bFinished = true;
d->startTimer();
return;
}
if (!d->m_bIsLocalFile && d->m_strURL.isLocalFile()) { if (!d->m_bIsLocalFile && d->m_strURL.isLocalFile()) {
d->m_bIsLocalFile = true; d->m_bIsLocalFile = true;

View file

@ -68,13 +68,6 @@ int main(int argc, char **argv)
return 2; return 2;
} }
if (!KAuthorized::authorize("shell_access"))
{
KMessageBox::sorry(0,
i18n("You do not have permission to access the %1 protocol.", url.protocol()));
return 3;
}
if (!url.user().isEmpty()) if (!url.user().isEmpty())
{ {
cmd << "-l"; cmd << "-l";

View file

@ -204,8 +204,11 @@ endif(PHONON_FOUND)
kde4_add_library(plasma ${LIBRARY_TYPE} ${plasma_LIB_SRCS}) kde4_add_library(plasma ${LIBRARY_TYPE} ${plasma_LIB_SRCS})
target_link_libraries(plasma ${QT_QTUITOOLS_LIBRARY} ${QT_QTWEBKIT_LIBRARY} target_link_libraries(plasma ${QT_QTUITOOLS_LIBRARY} ${QT_QTWEBKIT_LIBRARY}
${QT_QTSCRIPT_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTXML_LIBRARY} ${QT_QTSQL_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} ${QT_QTSCRIPT_LIBRARY} ${QT_QTNETWORK_LIBRARY}
${KDE4_KDEUI_LIBS} ${KDE4_KDNSSD_LIBS} ${KDE4_THREADWEAVER_LIBS} ${PLASMA_EXTRA_LIBS}) ${QT_QTXML_LIBRARY} ${QT_QTSQL_LIBRARY}
${QT_QTDECLARATIVE_LIBRARY} ${KDE4_KDEUI_LIBS}
${KDE4_KDNSSD_LIBS} ${KDE4_THREADWEAVER_LIBS}
${PLASMA_EXTRA_LIBS})
if(X11_FOUND) if(X11_FOUND)
target_link_libraries(plasma ${X11_LIBRARIES}) target_link_libraries(plasma ${X11_LIBRARIES})

View file

@ -1225,9 +1225,8 @@ void Applet::flushPendingConstraintsEvents()
} }
if (d->hasConfigurationInterface) { if (d->hasConfigurationInterface) {
bool canConfig = unlocked || KAuthorized::authorize("plasma/allow_configure_when_locked"); configAction->setVisible(unlocked);
configAction->setVisible(canConfig); configAction->setEnabled(unlocked);
configAction->setEnabled(canConfig);
} }
} }
@ -1253,9 +1252,8 @@ void Applet::flushPendingConstraintsEvents()
action = d->actions->action("configure"); action = d->actions->action("configure");
if (action && d->hasConfigurationInterface) { if (action && d->hasConfigurationInterface) {
bool canConfig = unlocked || KAuthorized::authorize("plasma/allow_configure_when_locked"); action->setVisible(unlocked);
action->setVisible(canConfig); action->setEnabled(unlocked);
action->setEnabled(canConfig);
} }
if (d->extender) { if (d->extender) {
@ -1671,8 +1669,7 @@ void Applet::setHasConfigurationInterface(bool hasInterface)
if (configAction) { if (configAction) {
bool enable = hasInterface; bool enable = hasInterface;
if (enable) { if (enable) {
const bool unlocked = immutability() == Mutable; enable = immutability() == Mutable;
enable = unlocked || KAuthorized::authorize("plasma/allow_configure_when_locked");
} }
configAction->setEnabled(enable); configAction->setEnabled(enable);
} }
@ -1841,7 +1838,7 @@ void Applet::showConfigurationInterface()
return; return;
} }
if (immutability() != Mutable && !KAuthorized::authorize("plasma/allow_configure_when_locked")) { if (immutability() != Mutable) {
return; return;
} }

View file

@ -590,7 +590,7 @@ void Containment::showContextMenu(const QPointF &containmentPos, const QPoint &s
void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
if (!isContainment() || !KAuthorized::authorizeKAction("plasma/containment_context_menu")) { if (!isContainment()) {
Applet::contextMenuEvent(event); Applet::contextMenuEvent(event);
return; return;
} }
@ -642,12 +642,6 @@ void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void ContainmentPrivate::addContainmentActions(KMenu &desktopMenu, QEvent *event) void ContainmentPrivate::addContainmentActions(KMenu &desktopMenu, QEvent *event)
{ {
if (static_cast<Corona*>(q->scene())->immutability() != Mutable &&
!KAuthorized::authorizeKAction("plasma/containment_actions")) {
//kDebug() << "immutability";
return;
}
const QString trigger = ContainmentActions::eventToString(event); const QString trigger = ContainmentActions::eventToString(event);
prepareContainmentActions(trigger, QPoint(), &desktopMenu); prepareContainmentActions(trigger, QPoint(), &desktopMenu);
} }
@ -1998,7 +1992,7 @@ void Containment::destroy(bool confirm)
void ContainmentPrivate::createToolBox() void ContainmentPrivate::createToolBox()
{ {
if (!toolBox && KAuthorized::authorizeKAction("plasma/containment_context_menu")) { if (!toolBox) {
toolBox = Plasma::AbstractToolBox::load(q->corona()->preferredToolBoxPlugin(type), QVariantList(), q); toolBox = Plasma::AbstractToolBox::load(q->corona()->preferredToolBoxPlugin(type), QVariantList(), q);
if (toolBox) { if (toolBox) {

View file

@ -188,9 +188,7 @@ void Corona::initializeLayout(const QString &configName)
} }
} }
if (config()->isImmutable() || if (config()->isImmutable()) {
!KAuthorized::authorize("plasma/" + KGlobal::mainComponent().aboutData()->appName() +
"/unlockedDesktop")) {
setImmutability(SystemImmutable); setImmutability(SystemImmutable);
} else { } else {
KConfigGroup coronaConfig(config(), "General"); KConfigGroup coronaConfig(config(), "General");