mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 09:50:12 +00:00
Adress the third round of Angelaccio's review comments
Additionally remove some redundant code concerning UrlNavigator visuals.
This commit is contained in:
parent
2d4d2ce9a1
commit
63f4981fe0
|
@ -201,7 +201,7 @@ QWidget *DolphinNavigatorsWidgetAction::createNavigatorWidget(Side side) const
|
|||
auto emptyTrashButton = newEmptyTrashButton(urlNavigator, navigatorWidget);
|
||||
layout->addWidget(emptyTrashButton);
|
||||
|
||||
connect(urlNavigator, &KUrlNavigator::urlChanged, [this]() {
|
||||
connect(urlNavigator, &KUrlNavigator::urlChanged, this, [this]() {
|
||||
// We have to wait for DolphinUrlNavigator::sizeHint() to update which
|
||||
// happens a little bit later than when urlChanged is emitted.
|
||||
this->m_adjustSpacingTimer->start();
|
||||
|
@ -231,7 +231,7 @@ QPushButton *DolphinNavigatorsWidgetAction::newEmptyTrashButton(const DolphinUrl
|
|||
connect(&Trash::instance(), &Trash::emptinessChanged,
|
||||
emptyTrashButton, &QPushButton::setDisabled);
|
||||
emptyTrashButton->hide();
|
||||
connect(urlNavigator, &KUrlNavigator::urlChanged, [emptyTrashButton, urlNavigator]() {
|
||||
connect(urlNavigator, &KUrlNavigator::urlChanged, this, [emptyTrashButton, urlNavigator]() {
|
||||
emptyTrashButton->setVisible(urlNavigator->locationUrl().scheme() == QLatin1String("trash"));
|
||||
});
|
||||
emptyTrashButton->setDisabled(Trash::isEmpty());
|
||||
|
|
|
@ -159,11 +159,9 @@ void DolphinTabPage::connectNavigators(DolphinNavigatorsWidgetAction *navigators
|
|||
{
|
||||
m_navigatorsWidget = navigatorsWidget;
|
||||
auto primaryNavigator = navigatorsWidget->primaryUrlNavigator();
|
||||
primaryNavigator->setActive(m_primaryViewActive);
|
||||
m_primaryViewContainer->connectUrlNavigator(primaryNavigator);
|
||||
if (m_splitViewEnabled) {
|
||||
auto secondaryNavigator = navigatorsWidget->secondaryUrlNavigator();
|
||||
secondaryNavigator->setActive(!m_primaryViewActive);
|
||||
m_secondaryViewContainer->connectUrlNavigator(secondaryNavigator);
|
||||
}
|
||||
resizeNavigators();
|
||||
|
@ -178,12 +176,13 @@ void DolphinTabPage::disconnectNavigators()
|
|||
}
|
||||
}
|
||||
|
||||
bool DolphinTabPage::eventFilter(QObject */* watched */, QEvent *event)
|
||||
bool DolphinTabPage::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::Resize && m_navigatorsWidget) {
|
||||
resizeNavigators();
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void DolphinTabPage::resizeNavigators() const
|
||||
|
@ -292,11 +291,9 @@ void DolphinTabPage::restoreState(const QByteArray& state)
|
|||
stream >> m_primaryViewActive;
|
||||
if (m_primaryViewActive) {
|
||||
m_primaryViewContainer->setActive(true);
|
||||
m_navigatorsWidget->primaryUrlNavigator()->setActive(true);
|
||||
} else {
|
||||
Q_ASSERT(m_splitViewEnabled);
|
||||
m_secondaryViewContainer->setActive(true);
|
||||
m_navigatorsWidget->primaryUrlNavigator()->setActive(false);
|
||||
}
|
||||
|
||||
QByteArray splitterState;
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
/**
|
||||
* Calls resizeNavigators() when a watched object is resized.
|
||||
*/
|
||||
bool eventFilter(QObject */* watched */, QEvent *event) override;
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
/**
|
||||
* Notify the connected DolphinNavigatorsWidgetAction of geometry changes which it
|
||||
|
|
|
@ -406,7 +406,7 @@ void DolphinTabWidget::currentTabChanged(int index)
|
|||
tabPage->setActive(true);
|
||||
tabPage->connectNavigators(m_navigatorsWidget);
|
||||
m_navigatorsWidget->setSecondaryNavigatorVisible(tabPage->splitViewEnabled());
|
||||
m_lastViewedTab = tabPageAt(index);
|
||||
m_lastViewedTab = tabPage;
|
||||
}
|
||||
|
||||
void DolphinTabWidget::tabInserted(int index)
|
||||
|
|
|
@ -47,10 +47,8 @@ DolphinUrlNavigator::DolphinUrlNavigator(const QUrl &url, QWidget *parent) :
|
|||
|
||||
DolphinUrlNavigatorsController::registerDolphinUrlNavigator(this);
|
||||
|
||||
connect(this, &DolphinUrlNavigator::returnPressed,
|
||||
connect(this, &KUrlNavigator::returnPressed,
|
||||
this, &DolphinUrlNavigator::slotReturnPressed);
|
||||
connect(editor(), &KUrlComboBox::completionModeChanged,
|
||||
DolphinUrlNavigatorsController::setCompletionMode);
|
||||
}
|
||||
|
||||
DolphinUrlNavigator::~DolphinUrlNavigator()
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
*
|
||||
* Makes sure that Dolphin preferences and settings are
|
||||
* applied to all constructed DolphinUrlNavigators.
|
||||
*
|
||||
* @see KUrlNavigator
|
||||
*
|
||||
* To apply changes to all instances of this class @see DolphinUrlNavigatorsController.
|
||||
*/
|
||||
class DolphinUrlNavigator : public KUrlNavigator
|
||||
{
|
||||
|
@ -55,6 +56,9 @@ public:
|
|||
/**
|
||||
* Retrieve the visual state of this DolphinUrlNavigator.
|
||||
* If two DolphinUrlNavigators have the same visual state they should look identical.
|
||||
*
|
||||
* @return a copy of the visualState of this object. Ownership of this copy is transferred
|
||||
* to the caller via std::unique_ptr.
|
||||
*/
|
||||
std::unique_ptr<VisualState> visualState() const;
|
||||
/**
|
||||
|
|
|
@ -46,6 +46,8 @@ bool DolphinUrlNavigatorsController::placesSelectorVisible()
|
|||
void DolphinUrlNavigatorsController::registerDolphinUrlNavigator(DolphinUrlNavigator *dolphinUrlNavigator)
|
||||
{
|
||||
s_instances.push_front(dolphinUrlNavigator);
|
||||
connect(dolphinUrlNavigator->editor(), &KUrlComboBox::completionModeChanged,
|
||||
DolphinUrlNavigatorsController::setCompletionMode);
|
||||
}
|
||||
|
||||
void DolphinUrlNavigatorsController::unregisterDolphinUrlNavigator(DolphinUrlNavigator *dolphinUrlNavigator)
|
||||
|
|
|
@ -291,11 +291,11 @@ void DolphinViewContainer::connectUrlNavigator(DolphinUrlNavigator *urlNavigator
|
|||
Q_CHECK_PTR(m_view);
|
||||
|
||||
urlNavigator->setLocationUrl(m_view->url());
|
||||
urlNavigator->setActive(isActive());
|
||||
if (m_urlNavigatorVisualState) {
|
||||
urlNavigator->setVisualState(*m_urlNavigatorVisualState.get());
|
||||
m_urlNavigatorVisualState.reset();
|
||||
}
|
||||
urlNavigator->setActive(isActive());
|
||||
|
||||
connect(m_view, &DolphinView::urlChanged,
|
||||
urlNavigator, &DolphinUrlNavigator::setLocationUrl);
|
||||
|
@ -307,7 +307,8 @@ void DolphinViewContainer::connectUrlNavigator(DolphinUrlNavigator *urlNavigator
|
|||
this, &DolphinViewContainer::slotUrlNavigatorLocationAboutToBeChanged);
|
||||
connect(urlNavigator, &DolphinUrlNavigator::urlSelectionRequested,
|
||||
this, &DolphinViewContainer::slotUrlSelectionRequested);
|
||||
connect(urlNavigator, &DolphinUrlNavigator::urlsDropped, this, [=](const QUrl &destination, QDropEvent *event) {
|
||||
connect(urlNavigator, &DolphinUrlNavigator::urlsDropped,
|
||||
this, [=](const QUrl &destination, QDropEvent *event) {
|
||||
m_view->dropUrls(destination, event, urlNavigator->dropWidget());
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue