File indexing completed on 2025-01-19 13:26:06

0001 /***************************************************************************
0002     This configuration page takes care of all settings concerning the 
0003     user interface
0004                              -------------------
0005     begin                : Mi Aug 30 2006
0006     copyright            : (C) 2006-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 "smb4kconfigpageuserinterface.h"
0033 #include "core/smb4ksettings.h"
0034 
0035 // Qt includes
0036 #include <QGridLayout>
0037 #include <QVBoxLayout>
0038 #include <QGroupBox>
0039 #include <QButtonGroup>
0040 #include <QRadioButton>
0041 #include <QCheckBox>
0042 #include <QLabel>
0043 
0044 // KDE includes
0045 #include <KI18n/KLocalizedString>
0046 #include <KCompletion/KComboBox>
0047 
0048 
0049 Smb4KConfigPageUserInterface::Smb4KConfigPageUserInterface(QWidget *parent)
0050 : QWidget(parent)
0051 {
0052   //
0053   // Layout
0054   // 
0055   QVBoxLayout *layout = new QVBoxLayout(this);
0056   layout->setSpacing(5);
0057   layout->setMargin(0);
0058   
0059   // 
0060   // Main Window settings
0061   // 
0062   QGroupBox *mainWindowBox = new QGroupBox(i18n("Main Window"), this);
0063   QGridLayout *mainWindowBoxLayout = new QGridLayout(mainWindowBox);
0064   mainWindowBoxLayout->setSpacing(5);
0065   
0066   QLabel *tabOrientationLabel = new QLabel(Smb4KSettings::self()->mainWindowTabOrientationItem()->label(), mainWindowBox);
0067   
0068   KComboBox *tabOrientation = new KComboBox(mainWindowBox);
0069   tabOrientation->setObjectName("kcfg_MainWindowTabOrientation");
0070   
0071   QList<KCoreConfigSkeleton::ItemEnum::Choice> tabOrientationChoices = Smb4KSettings::self()->mainWindowTabOrientationItem()->choices();
0072   
0073   for (const KCoreConfigSkeleton::ItemEnum::Choice &to : tabOrientationChoices)
0074   {
0075     tabOrientation->addItem(to.label);
0076   }
0077   
0078   tabOrientationLabel->setBuddy(tabOrientation);
0079   
0080   mainWindowBoxLayout->addWidget(tabOrientationLabel, 0, 0, 0);
0081   mainWindowBoxLayout->addWidget(tabOrientation, 0, 1, 0);
0082   
0083   QCheckBox *showBookmarkLabel = new QCheckBox(Smb4KSettings::self()->showCustomBookmarkLabelItem()->label(), mainWindowBox);
0084   showBookmarkLabel->setObjectName("kcfg_ShowCustomBookmarkLabel");
0085   
0086   mainWindowBoxLayout->addWidget(showBookmarkLabel, 1, 0, 1, 2, 0);
0087 
0088   layout->addWidget(mainWindowBox, 0);
0089   
0090   //
0091   // Network Neighborhood settings
0092   // 
0093   QGroupBox *networkNeighhoodBox = new QGroupBox(i18n("Network Neighborhood"), this);
0094   QGridLayout *networkNeighhoodBoxLayout = new QGridLayout(networkNeighhoodBox);
0095   networkNeighhoodBoxLayout->setSpacing(5);
0096   
0097   QCheckBox *autoExpand = new QCheckBox(Smb4KSettings::self()->autoExpandNetworkItemsItem()->label(), networkNeighhoodBox);
0098   autoExpand->setObjectName("kcfg_AutoExpandNetworkItems");
0099   
0100   networkNeighhoodBoxLayout->addWidget(autoExpand, 0, 0, 0);
0101   
0102   QCheckBox *showType = new QCheckBox(Smb4KSettings::self()->showTypeItem()->label(), networkNeighhoodBox);
0103   showType->setObjectName("kcfg_ShowType");
0104   
0105   networkNeighhoodBoxLayout->addWidget(showType, 0, 1, 0);
0106   
0107   QCheckBox *showIpAddress = new QCheckBox(Smb4KSettings::self()->showIPAddressItem()->label(), networkNeighhoodBox);
0108   showIpAddress->setObjectName("kcfg_ShowIPAddress");
0109   
0110   networkNeighhoodBoxLayout->addWidget(showIpAddress, 1, 0, 0);
0111   
0112   QCheckBox *showComment = new QCheckBox(Smb4KSettings::self()->showCommentItem()->label(), networkNeighhoodBox);
0113   showComment->setObjectName("kcfg_ShowComment");
0114   
0115   networkNeighhoodBoxLayout->addWidget(showComment, 1, 1, 0);
0116   
0117   QCheckBox *showNetworkTooltip = new QCheckBox(Smb4KSettings::self()->showNetworkItemToolTipItem()->label(), networkNeighhoodBox);
0118   showNetworkTooltip->setObjectName("kcfg_ShowNetworkItemToolTip");
0119   
0120   networkNeighhoodBoxLayout->addWidget(showNetworkTooltip, 2, 0, 1, 2, 0);
0121   
0122   layout->addWidget(networkNeighhoodBox, 0);
0123   
0124   //
0125   // Shares View settings
0126   // 
0127   QGroupBox *sharesViewBox = new QGroupBox(i18n("Shares View"), this);
0128   QGridLayout *sharesViewBoxLayout = new QGridLayout(sharesViewBox);
0129   sharesViewBoxLayout->setSpacing(5);
0130   
0131   QLabel *viewModeLabel = new QLabel(Smb4KSettings::self()->sharesViewModeItem()->label(), sharesViewBox);
0132   
0133   KComboBox *viewMode = new KComboBox(sharesViewBox);
0134   viewMode->setObjectName("kcfg_SharesViewMode");
0135   
0136   QList<KCoreConfigSkeleton::ItemEnum::Choice> sharesViewModeChoices = Smb4KSettings::self()->sharesViewModeItem()->choices();
0137   
0138   for (const KCoreConfigSkeleton::ItemEnum::Choice &vm : sharesViewModeChoices)
0139   {
0140     viewMode->addItem(vm.label);
0141   }
0142 
0143   viewModeLabel->setBuddy(viewMode);
0144 
0145   sharesViewBoxLayout->addWidget(viewModeLabel, 0, 0, 0);
0146   sharesViewBoxLayout->addWidget(viewMode, 0, 1, 0);
0147   
0148   QCheckBox *showShareTooltip = new QCheckBox(Smb4KSettings::self()->showShareToolTipItem()->label(), sharesViewBox);
0149   showShareTooltip->setObjectName("kcfg_ShowShareToolTip");
0150   
0151   sharesViewBoxLayout->addWidget(showShareTooltip, 1, 0, 1, 2, 0);
0152   
0153   layout->addWidget(sharesViewBox, 0);
0154   layout->addStretch(100);
0155   
0156 
0157 
0158 //   // Network item tooltips
0159 //   QGroupBox *network_tooltips_box = new QGroupBox(i18n("Tooltips"), networkNeighborhoodTab);
0160 // 
0161 //   QGridLayout *n_tooltips_layout = new QGridLayout(network_tooltips_box);
0162 //   n_tooltips_layout->setSpacing(5);
0163 // 
0164 
0165 // 
0166 //   n_tooltips_layout->addWidget(network_tooltip, 0, 0, 0);
0167 // 
0168 //   networkNeighborhoodTabLayout->addWidget(behavior_box);
0169 //   networkNeighborhoodTabLayout->addWidget(columns_box);
0170 //   networkNeighborhoodTabLayout->addWidget(network_tooltips_box);
0171 //   networkNeighborhoodTabLayout->addStretch(100);
0172 // 
0173 //   addTab(networkNeighborhoodTab, i18n("Network Neighborhood"));
0174 // 
0175 //   //
0176 //   // Shares view
0177 //   //
0178 //   QWidget *shares_view_tab = new QWidget(this);
0179 // 
0180 //   QVBoxLayout *shares_view_layout = new QVBoxLayout(shares_view_tab);
0181 //   shares_view_layout->setSpacing(5);
0182 //   shares_view_layout->setMargin(0);
0183 //   
0184 //   // View
0185 //   QGroupBox *viewBox = new QGroupBox(i18n("View Mode"), shares_view_tab);
0186 //   QHBoxLayout *viewBoxLayout = new QHBoxLayout(viewBox);
0187 //   viewBoxLayout->setSpacing(5);
0188 //   
0189 //   QLabel *viewModeLabel = new QLabel(Smb4KSettings::self()->sharesViewModeItem()->label(), viewBox);
0190 //   KComboBox *viewMode = new KComboBox(viewBox);
0191 //   viewMode->setObjectName("kcfg_SharesViewMode");
0192 //   viewMode->insertItem(Smb4KSettings::EnumSharesViewMode::IconView,
0193 //                        Smb4KSettings::self()->sharesViewModeItem()->choices().value(Smb4KSettings::EnumSharesViewMode::IconView).label);
0194 //   viewMode->insertItem(Smb4KSettings::EnumSharesViewMode::ListView,
0195 //                        Smb4KSettings::self()->sharesViewModeItem()->choices().value(Smb4KSettings::EnumSharesViewMode::ListView).label);  
0196 //   viewModeLabel->setBuddy(viewMode);
0197 //   
0198 //   viewBoxLayout->addWidget(viewModeLabel);
0199 //   viewBoxLayout->addWidget(viewMode);
0200 // 
0201 //   // Share tooltips
0202 //   QGroupBox *share_tooltips_box = new QGroupBox(i18n("Tooltips"), shares_view_tab);
0203 // 
0204 //   QGridLayout *s_tooltips_layout = new QGridLayout(share_tooltips_box);
0205 //   s_tooltips_layout->setSpacing(5);
0206 // 
0207 //   QCheckBox *show_share_tooltip = new QCheckBox(Smb4KSettings::self()->showShareToolTipItem()->label(), share_tooltips_box);
0208 //   show_share_tooltip->setObjectName("kcfg_ShowShareToolTip");
0209 // 
0210 //   s_tooltips_layout->addWidget(show_share_tooltip, 0, 0, 0);
0211 // 
0212 //   QSpacerItem *spacer4 = new QSpacerItem(10, 10, QSizePolicy::Preferred, QSizePolicy::Expanding);
0213 // 
0214 //   shares_view_layout->addWidget(viewBox);
0215 //   shares_view_layout->addWidget(share_tooltips_box);
0216 //   shares_view_layout->addItem(spacer4);
0217 // 
0218 //   addTab(shares_view_tab, i18n("Mounted Shares"));
0219 }
0220 
0221 
0222 Smb4KConfigPageUserInterface::~Smb4KConfigPageUserInterface()
0223 {
0224 }
0225 
0226 
0227 /////////////////////////////////////////////////////////////////////////////
0228 // SLOT IMPLEMENTATIONS
0229 /////////////////////////////////////////////////////////////////////////////
0230 
0231