X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/b706108206be1c9e777e1ace02aa99247fdfc3ca..41b0e4297313b6549f9178c77c30101a42b0525f:/src/views/dolphinview.cpp diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 4105628ee..c7267cee0 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -211,19 +212,7 @@ void DolphinView::setActive(bool active) m_active = active; - QColor color = KColorScheme(QPalette::Active, KColorScheme::View).background().color(); - if (!active) { - color.setAlpha(150); - } - - QWidget* viewport = m_container->viewport(); - if (viewport) { - QPalette palette; - palette.setColor(viewport->backgroundRole(), color); - viewport->setPalette(palette); - } - - update(); + updatePalette(); if (active) { m_container->setFocus(); @@ -596,7 +585,6 @@ void DolphinView::setUrl(const QUrl& url) clearSelection(); - emit urlAboutToBeChanged(url); m_url = url; hideToolTip(); @@ -721,9 +709,31 @@ void DolphinView::stopLoading() m_model->cancelDirectoryLoading(); } +void DolphinView::updatePalette() +{ + QColor color = KColorScheme(QPalette::Active, KColorScheme::View).background().color(); + if (!m_active) { + color.setAlpha(150); + } + + QWidget* viewport = m_container->viewport(); + if (viewport) { + QPalette palette; + palette.setColor(viewport->backgroundRole(), color); + viewport->setPalette(palette); + } + + update(); +} + bool DolphinView::eventFilter(QObject* watched, QEvent* event) { switch (event->type()) { + case QEvent::PaletteChange: + updatePalette(); + QPixmapCache::clear(); + break; + case QEvent::KeyPress: if (GeneralSettings::useTabForSwitchingSplitView()) { QKeyEvent* keyEvent = static_cast(event); @@ -1012,7 +1022,7 @@ void DolphinView::slotItemHovered(int index) const QPoint pos = m_container->mapToGlobal(itemRect.topLeft().toPoint()); itemRect.moveTo(pos); - m_toolTipManager->showToolTip(item, itemRect); + m_toolTipManager->showToolTip(item, itemRect, nativeParentWidget()->windowHandle()); } emit requestItemInfo(item); @@ -1525,7 +1535,7 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con KIO::Job * job = KIO::moveAs(oldUrl, newUrl); KJobWidgets::setWindow(job, this); KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Rename, {oldUrl}, newUrl, job); - job->ui()->setAutoErrorHandlingEnabled(true); + job->uiDelegate()->setAutoErrorHandlingEnabled(true); if (!newNameExistsAlready) { // Only connect the result signal if there is no item with the new name