Showing the changes to interface/src/Menu.cpp (1 of 38 files). Show all
Unified · Split
| @@ -161,6 +161,15 @@ Menu::Menu() : · 160 unmodified lines | |||
| 161 | 161 | ||
| 162 | 162 | ||
| 163 | QMenu* editMenu = addMenu("Edit"); | 163 | QMenu* editMenu = addMenu("Edit"); |
| 164 | |||
| 165 | QUndoStack* undoStack = Application::getInstance()->getUndoStack(); | ||
| 166 | QAction* undoAction = undoStack->createUndoAction(editMenu); | ||
| 167 | undoAction->setShortcut(Qt::CTRL | Qt::Key_Z); | ||
| 168 | addActionToQMenuAndActionHash(editMenu, undoAction); | ||
| 169 | |||
| 170 | QAction* redoAction = undoStack->createRedoAction(editMenu); | ||
| 171 | redoAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_Z); | ||
| 172 | addActionToQMenuAndActionHash(editMenu, redoAction); | ||
| 164 | 173 | ||
| 165 | addActionToQMenuAndActionHash(editMenu, | 174 | addActionToQMenuAndActionHash(editMenu, |
| 166 | MenuOption::Preferences, | 175 | MenuOption::Preferences, |
| @@ -183,7 +192,7 @@ Menu::Menu() : · 16 unmodified lines | |||
| 183 | #ifdef HAVE_QXMPP | 192 | #ifdef HAVE_QXMPP |
| 184 | _chatAction = addActionToQMenuAndActionHash(toolsMenu, | 193 | _chatAction = addActionToQMenuAndActionHash(toolsMenu, |
| 185 | MenuOption::Chat, | 194 | MenuOption::Chat, |
| 186 | Qt::Key_Return, | 195 | 0, |
| 187 | this, | 196 | this, |
| 188 | SLOT(showChat())); | 197 | SLOT(showChat())); |
| 189 | 198 | ||
| @@ -620,6 +629,41 @@ QAction* Menu::addActionToQMenuAndActionHash(QMenu* destinationMenu, · 430 unmodified lines | |||
| 620 | return action; | 629 | return action; |
| 621 | } | 630 | } |
| 622 | 631 | ||
| 632 | QAction* Menu::addActionToQMenuAndActionHash(QMenu* destinationMenu, | ||
| 633 | QAction* action, | ||
| 634 | const QString& actionName, | ||
| 635 | const QKeySequence& shortcut, | ||
| 636 | QAction::MenuRole role, | ||
| 637 | int menuItemLocation) { | ||
| 638 | QAction* actionBefore = NULL; | ||
| 639 | |||
| 640 | if (menuItemLocation >= 0 && destinationMenu->actions().size() > menuItemLocation) { | ||
| 641 | actionBefore = destinationMenu->actions()[menuItemLocation]; | ||
| 642 | } | ||
| 643 | |||
| 644 | if (!actionName.isEmpty()) { | ||
| 645 | action->setText(actionName); | ||
| 646 | } | ||
| 647 | |||
| 648 | if (shortcut != 0) { | ||
| 649 | action->setShortcut(shortcut); | ||
| 650 | } | ||
| 651 | |||
| 652 | if (role != QAction::NoRole) { | ||
| 653 | action->setMenuRole(role); | ||
| 654 | } | ||
| 655 | |||
| 656 | if (!actionBefore) { | ||
| 657 | destinationMenu->addAction(action); | ||
| 658 | } else { | ||
| 659 | destinationMenu->insertAction(actionBefore, action); | ||
| 660 | } | ||
| 661 | |||
| 662 | _actionHash.insert(action->text(), action); | ||
| 663 | |||
| 664 | return action; | ||
| 665 | } | ||
| 666 | |||
| 623 | QAction* Menu::addCheckableActionToQMenuAndActionHash(QMenu* destinationMenu, | 667 | QAction* Menu::addCheckableActionToQMenuAndActionHash(QMenu* destinationMenu, |
| 624 | const QString& actionName, | 668 | const QString& actionName, |
| 625 | const QKeySequence& shortcut, | 669 | const QKeySequence& shortcut, |