Use KToolBarPopupAction (KonqHistoryAction is dead), and fixed a useless

broadcast emitted on konqueror startup (profileListDirty).

BTW, anyone who find konq windows slow to appear... Change kfmclientrc:
[Settings], StartNewKonqueror=false. It's still true in case of crashes,
but it's faster with false.

svn path=/trunk/kdebase/konqueror/; revision=72175
This commit is contained in:
David Faure 2000-11-25 19:06:23 +00:00
parent 37440734d1
commit bbe33ab0b2
4 changed files with 20 additions and 163 deletions

View file

@ -90,64 +90,8 @@ void KonqComboAction::unplug( QWidget *w )
/////////////////
KonqHistoryAction::KonqHistoryAction( const QString& text, const QString& icon, int accel, QObject* parent, const char* name )
: KAction( text, icon, accel, parent, name )
{
m_popup = 0;
}
KonqHistoryAction::~KonqHistoryAction()
{
if ( m_popup )
delete m_popup;
}
int KonqHistoryAction::plug( QWidget *widget, int index )
{
if ( widget->inherits( "KToolBar" ) )
{
KToolBar *bar = (KToolBar *)widget;
int id_ = KAction::getToolButtonID();
bar->insertButton( icon(), id_, SIGNAL( clicked() ), this,
SLOT( slotActivated() ), isEnabled(), plainText(),
index );
addContainer( bar, id_ );
connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
bar->setDelayedPopup( id_, popupMenu(), true );
return containerCount() - 1;
}
return KAction::plug( widget, index );
}
void KonqHistoryAction::unplug( QWidget *widget )
{
if ( widget->inherits( "KToolBar" ) )
{
KToolBar *bar = (KToolBar *)widget;
int idx = findContainer( bar );
if ( idx != -1 )
{
bar->removeItem( menuId( idx ) );
removeContainer( idx );
}
return;
}
KAction::unplug( widget );
}
//static - used by KonqHistoryAction and KonqBidiHistoryAction
void KonqHistoryAction::fillHistoryPopup( const QList<HistoryEntry> &history,
void KonqBidiHistoryAction::fillHistoryPopup( const QList<HistoryEntry> &history,
QPopupMenu * popup,
bool onlyBack,
bool onlyForward,
@ -185,51 +129,6 @@ void KonqHistoryAction::fillHistoryPopup( const QList<HistoryEntry> &history,
//kdDebug(1202) << "After fillHistoryPopup position: " << history.at() << endl;
}
void KonqHistoryAction::setEnabled( bool b )
{
// Is this still necessary ? Looks very standard...
int len = containerCount();
for ( int i = 0; i < len; i++ )
{
QWidget *w = container( i );
if ( w->inherits( "KToolBar" ) )
((KToolBar *)w)->setItemEnabled( menuId( i ), b );
}
KAction::setEnabled( b );
}
void KonqHistoryAction::setIconSet( const QIconSet& iconSet )
{
// Is this still necessary ? Looks very standard...
int len = containerCount();
for ( int i = 0; i < len; i++ )
{
QWidget *w = container( i );
if ( w->inherits( "KToolBar" ) )
((KToolBar *)w)->setButtonPixmap( menuId( i ), iconSet.pixmap() );
}
KAction::setIconSet( iconSet );
}
QPopupMenu *KonqHistoryAction::popupMenu()
{
if ( m_popup )
return m_popup;
m_popup = new QPopupMenu();
return m_popup;
}
///////////////////////////////
KonqBidiHistoryAction::KonqBidiHistoryAction ( QObject* parent, const char* name )
@ -292,7 +191,7 @@ void KonqBidiHistoryAction::fillGoMenu( const QList<HistoryEntry> & history )
}
assert( m_startPos >= 0 && (uint)m_startPos < history.count() );
m_currentPos = history.at(); // for slotActivated
KonqHistoryAction::fillHistoryPopup( history, m_goMenu, false, false, true, m_startPos );
KonqBidiHistoryAction::fillHistoryPopup( history, m_goMenu, false, false, true, m_startPos );
}
void KonqBidiHistoryAction::slotActivated( int id )

View file

