Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / kinfocenter / samba / main.cpp
blob9c145e2ad6778e3284e66367f7f941d1f876becc
1 /*
2 * main.cpp for the samba kcontrol module
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #include <QLayout>
20 #include <QTabWidget>
22 #include <kaboutdata.h>
23 #include <kcmodule.h>
24 #include <kdialog.h>
25 #include <kgenericfactory.h>
27 #include "kcmsambaimports.h"
28 #include "kcmsambalog.h"
29 #include "kcmsambastatistics.h"
30 #include "ksmbstatus.h"
31 #include <KPluginFactory>
33 class SambaContainer : public KCModule {
34 Q_OBJECT
35 public:
36 SambaContainer(QWidget *parent=0, const QVariantList &list = QVariantList());
37 virtual ~SambaContainer();
38 virtual void load();
39 virtual void save();
41 private:
42 KConfig config;
43 QTabWidget tabs;
44 NetMon status;
45 ImportsView imports;
46 LogView logView;
47 StatisticsView statisticsView;
50 K_PLUGIN_FACTORY(SambaFactory,
51 registerPlugin<SambaContainer>();
53 K_EXPORT_PLUGIN(SambaFactory("kcmsamba"))
55 SambaContainer::SambaContainer(QWidget *parent, const QVariantList&) :
56 KCModule(SambaFactory::componentData(), parent), config("kcmsambarc"), tabs(this), status(&tabs, &config), imports(&tabs, &config), logView(&tabs, &config), statisticsView(&tabs, &config) {
57 QVBoxLayout *layout = new QVBoxLayout( this );
58 layout->setMargin(0);
59 layout->setSpacing(0);
60 layout->addWidget(&tabs);
61 tabs.addTab(&status, i18n("&Exports"));
62 tabs.addTab(&imports, i18n("&Imports"));
63 tabs.addTab(&logView, i18n("&Log"));
64 tabs.addTab(&statisticsView, i18n("&Statistics"));
65 connect(&logView, SIGNAL(contentsChanged(Q3ListView* , int, int)), &statisticsView, SLOT(setListInfo(Q3ListView *, int, int)));
66 setButtons(Help);
68 setQuickHelp(i18n("<p>The Samba and NFS Status Monitor is a front end to the programs"
69 " <em>smbstatus</em> and <em>showmount</em>. Smbstatus reports on current"
70 " Samba connections, and is part of the suite of Samba tools, which"
71 " implements the SMB (Session Message Block) protocol, also called the"
72 " NetBIOS or LanManager protocol. This protocol can be used to provide"
73 " printer sharing or drive sharing services on a network including"
74 " machines running the various flavors of Microsoft Windows.</p>"));
76 KAboutData *about = new KAboutData(I18N_NOOP("kcmsamba"), 0,
77 ki18n("KDE Panel System Information Control Module"),
78 0, KLocalizedString(), KAboutData::License_GPL,
79 ki18n("(c) 2002 KDE Information Control Module Samba Team"));
80 about->addAuthor(ki18n("Michael Glauche"), KLocalizedString(), "glauche@isa.rwth-aachen.de");
81 about->addAuthor(ki18n("Matthias Hoelzer"), KLocalizedString(), "hoelzer@kde.org");
82 about->addAuthor(ki18n("David Faure"), KLocalizedString(), "faure@kde.org");
83 about->addAuthor(ki18n("Harald Koschinski"), KLocalizedString(), "Harald.Koschinski@arcormail.de");
84 about->addAuthor(ki18n("Wilco Greven"), KLocalizedString(), "greven@kde.org");
85 about->addAuthor(ki18n("Alexander Neundorf"), KLocalizedString(), "neundorf@kde.org");
86 setAboutData(about);
89 SambaContainer::~SambaContainer() {
90 save();
93 void SambaContainer::load() {
94 status.loadSettings();
95 imports.loadSettings();
96 logView.loadSettings();
97 statisticsView.loadSettings();
100 void SambaContainer::save() {
101 status.saveSettings();
102 imports.saveSettings();
103 logView.saveSettings();
104 statisticsView.saveSettings();
105 config.sync();
108 #include "main.moc"