Changeset View
Changeset View
Standalone View
Standalone View
src/plasma/corona.cpp
Show First 20 Lines • Show All 361 Lines • ▼ Show 20 Line(s) | 354 | #endif | |||
---|---|---|---|---|---|
362 | if (action) { | 362 | if (action) { | ||
363 | if (d->immutability == Types::SystemImmutable) { | 363 | if (d->immutability == Types::SystemImmutable) { | ||
364 | action->setEnabled(false); | 364 | action->setEnabled(false); | ||
365 | action->setVisible(false); | 365 | action->setVisible(false); | ||
366 | } else { | 366 | } else { | ||
367 | bool unlocked = d->immutability == Types::Mutable; | 367 | bool unlocked = d->immutability == Types::Mutable; | ||
368 | action->setText(unlocked ? i18n("Lock Widgets") : i18n("Unlock Widgets")); | 368 | action->setText(unlocked ? i18n("Lock Widgets") : i18n("Unlock Widgets")); | ||
369 | action->setIcon(QIcon::fromTheme(unlocked ? QStringLiteral("object-locked") : QStringLiteral("object-unlocked"))); | 369 | action->setIcon(QIcon::fromTheme(unlocked ? QStringLiteral("object-locked") : QStringLiteral("object-unlocked"))); | ||
370 | action->setEnabled(true); | 370 | action->setEnabled(!unlocked); | ||
371 | action->setVisible(true); | 371 | action->setVisible(!unlocked); | ||
372 | } | 372 | } | ||
373 | } | 373 | } | ||
374 | 374 | | |||
375 | if (d->immutability != Types::SystemImmutable) { | 375 | if (d->immutability != Types::SystemImmutable) { | ||
376 | KConfigGroup cg(config(), "General"); | 376 | KConfigGroup cg(config(), "General"); | ||
377 | 377 | | |||
378 | // we call the dptr member directly for locked since isImmutable() | 378 | // we call the dptr member directly for locked since isImmutable() | ||
379 | // also checks kiosk and parent containers | 379 | // also checks kiosk and parent containers | ||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | 429 | { | |||
438 | QAction *lockAction = actions.add<QAction>(QStringLiteral("lock widgets")); | 438 | QAction *lockAction = actions.add<QAction>(QStringLiteral("lock widgets")); | ||
439 | QObject::connect(lockAction, SIGNAL(triggered(bool)), q, SLOT(toggleImmutability())); | 439 | QObject::connect(lockAction, SIGNAL(triggered(bool)), q, SLOT(toggleImmutability())); | ||
440 | lockAction->setText(i18n("Lock Widgets")); | 440 | lockAction->setText(i18n("Lock Widgets")); | ||
441 | lockAction->setAutoRepeat(true); | 441 | lockAction->setAutoRepeat(true); | ||
442 | lockAction->setIcon(QIcon::fromTheme(QStringLiteral("object-locked"))); | 442 | lockAction->setIcon(QIcon::fromTheme(QStringLiteral("object-locked"))); | ||
443 | lockAction->setData(Plasma::Types::ControlAction); | 443 | lockAction->setData(Plasma::Types::ControlAction); | ||
444 | lockAction->setShortcut(QKeySequence(QStringLiteral("alt+d, l"))); | 444 | lockAction->setShortcut(QKeySequence(QStringLiteral("alt+d, l"))); | ||
445 | lockAction->setShortcutContext(Qt::ApplicationShortcut); | 445 | lockAction->setShortcutContext(Qt::ApplicationShortcut); | ||
446 | bool unlocked = immutability == Types::Mutable; | ||||
447 | lockAction->setVisible(!unlocked); | ||||
446 | 448 | | |||
447 | //fake containment/applet actions | 449 | //fake containment/applet actions | ||
448 | KActionCollection *containmentActions = AppletPrivate::defaultActions(q); //containment has to start with applet stuff | 450 | KActionCollection *containmentActions = AppletPrivate::defaultActions(q); //containment has to start with applet stuff | ||
449 | ContainmentPrivate::addDefaultActions(containmentActions); //now it's really containment | 451 | ContainmentPrivate::addDefaultActions(containmentActions); //now it's really containment | ||
450 | } | 452 | } | ||
451 | 453 | | |||
452 | void CoronaPrivate::toggleImmutability() | 454 | void CoronaPrivate::toggleImmutability() | ||
453 | { | 455 | { | ||
▲ Show 20 Lines • Show All 225 Lines • Show Last 20 Lines |