]> cloud.milkyroute.net Git - dolphin.git/commitdiff
* Fix memory leak (DolphinCategoryDrawer is leaking...)
authorPeter Penz <peter.penz19@gmail.com>
Wed, 26 Sep 2007 11:46:49 +0000 (11:46 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Wed, 26 Sep 2007 11:46:49 +0000 (11:46 +0000)
* There is no need to explicitly turning on the category, as this is done automatically when reading out the view properties. @Rafael: I tested your error description and could not reproduce the problem anymore. If I miss something, please let me know, so that we can work together to fix this :-)

CCMAIL: ereslibre@gmail.com

svn path=/trunk/KDE/kdebase/apps/; revision=717245

src/dolphiniconsview.cpp
src/dolphiniconsview.h
src/dolphinview.cpp

index d9bfef8a476e2623b28163c376adee2d99cc094e..3da04c113a69cbd46dde69239519b5f13dc2483d 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "dolphiniconsview.h"
 
 
 #include "dolphiniconsview.h"
 
+#include "dolphincategorydrawer.h"
 #include "dolphincontroller.h"
 #include "dolphinsettings.h"
 
 #include "dolphincontroller.h"
 #include "dolphinsettings.h"
 
@@ -34,6 +35,7 @@
 DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controller) :
     KCategorizedView(parent),
     m_controller(controller),
 DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controller) :
     KCategorizedView(parent),
     m_controller(controller),
+    m_categoryDrawer(0),
     m_itemSize(),
     m_dragging(false),
     m_dropRect()
     m_itemSize(),
     m_dragging(false),
     m_dropRect()
@@ -92,10 +94,15 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle
         m_viewOptions.decorationPosition = QStyleOptionViewItem::Left;
         m_viewOptions.displayAlignment = Qt::AlignLeft | Qt::AlignVCenter;
     }
         m_viewOptions.decorationPosition = QStyleOptionViewItem::Left;
         m_viewOptions.displayAlignment = Qt::AlignLeft | Qt::AlignVCenter;
     }
+
+    m_categoryDrawer = new DolphinCategoryDrawer();
+    setCategoryDrawer(m_categoryDrawer);
 }
 
 DolphinIconsView::~DolphinIconsView()
 {
 }
 
 DolphinIconsView::~DolphinIconsView()
 {
+    delete m_categoryDrawer;
+    m_categoryDrawer = 0;
 }
 
 QRect DolphinIconsView::visualRect(const QModelIndex& index) const
 }
 
 QRect DolphinIconsView::visualRect(const QModelIndex& index) const
index 592137e5441bf599b104ed537628971ebdf1dc66..69481eb7fffaa9ce27f67c730716076e006e4d86 100644 (file)
@@ -28,6 +28,7 @@
 #include <libdolphin_export.h>
 
 class DolphinController;
 #include <libdolphin_export.h>
 
 class DolphinController;
+class DolphinCategoryDrawer;
 
 /**
  * @brief Represents the view, where each item is shown as an icon.
 
 /**
  * @brief Represents the view, where each item is shown as an icon.
@@ -81,6 +82,7 @@ private:
 
 private:
     DolphinController* m_controller;
 
 private:
     DolphinController* m_controller;
+    DolphinCategoryDrawer* m_categoryDrawer;
     QStyleOptionViewItem m_viewOptions;
 
     QSize m_itemSize;
     QStyleOptionViewItem m_viewOptions;
 
     QSize m_itemSize;
index e0a3df51e6ebc4251d5206f1261205bd2a3e71ef..73b44e6fb868c68fb07dc29d86fcb32655bcbf48 100644 (file)
@@ -51,7 +51,6 @@
 #include "viewproperties.h"
 #include "dolphinsettings.h"
 #include "dolphin_generalsettings.h"
 #include "viewproperties.h"
 #include "dolphinsettings.h"
 #include "dolphin_generalsettings.h"
-#include "dolphincategorydrawer.h"
 
 DolphinView::DolphinView(QWidget* parent,
                          const KUrl& url,
 
 DolphinView::DolphinView(QWidget* parent,
                          const KUrl& url,
@@ -805,25 +804,26 @@ void DolphinView::createView()
     // ... and recreate it representing the current mode
     switch (m_mode) {
     case IconsView: {
     // ... and recreate it representing the current mode
     switch (m_mode) {
     case IconsView: {
-        const KUrl viewPropsUrl = viewPropertiesUrl();
-        const ViewProperties props(viewPropsUrl);
-
         m_iconsView = new DolphinIconsView(this, m_controller);
         m_iconsView = new DolphinIconsView(this, m_controller);
-        m_iconsView->setCategoryDrawer(new DolphinCategoryDrawer());
         view = m_iconsView;
         view = m_iconsView;
-        setCategorizedSorting(props.categorizedSorting());
         break;
     }
 
     case DetailsView:
         m_detailsView = new DolphinDetailsView(this, m_controller);
         view = m_detailsView;
         break;
     }
 
     case DetailsView:
         m_detailsView = new DolphinDetailsView(this, m_controller);
         view = m_detailsView;
+
+        // categorized sorting is not supported yet for the details
+        // view, even if the view properties indicate this
         setCategorizedSorting(false);
         break;
 
     case ColumnView:
         m_columnView = new DolphinColumnView(this, m_controller);
         view = m_columnView;
         setCategorizedSorting(false);
         break;
 
     case ColumnView:
         m_columnView = new DolphinColumnView(this, m_controller);
         view = m_columnView;
+
+        // categorized sorting is not supported yet for the column
+        // view, even if the view properties indicate this
         setCategorizedSorting(false);
         break;
     }
         setCategorizedSorting(false);
         break;
     }