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 | 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 | 174 | addActionToQMenuAndActionHash(editMenu, |
| 166 | 175 | MenuOption::Preferences, |
| @@ -183,7 +192,7 @@ Menu::Menu() : · 16 unmodified lines | ||
| 183 | 192 | #ifdef HAVE_QXMPP |
| 184 | 193 | _chatAction = addActionToQMenuAndActionHash(toolsMenu, |
| 185 | 194 | MenuOption::Chat, |
| 186 | − Qt::Key_Return, | |
| 195 | + 0, | |
| 187 | 196 | this, |
| 188 | 197 | SLOT(showChat())); |
| 189 | 198 | |
| @@ -620,6 +629,41 @@ QAction* Menu::addActionToQMenuAndActionHash(QMenu* destinationMenu, · 430 unmodified lines | ||
| 620 | 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 | 667 | QAction* Menu::addCheckableActionToQMenuAndActionHash(QMenu* destinationMenu, |
| 624 | 668 | const QString& actionName, |
| 625 | 669 | const QKeySequence& shortcut, |