generic: adjust to shortcut changes

notice how the use of primary shortcut only disappears

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-04-24 10:25:20 +03:00
parent f4cec56a9c
commit 36bc690df1
48 changed files with 167 additions and 170 deletions

View file

@ -1260,7 +1260,7 @@ void DolphinMainWindow::setupActions()
KAction* newTab = actionCollection()->addAction("new_tab");
newTab->setIcon(KIcon("tab-new"));
newTab->setText(i18nc("@action:inmenu File", "New Tab"));
newTab->setShortcut(KShortcut(Qt::CTRL | Qt::Key_T, Qt::CTRL | Qt::SHIFT | Qt::Key_N));
newTab->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_T, Qt::CTRL | Qt::SHIFT | Qt::Key_N));
connect(newTab, SIGNAL(triggered()), this, SLOT(openNewTab()));
KAction* closeTab = actionCollection()->addAction("close_tab");
@ -1280,8 +1280,14 @@ void DolphinMainWindow::setupActions()
// need to remove shift+del from cut action, else the shortcut for deletejob
// doesn't work
KAction* cut = KStandardAction::cut(this, SLOT(cut()), actionCollection());
KShortcut cutShortcut = cut->shortcut();
cutShortcut.remove(Qt::SHIFT | Qt::Key_Delete, KShortcut::KeepEmpty);
QKeySequence cutShortcut = cut->shortcut();
static const int shiftdelete = (Qt::SHIFT | Qt::Key_Delete);
if (cutShortcut[0] == shiftdelete) {
cutShortcut = QKeySequence(cutShortcut[1]);
}
if (cutShortcut[0] == shiftdelete) {
cutShortcut = QKeySequence();
}
cut->setShortcut(cutShortcut);
KStandardAction::copy(this, SLOT(copy()), actionCollection());
KAction* paste = KStandardAction::paste(this, SLOT(paste()), actionCollection());
@ -1334,8 +1340,8 @@ void DolphinMainWindow::setupActions()
// setup 'Go' menu
KAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection());
connect(backAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goBack(Qt::MouseButtons)));
KShortcut backShortcut = backAction->shortcut();
backShortcut.setAlternate(Qt::Key_Backspace);
QKeySequence backShortcut = backAction->shortcut();
backShortcut = QKeySequence(backShortcut[0], Qt::Key_Backspace);
backAction->setShortcut(backShortcut);
DolphinRecentTabsMenu* recentTabsMenu = new DolphinRecentTabsMenu(this);
@ -1375,12 +1381,12 @@ void DolphinMainWindow::setupActions()
// not in menu actions
const QKeySequence nextTabKeys = QKeySequence(
KStandardShortcut::tabNext().primary(),
KStandardShortcut::tabNext()[0],
Qt::CTRL | Qt::Key_Tab
);
const QKeySequence prevTabKeys = QKeySequence(
KStandardShortcut::tabPrev().primary(),
KStandardShortcut::tabPrev()[0],
Qt::CTRL | Qt::SHIFT | Qt::Key_Tab
);

View file

@ -68,7 +68,6 @@
#include <kglobal.h>
#include <kglobalsettings.h>
#include <kiconloader.h>
#include <kshortcutsdialog.h>
#include <klineedit.h>
#include <klocale.h>
#include <kmessagebox.h>

View file

@ -66,7 +66,6 @@ namespace KIO
}
class KComboBox;
class KShortcutsEditor;
class KTemporaryFile;
class KIntNumInput;
class KIntSpinBox;

View file

@ -154,9 +154,8 @@ namespace KateMDI
QString aname = QString("kate_mdi_toolview_") + tv->id;
// try to read the action shortcut
KShortcut sc;
KSharedConfig::Ptr cfg = KGlobal::config();
sc = KShortcut( cfg->group("Shortcuts").readEntry( aname, QString() ) );
QKeySequence sc = QKeySequence( cfg->group("Shortcuts").readEntry( aname, QString() ) );
KToggleAction *a = new ToggleToolViewAction(i18n("Show %1", tv->text), tv, this );
a->setShortcut(sc, KAction::ActiveShortcut); // no DefaultShortcut! see bug #144945

View file

@ -20,7 +20,6 @@
#include <KGlobal>
#include <KLocale>
#include <KUrl>
#include <KShortcut>
#include <KWindowSystem>
#include <KPixmapWidget>
#include <kkeyserver.h>

View file

@ -31,7 +31,6 @@
#include <kfiledialog.h>
#include <kapplication.h>
#include <kaboutdata.h>
#include <kshortcut.h>
#include <knotificationconfigwidget.h>
#include <kkeyserver.h>

View file

@ -43,16 +43,16 @@ static void dressUpAction(KAction *action, KStandardShortcut::StandardShortcut s
// hardcoded default and the user set shortcut. But action currently
// only contain the active shortcuts as default shortcut. So we
// have to fill it correctly
KShortcut hardcoded = KStandardShortcut::hardcodedDefaultShortcut(shortcutId);
KShortcut active = KStandardShortcut::shortcut(shortcutId);
QKeySequence hardcoded = KStandardShortcut::hardcodedDefaultShortcut(shortcutId);
QKeySequence active = KStandardShortcut::shortcut(shortcutId);
// Set the hardcoded default shortcut as default shortcut
action->setShortcut(hardcoded, KAction::DefaultShortcut);
// Set the user defined values as active shortcuts. If the user only
// has overwritten the primary shortcut make sure the alternate one
// still get's shown
if (active.alternate()==QKeySequence())
if (active[1] == 0)
{
active.setAlternate(hardcoded.alternate());
active = QKeySequence(active[0], hardcoded[1]);
}
action->setShortcut(active, KAction::ActiveShortcut);
}

View file

@ -40,7 +40,6 @@
#include <KAboutApplicationDialog>
#include <KMessageBox>
#include <KFileDialog>
#include <KShortcut>
#include <KToolBar>
//QT
@ -190,7 +189,7 @@ void KInfoCenter::createMenuFrame()
m_searchText->completionObject()->setIgnoreCase(true);
m_searchAction = new KAction(this);
m_searchAction->setShortcut(KShortcut(QKeySequence(Qt::CTRL + Qt::Key_F)));
m_searchAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F));
m_searchAction->setText(i18nc("Kaction search label", "Search Modules"));
m_searchAction->setIcon(KIcon("edit-find"));

View file

@ -21,7 +21,6 @@
#define BASICTAB_H
#include <KTabWidget>
#include <KShortcut>
#include <KService>
#include <QCheckBox>
#include <QGroupBox>

View file

@ -23,7 +23,6 @@
#include <QList>
#include <KShortcut>
#include <KService>
class MenuFile;

View file

