4 * Copyright (c) 2000 Alexander Neundorf <neundorf@kde.org>
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.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "kcmkiolan.h"
23 #include <qcheckbox.h>
25 #include <qlineedit.h>
28 #include <q3groupbox.h>
30 #include <QVBoxLayout>
37 IOSlaveSettings::IOSlaveSettings(const QString
& config
, const KComponentData
&inst
,QWidget
*parent
)
38 :KCModule(inst
,parent
)
41 QVBoxLayout
*layout
= new QVBoxLayout(this);
42 layout
->setSpacing(KDialog::spacingHint());
43 layout
->setMargin(KDialog::marginHint());
45 Q3GroupBox
* group
=new Q3GroupBox(1, Qt::Horizontal
, i18n("Show Links for Following Services"), this);
46 layout
->addWidget(group
);
48 m_ftpSettings
=new PortSettingsBar(i18n("FTP (TCP, port 21): "), group
);
49 m_httpSettings
=new PortSettingsBar(i18n("HTTP (TCP, port 80): "),group
);
50 m_nfsSettings
=new PortSettingsBar(i18n("NFS (TCP, port 2049): "),group
);
51 m_smbSettings
=new PortSettingsBar(i18n("Windows shares (TCP, ports 445 and 139):"),group
);
52 m_fishSettings
=new PortSettingsBar(i18n("Secure Shell/Fish (TCP, port 22): "),group
);
53 m_shortHostnames
= new QCheckBox(i18n("Show &short hostnames (without domain suffix)"),this);
54 layout
->addWidget(m_shortHostnames
);
56 KHBox
*hbox
=new KHBox(this);
57 layout
->addWidget(hbox
);
58 QLabel
*label
=new QLabel(i18n("Default LISa server host: "), hbox
);
59 m_defaultLisaHostLe
=new QLineEdit(hbox
);
60 label
->setBuddy(m_defaultLisaHostLe
);
62 QWidget
*w
=new QWidget(this);
64 layout
->setStretchFactor(m_ftpSettings
,0);
65 layout
->setStretchFactor(m_httpSettings
,0);
66 layout
->setStretchFactor(m_nfsSettings
,0);
67 layout
->setStretchFactor(m_smbSettings
,0);
68 layout
->setStretchFactor(m_shortHostnames
,0);
69 layout
->setStretchFactor(hbox
,0);
70 layout
->setStretchFactor(w
,1);
72 connect(m_ftpSettings
,SIGNAL(changed()),this,SIGNAL(changed()));
73 connect(m_httpSettings
,SIGNAL(changed()),this,SIGNAL(changed()));
74 connect(m_nfsSettings
,SIGNAL(changed()),this,SIGNAL(changed()));
75 connect(m_smbSettings
,SIGNAL(changed()),this,SIGNAL(changed()));
76 connect(m_fishSettings
,SIGNAL(changed()),this,SIGNAL(changed()));
77 connect(m_shortHostnames
,SIGNAL(clicked()),this,SIGNAL(changed()));
78 connect(m_defaultLisaHostLe
, SIGNAL(textChanged(const QString
&)),this,SIGNAL(changed()));
81 void IOSlaveSettings::load()
83 kDebug()<<"IOSlaveSettings::load()";
84 m_ftpSettings
->setChecked(m_config
.group("").readEntry("Support_FTP", PORTSETTINGS_CHECK
));
85 m_httpSettings
->setChecked(m_config
.group("").readEntry("Support_HTTP", PORTSETTINGS_CHECK
));
86 m_nfsSettings
->setChecked(m_config
.group("").readEntry("Support_NFS", PORTSETTINGS_CHECK
));
87 m_smbSettings
->setChecked(m_config
.group("").readEntry("Support_SMB", PORTSETTINGS_CHECK
));
88 m_fishSettings
->setChecked(m_config
.group("").readEntry("Support_FISH", PORTSETTINGS_CHECK
));
89 m_shortHostnames
->setChecked(m_config
.group("").readEntry("ShowShortHostnames",false));
90 // m_rlanSidebar->setChecked(m_config.group("").readEntry("sidebarURL", "lan:/") == "rlan:/" ? true : false );
91 m_defaultLisaHostLe
->setText(m_config
.group("").readEntry("DefaultLisaHost", "localhost"));
94 void IOSlaveSettings::save()
96 kDebug()<<"IOSlaveSettings::save()";
97 m_config
.group("").writeEntry("AlreadyConfigured",true);
98 m_config
.group("").writeEntry("Support_FTP", m_ftpSettings
->selected());
99 m_config
.group("").writeEntry("Support_HTTP", m_httpSettings
->selected());
100 m_config
.group("").writeEntry("Support_NFS", m_nfsSettings
->selected());
101 m_config
.group("").writeEntry("Support_SMB", m_smbSettings
->selected());
102 m_config
.group("").writeEntry("Support_FISH", m_fishSettings
->selected());
103 m_config
.group("").writeEntry("ShowShortHostnames",m_shortHostnames
->isChecked());
104 // m_config.group("").writeEntry("sidebarURL", m_rlanSidebar->isChecked() ? "rlan:/" : "lan:/");
105 m_config
.group("").writeEntry("DefaultLisaHost", m_defaultLisaHostLe
->text());
110 #include "kcmkiolan.moc"