Fixed #3423 (m_firstIndex wasn't initialised if the Go menu wasn't shown at all)

svn path=/trunk/kdebase/konqueror/; revision=49362
This commit is contained in:
David Faure 2000-05-13 20:44:19 +00:00
parent c1a4571a41
commit c3a9565a3c
2 changed files with 17 additions and 12 deletions

View file

@ -243,6 +243,10 @@ int KonqBidiHistoryAction::plug( QWidget *widget, int index )
this, SIGNAL( menuAboutToShow() ) );
connect( m_goMenu, SIGNAL( activated( int ) ),
this, SLOT( slotActivated( int ) ) );
kdDebug(1202) << "m_goMenu->count()=" << m_goMenu->count() << endl;
// Store how many items the menu already contains.
// This means, the KonqBidiHistoryAction has to be plugged LAST in a menu !
m_firstIndex = m_goMenu->count();
return m_goMenu->count() /* hmmm, what should this be ? */;
}
return KAction::plug( widget, index );
@ -251,12 +255,8 @@ int KonqBidiHistoryAction::plug( QWidget *widget, int index )
void KonqBidiHistoryAction::fillGoMenu( const QList<HistoryEntry> & history )
{
kdDebug(1202) << "fillGoMenu position: " << history.at() << endl;
// Tricky. The first time, the menu doesn't contain history
// (but contains the other actions) -> store count at that point
if ( m_firstIndex == 0 )
{
if ( m_firstIndex == 0 ) // should never happen since done in plug
m_firstIndex = m_goMenu->count();
}
else
{ // Clean up old history (from the end, to avoid shifts)
for ( uint i = m_goMenu->count()-1 ; i >= m_firstIndex; i-- )

View file

@ -323,7 +323,7 @@ void KonqChildView::slotSpeed( KIO::Job *, unsigned long bytesPerSecond )
void KonqChildView::slotCompleted()
{
//kdDebug() << "KonqChildView::slotCompleted" << endl;
//kdDebug(1202) << "KonqChildView::slotCompleted" << endl;
m_bLoading = false;
m_pKonqFrame->statusbar()->slotLoadingProgress( -1 );
@ -332,7 +332,7 @@ void KonqChildView::slotCompleted()
if ( m_pMainView->currentChildView() == this )
{
//kdDebug() << "updating toolbar actions" << endl;
//kdDebug(1202) << "updating toolbar actions" << endl;
m_pMainView->updateToolBarActions();
}
}
@ -375,7 +375,7 @@ void KonqChildView::createHistoryEntry()
HistoryEntry * current = m_lstHistory.current();
if (current)
{
//kdDebug(1202) << "Truncating history" << endl;
//kdDebug(1202) << "Truncating history" << endl;
m_lstHistory.at( m_lstHistory.count() - 1 ); // go to last one
for ( ; m_lstHistory.current() != current ; )
{
@ -387,6 +387,8 @@ void KonqChildView::createHistoryEntry()
// Append a new entry
//kdDebug(1202) << "Append a new entry" << endl;
m_lstHistory.append( new HistoryEntry ); // made current
//kdDebug(1202) << "at=" << m_lstHistory.at() << " count=" << m_lstHistory.count() << endl;
assert( m_lstHistory.at() == (int) m_lstHistory.count() - 1 );
}
void KonqChildView::updateHistoryEntry()
@ -397,7 +399,7 @@ void KonqChildView::updateHistoryEntry()
assert( current ); // let's see if this happens
if ( current == 0L) // empty history
{
kdDebug(1202) << "Creating item because history is empty !" << endl;
kdWarning(1202) << "Creating item because history is empty !" << endl;
current = new HistoryEntry;
m_lstHistory.append( current );
}
@ -422,8 +424,11 @@ void KonqChildView::go( int steps )
if ( m_lstHistory.count() > 0 )
updateHistoryEntry();
//kdDebug(1202) << "go : " << steps << endl;
int newPos = m_lstHistory.at() + steps;
kdDebug(1202) << "go : steps=" << steps
<< " newPos=" << newPos
<< " m_lstHistory.count()=" << m_lstHistory.count()
<< endl;
assert( newPos >= 0 && (uint)newPos < m_lstHistory.count() );
// Yay, we can move there without a loop !
HistoryEntry *currentHistoryEntry = m_lstHistory.at( newPos ); // sets current item
@ -547,7 +552,7 @@ void KonqChildView::sendOpenURLEvent( const KURL &url )
void KonqChildView::initMetaView()
{
kdDebug() << "initMetaView" << endl;
kdDebug(1202) << "initMetaView" << endl;
static QString constr = QString::fromLatin1( "'Konqueror/MetaView' in ServiceTypes" );
@ -556,7 +561,7 @@ void KonqChildView::initMetaView()
if ( metaViewOffers.count() == 0 )
return;
kdDebug() << "got offers!" << endl;
kdDebug(1202) << "got offers!" << endl;
KService::Ptr service = *metaViewOffers.begin();