]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinview.cpp
prevent that the user can open more than one instance of the settings dialog
[dolphin.git] / src / dolphinview.cpp
index 72c06512e17ce2b4b68f57a53d04bcd4e9ace7dd..0bd24ecb3a5a73f8f291efd5e9a2397864113984 100644 (file)
@@ -87,6 +87,7 @@ DolphinView::DolphinView(QWidget* parent,
     m_storedCategorizedSorting(false),
     m_tabsForFiles(false),
     m_isContextMenuOpen(false),
+    m_ignoreViewProperties(false),
     m_mode(DolphinView::IconsView),
     m_topLayout(0),
     m_controller(0),
@@ -233,7 +234,7 @@ void DolphinView::setMode(Mode mode)
     }
 
     emit modeChanged();
-    
+
     updateZoomLevel(oldZoomLevel);
     if (m_showPreview) {
         loadDirectory(viewPropsUrl);
@@ -455,6 +456,8 @@ void DolphinView::reload()
 
 void DolphinView::refresh()
 {
+    m_ignoreViewProperties = false;
+
     const bool oldActivationState = m_active;
     const int oldZoomLevel = m_controller->zoomLevel();
     m_active = true;
@@ -550,7 +553,7 @@ QString DolphinView::statusBarText() const
             const QString name = list.first().name();
             text = (folderCount == 1) ? i18nc("@info:status", "<filename>%1</filename> selected", name) :
                                         i18nc("@info:status", "<filename>%1</filename> selected (%2)",
-                                              name, KIO::convertSize(totalFileSize));                                            
+                                              name, KIO::convertSize(totalFileSize));
         } else {
             // at least 2 items are selected
             const QString foldersText = i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount);
@@ -626,7 +629,7 @@ void DolphinView::renameSelectedItems()
             // TODO: check how this can be integrated into KIO::FileUndoManager/KonqOperations
             // as one operation instead of n rename operations like it is done now...
             Q_ASSERT(newName.contains('#'));
-            
+
             // currently the items are sorted by the selection order, resort
             // them by the file name
             qSort(items.begin(), items.end(), lessThan);
@@ -1153,6 +1156,10 @@ KUrl DolphinView::viewPropertiesUrl() const
 
 void DolphinView::applyViewProperties(const KUrl& url)
 {
+    if (m_ignoreViewProperties) {
+        return;
+    }
+
     if (isColumnViewActive() && rootUrl().isParentOf(url)) {
         // The column view is active, hence don't apply the view properties
         // of sub directories (represented by columns) to the view. The
@@ -1222,6 +1229,13 @@ void DolphinView::applyViewProperties(const KUrl& url)
         // the used zoom level of the controller must be adjusted manually:
         updateZoomLevel(oldZoomLevel);
     }
+
+    if (DolphinSettings::instance().generalSettings()->globalViewProps()) {
+        // During the lifetime of a DolphinView instance the global view properties
+        // should not be changed. This allows e. g. to split a view and use different
+        // view properties for each view.
+        m_ignoreViewProperties = true;
+    }
 }
 
 void DolphinView::createView()
@@ -1253,6 +1267,7 @@ void DolphinView::createView()
     Q_ASSERT(view != 0);
     view->installEventFilter(this);
     view->viewport()->installEventFilter(this);
+    setFocusProxy(view);
 
     if (m_mode != ColumnView) {
         // Give the view the ability to auto-expand its directories on hovering
@@ -1315,6 +1330,7 @@ void DolphinView::deleteView()
         // before deleting the view: Otherwise when having a split
         // view the other view will get the focus and will request
         // an activation (see DolphinView::eventFilter()).
+        setFocusProxy(0);
         setFocus();
 
         m_topLayout->removeWidget(view);
@@ -1323,7 +1339,7 @@ void DolphinView::deleteView()
         disconnect(view);
         m_controller->disconnect(view);
         view->disconnect();
-        
+
         bool deleteView = true;
         foreach (const QAbstractItemView* expandedView, m_expandedViews) {
             if (view == expandedView) {