diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 4aed2c8219774f5d797760606b8489a92ddc5163 (patch) | |
tree | 3f8c130f7d269626bf6a9447407ef6c35954426a /kcontrol/konqhtml/advancedTabDialog.cpp | |
download | tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kcontrol/konqhtml/advancedTabDialog.cpp')
-rw-r--r-- | kcontrol/konqhtml/advancedTabDialog.cpp | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/kcontrol/konqhtml/advancedTabDialog.cpp b/kcontrol/konqhtml/advancedTabDialog.cpp new file mode 100644 index 000000000..93a576043 --- /dev/null +++ b/kcontrol/konqhtml/advancedTabDialog.cpp @@ -0,0 +1,121 @@ +/* + * advancedTabDialog.cpp + * + * Copyright (c) 2002 Aaron J. Seigo <aseigo@olympusproject.org> + * + * 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 <qbuttongroup.h> +#include <qcheckbox.h> +#include <qlayout.h> +#include <qpushbutton.h> +#include <qradiobutton.h> +#include <qslider.h> + +#include <kapplication.h> +#include <dcopclient.h> +#include <kcolorbutton.h> +#include <klocale.h> +#include <kconfig.h> + +#include "advancedTabDialog.h" +#include "advancedTabOptions.h" +#include "main.h" + +advancedTabDialog::advancedTabDialog(QWidget* parent, KConfig* 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, SIGNAL(applyClicked()), + this, SLOT(save())); + connect(this, SIGNAL(okClicked()), + this, SLOT(save())); + actionButton(Apply)->setEnabled(false); + QFrame* page = plainPage(); + QVBoxLayout* layout = new QVBoxLayout(page); + m_advancedWidget = new advancedTabOptions(page); + layout->addWidget(m_advancedWidget); + layout->addSpacing( 20 ); + layout->addStretch(); + + connect(m_advancedWidget->m_pNewTabsInBackground, SIGNAL(clicked()), this, SLOT(changed())); + connect(m_advancedWidget->m_pOpenAfterCurrentPage, SIGNAL(clicked()), this, SLOT(changed())); + connect(m_advancedWidget->m_pTabConfirm, SIGNAL(clicked()), this, SLOT(changed())); + connect(m_advancedWidget->m_pTabCloseActivatePrevious, SIGNAL(clicked()), this, SLOT(changed())); + connect(m_advancedWidget->m_pPermanentCloseButton, SIGNAL(clicked()), this, SLOT(changed())); + connect(m_advancedWidget->m_pKonquerorTabforExternalURL, SIGNAL(clicked()), this, SLOT(changed())); + connect(m_advancedWidget->m_pPopupsWithinTabs, SIGNAL(clicked()), this, SLOT(changed())); + + load(); +} + +advancedTabDialog::~advancedTabDialog() +{ +} + +void advancedTabDialog::load() +{ + m_pConfig->setGroup("FMSettings"); + 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_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") ); + + actionButton(Apply)->setEnabled(false); +} + +void advancedTabDialog::save() +{ + m_pConfig->setGroup("FMSettings"); + 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( "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 wether 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 ); + + QByteArray data; + if ( !KApplication::kApplication()->dcopClient()->isAttached() ) + kapp->dcopClient()->attach(); + KApplication::kApplication()->dcopClient()->send( "konqueror*", "KonquerorIface", "reparseConfiguration()", data ); + + actionButton(Apply)->setEnabled(false); +} + +void advancedTabDialog::changed() +{ + actionButton(Apply)->setEnabled(true); +} + +#include "advancedTabDialog.moc" |