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 | bcb704366cb5e333a626c18c308c7e0448a8e69f (patch) | |
tree | f0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /ksirc/KSPrefs/page_general.cpp | |
download | tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.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/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksirc/KSPrefs/page_general.cpp')
-rw-r--r-- | ksirc/KSPrefs/page_general.cpp | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/ksirc/KSPrefs/page_general.cpp b/ksirc/KSPrefs/page_general.cpp new file mode 100644 index 00000000..d6256e2c --- /dev/null +++ b/ksirc/KSPrefs/page_general.cpp @@ -0,0 +1,117 @@ +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include <qcheckbox.h> +#include <qspinbox.h> + +#include <klocale.h> +#include <kcharsets.h> +#include "page_general.h" +#include "../servercontroller.h" + +PageGeneral::PageGeneral( QWidget *parent, const char *name ) : PageGeneralBase( parent, name) +{ +} + +PageGeneral::~PageGeneral() +{ +} + +void PageGeneral::saveConfig() +{ + ksopts->runDocked = dockedOnlyCB->isChecked(); + servercontroller::self()->checkDocking(); + ksopts->autoCreateWin = autoCreateWindowCB->isChecked(); + ksopts->autoCreateWinForNotice = autoCreateWindowForNoticeCB->isChecked(); + ksopts->nickCompletion = nickCompletionCB->isChecked(); + ksopts->displayTopic = displayTopicCB->isChecked(); + ksopts->colorPicker = colorPickerPopupCB->isChecked(); + ksopts->autoRejoin = autoRejoinCB->isChecked(); + ksopts->oneLineEntry = oneLineEditCB->isChecked(); + ksopts->useColourNickList = useColourNickListCB->isChecked(); + ksopts->dockPopups = dockPopupsCB->isChecked(); + ksopts->autoSaveHistory = autoSaveHistoryCB->isChecked(); + ksopts->windowLength = historySB->value(); + + ksopts->channel["global"]["global"].timeStamp = timeStampCB->isChecked(); + ksopts->channel["global"]["global"].beepOnMsg = beepCB->isChecked(); + ksopts->channel["global"]["global"].topicShow = showTopicCB->isChecked(); + ksopts->channel["global"]["global"].logging = enLoggingCB->isChecked(); + ksopts->channel["global"]["global"].encoding = encodingsCB->currentText(); + ksopts->channel["global"]["global"].filterJoinPart = joinPartCB->isChecked(); + + if(applyGloballyCB->isChecked()){ + ksopts->applyChannelGlobal(); + } + + ksopts->publicAway = publicAway->isChecked(); +} + +void PageGeneral::readConfig( const KSOGeneral *opts ) +{ + dockedOnlyCB->setChecked( opts->runDocked ); + autoCreateWindowCB->setChecked( opts->autoCreateWin ); + autoCreateWindowForNoticeCB->setChecked( opts->autoCreateWinForNotice ); + nickCompletionCB->setChecked( opts->nickCompletion ); + displayTopicCB->setChecked( opts->displayTopic ); + colorPickerPopupCB->setChecked( opts->colorPicker ); + autoRejoinCB->setChecked( opts->autoRejoin ); + oneLineEditCB->setChecked( opts->oneLineEntry ); + useColourNickListCB->setChecked( opts->useColourNickList ); + dockPopupsCB->setChecked( opts->dockPopups ); + dockPopupsCB->setEnabled(dockedOnlyCB->isChecked()); + + autoSaveHistoryCB->setChecked( opts->autoSaveHistory ); + + historySB->setValue( opts->windowLength ); + + timeStampCB->setChecked( ksopts->channel["global"]["global"].timeStamp ); + beepCB->setChecked( ksopts->channel["global"]["global"].beepOnMsg ); + showTopicCB->setChecked( ksopts->channel["global"]["global"].topicShow ); + enLoggingCB->setChecked( ksopts->channel["global"]["global"].logging ); + joinPartCB->setChecked( ksopts->channel["global"]["global"].filterJoinPart ); + + publicAway->setChecked( ksopts->publicAway ); + + encodingsCB->clear(); + + + QStringList encodings = KGlobal::charsets()->descriptiveEncodingNames(); + + // remove utf16/ucs2 as it just doesn't work for IRC + QStringList::Iterator encodingIt = encodings.begin(); + while ( encodingIt != encodings.end() ) { + if ( ( *encodingIt ).find( "utf16" ) != -1 || + ( *encodingIt ).find( "iso-10646" ) != -1 ) + encodingIt = encodings.remove( encodingIt ); + else + ++encodingIt; + } + encodings.prepend( i18n( "Default" ) ); + encodingsCB->insertStringList(encodings); + int eindex = encodings.findIndex(ksopts->channel["global"]["global"].encoding); + if(eindex == -1) + encodingsCB->setCurrentItem(0); + else + encodingsCB->setCurrentItem(eindex); +} + +void PageGeneral::defaultConfig() +{ + KSOGeneral opts; + readConfig( &opts ); +} + +void PageGeneral::changed() +{ + dockPopupsCB->setEnabled(dockedOnlyCB->isChecked()); + emit modified(); +} + +#include "page_general.moc" |