Commit 6bf96702 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix "Use index.html" when we activate it, all tab must be changed.

Before when we change tab and we reload it, "use html" was used.
=> so now we update all page to use index.html.

"Use index.html" is not local to tab, but global to konqueror

svn path=/trunk/kdebase/konqueror/; revision=253173
parent 9eb9a037
......@@ -1486,18 +1486,13 @@ void KonqMainWindow::slotViewModeToggle( bool toggle )
}
}
void KonqMainWindow::slotShowHTML()
void KonqMainWindow::showHTML( KonqView * _view, bool b, bool _activateView )
{
bool b = !m_currentView->allowHTML();
m_currentView->stop();
m_currentView->setAllowHTML( b );
// Save this setting, either locally or globally
// This has to be done before calling openView since it relies on it
if ( m_bSaveViewPropertiesLocally )
{
KURL u ( b ? m_currentView->url() : KURL( m_currentView->url().directory() ) );
KURL u ( b ? _view->url() : KURL( _view->url().directory() ) );
u.addPath(".directory");
if ( u.isLocalFile() )
{
......@@ -1512,24 +1507,35 @@ void KonqMainWindow::slotShowHTML()
KConfigGroupSaver cgs( config, "MainView Settings" );
config->writeEntry( "HTMLAllowed", b );
config->sync();
m_bHTMLAllowed = b;
if ( _activateView )
m_bHTMLAllowed = b;
}
if ( b && m_currentView->supportsServiceType( "inode/directory" ) )
if ( b && _view->supportsServiceType( "inode/directory" ) )
{
m_currentView->lockHistory();
openView( "inode/directory", m_currentView->url(), m_currentView );
_view->lockHistory();
openView( "inode/directory", _view->url(), _view );
}
else if ( !b && m_currentView->supportsServiceType( "text/html" ) )
else if ( !b && _view->supportsServiceType( "text/html" ) )
{
KURL u( m_currentView->url() );
KURL u( _view->url() );
QString fileName = u.fileName().lower();
if ( KProtocolInfo::supportsListing( u ) && fileName.startsWith("index.htm") ) {
m_currentView->lockHistory();
_view->lockHistory();
u.setPath( u.directory() );
openView( "inode/directory", u, m_currentView );
openView( "inode/directory", u, _view );
}
}
}
void KonqMainWindow::slotShowHTML()
{
bool b = !m_currentView->allowHTML();
m_currentView->stop();
m_currentView->setAllowHTML( b );
showHTML( m_currentView, b, true ); //current view
m_pViewManager->showHTML(b );
}
......@@ -3246,7 +3252,7 @@ void KonqMainWindow::initActions()
connect( m_pBookmarkMenu,
SIGNAL( aboutToShowContextMenu(const KBookmark &, QPopupMenu*) ),
this, SLOT( slotFillContextMenu(const KBookmark &, QPopupMenu*) ));
KAction *addBookmark = actionCollection()->action("add_bookmark");
if (addBookmark)
addBookmark->setText(i18n("Bookmark This Location"));
......
......@@ -205,6 +205,8 @@ public:
void setShowHTML( bool b );
void showHTML( KonqView * view, bool b, bool _activateView );
bool fullScreenMode() const { return m_bFullScreen; }
/**
......@@ -555,7 +557,7 @@ private:
bool stayPreloaded();
bool checkPreloadResourceUsage();
void updateFullScreen();
KNewMenu * m_pMenuNew;
......
......@@ -1638,6 +1638,32 @@ void KonqViewManager::setLoading( KonqView *view, bool loading )
}
}
void KonqViewManager::showHTML(bool b)
{
if (m_pDocContainer == 0L) return;
if (m_pDocContainer->frameType() != "Tabs") return;
KonqFrameTabs* tabContainer = static_cast<KonqFrameTabs*>(m_pDocContainer);
QPtrList<KonqFrameBase> frameList = *tabContainer->childFrameList();
QPtrListIterator<KonqFrameBase> it( frameList );
for ( it.toFirst(); it != 0L; ++it )
{
if ( it.current()->activeChildView() && it.current()->activeChildView() !=m_pMainWindow->currentView())
{
it.current()->activeChildView()->setAllowHTML( b );
if( !it.current()->activeChildView()->locationBarURL().isEmpty())
{
m_pMainWindow->showHTML( it.current()->activeChildView(), b, false );
}
}
}
}
///////////////// Debug stuff ////////////////
#ifndef NDEBUG
......
......@@ -266,6 +266,7 @@ public:
#endif
void setLoading( KonqView *view, bool loading );
void showHTML(bool b);
protected slots:
void emitActivePartChanged();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment