From 36ba7f534562e55ba880e3e2699c2aea5a5377f8 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sat, 19 Oct 2013 18:42:28 +0200 Subject: Add check box to control tabbar mouse wheel in konqueror Move tabbed browsing options into single dialog This resolves Bug 910 --- konqueror/konq_mainwindow.cc | 16 ++++++++++++---- konqueror/konq_tabs.cc | 7 +++++++ konqueror/konq_tabs.h | 6 +++--- konqueror/konq_viewmgr.cc | 45 +++++++++++++++++++++++++++++++------------- konqueror/konq_viewmgr.h | 8 ++++++++ 5 files changed, 62 insertions(+), 20 deletions(-) (limited to 'konqueror') diff --git a/konqueror/konq_mainwindow.cc b/konqueror/konq_mainwindow.cc index a3cda9154..b06ccdfe2 100644 --- a/konqueror/konq_mainwindow.cc +++ b/konqueror/konq_mainwindow.cc @@ -17,6 +17,12 @@ along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + -------------------------------------------------------------- + Additional changes: + - 2013/10/17 Michele Calgaro + * add support for updating tab options at runtime (no need to restart Konqueror + or reload the profile */ #include "konq_mainwindow.h" @@ -4234,7 +4240,7 @@ void KonqMainWindow::updateViewActions() KonqFrameTabs* tabContainer = static_cast(docContainer); bool state = (tabContainer->count()>1); m_paRemoveTab->setEnabled( state ); - m_paRemoveOtherTabs->setEnabled( state ); + m_paRemoveOtherTabs->setEnabled( state ); m_paBreakOffTab->setEnabled( state ); m_paActivateNextTab->setEnabled( state ); m_paActivatePrevTab->setEnabled( state ); @@ -4772,8 +4778,8 @@ void KonqMainWindow::slotPopupMenu( KXMLGUIClient *client, const TQPoint &_globa // Those actions go into the PopupMenuGUIClient, since that's the one defining them. - TDEAction *actNewWindow = 0L, *actNewTab = 0L; - if( doTabHandling ) + TDEAction *actNewWindow = 0L; + if (doTabHandling) { if (_args.forcesNewWindow()) { actNewWindow = new TDEAction( i18n( "Open in T&his Window" ), 0, TQT_TQOBJECT(this), TQT_SLOT( slotPopupThisWindow() ), konqyMenuClient->actionCollection(), "sameview" ); @@ -4879,7 +4885,6 @@ void KonqMainWindow::slotPopupMenu( KXMLGUIClient *client, const TQPoint &_globa popupItems.clear(); // Deleted by konqyMenuClient's actioncollection - //delete actNewTab; //delete actNewWindow; delete actPaste; @@ -4979,6 +4984,9 @@ void KonqMainWindow::reparseConfiguration() MapViews::ConstIterator end = m_mapViews.end(); for (; it != end; ++it ) (*it)->reparseConfiguration(); + + // Push updates to KonqViewManager as well + viewManager()->reparseConfiguration(); } void KonqMainWindow::saveProperties( TDEConfig *config ) diff --git a/konqueror/konq_tabs.cc b/konqueror/konq_tabs.cc index 252f80f3d..09502f85e 100644 --- a/konqueror/konq_tabs.cc +++ b/konqueror/konq_tabs.cc @@ -17,6 +17,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + -------------------------------------------------------------- + Additional changes: + - 2013/10/16 Michele Calgaro + add "scroll tabs on mouse wheel event" functionality */ #include "konq_tabs.h" @@ -188,6 +193,8 @@ KonqFrameTabs::KonqFrameTabs(TQWidget* parent, KonqFrameContainerBase* parentCon TQT_SLOT( slotReceivedDropEvent( TQWidget *, TQDropEvent * ) ) ); connect( this, TQT_SIGNAL( initiateDrag( TQWidget * )), TQT_SLOT( slotInitiateDrag( TQWidget * ) ) ); + + setMouseWheelScroll(KonqSettings::tabsCycleWheel()); } KonqFrameTabs::~KonqFrameTabs() diff --git a/konqueror/konq_tabs.h b/konqueror/konq_tabs.h index 4c84bd2f9..f21bf82a9 100644 --- a/konqueror/konq_tabs.h +++ b/konqueror/konq_tabs.h @@ -88,8 +88,8 @@ public: public slots: - void slotCurrentChanged( TQWidget* newPage ); - void setAlwaysTabbedMode( bool ); + void slotCurrentChanged(TQWidget* newPage); + void setAlwaysTabbedMode(bool enable); signals: void ctrlTabPressed(); @@ -124,7 +124,7 @@ private: bool m_permanentCloseButtons; bool m_alwaysTabBar; bool m_MouseMiddleClickClosesTab; - int m_closeOtherTabsId; + int m_closeOtherTabsId; }; #endif diff --git a/konqueror/konq_viewmgr.cc b/konqueror/konq_viewmgr.cc index 635d0b1ae..a1a61f86e 100644 --- a/konqueror/konq_viewmgr.cc +++ b/konqueror/konq_viewmgr.cc @@ -16,6 +16,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + -------------------------------------------------------------- + Additional changes: + - 2013/10/17 Michele Calgaro + * add "scroll tabs on mouse wheel event" functionality + * add support for updating options at runtime (no need to restart Konqueror + or reload the profile */ #include "konq_viewmgr.h" @@ -78,9 +84,9 @@ KonqView* KonqViewManager::Initialize( const TQString &serviceType, const TQStri setActivePart( childView->part() ); m_pDocContainer = childView->frame(); - convertDocContainer(); - static_cast( m_pDocContainer )->setAlwaysTabbedMode( - KonqSettings::alwaysTabbedMode() ); + convertDocContainer(); + static_cast( m_pDocContainer )->setAlwaysTabbedMode(KonqSettings::alwaysTabbedMode()); + static_cast( m_pDocContainer )->setMouseWheelScroll(KonqSettings::tabsCycleWheel()); m_pDocContainer->widget()->show(); return childView; @@ -366,13 +372,13 @@ KonqView* KonqViewManager::addTabFromHistory( int steps, bool openAfterCurrentPa int oldPos = m_pMainWindow->currentView()->historyPos(); int newPos = oldPos + steps; - const HistoryEntry * he = m_pMainWindow->currentView()->historyAt(newPos); + const HistoryEntry * he = m_pMainWindow->currentView()->historyAt(newPos); if(!he) return 0L; KonqView* newView = 0L; newView = addTab( he->strServiceType, he->strServiceName, false, openAfterCurrentPage ); - + if(!newView) return 0L; @@ -1200,7 +1206,7 @@ void KonqViewManager::loadViewProfile( TDEConfig &cfg, const TQString & filename TQString rootItem = cfg.readEntry( "RootItem", "empty" ); - //kdDebug(1202) << "KonqViewManager::loadViewProfile : loading RootItem " << rootItem << + //kdDebug(1202) << "KonqViewManager::loadViewProfile : loading RootItem " << rootItem << //" forcedURL " << forcedURL.url() << endl; if ( forcedURL.url() != "about:blank" ) @@ -1244,6 +1250,7 @@ void KonqViewManager::loadViewProfile( TDEConfig &cfg, const TQString & filename convertDocContainer(); static_cast( m_pDocContainer )->setAlwaysTabbedMode( alwaysTabbedMode ); + static_cast( m_pDocContainer )->setMouseWheelScroll(KonqSettings::tabsCycleWheel()); // Set an active part first so that we open the URL in the current view // (to set the location bar correctly and asap) @@ -1601,9 +1608,9 @@ void KonqViewManager::loadItem( TDEConfig &cfg, KonqFrameContainerBase *parent, { KonqFrameContainer *newContainer = new KonqFrameContainer( o, parent->widget(), parent ); connect(newContainer,TQT_SIGNAL(ctrlTabPressed()),m_pMainWindow,TQT_SLOT(slotCtrlTabPressed())); - + int tabindex = -1; - if(openAfterCurrentPage && parent->frameType() == "Tabs") // Need to honor it, if possible + if(openAfterCurrentPage && parent->frameType() == "Tabs") // Need to honor it, if possible tabindex = static_cast(parent)->currentPageIndex() + 1; parent->insertChildFrame( newContainer, tabindex ); @@ -1694,12 +1701,14 @@ void KonqViewManager::profileListDirty( bool broadcast ) if ( !broadcast ) { m_bProfileListDirty = true; -#if 0 + + // #if 0 causes problems with TDevelop syntax highlighting. Converted to comments + // #if 0 // There's always one profile at least, now... - TQStringList profiles = KonqFactory::instance()->dirs()->findAllResources( "data", "konqueror/profiles/*", false, true ); - if ( m_pamProfiles ) - m_pamProfiles->setEnabled( profiles.count() > 0 ); -#endif + //TQStringList profiles = KonqFactory::instance()->dirs()->findAllResources( "data", "konqueror/profiles/*", false, true ); + //if ( m_pamProfiles ) + // m_pamProfiles->setEnabled( profiles.count() > 0 ); + // #endif return; } @@ -1793,6 +1802,16 @@ void KonqViewManager::showHTML(bool b) } } +void KonqViewManager::reparseConfiguration() +{ + KonqFrameTabs *frameTabs=static_cast(m_pDocContainer); + if (frameTabs) + { + frameTabs->setAlwaysTabbedMode(KonqSettings::alwaysTabbedMode()); + frameTabs->setMouseWheelScroll(KonqSettings::tabsCycleWheel()); + } +} + ///////////////// Debug stuff //////////////// diff --git a/konqueror/konq_viewmgr.h b/konqueror/konq_viewmgr.h index d41628ae2..adc34f465 100644 --- a/konqueror/konq_viewmgr.h +++ b/konqueror/konq_viewmgr.h @@ -15,6 +15,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + -------------------------------------------------------------- + Additional changes: + - 2013/10/17 Michele Calgaro + * add support for updating options at runtime (no need to restart Konqueror + or reload the profile */ #ifndef __konq_viewmgr_h__ @@ -286,6 +291,9 @@ public: TQString profileHomeURL() const { return m_profileHomeURL; } + //Update options + void reparseConfiguration(); + protected slots: void emitActivePartChanged(); -- cgit v1.2.1