[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/apps/plasma/applets/folderview
From:       Fredrik Höglund <fredrik () kde ! org>
Date:       2010-01-13 18:55:15
Message-ID: 1263408915.641918.21722.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1074263 by fredrik:

- Call KDirLister::isFinished() instead of tracking this in the IconView.

  This also fixes the assumption that the lister is active when the IconView
  is created, which when false will result in a permanent loading animation.

- Set the minimum size hint for icon view to the size of one grid cell.

  This gives the applet a more reasonable size after moving it from
  from the panel to the desktop.

Fixed for: KDE 4.4 RC2
BUG: 205680


 M  +26 -8     iconview.cpp  
 M  +1 -1      iconview.h  


--- trunk/KDE/kdebase/apps/plasma/applets/folderview/iconview.cpp #1074262:1074263
@@ -73,7 +73,6 @@
       m_numTextLines(2),
       m_layoutBroken(false),
       m_needPostLayoutPass(false),
-      m_initialListing(true),
       m_positionsLoaded(false),
       m_doubleClick(false),
       m_dragInProgress(false),
@@ -289,7 +288,7 @@
 {
     QStringList data;
 
-    if (m_layoutBroken && !m_initialListing && m_validRows == m_items.size()) {
+    if (m_layoutBroken && !listingInProgress() && m_validRows == m_items.size()) {
         int version = 1;
         data << QString::number(version);
         data << QString::number(m_items.size());
@@ -321,6 +320,17 @@
     size.rwidth() = qMax(w, m_iconSize.width()) + left + right;
     size.rheight() = top + bottom + m_iconSize.height() + fm.lineSpacing() * textLineCount() + 4;
 
+    // Update the minimum size hint
+    const Plasma::Containment *containment = qobject_cast<Plasma::Containment*>(parentWidget());
+    if (!containment || !containment->isContainment()) {
+        getContentsMargins(&left, &top, &right, &bottom);
+        QSize minSize = size + QSize(20 + left + right, 20 + top + bottom);
+        if (m_flow == LeftToRight || m_flow == RightToLeft) {
+            minSize.rwidth() += m_scrollBar->geometry().width();
+        }
+        setMinimumSize(minSize);
+    }
+
     // Schedule a full relayout
     if (m_validRows > 0 && size != m_gridSize) {
         m_validRows = 0;
@@ -331,12 +341,23 @@
     m_gridSize = size;
 }
 
+bool IconView::listingInProgress() const
+{
+    if (m_dirModel) {
+        if (KDirLister *lister = m_dirModel->dirLister()) {
+            return !lister->isFinished();
+        }
+    }
+
+    return false;
+}
+
 void IconView::rowsInserted(const QModelIndex &parent, int first, int last)
 {
     Q_UNUSED(parent)
     m_regionCache.clear();
 
-    if (!m_layoutBroken || m_initialListing) {
+    if (!m_layoutBroken || listingInProgress()) {
         if (first < m_validRows) {
             m_validRows = 0;
         }
@@ -470,7 +491,6 @@
 
 void IconView::listingClear()
 {
-    m_initialListing = true;
     markAreaDirty(visibleArea());
     updateScrollBar();
     update();
@@ -479,7 +499,6 @@
 void IconView::listingCompleted()
 {
     m_delayedCacheClearTimer.start(5000, this);
-    m_initialListing = false;
 
     if (m_validRows == m_model->rowCount()) {
         emit busy(false);
@@ -489,7 +508,6 @@
 void IconView::listingCanceled()
 {
     m_delayedCacheClearTimer.start(5000, this);
-    m_initialListing = false;
 
     if (m_validRows == m_model->rowCount()) {
         emit busy(false);
@@ -676,7 +694,7 @@
                 }
             }
             // If we've finished laying out all the icons
-            if (!m_initialListing && !m_needPostLayoutPass && count == m_items.size()) {
+            if (!m_needPostLayoutPass && count == m_items.size() && !listingInProgress()) {
                 needUpdate |= doLayoutSanityCheck();
             }
         } else {
@@ -721,7 +739,7 @@
 
     if (m_validRows < m_items.size() || m_needPostLayoutPass) {
         m_delayedLayoutTimer.start(10, this);
-    } else if (!m_initialListing) {
+    } else if (!listingInProgress()) {
         emit busy(false);
     }
 
--- trunk/KDE/kdebase/apps/plasma/applets/folderview/iconview.h #1074262:1074263
@@ -115,6 +115,7 @@
 
     void updateGridSize();
 
+    bool listingInProgress() const;
     bool renameInProgress() const;
     bool dragInProgress() const;
     bool popupVisible() const;
@@ -228,7 +229,6 @@
     int m_numTextLines;
     bool m_layoutBroken;
     bool m_needPostLayoutPass;
-    bool m_initialListing;
     bool m_positionsLoaded;
     bool m_doubleClick;
     bool m_dragInProgress;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic