mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
generic: adjust to Katie changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
b8266082ff
commit
671d45fe1d
5 changed files with 11 additions and 28 deletions
|
@ -136,8 +136,8 @@ KShortcut KAction::shortcut(ShortcutTypes type) const
|
||||||
property("defaultAlternateShortcut").value<QKeySequence>()
|
property("defaultAlternateShortcut").value<QKeySequence>()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const QList<QKeySequence> cuts = shortcuts();
|
const QKeySequence cut = QAction::shortcut();
|
||||||
return KShortcut(cuts.value(0), cuts.value(1));
|
return KShortcut(cut[0], cut[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KAction::setShortcut(const KShortcut &shortcut, ShortcutTypes type)
|
void KAction::setShortcut(const KShortcut &shortcut, ShortcutTypes type)
|
||||||
|
@ -148,7 +148,7 @@ void KAction::setShortcut(const KShortcut &shortcut, ShortcutTypes type)
|
||||||
setProperty("defaultAlternateShortcut", shortcut.alternate());
|
setProperty("defaultAlternateShortcut", shortcut.alternate());
|
||||||
}
|
}
|
||||||
if (type & ActiveShortcut) {
|
if (type & ActiveShortcut) {
|
||||||
QAction::setShortcuts(shortcut);
|
QAction::setShortcut(QKeySequence(shortcut.primary(), shortcut.alternate()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,11 +163,6 @@ void KAction::setShortcut(const QKeySequence &keySeq, ShortcutTypes type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KAction::setShortcuts(const QList<QKeySequence> &shortcuts, ShortcutTypes type)
|
|
||||||
{
|
|
||||||
setShortcut(KShortcut(shortcuts), type);
|
|
||||||
}
|
|
||||||
|
|
||||||
const KShortcut& KAction::globalShortcut(ShortcutTypes type) const
|
const KShortcut& KAction::globalShortcut(ShortcutTypes type) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(type);
|
Q_ASSERT(type);
|
||||||
|
|
|
@ -314,20 +314,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void setShortcut(const QKeySequence &shortcut, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
|
void setShortcut(const QKeySequence &shortcut, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
|
||||||
|
|
||||||
/**
|
|
||||||
* \overload void setShortcuts(const QList\<QKeySequence\>& shortcuts).
|
|
||||||
*
|
|
||||||
* Set the shortcuts for this action.
|
|
||||||
*
|
|
||||||
* This function is there to explicitly override QAction::setShortcut(const QList\<QKeySequence\>&).
|
|
||||||
* QAction::setShortcuts() will bypass everything in KAction and may lead to unexpected behavior.
|
|
||||||
*
|
|
||||||
* \param shortcut shortcut(s) to use for this action in its specified shortcutContext()
|
|
||||||
* \param type type of shortcut to be set: active shortcut,
|
|
||||||
* default shortcut, or both (default argument value).
|
|
||||||
*/
|
|
||||||
void setShortcuts(const QList<QKeySequence> &shortcuts, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this action's shortcut is configurable.
|
* Returns true if this action's shortcut is configurable.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -227,7 +227,7 @@ void tst_KActionCollection::testSetShortcuts()
|
||||||
action->setShortcut(QKeySequence(Qt::ALT+Qt::Key_Plus));
|
action->setShortcut(QKeySequence(Qt::ALT+Qt::Key_Plus));
|
||||||
KShortcut shortcut = KShortcut(action->shortcuts());
|
KShortcut shortcut = KShortcut(action->shortcuts());
|
||||||
shortcut.setAlternate( QKeySequence( Qt::CTRL+Qt::Key_Plus ) );
|
shortcut.setAlternate( QKeySequence( Qt::CTRL+Qt::Key_Plus ) );
|
||||||
action->setShortcuts( shortcut );
|
action->setShortcut( shortcut );
|
||||||
QCOMPARE(action->shortcut().toString(), QString("Alt++; Ctrl++"));
|
QCOMPARE(action->shortcut().toString(), QString("Alt++; Ctrl++"));
|
||||||
|
|
||||||
// Simpler way:
|
// Simpler way:
|
||||||
|
|
|
@ -46,7 +46,8 @@ QAction* KUndoStack::createRedoAction(KActionCollection* actionCollection, const
|
||||||
|
|
||||||
action->setIcon(KIcon("edit-redo"));
|
action->setIcon(KIcon("edit-redo"));
|
||||||
action->setIconText(i18n("Redo"));
|
action->setIconText(i18n("Redo"));
|
||||||
action->setShortcuts(KStandardShortcut::redo());
|
const KShortcut redocut = KStandardShortcut::redo();
|
||||||
|
action->setShortcut(QKeySequence(redocut.primary(), redocut.alternate()));
|
||||||
|
|
||||||
actionCollection->addAction(action->objectName(), action);
|
actionCollection->addAction(action->objectName(), action);
|
||||||
|
|
||||||
|
@ -65,7 +66,8 @@ QAction* KUndoStack::createUndoAction(KActionCollection* actionCollection, const
|
||||||
|
|
||||||
action->setIcon(KIcon("edit-undo"));
|
action->setIcon(KIcon("edit-undo"));
|
||||||
action->setIconText(i18n("Undo"));
|
action->setIconText(i18n("Undo"));
|
||||||
action->setShortcuts(KStandardShortcut::undo());
|
const KShortcut undocut = KStandardShortcut::undo();
|
||||||
|
action->setShortcut(QKeySequence(undocut.primary(), undocut.alternate()));
|
||||||
|
|
||||||
actionCollection->addAction(action->objectName(), action);
|
actionCollection->addAction(action->objectName(), action);
|
||||||
|
|
||||||
|
|
|
@ -1729,7 +1729,7 @@ void KDirOperator::setupActions()
|
||||||
|
|
||||||
KAction* reloadAction = d->actionCollection->addAction(KStandardAction::Redisplay, "reload", this, SLOT(rereadDir()));
|
KAction* reloadAction = d->actionCollection->addAction(KStandardAction::Redisplay, "reload", this, SLOT(rereadDir()));
|
||||||
reloadAction->setText(i18n("Reload"));
|
reloadAction->setText(i18n("Reload"));
|
||||||
reloadAction->setShortcuts(KStandardShortcut::shortcut(KStandardShortcut::Reload));
|
reloadAction->setShortcut(KStandardShortcut::shortcut(KStandardShortcut::Reload));
|
||||||
|
|
||||||
KAction* mkdirAction = new KAction(i18n("New Folder..."), this);
|
KAction* mkdirAction = new KAction(i18n("New Folder..."), this);
|
||||||
d->actionCollection->addAction("mkdir", mkdirAction);
|
d->actionCollection->addAction("mkdir", mkdirAction);
|
||||||
|
@ -1739,13 +1739,13 @@ void KDirOperator::setupActions()
|
||||||
KAction* trash = new KAction(i18n("Move to Trash"), this);
|
KAction* trash = new KAction(i18n("Move to Trash"), this);
|
||||||
d->actionCollection->addAction("trash", trash);
|
d->actionCollection->addAction("trash", trash);
|
||||||
trash->setIcon(KIcon("user-trash"));
|
trash->setIcon(KIcon("user-trash"));
|
||||||
trash->setShortcuts(KShortcut(Qt::Key_Delete));
|
trash->setShortcut(KShortcut(Qt::Key_Delete));
|
||||||
connect(trash, SIGNAL(triggered(bool)), SLOT(trashSelected()));
|
connect(trash, SIGNAL(triggered(bool)), SLOT(trashSelected()));
|
||||||
|
|
||||||
KAction* action = new KAction(i18n("Delete"), this);
|
KAction* action = new KAction(i18n("Delete"), this);
|
||||||
d->actionCollection->addAction("delete", action);
|
d->actionCollection->addAction("delete", action);
|
||||||
action->setIcon(KIcon("edit-delete"));
|
action->setIcon(KIcon("edit-delete"));
|
||||||
action->setShortcuts(KShortcut(Qt::SHIFT + Qt::Key_Delete));
|
action->setShortcut(KShortcut(Qt::SHIFT + Qt::Key_Delete));
|
||||||
connect(action, SIGNAL(triggered(bool)), this, SLOT(deleteSelected()));
|
connect(action, SIGNAL(triggered(bool)), this, SLOT(deleteSelected()));
|
||||||
|
|
||||||
// the sort menu actions
|
// the sort menu actions
|
||||||
|
|
Loading…
Add table
Reference in a new issue