00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <QVBoxLayout>
00016
00017 #include <kcmodule.h>
00018 #include <kcmoduleloader.h>
00019 #include <kdebug.h>
00020 #include <klocale.h>
00021
00022 #include "knglobals.h"
00023 #include "knconfig.h"
00024 #include "knconfigmanager.h"
00025 #include "knconfigpages.h"
00026 #include "knconfigwidgets.h"
00027
00028 #include <kdemacros.h>
00029
00030
00031
00032
00033 KNode::KCMTabContainer::KCMTabContainer( const KComponentData &inst, QWidget * parent )
00034 : KCModule( inst, parent )
00035 {
00036 QVBoxLayout *vlay = new QVBoxLayout( this );
00037 vlay->setSpacing( KDialog::spacingHint() );
00038 vlay->setMargin( 0 );
00039 mTabWidget = new QTabWidget( this );
00040 vlay->addWidget( mTabWidget );
00041 }
00042
00043 void KNode::KCMTabContainer::addTab( KCModule* tab, const QString & title ) {
00044 mTabWidget->addTab( tab, title );
00045 connect( tab, SIGNAL(changed( bool )), this, SIGNAL(changed( bool )) );
00046 }
00047
00048 void KNode::KCMTabContainer::load() {
00049 for ( int i = 0 ; i < mTabWidget->count() ; ++i ) {
00050 KCModule *tab = (KCModule*) mTabWidget->widget(i);
00051 if ( tab )
00052 tab->load();
00053 }
00054 }
00055
00056 void KNode::KCMTabContainer::save() {
00057 for ( int i = 0 ; i < mTabWidget->count() ; ++i ) {
00058 KCModule *tab = (KCModule*) mTabWidget->widget(i);
00059 if ( tab )
00060 tab->save();
00061 }
00062 }
00063
00064 void KNode::KCMTabContainer::defaults()
00065 {
00066 KCModule *tab = static_cast<KCModule*>( mTabWidget->currentWidget() );
00067 if ( tab )
00068 tab->defaults();
00069 }
00070
00071
00072
00073
00074
00075
00076 extern "C"
00077 {
00078 KDE_EXPORT KCModule *create_knode_config_identity( QWidget *parent )
00079 {
00080 KNode::IdentityWidget *page = new KNode::IdentityWidget(
00081 knGlobals.configManager()->identity(), knGlobals.componentData(), parent );
00082 return page;
00083 }
00084 }
00085
00086
00087
00088
00089
00090
00091 extern "C"
00092 {
00093 KDE_EXPORT KCModule *create_knode_config_accounts( QWidget *parent )
00094 {
00095 KNode::AccountsPage *page = new KNode::AccountsPage( knGlobals.componentData(), parent );
00096 return page;
00097 }
00098 }
00099
00100 KNode::AccountsPage::AccountsPage( const KComponentData &inst,QWidget *parent )
00101 : KCMTabContainer( inst,parent ) {
00102
00103 addTab( new NntpAccountListWidget( inst, this ), i18n("Newsgroup Servers") );
00104 addTab( KCModuleLoader::loadModule( "kcm_mailtransport", KCModuleLoader::Inline, this ),
00105 i18n("Mail Server (SMTP)") );
00106 }
00107
00108
00109
00110
00111
00112
00113 extern "C"
00114 {
00115 KDE_EXPORT KCModule *create_knode_config_appearance( QWidget *parent )
00116 {
00117 KNode::AppearanceWidget *page = new KNode::AppearanceWidget( knGlobals.componentData(), parent );
00118 return page;
00119 }
00120 }
00121
00122
00123
00124
00125
00126
00127 extern "C"
00128 {
00129 KDE_EXPORT KCModule *create_knode_config_read_news( QWidget *parent )
00130 {
00131 KNode::ReadNewsPage *page = new KNode::ReadNewsPage( knGlobals.componentData(), parent );
00132 return page;
00133 }
00134 }
00135
00136 KNode::ReadNewsPage::ReadNewsPage( const KComponentData &inst,QWidget *parent )
00137 : KCMTabContainer( inst, parent )
00138 {
00139 addTab( new ReadNewsGeneralWidget( inst, this ), i18n("General") );
00140 addTab( new ReadNewsNavigationWidget( inst, this ), i18n("Navigation") );
00141 addTab( new ScoringWidget( inst, this ), i18n("Scoring") );
00142 addTab( new FilterListWidget( inst, this ), i18n("Filters") );
00143 addTab( new DisplayedHeadersWidget( knGlobals.configManager()->displayedHeaders(), inst, this ), i18n("Headers") );
00144 addTab( new ReadNewsViewerWidget( inst, this ), i18n("Viewer") );
00145 }
00146
00147
00148
00149
00150
00151
00152 extern "C"
00153 {
00154 KDE_EXPORT KCModule *create_knode_config_post_news( QWidget *parent )
00155 {
00156 KNode::PostNewsPage *page = new KNode::PostNewsPage( knGlobals.componentData(), parent );
00157 return page;
00158 }
00159 }
00160
00161 KNode::PostNewsPage::PostNewsPage( const KComponentData &inst, QWidget *parent )
00162 : KCMTabContainer( inst, parent )
00163 {
00164 addTab( new PostNewsTechnicalWidget( inst, this ), i18n("Technical") );
00165 addTab( new PostNewsComposerWidget( inst, this ), i18n("Composer") );
00166 addTab( new PostNewsSpellingWidget( inst, this ), i18n("Spelling") );
00167 }
00168
00169
00170
00171
00172
00173
00174 extern "C"
00175 {
00176 KDE_EXPORT KCModule *create_knode_config_privacy( QWidget *parent )
00177 {
00178 KNode::PrivacyWidget *page = new KNode::PrivacyWidget( knGlobals.componentData(), parent );
00179 return page;
00180 }
00181 }
00182
00183
00184
00185
00186
00187
00188 extern "C"
00189 {
00190 KDE_EXPORT KCModule *create_knode_config_cleanup( QWidget *parent )
00191 {
00192 KNode::CleanupWidget *page = new KNode::CleanupWidget( knGlobals.componentData(), parent );
00193 return page;
00194 }
00195 }
00196
00197
00198 #include "knconfigpages.moc"