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

List:       kde-core-devel
Subject:    Re: Some ioslave errors show in the browser?
From:       David Faure <david () mandrakesoft ! com>
Date:       2002-01-18 19:27:30
[Download RAW message or body]

On Friday 18 January 2002 19:23, jowenn@bigfoot.com wrote:
> This happens, because the first node in the tree
> get's expanded (which was wanted by some users)

Hmm, found the setOpen(true). I don't remember adding that one ;)

> and the subdirectory couldn't be parsed.
> 
> The same could happen for the lan IO slave, when a
> timeout occurs.
> 
> I think it's the old bug, which already existed in
> the old sideber code, where I took the directory
> tree views from. Interesting that I didn't notice
> it for some time.
> 
> David, I think you wrote much of the tree class,
> before I "ported" it. Could you have a look?

Yes but didn't you take over its maintainance ? ;-)
(Note that this wasn't a problem with the old sidebar, since it couldn't have 
"Services" as the toplevel item, it was always an item itself, initially 
closed)


Hmm, so we're simply trying to list something that's unavailable. 
I guess the error box shouldn't be shown, we should eat the error silently. 
Hmm, KDirLister doesn't provide a way to do that.
Maybe it should get a boolean "showErrors" or something like that ?

Anyway, I would go for something like the patch below, with a check for 
isOpeningFirstChild() in dirtree_module.cpp, to ask the dirlister to hide the 
error.

Index: konq_sidebartree.cpp
===================================================================
RCS file: /home/kde/kdebase/konqueror/sidebar/trees/konq_sidebartree.cpp,v
retrieving revision 1.13
diff -u -p -r1.13 konq_sidebartree.cpp
--- konq_sidebartree.cpp        2002/01/13 21:51:22     1.13
+++ konq_sidebartree.cpp        2002/01/18 19:23:55
@@ -95,6 +95,7 @@ KonqSidebarTree::KonqSidebarTree( KonqSi

     m_currentBeforeDropItem = 0;
     m_dropItem = 0;
+    m_bOpeningFirstChild = false;

     addColumn( QString::null );
     header()->hide();
@@ -138,7 +139,11 @@ KonqSidebarTree::KonqSidebarTree( KonqSi
     m_dirtreeDir.type=virt;
     // Initial parsing
     rescanConfiguration();
-    if (firstChild()) firstChild()->setOpen(true);
+    if (firstChild()) {
+        m_bOpeningFirstChild = true;
+        firstChild()->setOpen(true);
+        m_bOpeningFirstChild = false;
+    }
 }

 KonqSidebarTree::~KonqSidebarTree()
Index: konq_sidebartree.h
===================================================================
RCS file: /home/kde/kdebase/konqueror/sidebar/trees/konq_sidebartree.h,v
retrieving revision 1.3
diff -u -p -r1.3 konq_sidebartree.h
--- konq_sidebartree.h  2001/10/01 11:25:19     1.3
+++ konq_sidebartree.h  2002/01/18 19:23:55
@@ -89,6 +89,7 @@ public:
     KonqSidebar_Tree * part() { return m_part; }

     void lockScrolling( bool lock ) { m_scrollingLocked = lock; }
+    bool isOpeningFirstChild() const { return m_bOpeningFirstChild; }

 public slots:
     virtual void setContentsPos( int x, int y );
@@ -164,6 +165,7 @@ private:

     KonqSidebarTreeToolTip m_toolTip;
     bool m_scrollingLocked;
+    bool m_bOpeningFirstChild;

     QMap<QString,getModule> plugins;
 };

Michael, can you add something to KDirLister to make error handling more 
customizable ? Either a bool, or a virtual method.... but we already have the 
signals (canceled(url) and canceled()) but they don't provide the actual 
error code nor message.

-- 
David FAURE, david@mandrakesoft.com, faure@kde.org
http://people.mandrakesoft.com/~david, http://www.konqueror.org
KDE 3.0: Konquering the Desktops

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

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