| 757 | */ |
| 758 | |
| 759 | void KDiff3App::initActions(KActionCollection* ac) |
| 760 | { |
| 761 | if(Q_UNLIKELY(ac == nullptr)) |
| 762 | { |
| 763 | KMessageBox::error(nullptr, "actionCollection==0"); |
| 764 | exit(-1); //we cannot recover from this. |
| 765 | } |
| 766 | |
| 767 | viewStatusBar = KStandardAction::showStatusbar(this, &KDiff3App::slotViewStatusBar, ac); |
| 768 | viewStatusBar->setStatusTip(i18n("Enables/disables the statusbar")); |
| 769 | KStandardAction::keyBindings(this, &KDiff3App::slotConfigureKeys, ac); |
| 770 | QAction* pAction = KStandardAction::preferences(this, &KDiff3App::slotConfigure, ac); |
| 771 | pAction->setText(i18n("Configure KDiff3...")); |
| 772 | |
| 773 | stdMenus->setup(this, ac); |
| 774 | |
| 775 | editFind = KStandardAction::find(this, &KDiff3App::slotEditFind, ac); |
| 776 | editFind->setShortcut(QKeySequence::Find); |
| 777 | editFind->setStatusTip(i18n("Search for a string")); |
| 778 | editFindNext = KStandardAction::findNext(this, &KDiff3App::slotEditFindNext, ac); |
| 779 | editFindNext->setStatusTip(i18n("Search again for the string")); |
| 780 | #include "xpm/autoadvance.xpm" |
| 781 | #include "xpm/currentpos.xpm" |
| 782 | #include "xpm/down1arrow.xpm" |
| 783 | #include "xpm/down2arrow.xpm" |
| 784 | #include "xpm/downend.xpm" |
| 785 | #include "xpm/gotoline.xpm" |
| 786 | #include "xpm/iconA.xpm" |
| 787 | #include "xpm/iconB.xpm" |
| 788 | #include "xpm/iconC.xpm" |
| 789 | #include "xpm/nextunsolved.xpm" |
| 790 | #include "xpm/prevunsolved.xpm" |
| 791 | #include "xpm/showlinenumbers.xpm" |
| 792 | #include "xpm/showwhitespace.xpm" |
| 793 | #include "xpm/showwhitespacechars.xpm" |
| 794 | #include "xpm/up1arrow.xpm" |
| 795 | #include "xpm/up2arrow.xpm" |
| 796 | #include "xpm/upend.xpm" |
| 797 | |
| 798 | mGoCurrent = GuiUtils::createAction<QAction>(i18n("Go to Current Delta"), QIcon(QPixmap(currentpos)), i18n("Current\nDelta"), QKeySequence(Qt::CTRL | Qt::Key_Space), this, [this] { Q_EMIT goCurrent(); }, ac, "go_current"); |
| 799 | |
| 800 | mGoTop = GuiUtils::createAction<QAction>(i18n("Go to First Delta"), QIcon(QPixmap(upend)), i18n("First\nDelta"), this, [this] { Q_EMIT goTop(); }, ac, "go_top"); |
| 801 | |
| 802 | mGoBottom = GuiUtils::createAction<QAction>(i18n("Go to Last Delta"), QIcon(QPixmap(downend)), i18n("Last\nDelta"), this, [this] { Q_EMIT goBottom(); }, ac, "go_bottom"); |
| 803 | |
| 804 | QString omitsWhitespace = ".\n" + i18nc("Tooltip explanation text", "(Skips white space differences when \"Show White Space\" is disabled.)"); |
| 805 | QString includeWhitespace = ".\n" + i18nc("Tooltip explanation text", "(Does not skip white space differences even when \"Show White Space\" is disabled.)"); |
| 806 | mGoPrevDelta = GuiUtils::createAction<QAction>(i18n("Go to Previous Delta"), QIcon(QPixmap(up1arrow)), i18n("Prev\nDelta"), QKeySequence(Qt::CTRL | Qt::Key_Up), this, [this] { Q_EMIT goPrevDelta(); }, ac, "go_prev_delta"); |
| 807 | mGoPrevDelta->setToolTip(mGoPrevDelta->text() + omitsWhitespace); |
| 808 | mGoNextDelta = GuiUtils::createAction<QAction>(i18n("Go to Next Delta"), QIcon(QPixmap(down1arrow)), i18n("Next\nDelta"), QKeySequence(Qt::CTRL | Qt::Key_Down), this, [this] { Q_EMIT goNextDelta(); }, ac, "go_next_delta"); |
| 809 | mGoNextDelta->setToolTip(mGoNextDelta->text() + omitsWhitespace); |
| 810 | mGoPrevConflict = GuiUtils::createAction<QAction>(i18n("Go to Previous Conflict"), QIcon(QPixmap(up2arrow)), i18n("Prev\nConflict"), QKeySequence(Qt::CTRL | Qt::Key_PageUp), this, [this] { Q_EMIT goPrevConflict(); }, ac, "go_prev_conflict"); |
| 811 | mGoPrevConflict->setToolTip(mGoPrevConflict->text() + omitsWhitespace); |
| 812 | mGoNextConflict = GuiUtils::createAction<QAction>(i18n("Go to Next Conflict"), QIcon(QPixmap(down2arrow)), i18n("Next\nConflict"), QKeySequence(Qt::CTRL | Qt::Key_PageDown), this, &KDiff3App::slotGoNextConflict, ac, "go_next_conflict"); |
| 813 | mGoNextConflict->setToolTip(mGoNextConflict->text() + omitsWhitespace); |
| 814 | mGoPrevUnsolvedConflict = GuiUtils::createAction<QAction>(i18n("Go to Previous Unsolved Conflict"), QIcon(QPixmap(prevunsolved)), i18n("Prev\nUnsolved"), QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_PageUp), this, [this] { Q_EMIT goPrevUnsolvedConflict(); }, ac, "go_prev_unsolved_conflict"); |
| 815 | mGoPrevUnsolvedConflict->setToolTip(mGoPrevUnsolvedConflict->text() + includeWhitespace); |
| 816 | mGoNextUnsolvedConflict = GuiUtils::createAction<QAction>(i18n("Go to Next Unsolved Conflict"), QIcon(QPixmap(nextunsolved)), i18n("Next\nUnsolved"), QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_PageDown), this, &KDiff3App::slotGoNextUnsolvedConflict, ac, "go_next_unsolved_conflict"); |