Commit ed10d892 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add move tab next/preview

Bug reported by David
parent 43973713
......@@ -26,6 +26,7 @@
#include <KXMLGUIClient>
#include <QAction>
#include <KToggleAction>
#include <KStandardAction>
#include <QAbstractItemModel>
#include <QAbstractProxyModel>
......@@ -36,6 +37,7 @@
#include <QHeaderView>
#include <QRegularExpression>
#include <QVector>
#include <QApplication>
#include "storagemodel.h"
#include "core/widgets/quicksearchline.h"
......@@ -266,28 +268,57 @@ void Pane::setXmlGuiClient(KXMLGUIClient *xmlGuiClient)
d->addActivateTabAction(i);
}
d->mCloseTabAction = new QAction(i18n("Close Tab"), this);
d->mXmlGuiClient->actionCollection()->addAction(QStringLiteral("close_current_tab"), d->mCloseTabAction);
d->mXmlGuiClient->actionCollection()->setDefaultShortcuts(d->mCloseTabAction, QList<QKeySequence>() << QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_W) << QKeySequence(Qt::CTRL + Qt::Key_W));
connect(d->mCloseTabAction, &QAction::triggered, this, [this]() {
d->onCloseTabClicked();
});
d->mActionMenu->addAction(d->mCloseTabAction);
d->mCloseTabAction->setEnabled(false);
QList<QKeySequence> nextShortcut;
QList<QKeySequence> prevShortcut;
QString nextIcon, prevIcon;
if (QApplication::isRightToLeft())
{
prevShortcut.append(KStandardShortcut::tabPrev());
nextShortcut.append(KStandardShortcut::tabNext());
nextIcon = QStringLiteral("go-previous-view");
prevIcon = QStringLiteral("go-next-view");
}
else
{
nextShortcut.append(KStandardShortcut::tabPrev());
prevShortcut.append(KStandardShortcut::tabNext());
nextIcon = QStringLiteral("go-next-view");
prevIcon = QStringLiteral("go-previous-view");
}
d->mActivateNextTabAction = new QAction(i18n("Activate Next Tab"), this);
d->mXmlGuiClient->actionCollection()->addAction(QStringLiteral("activate_next_tab"), d->mActivateNextTabAction);
d->mActivateNextTabAction->setEnabled(false);
d->mActivateNextTabAction->setIcon(QIcon::fromTheme(nextIcon));
d->mXmlGuiClient->actionCollection()->setDefaultShortcuts(d->mActivateNextTabAction, nextShortcut);
connect(d->mActivateNextTabAction, &QAction::triggered, [this]() {
d->activateNextTab();
});
d->mActionMenu->addAction(d->mActivateNextTabAction);
d->mActivatePreviousTabAction = new QAction(i18n("Activate Previous Tab"), this);
d->mXmlGuiClient->actionCollection()->addAction(QStringLiteral("activate_previous_tab"), d->mActivatePreviousTabAction);
d->mXmlGuiClient->actionCollection()->setDefaultShortcuts(d->mActivatePreviousTabAction, prevShortcut);
d->mActivatePreviousTabAction->setIcon(QIcon::fromTheme(prevIcon));
d->mActivatePreviousTabAction->setEnabled(false);
connect(d->mActivatePreviousTabAction, &QAction::triggered, this, [this]() {
d->activatePreviousTab();
});
d->mActionMenu->addAction(d->mActivatePreviousTabAction);
d->mActionMenu->addSeparator();
d->mCloseTabAction = new QAction(i18n("Close Tab"), this);
d->mXmlGuiClient->actionCollection()->addAction(QStringLiteral("close_current_tab"), d->mCloseTabAction);
d->mXmlGuiClient->actionCollection()->setDefaultShortcuts(d->mCloseTabAction, QList<QKeySequence>() << QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_W) << QKeySequence(Qt::CTRL + Qt::Key_W));
connect(d->mCloseTabAction, &QAction::triggered, this, [this]() {
d->onCloseTabClicked();
});
d->mActionMenu->addAction(d->mCloseTabAction);
d->mCloseTabAction->setEnabled(false);
d->mMoveTabLeftAction = new QAction(i18n("Move Tab Left"), this);
d->mXmlGuiClient->actionCollection()->addAction(QStringLiteral("move_tab_left"), d->mMoveTabLeftAction);
......
......@@ -1670,13 +1670,13 @@ void ViewerPrivate::createActions()
q, &Viewer::slotScrollDown);
mScrollUpMoreAction = new QAction(i18n("Scroll Message Up (More)"), this);
ac->setDefaultShortcut(mScrollUpMoreAction, QKeySequence(Qt::Key_PageUp));
ac->setDefaultShortcut(mScrollUpMoreAction, QKeySequence(Qt::ALT + Qt::Key_PageUp));
ac->addAction(QStringLiteral("scroll_up_more"), mScrollUpMoreAction);
connect(mScrollUpMoreAction, &QAction::triggered,
q, &Viewer::slotScrollPrior);
mScrollDownMoreAction = new QAction(i18n("Scroll Message Down (More)"), this);
ac->setDefaultShortcut(mScrollDownMoreAction, QKeySequence(Qt::Key_PageDown));
ac->setDefaultShortcut(mScrollDownMoreAction, QKeySequence(Qt::ALT + Qt::Key_PageDown));
ac->addAction(QStringLiteral("scroll_down_more"), mScrollDownMoreAction);
connect(mScrollDownMoreAction, &QAction::triggered,
q, &Viewer::slotScrollNext);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment