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

List:       kde-core-devel
Subject:    Re: KFileDialog, KFileTreeView, KDirLister, something's broken
From:       Michael Brade <brade () kde ! org>
Date:       2002-01-31 12:22:35
[Download RAW message or body]

On Thursday 31 January 2002 11:23, Neil Stevens wrote:
> If you use a KFileDialog to get a directory, then pass that directory to a
> KFileTreeView, the KFileTreeView gets no items.  Can anyone help me figure
> out what's wrong?
Yes, found it. The problem was that KFileTreeView::addBranch started the 
listing without the signals from KFileTreeBranch connected. Later on 
KFileTreeBranch::populate() was called which resulted in an 
KDirLister::openURL() but since the lister already listed the url it just 
called updateDirectory() which yielded no new files.

The attached patch fixes it by not calling setOpen which emits the expanded() 
signal which in turn results in populate. This also prevents 
KFileTreeBranch::addBranch to immediately start the listing. However, just 
calling populate() after addBranch() will not open the item, the user has 
still to click on it. So is there any method to open the item without 
emitting expanded? (apart from using blockSignals()?)

Oh, and the patch fixes "the animation is started after it is stopped" as 
well.

Carsten, what do you think?

-- 
Michael Brade;                 KDE Developer, Student of Computer Science
  |-mail: echo brade !#|tr -d "c oh"|s\e\d 's/e/\@/2;s/$/.org/;s/bra/k/2'
  °--web: http://www.kde.org/people/michaelb.html

KDE 3.0: Konquering the Desktops


["kfile" (text/x-diff)]

Index: kfiletreebranch.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kfile/kfiletreebranch.cpp,v
retrieving revision 1.12
diff -u -p -r1.12 kfiletreebranch.cpp
--- kfiletreebranch.cpp	2002/01/28 16:37:00	1.12
+++ kfiletreebranch.cpp	2002/01/31 12:08:31
@@ -49,7 +49,7 @@ KFileTreeBranch::KFileTreeBranch( KFileT
    
    m_root->setPixmap( 0, pix );
    m_root->setText( 0, name );
-   m_root->setOpen( true );
+//   m_root->setOpen( true );
    m_currParent= m_root;
 
    setShowingDotFiles( showHidden );
Index: kfiletreeview.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kfile/kfiletreeview.cpp,v
retrieving revision 1.11
diff -u -p -r1.11 kfiletreeview.cpp
--- kfiletreeview.cpp	2002/01/28 16:37:00	1.11
+++ kfiletreeview.cpp	2002/01/31 12:08:32
@@ -457,13 +457,13 @@ void KFileTreeView::setDirOnlyMode( KFil
 
 void KFileTreeView::populateBranch( KFileTreeBranch *brnch )
 {
+   startAnimation( brnch->root() );
+   kdDebug() << "Starting to populate !" << endl;
+   
    if( brnch )
    {
       brnch->populate();
    }
-
-   startAnimation( brnch->root() );
-   kdDebug() << "Starting to populate !" << endl;
 }
 
 void KFileTreeView::slotPopulateFinished( KFileTreeViewItem *it )


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

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