Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: workspace/krunner/interfaces/default/interface.cpp
- ===================================================================
- --- workspace/krunner/interfaces/default/interface.cpp (revision 974496)
- +++ workspace/krunner/interfaces/default/interface.cpp (working copy)
- @@ -130,6 +130,28 @@
- QAction *focusEdit = new QAction(this);
- focusEdit->setShortcut(Qt::Key_F6);
- + QActionGroup *moveActions = new QActionGroup(this);
- +
- + QAction *upAction = new QAction(this);
- + upAction->setShortcut(Qt::META | Qt::Key_Up);
- +
- + QAction *downAction = new QAction(this);
- + downAction->setShortcut(Qt::META | Qt::Key_Down);
- +
- + QAction *leftAction = new QAction(this);
- + leftAction->setShortcut(Qt::META | Qt::Key_Left);
- +
- + QAction *rightAction = new QAction(this);
- + rightAction->setShortcut(Qt::META | Qt::Key_Right);
- +
- + moveActions->addAction(upAction);
- + moveActions->addAction(downAction);
- + moveActions->addAction(leftAction);
- + moveActions->addAction(rightAction);
- + addActions(moveActions->actions());
- +
- + connect(moveActions, SIGNAL(triggered(QAction *)), SLOT(slotMove(QAction *)));
- +
- // in therory, the widget should detect the direction from the content
- // but this is not available in Qt4.4/KDE 4.2, so the best default for this widget
- // is LTR: as it's more or less a "command line interface"
- @@ -396,6 +418,31 @@
- }
- }
- +void Interface::slotMove(QAction *action)
- +{
- + int movement = 30;
- +
- + int x = QWidget::pos().x();
- + int y = QWidget::pos().y();
- +
- + switch (action->shortcut()) {
- + case Qt::META | Qt::Key_Up:
- + if (y > 0) y -= movement;
- + break;
- + case Qt::META | Qt::Key_Down:
- + if (y < QApplication::desktop()->screenGeometry().height() - height()) y += movement;
- + break;
- + case Qt::META | Qt::Key_Right:
- + if (x < QApplication::desktop()->screenGeometry().width() - width()) x += movement;
- + break;
- + case Qt::META | Qt::Key_Left:
- + if (x > 0) x -= movement;
- + break;
- + }
- +
- + move(x, y);
- +}
- +
- void Interface::setStaticQueryMode(bool staticQuery)
- {
- if (staticQuery) {
- @@ -427,7 +474,7 @@
- }
- e->accept();
- }
- -
- +
- void Interface::run(ResultItem *item)
- {
- if (!item || item->group() < Plasma::QueryMatch::PossibleMatch) {
- Index: workspace/krunner/interfaces/default/interface.h
- ===================================================================
- --- workspace/krunner/interfaces/default/interface.h (revision 974496)
- +++ workspace/krunner/interfaces/default/interface.h (working copy)
- @@ -72,6 +72,7 @@
- void resetInterface();
- void showHelp();
- void itemSelected();
- + void slotMove(QAction *);
- private:
- void centerOnScreen();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement