Changeset View
Changeset View
Standalone View
Standalone View
desktop/MigrateShortcuts.cpp
Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | 88 | { | |||
---|---|---|---|---|---|
90 | action->setObjectName(QStringLiteral("ActiveWindowScreenShot")); | 90 | action->setObjectName(QStringLiteral("ActiveWindowScreenShot")); | ||
91 | shortCutActions.addAction(action->objectName(), action); | 91 | shortCutActions.addAction(action->objectName(), action); | ||
92 | } | 92 | } | ||
93 | { | 93 | { | ||
94 | QAction *action = new QAction(i18n("Capture Rectangular Region")); | 94 | QAction *action = new QAction(i18n("Capture Rectangular Region")); | ||
95 | action->setObjectName(QStringLiteral("RectangularRegionScreenShot")); | 95 | action->setObjectName(QStringLiteral("RectangularRegionScreenShot")); | ||
96 | shortCutActions.addAction(action->objectName(), action); | 96 | shortCutActions.addAction(action->objectName(), action); | ||
97 | } | 97 | } | ||
98 | { | ||||
99 | QAction *action = new QAction(i18n("Capture Rectangular Region to Clipboard")); | ||||
100 | action->setObjectName(QStringLiteral("RectangularRegionClipboardScreenShot")); | ||||
101 | shortCutActions.addAction(action->objectName(), action); | ||||
102 | } | ||||
103 | | ||||
98 | QAction* openAction = shortCutActions.action(QStringLiteral("_launch")); | 104 | QAction* openAction = shortCutActions.action(QStringLiteral("_launch")); | ||
99 | KGlobalAccel::self()->setDefaultShortcut(openAction, {Qt::Key_Print}); | 105 | KGlobalAccel::self()->setDefaultShortcut(openAction, {Qt::Key_Print}); | ||
100 | QAction* fullScreenAction = shortCutActions.action(QStringLiteral("FullScreenScreenShot")); | 106 | QAction* fullScreenAction = shortCutActions.action(QStringLiteral("FullScreenScreenShot")); | ||
101 | KGlobalAccel::self()->setDefaultShortcut(fullScreenAction, {Qt::SHIFT + Qt::Key_Print}); | 107 | KGlobalAccel::self()->setDefaultShortcut(fullScreenAction, {Qt::SHIFT + Qt::Key_Print}); | ||
102 | QAction* currentScreenAction = shortCutActions.action(QStringLiteral("CurrentMonitorScreenShot")); | 108 | QAction* currentScreenAction = shortCutActions.action(QStringLiteral("CurrentMonitorScreenShot")); | ||
103 | QAction* activeWindowAction = shortCutActions.action(QStringLiteral("ActiveWindowScreenShot")); | 109 | QAction* activeWindowAction = shortCutActions.action(QStringLiteral("ActiveWindowScreenShot")); | ||
104 | KGlobalAccel::self()->setDefaultShortcut(activeWindowAction, {Qt::META + Qt::Key_Print}); | 110 | KGlobalAccel::self()->setDefaultShortcut(activeWindowAction, {Qt::META + Qt::Key_Print}); | ||
105 | QAction* regionAction = shortCutActions.action(QStringLiteral("RectangularRegionScreenShot")); | 111 | QAction* regionAction = shortCutActions.action(QStringLiteral("RectangularRegionScreenShot")); | ||
106 | KGlobalAccel::self()->setDefaultShortcut(regionAction, {Qt::META + Qt::SHIFT + Qt::Key_Print}); | 112 | KGlobalAccel::self()->setDefaultShortcut(regionAction, {Qt::META + Qt::SHIFT + Qt::Key_Print}); | ||
113 | QAction* regionClipboardAction = shortCutActions.action(QStringLiteral("RectangularRegionClipboardScreenShot")); | ||||
114 | KGlobalAccel::self()->setDefaultShortcut(regionClipboardAction, {Qt::META + Qt::CTRL + Qt::SHIFT + Qt::Key_Print}); | ||||
107 | // Finally reinstate the old shortcuts | 115 | // Finally reinstate the old shortcuts | ||
108 | if (found_spectacle) { | 116 | if (found_spectacle) { | ||
109 | KGlobalAccel::self()->setShortcut(openAction, launchKey, KGlobalAccel::NoAutoloading); | 117 | KGlobalAccel::self()->setShortcut(openAction, launchKey, KGlobalAccel::NoAutoloading); | ||
110 | KGlobalAccel::self()->setShortcut(fullScreenAction, fullScreenKey, KGlobalAccel::NoAutoloading); | 118 | KGlobalAccel::self()->setShortcut(fullScreenAction, fullScreenKey, KGlobalAccel::NoAutoloading); | ||
111 | KGlobalAccel::self()->setShortcut(activeWindowAction, activeWindowKey, KGlobalAccel::NoAutoloading); | 119 | KGlobalAccel::self()->setShortcut(activeWindowAction, activeWindowKey, KGlobalAccel::NoAutoloading); | ||
112 | KGlobalAccel::self()->setShortcut(regionAction, regionKey, KGlobalAccel::NoAutoloading); | 120 | KGlobalAccel::self()->setShortcut(regionAction, regionKey, KGlobalAccel::NoAutoloading); | ||
113 | } | 121 | } | ||
114 | } | 122 | } |