mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-17 15:31:20 +00:00
Use tab for switching active split
REVIEW: 128564 REVIEW: 110970 BUGS: 171743
This commit is contained in:
parent
1bdebe6d7c
commit
b706108206
|
@ -323,6 +323,18 @@ void DolphinTabPage::slotViewUrlRedirection(const QUrl& oldUrl, const QUrl& newU
|
|||
emit activeViewUrlChanged(newUrl);
|
||||
}
|
||||
|
||||
void DolphinTabPage::switchActiveView()
|
||||
{
|
||||
if (!m_splitViewEnabled) {
|
||||
return;
|
||||
}
|
||||
if (m_primaryViewActive) {
|
||||
m_secondaryViewContainer->setActive(true);
|
||||
} else {
|
||||
m_primaryViewContainer->setActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
DolphinViewContainer* DolphinTabPage::createViewContainer(const QUrl& url) const
|
||||
{
|
||||
DolphinViewContainer* container = new DolphinViewContainer(url, m_splitter);
|
||||
|
@ -332,5 +344,8 @@ DolphinViewContainer* DolphinTabPage::createViewContainer(const QUrl& url) const
|
|||
connect(view, &DolphinView::activated,
|
||||
this, &DolphinTabPage::slotViewActivated);
|
||||
|
||||
connect(view, &DolphinView::toggleActiveViewRequested,
|
||||
this, &DolphinTabPage::switchActiveView);
|
||||
|
||||
return container;
|
||||
}
|
||||
|
|
|
@ -149,6 +149,8 @@ private slots:
|
|||
*/
|
||||
void slotViewUrlRedirection(const QUrl& oldUrl, const QUrl& newUrl);
|
||||
|
||||
void switchActiveView();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Creates a new view container and does the default initialization.
|
||||
|
|
|
@ -62,6 +62,10 @@
|
|||
<label>Show selection toggle</label>
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="UseTabForSwitchingSplitView" type="Bool">
|
||||
<label>Use tab for switching between right and left split</label>
|
||||
<default>false</default>
|
||||
</entry>
|
||||
<entry name="ShowToolTips" type="Bool">
|
||||
<label>Show tooltips</label>
|
||||
<default>false</default>
|
||||
|
|
|
@ -41,7 +41,8 @@ BehaviorSettingsPage::BehaviorSettingsPage(const QUrl& url, QWidget* parent) :
|
|||
m_naturalSorting(0),
|
||||
m_caseSensitiveSorting(0),
|
||||
m_caseInsensitiveSorting(0),
|
||||
m_renameInline(0)
|
||||
m_renameInline(0),
|
||||
m_useTabForSplitViewSwitch(0)
|
||||
{
|
||||
QVBoxLayout* topLayout = new QVBoxLayout(this);
|
||||
|
||||
|
@ -78,11 +79,15 @@ BehaviorSettingsPage::BehaviorSettingsPage(const QUrl& url, QWidget* parent) :
|
|||
// 'Inline renaming of items'
|
||||
m_renameInline = new QCheckBox(i18nc("option:check", "Rename inline"), this);
|
||||
|
||||
// 'Use tab for switching between right and left split'
|
||||
m_useTabForSplitViewSwitch = new QCheckBox(i18nc("option:check", "Use tab for switching between right and left split view"), this);
|
||||
|
||||
topLayout->addWidget(viewPropsBox);
|
||||
topLayout->addWidget(sortingPropsBox);
|
||||
topLayout->addWidget(m_showToolTips);
|
||||
topLayout->addWidget(m_showSelectionToggle);
|
||||
topLayout->addWidget(m_renameInline);
|
||||
topLayout->addWidget(m_useTabForSplitViewSwitch);
|
||||
topLayout->addStretch();
|
||||
|
||||
loadSettings();
|
||||
|
@ -95,6 +100,7 @@ BehaviorSettingsPage::BehaviorSettingsPage(const QUrl& url, QWidget* parent) :
|
|||
connect(m_caseInsensitiveSorting, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
|
||||
connect(m_caseSensitiveSorting, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
|
||||
connect(m_renameInline, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
|
||||
connect(m_useTabForSplitViewSwitch, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
|
||||
}
|
||||
|
||||
BehaviorSettingsPage::~BehaviorSettingsPage()
|
||||
|
@ -112,6 +118,7 @@ void BehaviorSettingsPage::applySettings()
|
|||
settings->setShowSelectionToggle(m_showSelectionToggle->isChecked());
|
||||
setSortingChoiceValue(settings);
|
||||
settings->setRenameInline(m_renameInline->isChecked());
|
||||
settings->setUseTabForSwitchingSplitView(m_useTabForSplitViewSwitch->isChecked());
|
||||
settings->save();
|
||||
|
||||
if (useGlobalViewProps) {
|
||||
|
@ -141,6 +148,7 @@ void BehaviorSettingsPage::loadSettings()
|
|||
m_showToolTips->setChecked(GeneralSettings::showToolTips());
|
||||
m_showSelectionToggle->setChecked(GeneralSettings::showSelectionToggle());
|
||||
m_renameInline->setChecked(GeneralSettings::renameInline());
|
||||
m_useTabForSplitViewSwitch->setChecked(GeneralSettings::useTabForSwitchingSplitView());
|
||||
|
||||
loadSortingChoiceSettings();
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ private:
|
|||
QRadioButton* m_caseInsensitiveSorting;
|
||||
|
||||
QCheckBox* m_renameInline;
|
||||
QCheckBox* m_useTabForSplitViewSwitch;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -724,6 +724,15 @@ void DolphinView::stopLoading()
|
|||
bool DolphinView::eventFilter(QObject* watched, QEvent* event)
|
||||
{
|
||||
switch (event->type()) {
|
||||
case QEvent::KeyPress:
|
||||
if (GeneralSettings::useTabForSwitchingSplitView()) {
|
||||
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
|
||||
if (keyEvent->key() == Qt::Key_Tab && keyEvent->modifiers() == Qt::NoModifier) {
|
||||
toggleActiveViewRequested();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QEvent::FocusIn:
|
||||
if (watched == m_container) {
|
||||
setActive(true);
|
||||
|
|
|
@ -546,6 +546,11 @@ signals:
|
|||
*/
|
||||
void goForwardRequested();
|
||||
|
||||
/**
|
||||
* Is emitted when the user wants to move the focus to another view.
|
||||
*/
|
||||
void toggleActiveViewRequested();
|
||||
|
||||
protected:
|
||||
/** Changes the zoom level if Control is pressed during a wheel event. */
|
||||
virtual void wheelEvent(QWheelEvent* event) Q_DECL_OVERRIDE;
|
||||
|
|
Loading…
Reference in a new issue