From a0e3f4ae50bd8ef9c006738541e0af9e0d5d1ecf Mon Sep 17 00:00:00 2001 From: Darrell Anderson Date: Fri, 31 Jan 2014 13:59:48 -0600 Subject: Move Konqueror Tabbed Browsing Advanced dialog to separate stand-alone module named User Interface. This is part of bug report 1683. --- kcontrol/konqhtml/CMakeLists.txt | 10 +- kcontrol/konqhtml/Makefile.am | 8 +- kcontrol/konqhtml/advancedTabDialog.cpp | 150 ------------------ kcontrol/konqhtml/advancedTabDialog.h | 45 ------ kcontrol/konqhtml/advancedTabOptions.ui | 199 ------------------------ kcontrol/konqhtml/htmlopts.cpp | 22 --- kcontrol/konqhtml/htmlopts.h | 1 - kcontrol/konqhtml/main.cpp | 17 +- kcontrol/konqhtml/tdehtml_userinterface.desktop | 18 +++ kcontrol/konqhtml/userInterConfig.cpp | 72 +++++++++ kcontrol/konqhtml/userInterConfig.h | 44 ++++++ kcontrol/konqhtml/userInterOpts.ui | 195 +++++++++++++++++++++++ kcontrol/konqhtml/userInterOpts_impl.cpp | 127 +++++++++++++++ kcontrol/konqhtml/userInterOpts_impl.h | 49 ++++++ 14 files changed, 526 insertions(+), 431 deletions(-) delete mode 100644 kcontrol/konqhtml/advancedTabDialog.cpp delete mode 100644 kcontrol/konqhtml/advancedTabDialog.h delete mode 100644 kcontrol/konqhtml/advancedTabOptions.ui create mode 100644 kcontrol/konqhtml/tdehtml_userinterface.desktop create mode 100644 kcontrol/konqhtml/userInterConfig.cpp create mode 100644 kcontrol/konqhtml/userInterConfig.h create mode 100644 kcontrol/konqhtml/userInterOpts.ui create mode 100644 kcontrol/konqhtml/userInterOpts_impl.cpp create mode 100644 kcontrol/konqhtml/userInterOpts_impl.h (limited to 'kcontrol/konqhtml') diff --git a/kcontrol/konqhtml/CMakeLists.txt b/kcontrol/konqhtml/CMakeLists.txt index 097ba8221..26cd535f5 100644 --- a/kcontrol/konqhtml/CMakeLists.txt +++ b/kcontrol/konqhtml/CMakeLists.txt @@ -26,6 +26,7 @@ link_directories( install( FILES tdehtml_behavior.desktop tdehtml_java_js.desktop tdehtml_fonts.desktop tdehtml_filter.desktop + tdehtml_userinterface.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) install( @@ -42,12 +43,11 @@ install( tde_add_kpart( kcm_konqhtml AUTOMOC SOURCES - advancedTabDialog.cpp htmlopts.cpp jsopts.cpp - javaopts.cpp pluginopts.cpp appearance.cpp - khttpoptdlg.cpp policydlg.cpp main.cpp + userInterOpts.ui userInterOpts_impl.cpp userInterConfig.cpp + htmlopts.cpp jsopts.cpp javaopts.cpp pluginopts.cpp + appearance.cpp khttpoptdlg.cpp policydlg.cpp main.cpp jspolicies.cpp nsconfigwidget.ui policies.cpp - domainlistview.cpp advancedTabOptions.ui - filteropts.cpp + domainlistview.cpp filteropts.cpp LINK tdehtml-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kcontrol/konqhtml/Makefile.am b/kcontrol/konqhtml/Makefile.am index 151e22aff..c1f276444 100644 --- a/kcontrol/konqhtml/Makefile.am +++ b/kcontrol/konqhtml/Makefile.am @@ -5,17 +5,17 @@ METASOURCES = AUTO kde_module_LTLIBRARIES = kcm_konqhtml.la -kcm_konqhtml_la_SOURCES = advancedTabDialog.cpp htmlopts.cpp jsopts.cpp \ +kcm_konqhtml_la_SOURCES = userInterOpts.ui userInterOpts_impl.cpp \ + userInterConfig.cpp htmlopts.cpp jsopts.cpp \ javaopts.cpp pluginopts.cpp appearance.cpp \ khttpoptdlg.cpp policydlg.cpp main.cpp \ jspolicies.cpp nsconfigwidget.ui policies.cpp \ - domainlistview.cpp advancedTabOptions.ui \ - filteropts.cpp + domainlistview.cpp filteropts.cpp kcm_konqhtml_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined kcm_konqhtml_la_LIBADD = -ltdehtml -ltdeui -xdg_apps_DATA = tdehtml_behavior.desktop tdehtml_java_js.desktop tdehtml_fonts.desktop tdehtml_filter.desktop +xdg_apps_DATA = tdehtml_behavior.desktop tdehtml_java_js.desktop tdehtml_fonts.desktop tdehtml_filter.desktop tdehtml_userinterface.desktop messages: rc.cpp $(XGETTEXT) *.cpp -o $(podir)/kcmkonqhtml.pot diff --git a/kcontrol/konqhtml/advancedTabDialog.cpp b/kcontrol/konqhtml/advancedTabDialog.cpp deleted file mode 100644 index 10e62fd53..000000000 --- a/kcontrol/konqhtml/advancedTabDialog.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* - * advancedTabDialog.cpp - * - * Copyright (c) 2002 Aaron J. Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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 -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "advancedTabDialog.h" -#include "advancedTabOptions.h" -#include "main.h" - -advancedTabDialog::advancedTabDialog(TQWidget* parent, TDEConfig* config, const char* name) - : KDialogBase(KDialogBase::Plain, - i18n("Advanced Options"), - KDialogBase::Ok | - KDialogBase::Apply | - KDialogBase::Cancel, - KDialogBase::Ok, - parent, - name, - true, true), - m_pConfig(config) -{ - connect(this, TQT_SIGNAL(applyClicked()), - this, TQT_SLOT(save())); - connect(this, TQT_SIGNAL(okClicked()), - this, TQT_SLOT(save())); - actionButton(Apply)->setEnabled(false); - TQFrame* page = plainPage(); - TQVBoxLayout* layout = new TQVBoxLayout(page); - m_advancedWidget = new advancedTabOptions(page); - layout->addWidget(m_advancedWidget); - 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())); - connect(m_advancedWidget->m_pTabCloseActivatePrevious, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); - connect(m_advancedWidget->m_pPermanentCloseButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); - connect(m_advancedWidget->m_pHoverCloseButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); - connect(m_advancedWidget->m_pKonquerorTabforExternalURL, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); - connect(m_advancedWidget->m_pPopupsWithinTabs, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); - - load(); -} - -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", true ) ); - 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 ) ); - m_advancedWidget->m_pHoverCloseButton->setChecked( m_pConfig->readBoolEntry( "HoverCloseButton", false ) ); - m_advancedWidget->m_pKonquerorTabforExternalURL->setChecked( m_pConfig->readBoolEntry( "KonquerorTabforExternalURL", false ) ); - m_advancedWidget->m_pPopupsWithinTabs->setChecked( m_pConfig->readBoolEntry( "PopupsWithinTabs", false ) ); - m_advancedWidget->m_pTabCloseActivatePrevious->setChecked( m_pConfig->readBoolEntry( "TabCloseActivatePrevious", false ) ); - - m_pConfig->setGroup("Notification Messages"); - m_advancedWidget->m_pTabConfirm->setChecked( !m_pConfig->hasKey("MultipleTabConfirm") ); - - if ( m_advancedWidget->m_pPermanentCloseButton->isChecked() ) - m_advancedWidget->m_pHoverCloseButton->setEnabled(false); - else - m_advancedWidget->m_pHoverCloseButton->setEnabled(true); - actionButton(Apply)->setEnabled(false); -} - -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() ); - m_pConfig->writeEntry( "HoverCloseButton", m_advancedWidget->m_pHoverCloseButton->isChecked() ); - m_pConfig->writeEntry( "KonquerorTabforExternalURL", m_advancedWidget->m_pKonquerorTabforExternalURL->isChecked() ); - m_pConfig->writeEntry( "PopupsWithinTabs", m_advancedWidget->m_pPopupsWithinTabs->isChecked() ); - m_pConfig->writeEntry( "TabCloseActivatePrevious", m_advancedWidget->m_pTabCloseActivatePrevious->isChecked() ); - m_pConfig->sync(); - - // It only matters whether the key is present, its value has no meaning - m_pConfig->setGroup("Notification Messages"); - if ( m_advancedWidget->m_pTabConfirm->isChecked() ) m_pConfig->deleteEntry( "MultipleTabConfirm" ); - else m_pConfig->writeEntry( "MultipleTabConfirm", true ); - - TQByteArray data; - if ( !TDEApplication::kApplication()->dcopClient()->isAttached() ) - kapp->dcopClient()->attach(); - TDEApplication::kApplication()->dcopClient()->send( "konqueror*", "KonquerorIface", "reparseConfiguration()", data ); - - if ( m_advancedWidget->m_pPermanentCloseButton->isChecked() ) - m_advancedWidget->m_pHoverCloseButton->setEnabled(false); - else - m_advancedWidget->m_pHoverCloseButton->setEnabled(true); - actionButton(Apply)->setEnabled(false); -} - -void advancedTabDialog::changed() -{ - if ( m_advancedWidget->m_pPermanentCloseButton->isChecked() ) - m_advancedWidget->m_pHoverCloseButton->setEnabled(false); - else - m_advancedWidget->m_pHoverCloseButton->setEnabled(true); - actionButton(Apply)->setEnabled(true); -} - -#include "advancedTabDialog.moc" diff --git a/kcontrol/konqhtml/advancedTabDialog.h b/kcontrol/konqhtml/advancedTabDialog.h deleted file mode 100644 index 8951b01e1..000000000 --- a/kcontrol/konqhtml/advancedTabDialog.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * advancedTabDialog.h - * - * Copyright (c) 2002 Aaron J. Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - */ - -#ifndef __ADVANCEDTABDIALOG_H -#define __ADVANCEDTABDIALOG_H - -#include - -class advancedTabOptions; - -class advancedTabDialog : public KDialogBase -{ - Q_OBJECT - - public: - advancedTabDialog(TQWidget* parent, TDEConfig *config, const char* name); - ~advancedTabDialog(); - - protected slots: - void load(); - void save(); - void changed(); - - private: - TDEConfig* m_pConfig; - advancedTabOptions* m_advancedWidget; -}; - -#endif diff --git a/kcontrol/konqhtml/advancedTabOptions.ui b/kcontrol/konqhtml/advancedTabOptions.ui deleted file mode 100644 index cd8331d27..000000000 --- a/kcontrol/konqhtml/advancedTabOptions.ui +++ /dev/null @@ -1,199 +0,0 @@ - -advancedTabOptions - - - advancedTabOptions - - - - 0 - 0 - 644 - 208 - - - - - unnamed - - - 0 - - - - TextLabel3 - - - <b>Tab Options</b> - - - - - Line1 - - - HLine - - - Sunken - - - Horizontal - - - - - layout - - - - unnamed - - - - m_pShowMMBInTabs - - - Open &links in new tab instead of in new window - - - 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. - - - - - m_pDynamicTabbarHide - - - &Hide the tab bar when only one tab is open - - - This will display the tab bar only if there are two or more tabs. Otherwise it will always be displayed. - - - - - m_pDynamicTabbarCycle - - - C&ycle tabs with mouse wheel - - - This will cycle through tabs when there are two or more tabs using the mouse wheel. - - - - - m_pNewTabsInBackground - - - O&pen new tabs in the background - - - This will open a new tab in the background, instead of in the foreground. - - - - - m_pOpenAfterCurrentPage - - - Open &new tab after current tab - - - This will open a new tab opened from a page after the current tab, instead of after the last tab. - - - - - m_pTabConfirm - - - Confirm &when closing windows with multiple tabs - - - This will ask you whether you are sure you want to close a window when it has multiple tabs opened in it. - - - - - m_pPermanentCloseButton - - - &Show close button instead of website icon - - - This will display close buttons inside each tab instead of websites' icons. - - - - - m_pHoverCloseButton - - - &Show close button instead of website icon with mouse hover - - - This will display a close button inside each tab instead of websites' icons when the mouse pointer hovers the icon. - - - - - m_pPopupsWithinTabs - - - Open pop&ups in new tab instead of in new window - - - Whether or not JavaScript popups if allowed shall open in a new tab or in a new window. - - - - - m_pTabCloseActivatePrevious - - - Activate previous used tab when closing the current tab - - - When checking this the previous used or opened tab will be activated when you close the current active tab instead of the one right to the current tab. - - - - - m_pKonquerorTabforExternalURL - - - Open as tab in existing Konqueror when URL is called externally - - - When you click a URL in another TDE program or call kfmclient to open a URL, the current desktop will be searched for a non-minimized Konqueror and, if found, the URL opened as a new tab within it. Otherwise a new Konqueror window will be opened with the required URL. - - - - - - - spacer - - - Vertical - - - Expanding - - - - 20 - 0 - - - - - - - kdialog.h - - - - diff --git a/kcontrol/konqhtml/htmlopts.cpp b/kcontrol/konqhtml/htmlopts.cpp index 5ba1a8d9b..99bdb25a4 100644 --- a/kcontrol/konqhtml/htmlopts.cpp +++ b/kcontrol/konqhtml/htmlopts.cpp @@ -16,7 +16,6 @@ #include #include "htmlopts.h" -#include "advancedTabDialog.h" #include // include default values directly from konqueror #include // get default for DEFAULT_CHANGECURSOR @@ -83,19 +82,6 @@ KMiscHTMLOptions::KMiscHTMLOptions(TDEConfig *config, TQString group, TQWidget * lay->addMultiCellWidget( bgForm, row, row, 0, 1 ); row++; - // Tabbed Browsing - - TQGroupBox *bgTabbedBrowsing = new TQGroupBox( 0, Qt::Vertical, i18n("Tabbed Browsing"), this ); - 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())); - - lay->addMultiCellWidget( bgTabbedBrowsing, row, row, 0, 1 ); - row++; - // Mouse behavior TQVGroupBox *bgMouse = new TQVGroupBox( i18n("Mouse Beha&vior"), this ); @@ -386,7 +372,6 @@ void KMiscHTMLOptions::save() emit changed(false); } - void KMiscHTMLOptions::slotChanged() { m_pMaxFormCompletionItems->setEnabled( m_pFormCompletionCheckBox->isChecked() ); @@ -394,10 +379,3 @@ void KMiscHTMLOptions::slotChanged() } -void KMiscHTMLOptions::launchAdvancedTabDialog() -{ - advancedTabDialog* dialog = new advancedTabDialog(this, m_pConfig, "advancedTabDialog"); - dialog->exec(); -} - - diff --git a/kcontrol/konqhtml/htmlopts.h b/kcontrol/konqhtml/htmlopts.h index c318d0628..bdfa3cd81 100644 --- a/kcontrol/konqhtml/htmlopts.h +++ b/kcontrol/konqhtml/htmlopts.h @@ -48,7 +48,6 @@ public: private slots: void slotChanged(); - void launchAdvancedTabDialog(); private: TDEConfig* m_pConfig; diff --git a/kcontrol/konqhtml/main.cpp b/kcontrol/konqhtml/main.cpp index 7c248ec70..2f71a7bc5 100644 --- a/kcontrol/konqhtml/main.cpp +++ b/kcontrol/konqhtml/main.cpp @@ -36,6 +36,7 @@ #include "appearance.h" #include "htmlopts.h" #include "filteropts.h" +#include "userInterConfig.h" #include "main.h" #include @@ -67,11 +68,17 @@ extern "C" return new KPluginOptions(c, "Java/JavaScript Settings", parent, name); } - KDE_EXPORT TDECModule *create_tdehtml_filter(TQWidget *parent, const char *name ) - { - TDEConfig *c = new TDEConfig( "tdehtmlrc", false, false ); - return new KCMFilter(c, "Filter Settings", parent, name); - } + KDE_EXPORT TDECModule *create_tdehtml_filter(TQWidget *parent, const char *name ) + { + TDEConfig *c = new TDEConfig( "tdehtmlrc", false, false ); + return new KCMFilter(c, "Filter Settings", parent, name); + } + + KDE_EXPORT TDECModule *create_tdehtml_userinterface(TQWidget *parent, const char *name ) + { + TDEConfig *c = new TDEConfig( "konquerorrc", false, false ); + return new userInterConfig(c, "FMSettings", parent, name); + } } diff --git a/kcontrol/konqhtml/tdehtml_userinterface.desktop b/kcontrol/konqhtml/tdehtml_userinterface.desktop new file mode 100644 index 000000000..333cb036c --- /dev/null +++ b/kcontrol/konqhtml/tdehtml_userinterface.desktop @@ -0,0 +1,18 @@ +[Desktop Entry] +Type=Application +DocPath=kcontrol/tdehtml/index.html#userinterface +Icon=konqueror +Exec=tdecmshell tdehtml_userinterface + + +X-TDE-Library=konqhtml +X-TDE-FactoryName=tdehtml_userinterface + +Name=User Interface +Name[it]=Interfaccia utente +Comment=Configure user interface options +Comment[it]=Configura opzioni dell'interfaccia utente +Keywords=konqueror,kfm,user,interface,tabbed,browsing +Keywords[it]=konqueror,kfm,utente,interfaccia,linguette,navigazione + +Categories=Qt;TDE;X-TDE-settings-webbrowsing; diff --git a/kcontrol/konqhtml/userInterConfig.cpp b/kcontrol/konqhtml/userInterConfig.cpp new file mode 100644 index 000000000..4e18c6d38 --- /dev/null +++ b/kcontrol/konqhtml/userInterConfig.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2005 Stefan Nikolaus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + */ + +#include +#include + +#include +#include + +#include "userInterOpts_impl.h" +#include "main.h" + +#include "userInterConfig.h" +#include "userInterConfig.moc" + +userInterConfig::userInterConfig(TDEConfig *config, TQString groupName, + TQWidget *parent, const char *name) + : TDECModule(parent, "kcmkonqhtml") +{ + TQVBoxLayout *layout = new TQVBoxLayout(this); + m_widget = new userInterOpts(config, groupName, this, name); + layout->addWidget(m_widget); + layout->addStretch(); + + connect(m_widget, TQT_SIGNAL(changed()), + this, TQT_SLOT(changed())); + + load(); + TQTimer::singleShot(0, this, TQT_SLOT(notChanged())); +} + +void userInterConfig::notChanged() +{ + emit changed(false); +} + +void userInterConfig::load() +{ + m_widget->load(); + TDECModule::load(); +} + +void userInterConfig::save() +{ + m_widget->save(); + TDECModule::save(); +} + +void userInterConfig::defaults() +{ + m_widget->defaults(); + TDECModule::defaults(); + + // TDEConfigDialogManager may queue an changed(false) signal, + // so we make sure, that the module is labeled as changed, + // while we manage some of the widgets ourselves + TQTimer::singleShot(0, this, TQT_SLOT(changed())); +} diff --git a/kcontrol/konqhtml/userInterConfig.h b/kcontrol/konqhtml/userInterConfig.h new file mode 100644 index 000000000..b87879e45 --- /dev/null +++ b/kcontrol/konqhtml/userInterConfig.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2005 Stefan Nikolaus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + */ + +#ifndef __USER_INTER_CONFIG_H__ +#define __USER_INTER_CONFIG_H__ + +#include + +class userInterOpts; + +class userInterConfig : public TDECModule +{ + Q_OBJECT + +public: + userInterConfig(TDEConfig *config, TQString group, + TQWidget *parent = 0, const char *name = 0); + + void load(); + void save(); + void defaults(); + +public slots: + void notChanged(); + +private: + userInterOpts *m_widget; +}; + +#endif // __USER_INTER_CONFIG_H__ diff --git a/kcontrol/konqhtml/userInterOpts.ui b/kcontrol/konqhtml/userInterOpts.ui new file mode 100644 index 000000000..8a6ebc3fe --- /dev/null +++ b/kcontrol/konqhtml/userInterOpts.ui @@ -0,0 +1,195 @@ + +userInterOptsBase + + + userInterOptsBase + + + + 0 + 0 + 644 + 208 + + + + + unnamed + + + 0 + + + + m_group_1 + + + + 1 + 4 + 0 + 0 + + + + Tabbed Browsing + + + + unnamed + + + + layout + + + + unnamed + + + + m_pShowMMBInTabs + + + Open &links in new tab instead of in new window + + + 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. + + + + + m_pDynamicTabbarHide + + + &Hide the tab bar when only one tab is open + + + This will display the tab bar only if there are two or more tabs. Otherwise it will always be displayed. + + + + + m_pDynamicTabbarCycle + + + C&ycle tabs with mouse wheel + + + This will cycle through tabs when there are two or more tabs using the mouse wheel. + + + + + m_pNewTabsInBackground + + + O&pen new tabs in the background + + + This will open a new tab in the background, instead of in the foreground. + + + + + m_pOpenAfterCurrentPage + + + Open &new tab after current tab + + + This will open a new tab opened from a page after the current tab, instead of after the last tab. + + + + + m_pTabConfirm + + + Confirm &when closing windows with multiple tabs + + + This will ask you whether you are sure you want to close a window when it has multiple tabs opened in it. + + + + + m_pPermanentCloseButton + + + &Show close button instead of website icon + + + This will display close buttons inside each tab instead of websites' icons. + + + + + m_pHoverCloseButton + + + &Show close button instead of website icon with mouse hover + + + This will display a close button inside each tab instead of websites' icons when the mouse pointer hovers the icon. + + + + + m_pPopupsWithinTabs + + + Open pop&ups in new tab instead of in new window + + + Whether or not JavaScript popups if allowed shall open in a new tab or in a new window. + + + + + m_pKonquerorTabforExternalURL + + + Open as tab in existing Konqueror when URL is called externally + + + When you click a URL in another TDE program or call kfmclient to open a URL, the current desktop will be searched for a non-minimized Konqueror and, if found, the URL opened as a new tab within it. Otherwise a new Konqueror window will be opened with the required URL. + + + + + m_pTabCloseActivatePrevious + + + Activate previous used tab when closing the current tab + + + When checking this the previous used or opened tab will be activated when you close the current active tab instead of the one right to the current tab. + + + + + + + + + spacer + + + Vertical + + + Expanding + + + + 20 + 16 + + + + + + + + diff --git a/kcontrol/konqhtml/userInterOpts_impl.cpp b/kcontrol/konqhtml/userInterOpts_impl.cpp new file mode 100644 index 000000000..efe3c7343 --- /dev/null +++ b/kcontrol/konqhtml/userInterOpts_impl.cpp @@ -0,0 +1,127 @@ +/* + * userInterOpts.cpp + * + * Copyright (c) 2002 Aaron J. Seigo + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "main.h" +#include "userInterOpts_impl.h" +#include "userInterOpts_impl.moc" + +userInterOpts::userInterOpts(TDEConfig *config, TQString groupName, + TQWidget* parent, const char* name) + : userInterOptsBase(parent, name), m_pConfig(config), m_groupName(groupName) +{ + // connections + connect(m_pShowMMBInTabs, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotChanged())); + connect(m_pDynamicTabbarHide, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotChanged())); + connect(m_pDynamicTabbarCycle, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotChanged())); + connect(m_pNewTabsInBackground, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotChanged())); + connect(m_pOpenAfterCurrentPage, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotChanged())); + connect(m_pTabConfirm, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotChanged())); + connect(m_pPermanentCloseButton, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotChanged())); + connect(m_pHoverCloseButton, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotChanged())); + connect(m_pKonquerorTabforExternalURL, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotChanged())); + connect(m_pPopupsWithinTabs, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotChanged())); + connect(m_pTabCloseActivatePrevious, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotChanged())); +} + +void userInterOpts::load() +{ + load(false); +} + +void userInterOpts::load(bool useDefaults) +{ + m_pConfig->setReadDefaults(useDefaults); + m_pConfig->setGroup(m_groupName); + + m_pShowMMBInTabs->setChecked( m_pConfig->readBoolEntry( "MMBOpensTab", false ) ); + m_pDynamicTabbarHide->setChecked( !(m_pConfig->readBoolEntry( "AlwaysTabbedMode", false )) ); + m_pDynamicTabbarCycle->setChecked( m_pConfig->readBoolEntry( "TabsCycleWheel", true ) ); + m_pNewTabsInBackground->setChecked( ! (m_pConfig->readBoolEntry( "NewTabsInFront", false )) ); + m_pOpenAfterCurrentPage->setChecked( m_pConfig->readBoolEntry( "OpenAfterCurrentPage", false ) ); + m_pPermanentCloseButton->setChecked( m_pConfig->readBoolEntry( "PermanentCloseButton", false ) ); + m_pHoverCloseButton->setChecked( m_pConfig->readBoolEntry( "HoverCloseButton", false ) ); + m_pKonquerorTabforExternalURL->setChecked( m_pConfig->readBoolEntry( "KonquerorTabforExternalURL", false ) ); + m_pPopupsWithinTabs->setChecked( m_pConfig->readBoolEntry( "PopupsWithinTabs", false ) ); + m_pTabCloseActivatePrevious->setChecked( m_pConfig->readBoolEntry( "TabCloseActivatePrevious", false ) ); + + m_pConfig->setGroup("Notification Messages"); + m_pTabConfirm->setChecked( !m_pConfig->hasKey("MultipleTabConfirm") ); + + if ( m_pPermanentCloseButton->isChecked() ) + m_pHoverCloseButton->setEnabled(false); + else + m_pHoverCloseButton->setEnabled(true); +} + +void userInterOpts::save() +{ + m_pConfig->setGroup(m_groupName); + + m_pConfig->writeEntry( "MMBOpensTab", (m_pShowMMBInTabs->isChecked()) ); + m_pConfig->writeEntry( "AlwaysTabbedMode", ( !(m_pDynamicTabbarHide->isChecked())) ); + m_pConfig->writeEntry( "TabsCycleWheel", (m_pDynamicTabbarCycle->isChecked()) ); + m_pConfig->writeEntry( "NewTabsInFront", !(m_pNewTabsInBackground->isChecked()) ); + m_pConfig->writeEntry( "OpenAfterCurrentPage", m_pOpenAfterCurrentPage->isChecked() ); + m_pConfig->writeEntry( "PermanentCloseButton", m_pPermanentCloseButton->isChecked() ); + m_pConfig->writeEntry( "HoverCloseButton", m_pHoverCloseButton->isChecked() ); + m_pConfig->writeEntry( "KonquerorTabforExternalURL", m_pKonquerorTabforExternalURL->isChecked() ); + m_pConfig->writeEntry( "PopupsWithinTabs", m_pPopupsWithinTabs->isChecked() ); + m_pConfig->writeEntry( "TabCloseActivatePrevious", m_pTabCloseActivatePrevious->isChecked() ); + m_pConfig->sync(); + + // It only matters whether the key is present, its value has no meaning + m_pConfig->setGroup("Notification Messages"); + if ( m_pTabConfirm->isChecked() ) m_pConfig->deleteEntry( "MultipleTabConfirm" ); + else m_pConfig->writeEntry( "MultipleTabConfirm", true ); + + TQByteArray data; + if ( !TDEApplication::kApplication()->dcopClient()->isAttached() ) + kapp->dcopClient()->attach(); + TDEApplication::kApplication()->dcopClient()->send( "konqueror*", "KonquerorIface", "reparseConfiguration()", data ); + + if ( m_pPermanentCloseButton->isChecked() ) + m_pHoverCloseButton->setEnabled(false); + else + m_pHoverCloseButton->setEnabled(true); +} + +void userInterOpts::defaults() +{ + load(true); +} + +void userInterOpts::slotChanged() +{ + emit changed(); +} + + diff --git a/kcontrol/konqhtml/userInterOpts_impl.h b/kcontrol/konqhtml/userInterOpts_impl.h new file mode 100644 index 000000000..763b640b9 --- /dev/null +++ b/kcontrol/konqhtml/userInterOpts_impl.h @@ -0,0 +1,49 @@ +/* + * userInterOpts_impl.h + * + * Copyright (c) 2002 Aaron J. Seigo + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + */ + +#ifndef __USERINTERFACE_OPTIONS_IMPL_H +#define __USERINTERFACE_OPTIONS_IMPL_H + +#include "userInterOpts.h" + +class userInterOpts : public userInterOptsBase +{ + Q_OBJECT + + public: + userInterOpts(TDEConfig *config, TQString groupName, + TQWidget* parent =0, const char* name =0); + + void load(); + void load(bool useDefaults); + void save(); + void defaults(); + + signals: + void changed(); + + protected: + TDEConfig *m_pConfig; + TQString m_groupName; + + private slots: + void slotChanged(); +}; + +#endif -- cgit v1.2.1