diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2013-10-19 18:42:28 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2013-10-19 20:32:05 +0200 |
commit | 36ba7f534562e55ba880e3e2699c2aea5a5377f8 (patch) | |
tree | ea824d4dea37eafc1b8848390eaab43f967530a1 | |
parent | 1041337c62d0bd9d9b503c77b04fd825936fb784 (diff) | |
download | tdebase-36ba7f534562e55ba880e3e2699c2aea5a5377f8.tar.gz tdebase-36ba7f534562e55ba880e3e2699c2aea5a5377f8.zip |
Add check box to control tabbar mouse wheel in konqueror
Move tabbed browsing options into single dialog
This resolves Bug 910
-rw-r--r-- | kcontrol/konqhtml/advancedTabDialog.cpp | 14 | ||||
-rw-r--r-- | kcontrol/konqhtml/advancedTabOptions.ui | 35 | ||||
-rw-r--r-- | kcontrol/konqhtml/htmlopts.cpp | 39 | ||||
-rw-r--r-- | kcontrol/konqhtml/htmlopts.h | 7 | ||||
-rw-r--r-- | konqueror/konq_mainwindow.cc | 16 | ||||
-rw-r--r-- | konqueror/konq_tabs.cc | 7 | ||||
-rw-r--r-- | konqueror/konq_tabs.h | 6 | ||||
-rw-r--r-- | konqueror/konq_viewmgr.cc | 45 | ||||
-rw-r--r-- | konqueror/konq_viewmgr.h | 8 |
9 files changed, 122 insertions, 55 deletions
diff --git a/kcontrol/konqhtml/advancedTabDialog.cpp b/kcontrol/konqhtml/advancedTabDialog.cpp index f58bb9836..d9a995588 100644 --- a/kcontrol/konqhtml/advancedTabDialog.cpp +++ b/kcontrol/konqhtml/advancedTabDialog.cpp @@ -15,6 +15,11 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software + + -------------------------------------------------------------- + Additional changes: + - 2013/10/16 Michele Calgaro + * centralized "tabbed browsing" options in this dialog */ #include <tqbuttongroup.h> @@ -58,6 +63,9 @@ advancedTabDialog::advancedTabDialog(TQWidget* parent, TDEConfig* config, const layout->addSpacing( 20 ); layout->addStretch(); + connect(m_advancedWidget->m_pShowMMBInTabs, TQT_SIGNAL(clicked()), TQT_SLOT(changed())); + connect(m_advancedWidget->m_pDynamicTabbarHide, TQT_SIGNAL(clicked()), TQT_SLOT(changed())); + connect(m_advancedWidget->m_pDynamicTabbarCycle, TQT_SIGNAL(clicked()), TQT_SLOT(changed())); connect(m_advancedWidget->m_pNewTabsInBackground, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); connect(m_advancedWidget->m_pOpenAfterCurrentPage, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); connect(m_advancedWidget->m_pTabConfirm, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); @@ -77,6 +85,9 @@ advancedTabDialog::~advancedTabDialog() void advancedTabDialog::load() { m_pConfig->setGroup("FMSettings"); + m_advancedWidget->m_pShowMMBInTabs->setChecked( m_pConfig->readBoolEntry( "MMBOpensTab", false ) ); + m_advancedWidget->m_pDynamicTabbarHide->setChecked( !(m_pConfig->readBoolEntry( "AlwaysTabbedMode", false )) ); + m_advancedWidget->m_pDynamicTabbarCycle->setChecked( m_pConfig->readBoolEntry( "TabsCycleWheel", false ) ); m_advancedWidget->m_pNewTabsInBackground->setChecked( ! (m_pConfig->readBoolEntry( "NewTabsInFront", false )) ); m_advancedWidget->m_pOpenAfterCurrentPage->setChecked( m_pConfig->readBoolEntry( "OpenAfterCurrentPage", false ) ); m_advancedWidget->m_pPermanentCloseButton->setChecked( m_pConfig->readBoolEntry( "PermanentCloseButton", false ) ); @@ -98,6 +109,9 @@ void advancedTabDialog::load() void advancedTabDialog::save() { m_pConfig->setGroup("FMSettings"); + m_pConfig->writeEntry( "MMBOpensTab", (m_advancedWidget->m_pShowMMBInTabs->isChecked()) ); + m_pConfig->writeEntry( "AlwaysTabbedMode", ( !(m_advancedWidget->m_pDynamicTabbarHide->isChecked())) ); + m_pConfig->writeEntry( "TabsCycleWheel", (m_advancedWidget->m_pDynamicTabbarCycle->isChecked()) ); m_pConfig->writeEntry( "NewTabsInFront", !(m_advancedWidget->m_pNewTabsInBackground->isChecked()) ); m_pConfig->writeEntry( "OpenAfterCurrentPage", m_advancedWidget->m_pOpenAfterCurrentPage->isChecked() ); m_pConfig->writeEntry( "PermanentCloseButton", m_advancedWidget->m_pPermanentCloseButton->isChecked() ); diff --git a/kcontrol/konqhtml/advancedTabOptions.ui b/kcontrol/konqhtml/advancedTabOptions.ui index df4419e95..3e4acb644 100644 --- a/kcontrol/konqhtml/advancedTabOptions.ui +++ b/kcontrol/konqhtml/advancedTabOptions.ui @@ -24,7 +24,7 @@ <cstring>TextLabel3</cstring> </property> <property name="text"> - <string><b>Advanced Options</b></string> + <string><b>Tab Options</b></string> </property> </widget> <widget class="Line"> @@ -50,6 +50,39 @@ <cstring>unnamed</cstring> </property> <widget class="TQCheckBox"> + <property name="name"> + <cstring>m_pShowMMBInTabs</cstring> + </property> + <property name="text"> + <string>Open &links in new tab instead of in new window</string> + </property> + <property name="whatsThis" stdset="0"> + <string>This will open a new tab instead of a new window in various situations, such as choosing a link or a folder with the middle mouse button.</string> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>m_pDynamicTabbarHide</cstring> + </property> + <property name="text"> + <string>&Hide the tab bar when only one tab is open</string> + </property> + <property name="whatsThis" stdset="0"> + <string>This will display the tab bar only if there are two or more tabs. Otherwise it will always be displayed.</string> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>m_pDynamicTabbarCycle</cstring> + </property> + <property name="text"> + <string>C&ycle tabs with mouse wheel</string> + </property> + <property name="whatsThis" stdset="0"> + <string>This will cycle through tabs when there are two or more tabs using the mouse wheel.</string> + </property> + </widget> + <widget class="TQCheckBox"> <property name="name"> <cstring>m_pNewTabsInBackground</cstring> </property> diff --git a/kcontrol/konqhtml/htmlopts.cpp b/kcontrol/konqhtml/htmlopts.cpp index f8731f60d..5ba1a8d9b 100644 --- a/kcontrol/konqhtml/htmlopts.cpp +++ b/kcontrol/konqhtml/htmlopts.cpp @@ -4,6 +4,10 @@ // (c) Sven Radej 1998 // (c) David Faure 1998 // (c) 2001 Waldo Bastian <bastian@kde.org> +// +// -------------------------------------------------------------- +// - 2013/10/16 Michele Calgaro +// Move some options to the 'advancedTabDialog' dialog #include <tqlayout.h>//CT - 12Nov1998 #include <tqwhatsthis.h> @@ -82,26 +86,9 @@ KMiscHTMLOptions::KMiscHTMLOptions(TDEConfig *config, TQString group, TQWidget * // Tabbed Browsing TQGroupBox *bgTabbedBrowsing = new TQGroupBox( 0, Qt::Vertical, i18n("Tabbed Browsing"), this ); - TQVBoxLayout *laygroup = new TQVBoxLayout(bgTabbedBrowsing->layout(), KDialog::spacingHint() ); - - m_pShowMMBInTabs = new TQCheckBox( i18n( "Open &links in new tab instead of in new window" ), bgTabbedBrowsing ); - TQWhatsThis::add( m_pShowMMBInTabs, i18n("This will open a new tab instead of a new window in various situations, " - "such as choosing a link or a folder with the middle mouse button.") ); - connect(m_pShowMMBInTabs, TQT_SIGNAL(clicked()), TQT_SLOT(slotChanged())); - laygroup->addWidget(m_pShowMMBInTabs); - - m_pDynamicTabbarHide = new TQCheckBox( i18n( "Hide the tab bar when only one tab is open" ), bgTabbedBrowsing ); - TQWhatsThis::add( m_pDynamicTabbarHide, i18n("This will display the tab bar only if there are two or more tabs. Otherwise it will always be displayed.") ); - connect(m_pDynamicTabbarHide, TQT_SIGNAL(clicked()), TQT_SLOT(slotChanged())); - laygroup->addWidget(m_pDynamicTabbarHide); - - m_pDynamicTabbarCycle = new TQCheckBox( i18n( "C&ycle tabs with mouse wheel" ), bgTabbedBrowsing ); - TQWhatsThis::add( m_pDynamicTabbarCycle, i18n("This will cycle through tabs when there are two or more tabs.") ); - connect(m_pDynamicTabbarCycle, TQT_SIGNAL(clicked()), TQT_SLOT(slotChanged())); - laygroup->addWidget(m_pDynamicTabbarCycle); - - TQHBoxLayout *laytab = new TQHBoxLayout(laygroup, KDialog::spacingHint()); - TQPushButton *advancedTabButton = new TQPushButton( i18n( "Advanced Options"), bgTabbedBrowsing ); + TQHBoxLayout *laytab = new TQHBoxLayout(bgTabbedBrowsing->layout(), KDialog::spacingHint()); + + TQPushButton *advancedTabButton = new TQPushButton( i18n( "Show &tab options"), bgTabbedBrowsing ); laytab->addWidget(advancedTabButton); laytab->addStretch(); connect(advancedTabButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(launchAdvancedTabDialog())); @@ -299,14 +286,9 @@ void KMiscHTMLOptions::load( bool useDefaults ) m_pMaxFormCompletionItems->setValue( m_pConfig->readNumEntry( "MaxFormCompletionItems", 10 ) ); m_pMaxFormCompletionItems->setEnabled( m_pFormCompletionCheckBox->isChecked() ); - m_pConfig->setGroup("FMSettings"); - m_pShowMMBInTabs->setChecked( m_pConfig->readBoolEntry( "MMBOpensTab", false ) ); - m_pDynamicTabbarHide->setChecked( ! (m_pConfig->readBoolEntry( "AlwaysTabbedMode", false )) ); - m_pDynamicTabbarCycle->setChecked( m_pConfig->readBoolEntry( "TabsCycleWheel", true ) ); - TDEConfig config("kbookmarkrc", true, false); config.setReadDefaults( useDefaults ); - config.setGroup("Bookmarks"); + config.setGroup("Bookmarks"); m_pAdvancedAddBookmarkCheckBox->setChecked( config.readBoolEntry("AdvancedAddBookmarkDialog", false) ); m_pOnlyMarkedBookmarksCheckBox->setChecked( config.readBoolEntry("FilteredToolbar", false) ); @@ -372,11 +354,6 @@ void KMiscHTMLOptions::save() m_pConfig->writeEntry( "FormCompletion", m_pFormCompletionCheckBox->isChecked() ); m_pConfig->writeEntry( "MaxFormCompletionItems", m_pMaxFormCompletionItems->value() ); - - m_pConfig->setGroup("FMSettings"); - m_pConfig->writeEntry( "MMBOpensTab", m_pShowMMBInTabs->isChecked() ); - m_pConfig->writeEntry( "AlwaysTabbedMode", !(m_pDynamicTabbarHide->isChecked()) ); - m_pConfig->writeEntry( "TabsCycleWheel", m_pDynamicTabbarCycle->isChecked() ); m_pConfig->sync(); TDEConfig config("kbookmarkrc", false, false); diff --git a/kcontrol/konqhtml/htmlopts.h b/kcontrol/konqhtml/htmlopts.h index 43ba62cee..c318d0628 100644 --- a/kcontrol/konqhtml/htmlopts.h +++ b/kcontrol/konqhtml/htmlopts.h @@ -4,6 +4,10 @@ // // (c) Sven Radej 1998 // (c) David Faure 1998 +// +// -------------------------------------------------------------- +// - 2013/10/16 Michele Calgaro +// Move some options to the 'advancedTabDialog' dialog #ifndef __KMISCHTML_OPTIONS_H #define __KMISCHTML_OPTIONS_H @@ -60,10 +64,7 @@ private: TQCheckBox* m_pAutoRedirectCheckBox; TQCheckBox* m_pOpenMiddleClick; TQCheckBox* m_pBackRightClick; - TQCheckBox* m_pShowMMBInTabs; TQCheckBox* m_pFormCompletionCheckBox; - TQCheckBox* m_pDynamicTabbarHide; - TQCheckBox* m_pDynamicTabbarCycle; TQCheckBox* m_pAdvancedAddBookmarkCheckBox; TQCheckBox* m_pOnlyMarkedBookmarksCheckBox; KIntNumInput* m_pMaxFormCompletionItems; 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<KonqFrameTabs*>(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<KonqFrameTabs*>( m_pDocContainer )->setAlwaysTabbedMode( - KonqSettings::alwaysTabbedMode() ); + convertDocContainer(); + static_cast<KonqFrameTabs*>( m_pDocContainer )->setAlwaysTabbedMode(KonqSettings::alwaysTabbedMode()); + static_cast<KonqFrameTabs*>( 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<KonqFrameTabs*>( m_pDocContainer )->setAlwaysTabbedMode( alwaysTabbedMode ); + static_cast<KonqFrameTabs*>( 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<KonqFrameTabs*>(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<KonqFrameTabs*>(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(); |