@ -39,7 +39,6 @@ class MenuFile;
class MenuFolderInfo;
class MenuEntryInfo;
class MenuSeparatorInfo;
class KShortcut;
static const QString SAVE_ACTION_NAME = "file_save";
static const QString NEW_ITEM_ACTION_NAME = "new_item";

View file

@ -414,7 +414,7 @@ void Application::startBackgroundMode(MainWindow* window)
KAction* action = window->actionCollection()->addAction("toggle-background-window");
action->setObjectName(QLatin1String("Konsole Background Mode"));
action->setText(i18n("Toggle Background Window"));
action->setGlobalShortcut(KShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_F12)));
action->setGlobalShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_F12));
connect(action, SIGNAL(triggered()),
this, SLOT(toggleBackgroundInstance()));

View file

@ -626,10 +626,7 @@ void SessionController::setupCommonActions()
action->setEnabled(false);
action = KStandardAction::paste(this, SLOT(paste()), collection);
KShortcut pasteShortcut = action->shortcut();
pasteShortcut.setPrimary(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V));
pasteShortcut.setAlternate(QKeySequence(Qt::SHIFT + Qt::Key_Insert));
action->setShortcut(pasteShortcut);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V, Qt::SHIFT + Qt::Key_Insert));
action = collection->addAction("paste-selection", this, SLOT(pasteFromX11Selection()));
action->setText(i18n("Paste Selection"));
@ -762,15 +759,12 @@ void SessionController::setupExtraActions()
action = collection->addAction("enlarge-font", this, SLOT(increaseFontSize()));
action->setText(i18n("Enlarge Font"));
action->setIcon(KIcon("format-font-size-more"));
KShortcut enlargeFontShortcut = action->shortcut();
enlargeFontShortcut.setPrimary(QKeySequence(Qt::CTRL + Qt::Key_Plus));
enlargeFontShortcut.setAlternate(QKeySequence(Qt::CTRL + Qt::Key_Equal));
action->setShortcut(enlargeFontShortcut);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Plus, Qt::CTRL + Qt::Key_Equal));
action = collection->addAction("shrink-font", this, SLOT(decreaseFontSize()));
action->setText(i18n("Shrink Font"));
action->setIcon(KIcon("format-font-size-less"));
action->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Minus));
action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Minus));
// Send signal
KSelectAction* sendSignalActions = collection->add<KSelectAction>("send-signal");

View file

@ -999,22 +999,22 @@ void KSMServer::setupShortcuts()
KAction* a;
a = actionCollection->addAction("Log Out");
a->setText(i18n("Log Out"));
a->setGlobalShortcut(KShortcut(Qt::ALT+Qt::CTRL+Qt::Key_Delete));
a->setGlobalShortcut(QKeySequence(Qt::ALT+Qt::CTRL+Qt::Key_Delete));
connect(a, SIGNAL(triggered(bool)), SLOT(defaultLogout()));
a = actionCollection->addAction("Log Out Without Confirmation");
a->setText(i18n("Log Out Without Confirmation"));
a->setGlobalShortcut(KShortcut(Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_Delete));
a->setGlobalShortcut(QKeySequence(Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_Delete));
connect(a, SIGNAL(triggered(bool)), SLOT(logoutWithoutConfirmation()));
a = actionCollection->addAction("Halt Without Confirmation");
a->setText(i18n("Halt Without Confirmation"));
a->setGlobalShortcut(KShortcut(Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_PageDown));
a->setGlobalShortcut(QKeySequence(Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_PageDown));
connect(a, SIGNAL(triggered(bool)), SLOT(haltWithoutConfirmation()));
a = actionCollection->addAction("Reboot Without Confirmation");
a->setText(i18n("Reboot Without Confirmation"));
a->setGlobalShortcut(KShortcut(Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_PageUp));
a->setGlobalShortcut(QKeySequence(Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_PageUp));
connect(a, SIGNAL(triggered(bool)), SLOT(rebootWithoutConfirmation()));
}

View file

@ -56,8 +56,7 @@ namespace Oxygen
setWindowTitle( i18n( "Oxygen Settings" ) );
// install Quit shortcut
connect( new QShortcut( KStandardShortcut::quit().primary(), this ), SIGNAL(activated()), SLOT(close()) );
connect( new QShortcut( KStandardShortcut::quit().alternate(), this ), SIGNAL(activated()), SLOT(close()) );
connect( new QShortcut( KStandardShortcut::quit(), this ), SIGNAL(activated()), SLOT(close()) );
// tab widget
pageWidget_ = new KPageWidget( this );

View file

@ -56,8 +56,7 @@ namespace Oxygen
setWindowTitle( i18n( "Oxygen Demo" ) );
// install Quit shortcut
connect( new QShortcut( KStandardShortcut::quit().primary(), this ), SIGNAL(activated()), SLOT(close()) );
connect( new QShortcut( KStandardShortcut::quit().alternate(), this ), SIGNAL(activated()), SLOT(close()) );
connect( new QShortcut( KStandardShortcut::quit(), this ), SIGNAL(activated()), SLOT(close()) );
// customize button box
QList<QDialogButtonBox*> children( findChildren<QDialogButtonBox*>() );

View file

@ -29,10 +29,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "toplevel.h"
#include "xcbutils.h"
// KDE
#include <KShortcut>
#include <NETWinInfo>
// Qt
// Katie
#include <QPixmap>
#include <QKeySequence>
// X
#ifdef HAVE_XSYNC
#include <X11/extensions/sync.h>
@ -457,7 +457,7 @@ public:
void shrinkVertical();
bool providesContextHelp() const;
KShortcut shortcut() const;
QKeySequence shortcut() const;
void setShortcut(const QString& cut);
WindowOperation mouseButtonToWindowOperation(Qt::MouseButtons button);
@ -728,7 +728,7 @@ private:
void setCaption(const QString& s, bool force = false);
bool hasTransientInternal(const Client* c, bool indirect, ConstClientList& set) const;
void finishWindowRules();
void setShortcutInternal(const KShortcut& cut);
void setShortcutInternal(const QKeySequence& cut);
void configureRequest(int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool);
NETExtendedStrut strut() const;
@ -910,7 +910,7 @@ private:
int padding_left, padding_right, padding_top, padding_bottom;
QRegion _mask;
static bool check_active_modal; ///< \see Client::checkActiveModal()
KShortcut _shortcut;
QKeySequence _shortcut;
int sm_stacking_order;
friend struct FetchNameInternalPredicate;
friend struct ResetupRulesProcedure;
@ -1178,7 +1178,7 @@ inline xcb_window_t Client::moveResizeGrabWindow() const
return m_moveResizeGrabWindow;
}
inline KShortcut Client::shortcut() const
inline QKeySequence Client::shortcut() const
{
return _shortcut;
}

View file

@ -333,7 +333,7 @@ void Compositor::toggleCompositing()
// when disabled show a shortcut how the user can get back compositing
QString shortcut, message;
if (KAction* action = qobject_cast<KAction*>(Workspace::self()->actionCollection()->action("Suspend Compositing")))
shortcut = action->globalShortcut().primary().toString(QKeySequence::NativeText);
shortcut = action->globalShortcut().toString(QKeySequence::NativeText);
if (!shortcut.isEmpty()) {
// display notification only if there is the shortcut
message = i18n("Desktop effects have been suspended by another application.<br/>"

View file

@ -52,11 +52,11 @@ MagnifierEffect::MagnifierEffect()
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a;
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomIn, this, SLOT(zoomIn())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Equal));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Equal));
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomOut, this, SLOT(zoomOut())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Minus));
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ActualSize, this, SLOT(toggle())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_0));
connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
this, SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
reconfigure(ReconfigureAll);

View file

@ -66,15 +66,15 @@ MagnifierEffectConfig::MagnifierEffectConfig(QWidget* parent, const QVariantList
KAction* a;
a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ZoomIn));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Plus));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Plus));
a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ZoomOut));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Minus));
a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ActualSize));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_0));
m_ui->editor->addCollection(m_actionCollection);
load();

View file

@ -48,11 +48,11 @@ MouseMarkEffect::MouseMarkEffect()
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = static_cast< KAction* >(actionCollection->addAction("ClearMouseMarks"));
a->setText(i18n("Clear All Mouse Marks"));
a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F11));
a->setGlobalShortcut(QKeySequence(Qt::SHIFT + Qt::META + Qt::Key_F11));
connect(a, SIGNAL(triggered(bool)), this, SLOT(clear()));
a = static_cast< KAction* >(actionCollection->addAction("ClearLastMouseMark"));
a->setText(i18n("Clear Last Mouse Mark"));
a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F12));
a->setGlobalShortcut(QKeySequence(Qt::SHIFT + Qt::META + Qt::Key_F12));
connect(a, SIGNAL(triggered(bool)), this, SLOT(clearLast()));
connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
this, SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));

View file

@ -62,12 +62,12 @@ MouseMarkEffectConfig::MouseMarkEffectConfig(QWidget* parent, const QVariantList
KAction* a = static_cast< KAction* >(m_actionCollection->addAction("ClearMouseMarks"));
a->setText(i18n("Clear Mouse Marks"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F11));
a->setGlobalShortcut(QKeySequence(Qt::SHIFT + Qt::META + Qt::Key_F11));
a = static_cast< KAction* >(m_actionCollection->addAction("ClearLastMouseMark"));
a->setText(i18n("Clear Last Mouse Mark"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F12));
a->setGlobalShortcut(QKeySequence(Qt::SHIFT + Qt::META + Qt::Key_F12));
m_ui->editor->addCollection(m_actionCollection);

View file

@ -68,19 +68,19 @@ PresentWindowsEffect::PresentWindowsEffect()
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = (KAction*)actionCollection->addAction("Expose");
a->setText(i18n("Toggle Present Windows (Current desktop)"));
a->setGlobalShortcut(KShortcut(Qt::ALT + Qt::Key_Tab));
a->setGlobalShortcut(QKeySequence(Qt::ALT + Qt::Key_Tab));
shortcut = a->globalShortcut();
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleActive()));
connect(a, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChanged(QKeySequence)));
KAction* b = (KAction*)actionCollection->addAction("ExposeAll");
b->setText(i18n("Toggle Present Windows (All desktops)"));
// b->setGlobalShortcut(KShortcut(Qt::ALT + Qt::CTRL + Qt::Key_Tab));
// b->setGlobalShortcut(QKeySequence(Qt::ALT + Qt::CTRL + Qt::Key_Tab));
shortcutAll = b->globalShortcut();
connect(b, SIGNAL(triggered(bool)), this, SLOT(toggleActiveAllDesktops()));
connect(b, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChangedAll(QKeySequence)));
KAction* c = (KAction*)actionCollection->addAction("ExposeClass");
c->setText(i18n("Toggle Present Windows (Window class)"));
c->setGlobalShortcut(KShortcut(Qt::ALT + Qt::SHIFT + Qt::Key_Tab));
c->setGlobalShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + Qt::Key_Tab));
connect(c, SIGNAL(triggered(bool)), this, SLOT(toggleActiveClass()));
connect(c, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChangedClass(QKeySequence)));
shortcutClass = c->globalShortcut();
@ -666,15 +666,16 @@ void PresentWindowsEffect::grabbedKeyboardEvent(QKeyEvent *e)
if (e->type() == QEvent::KeyPress) {
// check for global shortcuts
// HACK: keyboard grab disables the global shortcuts so we have to check for global shortcut (bug 156155)
if (m_mode == ModeCurrentDesktop && shortcut.contains(e->key() + e->modifiers())) {
const int eventkey = (e->key() + e->modifiers());
if (m_mode == ModeCurrentDesktop && shortcut.matches(eventkey) != QKeySequence::NoMatch) {
toggleActive();
return;
}
if (m_mode == ModeAllDesktops && shortcutAll.contains(e->key() + e->modifiers())) {
if (m_mode == ModeAllDesktops && shortcutAll.matches(eventkey) != QKeySequence::NoMatch) {
toggleActiveAllDesktops();
return;
}
if (m_mode == ModeWindowClass && shortcutClass.contains(e->key() + e->modifiers())) {
if (m_mode == ModeWindowClass && shortcutClass.matches(eventkey) != QKeySequence::NoMatch) {
toggleActiveClass();
return;
}
@ -1778,17 +1779,17 @@ EffectWindow* PresentWindowsEffect::findFirstWindow() const
void PresentWindowsEffect::globalShortcutChanged(const QKeySequence& seq)
{
shortcut = KShortcut(seq);
shortcut = seq;
}
void PresentWindowsEffect::globalShortcutChangedAll(const QKeySequence& seq)
{
shortcutAll = KShortcut(seq);
shortcutAll = seq;
}
void PresentWindowsEffect::globalShortcutChangedClass(const QKeySequence& seq)
{
shortcutClass = KShortcut(seq);
shortcutClass = seq;
}
bool PresentWindowsEffect::isActive() const

View file

@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "presentwindows_proxy.h"
#include <kwineffects.h>
#include <kshortcut.h>
#include <QKeySequence>
#include <QTimer>
#include <QGraphicsView>
@ -271,9 +271,9 @@ private:
QString m_windowFilter;
// Shortcut - needed to toggle the effect
KShortcut shortcut;
KShortcut shortcutAll;
KShortcut shortcutClass;
QKeySequence shortcut;
QKeySequence shortcutAll;
QKeySequence shortcutClass;
// Atoms
// Present windows for all windows of given desktop

View file

@ -59,17 +59,17 @@ PresentWindowsEffectConfig::PresentWindowsEffectConfig(QWidget* parent, const QV
KAction* a = (KAction*) m_actionCollection->addAction("ExposeAll");
a->setText(i18n("Toggle Present Windows (All desktops)"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F10));
a->setGlobalShortcut(QKeySequence(Qt::CTRL + Qt::Key_F10));
KAction* b = (KAction*) m_actionCollection->addAction("Expose");
b->setText(i18n("Toggle Present Windows (Current desktop)"));
b->setProperty("isConfigurationAction", true);
b->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F9));
b->setGlobalShortcut(QKeySequence(Qt::CTRL + Qt::Key_F9));
KAction* c = (KAction*)m_actionCollection->addAction("ExposeClass");
c->setText(i18n("Toggle Present Windows (Window class)"));
c->setProperty("isConfigurationAction", true);
c->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F7));
c->setGlobalShortcut(QKeySequence(Qt::CTRL + Qt::Key_F7));
m_ui->shortcutEditor->addCollection(m_actionCollection);

View file

@ -35,7 +35,7 @@ ThumbnailAsideEffect::ThumbnailAsideEffect()
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = (KAction*)actionCollection->addAction("ToggleCurrentThumbnail");
a->setText(i18n("Toggle Thumbnail for Current Window"));
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_T));
a->setGlobalShortcut(QKeySequence(Qt::CTRL + Qt::META + Qt::Key_T));
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleCurrentThumbnail()));
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowGeometryShapeChanged(KWin::EffectWindow*,QRect)), this, SLOT(slotWindowGeometryShapeChanged(KWin::EffectWindow*,QRect)));

