Merge branch 'stashAction'

This adds the support for the Stash action which will be helpful for the upcoming stash:/ ioslave
This commit is contained in:
arnav dhamija 2017-02-13 22:24:01 +05:30
commit ccb3658b3a
5 changed files with 25 additions and 3 deletions

View file

@ -57,6 +57,7 @@
#include <KIO/JobUiDelegate>
#include <KLocalizedString>
#include <KProtocolManager>
#include <KProtocolInfo>
#include <QMenu>
#include <KMessageBox>
#include <KFileItemListProperties>
@ -523,6 +524,13 @@ void DolphinMainWindow::toggleSplitView()
updateViewActions();
}
void DolphinMainWindow::toggleSplitStash()
{
DolphinTabPage* tabPage = m_tabWidget->currentTabPage();
tabPage->setSplitViewEnabled(false);
tabPage->setSplitViewEnabled(true, QUrl("stash:/"));
}
void DolphinMainWindow::reloadView()
{
clearStatusBar();
@ -1041,6 +1049,15 @@ void DolphinMainWindow::setupActions()
actionCollection()->setDefaultShortcut(split, Qt::Key_F3);
connect(split, &QAction::triggered, this, &DolphinMainWindow::toggleSplitView);
QAction* stashSplit = actionCollection()->addAction(QStringLiteral("split_stash"));
actionCollection()->setDefaultShortcut(stashSplit, Qt::CTRL | Qt::Key_S);
stashSplit->setText(i18nc("@action:intoolbar Stash", "Stash"));
stashSplit->setToolTip(i18nc("@info", "Opens the stash virtual directory in a split window"));
stashSplit->setIcon(QIcon::fromTheme(QStringLiteral("folder-visiting")));
stashSplit->setCheckable(false);
stashSplit->setVisible(KProtocolInfo::isKnownProtocol("stash"));
connect(stashSplit, &QAction::triggered, this, &DolphinMainWindow::toggleSplitStash);
QAction* reload = actionCollection()->addAction(QStringLiteral("reload"));
reload->setText(i18nc("@action:inmenu View", "Reload"));
actionCollection()->setDefaultShortcut(reload, Qt::Key_F5);

View file

@ -224,6 +224,9 @@ private slots:
*/
void toggleSplitView();
/** Dedicated action to open the stash:/ ioslave in split view. */
void toggleSplitStash();
/** Reloads the currently active view. */
void reloadView();

View file

@ -71,13 +71,13 @@ bool DolphinTabPage::splitViewEnabled() const
return m_splitViewEnabled;
}
void DolphinTabPage::setSplitViewEnabled(bool enabled)
void DolphinTabPage::setSplitViewEnabled(bool enabled, const QUrl &secondaryUrl)
{
if (m_splitViewEnabled != enabled) {
m_splitViewEnabled = enabled;
if (enabled) {
const QUrl& url = m_primaryViewContainer->url();
const QUrl& url = (secondaryUrl.isEmpty()) ? m_primaryViewContainer->url() : secondaryUrl;
m_secondaryViewContainer = createViewContainer(url);
const bool placesSelectorVisible = m_primaryViewContainer->urlNavigator()->isPlacesSelectorVisible();

View file

@ -50,7 +50,7 @@ public:
*
* If \a enabled is true, it creates a secondary view with the url of the primary view.
*/
void setSplitViewEnabled(bool enabled);
void setSplitViewEnabled(bool enabled, const QUrl &secondaryUrl = QUrl());
/**
* @return The primary view containter.

View file

@ -27,6 +27,7 @@
<Action name="show_hidden_files" />
<Separator/>
<Action name="split_view" />
<Action name="split_stash" />
<Action name="reload" />
<Action name="stop" />
<Separator/>
@ -97,6 +98,7 @@
<Action name="edit_find"/>
<Action name="show_preview" />
<Action name="split_view" />
<Action name="split_stash" />
</ToolBar>
<ActionProperties scheme="Default">
<Action priority="0" name="go_back"/>