french -> French
[kdepim.git] / knode / knconfigmanager.cpp
blob4dd5c40a7167895de656602c65860a733ad75b59
1 /*
2 KNode, the KDE newsreader
3 Copyright (c) 1999-2005 the KNode authors.
4 See file AUTHORS for details
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 You should have received a copy of the GNU General Public License
11 along with this program; if not, write to the Free Software Foundation,
12 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
15 #include "knconfigmanager.h"
17 #include <kiconloader.h>
18 #include <kwindowsystem.h>
20 #include "utilities.h"
21 #include "knglobals.h"
22 #include "articlewidget.h"
23 #include "knarticlefactory.h"
24 #include "knmainwidget.h"
25 #include "settings.h"
28 KNConfigManager::KNConfigManager( QObject *parent )
29 : QObject( parent ), d_ialog(0)
31 a_ppearance = new KNode::Appearance();
32 d_isplayedHeaders = new KNode::DisplayedHeaders();
33 c_leanup = new KNode::Cleanup();
37 KNConfigManager::~KNConfigManager()
39 delete a_ppearance;
40 delete d_isplayedHeaders;
41 delete c_leanup;
45 void KNConfigManager::configure()
47 if(!d_ialog) {
48 d_ialog = new KNConfigDialog( knGlobals.topWidget );
49 d_ialog->setObjectName( "Preferences_Dlg" );
50 connect(d_ialog, SIGNAL(finished()), this, SLOT(slotDialogDone()));
51 d_ialog->show();
53 #ifdef Q_OS_UNIX
54 else
55 KWindowSystem::activateWindow(d_ialog->winId());
56 #endif
60 void KNConfigManager::syncConfig()
62 a_ppearance->save();
63 d_isplayedHeaders->save();
64 c_leanup->save();
65 knGlobals.settings()->writeConfig();
69 void KNConfigManager::slotDialogDone()
71 d_ialog->delayedDestruct();
72 d_ialog=0;
76 //===================================================================================================
79 KNConfigDialog::KNConfigDialog( QWidget *parent )
80 : KCMultiDialog( parent )
82 addModule ( "knode_config_identity" );
83 addModule ( "knode_config_accounts" );
84 addModule ( "knode_config_appearance" );
85 addModule ( "knode_config_read_news" );
86 addModule ( "knode_config_post_news" );
87 addModule ( "knode_config_privacy" );
88 addModule ( "knode_config_cleanup" );
90 setHelp("anc-setting-your-identity");
92 connect(this, SIGNAL(configCommitted()), this, SLOT(slotConfigCommitted()));
96 void KNConfigDialog::slotConfigCommitted()
98 knGlobals.configManager()->syncConfig();
100 KNode::ArticleWidget::configChanged();
101 if(knGlobals.top)
102 knGlobals.top->configChanged();
103 KNGlobals::self()->articleFactory()->configChanged();
107 //-----------------------------