View file

@ -66,7 +66,7 @@ ThumbnailAsideEffectConfig::ThumbnailAsideEffectConfig(QWidget* parent, const QV
KAction* a = (KAction*)m_actionCollection->addAction("ToggleCurrentThumbnail");
a->setText(i18n("Toggle Thumbnail for Current Window"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::CTRL + Qt::Key_T));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::CTRL + Qt::Key_T));
m_ui->editor->addCollection(m_actionCollection);

View file

@ -56,7 +56,7 @@ TrackMouseEffect::TrackMouseEffect()
KActionCollection *actionCollection = new KActionCollection(this);
m_action = static_cast< KAction* >(actionCollection->addAction("TrackMouse"));
m_action->setText(i18n("Track mouse"));
m_action->setGlobalShortcut(KShortcut());
m_action->setGlobalShortcut(QKeySequence());
connect(m_action, SIGNAL(triggered(bool)), this, SLOT(toggle()));
connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),

View file

@ -62,7 +62,7 @@ TrackMouseEffectConfig::TrackMouseEffectConfig(QWidget* parent, const QVariantLi
KAction *a = static_cast< KAction* >(m_actionCollection->addAction("TrackMouse"));
a->setText(i18n("Track mouse"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut());
a->setGlobalShortcut(QKeySequence());
connect(m_ui->shortcut, SIGNAL(keySequenceChanged(QKeySequence)),
SLOT(shortcutChanged(QKeySequence)));
@ -85,7 +85,7 @@ void TrackMouseEffectConfig::load()
{
KCModule::load();
if (KAction *a = qobject_cast<KAction*>(m_actionCollection->action("TrackMouse")))
m_ui->shortcut->setKeySequence(a->globalShortcut().primary());
m_ui->shortcut->setKeySequence(a->globalShortcut());
checkModifiers();
emit changed(false);
@ -108,7 +108,7 @@ void TrackMouseEffectConfig::defaults()
void TrackMouseEffectConfig::shortcutChanged(const QKeySequence &seq)
{
if (KAction *a = qobject_cast<KAction*>(m_actionCollection->action("TrackMouse")))
a->setGlobalShortcut(KShortcut(seq), KAction::ActiveShortcut);
a->setGlobalShortcut(seq, KAction::ActiveShortcut);
// m_actionCollection->writeSettings();
emit changed(true);
}

View file

@ -59,7 +59,7 @@ WindowGeometryEffect::WindowGeometryEffect()
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = static_cast< KAction* >(actionCollection->addAction("WindowGeometry"));
a->setText(i18n("Toggle window geometry display (effect only)"));
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_F11));
a->setGlobalShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_F11));
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggle()));
connect(effects, SIGNAL(windowStartUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowStartUserMovedResized(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowFinishUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowFinishUserMovedResized(KWin::EffectWindow*)));

View file

@ -48,7 +48,7 @@ WindowGeometryConfig::WindowGeometryConfig(QWidget* parent, const QVariantList&
KAction* a = (KAction*)myActionCollection->addAction("WindowGeometry");
a->setText(i18n("Toggle KWin composited geometry display"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_F11));
a->setGlobalShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_F11));
myUi->shortcuts->addCollection(myActionCollection);
connect(myUi->shortcuts, SIGNAL(keyChange()), this, SLOT(changed()));

View file

@ -63,35 +63,35 @@ ZoomEffect::ZoomEffect()
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = 0;
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomIn, this, SLOT(zoomIn())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Equal));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Equal));
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomOut, this, SLOT(zoomOut())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Minus));
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ActualSize, this, SLOT(actualSize())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_0));
a = static_cast< KAction* >(actionCollection->addAction("MoveZoomLeft"));
a->setText(i18n("Move Zoomed Area to Left"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Left));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Left));
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomLeft()));
a = static_cast< KAction* >(actionCollection->addAction("MoveZoomRight"));
a->setText(i18n("Move Zoomed Area to Right"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Right));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Right));
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomRight()));
a = static_cast< KAction* >(actionCollection->addAction("MoveZoomUp"));
a->setText(i18n("Move Zoomed Area Upwards"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Up));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Up));
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomUp()));
a = static_cast< KAction* >(actionCollection->addAction("MoveZoomDown"));
a->setText(i18n("Move Zoomed Area Downwards"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Down));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Down));
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomDown()));
a = static_cast< KAction* >(actionCollection->addAction("MoveMouseToCenter"));
a->setText(i18n("Move Mouse to Center"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F6));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_F6));
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveMouseToCenter()));
timeline.setDuration(350);

View file

@ -64,45 +64,45 @@ ZoomEffectConfig::ZoomEffectConfig(QWidget* parent, const QVariantList& args) :
KAction* a;
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomIn));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Equal));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Equal));
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomOut));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Minus));
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ActualSize));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_0));
a = static_cast< KAction* >(actionCollection->addAction("MoveZoomLeft"));
a->setIcon(KIcon("go-previous"));
a->setText(i18n("Move Left"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Left));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Left));
a = static_cast< KAction* >(actionCollection->addAction("MoveZoomRight"));
a->setIcon(KIcon("go-next"));
a->setText(i18n("Move Right"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Right));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Right));
a = static_cast< KAction* >(actionCollection->addAction("MoveZoomUp"));
a->setIcon(KIcon("go-up"));
a->setText(i18n("Move Up"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Up));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Up));
a = static_cast< KAction* >(actionCollection->addAction("MoveZoomDown"));
a->setIcon(KIcon("go-down"));
a->setText(i18n("Move Down"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Down));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Down));
a = static_cast< KAction* >(actionCollection->addAction("MoveMouseToCenter"));
a->setIcon(KIcon("view-restore"));
a->setText(i18n("Move Mouse to Center"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F6));
a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_F6));
m_ui->editor->addCollection(actionCollection);
load();

View file

@ -150,7 +150,7 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
KAction* a = static_cast<KAction*>(m_actionCollection->addAction( "Suspend Compositing" ));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut( KShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_F12 ));
a->setGlobalShortcut( QKeySequence( Qt::ALT + Qt::SHIFT + Qt::Key_F12 ));
connect(ui.toggleEffectsShortcut, SIGNAL(keySequenceChanged(QKeySequence)), this, SLOT(toggleEffectShortcutChanged(QKeySequence)));
// Initialize the user interface with the config loaded from kwinrc.
@ -233,7 +233,7 @@ void KWinCompositingConfig::loadGeneralTab()
// this works by global shortcut magics - it will pick the current sc
// but the constructor line that adds the default alt+shift+f12 gsc is IMPORTANT!
if (KAction *a = qobject_cast<KAction*>(m_actionCollection->action("Suspend Compositing")))
ui.toggleEffectsShortcut->setKeySequence(a->globalShortcut().primary());
ui.toggleEffectsShortcut->setKeySequence(a->globalShortcut());
ui.animationSpeedCombo->setCurrentIndex(config.readEntry("AnimationSpeed", 3));
@ -270,7 +270,7 @@ void KWinCompositingConfig::alignGuiToCompositingType(int compositingType)
void KWinCompositingConfig::toggleEffectShortcutChanged(const QKeySequence &seq)
{
if (KAction *a = qobject_cast<KAction*>(m_actionCollection->action("Suspend Compositing")))
a->setGlobalShortcut(KShortcut(seq), KAction::ActiveShortcut);
a->setGlobalShortcut(seq, KAction::ActiveShortcut);
m_actionCollection->writeSettings();
}

View file

@ -109,7 +109,7 @@ void KWinDesktopConfig::init()
KAction* a = qobject_cast<KAction*>(m_actionCollection->addAction(QString("Switch to Desktop %1").arg(i)));
a->setProperty("isConfigurationAction", true);
a->setText(i18n("Switch to Desktop %1", i));
a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
a->setGlobalShortcut(QKeySequence(), KAction::ActiveShortcut);
}
// This should be after the "Switch to Desktop %1" loop. It HAS to be
@ -186,7 +186,7 @@ void KWinDesktopConfig::addAction(const QString &name, const QString &label)
KAction* a = qobject_cast<KAction*>(m_switchDesktopCollection->addAction(name));
a->setProperty("isConfigurationAction", true);
a->setText(label);
a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
a->setGlobalShortcut(QKeySequence(), KAction::ActiveShortcut);
}
void KWinDesktopConfig::defaults()
@ -402,7 +402,7 @@ void KWinDesktopConfig::slotChangeShortcuts(int number)
m_actionCollection->takeAction(m_actionCollection->actions().last()));
// Remove any associated global shortcut. Set it to ""
a->setGlobalShortcut(
KShortcut(),
QKeySequence(),
KAction::ActiveShortcut
);
m_ui->messageLabel->hide();
@ -413,14 +413,14 @@ void KWinDesktopConfig::slotChangeShortcuts(int number)
KAction* action = qobject_cast<KAction*>(m_actionCollection->addAction(QString("Switch to Desktop %1").arg(desktop)));
action->setProperty("isConfigurationAction", true);
action->setText(i18n("Switch to Desktop %1", desktop));
action->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
action->setGlobalShortcut(QKeySequence(), KAction::ActiveShortcut);
QString shortcutString = extrapolatedShortcut(desktop);
if (shortcutString.isEmpty()) {
m_ui->messageLabel->setText(i18n("No suitable Shortcut for Desktop %1 found", desktop));
m_ui->messageLabel->show();
} else {
KShortcut shortcut(shortcutString);
if (!shortcut.primary().isEmpty() || KGlobalAccel::self()->isGlobalShortcutAvailable(shortcut.primary())) {
QKeySequence shortcut(shortcutString);
if (!shortcut.isEmpty() || KGlobalAccel::self()->isGlobalShortcutAvailable(shortcut)) {
action->setGlobalShortcut(shortcut, KAction::ActiveShortcut);
m_ui->messageLabel->setText(i18n("Assigned global Shortcut \"%1\" to Desktop %2", shortcutString, desktop));
m_ui->messageLabel->show();

View file

@ -30,7 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DEF2( name, descr, key, fnSlot ) \
a = actionCollection->addAction( name ); \
a->setText( i18n(descr) ); \
qobject_cast<KAction*>( a )->setGlobalShortcut(KShortcut(key)); \
qobject_cast<KAction*>( a )->setGlobalShortcut(QKeySequence(key)); \
connect(a, SIGNAL(triggered(bool)), SLOT(fnSlot));
#define DEF( name, key, fnSlot ) \
@ -39,7 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DEF3( name, key, fnSlot, value ) \
a = actionCollection->addAction( QString(name).arg(value) ); \
a->setText( i18n(name, value) ); \
qobject_cast<KAction*>( a )->setGlobalShortcut(KShortcut(key)); \
qobject_cast<KAction*>( a )->setGlobalShortcut(QKeySequence(key)); \
a->setData(value); \
connect(a, SIGNAL(triggered(bool)), SLOT(fnSlot));

View file

@ -169,7 +169,7 @@ void UserActionsMenu::helperDialog(const QString& message, const QWeakPointer<Cl
KAction* action = qobject_cast<KAction*>(keys->action("Window Operations Menu"));
assert(action != NULL);
QString shortcut = QString("%1 (%2)").arg(action->text())
.arg(action->globalShortcut().primary().toString(QKeySequence::NativeText));
.arg(action->globalShortcut().toString(QKeySequence::NativeText));
args << "--msgbox" << i18n(
"You have selected to show a window without its border.\n"
"Without the border, you will not be able to enable the border "
@ -181,7 +181,7 @@ void UserActionsMenu::helperDialog(const QString& message, const QWeakPointer<Cl
KAction* action = qobject_cast<KAction*>(keys->action("Window Operations Menu"));
assert(action != NULL);
QString shortcut = QString("%1 (%2)").arg(action->text())
.arg(action->globalShortcut().primary().toString(QKeySequence::NativeText));
.arg(action->globalShortcut().toString(QKeySequence::NativeText));
args << "--msgbox" << i18n(
"You have selected to show a window in fullscreen mode.\n"
"If the application itself does not have an option to turn the fullscreen "
@ -244,20 +244,20 @@ void UserActionsMenu::init()
KActionCollection *keys = Workspace::self()->actionCollection();
KAction *kaction = qobject_cast<KAction*>(keys->action("Window Move"));
if (kaction != 0)
m_moveOperation->setShortcut(kaction->globalShortcut().primary());
m_moveOperation->setShortcut(kaction->globalShortcut());
m_moveOperation->setData(Options::UnrestrictedMoveOp);
m_resizeOperation = advancedMenu->addAction(i18n("Re&size"));
kaction = qobject_cast<KAction*>(keys->action("Window Resize"));
if (kaction != 0)
m_resizeOperation->setShortcut(kaction->globalShortcut().primary());
m_resizeOperation->setShortcut(kaction->globalShortcut());
m_resizeOperation->setData(Options::ResizeOp);
m_keepAboveOperation = advancedMenu->addAction(i18n("Keep &Above Others"));
m_keepAboveOperation->setIcon(KIcon("go-up"));
kaction = qobject_cast<KAction*>(keys->action("Window Above Other Windows"));
if (kaction != 0)
m_keepAboveOperation->setShortcut(kaction->globalShortcut().primary());
m_keepAboveOperation->setShortcut(kaction->globalShortcut());
m_keepAboveOperation->setCheckable(true);
m_keepAboveOperation->setData(Options::KeepAboveOp);
@ -265,7 +265,7 @@ void UserActionsMenu::init()
m_keepBelowOperation->setIcon(KIcon("go-down"));
kaction = qobject_cast<KAction*>(keys->action("Window Below Other Windows"));
if (kaction != 0)
m_keepBelowOperation->setShortcut(kaction->globalShortcut().primary());
m_keepBelowOperation->setShortcut(kaction->globalShortcut());
m_keepBelowOperation->setCheckable(true);
m_keepBelowOperation->setData(Options::KeepBelowOp);
@ -273,21 +273,21 @@ void UserActionsMenu::init()
m_fullScreenOperation->setIcon(KIcon("view-fullscreen"));
kaction = qobject_cast<KAction*>(keys->action("Window Fullscreen"));
if (kaction != 0)
m_fullScreenOperation->setShortcut(kaction->globalShortcut().primary());
m_fullScreenOperation->setShortcut(kaction->globalShortcut());
m_fullScreenOperation->setCheckable(true);
m_fullScreenOperation->setData(Options::FullScreenOp);
m_shadeOperation = advancedMenu->addAction(i18n("Sh&ade"));
kaction = qobject_cast<KAction*>(keys->action("Window Shade"));
if (kaction != 0)
m_shadeOperation->setShortcut(kaction->globalShortcut().primary());
m_shadeOperation->setShortcut(kaction->globalShortcut());
m_shadeOperation->setCheckable(true);
m_shadeOperation->setData(Options::ShadeOp);
m_noBorderOperation = advancedMenu->addAction(i18n("&No Border"));
kaction = qobject_cast<KAction*>(keys->action("Window No Border"));
if (kaction != 0)
m_noBorderOperation->setShortcut(kaction->globalShortcut().primary());
m_noBorderOperation->setShortcut(kaction->globalShortcut());
m_noBorderOperation->setCheckable(true);
m_noBorderOperation->setData(Options::NoBorderOp);
@ -297,7 +297,7 @@ void UserActionsMenu::init()
action->setIcon(KIcon("configure-shortcuts"));
kaction = qobject_cast<KAction*>(keys->action("Setup Window Shortcut"));
if (kaction != 0)
action->setShortcut(kaction->globalShortcut().primary());
action->setShortcut(kaction->globalShortcut());
action->setData(Options::SetupWindowShortcutOp);
action = advancedMenu->addAction(i18n("&Special Window Settings..."));
@ -318,13 +318,13 @@ void UserActionsMenu::init()
m_minimizeOperation = m_menu->addAction(i18n("Mi&nimize"));
kaction = qobject_cast<KAction*>(keys->action("Window Minimize"));
if (kaction != 0)
m_minimizeOperation->setShortcut(kaction->globalShortcut().primary());
m_minimizeOperation->setShortcut(kaction->globalShortcut());
m_minimizeOperation->setData(Options::MinimizeOp);
m_maximizeOperation = m_menu->addAction(i18n("Ma&ximize"));
kaction = qobject_cast<KAction*>(keys->action("Window Maximize"));
if (kaction != 0)
m_maximizeOperation->setShortcut(kaction->globalShortcut().primary());
m_maximizeOperation->setShortcut(kaction->globalShortcut());
m_maximizeOperation->setCheckable(true);
m_maximizeOperation->setData(Options::MaximizeOp);
@ -335,14 +335,14 @@ void UserActionsMenu::init()
m_removeFromTabGroup = m_menu->addAction(i18n("&Untab"));
kaction = qobject_cast<KAction*>(keys->action("Untab"));
if (kaction != 0)
m_removeFromTabGroup->setShortcut(kaction->globalShortcut().primary());
m_removeFromTabGroup->setShortcut(kaction->globalShortcut());
m_removeFromTabGroup->setData(Options::RemoveTabFromGroupOp);
m_closeTabGroup = m_menu->addAction(i18n("Close Entire &Group"));
m_closeTabGroup->setIcon(KIcon("window-close"));
kaction = qobject_cast<KAction*>(keys->action("Close TabGroup"));
if (kaction != 0)
m_closeTabGroup->setShortcut(kaction->globalShortcut().primary());
m_closeTabGroup->setShortcut(kaction->globalShortcut());
m_closeTabGroup->setData(Options::CloseTabGroupOp);
m_menu->addSeparator();
@ -359,7 +359,7 @@ void UserActionsMenu::init()
m_closeOperation->setIcon(KIcon("window-close"));
kaction = qobject_cast<KAction*>(keys->action("Window Close"));
if (kaction != 0)
m_closeOperation->setShortcut(kaction->globalShortcut().primary());
m_closeOperation->setShortcut(kaction->globalShortcut());
m_closeOperation->setData(Options::CloseOp);
}
@ -826,7 +826,7 @@ void Workspace::initShortcuts()
void Workspace::setupWindowShortcut(Client* c)
{
assert(client_keys_dialog == NULL);
client_keys_dialog = new ShortcutDialog(c->shortcut().primary());
client_keys_dialog = new ShortcutDialog(c->shortcut());
client_keys_client = c;
connect(client_keys_dialog, SIGNAL(dialogDone(bool)), SLOT(setupWindowShortcutDone(bool)));
QRect r = clientArea(ScreenArea, c);
@ -848,7 +848,7 @@ void Workspace::setupWindowShortcutDone(bool ok)
// disable_shortcuts_keys->setEnabled( true );
// client_keys->setEnabled( true );
if (ok)
client_keys_client->setShortcut(KShortcut(client_keys_dialog->shortcut()).toString());
client_keys_client->setShortcut(client_keys_dialog->shortcut().toString());
closeActivePopup();
client_keys_dialog->deleteLater();
client_keys_dialog = NULL;
@ -1755,7 +1755,7 @@ void Client::setShortcut(const QString& _cut)
{
QString cut = rules()->checkShortcut(_cut);
if (cut.isEmpty())
return setShortcutInternal(KShortcut());
return setShortcutInternal(QKeySequence());
if (cut == shortcut().toString()) {
return; // no change
}
@ -1763,13 +1763,13 @@ void Client::setShortcut(const QString& _cut)
// base+(abcdef)<space>base+(abcdef)
// E.g. Alt+Ctrl+(ABCDEF);Meta+X,Meta+(ABCDEF)
if (!cut.contains('(') && !cut.contains(')') && !cut.contains(" - ")) {
if (workspace()->shortcutAvailable(KShortcut(cut), this))
setShortcutInternal(KShortcut(cut));
if (workspace()->shortcutAvailable(QKeySequence(cut), this))
setShortcutInternal(QKeySequence(cut));
else
setShortcutInternal(KShortcut());
setShortcutInternal(QKeySequence());
return;
}
QList< KShortcut > keys;
QList< QKeySequence > keys;
QStringList groups = cut.split(" - ");
foreach (const QString &it, groups) {
QRegExp reg("(.*\\+)\\((.*)\\)");
@ -1779,19 +1779,19 @@ void Client::setShortcut(const QString& _cut)
for (int i = 0;
i < list.length();
++i) {
KShortcut c(base + list[ i ]);
QKeySequence c(base + list[ i ]);
if (!c.isEmpty())
keys.append(c);
}
} else {
// regexp doesn't match, so it should be a normal shortcut
KShortcut c(it);
QKeySequence c(it);
if (!c.isEmpty()) {
keys.append(c);
}
}
}
foreach (const KShortcut &it, keys) {
foreach (const QKeySequence &it, keys) {
if (_shortcut == it) // current one is in the list
return;
if (workspace()->shortcutAvailable(it, this)) {
@ -1799,10 +1799,10 @@ void Client::setShortcut(const QString& _cut)
return;
}
}
setShortcutInternal(KShortcut());
setShortcutInternal(QKeySequence());
}
void Client::setShortcutInternal(const KShortcut& cut)
void Client::setShortcutInternal(const QKeySequence& cut)
{
if (_shortcut == cut)
return;
@ -1823,14 +1823,13 @@ void Client::delayedSetShortcut()
workspace()->clientShortcutUpdated(this);
}
bool Workspace::shortcutAvailable(const KShortcut& cut, Client* ignore) const
bool Workspace::shortcutAvailable(const QKeySequence& cut, Client* ignore) const
{
if (ignore && cut == ignore->shortcut())
if (ignore && cut == ignore->shortcut()) {
return true;
foreach (const QKeySequence &seq, cut.toList()) {
if (!KGlobalAccel::self()->getGlobalShortcutsByKey(seq).isEmpty()) {
return false;
}
}
if (!KGlobalAccel::self()->getGlobalShortcutsByKey(cut).isEmpty()) {
return false;
}
foreach (const Client* it, clients) {
if (it != ignore && it->shortcut() == cut)

View file

@ -436,17 +436,17 @@ void VirtualDesktopManager::initSwitchToShortcuts(KActionCollection *keys)
{
const QString toDesktop = "Switch to Desktop %1";
const KLocalizedString toDesktopLabel = ki18n("Switch to Desktop %1");
addAction(keys, toDesktop, toDesktopLabel, 1, KShortcut(Qt::CTRL + Qt::Key_F1), SLOT(slotSwitchTo()));
addAction(keys, toDesktop, toDesktopLabel, 2, KShortcut(Qt::CTRL + Qt::Key_F2), SLOT(slotSwitchTo()));
addAction(keys, toDesktop, toDesktopLabel, 3, KShortcut(Qt::CTRL + Qt::Key_F3), SLOT(slotSwitchTo()));
addAction(keys, toDesktop, toDesktopLabel, 4, KShortcut(Qt::CTRL + Qt::Key_F4), SLOT(slotSwitchTo()));
addAction(keys, toDesktop, toDesktopLabel, 1, QKeySequence(Qt::CTRL + Qt::Key_F1), SLOT(slotSwitchTo()));
addAction(keys, toDesktop, toDesktopLabel, 2, QKeySequence(Qt::CTRL + Qt::Key_F2), SLOT(slotSwitchTo()));
addAction(keys, toDesktop, toDesktopLabel, 3, QKeySequence(Qt::CTRL + Qt::Key_F3), SLOT(slotSwitchTo()));
addAction(keys, toDesktop, toDesktopLabel, 4, QKeySequence(Qt::CTRL + Qt::Key_F4), SLOT(slotSwitchTo()));
for (uint i = 5; i <= maximum(); ++i) {
addAction(keys, toDesktop, toDesktopLabel, i, KShortcut(), SLOT(slotSwitchTo()));
addAction(keys, toDesktop, toDesktopLabel, i, QKeySequence(), SLOT(slotSwitchTo()));
}
}
void VirtualDesktopManager::addAction(KActionCollection *keys, const QString &name, const KLocalizedString &label, uint value, const KShortcut &key, const char *slot)
void VirtualDesktopManager::addAction(KActionCollection *keys, const QString &name, const KLocalizedString &label, uint value, const QKeySequence &key, const char *slot)
{
KAction *a = keys->addAction(name.arg(value), this, slot);
a->setText(label.subs(value).toString());
@ -457,7 +457,7 @@ void VirtualDesktopManager::addAction(KActionCollection *keys, const QString &na
void VirtualDesktopManager::addAction(KActionCollection *keys, const QString &name, const QString &label, const char *slot)
{
KAction *a = keys->addAction(name, this, slot);
a->setGlobalShortcut(KShortcut());
a->setGlobalShortcut(QKeySequence());
a->setText(label);
}

View file

@ -30,7 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class KActionCollection;
class KLocalizedString;
class KShortcut;
class NETRootInfo;
namespace KWin {
@ -341,7 +340,7 @@ private:
* @param key The global shortcut for the action
* @param slot The slot to invoke when the action is triggered
**/
void addAction(KActionCollection *keys, const QString &name, const KLocalizedString &label, uint value, const KShortcut &key, const char *slot);
void addAction(KActionCollection *keys, const QString &name, const KLocalizedString &label, uint value, const QKeySequence &key, const char *slot);
/**
* Creates an action and connects it to the @p slot in this Manager.
* Overloaded method for the case that no additional value needs to be passed to the action and

View file

@ -27,18 +27,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kdecoration.h>
#include "sm.h"
#include "utils.h"
// Qt
// Katie
#include <QKeySequence>
#include <QTimer>
#include <QVector>
#include <QStringList>
// X
#include <X11/Xlib.h>
// TODO: Cleanup the order of things in this .h file
#include <QStringList>
class KConfig;
class KActionCollection;
class KShortcut;
class KStartupInfo;
class KStartupInfoId;
class KStartupInfoData;
@ -264,7 +262,7 @@ public:
bool forcedGlobalMouseGrab() const;
void clientShortcutUpdated(Client* c);
bool shortcutAvailable(const KShortcut& cut, Client* ignore = NULL) const;
bool shortcutAvailable(const QKeySequence& cut, Client* ignore = NULL) const;
bool globalShortcutsDisabled() const;
void disableGlobalShortcutsForClient(bool disable);

View file

@ -34,7 +34,6 @@
#include <knotification.h>
#include <krun.h>
#include <kshell.h>
#include <kshortcut.h>
#include <kprotocolmanager.h>
#include <kio/deletejob.h>
#include <kio/fileundomanager.h>

View file

@ -1506,9 +1506,15 @@ void FolderView::createActions()
// Remove the Shift+Delete shortcut from the cut action, since it's used for deleting files
KAction *cut = KStandardAction::cut(this, SLOT(cut()), this);
KShortcut cutShortCut = cut->shortcut();
cutShortCut.remove(Qt::SHIFT + Qt::Key_Delete);
cut->setShortcut(cutShortCut);
QKeySequence cutShortcut = cut->shortcut();
static const int shiftdelete = (Qt::SHIFT | Qt::Key_Delete);
if (cutShortcut[0] == shiftdelete) {
cutShortcut = QKeySequence(cutShortcut[1]);
}
if (cutShortcut[0] == shiftdelete) {
cutShortcut = QKeySequence();
}
cut->setShortcut(cutShortcut);
cut->setShortcutContext(Qt::WidgetShortcut);
KAction *copy = KStandardAction::copy(this, SLOT(copy()), this);

View file

@ -243,9 +243,15 @@ void PopupView::createActions()
{
// Remove the Shift+Delete shortcut from the cut action, since it's used for deleting files
KAction *cut = KStandardAction::cut(this, SLOT(cut()), this);
KShortcut cutShortCut = cut->shortcut();
cutShortCut.remove(Qt::SHIFT + Qt::Key_Delete);
cut->setShortcut(cutShortCut);
QKeySequence cutShortcut = cut->shortcut();
static const int shiftdelete = (Qt::SHIFT | Qt::Key_Delete);
if (cutShortcut[0] == shiftdelete) {
cutShortcut = QKeySequence(cutShortcut[1]);
}
if (cutShortcut[0] == shiftdelete) {
cutShortcut = QKeySequence();
}
cut->setShortcut(cutShortcut);
KAction *copy = KStandardAction::copy(this, SLOT(copy()), this);

View file

@ -54,7 +54,7 @@ void KeyboardApplet::init()
m_showflag = configgroup.readEntry("showFlag", false);
m_showtext = configgroup.readEntry("showText", true);
setGlobalShortcut(KShortcut(Qt::ALT+Qt::CTRL+Qt::Key_K));
setGlobalShortcut(QKeySequence(Qt::ALT+Qt::CTRL+Qt::Key_K));
connect(
this, SIGNAL(activate()),
this, SLOT(slotNextLayout())

View file

@ -1728,7 +1728,7 @@ void LauncherApplet::init()
{
Plasma::PopupApplet::init();
setGlobalShortcut(KShortcut(Qt::ALT+Qt::Key_F2));
setGlobalShortcut(QKeySequence(Qt::ALT+Qt::Key_F2));
m_shareconfig = KSharedConfig::openConfig(globalConfig().config()->name());
m_configgroup = m_shareconfig->group("Plugins");

View file

@ -123,12 +123,12 @@ PlasmaApp::PlasmaApp()
KActionCollection* actionCollection = new KActionCollection(this);
KAction* action = actionCollection->addAction("Capture the desktop");
action->setText(i18n("Capture the desktop"));
action->setGlobalShortcut(KShortcut(Qt::Key_Print));
action->setGlobalShortcut(QKeySequence(Qt::Key_Print));
connect(action, SIGNAL(triggered(bool)), SLOT(captureDesktop()));
action = actionCollection->addAction("Capture the current window");
action->setText(i18n("Capture the current window"));
action->setGlobalShortcut(KShortcut(Qt::CTRL+Qt::Key_Print));
action->setGlobalShortcut(QKeySequence(Qt::CTRL+Qt::Key_Print));
connect(action, SIGNAL(triggered(bool)), SLOT(captureCurrentWindow()));
QTimer::singleShot(0, this, SLOT(setupDesktop()));

View file

@ -122,7 +122,7 @@ void SettingsBase::initToolBar()
quitAction = actionCollection()->addAction( KStandardAction::Quit, "quit_action", this, SLOT(close()) );
// Configure goes at the end
configureAction = actionCollection()->addAction( KStandardAction::Preferences, this, SLOT(configShow()) );
configureAction->setShortcut(KShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)));
configureAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
configureAction->setText( i18n("Configure") );
// Help after it
initHelpMenu();
@ -133,7 +133,7 @@ void SettingsBase::initToolBar()
// Finally the search line-edit
searchAction = new KAction( this );
searchAction->setDefaultWidget(searchText);
searchAction->setShortcut(KShortcut(QKeySequence(Qt::CTRL + Qt::Key_F)));
searchAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F));
connect( searchAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)),
searchText, SLOT(setFocus()));
actionCollection()->addAction( "searchText", searchAction );

View file

@ -68,7 +68,7 @@ IconMode::IconMode( QObject *parent, const QVariantList& )
d->backAction = KStandardAction::back( this, SLOT(backToOverview()), this );
d->backAction->setText( i18n( "Overview" ) );
d->backAction->setToolTip( i18n("Keyboard Shortcut: %1", d->backAction->shortcut().primary().toString( QKeySequence::NativeText )) );
d->backAction->setToolTip( i18n("Keyboard Shortcut: %1", d->backAction->shortcut().toString( QKeySequence::NativeText )) );
d->backAction->setEnabled( false );
actionsList() << d->backAction;
}