@ -52,47 +52,6 @@ private:
const char *m_member;
};
/**
* This is a one-direction history action (such as : the list up, back or forward)
*/
class KonqHistoryAction : public KAction
{
Q_OBJECT
public:
/**
* Only constructor - because we need an icon, since this action only makes
* sense in a toolbar (as well as menubar)
*/
KonqHistoryAction( const QString& text, const QString& icon, int accel = 0,
QObject* parent = 0, const char* name = 0 );
virtual ~KonqHistoryAction();
virtual int plug( QWidget *widget, int index = -1 );
virtual void unplug( QWidget *widget );
// Used by KonqHistoryAction and KonqBidiHistoryAction
static void fillHistoryPopup( const QList<HistoryEntry> &history,
QPopupMenu * popup,
bool onlyBack = false,
bool onlyForward = false,
bool checkCurrentItem = false,
uint startPos = 0 );
virtual void setEnabled( bool b );
virtual void setIconSet( const QIconSet& iconSet );
QPopupMenu *popupMenu();
signals:
// -1 for one step back, 0 for don't move, +1 for one step forward, etc.
void activated( int );
private:
QPopupMenu *m_popup; // hack
};
/**
* Plug this action into a menu to get a bidirectional history
* (both back and forward, including current location)
@ -114,6 +73,14 @@ public:
void fillGoMenu( const QList<HistoryEntry> &history );
// Used by KonqHistoryAction and KonqBidiHistoryAction
static void fillHistoryPopup( const QList<HistoryEntry> &history,
QPopupMenu * popup,
bool onlyBack = false,
bool onlyForward = false,
bool checkCurrentItem = false,
uint startPos = 0 );
protected slots:
void slotActivated( int );

View file

@ -1865,7 +1865,7 @@ void KonqMainWindow::slotBackAboutToShow()
{
m_paBack->popupMenu()->clear();
if ( m_currentView )
KonqHistoryAction::fillHistoryPopup( m_currentView->history(), m_paBack->popupMenu(), true, false );
KonqBidiHistoryAction::fillHistoryPopup( m_currentView->history(), m_paBack->popupMenu(), true, false );
}
void KonqMainWindow::slotBack()
@ -1882,7 +1882,7 @@ void KonqMainWindow::slotForwardAboutToShow()
{
m_paForward->popupMenu()->clear();
if ( m_currentView )
KonqHistoryAction::fillHistoryPopup( m_currentView->history(), m_paForward->popupMenu(), false, true );
KonqBidiHistoryAction::fillHistoryPopup( m_currentView->history(), m_paForward->popupMenu(), false, true );
}
void KonqMainWindow::slotForward()
@ -2364,24 +2364,15 @@ void KonqMainWindow::initActions()
m_paLinkView = new KToggleAction( i18n( "Link view"), 0, this, SLOT( slotLinkView() ), actionCollection(), "link" );
// Go menu
m_paUp = new KonqHistoryAction( i18n( "&Up" ), "up", ALT+Key_Up, actionCollection(), "up" );
connect( m_paUp, SIGNAL( activated() ), this, SLOT( slotUp() ) );
m_paUp = new KToolBarPopupAction( i18n( "&Up" ), "up", ALT+Key_Up, this, SLOT( slotUp() ), actionCollection(), "up" );
connect( m_paUp->popupMenu(), SIGNAL( aboutToShow() ), this, SLOT( slotUpAboutToShow() ) );
connect( m_paUp->popupMenu(), SIGNAL( activated( int ) ), this, SLOT( slotUpActivated( int ) ) );
m_paBack = new KonqHistoryAction( i18n( "&Back" ), "back", ALT+Key_Left, actionCollection(), "back" );
connect( m_paBack, SIGNAL( activated() ), this, SLOT( slotBack() ) );
// toolbar button
m_paBack = new KToolBarPopupAction( i18n( "&Back" ), "back", ALT+Key_Left, this, SLOT( slotBack() ), actionCollection(), "back" );
connect( m_paBack->popupMenu(), SIGNAL( aboutToShow() ), this, SLOT( slotBackAboutToShow() ) );
connect( m_paBack->popupMenu(), SIGNAL( activated( int ) ), this, SLOT( slotBackActivated( int ) ) );
m_paForward = new KonqHistoryAction( i18n( "&Forward" ), "forward", ALT+Key_Right, actionCollection(), "forward" );
connect( m_paForward, SIGNAL( activated() ), this, SLOT( slotForward() ) );
m_paForward = new KToolBarPopupAction( i18n( "&Forward" ), "forward", ALT+Key_Right, this, SLOT( slotForward() ), actionCollection(), "forward" );
connect( m_paForward->popupMenu(), SIGNAL( aboutToShow() ), this, SLOT( slotForwardAboutToShow() ) );
connect( m_paForward->popupMenu(), SIGNAL( activated( int ) ), this, SLOT( slotForwardActivated( int ) ) );
@ -2676,7 +2667,7 @@ void KonqMainWindow::enableAllActions( bool enable )
m_paUnlockAll->setEnabled( false );
// Load profile submenu
m_pViewManager->profileListDirty();
m_pViewManager->profileListDirty( false );
currentProfileChanged();

View file

@ -53,7 +53,7 @@ class KonqComboAction;
class KonqFrame;
class KonqFrameBase;
class KonqFrameContainer;
class KonqHistoryAction;
class KToolBarPopupAction;
class KonqLogoAction;
class KonqPart;
class KonqViewManager;
@ -385,9 +385,9 @@ private:
KActionMenu *m_pamBookmarks;
KonqHistoryAction *m_paUp;
KonqHistoryAction *m_paBack;
KonqHistoryAction *m_paForward;
KToolBarPopupAction *m_paUp;
KToolBarPopupAction *m_paBack;
KToolBarPopupAction *m_paForward;
KAction *m_paHome;
KonqBidiHistoryAction *m_paHistory;