From bcb704366cb5e333a626c18c308c7e0448a8e69f Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kget/dlgPreferences.cpp | 164 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 kget/dlgPreferences.cpp (limited to 'kget/dlgPreferences.cpp') diff --git a/kget/dlgPreferences.cpp b/kget/dlgPreferences.cpp new file mode 100644 index 00000000..f35b8add --- /dev/null +++ b/kget/dlgPreferences.cpp @@ -0,0 +1,164 @@ +/*************************************************************************** +* dlgPreferences.cpp +* ------------------- +* +* Revision : $Id$ +* begin : Tue Jan 29 2002 +* copyright : (C) 2002 by Patrick Charbonnier +* : Based On Caitoo v.0.7.3 (c) 1998 - 2000, Matej Koss +* email : pch@freeshell.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. + * + ***************************************************************************/ + + +#include + +#include +#include +#include +#include + +#include "dlgConnection.h" +#include "dlgAutomation.h" +#include "dlgLimits.h" +#include "dlgAdvanced.h" +#include "dlgDirectories.h" +#include "dlgSystem.h" + +#include "settings.h" + +#ifdef index +#undef index +#endif + +#include "kmainwidget.h" +#include "dlgPreferences.h" + + +DlgPreferences::DlgPreferences(QWidget * parent): + KDialogBase(Tabbed, i18n("Configure"), Ok|Apply|Help|Cancel, Ok, parent, "DlgPreferences", true) +{ + // add pages + QFrame *page = addPage(i18n("Connection")); + QVBoxLayout *topLayout = new QVBoxLayout(page, 0, spacingHint()); + + conDlg = new DlgConnection(page); + topLayout->addWidget(conDlg); + + page = addPage(i18n("Automation")); + topLayout = new QVBoxLayout(page, 0, spacingHint()); + autDlg = new DlgAutomation(page); + topLayout->addWidget(autDlg); + topLayout->addStretch(); + + page = addPage(i18n("Limits")); + topLayout = new QVBoxLayout(page, 0, spacingHint()); + limDlg = new DlgLimits(page); + topLayout->addWidget(limDlg); + topLayout->addStretch(); + + page = addPage(i18n("Advanced")); + topLayout = new QVBoxLayout(page, 0, spacingHint()); + advDlg = new DlgAdvanced(page); + topLayout->addWidget(advDlg); + topLayout->addStretch(); + + // page = addPage(i18n("Search")); + // topLayout = new QVBoxLayout(page, 0, spacingHint()); + // seaDlg = new DlgSearch(page); + // topLayout->addWidget(seaDlg); + + page = addPage(i18n("Folders")); + topLayout = new QVBoxLayout(page, 0, spacingHint()); + dirDlg = new DlgDirectories(page); + topLayout->addWidget(dirDlg); + topLayout->addStretch(); + + page = addPage(i18n("System")); + topLayout = new QVBoxLayout(page, 0, spacingHint()); + sysDlg = new DlgSystem(page); + topLayout->addWidget(sysDlg); + topLayout->addStretch(); + + // type of connection influences autoDisconnect & timedDisconnect features + connect(conDlg, SIGNAL(typeChanged(int)), autDlg, SLOT(slotTypeChanged(int))); + + loadAllData(); + + connect( conDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); + connect( autDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); + connect( limDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); + connect( advDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); + connect( dirDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); + connect( sysDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); +} + + +void DlgPreferences::slotChanged() +{ + changed = true; + enableButton( Apply, true ); +} + +void DlgPreferences::applySettings() +{ + conDlg->applyData(); + autDlg->applyData(); + limDlg->applyData(); + advDlg->applyData(); + // seaDlg->applyData(); + dirDlg->applyData(); + sysDlg->applyData(); + + ksettings.save(); + changed = false; + enableButton( Apply, false ); +} + +void DlgPreferences::slotOk() +{ + if ( changed ) + applySettings(); + accept(); +} + +void DlgPreferences::slotCancel() +{ + if ( changed ) + loadAllData(); + reject(); +} + +void DlgPreferences::slotApply() +{ + applySettings(); +} + +void DlgPreferences::loadAllData() +{ + conDlg->setData(); + autDlg->setData(); + limDlg->setData(); + advDlg->setData(); + // seaDlg->setData(); + dirDlg->setData(); + sysDlg->setData(); + changed = false; + enableButton( Apply, false ); +} + +#include "dlgPreferences.moc" -- cgit v1.2.1