diff --git a/konqueror/konq_actions.cc b/konqueror/konq_actions.cc index ca9c412c63..8f01797d72 100644 --- a/konqueror/konq_actions.cc +++ b/konqueror/konq_actions.cc @@ -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 &history, +void KonqBidiHistoryAction::fillHistoryPopup( const QList &history, QPopupMenu * popup, bool onlyBack, bool onlyForward, @@ -185,51 +129,6 @@ void KonqHistoryAction::fillHistoryPopup( const QList &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 & 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 ) diff --git a/konqueror/konq_actions.h b/konqueror/konq_actions.h index 3ce3da4969..fee244b7ac 100644 --- a/konqueror/konq_actions.h +++ b/konqueror/konq_actions.h @@ -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 &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 &history ); + // Used by KonqHistoryAction and KonqBidiHistoryAction + static void fillHistoryPopup( const QList &history, + QPopupMenu * popup, + bool onlyBack = false, + bool onlyForward = false, + bool checkCurrentItem = false, + uint startPos = 0 ); + protected slots: void slotActivated( int ); diff --git a/konqueror/konq_mainwindow.cc b/konqueror/konq_mainwindow.cc index 0990a1b39d..74f767ae41 100644 --- a/konqueror/konq_mainwindow.cc +++ b/konqueror/konq_mainwindow.cc @@ -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(); diff --git a/konqueror/konq_mainwindow.h b/konqueror/konq_mainwindow.h index 1db655640d..9b46af2322 100644 --- a/konqueror/konq_mainwindow.h +++ b/konqueror/konq_mainwindow.h @@ -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;