]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/dolphinview.cpp
Change "Date" to "Modified" and allow access to new "Accessed" time field
[dolphin.git] / src / views / dolphinview.cpp
index 5466fd38efc716351cb6264823208ffe15a37c06..f5ba63d1ee41511cb06f43353dd90180c527c6f3 100644 (file)
 #endif
 #include <KFormat>
 
-namespace {
-    const int MaxModeEnum = DolphinView::CompactView;
-}
-
 DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
     QWidget(parent),
     m_active(true),
@@ -215,19 +211,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();
@@ -725,9 +709,39 @@ 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();
+        break;
+
+    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);
@@ -1520,7 +1534,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