File indexing completed on 2024-12-01 13:10:43
0001 /*************************************************************************** 0002 smb4knetworkoptions - The configuration page for the network 0003 settings of Smb4K 0004 ------------------- 0005 begin : Sa Nov 15 2003 0006 copyright : (C) 2003-2019 by Alexander Reinholdt 0007 email : alexander.reinholdt@kdemail.net 0008 ***************************************************************************/ 0009 0010 /*************************************************************************** 0011 * This program is free software; you can redistribute it and/or modify * 0012 * it under the terms of the GNU General Public License as published by * 0013 * the Free Software Foundation; either version 2 of the License, or * 0014 * (at your option) any later version. * 0015 * * 0016 * This program is distributed in the hope that it will be useful, but * 0017 * WITHOUT ANY WARRANTY; without even the implied warranty of * 0018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 0019 * General Public License for more details. * 0020 * * 0021 * You should have received a copy of the GNU General Public License * 0022 * along with this program; if not, write to the * 0023 * Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston,* 0024 * MA 02110-1335, USA * 0025 ***************************************************************************/ 0026 0027 #ifdef HAVE_CONFIG_H 0028 #include <config.h> 0029 #endif 0030 0031 // application specific includes 0032 #include "smb4kconfigpagenetwork.h" 0033 #include "core/smb4ksettings.h" 0034 0035 // Qt includes 0036 #include <QVBoxLayout> 0037 #include <QGridLayout> 0038 #include <QGroupBox> 0039 #include <QLabel> 0040 #include <QCheckBox> 0041 #include <QSpinBox> 0042 0043 // KDE includes 0044 #include <KIconThemes/KIconLoader> 0045 #include <KI18n/KLocalizedString> 0046 #include <KCompletion/KLineEdit> 0047 #include <KCompletion/KComboBox> 0048 0049 0050 Smb4KConfigPageNetwork::Smb4KConfigPageNetwork(QWidget *parent) : QTabWidget(parent) 0051 { 0052 // 0053 // Network Neighborhood tab 0054 // 0055 QWidget *sambaTab = new QWidget(this); 0056 0057 QVBoxLayout *sambaTabLayout = new QVBoxLayout(sambaTab); 0058 sambaTabLayout->setSpacing(5); 0059 sambaTabLayout->setMargin(0); 0060 0061 // 0062 // Basic Settings group box 0063 // 0064 QGroupBox *basicSettingsBox = new QGroupBox(i18n("Basic Settings"), sambaTab); 0065 0066 QGridLayout *basicSettingsBoxLayout = new QGridLayout(basicSettingsBox); 0067 basicSettingsBoxLayout->setSpacing(5); 0068 0069 QLabel *nebiosNameLabel = new QLabel(Smb4KSettings::self()->netBIOSNameItem()->label(), basicSettingsBox); 0070 KLineEdit *netbiosName = new KLineEdit(basicSettingsBox); 0071 netbiosName->setObjectName("kcfg_NetBIOSName"); 0072 netbiosName->setClearButtonEnabled(true); 0073 nebiosNameLabel->setBuddy(netbiosName); 0074 0075 QLabel *domainLabel = new QLabel(Smb4KSettings::self()->domainNameItem()->label(), basicSettingsBox); 0076 KLineEdit *domain = new KLineEdit(basicSettingsBox); 0077 domain->setObjectName("kcfg_DomainName"); 0078 domain->setClearButtonEnabled(true); 0079 domainLabel->setBuddy(domain); 0080 0081 QCheckBox *useRemoteSmbPort = new QCheckBox(Smb4KSettings::self()->useRemoteSmbPortItem()->label(), basicSettingsBox); 0082 useRemoteSmbPort->setObjectName("kcfg_UseRemoteSmbPort"); 0083 0084 QSpinBox *remoteSmbPort = new QSpinBox(basicSettingsBox); 0085 remoteSmbPort->setObjectName("kcfg_RemoteSmbPort"); 0086 // remoteSmbPort->setSliderEnabled(true); 0087 0088 QCheckBox *largeNetworkNeighborhood = new QCheckBox(Smb4KSettings::self()->largeNetworkNeighborhoodItem()->label(), basicSettingsBox); 0089 largeNetworkNeighborhood->setObjectName("kcfg_LargeNetworkNeighborhood"); 0090 0091 basicSettingsBoxLayout->addWidget(nebiosNameLabel, 0, 0, 0); 0092 basicSettingsBoxLayout->addWidget(netbiosName, 0, 1, 0); 0093 basicSettingsBoxLayout->addWidget(domainLabel, 1, 0, 0); 0094 basicSettingsBoxLayout->addWidget(domain, 1, 1, 0); 0095 basicSettingsBoxLayout->addWidget(useRemoteSmbPort, 2, 0, 0); 0096 basicSettingsBoxLayout->addWidget(remoteSmbPort, 2, 1, 0); 0097 basicSettingsBoxLayout->addWidget(largeNetworkNeighborhood, 3, 0, 1, 2, 0); 0098 0099 sambaTabLayout->addWidget(basicSettingsBox, 0); 0100 0101 // 0102 // Authentication group box 0103 // 0104 QGroupBox *authenticationBox = new QGroupBox(i18n("Authentication"), sambaTab); 0105 QGridLayout *authenticationBoxLayout = new QGridLayout(authenticationBox); 0106 authenticationBoxLayout->setSpacing(5); 0107 0108 QCheckBox *masterBrowsersRequireAuth = new QCheckBox(Smb4KSettings::self()->masterBrowsersRequireAuthItem()->label(), authenticationBox); 0109 masterBrowsersRequireAuth->setObjectName("kcfg_MasterBrowsersRequireAuth"); 0110 0111 QCheckBox *useKerberos = new QCheckBox(Smb4KSettings::self()->useKerberosItem()->label(), authenticationBox); 0112 useKerberos->setObjectName("kcfg_UseKerberos"); 0113 0114 QCheckBox *useCCache = new QCheckBox(Smb4KSettings::self()->useWinbindCCacheItem()->label(), authenticationBox); 0115 useCCache->setObjectName("kcfg_UseWinbindCCache"); 0116 0117 authenticationBoxLayout->addWidget(masterBrowsersRequireAuth, 0, 0, 0); 0118 authenticationBoxLayout->addWidget(useKerberos, 0, 1, 0); 0119 authenticationBoxLayout->addWidget(useCCache, 1, 0, 0); 0120 0121 sambaTabLayout->addWidget(authenticationBox, 0); 0122 0123 // 0124 // Security group box 0125 // 0126 QGroupBox *securityBox = new QGroupBox(i18n("Security"), sambaTab); 0127 QGridLayout *securityBoxLayout = new QGridLayout(securityBox); 0128 securityBoxLayout->setSpacing(5); 0129 0130 // Encryption level 0131 QCheckBox *useEncryptionLevel = new QCheckBox(Smb4KSettings::self()->useEncryptionLevelItem()->label(), securityBox); 0132 useEncryptionLevel->setObjectName("kcfg_UseEncryptionLevel"); 0133 0134 KComboBox *encryptionLevel = new KComboBox(securityBox); 0135 encryptionLevel->setObjectName("kcfg_EncryptionLevel"); 0136 0137 QList<KCoreConfigSkeleton::ItemEnum::Choice> encryptionLevelChoices = Smb4KSettings::self()->encryptionLevelItem()->choices(); 0138 0139 for (const KCoreConfigSkeleton::ItemEnum::Choice &c : encryptionLevelChoices) 0140 { 0141 encryptionLevel->addItem(c.label); 0142 } 0143 0144 securityBoxLayout->addWidget(useEncryptionLevel, 0, 0, 0); 0145 securityBoxLayout->addWidget(encryptionLevel, 0, 1, 0); 0146 0147 sambaTabLayout->addWidget(securityBox, 0); 0148 0149 // 0150 // Behavior group box 0151 // 0152 QGroupBox *behaviorBox = new QGroupBox(i18n("Behavior"), sambaTab); 0153 QGridLayout *behaviorBoxLayout = new QGridLayout(behaviorBox); 0154 behaviorBoxLayout->setSpacing(5); 0155 0156 QCheckBox *detectPrinters = new QCheckBox(Smb4KSettings::self()->detectPrinterSharesItem()->label(), behaviorBox); 0157 detectPrinters->setObjectName("kcfg_DetectPrinterShares"); 0158 0159 QCheckBox *detectHiddenShares = new QCheckBox(Smb4KSettings::self()->detectHiddenSharesItem()->label(), behaviorBox); 0160 detectHiddenShares->setObjectName("kcfg_DetectHiddenShares"); 0161 0162 QCheckBox *previewHiddenItems = new QCheckBox(Smb4KSettings::self()->previewHiddenItemsItem()->label(), behaviorBox); 0163 previewHiddenItems->setObjectName("kcfg_PreviewHiddenItems"); 0164 0165 behaviorBoxLayout->addWidget(detectPrinters, 0, 0, 0); 0166 behaviorBoxLayout->addWidget(detectHiddenShares, 0, 1, 0); 0167 behaviorBoxLayout->addWidget(previewHiddenItems, 1, 0, 0); 0168 0169 sambaTabLayout->addWidget(behaviorBox, 0); 0170 sambaTabLayout->addStretch(100); 0171 0172 addTab(sambaTab, i18n("Samba")); 0173 0174 // 0175 // Wake-On-LAN tab 0176 // 0177 QWidget *wakeOnLanTab = new QWidget(this); 0178 0179 // 0180 // Wake-On-LAN tab layout 0181 // 0182 QVBoxLayout *wakeOnLanTabLayout = new QVBoxLayout(wakeOnLanTab); 0183 wakeOnLanTabLayout->setSpacing(5); 0184 wakeOnLanTabLayout->setMargin(0); 0185 0186 // 0187 // Wake-On-LAN group box 0188 // 0189 QGroupBox *wakeOnLanBox = new QGroupBox(i18n("Wake-On-LAN"), wakeOnLanTab); 0190 QGridLayout *wakeOnLanBoxLayout = new QGridLayout(wakeOnLanBox); 0191 wakeOnLanBoxLayout->setSpacing(5); 0192 0193 QCheckBox *enableWakeOnLan = new QCheckBox(Smb4KSettings::self()->enableWakeOnLANItem()->label(), wakeOnLanBox); 0194 enableWakeOnLan->setObjectName("kcfg_EnableWakeOnLAN"); 0195 0196 QLabel *wakeOnLanWaitingTimeLabel = new QLabel(Smb4KSettings::self()->wakeOnLANWaitingTimeItem()->label(), wakeOnLanBox); 0197 wakeOnLanWaitingTimeLabel->setIndent(25); 0198 0199 QSpinBox *wakeOnLanWaitingTime = new QSpinBox(wakeOnLanBox); 0200 wakeOnLanWaitingTime->setObjectName("kcfg_WakeOnLANWaitingTime"); 0201 wakeOnLanWaitingTime->setSuffix(i18n(" s")); 0202 wakeOnLanWaitingTime->setSingleStep(1); 0203 // wakeOnLanWaitingTime->setSliderEnabled(true); 0204 0205 wakeOnLanWaitingTimeLabel->setBuddy(wakeOnLanWaitingTime); 0206 0207 QFrame *wakeOnLanNote = new QFrame(wakeOnLanBox); 0208 QGridLayout *wakeOnLanNoteLayout = new QGridLayout(wakeOnLanNote); 0209 wakeOnLanNoteLayout->setSpacing(10); 0210 wakeOnLanNoteLayout->setMargin(5); 0211 0212 QLabel *importantPixmap = new QLabel(wakeOnLanNote); 0213 importantPixmap->setPixmap(KIconLoader::global()->loadIcon("emblem-important", KIconLoader::Desktop, KIconLoader::SizeMedium)); 0214 importantPixmap->adjustSize(); 0215 0216 QLabel *message = new QLabel(wakeOnLanNote); 0217 message->setText(i18n("<qt>Define the hosts that should be woken up via the custom options dialog.</qt>")); 0218 message->setTextFormat(Qt::AutoText); 0219 message->setWordWrap(true); 0220 message->setAlignment(Qt::AlignJustify); 0221 0222 wakeOnLanNoteLayout->addWidget(importantPixmap, 0, 0, Qt::AlignVCenter); 0223 wakeOnLanNoteLayout->addWidget(message, 0, 1, Qt::AlignVCenter); 0224 wakeOnLanNoteLayout->setColumnStretch(1, 1); 0225 0226 wakeOnLanBoxLayout->addWidget(enableWakeOnLan, 0, 0, 1, 2, 0); 0227 wakeOnLanBoxLayout->addWidget(wakeOnLanWaitingTimeLabel, 1, 0, 0); 0228 wakeOnLanBoxLayout->addWidget(wakeOnLanWaitingTime, 1, 1, 0); 0229 wakeOnLanBoxLayout->addWidget(wakeOnLanNote, 2, 0, 1, 2, 0); 0230 0231 wakeOnLanTabLayout->addWidget(wakeOnLanBox, 0); 0232 wakeOnLanTabLayout->addStretch(100); 0233 0234 addTab(wakeOnLanTab, i18n("Wake-On-LAN")); 0235 } 0236 0237 0238 Smb4KConfigPageNetwork::~Smb4KConfigPageNetwork() 0239 { 0240 } 0241