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

List:       kfm-devel
Subject:    [Patch] Fix for a problem with loadItem in konqviewmanager
From:       Eduardo Robles Elvira <edulix () gmail ! com>
Date:       2008-04-11 9:26:32
Message-ID: 200804111126.38630.edulix () gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hello people,

As can be seen in KonqFrameContainer::saveConfig(), that function doesn't 
necesarily save two childs. But when KonqViewManager::loadItem() is loading a 
container it wants the container to have obligatory two childs, otherwise it 
shows with kDebug() a "profile loading error" and loads a default url. The 
patch attached to this emails fixes this problem. Should I commit? =)

Greetings,
        Eduardo Robles Elvira.
-- 
"The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man." (George Bernard Shaw)

["fix-loadItem.patch" (text/x-diff)]

Index: konqviewmanager.cpp
===================================================================
--- konqviewmanager.cpp	(revisiĆ³n: 795595)
+++ konqviewmanager.cpp	(copia de trabajo)
@@ -1247,11 +1247,36 @@
     int index = cfg.readEntry( QString::fromLatin1( "activeChildIndex" \
).prepend(prefix), -1 );  
     QStringList childList = cfg.readEntry( QString::fromLatin1( "Children" \
                ).prepend( prefix ),QStringList() );
-    if( childList.count() < 2 )
+    if( childList.count() == 0 )
     {
       kWarning() << "Profile Loading Error: Less than two children in " << name ;
       // fallback to defaults
       loadItem( cfg, parent, "InitialView", defaultURL, openUrl, forcedUrl );
+    } else if( childList.count() == 1 )
+    {
+    
+        if ( !m_tabContainer ) {
+            createTabContainer(parent->asQWidget(), parent);
+            parent->insertChildFrame( m_tabContainer );
+        }
+        
+        loadItem( cfg, tabContainer(), childList.at(0), defaultURL, openUrl, \
forcedUrl ); +        QWidget* currentPage = m_tabContainer->currentWidget();
+        if (currentPage != 0L) {
+            KonqView* activeChildView = \
dynamic_cast<KonqFrameBase*>(currentPage)->activeChildView(); +            if \
(activeChildView != 0L) { +                activeChildView->setCaption( \
activeChildView->caption() ); +                activeChildView->setTabIcon( \
activeChildView->url() ); +            }
+        }
+    
+        QWidget* w = m_tabContainer->widget(index);
+        Q_ASSERT(w);
+        m_tabContainer->setActiveChild( dynamic_cast<KonqFrameBase*>(w) );
+        m_tabContainer->setCurrentIndex( index );
+        m_tabContainer->show();
+    
+    
     }
     else
     {


["signature.asc" (application/pgp-signature)]

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

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