[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#931678: marked as done (buster-pu: package qdirstat/1.5-1+deb10u1)



Your message dated Sat, 01 Aug 2020 12:51:28 +0100
with message-id <43535efb498a168cf81452ca0c326f004f46adc6.camel@adam-barratt.org.uk>
and subject line Closing bugs for fixes included in 10.5 point release
has caused the Debian Bug report #931678,
regarding buster-pu: package qdirstat/1.5-1+deb10u1
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
931678: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=931678
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: release.debian.org
Severity: normal
Tags: buster
User: release.debian.org@packages.debian.org
Usertags: pu

Hello,

upstream just fixed a bug in qdirstat, where user configured MIME categories
are not saved properly, as described here:
https://github.com/shundhammer/qdirstat/issues/109

Upstream patch: https://github.com/shundhammer/qdirstat/commit/7ce3d1ebe51e55951c7b6d318dc8870b6f1eea77

I have prepared this patch:


diff -Naur '--exclude=.svn' tags/1.5-1/debian/changelog branches/buster/debian/changelog
--- tags/1.5-1/debian/changelog 2018-11-08 12:20:05.069481981 +0100
+++ branches/buster/debian/changelog    2019-07-09 10:18:06.341381029 +0200
@@ -1,3 +1,10 @@
+qdirstat (1.5-1+deb10u1) UNRELEASED; urgency=medium
+
+  * Add upstream patch 01-mime-categories-save to fix a bug where user
+    configured MIME categories are not saved.
+
+ -- Patrick Matthäi <pmatthaei@debian.org>  Tue, 09 Jul 2019 10:16:47 +0200
+
 qdirstat (1.5-1) unstable; urgency=medium

   * New upstream release.
diff -Naur '--exclude=.svn' tags/1.5-1/debian/patches/01-mime-categories-save.diff branches/buster/debian/patches/01-mime-categories-save.diff
--- tags/1.5-1/debian/patches/01-mime-categories-save.diff      1970-01-01 01:00:00.000000000 +0100
+++ branches/buster/debian/patches/01-mime-categories-save.diff 2019-07-09 10:15:19.878253032 +0200
@@ -0,0 +1,419 @@
+From 7ce3d1ebe51e55951c7b6d318dc8870b6f1eea77 Mon Sep 17 00:00:00 2001
+From: Stefan Hundhammer <Stefan.Hundhammer@gmx.de>
+Date: Mon, 1 Jul 2019 17:08:19 +0200
+Subject: [PATCH] Turned MimeCategorizer into a singleton to properly save
+ config (GitHub issue #109)
+
+---
+ src/FileDetailsView.cpp        | 11 ++--------
+ src/FileDetailsView.h          |  2 --
+ src/FileTypeStats.cpp          |  4 ++--
+ src/MainWindow.cpp             |  8 ++-----
+ src/MainWindow.h               |  2 --
+ src/MimeCategorizer.cpp        | 23 +++++++++++++++++--
+ src/MimeCategorizer.h          | 40 ++++++++++++++++++++++++----------
+ src/MimeCategoryConfigPage.cpp |  4 ++--
+ src/MimeCategoryConfigPage.h   | 12 ----------
+ src/TreemapView.cpp            | 18 +--------------
+ src/TreemapView.h              | 15 -------------
+ 11 files changed, 59 insertions(+), 80 deletions(-)
+
+diff --git a/src/FileDetailsView.cpp b/src/FileDetailsView.cpp
+index 0b8f60a..93788c4 100644
+--- a/src/FileDetailsView.cpp
++++ b/src/FileDetailsView.cpp
+@@ -23,8 +23,7 @@ FileDetailsView::FileDetailsView( QWidget * parent ):
+     QStackedWidget( parent ),
+     _ui( new Ui::FileDetailsView ),
+     _pkgUpdateTimer( new AdaptiveTimer( this ) ),
+-    _labelLimit( 40 ),
+-    _mimeCategorizer( 0 )
++    _labelLimit( 40 )
+ {
+     CHECK_NEW( _ui );
+     CHECK_NEW( _pkgUpdateTimer );
+@@ -423,13 +422,7 @@ QString FileDetailsView::limitText( const QString & longText )
+
+ QString FileDetailsView::mimeCategory( FileInfo * file )
+ {
+-    if ( ! _mimeCategorizer )
+-    {
+-        _mimeCategorizer = new MimeCategorizer( this );
+-        CHECK_NEW( _mimeCategorizer );
+-    }
+-
+-    MimeCategory * category = _mimeCategorizer->category( file );
++    MimeCategory * category = MimeCategorizer::instance()->category( file );
+
+     return category ? category->name() : "";
+ }
+diff --git a/src/FileDetailsView.h b/src/FileDetailsView.h
+index e36792c..f677b92 100644
+--- a/src/FileDetailsView.h
++++ b/src/FileDetailsView.h
+@@ -16,7 +16,6 @@
+
+ namespace QDirStat
+ {
+-    class MimeCategorizer;
+     class AdaptiveTimer;
+
+     /**
+@@ -153,7 +152,6 @@ namespace QDirStat
+         Ui::FileDetailsView * _ui;
+         AdaptiveTimer *       _pkgUpdateTimer;
+         int                   _labelLimit;
+-        MimeCategorizer *     _mimeCategorizer;
+
+     };  // class FileDetailsView
+ }     // namespace QDirStat
+diff --git a/src/FileTypeStats.cpp b/src/FileTypeStats.cpp
+index d50821f..f453776 100644
+--- a/src/FileTypeStats.cpp
++++ b/src/FileTypeStats.cpp
+@@ -21,8 +21,8 @@ FileTypeStats::FileTypeStats( QObject  * parent ):
+     QObject( parent ),
+     _totalSize( 0LL )
+ {
+-    _mimeCategorizer = new MimeCategorizer( this );
+-    CHECK_NEW( _mimeCategorizer );
++    _mimeCategorizer = MimeCategorizer::instance();
++    CHECK_PTR( _mimeCategorizer );
+
+     _otherCategory = new MimeCategory( tr( "Other" ) );
+     CHECK_NEW( _otherCategory );
+diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
+index fdce914..b405565 100644
+--- a/src/MainWindow.cpp
++++ b/src/MainWindow.cpp
+@@ -103,10 +103,7 @@ MainWindow::MainWindow():
+     _ui->dirTreeView->setCleanupCollection( _cleanupCollection );
+     _ui->treemapView->setCleanupCollection( _cleanupCollection );
+
+-    _mimeCategorizer = new MimeCategorizer();
+-    CHECK_NEW( _mimeCategorizer );
+-
+-    _ui->treemapView->setMimeCategorizer( _mimeCategorizer );
++    _ui->breadcrumbNavigator->clear();
+
+ #ifdef Q_OS_MACX
+     // This makes the application to look like more "native" on macOS
+@@ -132,6 +129,7 @@ MainWindow::~MainWindow()
+
+     writeSettings();
+     ExcludeRules::instance()->writeSettings();
++    MimeCategorizer::instance()->writeSettings();
+
+     // Relying on the QObject hierarchy to properly clean this up resulted in a
+     //        segfault; there was probably a problem in the deletion order.
+@@ -141,7 +139,6 @@ MainWindow::~MainWindow()
+
+     delete _ui->dirTreeView;
+     delete _cleanupCollection;
+-    delete _mimeCategorizer;
+     delete _selectionModel;
+     delete _dirTreeModel;
+
+@@ -919,7 +916,6 @@ void MainWindow::openConfigDialog()
+     _configDialog = new ConfigDialog( this );
+     CHECK_PTR( _configDialog );
+     _configDialog->cleanupConfigPage()->setCleanupCollection( _cleanupCollection );
+-    _configDialog->mimeCategoryConfigPage()->setMimeCategorizer( _mimeCategorizer );
+
+     if ( ! _configDialog->isVisible() )
+     {
+diff --git a/src/MainWindow.h b/src/MainWindow.h
+index 9f8050b..3054db2 100644
+--- a/src/MainWindow.h
++++ b/src/MainWindow.h
+@@ -31,7 +31,6 @@ namespace QDirStat
+     class ConfigDialog;
+     class DirTreeModel;
+     class FileInfo;
+-    class MimeCategorizer;
+     class SelectionModel;
+ }
+
+@@ -363,7 +362,6 @@ protected slots:
+     QDirStat::DirTreeModel    * _dirTreeModel;
+     QDirStat::SelectionModel  * _selectionModel;
+     QDirStat::CleanupCollection * _cleanupCollection;
+-    QDirStat::MimeCategorizer * _mimeCategorizer;
+     QDirStat::ConfigDialog    * _configDialog;
+     QActionGroup              * _layoutActionGroup;
+     QPointer<FileTypeStatsWindow> _fileTypeStatsWindow;
+diff --git a/src/MimeCategorizer.cpp b/src/MimeCategorizer.cpp
+index 7c8ad45..1d38f89 100644
+--- a/src/MimeCategorizer.cpp
++++ b/src/MimeCategorizer.cpp
+@@ -17,10 +17,26 @@
+ using namespace QDirStat;
+
+
+-MimeCategorizer::MimeCategorizer( QObject * parent ):
+-    QObject( parent ),
++MimeCategorizer * MimeCategorizer::_instance = 0;
++
++
++MimeCategorizer * MimeCategorizer::instance()
++{
++    if ( ! _instance )
++    {
++      _instance = new MimeCategorizer();
++      CHECK_NEW( _instance );
++    }
++
++    return _instance;
++}
++
++
++MimeCategorizer::MimeCategorizer():
++    QObject( 0 ),
+     _mapsDirty( true )
+ {
++    // logDebug() << "Creating MimeCategorizer" << endl;
+     readSettings();
+ }
+
+@@ -212,6 +228,7 @@ void MimeCategorizer::readSettings()
+
+ void MimeCategorizer::writeSettings()
+ {
++    // logDebug() << endl;
+     MimeCategorySettings settings;
+
+     // Remove all leftover cleanup descriptions
+@@ -226,6 +243,7 @@ void MimeCategorizer::writeSettings()
+       MimeCategory * category = _categories.at(i);
+
+       settings.setValue( "Name", category->name() );
++      // logDebug() << "Adding " << groupName << ": " << category->name() << endl;
+       writeColorEntry( settings, "Color", category->color() );
+
+       QStringList patterns = category->humanReadablePatternList( Qt::CaseInsensitive );
+@@ -303,6 +321,7 @@ void MimeCategorizer::addDefaultCategories()
+                        << "jpeg"
+                        << "jpg"
+                        << "png"
++                       << "svg"
+                        << "tif"
+                        << "tiff"
+                        << "xcf.bz2"
+diff --git a/src/MimeCategorizer.h b/src/MimeCategorizer.h
+index 24a244f..a290a33 100644
+--- a/src/MimeCategorizer.h
++++ b/src/MimeCategorizer.h
+@@ -25,22 +25,37 @@ namespace QDirStat
+      * This class is optimized for performance since the names of all files in
+      * QDirStat's DirTree need to be checked (something in the order of 200,000
+      * in a typical Linux root file system).
++     *
++     * This is a singleton class. Use instance() to get the instance. Remember
++     * to call instance()->writeSettings() in an appropriate destructor in the
++     * application to write the settings to disk.
+      **/
+     class MimeCategorizer: public QObject
+     {
+       Q_OBJECT
+
+-    public:
++    protected:
++
+       /**
+        * Constructor.
++       * This is a singleton class; use instance() instead.
+        **/
+-      MimeCategorizer( QObject * parent = 0 );
++      MimeCategorizer();
+
+       /**
+        * Destructor.
+        **/
+       virtual ~MimeCategorizer();
+
++
++    public:
++
++      /**
++       * Get the singleton for this class. The first call to this will create
++       * it.
++       **/
++      static MimeCategorizer * instance();
++
+       /**
+        * Return the MimeCategory for a FileInfo item or 0 if it doesn't fit
+        * into any of the available categories.
+@@ -50,11 +65,11 @@ namespace QDirStat
+       /**
+        * Return the MimeCategory for a filename or 0 if it doesn't fit into
+        * any of the available categories.
+-         *
+-         * If 'suffix_ret' is non-null, it returns the suffix used if the
+-         * category was found by a suffix rule. If the category was not found
+-         * or if a regexp (rather than a suffix rule) matched, this returns an
+-         * empty string.
++       *
++       * If 'suffix_ret' is non-null, it returns the suffix used if the
++       * category was found by a suffix rule. If the category was not found
++       * or if a regexp (rather than a suffix rule) matched, this returns an
++       * empty string.
+        **/
+       MimeCategory * category( const QString & filename, QString * suffix_ret = 0 );
+
+@@ -96,6 +111,7 @@ namespace QDirStat
+        **/
+       void writeSettings();
+
++
+     protected:
+
+       /**
+@@ -128,11 +144,13 @@ namespace QDirStat
+       // Data members
+       //
+
+-      bool             _mapsDirty;
+-      MimeCategoryList _categories;
++      static MimeCategorizer *        _instance;
++
++      bool                            _mapsDirty;
++      MimeCategoryList                _categories;
+
+-      QMap<QString, MimeCategory *> _caseInsensitiveSuffixMap;
+-      QMap<QString, MimeCategory *> _caseSensitiveSuffixMap;
++      QMap<QString, MimeCategory *>   _caseInsensitiveSuffixMap;
++      QMap<QString, MimeCategory *>   _caseSensitiveSuffixMap;
+
+     };        // class MimeCategorizer
+
+diff --git a/src/MimeCategoryConfigPage.cpp b/src/MimeCategoryConfigPage.cpp
+index 1c4ba0a..6e1d3d0 100644
+--- a/src/MimeCategoryConfigPage.cpp
++++ b/src/MimeCategoryConfigPage.cpp
+@@ -30,10 +30,11 @@ using namespace QDirStat;
+ MimeCategoryConfigPage::MimeCategoryConfigPage( QWidget * parent ):
+     ListEditor( parent ),
+     _ui( new Ui::MimeCategoryConfigPage ),
+-    _categorizer( 0 ),
++    _categorizer( MimeCategorizer::instance() ),
+     _dirTree( 0 )
+ {
+     CHECK_NEW( _ui );
++    CHECK_PTR( _categorizer );
+
+     _ui->setupUi( this );
+     setListWidget  ( _ui->listWidget   );
+@@ -86,7 +87,6 @@ void MimeCategoryConfigPage::discardChanges()
+     // logDebug() << endl;
+
+     listWidget()->clear();
+-    _categorizer->clear();
+     _categorizer->readSettings();
+ }
+
+diff --git a/src/MimeCategoryConfigPage.h b/src/MimeCategoryConfigPage.h
+index 4ae98a1..e9bf1a3 100644
+--- a/src/MimeCategoryConfigPage.h
++++ b/src/MimeCategoryConfigPage.h
+@@ -30,18 +30,6 @@ namespace QDirStat
+       MimeCategoryConfigPage( QWidget * parent = 0 );
+       virtual ~MimeCategoryConfigPage();
+
+-      /**
+-       * Set the MimeCategorizer to work on.
+-       **/
+-      void setMimeCategorizer( MimeCategorizer * categorizer )
+-          { _categorizer = categorizer; }
+-
+-      /**
+-       * Return the internal MimeCategorizer.
+-       **/
+-      MimeCategorizer * mimeCategorizer() const
+-          { return _categorizer; }
+-
+     public slots:
+
+       /**
+diff --git a/src/TreemapView.cpp b/src/TreemapView.cpp
+index f40e498..af9e6bb 100644
+--- a/src/TreemapView.cpp
++++ b/src/TreemapView.cpp
+@@ -34,7 +34,6 @@ TreemapView::TreemapView( QWidget * parent ):
+     _selectionModel(0),
+     _selectionModelProxy(0),
+     _cleanupCollection(0),
+-    _mimeCategorizer(0),
+     _rebuilder(0),
+     _rootTile(0),
+     _currentItem(0),
+@@ -632,15 +631,6 @@ QSize TreemapView::visibleSize()
+ }
+
+
+-void TreemapView::setMimeCategorizer( MimeCategorizer * newCategorizer )
+-{
+-    if ( _mimeCategorizer )
+-      delete _mimeCategorizer;
+-
+-    _mimeCategorizer = newCategorizer;
+-}
+-
+-
+ void TreemapView::setFixedColor( const QColor & color )
+ {
+     _fixedColor          = color;
+@@ -657,13 +647,7 @@ QColor TreemapView::tileColor( FileInfo * file )
+     {
+       if ( file->isFile() )
+       {
+-          if ( ! _mimeCategorizer )
+-          {
+-              _mimeCategorizer = new MimeCategorizer( this );
+-              CHECK_NEW( _mimeCategorizer );
+-          }
+-
+-          MimeCategory * category = _mimeCategorizer->category( file );
++          MimeCategory * category = MimeCategorizer::instance()->category( file );
+
+           if ( category )
+               return category->color();
+diff --git a/src/TreemapView.h b/src/TreemapView.h
+index 1f1e0f7..00aaf5b 100644
+--- a/src/TreemapView.h
++++ b/src/TreemapView.h
+@@ -43,7 +43,6 @@ namespace QDirStat
+     class SelectionModelProxy;
+     class CleanupCollection;
+     class FileInfoSet;
+-    class MimeCategorizer;
+     class DelayedRebuilder;
+
+
+@@ -132,19 +131,6 @@ namespace QDirStat
+        **/
+       QColor tileColor( FileInfo * file );
+
+-      /**
+-       * Return the MimeCategorizer (the class that maps filenames to treemap
+-       * colors) or 0 if it is not created yet. The MimeCategorizer is
+-       * created lazily when needed.
+-       **/
+-      MimeCategorizer * mimeCategorizer() const { return _mimeCategorizer; }
+-
+-      /**
+-       * Set the MimeCategorizer (the class that maps filenames to treemap
+-       * colors).
+-       **/
+-      void setMimeCategorizer( MimeCategorizer * categorizer );
+-
+       /**
+        * Use a fixed color for all tiles. To undo this, set an invalid QColor
+        * with the QColor default constructor.
+@@ -493,7 +479,6 @@ namespace QDirStat
+       SelectionModel      * _selectionModel;
+       SelectionModelProxy * _selectionModelProxy;
+       CleanupCollection   * _cleanupCollection;
+-      MimeCategorizer     * _mimeCategorizer;
+         DelayedRebuilder    * _rebuilder;
+       TreemapTile         * _rootTile;
+       TreemapTile         * _currentItem;
diff -Naur '--exclude=.svn' tags/1.5-1/debian/patches/series branches/buster/debian/patches/series
--- tags/1.5-1/debian/patches/series    1970-01-01 01:00:00.000000000 +0100
+++ branches/buster/debian/patches/series       2019-07-09 10:16:36.229853140 +0200
@@ -0,0 +1 @@
+01-mime-categories-save.diff



-- System Information:
Debian Release: 10.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

--- End Message ---
--- Begin Message ---
Package: release.debian.org
Version: 10.5

Hi,

Each of these bugs relates to an update that was included in today's
stable point release.

Regards,

Adam

--- End Message ---

Reply to: