[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Re: No flicker on initial creation of the tabbar
From: Zack Rusin <zack () kde ! org>
Date: 2004-06-25 12:12:47
Message-ID: 200406250812.55561.zack () kde ! org
[Download RAW message or body]
On Friday 25 June 2004 03:19, Stephan Binner wrote:
> On Friday 25 June 2004 01:59, Zack Rusin wrote:
> > Those are four highest priority things we should work on, but for
> > now the attached patch fixes (correctly :) including the sidebar
> > issue) the flicker on the creation of the first (second actually)
> > tab.
>
> The tabbar is initially not shown for AlwaysTabbedMode at Konqueror
> startup.
>
> For AlwaysTabbedMode==false and only one tab shown (and tabbar
> hidden) actions of sole tab context menu are still enabled (Ctrl+W or
> Ctrl+Shift+B -> crash).
k, now it works. I'll commit the patch in a little bit.
> Now you must restart Konqueror to make changes of AlwaysTabbedMode
> active.
You always had to do that.
Zack
--
Logic: The art of being wrong with confidence...
["tabs_no_flicker.diff" (text/x-diff)]
? .emacs-dirvars
? .kcfgc
? konquerorsettings.kcfgc
? one.diff
? semantic.cache
? tabs_no_flicker.diff
Index: konq_mainwindow.cc
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_mainwindow.cc,v
retrieving revision 1.1333
diff -u -3 -p -b -B -r1.1333 konq_mainwindow.cc
--- konq_mainwindow.cc 22 Jun 2004 09:51:09 -0000 1.1333
+++ konq_mainwindow.cc 25 Jun 2004 12:11:36 -0000
@@ -1119,8 +1119,6 @@ void KonqMainWindow::slotCreateNewWindow
// activate the view _now_ in order to make the menuBar() hide call work
if ( part ) {
mainWindow->viewManager()->setActivePart( part, true );
- if ( dynamic_cast<KonqFrameTabs*>(mainWindow->viewManager()->docContainer()) \
)
- mainWindow->viewManager()->revertDocContainer();
}
QString profileName = QString::fromLatin1( url.isLocalFile() ? \
"konqueror/profiles/filemanagement" : \
"konqueror/profiles/webbrowsing" );
Index: konq_tabs.cc
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_tabs.cc,v
retrieving revision 1.50
diff -u -3 -p -b -B -r1.50 konq_tabs.cc
--- konq_tabs.cc 15 May 2004 08:03:46 -0000 1.50
+++ konq_tabs.cc 25 Jun 2004 12:11:36 -0000
@@ -53,7 +53,7 @@
KonqFrameTabs::KonqFrameTabs(QWidget* parent, KonqFrameContainerBase* \
parentContainer,
KonqViewManager* viewManager, const char * name)
- : KTabWidget(parent, name), m_rightWidget(0)
+ : KTabWidget(parent, name), m_rightWidget(0), m_leftWidget(0), \
m_alwaysTabBar(false) {
//kdDebug(1202) << "KonqFrameTabs::KonqFrameTabs()" << endl;
@@ -141,13 +141,13 @@ KonqFrameTabs::KonqFrameTabs(QWidget* pa
m_pViewManager->mainWindow(), SLOT( slotRemoveTabPopup() ) );
if ( config->readBoolEntry( "AddTabButton", true ) ) {
- QToolButton * leftWidget = new QToolButton( this );
- connect( leftWidget, SIGNAL( clicked() ),
+ m_leftWidget = new QToolButton( this );
+ connect( m_leftWidget, SIGNAL( clicked() ),
m_pViewManager->mainWindow(), SLOT( slotAddTab() ) );
- leftWidget->setIconSet( SmallIcon( "tab_new" ) );
- leftWidget->adjustSize();
- QToolTip::add(leftWidget, i18n("Open a new tab"));
- setCornerWidget( leftWidget, TopLeft );
+ m_leftWidget->setIconSet( SmallIcon( "tab_new" ) );
+ m_leftWidget->adjustSize();
+ QToolTip::add(m_leftWidget, i18n("Open a new tab"));
+ setCornerWidget( m_leftWidget, TopLeft );
}
if ( config->readBoolEntry( "CloseTabButton", true ) ) {
m_rightWidget = new QToolButton( this );
@@ -374,6 +374,7 @@ void KonqFrameTabs::insertChildFrame( Ko
if (frame)
{
//kdDebug(1202) << "Adding frame" << endl;
+ bool showTabBar = (count() == 1);
insertTab(frame->widget(),"", index);
frame->setParentContainer(this);
if (index == -1) m_pChildFrameList->append(frame);
@@ -385,6 +386,10 @@ void KonqFrameTabs::insertChildFrame( Ko
activeChildView->setCaption( activeChildView->caption() );
activeChildView->setTabIcon( activeChildView->url().url() );
}
+ if (showTabBar)
+ this->showTabBar();
+ else if ( count() == 1 )
+ this->hideTabBar();//the first frame inserted (initialization)
}
else
kdWarning(1202) << "KonqFrameTabs " << this << ": insertChildFrame(0L) !" << \
endl; @@ -398,6 +403,8 @@ void KonqFrameTabs::removeChildFrame( Ko
m_pChildFrameList->remove(frame);
if (m_rightWidget)
m_rightWidget->setEnabled( m_pChildFrameList->count()>1 );
+ if (count() == 1)
+ hideTabBar();
}
else
kdWarning(1202) << "KonqFrameTabs " << this << ": removeChildFrame(0L) !" << \
endl; @@ -571,4 +578,33 @@ void KonqFrameTabs::slotInitiateDrag( QW
}
}
+void KonqFrameTabs::hideTabBar()
+{
+ if ( !m_alwaysTabBar ) {
+ m_leftWidget->hide();
+ m_rightWidget->hide();
+ tabBar()->hide();
+ }
+}
+
+void KonqFrameTabs::showTabBar()
+{
+ tabBar()->show();
+ m_leftWidget->show();
+ m_rightWidget->show();
+}
+
+void KonqFrameTabs::setAlwaysTabbedMode( bool enable )
+{
+ bool update = ( enable != m_alwaysTabBar );
+
+ m_alwaysTabBar = enable;
+ if ( update ) {
+ if ( m_alwaysTabBar )
+ showTabBar();
+ else
+ hideTabBar();
+ }
+}
+
#include "konq_tabs.moc"
Index: konq_tabs.h
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_tabs.h,v
retrieving revision 1.18
diff -u -3 -p -b -B -r1.18 konq_tabs.h
--- konq_tabs.h 15 May 2004 08:03:46 -0000 1.18
+++ konq_tabs.h 25 Jun 2004 12:11:36 -0000
@@ -89,6 +89,7 @@ public:
public slots:
void slotCurrentChanged( QWidget* newPage );
+ void setAlwaysTabbedMode( bool );
signals:
void ctrlTabPressed();
@@ -99,6 +100,8 @@ protected:
uint tabBarWidthForMaxChars( uint );
void refreshSubPopupMenuTab();
+ void hideTabBar();
+ void showTabBar();
QPtrList<KonqFrameBase>* m_pChildFrameList;
@@ -113,14 +116,17 @@ private slots:
void slotReceivedDropEvent( QDropEvent* );
void slotInitiateDrag( QWidget * );
void slotReceivedDropEvent( QWidget *, QDropEvent * );
- void slotSubPopupMenuTabActivated( int);
+ void slotSubPopupMenuTabActivated( int );
+
private:
KonqViewManager* m_pViewManager;
QPopupMenu* m_pPopupMenu;
QPopupMenu * m_pSubPopupMenuTab;
uint m_CurrentMaxLength, m_maxLength, m_minLength;
QToolButton* m_rightWidget;
+ QToolButton* m_leftWidget;
bool m_permanentCloseButtons;
+ bool m_alwaysTabBar;
};
#endif
Index: konq_viewmgr.cc
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_viewmgr.cc,v
retrieving revision 1.265
diff -u -3 -p -b -B -r1.265 konq_viewmgr.cc
--- konq_viewmgr.cc 18 Jun 2004 12:51:24 -0000 1.265
+++ konq_viewmgr.cc 25 Jun 2004 12:11:38 -0000
@@ -77,8 +77,10 @@ KonqView* KonqViewManager::Initialize( c
KConfig *config = KGlobal::config();
KConfigGroupSaver cs( config, QString::fromLatin1("FMSettings") );
- if ( config->readBoolEntry( "AlwaysTabbedMode", false ) )
+
convertDocContainer();
+ static_cast<KonqFrameTabs*>( m_pDocContainer )->setAlwaysTabbedMode(
+ config->readBoolEntry( "AlwaysTabbedMode", false ) );
m_pDocContainer->widget()->show();
return childView;
@@ -305,60 +307,6 @@ void KonqViewManager::convertDocContaine
m_pDocContainer = newContainer;
}
-void KonqViewManager::revertDocContainer()
-{
- // If the tab container is left with only one tab after the removal,
- // destroy it and put its lone child frame in its place
-
- KonqFrameTabs* tabContainer = static_cast<KonqFrameTabs*>(m_pDocContainer);
-
- KonqFrameContainerBase* parentContainer = tabContainer->parentContainer();
- kdDebug(1202) << "parentContainer=" << parentContainer << endl;
- if (parentContainer == 0L) return;
-
- bool moveNewContainer = false;
- QValueList<int> splitterSizes;
- if (parentContainer->frameType()=="Container") {
- moveNewContainer = (static_cast<KonqFrameContainer*>(parentContainer)->idAfter( \
tabContainer ) != 0);
- splitterSizes = static_cast<KonqFrameContainer*>(parentContainer)->sizes();
- }
-
- KonqFrameBase* otherFrame = tabContainer->childFrameList()->first();
- kdDebug(1202) << "otherFrame=" << otherFrame << endl;
- if (otherFrame == 0L ) return;
-
- parentContainer->widget()->setUpdatesEnabled( false );
-
- QPoint pos = otherFrame->widget()->pos();
- otherFrame->reparentFrame( m_pMainWindow, pos );
-
- tabContainer->removeChildFrame( otherFrame );
- parentContainer->removeChildFrame( tabContainer );
-
- delete tabContainer;
-
- otherFrame->reparentFrame( parentContainer->widget(), pos );
- parentContainer->insertChildFrame( otherFrame );
-
- if ( moveNewContainer ) {
- static_cast<KonqFrameContainer*>(parentContainer)->moveToFirst( \
otherFrame->widget() );
- static_cast<KonqFrameContainer*>(parentContainer)->swapChildren();
- }
- if (parentContainer->frameType()=="Container")
- static_cast<KonqFrameContainer*>(parentContainer)->setSizes( splitterSizes );
-
- otherFrame->widget()->show();
-
- parentContainer->widget()->setUpdatesEnabled( true );
-
- parentContainer->setActiveChild( otherFrame );
-
- parentContainer->activateChild();
-
- m_pDocContainer = otherFrame;
-}
-
-
KonqView* KonqViewManager::addTab(const QString &serviceType, const QString \
&serviceName, bool passiveMode, bool openAfterCurrentPage ) {
#ifdef DEBUG_VIEWMGR
@@ -592,13 +540,6 @@ void KonqViewManager::removeTab( KonqFra
tabContainer->slotCurrentChanged(tabContainer->currentPage());
- if (tabContainer->count() == 1) {
- KConfig *config = KGlobal::config();
- KConfigGroupSaver cs( config, QString::fromLatin1("FMSettings") );
- if ( !( config->readBoolEntry( "AlwaysTabbedMode", false ) ) )
- revertDocContainer();
- }
-
#ifdef DEBUG_VIEWMGR
m_pMainWindow->dumpViewList();
printFullHierarchy( m_pMainWindow );
@@ -1217,7 +1158,7 @@ void KonqViewManager::loadViewProfile( K
}
//kdDebug(1202) << "KonqViewManager::loadViewProfile : loading RootItem " << \
rootItem << endl;
- if ( alwaysTabbedMode && rootItem == "empty" )
+ if ( rootItem == "empty" )
{
cfg.writeEntry( "View0_ServiceType", "text/html" );
cfg.writeEntry( "View0_ServiceName", "html" );
@@ -1246,9 +1187,11 @@ void KonqViewManager::loadViewProfile( K
m_pMainWindow->action( "clear_location" )->activate();
}
- if ( alwaysTabbedMode && m_pDocContainer->frameType() != "Tabs")
+ if ( m_pDocContainer->frameType() != "Tabs")
convertDocContainer();
+ static_cast<KonqFrameTabs*>( m_pDocContainer )->setAlwaysTabbedMode( \
alwaysTabbedMode ); +
// Set an active part first so that we open the URL in the current view
// (to set the location bar correctly and asap)
KonqView *nextChildView = 0L;
Index: konq_viewmgr.h
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_viewmgr.h,v
retrieving revision 1.78
diff -u -3 -p -b -B -r1.78 konq_viewmgr.h
--- konq_viewmgr.h 9 May 2004 09:10:30 -0000 1.78
+++ konq_viewmgr.h 25 Jun 2004 12:11:38 -0000
@@ -90,10 +90,6 @@ public:
*/
void convertDocContainer();
- /**
- * Reverts a Tab docContainer into a View
- */
- void revertDocContainer();
/**
* Adds a tab to m_pMainContainer
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic