From 690670800ab50e27c4cb32dc686a74c31a1f785a Mon Sep 17 00:00:00 2001 From: tpearson Date: Sun, 23 Oct 2011 22:10:05 +0000 Subject: Add option to disable Konqueror smooth scrolling Thanks to Nick Leverton for the patch! git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1260417 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kcontrol/konqhtml/htmlopts.cpp | 47 +++++++++++++++++++++++++++++++++++++++++- kcontrol/konqhtml/htmlopts.h | 2 ++ 2 files changed, 48 insertions(+), 1 deletion(-) (limited to 'kcontrol/konqhtml') diff --git a/kcontrol/konqhtml/htmlopts.cpp b/kcontrol/konqhtml/htmlopts.cpp index e6a6c59bb..88e9685bb 100644 --- a/kcontrol/konqhtml/htmlopts.cpp +++ b/kcontrol/konqhtml/htmlopts.cpp @@ -29,6 +29,7 @@ enum UnderlineLinkType { UnderlineAlways=0, UnderlineNever=1, UnderlineHover=2 }; enum AnimationsType { AnimationsAlways=0, AnimationsNever=1, AnimationsLoopOnce=2 }; +enum SmoothScrollingType { SmoothScrollingAlways=0, SmoothScrollingNever=1, SmoothScrollingWhenEfficient=2 }; //----------------------------------------------------------------------------- KMiscHTMLOptions::KMiscHTMLOptions(KConfig *config, TQString group, TQWidget *parent, const char *) @@ -187,11 +188,30 @@ KMiscHTMLOptions::KMiscHTMLOptions(KConfig *config, TQString group, TQWidget *pa whatsThis = i18n("Controls how Konqueror shows animated images:
" ""); TQWhatsThis::add( label, whatsThis); TQWhatsThis::add( m_pAnimationsCombo, whatsThis); connect(m_pAnimationsCombo, TQT_SIGNAL(activated(int)), TQT_SLOT(slotChanged())); + label = new TQLabel( i18n("Sm&ooth scrolling"), this); + m_pSmoothScrollingCombo = new TQComboBox( false, this ); + label->setBuddy(m_pSmoothScrollingCombo); + m_pSmoothScrollingCombo->insertItem(i18n("SmoothScrolling","Enabled"), SmoothScrollingAlways); + m_pSmoothScrollingCombo->insertItem(i18n("SmoothScrolling","Disabled"), SmoothScrollingNever); + // not implemented: m_pSmoothScrollingCombo->insertItem(i18n("SmoothScrolling","WhenEfficient"), SmoothScrollingWhenEfficient); + lay->addWidget(label, row, 0); + lay->addWidget(m_pSmoothScrollingCombo, row, 1); + row++; + whatsThis = i18n("Determines whether Konqueror should use smooth steps to scroll HTML pages, or whole steps:
" + ""); + TQWhatsThis::add( label, whatsThis); + TQWhatsThis::add( m_pSmoothScrollingCombo, whatsThis); + connect(m_pSmoothScrollingCombo, TQT_SIGNAL(activated(int)), TQT_SLOT(slotChanged())); + + lay->setRowStretch(row, 1); load(); @@ -276,6 +296,15 @@ void KMiscHTMLOptions::load( bool useDefaults ) m_pAdvancedAddBookmarkCheckBox->setChecked( config.readBoolEntry("AdvancedAddBookmarkDialog", false) ); m_pOnlyMarkedBookmarksCheckBox->setChecked( config.readBoolEntry("FilteredToolbar", false) ); + KConfig kdeglobals("kdeglobals", true, false); + kdeglobals.setReadDefaults( useDefaults ); + kdeglobals.setGroup("KDE"); + bool smoothScrolling = kdeglobals.readBoolEntry("SmoothScroll", DEFAULT_SMOOTHSCROLL); + if (smoothScrolling) + m_pSmoothScrollingCombo->setCurrentItem( SmoothScrollingAlways ); + else + m_pSmoothScrollingCombo->setCurrentItem( SmoothScrollingNever ); + emit changed( useDefaults ); #undef READ_ENTRY @@ -340,6 +369,22 @@ void KMiscHTMLOptions::save() config.writeEntry("FilteredToolbar", m_pOnlyMarkedBookmarksCheckBox->isChecked()); config.sync(); + KConfig kdeglobals("kdeglobals", false, false); + kdeglobals.setGroup("KDE"); + switch(m_pSmoothScrollingCombo->currentItem()) + { + case SmoothScrollingAlways: + kdeglobals.writeEntry( "SmoothScroll", true ); + break; + case SmoothScrollingNever: + kdeglobals.writeEntry( "SmoothScroll", false ); + break; + // case SmoothScrollingWhenEfficient: + // kdeglobals.writeEntry( "SmoothScroll", somethingelse ); + // break; + } + kdeglobals.sync(); + TQByteArray data; if ( !kapp->dcopClient()->isAttached() ) kapp->dcopClient()->attach(); diff --git a/kcontrol/konqhtml/htmlopts.h b/kcontrol/konqhtml/htmlopts.h index 503eadfdd..42024f71b 100644 --- a/kcontrol/konqhtml/htmlopts.h +++ b/kcontrol/konqhtml/htmlopts.h @@ -20,6 +20,7 @@ // Change cursor over links // Underline links // AutoLoad Images +// Smooth Scrolling // ... there is room for others :)) @@ -51,6 +52,7 @@ private: TQComboBox* m_pUnderlineCombo; TQComboBox* m_pAnimationsCombo; + TQComboBox* m_pSmoothScrollingCombo; TQCheckBox* m_cbCursor; TQCheckBox* m_pAutoLoadImagesCheckBox; TQCheckBox* m_pUnfinishedImageFrameCheckBox; -- cgit v1.2.3