diff --git a/applets/kimpanel/backend/scim/main.cpp b/applets/kimpanel/backend/scim/main.cpp --- a/applets/kimpanel/backend/scim/main.cpp +++ b/applets/kimpanel/backend/scim/main.cpp @@ -435,7 +435,7 @@ } protected: - bool event(QEvent *e) { + bool event(QEvent *e) override { QStringList list_result; QList prop_list; if (e->type() == dbus_event_type) { @@ -750,7 +750,7 @@ public: explicit PanelAgentThread(QObject *parent = nullptr): QThread(parent) {} ~PanelAgentThread() {} - void run() { + void run() override { if (!_panel_agent->run()) std::cerr << "Failed to run Panel.\n"; _global_resource_lock.lock(); diff --git a/applets/taskmanager/package/contents/ui/ContextMenu.qml b/applets/taskmanager/package/contents/ui/ContextMenu.qml --- a/applets/taskmanager/package/contents/ui/ContextMenu.qml +++ b/applets/taskmanager/package/contents/ui/ContextMenu.qml @@ -95,21 +95,42 @@ } function loadDynamicLaunchActions(launcherUrl) { - var lists = [ - backend.jumpListActions(launcherUrl, menu), - backend.placesActions(launcherUrl, showAllPlaces, menu), - backend.recentDocumentActions(launcherUrl, menu) + var sections = [ + { + title: i18n("Places"), + group: "places", + actions: backend.placesActions(launcherUrl, showAllPlaces, menu) + }, + { + title: i18n("Recent Documents"), + group: "recents", + actions: backend.recentDocumentActions(launcherUrl, menu) + }, + { + title: i18n("Actions"), + group: "actions", + actions: backend.jumpListActions(launcherUrl, menu) + } ] // QMenu does not limit its width automatically. Even if we set a maximumWidth // it would just cut off text rather than eliding. So we do this manually. var textMetrics = Qt.createQmlObject("import QtQuick 2.4; TextMetrics {}", menu); var maximumWidth = LayoutManager.maximumContextMenuTextWidth(); - lists.forEach(function (list) { - for (var i = 0; i < list.length; ++i) { + sections.forEach(function (section) { + // Always show the "Actions:" header, since we visually merge + // This section with the one beneath it that shows universal actions + if (section["actions"].length > 0 || section["group"] == "actions") { + var sectionHeader = newMenuItem(menu); + sectionHeader.text = section["title"]; + sectionHeader.section = true; + menu.addMenuItem(sectionHeader, startNewInstanceItem); + } + + for (var i = 0; i < section["actions"].length; ++i) { var item = newMenuItem(menu); - item.action = list[i]; + item.action = section["actions"][i]; // Crude way of manually eliding... var elided = false; @@ -126,11 +147,7 @@ item.action.text += "..."; } - menu.addMenuItem(item, virtualDesktopsMenuItem); - } - - if (list.length > 0) { - menu.addMenuItem(newSeparator(menu), virtualDesktopsMenuItem); + menu.addMenuItem(item, startNewInstanceItem); } }); @@ -151,7 +168,7 @@ menuItem.clicked.connect(function() { mpris2Source.goPrevious(sourceName); }); - menu.addMenuItem(menuItem, virtualDesktopsMenuItem); + menu.addMenuItem(menuItem, startNewInstanceItem); menuItem = menu.newMenuItem(menu); // PlasmaCore Menu doesn't actually handle icons or labels changing at runtime... @@ -172,7 +189,7 @@ mpris2Source.play(sourceName); } }); - menu.addMenuItem(menuItem, virtualDesktopsMenuItem); + menu.addMenuItem(menuItem, startNewInstanceItem); menuItem = menu.newMenuItem(menu); menuItem.text = i18nc("Play next track", "Next Track"); @@ -183,7 +200,7 @@ menuItem.clicked.connect(function() { mpris2Source.goNext(sourceName); }); - menu.addMenuItem(menuItem, virtualDesktopsMenuItem); + menu.addMenuItem(menuItem, startNewInstanceItem); menuItem = menu.newMenuItem(menu); menuItem.text = i18nc("Stop playback", "Stop"); @@ -194,12 +211,12 @@ menuItem.clicked.connect(function() { mpris2Source.stop(sourceName); }); - menu.addMenuItem(menuItem, virtualDesktopsMenuItem); + menu.addMenuItem(menuItem, startNewInstanceItem); // Technically media controls and audio streams are separate but for the user they're // semantically related, don't add a separator inbetween. if (!menu.visualParent.hasAudioStream) { - menu.addMenuItem(newSeparator(menu), virtualDesktopsMenuItem); + menu.addMenuItem(newSeparator(menu), startNewInstanceItem); } // If we don't have a window associated with the player but we can quit @@ -249,13 +266,25 @@ }); muteItem.text = i18n("Mute"); muteItem.icon = "audio-volume-muted"; - menu.addMenuItem(muteItem, virtualDesktopsMenuItem); + menu.addMenuItem(muteItem, startNewInstanceItem); - menu.addMenuItem(newSeparator(menu), virtualDesktopsMenuItem); + menu.addMenuItem(newSeparator(menu), startNewInstanceItem); } } PlasmaComponents.MenuItem { + id: startNewInstanceItem + visible: (visualParent && get(atm.IsLauncher) !== true && get(atm.IsStartup) !== true) + + enabled: visualParent && get(atm.LauncherUrlWithoutIcon) !== "" + + text: i18n("Start New Instance") + icon: "list-add-symbolic" + + onClicked: tasksModel.requestNewInstance(modelIndex) + } + + PlasmaComponents.MenuItem { id: virtualDesktopsMenuItem visible: virtualDesktopInfo.numberOfDesktops > 1 @@ -427,43 +456,156 @@ } } - PlasmaComponents.MenuItem { + id: moreActionsMenuItem + visible: (visualParent && get(atm.IsLauncher) !== true && get(atm.IsStartup) !== true) - enabled: visualParent && get(atm.IsMinimizable) === true + enabled: visible - checkable: true - checked: visualParent && get(atm.IsMinimized) === true + text: i18n("More Actions") + icon: "view-more-symbolic" - text: i18n("Mi&nimize") + PlasmaComponents.ContextMenu { + visualParent: moreActionsMenuItem.action - onClicked: tasksModel.requestToggleMinimized(modelIndex) - } + PlasmaComponents.MenuItem { + enabled: menu.visualParent && menu.get(atm.IsMovable) === true - PlasmaComponents.MenuItem { - visible: (visualParent && get(atm.IsLauncher) !== true && get(atm.IsStartup) !== true) + text: i18n("&Move") + icon: "transform-move" - enabled: visualParent && get(atm.IsMaximizable) === true + onClicked: tasksModel.requestMove(menu.modelIndex) + } - checkable: true - checked: visualParent && get(atm.IsMaximized) === true + PlasmaComponents.MenuItem { + enabled: menu.visualParent && menu.get(atm.IsResizable) === true - text: i18n("Ma&ximize") + text: i18n("Re&size") + icon: "transform-scale" - onClicked: tasksModel.requestToggleMaximized(modelIndex) - } + onClicked: tasksModel.requestResize(menu.modelIndex) + } - PlasmaComponents.MenuItem { - id: startNewInstanceItem - visible: (visualParent && get(atm.IsLauncher) !== true && get(atm.IsStartup) !== true) + PlasmaComponents.MenuItem { + visible: (menu.visualParent && get(atm.IsLauncher) !== true && get(atm.IsStartup) !== true) - enabled: visualParent && get(atm.LauncherUrlWithoutIcon) !== "" + enabled: menu.visualParent && get(atm.IsMaximizable) === true - text: i18n("Start New Instance") - icon: "system-run" + checkable: true + checked: menu.visualParent && get(atm.IsMaximized) === true - onClicked: tasksModel.requestNewInstance(modelIndex) + text: i18n("Ma&ximize") + icon: "window-maximize" + + onClicked: tasksModel.requestToggleMaximized(modelIndex) + } + + PlasmaComponents.MenuItem { + visible: (menu.visualParent && get(atm.IsLauncher) !== true && get(atm.IsStartup) !== true) + + enabled: menu.visualParent && get(atm.IsMinimizable) === true + + checkable: true + checked: menu.visualParent && get(atm.IsMinimized) === true + + text: i18n("Mi&nimize") + icon: "window-minimize" + + onClicked: tasksModel.requestToggleMinimized(modelIndex) + } + + PlasmaComponents.MenuItem { + checkable: true + checked: menu.visualParent && menu.get(atm.IsKeepAbove) === true + + text: i18n("Keep &Above Others") + icon: "window-keep-above" + + onClicked: tasksModel.requestToggleKeepAbove(menu.modelIndex) + } + + PlasmaComponents.MenuItem { + checkable: true + checked: menu.visualParent && menu.get(atm.IsKeepBelow) === true + + text: i18n("Keep &Below Others") + icon: "window-keep-below" + + onClicked: tasksModel.requestToggleKeepBelow(menu.modelIndex) + } + + PlasmaComponents.MenuItem { + enabled: menu.visualParent && menu.get(atm.IsFullScreenable) === true + + checkable: true + checked: menu.visualParent && menu.get(atm.IsFullScreen) === true + + text: i18n("&Fullscreen") + icon: "view-fullscreen" + + onClicked: tasksModel.requestToggleFullScreen(menu.modelIndex) + } + + PlasmaComponents.MenuItem { + enabled: menu.visualParent && menu.get(atm.IsShadeable) === true + + checkable: true + checked: menu.visualParent && menu.get(atm.IsShaded) === true + + text: i18n("&Shade") + icon: "window-shade" + + onClicked: tasksModel.requestToggleShaded(menu.modelIndex) + } + + PlasmaComponents.MenuItem { + separator: true + } + + PlasmaComponents.MenuItem { + visible: (plasmoid.configuration.groupingStrategy !== 0) && menu.get(atm.IsWindow) === true + + checkable: true + checked: menu.visualParent && menu.get(atm.IsGroupable) === true + + text: i18n("Allow this program to be grouped") + + onClicked: tasksModel.requestToggleGrouping(menu.modelIndex) + } + + PlasmaComponents.MenuItem { + separator: true + } + + PlasmaComponents.MenuItem { + property QtObject configureAction: null + + enabled: configureAction && configureAction.enabled + visible: configureAction && configureAction.visible + + text: configureAction ? configureAction.text : "" + icon: configureAction ? configureAction.icon : "" + + onClicked: configureAction.trigger() + + Component.onCompleted: configureAction = plasmoid.action("configure") + } + + PlasmaComponents.MenuItem { + property QtObject alternativesAction: null + + enabled: alternativesAction && alternativesAction.enabled + visible: alternativesAction && alternativesAction.visible + + text: alternativesAction ? alternativesAction.text : "" + icon: alternativesAction ? alternativesAction.icon : "" + + onClicked: alternativesAction.trigger() + + Component.onCompleted: alternativesAction = plasmoid.action("alternatives") + } + } } PlasmaComponents.MenuItem { @@ -479,7 +621,8 @@ checkable: true - text: i18nc("Toggle action for showing a launcher button while the application is not running", "&Pin") + text: i18n("&Pin to Task Manager") + icon: "window-pin" onClicked: { if (tasksModel.launcherPosition(get(atm.LauncherUrlWithoutIcon)) !== -1) { @@ -493,7 +636,8 @@ PlasmaComponents.MenuItem { id: showLauncherInActivitiesItem - text: i18n("&Pin") + text: i18n("&Pin to Task Manager") + icon: "window-pin" visible: visualParent && get(atm.IsLauncher) !== true @@ -572,139 +716,14 @@ PlasmaComponents.MenuItem { visible: (visualParent && get(atm.IsLauncher) === true) && plasmoid.immutability !== PlasmaCore.Types.SystemImmutable - text: i18nc("Remove launcher button for application shown while it is not running", "Unpin") + text: i18n("Unpin from Task Manager") + icon: "window-unpin" onClicked: { tasksModel.requestRemoveLauncher(get(atm.LauncherUrlWithoutIcon)); } } - - PlasmaComponents.MenuItem { - id: moreActionsMenuItem - - visible: (visualParent && get(atm.IsLauncher) !== true && get(atm.IsStartup) !== true) - - enabled: visible - - text: i18n("More Actions") - - PlasmaComponents.ContextMenu { - visualParent: moreActionsMenuItem.action - - PlasmaComponents.MenuItem { - enabled: menu.visualParent && menu.get(atm.IsMovable) === true - - text: i18n("&Move") - icon: "transform-move" - - onClicked: tasksModel.requestMove(menu.modelIndex) - } - - PlasmaComponents.MenuItem { - enabled: menu.visualParent && menu.get(atm.IsResizable) === true - - text: i18n("Re&size") - - onClicked: tasksModel.requestResize(menu.modelIndex) - } - - PlasmaComponents.MenuItem { - checkable: true - checked: menu.visualParent && menu.get(atm.IsKeepAbove) === true - - text: i18n("Keep &Above Others") - icon: "go-up" - - onClicked: tasksModel.requestToggleKeepAbove(menu.modelIndex) - } - - PlasmaComponents.MenuItem { - checkable: true - checked: menu.visualParent && menu.get(atm.IsKeepBelow) === true - - text: i18n("Keep &Below Others") - icon: "go-down" - - onClicked: tasksModel.requestToggleKeepBelow(menu.modelIndex) - } - - PlasmaComponents.MenuItem { - enabled: menu.visualParent && menu.get(atm.IsFullScreenable) === true - - checkable: true - checked: menu.visualParent && menu.get(atm.IsFullScreen) === true - - text: i18n("&Fullscreen") - icon: "view-fullscreen" - - onClicked: tasksModel.requestToggleFullScreen(menu.modelIndex) - } - - PlasmaComponents.MenuItem { - enabled: menu.visualParent && menu.get(atm.IsShadeable) === true - - checkable: true - checked: menu.visualParent && menu.get(atm.IsShaded) === true - - text: i18n("&Shade") - - onClicked: tasksModel.requestToggleShaded(menu.modelIndex) - } - - PlasmaComponents.MenuItem { - separator: true - } - - PlasmaComponents.MenuItem { - visible: (plasmoid.configuration.groupingStrategy !== 0) && menu.get(atm.IsWindow) === true - - checkable: true - checked: menu.visualParent && menu.get(atm.IsGroupable) === true - - text: i18n("Allow this program to be grouped") - - onClicked: tasksModel.requestToggleGrouping(menu.modelIndex) - } - } - } - - PlasmaComponents.MenuItem { - separator: true - } - - PlasmaComponents.MenuItem { - property QtObject configureAction: null - - enabled: configureAction && configureAction.enabled - visible: configureAction && configureAction.visible - - text: configureAction ? configureAction.text : "" - icon: configureAction ? configureAction.icon : "" - - onClicked: configureAction.trigger() - - Component.onCompleted: configureAction = plasmoid.action("configure") - } - - PlasmaComponents.MenuItem { - property QtObject alternativesAction: null - - enabled: alternativesAction && alternativesAction.enabled - visible: alternativesAction && alternativesAction.visible - - text: alternativesAction ? alternativesAction.text : "" - icon: alternativesAction ? alternativesAction.icon : "" - - onClicked: alternativesAction.trigger() - - Component.onCompleted: alternativesAction = plasmoid.action("alternatives") - } - - PlasmaComponents.MenuItem { - separator: true - } - PlasmaComponents.MenuItem { id: closeWindowItem visible: (visualParent && get(atm.IsLauncher) !== true && get(atm.IsStartup) !== true) diff --git a/applets/taskmanager/plugin/backend.cpp b/applets/taskmanager/plugin/backend.cpp --- a/applets/taskmanager/plugin/backend.cpp +++ b/applets/taskmanager/plugin/backend.cpp @@ -348,6 +348,7 @@ if (actionCount > 0) { QAction *action = new QAction(parent); action->setText(i18n("Forget Recent Documents")); + action->setIcon(QIcon::fromTheme(QStringLiteral("edit-clear-history"))); action->setProperty("agent", storageId); connect(action, &QAction::triggered, this, &Backend::handleRecentDocumentAction); diff --git a/kcms/colors/editor/scmeditorcolors.cpp b/kcms/colors/editor/scmeditorcolors.cpp --- a/kcms/colors/editor/scmeditorcolors.cpp +++ b/kcms/colors/editor/scmeditorcolors.cpp @@ -72,10 +72,10 @@ commonColorTable->verticalHeader()->hide(); commonColorTable->horizontalHeader()->hide(); commonColorTable->setShowGrid(false); - commonColorTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); + commonColorTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); int minWidth = QPushButton(i18n("Varies")).minimumSizeHint().width(); commonColorTable->horizontalHeader()->setMinimumSectionSize(minWidth); - commonColorTable->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents); + commonColorTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents); for (int i = 0; i < 26; ++i) { @@ -112,7 +112,7 @@ colorTable->setShowGrid(false); colorTable->setRowCount(12); colorTable->horizontalHeader()->setMinimumSectionSize(minWidth); - colorTable->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents); + colorTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents); createColorEntry(i18n("Normal Background"), QStringLiteral("BackgroundNormal"), m_backgroundButtons, 0); createColorEntry(i18n("Alternate Background"), QStringLiteral("BackgroundAlternate"), m_backgroundButtons, 1); @@ -127,8 +127,8 @@ createColorEntry(i18n("Focus Decoration"), QStringLiteral("DecorationFocus"), m_decorationButtons, 10); createColorEntry(i18n("Hover Decoration"), QStringLiteral("DecorationHover"), m_decorationButtons, 11); - colorTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); - colorTable->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents); + colorTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); + colorTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents); updateColorSchemes(); updateColorTable(); diff --git a/kcms/hardware/joystick/joywidget.cpp b/kcms/hardware/joystick/joywidget.cpp --- a/kcms/hardware/joystick/joywidget.cpp +++ b/kcms/hardware/joystick/joywidget.cpp @@ -122,22 +122,22 @@ buttonTbl->setEditTriggers(QAbstractItemView::NoEditTriggers); buttonTbl->setHorizontalHeaderLabels(QStringList(i18n("State"))); buttonTbl->setSortingEnabled(false); - buttonTbl->horizontalHeader()->setClickable(false); - buttonTbl->horizontalHeader()->setResizeMode(QHeaderView::Stretch); + buttonTbl->horizontalHeader()->setSectionsClickable(false); + buttonTbl->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); buttonTbl->horizontalHeader()->resizeSection(0, colWidth); - buttonTbl->verticalHeader()->setClickable(false); + buttonTbl->verticalHeader()->setSectionsClickable(false); vboxMid->addWidget(buttonTbl); vboxRight->addWidget(new QLabel(i18n("Axes:"))); axesTbl = new TableWidget(0, 1); axesTbl->setSelectionMode(QAbstractItemView::NoSelection); axesTbl->setEditTriggers(QAbstractItemView::NoEditTriggers); axesTbl->setHorizontalHeaderLabels(QStringList(i18n("Value"))); axesTbl->setSortingEnabled(false); - axesTbl->horizontalHeader()->setClickable(false); - axesTbl->horizontalHeader()->setResizeMode(QHeaderView::Stretch); + axesTbl->horizontalHeader()->setSectionsClickable(false); + axesTbl->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); axesTbl->horizontalHeader()->resizeSection(0, colWidth); - axesTbl->verticalHeader()->setClickable(false); + axesTbl->verticalHeader()->setSectionsClickable(false); vboxRight->addWidget(axesTbl); hbox->addLayout(vboxLeft); diff --git a/kcms/krdb/krdb.cpp b/kcms/krdb/krdb.cpp --- a/kcms/krdb/krdb.cpp +++ b/kcms/krdb/krdb.cpp @@ -140,7 +140,7 @@ clr = wmCfgGroup.readEntry("activeBackground", clr); settings.setValue(QStringLiteral("/qt/KWinPalette/activeBackground"), clr.name()); if (QPixmap::defaultDepth() > 8) - clr = clr.dark(110); + clr = clr.darker(110); clr = wmCfgGroup.readEntry("activeBlend", clr); settings.setValue(QStringLiteral("/qt/KWinPalette/activeBlend"), clr.name()); clr = newPal.color( QPalette::Active, QPalette::HighlightedText ); @@ -157,10 +157,10 @@ clr = wmCfgGroup.readEntry("inactiveBackground", clr); settings.setValue(QStringLiteral("/qt/KWinPalette/inactiveBackground"), clr.name()); if (QPixmap::defaultDepth() > 8) - clr = clr.dark(110); + clr = clr.darker(110); clr = wmCfgGroup.readEntry("inactiveBlend", clr); settings.setValue(QStringLiteral("/qt/KWinPalette/inactiveBlend"), clr.name()); - clr = newPal.color(QPalette::Inactive, QPalette::Window).dark(); + clr = newPal.color(QPalette::Inactive, QPalette::Window).darker(); clr = wmCfgGroup.readEntry("inactiveForeground", clr); settings.setValue(QStringLiteral("/qt/KWinPalette/inactiveForeground"), clr.name()); clr = newPal.color(QPalette::Inactive, QPalette::Window); @@ -442,8 +442,8 @@ QColor backCol = newPal.color( QPalette::Active, QPalette::Window ); addColorDef(preproc, "FOREGROUND" , newPal.color( QPalette::Active, QPalette::WindowText ) ); addColorDef(preproc, "BACKGROUND" , backCol); - addColorDef(preproc, "HIGHLIGHT" , backCol.light(100+(2*KColorScheme::contrast()+4)*16/1)); - addColorDef(preproc, "LOWLIGHT" , backCol.dark(100+(2*KColorScheme::contrast()+4)*10)); + addColorDef(preproc, "HIGHLIGHT" , backCol.lighter(100+(2*KColorScheme::contrast()+4)*16/1)); + addColorDef(preproc, "LOWLIGHT" , backCol.darker(100+(2*KColorScheme::contrast()+4)*10)); addColorDef(preproc, "SELECT_BACKGROUND" , newPal.color( QPalette::Active, QPalette::Highlight)); addColorDef(preproc, "SELECT_FOREGROUND" , newPal.color( QPalette::Active, QPalette::HighlightedText)); addColorDef(preproc, "WINDOW_BACKGROUND" , newPal.color( QPalette::Active, QPalette::Base ) );