Add check box to control tabbar mouse wheel in konqueror

Move tabbed browsing options into single dialog
This resolves Bug 910
pull/2/head
Michele Calgaro 11 years ago committed by Slávek Banko
parent 1041337c62
commit 36ba7f5345

@ -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() );

@ -24,7 +24,7 @@
<cstring>TextLabel3</cstring>
</property>
<property name="text">
<string>&lt;b&gt;Advanced Options&lt;/b&gt;</string>
<string>&lt;b&gt;Tab Options&lt;/b&gt;</string>
</property>
</widget>
<widget class="Line">
@ -49,6 +49,39 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQCheckBox">
<property name="name">
<cstring>m_pShowMMBInTabs</cstring>
</property>
<property name="text">
<string>Open &amp;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>&amp;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&amp;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>

@ -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);

@ -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;

@ -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 )

@ -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()

@ -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

@ -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 ////////////////

@ -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();

Loading…
Cancel
Save