summaryrefslogtreecommitdiffstats
path: root/smb4k/configdlg
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-03-01 18:55:11 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-03-01 18:55:11 +0000
commit854bf52eebd2da47ff45f6ae85f4cb89bae89876 (patch)
tree24fa0a7eabb9c300a1655d665f72327fe5ab3464 /smb4k/configdlg
downloadsmb4k-854bf52eebd2da47ff45f6ae85f4cb89bae89876.tar.gz
smb4k-854bf52eebd2da47ff45f6ae85f4cb89bae89876.zip
Added old KDE3 version of SMB4K
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/smb4k@1097609 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'smb4k/configdlg')
-rw-r--r--smb4k/configdlg/Makefile.am12
-rw-r--r--smb4k/configdlg/smb4kauthoptions.cpp135
-rw-r--r--smb4k/configdlg/smb4kauthoptions.h81
-rw-r--r--smb4k/configdlg/smb4kconfigdialog.cpp1222
-rw-r--r--smb4k/configdlg/smb4kconfigdialog.h208
-rw-r--r--smb4k/configdlg/smb4knetworkoptions.cpp107
-rw-r--r--smb4k/configdlg/smb4knetworkoptions.h63
-rw-r--r--smb4k/configdlg/smb4krsyncoptions.cpp351
-rw-r--r--smb4k/configdlg/smb4krsyncoptions.h108
-rw-r--r--smb4k/configdlg/smb4ksambaoptions.cpp1230
-rw-r--r--smb4k/configdlg/smb4ksambaoptions.h168
-rw-r--r--smb4k/configdlg/smb4kshareoptions.cpp98
-rw-r--r--smb4k/configdlg/smb4kshareoptions.h62
-rw-r--r--smb4k/configdlg/smb4ksuperuseroptions.cpp101
-rw-r--r--smb4k/configdlg/smb4ksuperuseroptions.h79
-rw-r--r--smb4k/configdlg/smb4kuserinterfaceoptions.cpp207
-rw-r--r--smb4k/configdlg/smb4kuserinterfaceoptions.h68
17 files changed, 4300 insertions, 0 deletions
diff --git a/smb4k/configdlg/Makefile.am b/smb4k/configdlg/Makefile.am
new file mode 100644
index 0000000..6a85b0f
--- /dev/null
+++ b/smb4k/configdlg/Makefile.am
@@ -0,0 +1,12 @@
+INCLUDES = $(all_includes)
+METASOURCES = AUTO
+kde_module_LTLIBRARIES = libsmb4kconfigdialog.la
+noinst_HEADERS = smb4kauthoptions.h smb4kconfigdialog.h smb4knetworkoptions.h \
+ smb4krsyncoptions.h smb4ksambaoptions.h smb4kshareoptions.h smb4ksuperuseroptions.h \
+ smb4kuserinterfaceoptions.h
+libsmb4kconfigdialog_la_SOURCES = smb4kauthoptions.cpp smb4kconfigdialog.cpp \
+ smb4knetworkoptions.cpp smb4krsyncoptions.cpp smb4ksambaoptions.cpp smb4kshareoptions.cpp \
+ smb4ksuperuseroptions.cpp smb4kuserinterfaceoptions.cpp
+libsmb4kconfigdialog_la_LIBADD = $(top_builddir)/smb4k/core/libsmb4kcore.la \
+ $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_QT)
+libsmb4kconfigdialog_la_LDFLAGS = -module $(KDE_PLUGIN)
diff --git a/smb4k/configdlg/smb4kauthoptions.cpp b/smb4k/configdlg/smb4kauthoptions.cpp
new file mode 100644
index 0000000..1cafc91
--- /dev/null
+++ b/smb4k/configdlg/smb4kauthoptions.cpp
@@ -0,0 +1,135 @@
+/***************************************************************************
+ smb4kauthoptions - The configuration page for the authentication
+ settings of Smb4K
+ -------------------
+ begin : Sa Nov 15 2003
+ copyright : (C) 2003-2007 by Alexander Reinholdt
+ email : dustpuppy@users.berlios.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+// Qt includes
+#include <qcheckbox.h>
+#include <qlayout.h>
+#include <qgroupbox.h>
+#include <qbuttongroup.h>
+#include <qlabel.h>
+#include <qwhatsthis.h>
+
+// KDE includes
+#include <klocale.h>
+#include <klineedit.h>
+
+// application specific includes
+#include "smb4kauthoptions.h"
+
+Smb4KAuthOptions::Smb4KAuthOptions( QWidget *parent, const char *name )
+: QWidget( parent, name )
+{
+ //
+ // Default Authentication
+ //
+ QGridLayout *grid = new QGridLayout( this );
+ grid->setSpacing( 10 );
+
+ QButtonGroup *password_group = new QButtonGroup( 1, QButtonGroup::Horizontal,
+ i18n( "Password Storage" ), this );
+ QCheckBox *use_wallet = new QCheckBox( i18n( "Save the authentication data in a wallet" ),
+ password_group, "kcfg_UseWallet" );
+ (void) new QCheckBox( i18n( "If no wallet is used, remember authentication data during run time" ),
+ password_group, "kcfg_RememberPasswords" );
+
+ QGroupBox *login_box = new QGroupBox( 1, Qt::Horizontal, i18n( "Default Login" ),
+ this, "DefaultLoginBox" );
+// login_box->setInsideMargin( 10 );
+
+ QCheckBox *default_auth = new QCheckBox( i18n( "Use default login" ),
+ login_box, "kcfg_UseDefaultLogin" );
+
+ QWidget *auth_widget = new QWidget( login_box, "DefaultAuthWidget" );
+ QGridLayout *auth_grid = new QGridLayout( auth_widget );
+ auth_grid->setSpacing( 5 );
+
+ QLabel *login = new QLabel( i18n( "User:" ), auth_widget );
+ KLineEdit *default_login = new KLineEdit( auth_widget, "DefaultUserName" );
+ default_login->setMinimumWidth( 150 );
+ QWhatsThis::add( default_login, i18n( "This login name is used by default to authenticate to a remote server." ) );
+ QLabel *password = new QLabel( i18n( "Password:" ), auth_widget );
+ KLineEdit *default_password = new KLineEdit( auth_widget, "DefaultPassword" );
+ default_password->setEchoMode( KLineEdit::Password );
+ default_password->setMinimumWidth( 150 );
+ QWhatsThis::add( default_password, i18n( "This password is used by default to authenticate to a remote server. It may be empty." ) );
+
+ auth_grid->addWidget( login, 0, 0 );
+ auth_grid->addWidget( default_login, 0, 1 );
+ auth_grid->addWidget( password, 1, 0 );
+ auth_grid->addWidget( default_password, 1, 1 );
+
+ QSpacerItem *spacer2 = new QSpacerItem( 0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding );
+
+ grid->addWidget( password_group, 0, 0, 0 );
+ grid->addWidget( login_box, 1, 0, 0 );
+ grid->addItem( spacer2, 2, 0 );
+
+ connect( use_wallet, SIGNAL( stateChanged( int ) ),
+ this, SLOT( slotKWalletButtonState( int ) ) );
+ connect( default_auth, SIGNAL( stateChanged( int ) ),
+ this, SLOT( slotDefaultAuthButtonState( int ) ) );
+
+ slotKWalletButtonState( use_wallet->state() );
+ slotDefaultAuthButtonState( default_auth->state() );
+}
+
+
+Smb4KAuthOptions::~Smb4KAuthOptions()
+{
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// SLOT IMPLEMENTATIONS
+/////////////////////////////////////////////////////////////////////////////
+
+void Smb4KAuthOptions::slotKWalletButtonState( int state )
+{
+ if ( state == QCheckBox::On )
+ {
+ static_cast<QCheckBox *>( child( "DefaultLoginBox", "QGroupBox", true ) )->setEnabled( true );
+ }
+ else if ( state == QCheckBox::Off )
+ {
+ static_cast<QCheckBox *>( child( "DefaultLoginBox", "QGroupBox", true ) )->setEnabled( false );
+ }
+}
+
+
+void Smb4KAuthOptions::slotDefaultAuthButtonState( int state )
+{
+ if ( state == QCheckBox::On )
+ {
+ static_cast<QCheckBox *>( child( "DefaultAuthWidget", "QWidget", true ) )->setEnabled( true );
+ }
+ else if ( state == QCheckBox::Off )
+ {
+ static_cast<QCheckBox *>( child( "DefaultAuthWidget", "QWidget", true ) )->setEnabled( false );
+ }
+}
+
+
+
+#include "smb4kauthoptions.moc"
diff --git a/smb4k/configdlg/smb4kauthoptions.h b/smb4k/configdlg/smb4kauthoptions.h
new file mode 100644
index 0000000..5428ede
--- /dev/null
+++ b/smb4k/configdlg/smb4kauthoptions.h
@@ -0,0 +1,81 @@
+/***************************************************************************
+ smb4kauthoptions - The configuration page for the authentication
+ settings of Smb4K
+ -------------------
+ begin : Sa Nov 15 2003
+ copyright : (C) 2003-2007 by Alexander Reinholdt
+ email : dustpuppy@users.berlios.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef SMB4KAUTHOPTIONS_H
+#define SMB4KAUTHOPTIONS_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// Qt includes
+#include <qwidget.h>
+
+
+/**
+ * This is the configuration tab for the authentication settings
+ * of Smb4K.
+ *
+ * @author Alexander Reinholdt <dustpuppy@users.berlios.de>
+ */
+
+
+class Smb4KAuthOptions : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ /**
+ * The constructor.
+ *
+ * @param parent The parent widget
+ *
+ * @param name The name of this widget
+ */
+ Smb4KAuthOptions( QWidget *parent = 0, const char *name = 0 );
+
+ /**
+ * The destructor.
+ */
+ ~Smb4KAuthOptions();
+
+ protected slots:
+ /**
+ * This slot manages the toggling of the KWallet support button in the
+ * Authentication tab.
+ *
+ * @param state The toggle state
+ */
+ void slotKWalletButtonState( int state );
+ /**
+ * This slot manages the toggling of the default authentication button.
+ *
+ * @param state The toggle state
+ */
+ void slotDefaultAuthButtonState( int state );
+};
+
+#endif
diff --git a/smb4k/configdlg/smb4kconfigdialog.cpp b/smb4k/configdlg/smb4kconfigdialog.cpp
new file mode 100644
index 0000000..449aec3
--- /dev/null
+++ b/smb4k/configdlg/smb4kconfigdialog.cpp
@@ -0,0 +1,1222 @@
+/***************************************************************************
+ smb4kconfigdialog - The configuration dialog of Smb4K
+ -------------------
+ begin : Sa Apr 14 2007
+ copyright : (C) 2007 by Alexander Reinholdt
+ email : dustpuppy@users.berlios.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+// Qt includes
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+
+// KDE includes
+#include <klistview.h>
+#include <klineedit.h>
+#include <kpushbutton.h>
+#include <kmessagebox.h>
+#include <kurlrequester.h>
+
+// system specific includes
+#include <unistd.h>
+#include <sys/types.h>
+
+// application specific includes
+#include "smb4kconfigdialog.h"
+#include "smb4kuserinterfaceoptions.h"
+#include "smb4knetworkoptions.h"
+#include "smb4kshareoptions.h"
+#include "smb4kauthoptions.h"
+#include "smb4ksuperuseroptions.h"
+#include "smb4ksambaoptions.h"
+#include "smb4krsyncoptions.h"
+#include "../core/smb4ksettings.h"
+#include "../core/smb4kglobal.h"
+#include "../core/smb4ksambaoptionsinfo.h"
+#include "../core/smb4ksambaoptionshandler.h"
+#include "../core/smb4kcore.h"
+#include "../core/smb4kauthinfo.h"
+#include "../core/smb4kpasswordhandler.h"
+
+using namespace Smb4KGlobal;
+
+KInstance *Smb4KConfigDialogFactory::m_instance = 0L;
+KAboutData *Smb4KConfigDialogFactory::m_about = 0L;
+
+// Variables we need to determine if super user entries
+// have to be written to /etc/sudoers or /etc/super.tab
+bool use_sudo = false;
+bool use_super = false;
+#ifdef __linux__
+bool force_unmount = false;
+#endif
+bool always_use_su = false;
+
+// Use this variable to determine if the dialog should be
+// closed after Smb4KFileIO::finished() was emitted.
+bool close_dialog = false;
+
+
+Smb4KConfigDialog::Smb4KConfigDialog( Smb4KSettings *settings, QWidget *parent, const char *name )
+: KConfigDialog( parent, name, settings )
+{
+ // FIXME: I guess, normally we would not need to close destructively,
+ // but at the moment there are issues with the KURLRequester in file
+ // mode. To work around those, we are closing the dialog destructively.
+ // Maybe we can remove this if we moved to KDE4.
+ setWFlags( Qt::WDestructiveClose );
+
+ // Add the pages:
+ Smb4KUserInterfaceOptions *interface_options = new Smb4KUserInterfaceOptions( this, "UserInterfaceOptions" );
+ Smb4KNetworkOptions* network_options = new Smb4KNetworkOptions( this, "NetworkOptions" );
+ Smb4KShareOptions *share_options= new Smb4KShareOptions( this, "ShareOptions" );
+ Smb4KAuthOptions *auth_options = new Smb4KAuthOptions( this, "AuthenticationOptions" );
+ Smb4KSambaOptions *samba_options = new Smb4KSambaOptions( this, "SambaOptions" );
+ Smb4KRsyncOptions *rsync_options = new Smb4KRsyncOptions( this, "SynchronizationOptions" );
+ Smb4KSuperUserOptions *super_user_options = new Smb4KSuperUserOptions( this, "SuperUserOptions" );
+
+ // Disable widgets if the respective programs are not installed.
+ if ( Smb4KSettings::rsync().isEmpty() )
+ {
+ rsync_options->setEnabled( false );
+ }
+
+ if ( Smb4KSettings::sudo().isEmpty() && Smb4KSettings::super().isEmpty() )
+ {
+ super_user_options->setEnabled( false );
+ }
+ else
+ {
+ // The search for the programs and all related actions have been
+ // done by the core. We only need to disable widgets here.
+ if ( Smb4KSettings::sudo().isEmpty() )
+ {
+ QRadioButton *sudo = static_cast<QRadioButton *>( super_user_options->child( "SudoButton", "QRadioButton", true ) );
+
+ if ( sudo )
+ {
+ sudo->setEnabled( false );
+ }
+ }
+ else if ( Smb4KSettings::super().isEmpty() )
+ {
+ QRadioButton *super = static_cast<QRadioButton *>( super_user_options->child( "SuperButton", "QRadioButton", true ) );
+
+ if ( super )
+ {
+ super->setEnabled( false );
+ }
+ }
+ else
+ {
+ // Do nothing
+ }
+ }
+
+ // There are a few settings we need to the initial values of.
+ // Initialize them here:
+ switch ( Smb4KSettings::superUserProgram() )
+ {
+ case Smb4KSettings::EnumSuperUserProgram::Sudo:
+ {
+ use_sudo = true;
+
+ break;
+ }
+ case Smb4KSettings::EnumSuperUserProgram::Super:
+ {
+ use_super = true;
+
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+
+#ifdef __linux__
+ force_unmount = Smb4KSettings::useForceUnmount();
+#endif
+ always_use_su = Smb4KSettings::alwaysUseSuperUser();
+
+ // Now add the pages to the configuration dialog
+ addPage( interface_options, i18n( "User Interface" ), "view_choose" );
+ addPage( network_options, i18n( "Network" ), "network" );
+ addPage( share_options, i18n( "Shares" ), "hdd_mount" );
+ addPage( auth_options, i18n( "Authentication" ), "identity" );
+ addPage( samba_options, i18n( "Samba" ), "samba" );
+ addPage( rsync_options, i18n( "Synchronization" ), "bottom" );
+ addPage( super_user_options, i18n( "Super User" ), "penguin" );
+
+ // Stuff that's not managed by KConfig XT is loaded by
+ // Smb4KConfigDialog::showEvent()!
+
+ // Resize the dialog
+ setInitialSize( configDialogSize( *(Smb4KSettings::self()->config()), "ConfigDialog" ) );
+
+ // Connections
+ connect( samba_options, SIGNAL( customSettingsChanged() ),
+ this, SLOT( slotCustomSambaSettingsChanged() ) );
+
+ connect( super_user_options, SIGNAL( removeEntries() ),
+ this, SLOT( slotRemoveSuperUserEntries() ) );
+
+ connect( Smb4KCore::fileIO(), SIGNAL( failed() ),
+ this, SLOT( slotReceivedFileIOFailed() ) );
+
+ connect( Smb4KCore::fileIO(), SIGNAL( finished() ),
+ this, SLOT( slotReceivedFileIOFinished() ) );
+}
+
+
+Smb4KConfigDialog::~Smb4KConfigDialog()
+{
+}
+
+
+void Smb4KConfigDialog::loadCustomSambaOptions()
+{
+ // Get the list view:
+ KListView *custom_list = static_cast<KListView *>( child( "CustomOptionsList", "KListView", true ) );
+
+ if ( !custom_list )
+ {
+ return;
+ }
+
+ // First of all clear the list view:
+ custom_list->clear();
+
+ // Now get the default values:
+ QString default_filesystem, protocol_hint, default_uid, default_gid;
+ bool write_access = true;
+
+ switch( Smb4KSettings::filesystem() )
+ {
+ case Smb4KSettings::EnumFilesystem::CIFS:
+ {
+ default_filesystem = "cifs";
+
+ break;
+ }
+ case Smb4KSettings::EnumFilesystem::SMBFS:
+ {
+ default_filesystem = "smbfs";
+
+ break;
+ }
+ default:
+ {
+ // FIXME: Set default_filesystem to "cifs"?
+ break;
+ }
+ }
+
+ switch ( Smb4KSettings::protocolHint() )
+ {
+ case Smb4KSettings::EnumProtocolHint::Automatic:
+ {
+ // In this case the user leaves it to the net
+ // command to determine the right protocol.
+ protocol_hint = QString::null;
+
+ break;
+ }
+ case Smb4KSettings::EnumProtocolHint::RPC:
+ {
+ protocol_hint = "rpc";
+
+ break;
+ }
+ case Smb4KSettings::EnumProtocolHint::RAP:
+ {
+ protocol_hint = "rap";
+
+ break;
+ }
+ case Smb4KSettings::EnumProtocolHint::ADS:
+ {
+ protocol_hint = "ads";
+
+ break;
+ }
+ default:
+ {
+ protocol_hint = QString::null;
+
+ break;
+ }
+ }
+
+ switch( Smb4KSettings::writeAccess() )
+ {
+ case Smb4KSettings::EnumWriteAccess::ReadWrite:
+ {
+ write_access = true;
+
+ break;
+ }
+ case Smb4KSettings::EnumWriteAccess::ReadOnly:
+ {
+ write_access = false;
+
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+ const QValueList<Smb4KSambaOptionsInfo *> &list = optionsHandler()->customOptionsList();
+
+ for ( QValueList<Smb4KSambaOptionsInfo *>::ConstIterator it = list.begin();
+ it != list.end(); ++it )
+ {
+ // If the only modification is that the share is to be remounted,
+ // we will not put it into the list:
+ if ( (*it)->type() == Smb4KSambaOptionsInfo::Share &&
+ (*it)->remount() &&
+ (*it)->port() == Smb4KSettings::remotePort() &&
+#ifndef __FreeBSD__
+ QString::compare( (*it)->filesystem(), default_filesystem ) == 0 &&
+ (*it)->writeAccess() == write_access &&
+ (*it)->kerberos() == Smb4KSettings::useKerberos() /* FreeBSD does not know Kerberos for mounting */ &&
+#endif
+ ((QString::compare( default_filesystem, "cifs" ) == 0 && (*it)->uid().toInt() == (int)getuid()) ||
+ (!(*it)->uid().isEmpty() && QString::compare( (*it)->uid(), Smb4KSettings::userID() ) == 0)) &&
+ ((QString::compare( default_filesystem, "cifs" ) == 0 && (*it)->gid().toInt() == (int)getgid()) ||
+ (!(*it)->gid().isEmpty() && QString::compare( (*it)->gid(), Smb4KSettings::groupID() ) == 0)) )
+ {
+ continue;
+ }
+
+ // Now put the item in the list:
+ KListViewItem *item = new KListViewItem( custom_list );
+
+ item->setText( Smb4KSambaOptions::ItemName, (*it)->itemName() );
+
+ item->setText( Smb4KSambaOptions::Port, ((*it)->port() != -1 ?
+ QString( "%1" ).arg( (*it)->port() ) :
+ QString( "%1" ).arg( Smb4KSettings::remotePort() )) );
+
+ switch ( (*it)->type() )
+ {
+ case Smb4KSambaOptionsInfo::Host:
+ {
+ item->setText( Smb4KSambaOptions::Protocol, !(*it)->protocol().isEmpty() ?
+ (QString::compare( (*it)->protocol(), "auto" ) == 0 ? i18n( "auto" ) : (*it)->protocol().upper()) :
+ (protocol_hint.isEmpty() ? i18n( "auto" ) : protocol_hint.upper()) );
+
+ item->setText( Smb4KSambaOptions::Kerberos, (*it)->kerberos() ?
+ i18n( "yes" ) :
+ i18n( "no" ) );
+
+#ifndef __FreeBSD__
+ item->setText( Smb4KSambaOptions::FileSystem, "-" );
+
+ item->setText( Smb4KSambaOptions::WriteAccess, "-" );
+#endif
+
+ item->setText( Smb4KSambaOptions::UID, "-" );
+
+ item->setText( Smb4KSambaOptions::GID, "-" );
+
+ break;
+ }
+ case Smb4KSambaOptionsInfo::Share:
+ {
+ item->setText( Smb4KSambaOptions::Protocol, "-" );
+
+#ifndef __FreeBSD__
+ item->setText( Smb4KSambaOptions::Kerberos, (*it)->kerberos() ?
+ i18n( "yes" ) :
+ i18n( "no" ) );
+
+ item->setText( Smb4KSambaOptions::FileSystem, !(*it)->filesystem().isEmpty() ?
+ (*it)->filesystem().upper() :
+ default_filesystem.upper() );
+
+ item->setText( Smb4KSambaOptions::WriteAccess, (*it)->writeAccess() ?
+ i18n( "read-write" ) :
+ i18n( "read-only" ) );
+#else
+ // FreeBSD does not know Kerberos for mounting
+ item->setText( Smb4KSambaOptions::Kerberos, "-" );
+#endif
+ item->setText( Smb4KSambaOptions::UID, !(*it)->uid().isEmpty() ?
+ (*it)->uid() :
+ Smb4KSettings::userID() );
+
+ item->setText( Smb4KSambaOptions::GID, !(*it)->gid().isEmpty() ?
+ (*it)->gid() :
+ Smb4KSettings::groupID() );
+
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+
+ Smb4KSambaOptions *samba_options = static_cast<Smb4KSambaOptions *>( child( "SambaOptions", "Smb4KSambaOptions", true ) );
+
+ if ( samba_options )
+ {
+ samba_options->resetCustomTab();
+ }
+}
+
+
+void Smb4KConfigDialog::saveCustomSambaOptions()
+{
+ // Get the list view:
+ KListView *custom_list = static_cast<KListView *>( child( "CustomOptionsList", "KListView", true ) );
+
+ if ( !custom_list )
+ {
+ return;
+ }
+
+ if ( custom_list->childCount() != 0 )
+ {
+ // First remove all items that have been deleted in the
+ // configuration dialog:
+ QValueList<Smb4KSambaOptionsInfo *> list = optionsHandler()->customOptionsList();
+
+ for ( QValueList<Smb4KSambaOptionsInfo *>::Iterator it = list.begin(); it != list.end(); ++it )
+ {
+ if ( !custom_list->findItem( (*it)->itemName(), Smb4KSambaOptions::ItemName ) )
+ {
+ optionsHandler()->removeItem( (*it)->itemName(), false );
+
+ continue;
+ }
+ else
+ {
+ continue;
+ }
+ }
+
+ // Now updated the remaining items:
+ QListViewItemIterator it( custom_list );
+
+ while ( it.current() )
+ {
+ QListViewItem *item = it.current();
+
+ Smb4KSambaOptionsInfo *info = optionsHandler()->findItem( item->text( Smb4KSambaOptions::ItemName ) );
+
+ if ( info )
+ {
+ switch( info->type() )
+ {
+ case Smb4KSambaOptionsInfo::Host:
+ {
+ info->setProtocol( (QString::compare( item->text( Smb4KSambaOptions::Protocol ), "-" ) != 0 ?
+ item->text( Smb4KSambaOptions::Protocol ).lower() :
+ QString::null) );
+
+ info->setKerberos( (QString::compare( item->text( Smb4KSambaOptions::Kerberos ), i18n( "yes" ) ) == 0) );
+
+ info->setPort( item->text( Smb4KSambaOptions::Port ).toInt() );
+
+ break;
+ }
+ case Smb4KSambaOptionsInfo::Share:
+ {
+#ifndef __FreeBSD__
+ // FreeBSD does not know Kerberos for mounting
+ info->setKerberos( (QString::compare( item->text( Smb4KSambaOptions::Kerberos ), i18n( "yes" ) ) == 0) );
+
+ info->setFilesystem( (QString::compare( item->text( Smb4KSambaOptions::FileSystem ), "-" ) != 0 ?
+ item->text( Smb4KSambaOptions::FileSystem ).lower() :
+ QString::null) );
+
+ info->setWriteAccess( (QString::compare( item->text( Smb4KSambaOptions::WriteAccess ),
+ i18n( "read-write" ) ) == 0) );
+#endif
+ info->setUID( (QString::compare( item->text( Smb4KSambaOptions::UID ), i18n( "default" ) ) != 0 &&
+ QString::compare( item->text( Smb4KSambaOptions::UID ), "-" ) != 0) ?
+ item->text( Smb4KSambaOptions::UID ) :
+ QString::null );
+
+ info->setGID( (QString::compare( item->text( Smb4KSambaOptions::GID ), i18n( "default" ) ) != 0 &&
+ QString::compare( item->text( Smb4KSambaOptions::GID ), "-" ) != 0) ?
+ item->text( Smb4KSambaOptions::GID ) :
+ QString::null );
+
+ info->setPort( item->text( Smb4KSambaOptions::Port ).toInt() );
+
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+ else
+ {
+ // We do not have this case.
+ }
+
+ ++it;
+ }
+ }
+ else
+ {
+ // Remove all items, if the list view is empty:
+ QValueList<Smb4KSambaOptionsInfo *> list = optionsHandler()->customOptionsList();
+
+ for ( QValueList<Smb4KSambaOptionsInfo *>::Iterator it = list.begin(); it != list.end(); ++it )
+ {
+ if ( !(*it)->remount() )
+ {
+ optionsHandler()->removeItem( (*it)->itemName(), false );
+
+ continue;
+ }
+ else
+ {
+ continue;
+ }
+ }
+ }
+
+ optionsHandler()->sync();
+}
+
+
+void Smb4KConfigDialog::loadAuthenticationData()
+{
+ // Load the default login info and put it into the configuration
+ // page:
+ Smb4KAuthInfo auth( QString::null, QString::null, QString::null );
+
+ (void) passwordHandler()->readDefaultAuth( &auth );
+
+ KLineEdit *default_user = static_cast<KLineEdit *>( child( "DefaultUserName", "KLineEdit", true ) );
+
+ if ( default_user )
+ {
+ default_user->setText( auth.user() );
+ }
+
+ KLineEdit *default_pass = static_cast<KLineEdit *>( child( "DefaultPassword", "KLineEdit", true ) );
+
+ if ( default_pass )
+ {
+ default_pass->setText( auth.password() );
+ }
+}
+
+
+void Smb4KConfigDialog::saveAuthenticationData()
+{
+ // Read the default login info from the configuration page
+ // and pass it to the password handler, but only if the wallet
+ // is open at this time. Otherwise we could end up with empty
+ // entries:
+ if ( passwordHandler()->walletIsOpen() )
+ {
+ Smb4KAuthInfo auth( QString::null, QString::null, QString::null );
+
+ KLineEdit *default_user = static_cast<KLineEdit *>( child( "DefaultUserName", "KLineEdit", true ) );
+
+ if ( default_user )
+ {
+ auth.setUser( default_user->text() );
+ }
+
+ KLineEdit *default_pass = static_cast<KLineEdit *>( child( "DefaultPassword", "KLineEdit", true ) );
+
+ if ( default_pass )
+ {
+ auth.setPassword( default_pass->text() );
+ }
+
+ passwordHandler()->writeDefaultAuth( &auth );
+ }
+ else
+ {
+ // Do nothing
+ }
+}
+
+
+bool Smb4KConfigDialog::writeSuperUserEntries()
+{
+ QRadioButton *sudo = static_cast<QRadioButton *>( child( "SudoButton", "QRadioButton", true ) );
+ QRadioButton *super = static_cast<QRadioButton *>( child( "SuperButton", "QRadioButton", true ) );
+#ifdef __linux__
+ QCheckBox *force = static_cast<QCheckBox *>( child( "kcfg_UseForceUnmount", "QCheckBox", true ) );
+#endif
+ QCheckBox *full_use = static_cast<QCheckBox *>( child( "kcfg_AlwaysUseSuperUser", "QCheckBox", true ) );
+
+ // Check if we need to write anything at all:
+ Smb4KFileIO::Operation op = Smb4KFileIO::NoOperation;
+ bool success = true;
+
+#ifdef __linux__
+ if ( sudo && super && force && full_use )
+#else
+ if ( sudo && super && full_use )
+#endif
+ {
+ if ( sudo->isChecked() )
+ {
+#ifdef __linux__
+ if ( (!use_sudo && (force->isChecked() || full_use->isChecked())) ||
+ (use_sudo &&
+ ((force->isChecked() && force_unmount != force->isChecked()) ||
+ (full_use->isChecked() && always_use_su != full_use->isChecked()))) )
+#else
+ if ( (!use_sudo && full_use->isChecked()) ||
+ (use_sudo &&
+ (full_use->isChecked() && always_use_su != full_use->isChecked())) )
+#endif
+ {
+ success = Smb4KCore::fileIO()->writeSudoers( (op = Smb4KFileIO::Insert) );
+ }
+ }
+ else if ( super->isChecked() )
+ {
+#ifdef __linux__
+ if ( (!use_super && (force->isChecked() || full_use->isChecked())) ||
+ (use_super &&
+ ((force->isChecked() && force_unmount != force->isChecked()) ||
+ (full_use->isChecked() && always_use_su != full_use->isChecked()))) )
+#else
+ if ( (!use_super && full_use->isChecked()) ||
+ (use_super &&
+ (full_use->isChecked() && always_use_su != full_use->isChecked())) )
+#endif
+ {
+ success = Smb4KCore::fileIO()->writeSuperTab( (op = Smb4KFileIO::Insert) );
+ }
+ }
+ else
+ {
+ // Do nothing
+ }
+
+ use_sudo = sudo->isChecked();
+ use_super = super->isChecked();
+#ifdef __linux__
+ force_unmount = force->isChecked();
+#endif
+ always_use_su = full_use->isChecked();
+ }
+ else
+ {
+ // Do nothing
+ }
+
+ return (!success || op == Smb4KFileIO::NoOperation) ? false : true;
+}
+
+
+void Smb4KConfigDialog::removeSuperUserEntries()
+{
+ QRadioButton *sudo = static_cast<QRadioButton *>( child( "SudoButton", "QRadioButton", true ) );
+ QRadioButton *super = static_cast<QRadioButton *>( child( "SuperButton", "QRadioButton", true ) );
+#ifdef __linux__
+ QCheckBox *force = static_cast<QCheckBox *>( child( "kcfg_UseForceUnmount", "QCheckBox", true ) );
+#endif
+ QCheckBox *full_use = static_cast<QCheckBox *>( child( "kcfg_AlwaysUseSuperUser", "QCheckBox", true ) );
+
+#ifdef __linux__
+ if ( sudo && super && force && full_use )
+#else
+ if ( sudo && super && full_use )
+#endif
+
+ {
+ if ( sudo->isChecked() )
+ {
+ Smb4KCore::fileIO()->writeSudoers( Smb4KFileIO::Remove );
+ }
+ else if ( super->isChecked() )
+ {
+ Smb4KCore::fileIO()->writeSuperTab( Smb4KFileIO::Remove );
+ }
+ else
+ {
+ // Do nothing
+ }
+
+#ifdef __linux__
+ force->setChecked( false );
+#endif
+ full_use->setChecked( false );
+
+ use_sudo = sudo->isChecked();
+ use_super = super->isChecked();
+#ifdef __linux__
+ force_unmount = force->isChecked();
+#endif
+ always_use_su = full_use->isChecked();
+ }
+ else
+ {
+ // Do nothing
+ }
+}
+
+
+bool Smb4KConfigDialog::checkSettings()
+{
+ bool ok = true;
+ QString issues = QString::null;
+ int index = 0;
+
+ // If the user chose "Query custom master browser" in the
+ // "Network" tab, there must be a master browser present:
+ QRadioButton *query_custom_master = static_cast<QRadioButton *>( child( "CustomMasterBrowserLabel", "QRadioButton", true ) );
+ KLineEdit *custom_master_input = static_cast<KLineEdit *>( child( "kcfg_CustomMasterBrowser", "KLineEdit", true ) );
+
+ if ( query_custom_master && custom_master_input &&
+ query_custom_master->isChecked() &&
+ custom_master_input->text().stripWhiteSpace().isEmpty() )
+ {
+ ok = false;
+ index++;
+
+ issues.append( "* "+i18n( "[Network] The custom master browser has not been entered.\n" ) );
+ }
+
+ // If the user chose "Scan broadcast areas" in the
+ // "Network" tab, there must broadcast areas present:
+ QRadioButton *scan_bcast_areas = static_cast<QRadioButton *>( child( "BroadcastAreasLabel", "QRadioButton", true ) );
+ KLineEdit *bcast_areas_input = static_cast<KLineEdit *>( child( "kcfg_BroadcastAreas", "KLineEdit", true ) );
+
+ if ( scan_bcast_areas && bcast_areas_input &&
+ scan_bcast_areas->isChecked() &&
+ bcast_areas_input->text().stripWhiteSpace().isEmpty() )
+ {
+ ok = false;
+ index++;
+
+ issues.append( "* "+i18n( "[Network] The broadcast areas have not been entered.\n" ) );
+ }
+
+ // The mount prefix must not be empty:
+ KURLRequester *mount_prefix = static_cast<KURLRequester *>( child( "kcfg_MountPrefix", "KURLRequester", true ) );
+
+ if ( mount_prefix && mount_prefix->url().stripWhiteSpace().isEmpty() )
+ {
+ ok = false;
+ index++;
+
+ issues.append( "* "+i18n( "[Shares] The mount prefix is empty.\n" ) );
+ }
+
+ // If the user wants to use a default login, the user
+ // name must not be empty.
+ QCheckBox *use_default_login = static_cast<QCheckBox *>( child( "kcfg_UseDefaultLogin", "QCheckBox", true ) );
+ KLineEdit *default_user_name = static_cast<KLineEdit *>( child( "kcfg_DefaultUserName", "KLineEdit", true ) );
+
+ if ( use_default_login && default_user_name &&
+ use_default_login->isChecked() &&
+ default_user_name->text().stripWhiteSpace().isEmpty() )
+ {
+ ok = false;
+ index++;
+
+ issues.append( "* "+i18n( "[Authentication] The default user name has not been entered.\n" ) );
+ }
+
+ // The file mask must not be empty.
+ KLineEdit *file_mask = static_cast<KLineEdit *>( child( "kcfg_FileMask", "KLineEdit", true ) );
+
+ if ( file_mask && file_mask->text().stripWhiteSpace().isEmpty() )
+ {
+ ok = false;
+ index++;
+
+ issues.append( "* "+i18n( "[Samba] The file mask is empty.\n" ) );
+ }
+
+ // The directory mask must not be empty.
+ KLineEdit *directory_mask = static_cast<KLineEdit *>( child( "kcfg_DirectoryMask", "KLineEdit", true ) );
+
+ if ( directory_mask && directory_mask->text().stripWhiteSpace().isEmpty() )
+ {
+ ok = false;
+ index++;
+
+ issues.append( "* "+i18n( "[Samba] The directory mask is empty.\n" ) );
+ }
+
+ // The UID must not be empty.
+ KLineEdit *user_id = static_cast<KLineEdit *>( child( "kcfg_UserID", "KLineEdit", true ) );
+
+ if ( user_id && user_id->text().stripWhiteSpace().isEmpty() )
+ {
+ ok = false;
+ index++;
+
+ issues.append( "* "+i18n( "[Samba] The UID is empty.\n" ) );
+ }
+
+ // The GID must not be empty.
+ KLineEdit *group_id = static_cast<KLineEdit *>( child( "kcfg_GroupID", "KLineEdit", true ) );
+
+ if ( group_id && group_id->text().stripWhiteSpace().isEmpty() )
+ {
+ ok = false;
+ index++;
+
+ issues.append( "* "+i18n( "[Samba] The GID is empty.\n" ) );
+ }
+
+ // The rsync prefix must not be empty.
+ KURLRequester *rsync_prefix = static_cast<KURLRequester *>( child( "kcfg_RsyncPrefix", "KURLRequester", true ) );
+
+ if ( rsync_prefix && rsync_prefix->url().stripWhiteSpace().isEmpty() )
+ {
+ ok = false;
+ index++;
+
+ issues.append( "* "+i18n( "[Synchronization] The rsync prefix is empty.\n" ) );
+ }
+
+ // The path where to store partial files must not be empty.
+ QCheckBox *use_partical_directory = static_cast<QCheckBox *>( child( "kcfg_UsePartialDirectory", "QCheckBox", true ) );
+ KURLRequester *partial_directory = static_cast<KURLRequester *>( child( "kcfg_PartialDirectory", "KURLRequester", true ) );
+
+ if ( use_partical_directory && use_partical_directory->isChecked() &&
+ partial_directory && partial_directory->url().stripWhiteSpace().isEmpty() )
+ {
+ ok = false;
+ index++;
+
+ issues.append( "* "+i18n( "[Synchronization] The directory where partially transferred files should be stored is empty.\n" ) );
+ }
+
+ // The the exclude patterns must not be empty.
+ QCheckBox *use_exclude_pattern = static_cast<QCheckBox *>( child( "kcfg_UseExcludePattern", "QCheckBox", true ) );
+ KLineEdit *exclude_pattern = static_cast<KLineEdit *>( child( "kcfg_ExcludePattern", "KLineEdit", true ) );
+
+ if ( use_exclude_pattern && use_exclude_pattern->isChecked() &&
+ exclude_pattern && exclude_pattern->text().stripWhiteSpace().isEmpty() )
+ {
+ ok = false;
+ index++;
+
+ issues.append( "* "+i18n( "[Synchronization] The exclude patterns have not been entered.\n" ) );
+ }
+
+ // The the path of the exclude file must not be empty.
+ QCheckBox *use_exclude_file = static_cast<QCheckBox *>( child( "kcfg_UseExcludeFrom", "QCheckBox", true ) );
+ KURLRequester *exclude_file = static_cast<KURLRequester *>( child( "kcfg_ExcludeFrom", "KURLRequester", true ) );
+
+ if ( use_exclude_file && use_exclude_file->isChecked() &&
+ exclude_file && exclude_file->url().stripWhiteSpace().isEmpty() )
+ {
+ ok = false;
+ index++;
+
+ issues.append( "* "+i18n( "[Synchronization] The path of the exclude file is empty.\n" ) );
+ }
+
+ // The the include patterns must not be empty.
+ QCheckBox *use_include_pattern = static_cast<QCheckBox *>( child( "kcfg_UseIncludePattern", "QCheckBox", true ) );
+ KLineEdit *include_pattern = static_cast<KLineEdit *>( child( "kcfg_IncludePattern", "KLineEdit", true ) );
+
+ if ( use_include_pattern && use_include_pattern->isChecked() &&
+ include_pattern && include_pattern->text().stripWhiteSpace().isEmpty() )
+ {
+ ok = false;
+ index++;
+
+ issues.append( "* "+i18n( "[Synchronization] The include patterns have not been entered.\n" ) );
+ }
+
+ // The the path of the exclude file must not be empty.
+ QCheckBox *use_include_file = static_cast<QCheckBox *>( child( "kcfg_UseIncludeFrom", "QCheckBox", true ) );
+ KURLRequester *include_file = static_cast<KURLRequester *>( child( "kcfg_IncludeFrom", "KURLRequester", true ) );
+
+ if ( use_include_file && use_include_file->isChecked() &&
+ include_file && include_file->url().stripWhiteSpace().isEmpty() )
+ {
+ ok = false;
+ index++;
+
+ issues.append( "* "+i18n( "[Synchronization] The path of the include file is empty.\n" ) );
+ }
+
+ // If you make backups, check that the suffix and that the
+ // backup directory is not empty.
+ QCheckBox *make_backups = static_cast<QCheckBox *>( child( "kcfg_MakeBackups", "QCheckBox", true ) );
+
+ if ( make_backups && make_backups->isChecked() )
+ {
+ // The backup suffix must not be empty.
+ QCheckBox *use_backup_suffix = static_cast<QCheckBox *>( child( "kcfg_UseBackupSuffix", "QCheckBox", true ) );
+ KLineEdit *backup_suffix = static_cast<KLineEdit *>( child( "kcfg_BackupSuffix", "KLineEdit", true ) );
+
+ if ( use_backup_suffix && use_backup_suffix->isChecked() &&
+ backup_suffix && backup_suffix->text().stripWhiteSpace().isEmpty() )
+ {
+ ok = false;
+ index++;
+
+ issues.append( "* "+i18n( "[Synchronization] The backup suffix has not been defined.\n" ) );
+ }
+
+ // The the path for backups must not be empty.
+ QCheckBox *use_backup_dir = static_cast<QCheckBox *>( child( "kcfg_UseBackupDirectory", "QCheckBox", true ) );
+ KURLRequester *backup_dir = static_cast<KURLRequester *>( child( "kcfg_BackupDirectory", "KURLRequester", true ) );
+
+ if ( use_backup_dir && use_backup_dir->isChecked() &&
+ backup_dir && backup_dir->url().stripWhiteSpace().isEmpty() )
+ {
+ ok = false;
+ index++;
+
+ issues.append( "* "+i18n( "[Synchronization] The backup directory is empty.\n" ) );
+ }
+ }
+
+ if ( !ok )
+ {
+ if ( index == 1 )
+ {
+ KMessageBox::error( this, i18n( "The configuration could not be written, because one setting is incomplete:\n%1Please correct this issue." ).arg( issues ) );
+ }
+ else
+ {
+ KMessageBox::error( this, i18n( "The configuration could not be written, because %1 settings are incomplete:\n%1Please correct these issues." ).arg( index ).arg( issues ) );
+ }
+ }
+
+ return ok;
+}
+
+
+void Smb4KConfigDialog::showEvent( QShowEvent *e )
+{
+ // Spontaneous show events come from outside the application.
+ // We do not want to react on them.
+ if ( !e->spontaneous() )
+ {
+ loadCustomSambaOptions();
+ loadAuthenticationData();
+ }
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// SLOT IMPLEMENTATIONS
+/////////////////////////////////////////////////////////////////////////////
+
+void Smb4KConfigDialog::slotApply()
+{
+ // If some settings are not complete, stop here and give
+ // the user the opportunity to fill in the needed string(s).
+ if ( !checkSettings() )
+ {
+ return;
+ }
+
+ saveCustomSambaOptions();
+ saveAuthenticationData();
+
+ if ( writeSuperUserEntries() )
+ {
+ // Disable this widget until Smb4KFileIO::finished()
+ // is received.
+ setEnabled( false );
+ }
+
+ // The 'Apply' button will be disabled by KConfigDialog, so we do not
+ // need to do it here.
+
+ KConfigDialog::slotApply();
+}
+
+
+void Smb4KConfigDialog::slotOk()
+{
+ // If some settings are not complete, stop here and give
+ // the user the opportunity to fill in the needed string(s).
+ if ( !checkSettings() )
+ {
+ return;
+ }
+
+ saveCustomSambaOptions();
+ saveAuthenticationData();
+
+ saveDialogSize( *(Smb4KSettings::self()->config()), "ConfigDialog" );
+
+ // If the something needs to be written to either /etc/super.tab
+ // or /etc/sudoers, do not close the dialog but wait until the
+ // Smb4KFileIO::finished() signal is received.
+ if ( !writeSuperUserEntries() )
+ {
+ KConfigDialog::slotOk();
+ }
+ else
+ {
+ // Disable this widget until Smb4KFileIO::finished()
+ // is received.
+ setEnabled( false );
+
+ // Tell Smb4KConfigDialog::slotReceivedFileIOFinished()
+ // to close the dialog.
+ close_dialog = true;
+ }
+}
+
+
+void Smb4KConfigDialog::slotCancel()
+{
+ // Reset the custom Samba options tab:
+ Smb4KSambaOptions *samba_options = static_cast<Smb4KSambaOptions *>( child( "SambaOptions", "Smb4KSambaOptions", true ) );
+
+ if ( samba_options )
+ {
+ samba_options->resetCustomTab();
+ }
+
+ KConfigDialog::slotCancel();
+}
+
+
+void Smb4KConfigDialog::slotCustomSambaSettingsChanged()
+{
+ // Get the list view and all other input widgets:
+ KListView *view = static_cast<KListView *>( child( "CustomOptionsList", "KListView", true ) );
+
+ if ( !view )
+ {
+ return;
+ }
+
+ // Get the list of custom options:
+ QValueList<Smb4KSambaOptionsInfo *> list = optionsHandler()->customOptionsList();
+
+ bool changed = false;
+
+ // Loop through the list view items to see what changed and if
+ // we need to enable the 'Apply' button:
+ for ( QValueList<Smb4KSambaOptionsInfo *>::ConstIterator it = list.begin();
+ it != list.end(); ++it )
+ {
+ // Find the item in the list view:
+ QListViewItem *item = view->findItem( (*it)->itemName(), Smb4KSambaOptions::ItemName );
+
+ if ( item )
+ {
+ if ( (*it)->type() == Smb4KSambaOptionsInfo::Host )
+ {
+ // Check if the protocol changed.
+ if ( ((*it)->protocol().isEmpty() &&
+ QString::compare( item->text( Smb4KSambaOptions::Protocol ).lower(), i18n( "auto" ) ) != 0) ||
+ QString::compare( (*it)->protocol(), item->text( Smb4KSambaOptions::Protocol ).lower() ) != 0 )
+ {
+ changed = true;
+
+ break;
+ }
+ }
+ else if ( (*it)->type() == Smb4KSambaOptionsInfo::Share )
+ {
+#ifndef __FreeBSD__
+ // Check if the file system changed.
+ if ( QString::compare( (*it)->filesystem(), item->text( Smb4KSambaOptions::FileSystem ).lower() ) != 0 )
+ {
+ changed = true;
+
+ break;
+ }
+
+ // Check if the write access changed.
+ QString write_access = (*it)->writeAccess() ?
+ i18n( "read-write" ) :
+ i18n( "read-only" );
+
+ if ( QString::compare( write_access, item->text( Smb4KSambaOptions::WriteAccess ) ) != 0 )
+ {
+ changed = true;
+
+ break;
+ }
+#endif
+ // Check if the UID changed.
+ if ( ((*it)->uid().isEmpty() &&
+ QString::compare( i18n( "default" ), item->text( Smb4KSambaOptions::UID ) ) != 0) ||
+ QString::compare( (*it)->uid(), item->text( Smb4KSambaOptions::UID ) ) != 0 )
+ {
+ changed = true;
+
+ break;
+ }
+
+ // Check if the GID changed.
+ if ( ((*it)->gid().isEmpty() &&
+ QString::compare( i18n( "default" ), item->text( Smb4KSambaOptions::GID ) ) != 0) ||
+ QString::compare( (*it)->gid(), item->text( Smb4KSambaOptions::GID ) ) != 0 )
+ {
+ changed = true;
+
+ break;
+ }
+ }
+ else
+ {
+ // Something went wrong. Stop right here.
+ break;
+ }
+
+ // Check if the Kerberos entry changed.
+ QString kerberos = (*it)->kerberos() ?
+ i18n( "yes" ) :
+ i18n( "no" );
+
+ if ( QString::compare( kerberos, item->text( Smb4KSambaOptions::Kerberos ) ) != 0 )
+ {
+ changed = true;
+
+ break;
+ }
+
+ // Check if the port value changed.
+ if ( (*it)->port() != item->text( Smb4KSambaOptions::Port ).toInt() )
+ {
+ changed = true;
+
+ break;
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ enableButtonApply( changed );
+}
+
+
+void Smb4KConfigDialog::slotRemoveSuperUserEntries()
+{
+ // Disable this widget until Smb4KFileIO::finished()
+ // is received.
+ setEnabled( false );
+
+ removeSuperUserEntries();
+}
+
+
+void Smb4KConfigDialog::slotReceivedFileIOFailed()
+{
+#ifdef __linux__
+ QCheckBox *force = static_cast<QCheckBox *>( child( "kcfg_UseForceUnmount", "QCheckBox", true ) );
+#endif
+ QCheckBox *full_use = static_cast<QCheckBox *>( child( "kcfg_AlwaysUseSuperUser", "QCheckBox", true ) );
+
+#ifdef __linux__
+ if ( force && full_use )
+ {
+ force->setChecked( false );
+#else
+ if ( full_use )
+ {
+#endif
+ full_use->setChecked( false );
+ }
+}
+
+
+void Smb4KConfigDialog::slotReceivedFileIOFinished()
+{
+ // Enable the widget again.
+ setEnabled( true );
+
+ if ( close_dialog )
+ {
+ KConfigDialog::slotOk();
+ }
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// FACTORY STUFF
+/////////////////////////////////////////////////////////////////////////////
+
+Smb4KConfigDialogFactory::Smb4KConfigDialogFactory()
+: KLibFactory()
+{
+}
+
+
+Smb4KConfigDialogFactory::~Smb4KConfigDialogFactory()
+{
+ delete m_instance;
+ delete m_about;
+
+ m_instance = 0L;
+}
+
+
+KInstance *Smb4KConfigDialogFactory::instance()
+{
+ if( !m_instance )
+ {
+ m_about = new KAboutData( "smb4kconfigdialog", I18N_NOOP( "Smb4KConfigDialog" ), "1.0" );
+ m_about->addAuthor("Alexander Reinholdt", 0, "dustpuppy@users.berlios.de");
+ m_about->setLicense( KAboutData::License_GPL );
+ m_instance = new KInstance( m_about );
+ }
+
+ return m_instance;
+}
+
+
+QObject *Smb4KConfigDialogFactory::createObject( QObject *parent, const char *name, const char *,
+const QStringList & )
+{
+ return static_cast<QObject *>( new Smb4KConfigDialog( Smb4KSettings::self(), static_cast<QWidget *>( parent ), name ) );
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// INIT
+/////////////////////////////////////////////////////////////////////////////
+
+
+extern "C"
+{
+ void *init_libsmb4kconfigdialog()
+ {
+ KGlobal::locale()->insertCatalogue( "smb4k" );
+ return new Smb4KConfigDialogFactory;
+ }
+}
+
+#include "smb4kconfigdialog.moc"
diff --git a/smb4k/configdlg/smb4kconfigdialog.h b/smb4k/configdlg/smb4kconfigdialog.h
new file mode 100644
index 0000000..8e6f9f8
--- /dev/null
+++ b/smb4k/configdlg/smb4kconfigdialog.h
@@ -0,0 +1,208 @@
+/***************************************************************************
+ smb4kconfigdialog - The configuration dialog of Smb4K
+ -------------------
+ begin : Sa Apr 14 2007
+ copyright : (C) 2007 by Alexander Reinholdt
+ email : dustpuppy@users.berlios.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef SMB4KCONFIGDIALOG_H
+#define SMB4KCONFIGDIALOG_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// KDE includes
+#include <kconfigdialog.h>
+#include <klibloader.h>
+#include <kaboutdata.h>
+#include <kinstance.h>
+
+// forward declarations
+class Smb4KSettings;
+
+/**
+ * This is the (new) configuration dialog of Smb4K.
+ *
+ * @author Alexander Reinholdt <dustpuppy@users.berlios.de>
+ */
+
+class Smb4KConfigDialog : public KConfigDialog
+{
+ Q_OBJECT
+
+ public:
+ /**
+ * The constructor.
+ *
+ * @param settings The Smb4KSettings object that needs to be passed
+ * so that the settings can be managed.
+ *
+ * @param parent The parent widget
+ *
+ * @param name The name of this dialog
+ */
+ Smb4KConfigDialog( Smb4KSettings *settings, QWidget *parent = 0, const char *name = 0 );
+
+ /**
+ * The destructor
+ */
+ ~Smb4KConfigDialog();
+
+ protected:
+ /**
+ * Reimplemented from QWidget to do last things before the
+ * configuration dialog is shown.
+ *
+ * @param e The show event object
+ */
+ void showEvent( QShowEvent *e );
+
+ protected slots:
+ /**
+ * Reimplemented from KConfigDialog. This slot does application
+ * specific stuff first and then executes KConfigDialog::slotApply().
+ */
+ void slotApply();
+
+ /**
+ * Reimplemented from KConfigDialog. This slot does application
+ * specific stuff first and then executes KConfigDialog::slotOk().
+ */
+ void slotOk();
+
+ /**
+ *Reimplemented from KConfigDialog. This slot does application
+ * specific stuff first and then executes KConfigDialog::slotCancel().
+ */
+ void slotCancel();
+
+ /**
+ * The custom Samba settings changed. Decide if we have to
+ * enable the 'Apply' button or not.
+ */
+ void slotCustomSambaSettingsChanged();
+
+ /**
+ * The 'Remove Entries' button in the 'Super User' page has been
+ * clicked. Initialize the removal of Smb4K's configuration entries
+ * from the configuration file of the currently chosen program.
+ */
+ void slotRemoveSuperUserEntries();
+
+ /**
+ * This slot is activated if the Smb4KFileIO::failed() signal is
+ * received. It deselects all check boxes in the "Super User" page.
+ */
+ void slotReceivedFileIOFailed();
+
+ /**
+ * This slot is activated if the Smb4KFileIO::finished() signal is
+ * received. It closes the dialog by invoking KConfigDialog::slotOk().
+ */
+ void slotReceivedFileIOFinished();
+
+ private:
+ /**
+ * Load the custom Samba options
+ */
+ void loadCustomSambaOptions();
+
+ /**
+ * Save the custom Samba options
+ */
+ void saveCustomSambaOptions();
+
+ /**
+ * Load the authentication data
+ */
+ void loadAuthenticationData();
+
+ /**
+ * Save the authentication data
+ */
+ void saveAuthenticationData();
+
+ /**
+ * Write super user configuration entries to configuration file.
+ *
+ * @returns TRUE if something needs to be written.
+ */
+ bool writeSuperUserEntries();
+
+ /**
+ * Remove super user configuration entries from the configuration file.
+ */
+ void removeSuperUserEntries();
+
+ /**
+ * Checks that mandatorily needed input is provided for settings that
+ * need it. This function will report all missing input to the user
+ * via a message box.
+ *
+ * @returns TRUE if the check passed and FALSE if it failed.
+ */
+ bool checkSettings();
+};
+
+
+class KInstance;
+class KAboutData;
+
+
+class Smb4KConfigDialogFactory : KLibFactory
+{
+ Q_OBJECT
+
+ public:
+ /**
+ * The constructor.
+ */
+ Smb4KConfigDialogFactory();
+
+ /**
+ * The destructor.
+ */
+ virtual ~Smb4KConfigDialogFactory();
+
+ /**
+ * The instance
+ */
+ static KInstance *instance();
+
+ protected:
+ QObject *createObject( QObject *parent = 0, const char *name = 0,
+ const char *classname = "QObject",
+ const QStringList &args = QStringList() );
+
+ private:
+ /**
+ * The factory's instance
+ */
+ static KInstance *m_instance;
+
+ /**
+ * The factory's KAboutData object
+ */
+ static KAboutData *m_about;
+};
+
+#endif
diff --git a/smb4k/configdlg/smb4knetworkoptions.cpp b/smb4k/configdlg/smb4knetworkoptions.cpp
new file mode 100644
index 0000000..4c2244b
--- /dev/null
+++ b/smb4k/configdlg/smb4knetworkoptions.cpp
@@ -0,0 +1,107 @@
+/***************************************************************************
+ smb4knetworkoptions - The configuration page for the network
+ settings of Smb4K
+ -------------------
+ begin : Sa Nov 15 2003
+ copyright : (C) 2003-2007 by Alexander Reinholdt
+ email : dustpuppy@users.berlios.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+// Qt includes
+#include <qbuttongroup.h>
+#include <qlayout.h>
+#include <qradiobutton.h>
+#include <qlabel.h>
+
+// KDE includes
+#include <klocale.h>
+#include <klineedit.h>
+#include <kcombobox.h>
+
+// application specific includes
+#include "smb4knetworkoptions.h"
+#include "../core/smb4ksettings.h"
+
+Smb4KNetworkOptions::Smb4KNetworkOptions( QWidget *parent, const char *name ) : QWidget( parent, name )
+{
+ QGridLayout *grid = new QGridLayout( this );
+ grid->setSpacing( 10 );
+
+ //
+ // The browse list group box.
+ //
+ QButtonGroup *browse_box = new QButtonGroup( 1, Qt::Horizontal, i18n( "Browse List" ),
+ this, "kcfg_BrowseList" );
+
+ browse_box->insert( new QRadioButton( i18n( "Scan the network neighborhood for available workgroups and domains" ),
+ browse_box ), Smb4KSettings::EnumBrowseList::LookupDomains );
+ browse_box->insert( new QRadioButton( i18n( "Query the current workgroup master browser" ),
+ browse_box), Smb4KSettings::EnumBrowseList::QueryCurrentMaster );
+
+ QWidget *buttonWidget = new QWidget( browse_box );
+ QGridLayout *buttonLayout = new QGridLayout( buttonWidget );
+ buttonLayout->setSpacing( 5 );
+
+ QRadioButton *use_host = new QRadioButton( i18n( "Query this master browser:" ),
+ buttonWidget, "CustomMasterBrowserLabel" );
+ KLineEdit *host_name = new KLineEdit( buttonWidget, "kcfg_CustomMasterBrowser" );
+ QRadioButton *use_scan = new QRadioButton( i18n( "Scan broadcast areas:" ),
+ buttonWidget, "BroadcastAreasLabel" );
+ KLineEdit *broadcast_addresses = new KLineEdit( buttonWidget, "kcfg_BroadcastAreas" );
+
+ buttonLayout->addWidget( use_host, 0, 0, 0 );
+ buttonLayout->addWidget( host_name, 0, 1, 0 );
+ buttonLayout->addWidget( use_scan, 1, 0, 0 );
+ buttonLayout->addWidget( broadcast_addresses, 1, 1, 0 );
+
+ browse_box->insert( use_host, Smb4KSettings::EnumBrowseList::QueryCustomMaster );
+ browse_box->insert( use_scan, Smb4KSettings::EnumBrowseList::ScanBroadcastAreas );
+
+ //
+ // The search group box
+ //
+ QButtonGroup *search_box = new QButtonGroup( 1, Qt::Horizontal, i18n( "Network Search" ),
+ this, "kcfg_SearchMethod" );
+ search_box->setInsideSpacing( 5 );
+
+ QLabel *description = new QLabel( search_box );
+ description->setText( i18n( "Smb4K uses \"nmblookup\" by default to search for remote hosts. This method is very reliable but fails sometimes if your network neighborhood is configured uncommonly. In this case you should try to use \"smbclient\"." ) );
+ description->setTextFormat( Qt::RichText );
+
+ search_box->insert( new QRadioButton( i18n( "Use nmblookup (recommended)" ),
+ search_box ), Smb4KSettings::EnumSearchMethod::Nmblookup );
+
+ search_box->insert( new QRadioButton( i18n( "Use smbclient" ),
+ search_box ), Smb4KSettings::EnumSearchMethod::Smbclient );
+
+ QSpacerItem *spacer4 = new QSpacerItem( 0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding );
+
+ grid->addWidget( browse_box, 0, 0, 0 );
+ grid->addWidget( search_box, 1, 0, 0 );
+ grid->addItem( spacer4, 2, 0 );
+}
+
+
+Smb4KNetworkOptions::~Smb4KNetworkOptions()
+{
+}
+
+
+#include "smb4knetworkoptions.moc"
diff --git a/smb4k/configdlg/smb4knetworkoptions.h b/smb4k/configdlg/smb4knetworkoptions.h
new file mode 100644
index 0000000..b3b47f3
--- /dev/null
+++ b/smb4k/configdlg/smb4knetworkoptions.h
@@ -0,0 +1,63 @@
+/***************************************************************************
+ smb4knetworkoptions - The configuration page for the network
+ settings of Smb4K
+ -------------------
+ begin : Sa Nov 15 2003
+ copyright : (C) 2003-2007 by Alexander Reinholdt
+ email : dustpuppy@users.berlios.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef SMB4KNETWORKOPTIONS_H
+#define SMB4KNETWORKOPTIONS_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// Qt includes
+#include <qwidget.h>
+
+/**
+ * This is the configuration tab for the network settings
+ * of Smb4K.
+ *
+ * @author Alexander Reinholdt <dustpuppy@users.berlios.de>
+ */
+
+class Smb4KNetworkOptions : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ /**
+ * The constructor
+ *
+ * @param parent The parent widget
+ *
+ * @param name The widget's name
+ */
+ Smb4KNetworkOptions( QWidget *parent = 0, const char *name = 0 );
+
+ /**
+ * The destructor
+ */
+ ~Smb4KNetworkOptions();
+};
+#endif
diff --git a/smb4k/configdlg/smb4krsyncoptions.cpp b/smb4k/configdlg/smb4krsyncoptions.cpp
new file mode 100644
index 0000000..301ee30
--- /dev/null
+++ b/smb4k/configdlg/smb4krsyncoptions.cpp
@@ -0,0 +1,351 @@
+/***************************************************************************
+ smb4ksynchronizeoptions - The configuration page for the rsync options
+ -------------------
+ begin : So Nov 20 2005
+ copyright : (C) 2005-2007 by Alexander Reinholdt
+ email : dustpuppy@users.berlios.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+// Qt includes
+#include <qlayout.h>
+#include <qbuttongroup.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qradiobutton.h>
+
+// KDE includes
+#include <klocale.h>
+#include <kurlrequester.h>
+#include <klineedit.h>
+#include <knuminput.h>
+#include <klineedit.h>
+#include <kfile.h>
+
+// application specific includes
+#include "smb4krsyncoptions.h"
+
+Smb4KRsyncOptions::Smb4KRsyncOptions( QWidget *parent, const char *name ) : QTabWidget( parent, name )
+{
+ setMargin( 10 );
+
+ //
+ // The Copying tab
+ //
+ QWidget *copying_tab = new QWidget( this, "RsyncCopying" );
+ QGridLayout *copying_layout = new QGridLayout( copying_tab );
+ copying_layout->setSpacing( 10 );
+
+ QGroupBox *directory_box = new QGroupBox( 2, QGroupBox::Horizontal, i18n( "Default Destination" ),
+ copying_tab, "RsyncDestinationBox" );
+ directory_box->setInsideSpacing( 5 );
+
+ (void) new QLabel( i18n( "Rsync prefix:" ), directory_box, "RsyncPrefixLabel" );
+ KURLRequester *prefix = new KURLRequester( directory_box, "kcfg_RsyncPrefix" );
+ prefix->setMode( KFile::Directory | KFile::LocalOnly );
+
+ QButtonGroup *general_box = new QButtonGroup( 2, QButtonGroup::Horizontal, i18n( "General" ),
+ copying_tab, "RsyncModeBox" );
+ general_box->setInsideSpacing( 5 );
+
+ QCheckBox *archive_mode = new QCheckBox( i18n( "Archive mode" ), general_box, "kcfg_ArchiveMode" );
+ QCheckBox *recursive = new QCheckBox( i18n( "Recurse into directories" ), general_box, "kcfg_RecurseIntoDirectories" );
+ (void) new QCheckBox( i18n( "Skip files that are newer in target directory" ), general_box, "kcfg_UpdateTarget" );
+ (void) new QCheckBox( i18n( "Update destination files in place" ), general_box, "kcfg_UpdateInPlace" );
+ (void) new QCheckBox( i18n( "Use relative path names" ), general_box, "kcfg_RelativePathNames" );
+ (void) new QCheckBox( i18n( "Don't send implied directories" ), general_box, "kcfg_NoImpliedDirectories" );
+ (void) new QCheckBox( i18n( "Transfer directories without recursing" ), general_box, "kcfg_TransferDirectories" );
+ (void) new QCheckBox( i18n( "Compress data during transfer" ), general_box, "kcfg_CompressData" );
+
+ QButtonGroup *links_box = new QButtonGroup( 2, QButtonGroup::Horizontal, i18n( "Links" ), copying_tab, "RsyncModeBox" );
+ links_box->setInsideSpacing( 5 );
+
+ QCheckBox *links = new QCheckBox( i18n( "Preserve symlinks" ), links_box, "kcfg_PreserveSymlinks" );
+ (void) new QCheckBox( i18n( "Transform symlinks" ), links_box, "kcfg_TransformSymlinks" );
+ (void) new QCheckBox( i18n( "Only transform unsafe symlinks" ), links_box, "kcfg_TransformUnsafeSymlinks" );
+ (void) new QCheckBox( i18n( "Ignore unsafe symlinks" ), links_box, "kcfg_IgnoreUnsafeSymlinks" );
+ (void) new QCheckBox( i18n( "Preserve hard links" ), links_box, "kcfg_PreserveHardLinks" );
+ (void) new QCheckBox( i18n( "Keep directory symlinks" ), links_box, "kcfg_KeepDirectorySymlinks" );
+
+ QButtonGroup *perm_box = new QButtonGroup( 2, QButtonGroup::Horizontal, i18n( "File Permissions, etc." ),
+ copying_tab, "RsyncPreservationBox" );
+ perm_box->setInsideSpacing( 5 );
+
+ QCheckBox *perms = new QCheckBox( i18n( "Preserve permissions" ), perm_box, "kcfg_PreservePermissions" );
+ QCheckBox *group = new QCheckBox( i18n( "Preserve group" ), perm_box, "kcfg_PreserveGroup" );
+ QCheckBox *owner = new QCheckBox( i18n( "Preserve owner" ), perm_box, "kcfg_PreserveOwner" );
+ QCheckBox *devices = new QCheckBox( i18n( "Preserve device and special files" ), perm_box, "kcfg_PreserveDevicesAndSpecials" );
+ QCheckBox *times = new QCheckBox( i18n( "Preserve times" ), perm_box, "kcfg_PreserveTimes" );
+ (void) new QCheckBox( i18n( "Omit directories when preserving times" ), perm_box, "kcfg_OmitDirectoryTimes" );
+
+ QSpacerItem *spacer1 = new QSpacerItem( 0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding );
+
+ copying_layout->addWidget( directory_box, 0, 0, 0 );
+ copying_layout->addWidget( general_box, 1, 0, 0 );
+ copying_layout->addWidget( links_box, 2, 0, 0 );
+ copying_layout->addWidget( perm_box, 3, 0, 0 );
+ copying_layout->addItem( spacer1, 4, 0 );
+
+ addTab( copying_tab, i18n( "Copying" ) );
+
+
+ //
+ // The File Deletion & Transfer tab
+ //
+ QWidget *deltrans_tab = new QWidget( this, "RsyncFileDeletion" );
+ QGridLayout *deltrans_layout = new QGridLayout( deltrans_tab );
+ deltrans_layout->setSpacing( 10 );
+
+ QButtonGroup *delete_box = new QButtonGroup( 2, QButtonGroup::Horizontal, i18n( "File Deletion" ), deltrans_tab, "RsyncDeleteBox" );
+ delete_box->setInsideSpacing( 5 );
+
+ (void) new QCheckBox( i18n( "Remove synchronized source files" ), delete_box, "kcfg_RemoveSourceFiles" );
+ (void) new QCheckBox( i18n( "Delete extraneous files" ), delete_box, "kcfg_DeleteExtraneous" );
+ (void) new QCheckBox( i18n( "Delete files before transfer" ), delete_box, "kcfg_DeleteBefore" );
+ (void) new QCheckBox( i18n( "Delete files after transfer" ), delete_box, "kcfg_DeleteAfter" );
+ (void) new QCheckBox( i18n( "Delete files during transfer" ), delete_box, "kcfg_DeleteDuring" );
+ (void) new QCheckBox( i18n( "Also delete excluded files" ), delete_box, "kcfg_DeleteExcluded" );
+ (void) new QCheckBox( i18n( "Delete even if I/O errors occur" ), delete_box, "kcfg_IgnoreErrors" );
+ (void) new QCheckBox( i18n( "Force deletion of non-void directories" ), delete_box, "kcfg_ForceDirectoryDeletion" );
+
+ QButtonGroup *delete_restrictions_box = new QButtonGroup( 2, QButtonGroup::Horizontal, i18n( "Restrictions" ), deltrans_tab, "RsyncDeleteRestrictionsBox" );
+ delete_restrictions_box->setInsideSpacing( 5 );
+
+ (void) new QCheckBox( i18n( "Don't delete more than this many files:" ), delete_restrictions_box, "kcfg_UseMaximumDelete" );
+ (void) new KIntNumInput( delete_restrictions_box, "kcfg_MaximumDeleteValue" );
+
+ QButtonGroup *transfer_box = new QButtonGroup( 2, QButtonGroup::Horizontal, i18n( "File Transfer" ),
+ deltrans_tab, "RsyncFileTransferBox" );
+ transfer_box->setInsideSpacing( 5 );
+
+ (void) new QCheckBox( i18n( "Don't transfer any file smaller than:" ), transfer_box, "kcfg_UseMinimalTransferSize" );
+ KIntNumInput *min_size = new KIntNumInput( transfer_box, "kcfg_MinimalTransferSize" );
+ min_size->setSuffix( " kB" );
+ (void) new QCheckBox( i18n( "Don't transfer any file larger than:" ), transfer_box, "kcfg_UseMaximalTransferSize" );
+ KIntNumInput *max_size = new KIntNumInput( transfer_box, "kcfg_MaximalTransferSize" );
+ max_size->setSuffix( " kB" );
+ (void) new QCheckBox( i18n( "Keep partially transferred files" ), transfer_box, "kcfg_KeepPartial" );
+ transfer_box->addSpace( 0 );
+ (void) new QCheckBox( i18n( "Put a partially transferred file into:" ), transfer_box, "kcfg_UsePartialDirectory" );
+ KURLRequester *partial_dir = new KURLRequester( transfer_box, "kcfg_PartialDirectory" );
+ partial_dir->setMode( KFile::Directory | KFile::LocalOnly );
+
+ QSpacerItem *spacer2 = new QSpacerItem( 0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding );
+
+ deltrans_layout->addWidget( delete_box, 0, 0, 0 );
+ deltrans_layout->addWidget( delete_restrictions_box, 1, 0, 0 );
+ deltrans_layout->addWidget( transfer_box, 2, 0, 0 );
+ deltrans_layout->addItem( spacer2, 3, 0 );
+
+ addTab( deltrans_tab, i18n( "File Deletion && Transfer" ) );
+
+
+ //
+ // The Filter tab
+ //
+ QWidget *filter_tab = new QWidget( this, "RsyncFiltering" );
+ QGridLayout *filter_layout = new QGridLayout( filter_tab );
+ filter_layout->setSpacing( 10 );
+
+ QButtonGroup *general_filter_box = new QButtonGroup( 2, QButtonGroup::Horizontal, i18n( "General" ),
+ filter_tab, "RsyncGeneralFilterBox" );
+ general_filter_box->setInsideSpacing( 5 );
+
+ (void) new QCheckBox( i18n( "Auto-ignore files in the same way CVS does" ), general_filter_box, "kcfg_UseCVSExclude" );
+ general_filter_box->addSpace( 0 );
+ (void) new QCheckBox( i18n( "Exclude files matching this pattern:" ), general_filter_box, "kcfg_UseExcludePattern" );
+ (void) new KLineEdit( general_filter_box, "kcfg_ExcludePattern" );
+ (void) new QCheckBox( i18n( "Read exclude patterns from:" ), general_filter_box, "kcfg_UseExcludeFrom" );
+ KURLRequester *exclude_from = new KURLRequester( general_filter_box, "kcfg_ExcludeFrom" );
+ exclude_from->setMode( KFile::File | KFile::LocalOnly );
+ (void) new QCheckBox( i18n( "Don't exclude files matching this pattern:" ), general_filter_box, "kcfg_UseIncludePattern" );
+ (void) new KLineEdit( general_filter_box, "kcfg_IncludePattern" );
+ (void) new QCheckBox( i18n( "Read include patterns from:" ), general_filter_box, "kcfg_UseIncludeFrom" );
+ KURLRequester *include_from = new KURLRequester( general_filter_box, "kcfg_IncludeFrom" );
+ include_from->setMode( KFile::File | KFile::LocalOnly );
+
+ QButtonGroup *filter_rules_box = new QButtonGroup( 1, QGroupBox::Horizontal, i18n( "Filter Rules" ),
+ filter_tab, "RsyncFilterRulesBox" );
+ filter_rules_box->setInsideSpacing( 5 );
+ QLabel *filter_rules_label = new QLabel( i18n( "The rules defined below will be added to the \"rsync\" command as they are. Thus, you have to start with the --filter=... argument." ), filter_rules_box );
+ filter_rules_label->setTextFormat( Qt::RichText );
+ (void) new KLineEdit( filter_rules_box, "kcfg_CustomFilteringRules" );
+ (void) new QLabel( i18n( "Special filter rules:" ), filter_rules_box );
+ QCheckBox *f_filter = new QCheckBox( i18n( "Use --filter='dir-merge /.rsync-filter' filter rule" ), filter_rules_box, "kcfg_UseFFilterRule" );
+ QCheckBox *ff_filter = new QCheckBox( i18n( "Use --filter='exclude .rsync-filter' filter rule" ), filter_rules_box, "kcfg_UseFFFilterRule" );
+
+ QSpacerItem *spacer3 = new QSpacerItem( 0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding );
+
+ filter_layout->addWidget( general_filter_box, 0, 0, 0 );
+ filter_layout->addWidget( filter_rules_box, 1, 0, 0 );
+ filter_layout->addItem( spacer3, 2, 0 );
+
+ addTab( filter_tab, i18n( "Filtering" ) );
+
+
+ //
+ // The Advanced tab
+ //
+ QWidget *advanced_tab = new QWidget( this, "RsyncAdvanced" );
+ QGridLayout *advanced_layout = new QGridLayout( advanced_tab );
+ advanced_layout->setSpacing( 10 );
+
+ QButtonGroup *misc_box = new QButtonGroup( 2, QButtonGroup::Horizontal, i18n( "General" ),
+ advanced_tab, "RsyncAdvancedMiscBox" );
+ misc_box->setInsideSpacing( 5 );
+
+ (void) new QCheckBox( i18n( "Handle sparse files efficiently" ), misc_box, "kcfg_EfficientSparseFileHandling" );
+ (void) new QCheckBox( i18n( "Copy files whole (no rsync algorithm)" ), misc_box, "kcfg_CopyFilesWhole" );
+ (void) new QCheckBox( i18n( "Don't cross file system boundaries" ), misc_box, "kcfg_OneFileSystem" );
+ (void) new QCheckBox( i18n( "Only update files that already exist" ), misc_box, "kcfg_UpdateExisting" );
+ (void) new QCheckBox( i18n( "Ignore files that already exist" ), misc_box, "kcfg_IgnoreExisting" );
+ (void) new QCheckBox( i18n( "Delay updates until the end of transfer" ), misc_box, "kcfg_DelayUpdates" );
+
+ QButtonGroup *backup_box = new QButtonGroup( 2, QButtonGroup::Horizontal, i18n( "Backup" ), advanced_tab, "RsyncBackupBox" );
+ backup_box->setInsideSpacing( 5 );
+
+ QCheckBox *backup = new QCheckBox( i18n( "Make backups" ), backup_box, "kcfg_MakeBackups" );
+ backup_box->addSpace( 0 );
+ (void) new QCheckBox( i18n( "Backup suffix:" ), backup_box, "kcfg_UseBackupSuffix" );
+ (void) new KLineEdit( backup_box, "kcfg_BackupSuffix" );
+ (void) new QCheckBox( i18n( "Backup directory:" ), backup_box, "kcfg_UseBackupDirectory" );
+ KURLRequester *backup_dir = new KURLRequester( backup_box, "kcfg_BackupDirectory" );
+ backup_dir->setMode( KFile::Directory | KFile::LocalOnly );
+
+ QButtonGroup *checksum_box = new QButtonGroup( 2, QButtonGroup::Horizontal, i18n( "Checksums" ), advanced_tab, "RsyncChecksumsBox" );
+ checksum_box->setInsideSpacing( 5 );
+
+ (void) new QCheckBox( i18n( "Force fixed checksum block size:" ), checksum_box, "kcfg_UseBlockSize" );
+ (void) new KIntNumInput( checksum_box, "kcfg_BlockSize" );
+ (void) new QCheckBox( i18n( "Set block/file checksum seed:" ), checksum_box, "kcfg_UseChecksumSeed" );
+ (void) new KIntNumInput( checksum_box, "kcfg_ChecksumSeed" );
+ (void) new QCheckBox( i18n( "Skip files based on checksum" ), checksum_box, "kcfg_UseChecksum" );
+ checksum_box->addSpace( 0 );
+
+ QSpacerItem *spacer4 = new QSpacerItem( 0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding );
+
+ advanced_layout->addWidget( misc_box, 0, 0, 0 );
+ advanced_layout->addWidget( backup_box, 1, 0, 0 );
+ advanced_layout->addWidget( checksum_box, 2, 0, 0 );
+ advanced_layout->addItem( spacer4, 3, 0 );
+
+ addTab( advanced_tab, i18n( "Advanced" ) );
+
+ connect( archive_mode, SIGNAL( toggled( bool ) ),
+ this, SLOT( slotArchiveToggled( bool ) ) );
+
+ connect( recursive, SIGNAL( toggled( bool ) ),
+ this, SLOT( slotUncheckArchive( bool ) ) );
+
+ connect( links, SIGNAL( toggled( bool ) ),
+ this, SLOT( slotUncheckArchive( bool ) ) );
+
+ connect( perms, SIGNAL( toggled( bool ) ),
+ this, SLOT( slotUncheckArchive( bool ) ) );
+
+ connect( times, SIGNAL( toggled( bool ) ),
+ this, SLOT( slotUncheckArchive( bool ) ) );
+
+ connect( group, SIGNAL( toggled( bool ) ),
+ this, SLOT( slotUncheckArchive( bool ) ) );
+
+ connect( owner, SIGNAL( toggled( bool ) ),
+ this, SLOT( slotUncheckArchive( bool ) ) );
+
+ connect( devices, SIGNAL( toggled( bool ) ),
+ this, SLOT( slotUncheckArchive( bool ) ) );
+
+ connect( backup, SIGNAL( toggled( bool ) ),
+ this, SLOT( slotBackupToggled( bool ) ) );
+
+ connect( f_filter, SIGNAL( toggled( bool ) ),
+ this, SLOT( slotFShortcutToggled( bool ) ) );
+
+ connect( ff_filter, SIGNAL( toggled( bool ) ),
+ this, SLOT( slotFFShortcutToggled( bool ) ) );
+
+ slotArchiveToggled( true );
+ slotBackupToggled( false );
+}
+
+
+Smb4KRsyncOptions::~Smb4KRsyncOptions()
+{
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// SLOT IMPLEMENTATIONS
+/////////////////////////////////////////////////////////////////////////////
+
+void Smb4KRsyncOptions::slotArchiveToggled( bool on )
+{
+ if ( on )
+ {
+ static_cast<QCheckBox *>( child( "kcfg_RecurseIntoDirectories", "QCheckBox", true ) )->setChecked( on );
+ static_cast<QCheckBox *>( child( "kcfg_PreserveSymlinks", "QCheckBox", true ) )->setChecked( on );
+ static_cast<QCheckBox *>( child( "kcfg_PreservePermissions", "QCheckBox", true ) )->setChecked( on );
+ static_cast<QCheckBox *>( child( "kcfg_PreserveTimes", "QCheckBox", true ) )->setChecked( on );
+ static_cast<QCheckBox *>( child( "kcfg_PreserveGroup", "QCheckBox", true ) )->setChecked( on );
+ static_cast<QCheckBox *>( child( "kcfg_PreserveOwner", "QCheckBox", true ) )->setChecked( on );
+ static_cast<QCheckBox *>( child( "kcfg_PreserveDevicesAndSpecials", "QCheckBox", true ) )->setChecked( on );
+ }
+}
+
+
+void Smb4KRsyncOptions::slotUncheckArchive( bool on )
+{
+ if ( !on )
+ {
+ static_cast<QCheckBox *>( child( "kcfg_ArchiveMode", "QCheckBox", true ) )->setChecked( on );
+ }
+}
+
+
+void Smb4KRsyncOptions::slotBackupToggled( bool on )
+{
+ static_cast<QCheckBox *>( child( "kcfg_UseBackupDirectory", "QCheckBox", true ) )->setEnabled( on );
+ static_cast<KURLRequester *>( child( "kcfg_BackupDirectory", "KURLRequester", true ) )->setEnabled( on );
+ static_cast<QCheckBox *>( child( "kcfg_UseBackupSuffix", "QCheckBox", true ) )->setEnabled( on );
+ static_cast<KLineEdit *>( child( "kcfg_BackupSuffix", "KLineEdit", true ) )->setEnabled( on );
+}
+
+
+void Smb4KRsyncOptions::slotFShortcutToggled( bool on )
+{
+ QCheckBox *ff_filter = static_cast<QCheckBox *>( child( "kcfg_UseFFFilterRule", "QCheckBox", true ) );
+
+ if ( on && ff_filter->isChecked() )
+ {
+ ff_filter->setChecked( false );
+ }
+}
+
+
+void Smb4KRsyncOptions::slotFFShortcutToggled( bool on )
+{
+ QCheckBox *f_filter = static_cast<QCheckBox *>( child( "kcfg_UseFFilterRule", "QCheckBox", true ) );
+
+ if ( on && f_filter->isChecked() )
+ {
+ f_filter->setChecked( false );
+ }
+}
+
+#include "smb4krsyncoptions.moc"
diff --git a/smb4k/configdlg/smb4krsyncoptions.h b/smb4k/configdlg/smb4krsyncoptions.h
new file mode 100644
index 0000000..3559182
--- /dev/null
+++ b/smb4k/configdlg/smb4krsyncoptions.h
@@ -0,0 +1,108 @@
+/***************************************************************************
+ smb4krsyncoptions - The configuration page for the rsync options
+ -------------------
+ begin : So Nov 20 2005
+ copyright : (C) 2005-2007 by Alexander Reinholdt
+ email : dustpuppy@users.berlios.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef SMB4KRSYNCOPTIONS_H
+#define SMB4KRSYNCOPTIONS_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// Qt includes
+#include <qtabwidget.h>
+
+
+/**
+ * This class belongs to the configuration dialog and takes
+ * care of the options that can be defined for rsync.
+ *
+ * @author Alexander Reinholdt <dustpuppy@users.berlios.de>
+ */
+
+class Smb4KRsyncOptions : public QTabWidget
+{
+ Q_OBJECT
+
+ public:
+ /**
+ * The constructor.
+ *
+ * @param parent The parent widget
+ *
+ * @param name The name of this widget
+ */
+ Smb4KRsyncOptions( QWidget *parent = 0, const char *name = 0 );
+
+ /**
+ * The destructor
+ */
+ ~Smb4KRsyncOptions();
+
+ protected slots:
+ /**
+ * This slot is invoked if the "Archive mode" checkbox has been
+ * toggled.
+ *
+ * @param on Is TRUE if the checkbox is checked and FALSE otherwise.
+ */
+ void slotArchiveToggled( bool on );
+
+ /**
+ * This slot is invoked if the --archive option has to be switched
+ * off.
+ *
+ * @param on Is FALSE if one of the connected checkboxes is unchecked
+ * and TRUE otherwise.
+ */
+ void slotUncheckArchive( bool on );
+
+ /**
+ * This slot is called, when the backup checkbox has been toggled.
+ * It enables/disables all other backup options according to the
+ * state the backup button is in.
+ *
+ * @param on Is TRUE if the m_backup check box has been
+ * checked and FALSE otherwise.
+ */
+ void slotBackupToggled( bool on );
+
+ /**
+ * This slot is called if the '-F' shortcut has been toggled.
+ * It unchecks the '-F -F' shortcut.
+ *
+ * @param on Is TRUE is m_f_filter is checked and FALSE otherwise.
+ */
+ void slotFShortcutToggled( bool on );
+
+ /**
+ * This slot is called if the '-F -F' shortcut has been toggled.
+ * It unchecks the '-F' shortcut.
+ *
+ * @param on Is TRUE is m_ff_filter is checked and FALSE otherwise.
+ */
+ void slotFFShortcutToggled( bool on );
+};
+
+#endif
diff --git a/smb4k/configdlg/smb4ksambaoptions.cpp b/smb4k/configdlg/smb4ksambaoptions.cpp
new file mode 100644
index 0000000..ab57b25
--- /dev/null
+++ b/smb4k/configdlg/smb4ksambaoptions.cpp
@@ -0,0 +1,1230 @@
+/***************************************************************************
+ smb4ksambaoptions.cpp - This is the configuration page for the
+ Samba settings of Smb4K
+ -------------------
+ begin : Mo Jan 26 2004
+ copyright : (C) 2004-2007 by Alexander Reinholdt
+ email : dustpuppy@users.berlios.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+// Qt includes
+#include <qlayout.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qcheckbox.h>
+#include <qbuttongroup.h>
+#include <qradiobutton.h>
+#include <qmap.h>
+
+// KDE includes
+#include <klocale.h>
+#include <klineedit.h>
+#include <knuminput.h>
+#include <kcombobox.h>
+#include <kuser.h>
+#include <klistview.h>
+#include <kpushbutton.h>
+
+// System includes
+#include <unistd.h>
+#include <sys/types.h>
+
+// application specific includes
+#include "smb4ksambaoptions.h"
+#include "../core/smb4kglobal.h"
+#include "../core/smb4ksettings.h"
+
+using namespace Smb4KGlobal;
+
+
+Smb4KSambaOptions::Smb4KSambaOptions( QWidget *parent, const char *name )
+: QTabWidget( parent, name )
+{
+ setMargin( 10 );
+
+ //
+ // General options
+ //
+ QWidget *general_tab = new QWidget( this, "GeneralSambaOptions" );
+ QGridLayout *general_layout = new QGridLayout( general_tab );
+ general_layout->setSpacing( 10 );
+
+ QGroupBox *general_options = new QGroupBox( 2, Qt::Horizontal,
+ i18n( "General Options" ), general_tab );
+ general_options->setInsideSpacing( 5 );
+
+ (void) new QLabel( i18n( "NetBIOS name:"), general_options );
+ (void) new KLineEdit( general_options, "kcfg_NetBIOSName" );
+
+ (void) new QLabel( i18n( "Domain:" ), general_options );
+ (void) new KLineEdit( general_options, "kcfg_DomainName" );
+
+ (void) new QLabel( i18n( "Socket options:" ), general_options );
+ (void) new KLineEdit( general_options, "kcfg_SocketOptions" );
+
+ (void) new QLabel( i18n( "NetBIOS scope:" ), general_options );
+ (void) new KLineEdit( general_options, "kcfg_NetBIOSScope" );
+
+ (void) new QLabel( i18n( "Remote SMB port:" ), general_options );
+ (void) new KIntNumInput( general_options, "kcfg_RemotePort" );
+
+ QGroupBox *authentication = new QGroupBox( 1, Qt::Horizontal,
+ i18n( "Authentication" ), general_tab );
+
+ (void) new QCheckBox( i18n( "Try to authenticate with Kerberos" ), authentication, "kcfg_UseKerberos" );
+ (void) new QCheckBox( i18n( "Authenticate as machine account" ), authentication, "kcfg_MachineAccount" );
+
+ QSpacerItem *spacer1 = new QSpacerItem( 0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding );
+
+ general_layout->addWidget( general_options, 0, 0, 0 );
+ general_layout->addWidget( authentication, 1, 0, 0 );
+ general_layout->addItem( spacer1, 2, 0 );
+
+ addTab( general_tab, i18n( "General Settings" ) );
+
+ //
+ // Options for the mount commands
+ //
+ QWidget *mount_tab = new QWidget( this, "MountOptions" );
+ QGridLayout *mount_layout = new QGridLayout( mount_tab );
+ mount_layout->setSpacing( 10 );
+
+ QGroupBox *filesystem_box = new QGroupBox( 1, Qt::Horizontal,
+ i18n( "File System" ), mount_tab );
+
+#ifndef __FreeBSD__
+ KComboBox *filesystem = new KComboBox( filesystem_box, "kcfg_Filesystem" );
+ filesystem->insertItem( "CIFS", Smb4KSettings::EnumFilesystem::CIFS );
+ filesystem->insertItem( "SMBFS", Smb4KSettings::EnumFilesystem::SMBFS );
+#else
+ (void) new QLabel( "SMBFS", filesystem_box );
+#endif
+
+ QLabel *note = new QLabel( i18n( "NOTE: You might need to enable support for either \"super\" or \"sudo\" in the Super User page." ), filesystem_box );
+ note->setTextFormat( Qt::RichText );
+
+ QGroupBox *user_group_box = new QGroupBox( 2, Qt::Horizontal,
+ i18n( "User and Group" ), mount_tab );
+ user_group_box->setInsideSpacing( 5 );
+
+ (void) new QLabel( i18n( "User ID:" ), user_group_box );
+ KLineEdit *user_id = new KLineEdit( user_group_box, "kcfg_UserID" );
+ user_id->setAlignment( Qt::AlignRight );
+
+ (void) new QLabel( i18n( "Group ID:" ), user_group_box );
+ KLineEdit *group_id = new KLineEdit( user_group_box, "kcfg_GroupID" );
+ group_id->setAlignment( Qt::AlignRight );
+
+ QGroupBox *charset_box = new QGroupBox( 2, Qt::Horizontal,
+ i18n( "Charset and Codepage" ), mount_tab );
+ charset_box->setInsideSpacing( 5 );
+
+ (void) new QLabel( i18n( "Client charset:" ), charset_box );
+ KComboBox *charset = new KComboBox( charset_box, "kcfg_ClientCharset" );
+ charset->insertItem( i18n( "default" ), Smb4KSettings::EnumClientCharset::default_charset );
+ charset->insertItem( "iso8859-1", Smb4KSettings::EnumClientCharset::iso8859_1 );
+ charset->insertItem( "iso8859-2", Smb4KSettings::EnumClientCharset::iso8859_2 );
+ charset->insertItem( "iso8859-3", Smb4KSettings::EnumClientCharset::iso8859_3 );
+ charset->insertItem( "iso8859-4", Smb4KSettings::EnumClientCharset::iso8859_4 );
+ charset->insertItem( "iso8859-5", Smb4KSettings::EnumClientCharset::iso8859_5 );
+ charset->insertItem( "iso8859-6", Smb4KSettings::EnumClientCharset::iso8859_6 );
+ charset->insertItem( "iso8859-7", Smb4KSettings::EnumClientCharset::iso8859_7 );
+ charset->insertItem( "iso8859-8", Smb4KSettings::EnumClientCharset::iso8859_8 );
+ charset->insertItem( "iso8859-9", Smb4KSettings::EnumClientCharset::iso8859_9 );
+ charset->insertItem( "iso8859-13", Smb4KSettings::EnumClientCharset::iso8859_13 );
+ charset->insertItem( "iso8859-14", Smb4KSettings::EnumClientCharset::iso8859_14 );
+ charset->insertItem( "iso8859-15", Smb4KSettings::EnumClientCharset::iso8859_15 );
+ charset->insertItem( "utf8", Smb4KSettings::EnumClientCharset::utf8 );
+ charset->insertItem( "koi8-r", Smb4KSettings::EnumClientCharset::koi8_r );
+ charset->insertItem( "koi8-u", Smb4KSettings::EnumClientCharset::koi8_u );
+ charset->insertItem( "koi8-ru", Smb4KSettings::EnumClientCharset::koi8_ru );
+ charset->insertItem( "cp1251", Smb4KSettings::EnumClientCharset::cp1251 );
+ charset->insertItem( "gb2312", Smb4KSettings::EnumClientCharset::gb2312 );
+ charset->insertItem( "big5", Smb4KSettings::EnumClientCharset::big5 );
+ charset->insertItem( "euc-jp", Smb4KSettings::EnumClientCharset::euc_jp );
+ charset->insertItem( "euc-kr", Smb4KSettings::EnumClientCharset::euc_kr );
+ charset->insertItem( "tis-620", Smb4KSettings::EnumClientCharset::tis_620 );
+
+ (void) new QLabel( i18n( "Server codepage:" ), charset_box, "CodepageLabel" );
+ KComboBox *codepage = new KComboBox( charset_box, "kcfg_ServerCodepage" );
+ codepage->insertItem( i18n( "default" ), Smb4KSettings::EnumServerCodepage::default_codepage );
+ codepage->insertItem( "cp437", Smb4KSettings::EnumServerCodepage::cp437 );
+ codepage->insertItem( "cp720", Smb4KSettings::EnumServerCodepage::cp720 );
+ codepage->insertItem( "cp737", Smb4KSettings::EnumServerCodepage::cp737 );
+ codepage->insertItem( "cp775", Smb4KSettings::EnumServerCodepage::cp775 );
+ codepage->insertItem( "cp850", Smb4KSettings::EnumServerCodepage::cp850 );
+ codepage->insertItem( "cp852", Smb4KSettings::EnumServerCodepage::cp852 );
+ codepage->insertItem( "cp855", Smb4KSettings::EnumServerCodepage::cp855 );
+ codepage->insertItem( "cp857", Smb4KSettings::EnumServerCodepage::cp857 );
+ codepage->insertItem( "cp858", Smb4KSettings::EnumServerCodepage::cp858 );
+ codepage->insertItem( "cp860", Smb4KSettings::EnumServerCodepage::cp860 );
+ codepage->insertItem( "cp861", Smb4KSettings::EnumServerCodepage::cp861 );
+ codepage->insertItem( "cp862", Smb4KSettings::EnumServerCodepage::cp862 );
+ codepage->insertItem( "cp863", Smb4KSettings::EnumServerCodepage::cp863 );
+ codepage->insertItem( "cp864", Smb4KSettings::EnumServerCodepage::cp864 );
+ codepage->insertItem( "cp865", Smb4KSettings::EnumServerCodepage::cp865 );
+ codepage->insertItem( "cp866", Smb4KSettings::EnumServerCodepage::cp866 );
+ codepage->insertItem( "cp869", Smb4KSettings::EnumServerCodepage::cp869 );
+ codepage->insertItem( "cp874", Smb4KSettings::EnumServerCodepage::cp874 );
+ codepage->insertItem( "cp932", Smb4KSettings::EnumServerCodepage::cp932 );
+ codepage->insertItem( "cp936", Smb4KSettings::EnumServerCodepage::cp936 );
+ codepage->insertItem( "cp949", Smb4KSettings::EnumServerCodepage::cp949 );
+ codepage->insertItem( "cp950", Smb4KSettings::EnumServerCodepage::cp950 );
+ codepage->insertItem( "cp1250", Smb4KSettings::EnumServerCodepage::cp1250 );
+ codepage->insertItem( "cp1251", Smb4KSettings::EnumServerCodepage::cp1251 );
+ codepage->insertItem( "cp1252", Smb4KSettings::EnumServerCodepage::cp1252 );
+ codepage->insertItem( "cp1253", Smb4KSettings::EnumServerCodepage::cp1253 );
+ codepage->insertItem( "cp1254", Smb4KSettings::EnumServerCodepage::cp1254 );
+ codepage->insertItem( "cp1255", Smb4KSettings::EnumServerCodepage::cp1255 );
+ codepage->insertItem( "cp1256", Smb4KSettings::EnumServerCodepage::cp1256 );
+ codepage->insertItem( "cp1257", Smb4KSettings::EnumServerCodepage::cp1257 );
+ codepage->insertItem( "cp1258", Smb4KSettings::EnumServerCodepage::cp1258 );
+ codepage->insertItem( "unicode", Smb4KSettings::EnumServerCodepage::unicode );
+
+ QGroupBox *perms_box = new QGroupBox( 2, Qt::Horizontal,
+ i18n( "Permissions" ), mount_tab );
+ perms_box->setInsideSpacing( 5 );
+
+ (void) new QLabel( i18n( "File mask:" ), perms_box );
+ KLineEdit *fmask = new KLineEdit( perms_box, "kcfg_FileMask" );
+ fmask->setAlignment( Qt::AlignRight );
+
+ (void) new QLabel( i18n( "Directory mask:" ), perms_box );
+ KLineEdit *dmask = new KLineEdit( perms_box, "kcfg_DirectoryMask" );
+ dmask->setAlignment( Qt::AlignRight );
+
+ (void) new QLabel( i18n( "Write access:" ), perms_box );
+ KComboBox *read_mode = new KComboBox( perms_box, "kcfg_WriteAccess" );
+ read_mode->insertItem( i18n( "read-write" ), Smb4KSettings::EnumWriteAccess::ReadWrite );
+ read_mode->insertItem( i18n( "read-only" ), Smb4KSettings::EnumWriteAccess::ReadOnly );
+
+#ifndef __FreeBSD__
+ QGroupBox *advanced_cifs = new QGroupBox( 1, Qt::Horizontal,
+ i18n( "Advanced CIFS Options" ), mount_tab, "AdvancedCIFSOptions" );
+ advanced_cifs->setInsideSpacing( 5 );
+
+ QWidget *c_advanced_widget = new QWidget( advanced_cifs );
+ QGridLayout *c_advanced_layout = new QGridLayout( c_advanced_widget );
+ c_advanced_layout->setSpacing( 5 );
+ c_advanced_layout->setMargin( 0 );
+ c_advanced_layout->addWidget( new QCheckBox( i18n( "Do permission checks" ),
+ c_advanced_widget, "kcfg_PermissionChecks" ), 0, 0, 0 );
+ c_advanced_layout->addWidget( new QCheckBox( i18n( "Attempt to set UID and GID" ),
+ c_advanced_widget, "kcfg_ClientControlsIDs" ), 0, 1, 0 );
+ c_advanced_layout->addWidget( new QCheckBox( i18n( "Use server inode numbers" ),
+ c_advanced_widget, "kcfg_ServerInodeNumbers" ), 1, 0, 0 );
+ c_advanced_layout->addWidget( new QCheckBox( i18n( "Do not cache inode data" ),
+ c_advanced_widget, "kcfg_InodeDataCaching" ), 1, 1, 0 );
+ c_advanced_layout->addWidget( new QCheckBox( i18n( "Translate reserved characters" ),
+ c_advanced_widget, "kcfg_TranslateReservedChars" ), 2, 0, 0 );
+ c_advanced_layout->addWidget( new QCheckBox( i18n( "Do not use locking" ),
+ c_advanced_widget, "kcfg_NoLocking" ), 2, 1, 0 );
+
+ QWidget *c_extra_widget = new QWidget( advanced_cifs );
+ QGridLayout *c_extra_layout = new QGridLayout( c_extra_widget );
+ c_extra_layout->setSpacing( 5 );
+ c_extra_layout->setMargin( 0 );
+ c_extra_layout->addWidget( new QLabel( i18n( "Additional options:" ), c_extra_widget ), 0, 0, 0 );
+ c_extra_layout->addWidget( new KLineEdit( c_extra_widget, "kcfg_CustomCIFSOptions" ), 0, 1, 0 );
+
+ QGroupBox *advanced_smbfs = new QGroupBox( 1, Qt::Horizontal,
+ i18n( "Advanced SMBFS Options" ), mount_tab, "AdvancedSMBFSOptions" );
+ advanced_smbfs->setInsideSpacing( 5 );
+
+ (void) new QCheckBox( i18n( "Use Unicode when communicating with the server" ), advanced_smbfs, "kcfg_UnicodeSupport" );
+ (void) new QCheckBox( i18n( "Use large file support" ), advanced_smbfs, "kcfg_LargeFileSystemSupport" );
+
+ QWidget *s_advanced_widget = new QWidget( advanced_smbfs );
+ QGridLayout *s_advanced_layout = new QGridLayout( s_advanced_widget );
+ s_advanced_layout->setSpacing( 5 );
+ s_advanced_layout->setMargin( 0 );
+ s_advanced_layout->addWidget( new QLabel( i18n( "Caching time of directory listings:" ), s_advanced_widget ), 0, 0, 0 );
+ KIntNumInput *ttl = new KIntNumInput( s_advanced_widget, "kcfg_CachingTime" );
+ ttl->setSuffix( " ms" );
+ s_advanced_layout->addWidget( ttl, 0, 1, 0 );
+
+#endif
+
+ QSpacerItem *spacer2 = new QSpacerItem( 0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding );
+
+ mount_layout->addMultiCellWidget( filesystem_box, 0, 0, 0, 1, 0 );
+ mount_layout->addMultiCellWidget( perms_box, 0, 0, 2, 3, 0 );
+ mount_layout->addMultiCellWidget( charset_box, 1, 1, 0, 1, 0 );
+ mount_layout->addMultiCellWidget( user_group_box, 1, 1, 2, 3, 0 );
+#ifndef __FreeBSD__
+ mount_layout->addMultiCellWidget( advanced_cifs, 2, 2, 0, 3, 0 );
+ mount_layout->addMultiCellWidget( advanced_smbfs, 3, 3, 0, 3, 0 );
+ mount_layout->addMultiCell( spacer2, 4, 4, 0, 3, 0 );
+#else
+ mount_layout->addMultiCell( spacer2, 2, 2, 0, 3, 0 );
+#endif
+
+ addTab( mount_tab, "mount" );
+
+ //
+ // Options for the 'net' command
+ //
+ QWidget *net_tab = new QWidget( this, "NetOptions" );
+ QGridLayout *net_layout = new QGridLayout( net_tab );
+ net_layout->setSpacing( 10 );
+
+ QButtonGroup *protocol_hint = new QButtonGroup( 1, Qt::Horizontal,
+ i18n( "Protocol Hint" ), net_tab, "kcfg_ProtocolHint" );
+
+ protocol_hint->insert( new QRadioButton( i18n( "Automatic detection" ), protocol_hint ),
+ Smb4KSettings::EnumProtocolHint::Automatic );
+ protocol_hint->insert( new QRadioButton( i18n( "RPC: Modern operating systems" ), protocol_hint ),
+ Smb4KSettings::EnumProtocolHint::RPC );
+ protocol_hint->insert( new QRadioButton( i18n( "RAP: Older operating systems" ), protocol_hint ),
+ Smb4KSettings::EnumProtocolHint::RAP );
+ protocol_hint->insert( new QRadioButton( i18n( "ADS: Active Directory environment (LDAP/Kerberos)" ), protocol_hint ),
+ Smb4KSettings::EnumProtocolHint::ADS );
+
+ QSpacerItem *spacer3 = new QSpacerItem( 0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding );
+
+ net_layout->addWidget( protocol_hint, 0, 0, 0 );
+ net_layout->addItem( spacer3, 1, 0 );
+
+ addTab( net_tab, "net" );
+
+ //
+ // Options for the 'smbclient' command
+ //
+ QWidget *smbclient_tab = new QWidget( this, "SmbclientOptions" );
+ QGridLayout *smbclient_layout = new QGridLayout( smbclient_tab );
+ smbclient_layout->setSpacing( 10 );
+
+ QGroupBox *smbclient_misc = new QGroupBox( 2, Qt::Horizontal, i18n( "Miscellaneous" ),
+ smbclient_tab, "SmbclientMiscellaneous" );
+ smbclient_misc->setInsideSpacing( 5 );
+
+ (void) new QLabel( i18n( "Name resolve order:" ), smbclient_misc );
+ (void) new KLineEdit( smbclient_misc, "kcfg_NameResolveOrder" );
+
+ (void) new QLabel( i18n( "Buffer size:" ), smbclient_misc );
+ KIntNumInput *buffer_size = new KIntNumInput( smbclient_misc, "kcfg_BufferSize" );
+ buffer_size->setSuffix( i18n( " Bytes" ) );
+
+ (void) new QLabel( i18n( "Signing state:" ), smbclient_misc );
+ KComboBox *signing_state = new KComboBox( smbclient_misc, "kcfg_SigningState" );
+ signing_state->insertItem( i18n( "none" ), Smb4KSettings::EnumSigningState::None );
+ signing_state->insertItem( i18n( "on" ), Smb4KSettings::EnumSigningState::On );
+ signing_state->insertItem( i18n( "off" ), Smb4KSettings::EnumSigningState::Off );
+ signing_state->insertItem( i18n( "required" ), Smb4KSettings::EnumSigningState::Required );
+
+ QSpacerItem *spacer4 = new QSpacerItem( 0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding );
+
+ smbclient_layout->addWidget( smbclient_misc, 0, 0, 0 );
+ smbclient_layout->addItem( spacer4, 1, 0 );
+
+ addTab( smbclient_tab, "smbclient" );
+
+ //
+ // Options for the 'nmblookup' command
+ //
+ QWidget *nmblookup_tab = new QWidget( this, "NmblookupOptions" );
+ QGridLayout *nmblookup_layout = new QGridLayout( nmblookup_tab );
+ nmblookup_layout->setSpacing( 10 );
+
+ QGroupBox *nmblookup_misc = new QGroupBox( 1, Qt::Horizontal,
+ i18n( "Miscellaneous" ), nmblookup_tab );
+ nmblookup_misc->setInsideSpacing( 5 );
+
+ QWidget *broadcast_widget = new QWidget( nmblookup_misc );
+ QGridLayout *broadcast_layout = new QGridLayout( broadcast_widget );
+ broadcast_layout->setSpacing( 5 );
+ broadcast_layout->setMargin( 0 );
+ broadcast_layout->addWidget( new QLabel( i18n( "Broadcast address:" ), broadcast_widget ), 0, 0, 0 );
+ broadcast_layout->addWidget( new KLineEdit( broadcast_widget, "kcfg_BroadcastAddress" ), 0, 1, 0 );
+
+ (void) new QCheckBox( i18n( "Try and bind to UDP port 137 to send and receive UDP datagrams" ), nmblookup_misc, "kcfg_UsePort137" );
+
+ QSpacerItem *spacer5 = new QSpacerItem( 0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding );
+
+ nmblookup_layout->addWidget( nmblookup_misc, 0, 0, 0 );
+ nmblookup_layout->addItem( spacer5, 1, 0 );
+
+ addTab( nmblookup_tab, "nmblookup" );
+
+
+ //
+ // Custom options
+ //
+ QWidget *custom_tab = new QWidget( this, "CustomOptions" );
+ QGridLayout *custom_layout = new QGridLayout( custom_tab );
+ custom_layout->setSpacing( 10 );
+
+
+ // FIXME: Set "What's this' texts!!!
+
+ KListView *custom_options = new KListView( custom_tab, "CustomOptionsList" );
+// custom_options->setAllColumnsShowFocus( true );
+ custom_options->setSelectionMode( QListView::Single );
+ custom_options->setVScrollBarMode( KListView::Auto );
+ custom_options->addColumn( i18n( "Item" ), -1 );
+ custom_options->addColumn( i18n( "Protocol" ), -1 );
+#ifndef __FreeBSD__
+ custom_options->addColumn( i18n( "File System" ), -1 );
+ custom_options->addColumn( i18n( "Write Access" ), -1 );
+#endif
+ custom_options->addColumn( i18n( "Kerberos" ), -1 );
+ custom_options->addColumn( i18n( "UID" ), -1 );
+ custom_options->addColumn( i18n( "GID" ), -1 );
+ custom_options->addColumn( i18n( "Port" ), -1 );
+
+ QWidget *custom_input = new QWidget( custom_tab, "CustomInputWidget" );
+ QGridLayout *custom_input_layout = new QGridLayout( custom_input );
+ custom_input_layout->setSpacing( 5 );
+
+ QLabel *custom_proto_label = new QLabel( i18n( "Protocol:" ), custom_input, "CustomProtocolLabel" );
+
+ KComboBox *custom_protocol = new KComboBox( custom_input, "CustomProtocol" );
+ custom_protocol->insertItem( "-", -1 );
+ custom_protocol->insertItem( i18n( "auto" ), -1 );
+ custom_protocol->insertItem( "RPC", -1 );
+ custom_protocol->insertItem( "RAP", -1 );
+ custom_protocol->insertItem( "ADS", -1 );
+
+#ifndef __FreeBSD__
+
+ QLabel *custom_fs_label = new QLabel( i18n( "File system:" ), custom_input, "CustomFileSystemLabel" );
+
+ KComboBox *custom_fs = new KComboBox( custom_input, "CustomFileSystem" );
+ custom_fs->insertItem( "-", -1 );
+ custom_fs->insertItem( "CIFS", -1 );
+ custom_fs->insertItem( "SMBFS", -1 );
+
+ QLabel *custom_rw_label = new QLabel( i18n( "Write access:" ), custom_input, "CustomWriteAccessLabel" );
+
+ KComboBox *custom_rw = new KComboBox( custom_input, "CustomWriteAccess" );
+ custom_rw->insertItem( "-", -1 );
+ custom_rw->insertItem( i18n( "read-write" ), -1 );
+ custom_rw->insertItem( i18n( "read-only" ), -1 );
+
+#endif
+
+ QLabel *custom_krb_label = new QLabel( i18n( "Kerberos:" ), custom_input, "CustomKerberosLabel" );
+
+ KComboBox *custom_krb = new KComboBox( custom_input, "CustomKerberos" );
+ custom_krb->insertItem( "-", -1 );
+ custom_krb->insertItem( i18n( "no" ), -1 );
+ custom_krb->insertItem( i18n( "yes" ), -1 );
+
+ QLabel *custom_uid_label = new QLabel( i18n( "User ID:" ), custom_input, "CustomUIDLabel" );
+
+ KLineEdit *custom_uid = new KLineEdit( custom_input, "CustomUID" );
+ custom_uid->setText( "-" );
+
+ QLabel *custom_gid_label = new QLabel( i18n( "Group ID:" ), custom_input, "CustomGIDLabel" );
+
+ KLineEdit *custom_gid = new KLineEdit( custom_input, "CustomGID" );
+ custom_gid->setText( "-" );
+
+ QLabel *custom_port_label = new QLabel( i18n( "Port:" ), custom_input, "CustomPortLabel" );
+
+ KIntNumInput *custom_port = new KIntNumInput( Smb4KSettings::remotePort(), custom_input, 10, "CustomPort" );
+ custom_port->setMinValue( 0 );
+ custom_port->setMaxValue( 65535 );
+
+ QWidget *custom_rm = new QWidget( custom_input );
+ QGridLayout *custom_rm_layout = new QGridLayout( custom_rm );
+ custom_rm_layout->setSpacing( 5 );
+
+ KPushButton *remove_custom = new KPushButton( KGuiItem( i18n( "Remove" ), "remove" ), custom_rm, "CustomRemoveItem" );
+ KPushButton *rm_all_custom = new KPushButton( KGuiItem( i18n( "Remove All" ), "editdelete" ), custom_rm, "CustomRemoveAllItems" );
+
+ QSpacerItem *spacer6 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Preferred );
+
+ custom_rm_layout->addItem( spacer6, 0, 0 );
+ custom_rm_layout->addWidget( remove_custom, 0, 1, 0 );
+ custom_rm_layout->addWidget( rm_all_custom, 0, 2, 0 );
+
+ custom_input_layout->addWidget( custom_proto_label, 0, 0, 0 );
+ custom_input_layout->addWidget( custom_protocol, 0, 1, 0 );
+#ifndef __FreeBSD__
+ custom_input_layout->addWidget( custom_fs_label, 0, 2, 0 );
+ custom_input_layout->addWidget( custom_fs, 0, 3, 0 );
+ custom_input_layout->addWidget( custom_rw_label, 1, 0, 0 );
+ custom_input_layout->addWidget( custom_rw, 1, 1, 0 );
+ custom_input_layout->addWidget( custom_krb_label, 1, 2, 0 );
+ custom_input_layout->addWidget( custom_krb, 1, 3, 0 );
+ custom_input_layout->addWidget( custom_uid_label, 2, 0, 0 );
+ custom_input_layout->addWidget( custom_uid, 2, 1, 0 );
+ custom_input_layout->addWidget( custom_gid_label, 2, 2, 0 );
+ custom_input_layout->addWidget( custom_gid, 2, 3, 0 );
+ custom_input_layout->addWidget( custom_port_label, 3, 0, 0 );
+ custom_input_layout->addWidget( custom_port, 3, 1, 0 );
+ custom_input_layout->addMultiCellWidget( custom_rm, 3, 3, 2, 3, 0 );
+#else
+ custom_input_layout->addWidget( custom_krb_label, 0, 2, 0 );
+ custom_input_layout->addWidget( custom_krb, 0, 3, 0 );
+ custom_input_layout->addWidget( custom_uid_label, 1, 0, 0 );
+ custom_input_layout->addWidget( custom_uid, 1, 1, 0 );
+ custom_input_layout->addWidget( custom_gid_label, 1, 2, 0 );
+ custom_input_layout->addWidget( custom_gid, 1, 3, 0 );
+ custom_input_layout->addWidget( custom_port_label, 2, 0, 0 );
+ custom_input_layout->addWidget( custom_port, 2, 1, 0 );
+ custom_input_layout->addMultiCellWidget( custom_rm, 2, 2, 2, 3, 0 );
+#endif
+
+ QSpacerItem *spacer7 = new QSpacerItem( 0, 0, QSizePolicy::Preferred, QSizePolicy::Minimum );
+
+ custom_layout->addWidget( custom_options, 0, 0, 0 );
+ custom_layout->addWidget( custom_input, 1, 0, 0 );
+ custom_layout->addItem( spacer7, 2, 0 );
+
+ addTab( custom_tab, i18n( "Custom" ) );
+
+ //
+ // Connections
+ //
+#ifndef __FreeBSD__
+ connect( filesystem, SIGNAL( activated( int ) ),
+ this, SLOT( slotSambaFileSystem( int ) ) );
+#endif
+
+ connect( remove_custom, SIGNAL( clicked() ),
+ this, SLOT( slotRemoveCustomOption() ) );
+
+ connect( rm_all_custom, SIGNAL( clicked() ),
+ this, SLOT( slotRemoveAllCustomOptions() ) );
+
+ connect( custom_options, SIGNAL( clicked( QListViewItem * ) ),
+ this, SLOT( slotCustomItemClicked( QListViewItem * ) ) );
+
+ connect( custom_protocol, SIGNAL( activated( int ) ),
+ this, SLOT( slotCustomProtocolChanged( int ) ) );
+
+#ifndef __FreeBSD__
+ connect( custom_fs, SIGNAL( activated( int ) ),
+ this, SLOT( slotCustomFileSystemChanged( int ) ) );
+
+ connect( custom_rw, SIGNAL( activated( int ) ),
+ this, SLOT( slotCustomWriteAccessChanged( int ) ) );
+#endif
+
+ connect( custom_krb, SIGNAL( activated( int ) ),
+ this, SLOT( slotCustomKerberosChanged( int ) ) );
+
+ connect( custom_uid, SIGNAL( textChanged( const QString & ) ),
+ this, SLOT( slotCustomUIDChanged( const QString & ) ) );
+
+ connect( custom_gid, SIGNAL( textChanged( const QString & ) ),
+ this, SLOT( slotCustomGIDChanged( const QString & ) ) );
+
+ connect( custom_port, SIGNAL( valueChanged( int ) ),
+ this, SLOT( slotCustomPortChanged( int ) ) );
+
+ //
+ // Do last things before we are ready to go
+ //
+#ifndef __FreeBSD__
+ slotSambaFileSystem( filesystem->currentItem() );
+#endif
+ slotCustomItemClicked( NULL );
+}
+
+
+Smb4KSambaOptions::~Smb4KSambaOptions()
+{
+}
+
+
+void Smb4KSambaOptions::resetCustomTab()
+{
+ slotCustomItemClicked( NULL );
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// SLOT IMPLEMENTATIONS
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __FreeBSD__
+void Smb4KSambaOptions::slotSambaFileSystem( int item_index )
+{
+ switch ( item_index )
+ {
+ case Smb4KSettings::EnumFilesystem::CIFS:
+ {
+ QGroupBox *adv_cifs = static_cast<QGroupBox *>( child( "AdvancedCIFSOptions", "QGroupBox", true ) );
+
+ if ( adv_cifs )
+ {
+ adv_cifs->setEnabled( true );
+ }
+
+ QGroupBox *adv_smbfs = static_cast<QGroupBox *>( child( "AdvancedSMBFSOptions", "QGroupBox", true ) );
+
+ if ( adv_smbfs )
+ {
+ adv_smbfs->setEnabled( false );
+ }
+
+ QLabel *codepage = static_cast<QLabel *>( child( "CodepageLabel", "QLabel", true ) );
+
+ if ( codepage )
+ {
+ codepage->setEnabled( false );
+ }
+
+ KComboBox *srv_codepage = static_cast<KComboBox *>( child( "kcfg_ServerCodepage", "KComboBox", true ) );
+
+ if ( srv_codepage )
+ {
+ srv_codepage->setEnabled( false );
+ }
+
+ break;
+ }
+ case Smb4KSettings::EnumFilesystem::SMBFS:
+ {
+ QGroupBox *adv_cifs = static_cast<QGroupBox *>( child( "AdvancedCIFSOptions", "QGroupBox", true ) );
+
+ if ( adv_cifs )
+ {
+ adv_cifs->setEnabled( false );
+ }
+
+ QGroupBox *adv_smbfs = static_cast<QGroupBox *>( child( "AdvancedSMBFSOptions", "QGroupBox", true ) );
+
+ if ( adv_smbfs )
+ {
+ adv_smbfs->setEnabled( true );
+ }
+
+ QLabel *codepage = static_cast<QLabel *>( child( "CodepageLabel", "QLabel", true ) );
+
+ if ( codepage )
+ {
+ codepage->setEnabled( true );
+ }
+
+ KComboBox *srv_codepage = static_cast<KComboBox *>( child( "kcfg_ServerCodepage", "KComboBox", true ) );
+
+ if ( srv_codepage )
+ {
+ srv_codepage->setEnabled( true );
+ }
+
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ };
+#else
+void Smb4KSambaOptions::slotSambaFileSystem( int )
+{
+#endif
+}
+
+
+void Smb4KSambaOptions::slotCustomItemClicked( QListViewItem *item )
+{
+ if ( item )
+ {
+ // Enable the input widget:
+ QWidget *input = static_cast<QGroupBox *>( child( "CustomInputWidget", "QGroupBox", true ) );
+
+ if ( input )
+ {
+ input->setEnabled( true );
+ }
+
+ // Enable/disable the labels, combo boxes, buttons, etc:
+ QLabel *protocol_label = static_cast<QLabel *>( child( "CustomProtocolLabel", "QLabel", true ) );
+
+ if ( protocol_label )
+ {
+ if ( QString::compare( item->text( Protocol ).stripWhiteSpace(), "-" ) == 0 )
+ {
+ protocol_label->setEnabled( false );
+ }
+ else
+ {
+ protocol_label->setEnabled( true );
+ }
+ }
+
+ KComboBox *protocol = static_cast<KComboBox *>( child( "CustomProtocol", "KComboBox", true ) );
+
+ if ( protocol )
+ {
+ if ( QString::compare( item->text( Protocol ).stripWhiteSpace(), "-" ) == 0 )
+ {
+ protocol->setEnabled( false );
+ }
+ else
+ {
+ protocol->setEnabled( true );
+ }
+
+ protocol->setCurrentText( item->text( Protocol ) );
+ }
+
+#ifndef __FreeBSD__
+
+ QLabel *fs_label = static_cast<QLabel *>( child( "CustomFileSystemLabel", "QLabel", true ) );
+
+ if ( fs_label )
+ {
+ if ( QString::compare( item->text( FileSystem ).stripWhiteSpace(), "-" ) == 0 )
+ {
+ fs_label->setEnabled( false );
+ }
+ else
+ {
+ fs_label->setEnabled( true );
+ }
+ }
+
+ KComboBox *filesystem = static_cast<KComboBox *>( child( "CustomFileSystem", "KComboBox", true ) );
+
+ if ( filesystem )
+ {
+ if ( QString::compare( item->text( FileSystem ).stripWhiteSpace(), "-" ) == 0 )
+ {
+ filesystem->setEnabled( false );
+ }
+ else
+ {
+ filesystem->setEnabled( true );
+ }
+
+ filesystem->setCurrentText( item->text( FileSystem ) );
+ }
+
+ QLabel *write_access_label = static_cast<QLabel *>( child( "CustomWriteAccessLabel", "QLabel", true ) );
+
+ if ( write_access_label )
+ {
+ if ( QString::compare( item->text( WriteAccess ).stripWhiteSpace(), "-" ) == 0 )
+ {
+ write_access_label->setEnabled( false );
+ }
+ else
+ {
+ write_access_label->setEnabled( true );
+ }
+ }
+
+ KComboBox *write_access = static_cast<KComboBox *>( child( "CustomWriteAccess", "KComboBox", true ) );
+
+ if ( write_access )
+ {
+ if ( QString::compare( item->text( WriteAccess ).stripWhiteSpace(), "-" ) == 0 )
+ {
+ write_access->setEnabled( false );
+ }
+ else
+ {
+ write_access->setEnabled( true );
+ }
+
+ write_access->setCurrentText( item->text( WriteAccess ) );
+ }
+
+#endif
+
+ QLabel *krb_label = static_cast<QLabel *>( child( "CustomKerberosLabel", "QLabel", true ) );
+
+ if ( krb_label )
+ {
+ if ( QString::compare( item->text( Kerberos ).stripWhiteSpace(), "-" ) == 0 )
+ {
+ krb_label->setEnabled( false );
+ }
+ else
+ {
+ krb_label->setEnabled( true );
+ }
+ }
+
+ KComboBox *kerberos = static_cast<KComboBox *>( child( "CustomKerberos", "KComboBox", true ) );
+
+ if ( kerberos )
+ {
+ if ( QString::compare( item->text( Kerberos ).stripWhiteSpace(), "-" ) == 0 )
+ {
+ kerberos->setEnabled( false );
+ }
+ else
+ {
+ kerberos->setEnabled( true );
+ }
+
+ kerberos->setCurrentText( item->text( Kerberos ) );
+ }
+
+ QLabel *uid_label = static_cast<QLabel *>( child( "CustomUIDLabel", "QLabel", true ) );
+
+ if ( uid_label )
+ {
+ if ( QString::compare( item->text( UID ).stripWhiteSpace(), "-" ) == 0 )
+ {
+ uid_label->setEnabled( false );
+ }
+ else
+ {
+ uid_label->setEnabled( true );
+ }
+ }
+
+ KLineEdit *uid = static_cast<KLineEdit *>( child( "CustomUID", "KLineEdit", true ) );
+
+ if ( uid )
+ {
+ if ( QString::compare( item->text( UID ).stripWhiteSpace(), "-" ) == 0 )
+ {
+ uid->setEnabled( false );
+ }
+ else
+ {
+ uid->setEnabled( true );
+ }
+
+ uid->setText( item->text( UID ) );
+ }
+
+ QLabel *gid_label = static_cast<QLabel *>( child( "CustomGIDLabel", "QLabel", true ) );
+
+ if ( gid_label )
+ {
+ if ( QString::compare( item->text( GID ).stripWhiteSpace(), "-" ) == 0 )
+ {
+ gid_label->setEnabled( false );
+ }
+ else
+ {
+ gid_label->setEnabled( true );
+ }
+ }
+
+ KLineEdit *gid = static_cast<KLineEdit *>( child( "CustomGID", "KLineEdit", true ) );
+
+ if ( gid )
+ {
+ if ( QString::compare( item->text( GID ).stripWhiteSpace(), "-" ) == 0 )
+ {
+ gid->setEnabled( false );
+ }
+ else
+ {
+ gid->setEnabled( true );
+ }
+
+ gid->setText( item->text( GID ) );
+ }
+
+ QLabel *port_label = static_cast<QLabel *>( child( "CustomPortLabel", "QLabel", true ) );
+
+ if ( port_label )
+ {
+ if ( QString::compare( item->text( Port ).stripWhiteSpace(), "-" ) == 0 )
+ {
+ port_label->setEnabled( false );
+ }
+ else
+ {
+ port_label->setEnabled( true );
+ }
+ }
+
+ KIntNumInput *port = static_cast<KIntNumInput *>( child( "CustomPort", "KIntNumInput", true ) );
+
+ if ( port )
+ {
+ if ( QString::compare( item->text( Port ).stripWhiteSpace(), "-" ) == 0 )
+ {
+ port->setEnabled( false );
+ }
+ else
+ {
+ port->setEnabled( true );
+ }
+
+ port->setValue( item->text( Port ).toInt() );
+ }
+
+ KPushButton *remove = static_cast<KPushButton *>( child( "CustomRemoveItem", "KPushButton", true ) );
+
+ if ( remove )
+ {
+ remove->setEnabled( true );
+ }
+
+ KPushButton *remove_all = static_cast<KPushButton *>( child( "CustomRemoveAllItems", "KPushButton", true ) );
+
+ if ( remove_all )
+ {
+ remove_all->setEnabled( true );
+ }
+ }
+ else
+ {
+ // Get the list view:
+ KListView *view = static_cast<KListView *>( child( "CustomOptionsList", "KListView", true ) );
+
+ if ( view )
+ {
+ QLabel *protocol_label = static_cast<QLabel *>( child( "CustomProtocolLabel", "QLabel", true ) );
+
+ if ( protocol_label )
+ {
+ protocol_label->setEnabled( false );
+ }
+
+ KComboBox *protocol = static_cast<KComboBox *>( child( "CustomProtocol", "KComboBox", true ) );
+
+ if ( protocol )
+ {
+ protocol->setCurrentText( "-" );
+ protocol->setEnabled( false );
+ }
+
+#ifndef __FreeBSD__
+
+ QLabel *fs_label = static_cast<QLabel *>( child( "CustomFileSystemLabel", "QLabel", true ) );
+
+ if ( fs_label )
+ {
+ fs_label->setEnabled( false );
+ }
+
+ KComboBox *filesystem = static_cast<KComboBox *>( child( "CustomFileSystem", "KComboBox", true ) );
+
+ if ( filesystem )
+ {
+ filesystem->setCurrentText( "-" );
+ filesystem->setEnabled( false );
+ }
+
+ QLabel *write_access_label = static_cast<QLabel *>( child( "CustomWriteAccessLabel", "QLabel", true ) );
+
+ if ( write_access_label )
+ {
+ write_access_label->setEnabled( false );
+ }
+
+ KComboBox *write_access = static_cast<KComboBox *>( child( "CustomWriteAccess", "KComboBox", true ) );
+
+ if ( write_access )
+ {
+ write_access->setCurrentText( "-" );
+ write_access->setEnabled( false );
+ }
+
+#endif
+
+ QLabel *krb_label = static_cast<QLabel *>( child( "CustomKerberosLabel", "QLabel", true ) );
+
+ if ( krb_label )
+ {
+ krb_label->setEnabled( false );
+ }
+
+ KComboBox *kerberos = static_cast<KComboBox *>( child( "CustomKerberos", "KComboBox", true ) );
+
+ if ( kerberos )
+ {
+ kerberos->setCurrentText( "-" );
+ kerberos->setEnabled( false );
+ }
+
+ QLabel *uid_label = static_cast<QLabel *>( child( "CustomUIDLabel", "QLabel", true ) );
+
+ if ( uid_label )
+ {
+ uid_label->setEnabled( false );
+ }
+
+ KLineEdit *uid = static_cast<KLineEdit *>( child( "CustomUID", "KLineEdit", true ) );
+
+ if ( uid )
+ {
+ uid->setText( "-" );
+ uid->setEnabled( false );
+ }
+
+ QLabel *gid_label = static_cast<QLabel *>( child( "CustomGIDLabel", "QLabel", true ) );
+
+ if ( gid_label )
+ {
+ gid_label->setEnabled( false );
+ }
+
+ KLineEdit *gid = static_cast<KLineEdit *>( child( "CustomGID", "KLineEdit", true ) );
+
+ if ( gid )
+ {
+ gid->setText( "-" );
+ gid->setEnabled( false );
+ }
+
+ QLabel *port_label = static_cast<QLabel *>( child( "CustomPortLabel", "QLabel", true ) );
+
+ if ( port_label )
+ {
+ port_label->setEnabled( false );
+ }
+
+ KIntNumInput *port = static_cast<KIntNumInput *>( child( "CustomPort", "KIntNumInput", true ) );
+
+ if ( port )
+ {
+ port->setValue( Smb4KSettings::remotePort() );
+ port->setEnabled( false );
+ }
+
+ KPushButton *remove = static_cast<KPushButton *>( child( "CustomRemoveItem", "KPushButton", true ) );
+
+ if ( remove )
+ {
+ remove->setEnabled( false );
+ }
+
+ KPushButton *remove_all = static_cast<KPushButton *>( child( "CustomRemoveAllItems", "KPushButton", true ) );
+
+ if ( remove_all )
+ {
+ remove_all->setEnabled( (view->childCount() != 0) );
+ }
+ }
+ }
+}
+
+
+void Smb4KSambaOptions::slotCustomProtocolChanged( int index )
+{
+ KListView *view = static_cast<KListView *>( child( "CustomOptionsList", "KListView", true ) );
+ KComboBox *custom_protocol = static_cast<KComboBox *>( child( "CustomProtocol", "KComboBox", true ) );
+
+ if ( view && view->selectedItem() && custom_protocol )
+ {
+ if ( QString::compare( "-", custom_protocol->text( index ) ) != 0 )
+ {
+ // Set the new value:
+ view->selectedItem()->setText( Protocol, custom_protocol->text( index ) );
+
+ emit customSettingsChanged();
+ }
+ else
+ {
+ // Reset the combo box:
+ custom_protocol->setCurrentText( view->selectedItem()->text( Protocol ) );
+ }
+ }
+ else
+ {
+ // Nothing to do.
+ }
+}
+
+
+#ifndef __FreeBSD__
+void Smb4KSambaOptions::slotCustomFileSystemChanged( int index )
+{
+ KListView *view = static_cast<KListView *>( child( "CustomOptionsList", "KListView", true ) );
+ KComboBox *custom_filesystem = static_cast<KComboBox *>( child( "CustomFileSystem", "KComboBox", true ) );
+
+ if ( view && view->selectedItem() && custom_filesystem )
+ {
+ if ( QString::compare( "-", custom_filesystem->text( index ) ) != 0 )
+ {
+ // Set the new value:
+ view->selectedItem()->setText( FileSystem, custom_filesystem->text( index ) );
+
+ emit customSettingsChanged();
+ }
+ else
+ {
+ // Reset the combo box:
+ custom_filesystem->setCurrentText( view->selectedItem()->text( FileSystem ) );
+ }
+ }
+ else
+ {
+ // Nothing to do.
+ }
+#else
+void Smb4KSambaOptions::slotCustomFileSystemChanged( int )
+{
+#endif
+}
+
+
+#ifndef __FreeBSD__
+void Smb4KSambaOptions::slotCustomWriteAccessChanged( int index )
+{
+ KListView *view = static_cast<KListView *>( child( "CustomOptionsList", "KListView", true ) );
+ KComboBox *custom_rw = static_cast<KComboBox *>( child( "CustomWriteAccess", "KComboBox", true ) );
+
+ if ( view && view->selectedItem() && custom_rw )
+ {
+ if ( QString::compare( "-", custom_rw->text( index ) ) != 0 )
+ {
+ // Set the new value:
+ view->selectedItem()->setText( WriteAccess, custom_rw->text( index ) );
+
+ emit customSettingsChanged();
+ }
+ else
+ {
+ // Reset the combo box:
+ custom_rw->setCurrentText( view->selectedItem()->text( WriteAccess ) );
+ }
+ }
+ else
+ {
+ // Nothing to do.
+ }
+#else
+void Smb4KSambaOptions::slotCustomWriteAccessChanged( int )
+{
+#endif
+}
+
+
+void Smb4KSambaOptions::slotCustomKerberosChanged( int index )
+{
+ // FIXME: Do we need to adjust something here with respect to
+ // FreeBSD? It does not know Kerberos for mounting!
+
+ KListView *view = static_cast<KListView *>( child( "CustomOptionsList", "KListView", true ) );
+ KComboBox *custom_kerberos = static_cast<KComboBox *>( child( "CustomWriteAccess", "KComboBox", true ) );
+
+ if ( view && view->selectedItem() && custom_kerberos )
+ {
+ if ( QString::compare( "-", custom_kerberos->text( index ) ) != 0 )
+ {
+ // Set the new value:
+ view->selectedItem()->setText( Kerberos, custom_kerberos->text( index ) );
+
+ emit customSettingsChanged();
+ }
+ else
+ {
+ // Reset the combo box:
+ custom_kerberos->setCurrentText( view->selectedItem()->text( Kerberos ) );
+ }
+ }
+ else
+ {
+ // Nothing to do.
+ }
+}
+
+
+void Smb4KSambaOptions::slotCustomUIDChanged( const QString &uid )
+{
+ KListView *view = static_cast<KListView *>( child( "CustomOptionsList", "KListView", true ) );
+
+ if ( view && view->selectedItem() )
+ {
+ // Set the new value:
+ view->selectedItem()->setText( UID, uid );
+
+ emit customSettingsChanged();
+ }
+ else
+ {
+ // Nothing to do.
+ }
+}
+
+
+void Smb4KSambaOptions::slotCustomGIDChanged( const QString &gid )
+{
+ KListView *view = static_cast<KListView *>( child( "CustomOptionsList", "KListView", true ) );
+
+ if ( view && view->selectedItem() )
+ {
+ // Set the new value:
+ view->selectedItem()->setText( GID, gid );
+
+ emit customSettingsChanged();
+ }
+ else
+ {
+ // Nothing to do.
+ }
+}
+
+
+void Smb4KSambaOptions::slotCustomPortChanged( int port )
+{
+ KListView *view = static_cast<KListView *>( child( "CustomOptionsList", "KListView", true ) );
+
+ if ( view && view->selectedItem() )
+ {
+ view->selectedItem()->setText( Port, QString( "%1" ).arg( port ) );
+
+ emit customSettingsChanged();
+ }
+ else
+ {
+ // Nothing to do.
+ }
+}
+
+
+void Smb4KSambaOptions::slotRemoveCustomOption()
+{
+ KListView *view = static_cast<KListView *>( child( "CustomOptionsList", "KListView", true ) );
+
+ if ( view && view->selectedItem() )
+ {
+ delete view->currentItem();
+
+ slotCustomItemClicked( NULL );
+
+ emit customSettingsChanged();
+ }
+ else
+ {
+ // Nothing to do.
+ }
+}
+
+
+void Smb4KSambaOptions::slotRemoveAllCustomOptions()
+{
+ KListView *view = static_cast<KListView *>( child( "CustomOptionsList", "KListView", true ) );
+
+ if ( view )
+ {
+ while ( view->firstChild() )
+ {
+ delete view->firstChild();
+ }
+
+ slotCustomItemClicked( NULL );
+
+ emit customSettingsChanged();
+ }
+ else
+ {
+ // Nothing to do.
+ }
+}
+
+#include "smb4ksambaoptions.moc"
diff --git a/smb4k/configdlg/smb4ksambaoptions.h b/smb4k/configdlg/smb4ksambaoptions.h
new file mode 100644
index 0000000..9a994b0
--- /dev/null
+++ b/smb4k/configdlg/smb4ksambaoptions.h
@@ -0,0 +1,168 @@
+/***************************************************************************
+ smb4ksambaoptions.cpp - This is the configuration page for the
+ Samba settings of Smb4K
+ -------------------
+ begin : Mo Jan 26 2004
+ copyright : (C) 2004-2007 by Alexander Reinholdt
+ email : dustpuppy@users.berlios.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef SMB4KSAMBAOPTIONS_H
+#define SMB4KSAMBAOPTIONS_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// Qt includes
+#include <qtabwidget.h>
+
+
+/**
+ * This class manages the configuration dialog of the options
+ * that can be passed to smbmount and other programs of the
+ * Samba software suite.
+ *
+ * @author Alexander Reinholdt <dustpuppy@users.berlios.de>
+ */
+
+
+class Smb4KSambaOptions : public QTabWidget
+{
+ Q_OBJECT
+
+ public:
+ /**
+ * The constructor.
+ *
+ * @param parent The parent widget
+ *
+ * @param name This widget's name
+ */
+ Smb4KSambaOptions( QWidget *parent = 0, const char *name = 0 );
+
+ /**
+ * The destructor.
+ */
+ ~Smb4KSambaOptions();
+
+ /**
+ * This enumeration is used for the list view in the "Custom" tab.
+ */
+#ifndef __FreeBSD__
+ enum Columns{ ItemName = 0, Protocol = 1, FileSystem = 2, WriteAccess = 3, Kerberos = 4, UID = 5, GID = 6, Port = 7 };
+#else
+ enum Columns{ ItemName = 0, Protocol = 1, Kerberos = 2, UID = 3, GID = 4, Port = 5 };
+#endif
+
+ /**
+ * Reset the 'Custom' options tab.
+ */
+ void resetCustomTab();
+
+ signals:
+ /**
+ * This signal is emitted everytime the custom settings were changed by the
+ * user. That may mean, that only one setting has has been altered but also
+ * that all custom entries have been deleted. You have to figure out what
+ * happened in the slot that's connected to this signal.
+ */
+ void customSettingsChanged();
+
+ protected slots:
+ /**
+ * Enables/disables widgets according to the choice of the filesystem (SMBFS/CIFS).
+ *
+ * This slot is connected to the combo box that stores the file systems.
+ *
+ * @param item_index The index of the item in the combo box.
+ */
+ void slotSambaFileSystem( int item_index );
+
+ /**
+ * This slot is invoked if an item in the list of custom options has been
+ * clicked. It will put the values that are carried by the list view item
+ * into the editor combo boxes, num inputs, etc.
+ *
+ * @param item The item that has been clicked/highlighted.
+ */
+ void slotCustomItemClicked( QListViewItem *item );
+
+ /**
+ * Commit the new custom protocol to the list view item.
+ *
+ * @param index The index number of the new protocol
+ */
+ void slotCustomProtocolChanged( int index );
+
+ /**
+ * Commit the new custom file system to the list view item.
+ *
+ * @param index The index number of the new file system
+ */
+ void slotCustomFileSystemChanged( int index );
+
+ /**
+ * Commit the new custom write access setting to the list view item.
+ *
+ * @param index The index number of the new setting
+ */
+ void slotCustomWriteAccessChanged( int index );
+
+ /**
+ * Commit the new custom Kerberos setting to the list view item.
+ *
+ * @param index The index number of the new setting
+ */
+ void slotCustomKerberosChanged( int index );
+
+ /**
+ * Commit the new custom UID to the list view item.
+ *
+ * @param uid The new UID in text form
+ */
+ void slotCustomUIDChanged( const QString &uid );
+
+ /**
+ * This slot is invoked if the value for the custom GID setting changed.
+ *
+ * @param gid The new GID in text form
+ */
+ void slotCustomGIDChanged( const QString &gid );
+
+ /**
+ * Commit the new custom port number to the list view item.
+ *
+ * @param port The port number
+ */
+ void slotCustomPortChanged( int port );
+
+ /**
+ * Remove the highlighted item from the custom options list.
+ */
+ void slotRemoveCustomOption();
+
+ /**
+ * Remove all items from the custom options list.
+ */
+ void slotRemoveAllCustomOptions();
+};
+
+#endif
diff --git a/smb4k/configdlg/smb4kshareoptions.cpp b/smb4k/configdlg/smb4kshareoptions.cpp
new file mode 100644
index 0000000..aebd505
--- /dev/null
+++ b/smb4k/configdlg/smb4kshareoptions.cpp
@@ -0,0 +1,98 @@
+/***************************************************************************
+ smb4kshareoptions - The configuration page for the settings of
+ Smb4K regarding share management
+ -------------------
+ begin : Sa Nov 15 2003
+ copyright : (C) 2003-2007 by Alexander Reinholdt
+ email : dustpuppy@users.berlios.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+// Qt includes
+#include <qlayout.h>
+#include <qgroupbox.h>
+#include <qbuttongroup.h>
+#include <qlabel.h>
+#include <qcheckbox.h>
+
+// KDE includes
+#include <klocale.h>
+#include <kbuttonbox.h>
+#include <kurlrequester.h>
+#include <knuminput.h>
+
+// system includes
+#include <sys/types.h>
+#include <pwd.h>
+
+// applications specific includes
+#include "smb4kshareoptions.h"
+
+
+Smb4KShareOptions::Smb4KShareOptions( QWidget *parent, const char *name ) : QWidget( parent, name )
+{
+ QGridLayout *grid = new QGridLayout( this );
+ grid->setSpacing( 10 );
+
+ QGroupBox *dir_box = new QGroupBox( 1, Qt::Horizontal, i18n( "Directories" ), this );
+
+ QWidget *prefix_container = new QWidget( dir_box );
+ QGridLayout *prefix_layout = new QGridLayout( prefix_container );
+ prefix_layout->setSpacing( 10 );
+
+ QLabel *prefix = new QLabel( i18n( "Mount prefix:" ), prefix_container );
+ KURLRequester *mount_prefix = new KURLRequester( QString::null, prefix_container,
+ "kcfg_MountPrefix" );
+ mount_prefix->setMode( KFile::Directory );
+ prefix_layout->addWidget( prefix, 0, 0, 0 );
+ prefix_layout->addWidget( mount_prefix, 0, 1, 0 );
+
+ (void) new QCheckBox( i18n( "Force generated subdirectories to be lower case" ),
+ dir_box, "kcfg_ForceLowerCaseSubdirs" );
+
+ QButtonGroup *mount_box = new QButtonGroup( 1, QButtonGroup::Horizontal, i18n( "Mounting and Unmounting" ), this );
+ (void) new QCheckBox( i18n( "Unmount all shares of user %1 on exit" ).arg( getpwuid( getuid() )->pw_name ),
+ mount_box, "kcfg_UnmountSharesOnExit" );
+ (void) new QCheckBox( i18n( "Remount recently used shares on program start" ),
+ mount_box, "kcfg_RemountShares" );
+ (void) new QCheckBox( i18n( "Allow the unmounting of shares that are owned by other users" ),
+ mount_box, "kcfg_UnmountForeignShares" );
+
+ QGroupBox *checks_box = new QGroupBox( 2, QGroupBox::Horizontal, i18n( "Checks" ), this );
+
+ (void) new QLabel( i18n( "Interval between checks:" ), checks_box );
+ KIntNumInput *check_interval = new KIntNumInput( 2500, checks_box, 10,
+ "kcfg_CheckInterval" );
+ check_interval->setSuffix( " ms" );
+ check_interval->setRange( 500, 300000, 1, false );
+
+ QSpacerItem *spacer2 = new QSpacerItem( 0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding );
+
+ grid->addWidget( dir_box, 0, 0, 0 );
+ grid->addWidget( mount_box, 1, 0, 0 );
+ grid->addWidget( checks_box, 2, 0, 0 );
+ grid->addItem( spacer2, 3, 0 );
+}
+
+Smb4KShareOptions::~Smb4KShareOptions()
+{
+}
+
+
+#include "smb4kshareoptions.moc"
diff --git a/smb4k/configdlg/smb4kshareoptions.h b/smb4k/configdlg/smb4kshareoptions.h
new file mode 100644
index 0000000..cf45aa7
--- /dev/null
+++ b/smb4k/configdlg/smb4kshareoptions.h
@@ -0,0 +1,62 @@
+/***************************************************************************
+ smb4kshareoptions - The configuration page for the settings of
+ Smb4K regarding share management
+ -------------------
+ begin : Sa Nov 15 2003
+ copyright : (C) 2003-2007 by Alexander Reinholdt
+ email : dustpuppy@users.berlios.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef SMB4KSHAREOPTIONS_H
+#define SMB4KSHAREOPTIONS_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// Qt includes
+#include <qwidget.h>
+
+/**
+ * This is the configuration tab for the settings that are
+ * used to manage the mounted shares.
+ *
+ * @author Alexander Reinholdt <dustpuppy@users.berlios.de>
+ */
+
+class Smb4KShareOptions : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ /**
+ * The constructor.
+ *
+ * @param parent The parent of this widget
+ *
+ * @param name The name of this widget
+ */
+ Smb4KShareOptions( QWidget *parent = 0, const char *name = 0 );
+ /**
+ * The destructor.
+ */
+ ~Smb4KShareOptions();
+};
+#endif
diff --git a/smb4k/configdlg/smb4ksuperuseroptions.cpp b/smb4k/configdlg/smb4ksuperuseroptions.cpp
new file mode 100644
index 0000000..d23b624
--- /dev/null
+++ b/smb4k/configdlg/smb4ksuperuseroptions.cpp
@@ -0,0 +1,101 @@
+/***************************************************************************
+ smb4ksuperuseroptions - The configuration page for the super user
+ settings of Smb4K
+ -------------------
+ begin : Sa Okt 30 2004
+ copyright : (C) 2004-2007 by Alexander Reinholdt
+ email : dustpuppy@users.berlios.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+// Qt includes
+#include <qgroupbox.h>
+#include <qbuttongroup.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+
+// KDE includes
+#include <klocale.h>
+#include <kpushbutton.h>
+#include <kguiitem.h>
+
+// application specific includes
+#include "smb4ksuperuseroptions.h"
+#include "../core/smb4ksettings.h"
+
+
+Smb4KSuperUserOptions::Smb4KSuperUserOptions( QWidget *parent, const char *name )
+: QWidget( parent, name )
+{
+ QGridLayout *grid = new QGridLayout( this );
+ grid->setSpacing( 10 );
+
+ QButtonGroup *suid_progs = new QButtonGroup( 1, QButtonGroup::Horizontal,
+ i18n( "Programs" ), this, "kcfg_SuperUserProgram" );
+ suid_progs->setInsideSpacing( 5 );
+
+ new QLabel( i18n( "Use the following program to gain super user privileges:" ), suid_progs );
+ suid_progs->insert( new QRadioButton( "sudo", suid_progs, "SudoButton" ), Smb4KSettings::EnumSuperUserProgram::Sudo );
+ suid_progs->insert( new QRadioButton( "super", suid_progs, "SuperButton" ), Smb4KSettings::EnumSuperUserProgram::Super );
+
+ QButtonGroup *suid_actions = new QButtonGroup( 1, QButtonGroup::Horizontal, i18n( "Actions" ), this, "SUIDActions" );
+ suid_actions->setInsideSpacing( 5 );
+#ifdef __linux__
+ (void) new QCheckBox( i18n( "Use super user privileges to force the unmounting of (inaccessible) shares" ), suid_actions, "kcfg_UseForceUnmount" );
+#endif
+ (void) new QCheckBox( i18n( "Use super user privileges to mount and unmount shares" ), suid_actions, "kcfg_AlwaysUseSuperUser" );
+
+ QSpacerItem *spacer1 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Preferred );
+ KGuiItem remove_item = KGuiItem( i18n( "Remove Entries" ), "editdelete",
+ i18n( "Remove entries from the configuration file" ),
+ i18n( "Depending on your choice under \"Programs\", all entries that were written by Smb4K will be removed either from /etc/super.tab or /etc/sudoers. Additionally, all your choices under \"Actions\" will be cleared." ) );
+ KPushButton *remove = new KPushButton( remove_item, this, "RemoveButton" );
+
+ QSpacerItem *spacer2 = new QSpacerItem( 0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding );
+
+ grid->addMultiCellWidget( suid_progs, 0, 0, 0, 3, 0 );
+ grid->addMultiCellWidget( suid_actions, 1, 1, 0, 3, 0 );
+ grid->addMultiCell( spacer1, 2, 2, 0, 2, 0 );
+ grid->addWidget( remove, 2, 3, 0 );
+ grid->addMultiCell( spacer2, 3, 3, 0, 3, 0 );
+
+ connect( remove, SIGNAL( clicked() ),
+ this, SLOT( slotRemoveClicked() ) );
+}
+
+
+Smb4KSuperUserOptions::~Smb4KSuperUserOptions()
+{
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// SLOT IMPLEMENTATIONS
+/////////////////////////////////////////////////////////////////////////////
+
+void Smb4KSuperUserOptions::slotRemoveClicked()
+{
+ // Emit the signal that the removal of the super user
+ // entries has been requested.
+ emit removeEntries();
+}
+
+#include "smb4ksuperuseroptions.moc"
diff --git a/smb4k/configdlg/smb4ksuperuseroptions.h b/smb4k/configdlg/smb4ksuperuseroptions.h
new file mode 100644
index 0000000..86c705e
--- /dev/null
+++ b/smb4k/configdlg/smb4ksuperuseroptions.h
@@ -0,0 +1,79 @@
+/***************************************************************************
+ smb4ksuperuseroptions - The configuration page for the super user
+ settings of Smb4K
+ -------------------
+ begin : Sa Okt 30 2004
+ copyright : (C) 2004-2007 by Alexander Reinholdt
+ email : dustpuppy@users.berlios.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef SMB4KSUPERUSEROPTIONS_H
+#define SMB4KSUPERUSEROPTIONS_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// Qt includes
+#include <qwidget.h>
+
+/**
+ * This is the configuration tab where the user can determine
+ * whether he/she wants to use the program super or sudo to
+ * gain super user privileges.
+ *
+ * @author Alexander Reinholdt <dustpuppy@users.berlios.de>
+ */
+
+class Smb4KSuperUserOptions : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ /**
+ * The constructor
+ *
+ * @param parent The parent widget
+ *
+ * @param name The name of this widget
+ */
+ Smb4KSuperUserOptions( QWidget *parent = 0, const char *name = 0 );
+ /**
+ * The destructor
+ */
+ ~Smb4KSuperUserOptions();
+
+ signals:
+ /**
+ * This signal is emitted when the "Remove Entries" button has been
+ * clicked. It is provided for convenience. You could also connect
+ * to the clicked() signal.
+ */
+ void removeEntries();
+
+ protected slots:
+ /**
+ * This slot is activated when the "Remove Entries" button has been
+ * clicked.
+ */
+ void slotRemoveClicked();
+};
+
+#endif
diff --git a/smb4k/configdlg/smb4kuserinterfaceoptions.cpp b/smb4k/configdlg/smb4kuserinterfaceoptions.cpp
new file mode 100644
index 0000000..c4310fe
--- /dev/null
+++ b/smb4k/configdlg/smb4kuserinterfaceoptions.cpp
@@ -0,0 +1,207 @@
+/***************************************************************************
+ smb4kuserinterfaceoptions - This configuration page takes care
+ of all settings concerning the user interface of Smb4K
+ -------------------
+ begin : Mi Aug 30 2006
+ copyright : (C) 2006-2007 by Alexander Reinholdt
+ email : dustpuppy@users.berlios.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+// Qt includes
+#include <qlayout.h>
+#include <qbuttongroup.h>
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+
+// KDE includes
+#include <klocale.h>
+
+// application specific includes
+#include "smb4kuserinterfaceoptions.h"
+#include "../core/smb4ksettings.h"
+
+Smb4KUserInterfaceOptions::Smb4KUserInterfaceOptions( QWidget *parent, const char *name )
+: QTabWidget( parent, name )
+{
+ setMargin( 10 );
+
+ //
+ // Configuration for the main window:
+ //
+ QWidget *main_wd_widget = new QWidget( this );
+ QGridLayout *main_wd_layout = new QGridLayout( main_wd_widget );
+ main_wd_layout->setSpacing( 10 );
+
+ QButtonGroup *shares_view = new QButtonGroup( 1, Qt::Horizontal, i18n( "Shares View" ),
+ main_wd_widget, "kcfg_SharesView" );
+
+ shares_view->insert( new QRadioButton( i18n( "Show mounted shares in an icon view" ), shares_view ), Smb4KSettings::EnumSharesView::IconView );
+
+ shares_view->insert( new QRadioButton( i18n( "Show mounted shares in a list view" ), shares_view ), Smb4KSettings::EnumSharesView::ListView );
+
+ QButtonGroup *bookmarks_grp = new QButtonGroup( 1, Qt::Horizontal, i18n( "Bookmarks" ),
+ main_wd_widget, "BookmarksBox" );
+
+ (void) new QCheckBox( i18n( "Show custom bookmark label if available" ), bookmarks_grp, "kcfg_ShowCustomBookmarkLabel" );
+
+ QButtonGroup *tray_group = new QButtonGroup( 1, Qt::Horizontal, i18n( "System Tray" ),
+ main_wd_widget, "SystemTrayBox" );
+
+ (void) new QCheckBox( i18n( "Embed application into the system tray" ), tray_group, "kcfg_EmbedIntoSystemTray" );
+
+ QSpacerItem *spacer1 = new QSpacerItem( 0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding );
+
+ main_wd_layout->addWidget( shares_view, 0, 0, 0 );
+ main_wd_layout->addWidget( bookmarks_grp, 1, 0, 0 );
+ main_wd_layout->addWidget( tray_group, 2, 0, 0 );
+ main_wd_layout->addItem( spacer1, 3, 0 );
+
+ //
+ // Configuration for the network browser:
+ //
+ QWidget *browser_widget = new QWidget( this );
+ QGridLayout *browser_layout = new QGridLayout( browser_widget );
+ browser_layout->setSpacing( 10 );
+
+ QButtonGroup *remoteGroup = new QButtonGroup( 2, QButtonGroup::Horizontal, i18n( "Remote Shares" ),
+ browser_widget, "BrowserRemoteSharesBox" );
+ (void) new QCheckBox( i18n( "Show printer shares" ), remoteGroup, "kcfg_ShowPrinterShares" );
+ QCheckBox *hidden = new QCheckBox( i18n( "Show hidden shares" ), remoteGroup, "kcfg_ShowHiddenShares" );
+ (void) new QCheckBox( i18n( "Show IPC$ shares" ), remoteGroup, "kcfg_ShowHiddenIPCShares" );
+ (void) new QCheckBox( i18n( "Show ADMIN$ shares" ), remoteGroup, "kcfg_ShowHiddenADMINShares" );
+
+ QButtonGroup *columnsGroup = new QButtonGroup( 2, QButtonGroup::Horizontal, i18n( "Columns" ),
+ browser_widget, "BrowserColumnsBox" );
+ (void) new QCheckBox( i18n( "Show type" ), columnsGroup, "kcfg_ShowType" );
+ (void) new QCheckBox( i18n( "Show IP address" ), columnsGroup, "kcfg_ShowIPAddress" );
+ (void) new QCheckBox( i18n( "Show comment" ), columnsGroup, "kcfg_ShowComment" );
+
+ QButtonGroup *netTooltipsGroup = new QButtonGroup( 1, QButtonGroup::Horizontal, i18n( "Tooltips" ),
+ browser_widget, "BrowserTooltipsBox" );
+ (void) new QCheckBox( i18n( "Show tooltip with information about a network item" ), netTooltipsGroup, "kcfg_ShowNetworkItemToolTip" );
+
+ QSpacerItem *spacer2 = new QSpacerItem( 0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding );
+
+ browser_layout->addWidget( remoteGroup, 0, 0, 0 );
+ browser_layout->addWidget( columnsGroup, 1, 0, 0 );
+ browser_layout->addWidget( netTooltipsGroup, 2, 0, 0 );
+ browser_layout->addItem( spacer2, 3, 0 );
+
+ //
+ // Configuration for the shares view
+ //
+ QWidget *shares_widget = new QWidget( this );
+ QGridLayout *shares_layout = new QGridLayout( shares_widget );
+ shares_layout->setSpacing( 10 );
+
+ QButtonGroup *shares_group = new QButtonGroup( 1, Qt::Horizontal, i18n( "Mounted Shares" ),
+ shares_widget, "SharesIconGroupBox" );
+ (void) new QCheckBox( i18n( "Show mount point instead of share name" ), shares_group, "kcfg_ShowMountPoint" );
+ (void) new QCheckBox( i18n( "Show all shares that are mounted on the system" ), shares_group, "kcfg_ShowAllShares" );
+
+ QButtonGroup *dnd_group = new QButtonGroup( 1, Qt::Horizontal, i18n( "Drag and Drop" ),
+ shares_widget, "DragnDropBox" );
+ (void) new QCheckBox( i18n( "Allow dropping of files and directories onto shares" ), dnd_group, "kcfg_EnableDropSupport" );
+ (void) new QCheckBox( i18n( "Allow dragging of shares" ), dnd_group, "kcfg_EnableDragSupport" );
+
+ QButtonGroup *sharesTooltipGroup = new QButtonGroup( 1, Qt::Horizontal, i18n( "Tooltips" ),
+ shares_widget, "SharesTooltipsBox" );
+ (void) new QCheckBox( i18n( "Show tooltip with information about a share" ), sharesTooltipGroup, "kcfg_ShowShareToolTip" );
+
+ QButtonGroup *list_view_group = new QButtonGroup( 2, Qt::Horizontal, i18n( "List View" ),
+ shares_widget, "SharesListViewBox" );
+
+#ifndef __FreeBSD__
+ (void) new QCheckBox( i18n( "Show owner and group (SMBFS only)" ), list_view_group, "kcfg_ShowOwner" );
+ (void) new QCheckBox( i18n( "Show login (CIFS only)" ), list_view_group, "kcfg_ShowLogin" );
+#else
+ (void) new QCheckBox( i18n( "Show owner and group" ), list_view_group, "kcfg_ShowOwner" );
+#endif
+ (void) new QCheckBox( i18n( "Show file system" ), list_view_group, "kcfg_ShowFileSystem" );
+ (void) new QCheckBox( i18n( "Show free disk space" ), list_view_group, "kcfg_ShowFreeDiskSpace" );
+ (void) new QCheckBox( i18n( "Show used disk space" ), list_view_group, "kcfg_ShowUsedDiskSpace" );
+ (void) new QCheckBox( i18n( "Show total disk space" ), list_view_group, "kcfg_ShowTotalDiskSpace" );
+ (void) new QCheckBox( i18n( "Show disk usage" ), list_view_group, "kcfg_ShowDiskUsage" );
+
+ QSpacerItem *spacer3 = new QSpacerItem( 0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding );
+
+ shares_layout->addWidget( shares_group, 0, 0, 0 );
+ shares_layout->addWidget( dnd_group, 1, 0, 0 );
+ shares_layout->addWidget( sharesTooltipGroup, 2, 0, 0 );
+ shares_layout->addWidget( list_view_group, 3, 0, 0 );
+ shares_layout->addItem( spacer3, 4, 0 );
+
+ //
+ // Configuration for the preview dialog
+ //
+ QWidget *preview_widget = new QWidget( this );
+ QGridLayout *preview_layout = new QGridLayout( preview_widget );
+ preview_layout->setSpacing( 10 );
+
+ QButtonGroup *previewFilesGroup = new QButtonGroup( 1, QButtonGroup::Horizontal, i18n( "Hidden Files and Directories" ), preview_widget, "HiddenFilesBox" );
+ (void) new QCheckBox( i18n( "Preview hidden files and directories" ), previewFilesGroup, "kcfg_PreviewHiddenItems" );
+
+ QSpacerItem *spacer4 = new QSpacerItem( 0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding );
+
+ preview_layout->addWidget( previewFilesGroup, 0, 0, 0 );
+ preview_layout->addItem( spacer4, 1, 0 );
+
+ //
+ // Add tabs:
+ //
+ addTab( main_wd_widget, i18n( "Main Window && System Tray" ) );
+ addTab( browser_widget, i18n( "Network Browser" ) );
+ addTab( shares_widget, i18n( "Shares View" ) );
+ addTab( preview_widget, i18n( "Preview Dialog" ) );
+
+ // Add connections:
+ connect( hidden, SIGNAL( stateChanged( int ) ),
+ this, SLOT( slotShowHiddenShares( int ) ) );
+
+ // Do last adjustments:
+ slotShowHiddenShares( hidden->state() );
+}
+
+
+Smb4KUserInterfaceOptions::~Smb4KUserInterfaceOptions()
+{
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// SLOT IMPLEMENTATIONS
+/////////////////////////////////////////////////////////////////////////////
+
+
+void Smb4KUserInterfaceOptions::slotShowHiddenShares( int state )
+{
+ if ( state == QCheckBox::On )
+ {
+ static_cast<QCheckBox *>( child( "kcfg_ShowHiddenIPCShares", "QCheckBox" ) )->setEnabled( true );
+ static_cast<QCheckBox *>( child( "kcfg_ShowHiddenADMINShares", "QCheckBox" ) )->setEnabled( true );
+ }
+ else if ( state == QCheckBox::Off )
+ {
+ static_cast<QCheckBox *>( child( "kcfg_ShowHiddenIPCShares", "QCheckBox" ) )->setEnabled( false );
+ static_cast<QCheckBox *>( child( "kcfg_ShowHiddenADMINShares", "QCheckBox" ) )->setEnabled( false );
+ }
+}
+
+#include "smb4kuserinterfaceoptions.moc"
diff --git a/smb4k/configdlg/smb4kuserinterfaceoptions.h b/smb4k/configdlg/smb4kuserinterfaceoptions.h
new file mode 100644
index 0000000..6fb7e64
--- /dev/null
+++ b/smb4k/configdlg/smb4kuserinterfaceoptions.h
@@ -0,0 +1,68 @@
+/***************************************************************************
+ smb4kuserinterfaceoptions - This configuration page takes care
+ of all settings concerning the user interface of Smb4K
+ -------------------
+ begin : Mi Aug 30 2006
+ copyright : (C) 2006-2007 by Alexander Reinholdt
+ email : dustpuppy@users.berlios.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef SMB4KUSERINTERFACEOPTIONS_H
+#define SMB4KUSERINTERFACEOPTIONS_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// Qt includes
+#include <qtabwidget.h>
+
+
+/**
+ * The configuration page for the user interface of Smb4K.
+ *
+ * @author Alexander Reinholdt <dustpuppy@mail.berlios.de>
+ */
+
+class Smb4KUserInterfaceOptions : public QTabWidget
+{
+ Q_OBJECT
+
+ public:
+ /**
+ * The constructor
+ */
+ Smb4KUserInterfaceOptions( QWidget *parent = 0, const char *name = 0 );
+
+ /**
+ * The destructor
+ */
+ ~Smb4KUserInterfaceOptions();
+
+ protected slots:
+ /**
+ * Enables/disables buttons according to the toggle state of the "Show hidden shares" button.
+ *
+ * @param state Describes the toggle state of the "Show hidden shares" checkbox.
+ */
+ void slotShowHiddenShares( int state );
+};
+
+#endif