#13260: Fix for linked views saved in profile, introducing isLoadingProfile().

svn path=/trunk/kdebase/konqueror/; revision=68477
This commit is contained in:
David Faure 2000-10-21 11:15:10 +00:00
parent cde14a0ae9
commit 138279bdd7
4 changed files with 49 additions and 30 deletions

View file

@ -607,12 +607,13 @@ void KonqMainWindow::slotOpenURLRequest( const KURL &url, const KParts::URLArgs
//Called by slotOpenURLRequest
void KonqMainWindow::openURL( KonqView *childView, const KURL &url, const KParts::URLArgs &args )
{
kdDebug(1202) << "KonqMainWindow::openURL (from slotOpenURLRequest) url=" << url.prettyURL() << endl;
KonqOpenURLRequest req;
req.args = args;
if ( args.postData.size() > 0 ) // todo merge in if statement below
{
kdDebug() << "KonqMainWindow::openURL - with postData. serviceType=" << args.serviceType << endl;
kdDebug(1202) << "KonqMainWindow::openURL - with postData. serviceType=" << args.serviceType << endl;
openURL( childView, url, args.serviceType, req, args.trustedSource );
return;
}
@ -684,15 +685,17 @@ void KonqMainWindow::abortLoading()
void KonqMainWindow::slotCreateNewWindow( const KURL &url, const KParts::URLArgs &args )
{
kdDebug(1202) << "KonqMainWindow::slotCreateNewWindow url=" << url.prettyURL() << endl;
KonqMisc::createNewWindow( url, args );
}
void KonqMainWindow::slotCreateNewWindow( const KURL &url, const KParts::URLArgs &args,
const KParts::WindowArgs &windowArgs, KParts::ReadOnlyPart *&part )
{
kdDebug(1202) << "KonqMainWindow::slotCreateNewWindow(4 args) url=" << url.prettyURL()
<< " args.serviceType=" << args.serviceType << endl;
KonqMainWindow *mainWindow = new KonqMainWindow( KURL(), false );
mainWindow->setInitialFrameName( args.frameName );
//FIXME: obey args (like passing post-data (to KRun), etc.)
KonqOpenURLRequest req;
req.args = args;
@ -763,7 +766,7 @@ void KonqMainWindow::slotCreateNewWindow( const KURL &url, const KParts::URLArgs
view->frame()->statusbar()->hide();
if ( !windowArgs.resizable )
// ### this doesn't seem to work either :-(
// ### this doesn't seem to work :-(
mainWindow->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
if ( windowArgs.fullscreen )
@ -772,6 +775,7 @@ void KonqMainWindow::slotCreateNewWindow( const KURL &url, const KParts::URLArgs
void KonqMainWindow::slotNewWindow()
{
// ### Maybe use profile from current window, if set ?
if ( m_currentView && m_currentView->url().protocol() == QString::fromLatin1( "http" ) )
KonqMisc::createBrowserWindowFromProfile(
locate( "data", QString::fromLatin1("konqueror/profiles/webbrowsing") ),

View file

@ -161,24 +161,27 @@ void KonqView::switchView( KonqViewFactory &viewFactory )
connectPart();
// Honour "non-removeable passive mode" (like the dirtree)
QVariant prop = m_service->property( "X-KDE-BrowserView-PassiveMode");
if ( prop.isValid() && prop.toBool() )
if ( !m_pMainWindow->viewManager()->isLoadingProfile() )
{
setPassiveMode( true ); // set as passive
}
// Honour "linked view"
prop = m_service->property( "X-KDE-BrowserView-LinkedView");
if ( prop.isValid() && prop.toBool() )
{
setLinkedView( true ); // set as linked
// Two views : link both
if (m_pMainWindow->viewCount() <= 2) // '1' can happen if this view is not yet in the map
// Honour "non-removeable passive mode" (like the dirtree)
QVariant prop = m_service->property( "X-KDE-BrowserView-PassiveMode");
if ( prop.isValid() && prop.toBool() )
{
KonqView * otherView = m_pMainWindow->otherView( this );
if (otherView)
otherView->setLinkedView( true );
setPassiveMode( true ); // set as passive
}
// Honour "linked view"
prop = m_service->property( "X-KDE-BrowserView-LinkedView");
if ( prop.isValid() && prop.toBool() )
{
setLinkedView( true ); // set as linked
// Two views : link both
if (m_pMainWindow->viewCount() <= 2) // '1' can happen if this view is not yet in the map
{
KonqView * otherView = m_pMainWindow->otherView( this );
if (otherView)
otherView->setLinkedView( true );
}
}
}
}

View file

@ -515,7 +515,13 @@ void KonqViewManager::loadViewProfile( KConfig &cfg, const QString & filename, c
m_pMainContainer->setGeometry( 0, 0, m_pMainWindow->width(), m_pMainWindow->height() );
m_pMainContainer->show();
// This flag is used by KonqView, to distinguish manual view creation
// from profile loading (e.g. in switchView)
m_bLoadingProfile = true;
loadItem( cfg, m_pMainContainer, rootItem, defaultURL, forcedURL.isEmpty() );
m_bLoadingProfile = false;
}
else
{
@ -546,7 +552,7 @@ void KonqViewManager::loadViewProfile( KConfig &cfg, const QString & filename, c
printFullHierarchy( m_pMainContainer );
#endif
kdDebug(1202) << "KonqViewManager::loadViewProfile done" << endl;
//kdDebug(1202) << "KonqViewManager::loadViewProfile done" << endl;
}
void KonqViewManager::setActivePart( KParts::Part *part, bool immediate )
@ -649,7 +655,7 @@ void KonqViewManager::loadItem( KConfig &cfg, KonqFrameContainer *parent,
return; //ugh..
}
kdDebug(1202) << "Creating View Stuff" << endl;
//kdDebug(1202) << "Creating View Stuff" << endl;
KonqView *childView = setupView( parent, viewFactory, service, partServiceOffers, appServiceOffers, serviceType, passiveMode );
childView->setLinkedView( linkedView );
@ -667,7 +673,7 @@ void KonqViewManager::loadItem( KConfig &cfg, KonqFrameContainer *parent,
if ( !url.isEmpty() )
{
kdDebug(1202) << "loadItem: calling openURL " << url.prettyURL() << endl;
//kdDebug(1202) << "loadItem: calling openURL " << url.prettyURL() << endl;
childView->openURL( url, url.prettyURL() );
}
}

View file

@ -139,15 +139,9 @@ public:
QString currentProfileText() const { return m_currentProfileText; }
/**
* Load the config entries for a view.
* @param cfg the config file
* ...
* @param defaultURL the URL to use if the profile doesn't contain urls
* @param openURL whether to open urls at all (from the profile or using @p defaultURL).
* (this is set to false when we have a forcedURL to open)
* Whether we are currently loading a profile
*/
void loadItem( KConfig &cfg, KonqFrameContainer *parent,
const QString &name, const KURL & defaultURL, bool openURL );
bool isLoadingProfile() const { return m_bLoadingProfile; }
void clear();
@ -194,6 +188,17 @@ protected slots:
protected:
/**
* Load the config entries for a view.
* @param cfg the config file
* ...
* @param defaultURL the URL to use if the profile doesn't contain urls
* @param openURL whether to open urls at all (from the profile or using @p defaultURL).
* (this is set to false when we have a forcedURL to open)
*/
void loadItem( KConfig &cfg, KonqFrameContainer *parent,
const QString &name, const KURL & defaultURL, bool openURL );
// Disabled - we do it ourselves
virtual void setActiveInstance( KInstance * ) {}
@ -234,6 +239,7 @@ private:
QGuardedPtr<KActionMenu> m_pamProfiles;
bool m_bProfileListDirty;
bool m_bLoadingProfile;
QString m_currentProfile;
QString m_currentProfileText;