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

List:       kde-commits
Subject:    KDE/kdelibs/kfile
From:       Rafael Fernández López <ereslibre () kde ! org>
Date:       2008-07-01 1:08:38
Message-ID: 1214874518.328169.26910.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 826583 by ereslibre:

If the splitter has been moved, do not read the config value entry.

BUG: 164648


 M  +17 -3     kfilewidget.cpp  
 M  +1 -0      kfilewidget.h  


--- trunk/KDE/kdelibs/kfile/kfilewidget.cpp #826582:826583
@@ -70,6 +70,7 @@
         : boxLayout(0),
           labeledCustomWidget(0),
           bottomCustomWidget(0),
+          speedBarWidth(-1),
           inAccept(false),
           dummyAdded(false),
           q(q)
@@ -143,6 +144,7 @@
     void _k_toggleSpeedbar( bool );
     void _k_toggleBookmarks( bool );
     void _k_slotAutoSelectExtClicked();
+    void _k_placesViewSplitterMoved();
 
     void addToRecentDocuments();
 
@@ -185,6 +187,11 @@
 
     QStringList mimetypes; //the list of possible mimetypes to save as
 
+    // caches the speed bar width. This value will be updated when the splitter
+    // is moved. This allows us to properly set a value when the dialog itself
+    // is resized
+    int speedBarWidth;
+
     // indicates if the location edit should be kept or cleared when changing
     // directories
     bool keepLocation;
@@ -1210,6 +1217,8 @@
     placesViewSplitter->setChildrenCollapsible(false);
     boxLayout->addWidget(placesViewSplitter);
 
+    QObject::connect(placesViewSplitter, SIGNAL(splitterMoved(int,int)), q, \
SLOT(_k_placesViewSplitterMoved())); +
     vbox = new QVBoxLayout();
     vbox->setMargin(0);
     QWidget *vboxWidget = new QWidget();
@@ -1592,8 +1601,6 @@
     }
     d->ops->clearHistory();
 
-    d->updateSplitterSize();
-
     QWidget::showEvent(event);
 }
 
@@ -1767,6 +1774,12 @@
     updateLocationEditExtension (extension /* extension hasn't changed */);
 }
 
+void KFileWidgetPrivate::_k_placesViewSplitterMoved()
+{
+    const QList<int> sizes = placesViewSplitter->sizes();
+    speedBarWidth = sizes[0];
+}
+
 static QString getExtensionFromPatternList(const QStringList &patternList)
 {
     QString ret;
@@ -2038,7 +2051,8 @@
     if (sizes.count() == 2) {
         // restore width of speedbar
         KConfigGroup configGroup( KGlobal::config(), ConfigGroup );
-        const int speedbarWidth = configGroup.readEntry( SpeedbarWidth, \
placesView->sizeHintForColumn(0) ); +        const int speedbarWidth = speedBarWidth \
== -1 ? configGroup.readEntry( SpeedbarWidth, placesView->sizeHintForColumn(0) ) +    \
: speedBarWidth;  const int availableWidth = q->width();
         sizes[0] = speedbarWidth + 1; // without this pixel, our places view is \
reduced 1 pixel each time is shown.  sizes[1] = availableWidth - speedbarWidth - 1;
--- trunk/KDE/kdelibs/kfile/kfilewidget.h #826582:826583
@@ -461,6 +461,7 @@
     Q_PRIVATE_SLOT( d, void _k_toggleSpeedbar( bool ) )
     Q_PRIVATE_SLOT( d, void _k_toggleBookmarks( bool ) )
     Q_PRIVATE_SLOT( d, void _k_slotAutoSelectExtClicked() )
+    Q_PRIVATE_SLOT( d, void _k_placesViewSplitterMoved() )
 };
 
 #endif /* KABSTRACTFILEWIDGET_H */


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

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