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