110
116
label->setWordWrap( true );
111
117
label->setAlignment( Qt::AlignBottom );
113
119
desc_layout->addWidget( pixmap, 0 );
114
120
desc_layout->addWidget( label, Qt::AlignBottom );
116
QWidget *editors = new QWidget( main_widget );
118
QGridLayout *editors_layout = new QGridLayout( editors );
119
editors_layout->setSpacing( 5 );
120
editors_layout->setMargin( 0 );
122
QLabel *unc_label = new QLabel( i18n( "UNC Address:" ), editors );
123
KLineEdit *unc = NULL;
125
switch ( m_options->type() )
127
case Smb4KCustomOptions::Host:
129
unc = new KLineEdit( m_options->host()->unc(), editors );
132
case Smb4KCustomOptions::Share:
134
unc = new KLineEdit( m_options->share()->unc(), editors );
122
QGroupBox *general = new QGroupBox( i18n( "General" ), main_widget );
124
QGridLayout *general_layout = new QGridLayout( general );
125
general_layout->setSpacing( 5 );
127
QLabel *unc_label = new QLabel( i18n( "UNC Address:" ), general );
128
KLineEdit *unc = new KLineEdit( m_options->unc(), general );
142
129
unc->setReadOnly( true );
144
QLabel *smb_label = new QLabel( i18n( "SMB Port:" ), editors );
131
QLabel *ip_label = new QLabel( i18n( "IP Address:" ), general );
132
KLineEdit *ip = new KLineEdit( m_options->ip(), general );
133
ip->setReadOnly( true );
135
general_layout->addWidget( unc_label, 0, 0, 0 );
136
general_layout->addWidget( unc, 0, 1, 0 );
137
general_layout->addWidget( ip_label, 1, 0, 0 );
138
general_layout->addWidget( ip, 1, 1, 0 );
142
// Tab widget with settings
145
KTabWidget *tab_widget = new KTabWidget( main_widget );
148
// Custom options for Samba
151
QWidget *samba_editors = new QWidget( tab_widget );
153
QGridLayout *samba_editors_layout = new QGridLayout( samba_editors );
154
samba_editors_layout->setSpacing( 5 );
156
QLabel *smb_label = new QLabel( i18n( "SMB Port:" ), samba_editors );
145
157
m_smb_port = new KIntNumInput( (m_options->smbPort() != Smb4KSettings::remoteSMBPort() ?
146
m_options->smbPort() : Smb4KSettings::remoteSMBPort()), editors );
158
m_options->smbPort() : Smb4KSettings::remoteSMBPort()), samba_editors );
147
159
m_smb_port->setRange( Smb4KSettings::self()->remoteSMBPortItem()->minValue().toInt(),
148
160
Smb4KSettings::self()->remoteSMBPortItem()->maxValue().toInt() );
149
161
m_smb_port->setSliderEnabled( true );
162
smb_label->setBuddy( m_smb_port );
151
164
#ifndef Q_OS_FREEBSD
152
QLabel *fs_label = new QLabel( i18n( "Filesystem Port:" ), editors );
153
m_fs_port = new KIntNumInput( (m_options->fileSystemPort() != Smb4KSettings::remoteFileSystemPort() ?
154
m_options->fileSystemPort() : Smb4KSettings::remoteFileSystemPort()), editors );
165
QLabel *fs_label = new QLabel( i18n( "Filesystem Port:" ), samba_editors );
166
m_fs_port = new KIntNumInput( (m_options->fileSystemPort() != Smb4KSettings::remoteFileSystemPort() ?
167
m_options->fileSystemPort() : Smb4KSettings::remoteFileSystemPort()), samba_editors );
155
168
m_fs_port->setRange( Smb4KSettings::self()->remoteFileSystemPortItem()->minValue().toInt(),
156
169
Smb4KSettings::self()->remoteFileSystemPortItem()->maxValue().toInt() );
157
170
m_fs_port->setSliderEnabled( true );
159
QLabel *rw_label = new QLabel( i18n( "Write Access:" ), editors );
160
m_write_access = new KComboBox( editors );
171
fs_label->setBuddy( m_fs_port );
173
QLabel *rw_label = new QLabel( i18n( "Write Access:" ), samba_editors );
174
m_write_access = new KComboBox( samba_editors );
161
175
m_write_access->insertItem( 0, Smb4KSettings::self()->writeAccessItem()->choices()
162
.value( Smb4KSettings::EnumWriteAccess::ReadWrite ).label,
176
.value( Smb4KSettings::EnumWriteAccess::ReadWrite ).label,
163
177
QVariant::fromValue<int>( Smb4KCustomOptions::ReadWrite ) );
164
178
m_write_access->insertItem( 1, Smb4KSettings::self()->writeAccessItem()->choices()
165
.value( Smb4KSettings::EnumWriteAccess::ReadOnly ).label,
179
.value( Smb4KSettings::EnumWriteAccess::ReadOnly ).label,
166
180
QVariant::fromValue<int>( Smb4KCustomOptions::ReadOnly ) );
181
rw_label->setBuddy( m_write_access );
168
183
if ( m_options->writeAccess() == Smb4KCustomOptions::UndefinedWriteAccess )
170
185
switch ( Smb4KSettings::writeAccess() )
224
QLabel *security_label = new QLabel( i18n( "Security Mode:" ), samba_editors );
226
m_security_mode = new KComboBox( samba_editors );
227
m_security_mode->insertItem( 0, Smb4KSettings::self()->securityModeItem()->choices().value( Smb4KSettings::EnumSecurityMode::None ).label,
228
QVariant::fromValue<int>( Smb4KCustomOptions::NoSecurityMode ) );
229
m_security_mode->insertItem( 1, Smb4KSettings::self()->securityModeItem()->choices().value( Smb4KSettings::EnumSecurityMode::Krb5 ).label,
230
QVariant::fromValue<int>( Smb4KCustomOptions::Krb5 ) );
231
m_security_mode->insertItem( 2, Smb4KSettings::self()->securityModeItem()->choices().value( Smb4KSettings::EnumSecurityMode::Krb5i ).label,
232
QVariant::fromValue<int>( Smb4KCustomOptions::Krb5i ) );
233
m_security_mode->insertItem( 3, Smb4KSettings::self()->securityModeItem()->choices().value( Smb4KSettings::EnumSecurityMode::Ntlm ).label,
234
QVariant::fromValue<int>( Smb4KCustomOptions::Ntlm ) );
235
m_security_mode->insertItem( 4, Smb4KSettings::self()->securityModeItem()->choices().value( Smb4KSettings::EnumSecurityMode::Ntlmi ).label,
236
QVariant::fromValue<int>( Smb4KCustomOptions::Ntlmi ) );
237
m_security_mode->insertItem( 5, Smb4KSettings::self()->securityModeItem()->choices().value( Smb4KSettings::EnumSecurityMode::Ntlmv2 ).label,
238
QVariant::fromValue<int>( Smb4KCustomOptions::Ntlmv2 ) );
239
m_security_mode->insertItem( 6, Smb4KSettings::self()->securityModeItem()->choices().value( Smb4KSettings::EnumSecurityMode::Ntlmv2i ).label,
240
QVariant::fromValue<int>( Smb4KCustomOptions::Ntlmv2i ) );
241
m_security_mode->insertItem( 7, Smb4KSettings::self()->securityModeItem()->choices().value( Smb4KSettings::EnumSecurityMode::Ntlmssp ).label,
242
QVariant::fromValue<int>( Smb4KCustomOptions::Ntlmssp ) );
243
m_security_mode->insertItem( 8, Smb4KSettings::self()->securityModeItem()->choices().value( Smb4KSettings::EnumSecurityMode::Ntlmsspi ).label,
244
QVariant::fromValue<int>( Smb4KCustomOptions::Ntlmsspi ) );
245
security_label->setBuddy( m_security_mode );
247
if ( m_options->securityMode() == Smb4KCustomOptions::UndefinedSecurityMode )
249
switch ( Smb4KSettings::securityMode() )
251
case Smb4KSettings::EnumSecurityMode::None:
253
m_security_mode->setCurrentIndex( 0 );
256
case Smb4KSettings::EnumSecurityMode::Krb5:
258
m_security_mode->setCurrentIndex( 1 );
261
case Smb4KSettings::EnumSecurityMode::Krb5i:
263
m_security_mode->setCurrentIndex( 2 );
266
case Smb4KSettings::EnumSecurityMode::Ntlm:
268
m_security_mode->setCurrentIndex( 3 );
271
case Smb4KSettings::EnumSecurityMode::Ntlmi:
273
m_security_mode->setCurrentIndex( 4 );
276
case Smb4KSettings::EnumSecurityMode::Ntlmv2:
278
m_security_mode->setCurrentIndex( 5 );
281
case Smb4KSettings::EnumSecurityMode::Ntlmv2i:
283
m_security_mode->setCurrentIndex( 6 );
286
case Smb4KSettings::EnumSecurityMode::Ntlmssp:
288
m_security_mode->setCurrentIndex( 7 );
291
case Smb4KSettings::EnumSecurityMode::Ntlmsspi:
293
m_security_mode->setCurrentIndex( 8 );
304
switch ( m_options->securityMode() )
306
case Smb4KCustomOptions::NoSecurityMode:
308
m_security_mode->setCurrentIndex( 0 );
311
case Smb4KCustomOptions::Krb5:
313
m_security_mode->setCurrentIndex( 1 );
316
case Smb4KCustomOptions::Krb5i:
318
m_security_mode->setCurrentIndex( 2 );
321
case Smb4KCustomOptions::Ntlm:
323
m_security_mode->setCurrentIndex( 3 );
326
case Smb4KCustomOptions::Ntlmi:
328
m_security_mode->setCurrentIndex( 4 );
331
case Smb4KCustomOptions::Ntlmv2:
333
m_security_mode->setCurrentIndex( 5 );
336
case Smb4KCustomOptions::Ntlmv2i:
338
m_security_mode->setCurrentIndex( 6 );
341
case Smb4KCustomOptions::Ntlmssp:
343
m_security_mode->setCurrentIndex( 7 );
346
case Smb4KCustomOptions::Ntlmsspi:
348
m_security_mode->setCurrentIndex( 8 );
210
QLabel *protocol_label = new QLabel( i18n( "Protocol Hint:" ), editors );
211
m_protocol_hint = new KComboBox( editors );
359
QLabel *protocol_label = new QLabel( i18n( "Protocol Hint:" ), samba_editors );
360
m_protocol_hint = new KComboBox( samba_editors );
212
361
m_protocol_hint->insertItem( 0, Smb4KSettings::self()->protocolHintItem()->choices()
213
362
.value( Smb4KSettings::EnumProtocolHint::Automatic ).label,
214
363
QVariant::fromValue<int>( Smb4KCustomOptions::Automatic ) );
351
editors_layout->addWidget( unc_label, 0, 0, 0 );
352
editors_layout->addWidget( unc, 0, 1, 0 );
353
editors_layout->addWidget( smb_label, 1, 0, 0 );
354
editors_layout->addWidget( m_smb_port, 1, 1, 0 );
509
samba_editors_layout->addWidget( smb_label, 0, 0, 0 );
510
samba_editors_layout->addWidget( m_smb_port, 0, 1, 0 );
355
511
#ifndef Q_OS_FREEBSD
356
editors_layout->addWidget( fs_label, 2, 0, 0 );
357
editors_layout->addWidget( m_fs_port, 2, 1, 0 );
358
editors_layout->addWidget( rw_label, 3, 0, 0 );
359
editors_layout->addWidget( m_write_access, 3, 1, 0 );
360
editors_layout->addWidget( protocol_label, 4, 0, 0 );
361
editors_layout->addWidget( m_protocol_hint, 4, 1, 0 );
362
editors_layout->addWidget( uid_label, 5, 0, 0 );
363
editors_layout->addWidget( m_user_id, 5, 1, 0 );
364
editors_layout->addWidget( gid_label, 6, 0, 0 );
365
editors_layout->addWidget( m_group_id, 6, 1, 0 );
366
editors_layout->addWidget( m_kerberos, 7, 0, 1, 2, 0 );
512
samba_editors_layout->addWidget( fs_label, 1, 0, 0 );
513
samba_editors_layout->addWidget( m_fs_port, 1, 1, 0 );
514
samba_editors_layout->addWidget( rw_label, 2, 0, 0 );
515
samba_editors_layout->addWidget( m_write_access, 2, 1, 0 );
516
samba_editors_layout->addWidget( security_label, 3, 0, 0 );
517
samba_editors_layout->addWidget( m_security_mode, 3, 1, 0 );
518
samba_editors_layout->addWidget( protocol_label, 4, 0, 0 );
519
samba_editors_layout->addWidget( m_protocol_hint, 4, 1, 0 );
520
samba_editors_layout->addWidget( uid_label, 5, 0, 0 );
521
samba_editors_layout->addWidget( m_user_id, 5, 1, 0 );
522
samba_editors_layout->addWidget( gid_label, 6, 0, 0 );
523
samba_editors_layout->addWidget( m_group_id, 6, 1, 0 );
524
samba_editors_layout->addWidget( m_kerberos, 7, 0, 1, 2, 0 );
368
editors_layout->addWidget( protocol_label, 2, 0, 0 );
369
editors_layout->addWidget( m_protocol_hint, 2, 1, 0 );
370
editors_layout->addWidget( uid_label, 3, 0, 0 );
371
editors_layout->addWidget( m_user_id, 3, 1, 0 );
372
editors_layout->addWidget( gid_label, 4, 0, 0 );
373
editors_layout->addWidget( m_group_id, 4, 1, 0 );
374
editors_layout->addWidget( m_kerberos, 5, 0, 1, 2, 0 );
526
samba_editors_layout->addWidget( protocol_label, 1, 0, 0 );
527
samba_editors_layout->addWidget( m_protocol_hint, 1, 1, 0 );
528
samba_editors_layout->addWidget( uid_label, 2, 0, 0 );
529
samba_editors_layout->addWidget( m_user_id, 2, 1, 0 );
530
samba_editors_layout->addWidget( gid_label, 3, 0, 0 );
531
samba_editors_layout->addWidget( m_group_id, 3, 1, 0 );
532
samba_editors_layout->addWidget( m_kerberos, 4, 0, 1, 2, 0 );
535
tab_widget->addTab( samba_editors, i18n( "Samba" ) );
539
// Custom options for Wake-On-LAN
542
QWidget *wol_editors = new QWidget( tab_widget );
544
QGridLayout *wol_editors_layout = new QGridLayout( wol_editors );
545
wol_editors_layout->setSpacing( 5 );
547
QLabel *mac_label = new QLabel( i18n( "MAC Address:" ), wol_editors );
548
m_mac_address = new KLineEdit( m_options->macAddress(), wol_editors );
549
mac_label->setBuddy( m_mac_address );
551
// If you change the texts here, please also alter them in the config
553
m_send_before_scan = new QCheckBox( i18n( "Send magic package before scanning the network neighborhood" ), wol_editors );
554
m_send_before_scan->setChecked( m_options->wolSendBeforeNetworkScan() );
555
m_send_before_scan->setEnabled( (m_options->type() == Smb4KCustomOptions::Host) );
557
m_send_before_mount = new QCheckBox( i18n( "Send magic package before mounting a share" ), wol_editors );
558
m_send_before_mount->setChecked( m_options->wolSendBeforeMount() );
559
m_send_before_mount->setEnabled( (m_options->type() == Smb4KCustomOptions::Host) );
561
wol_editors_layout->addWidget( mac_label, 0, 0, 0 );
562
wol_editors_layout->addWidget( m_mac_address, 0, 1, 0 );
563
wol_editors_layout->addWidget( m_send_before_scan, 1, 0, 1, 2, 0 );
564
wol_editors_layout->addWidget( m_send_before_mount, 2, 0, 1, 2, 0 );
565
wol_editors_layout->setRowStretch( 3, 100 );
567
tab_widget->addTab( wol_editors, i18n( "Wake-On-LAN" ) );
377
569
layout->addWidget( description );
378
layout->addWidget( editors );
380
connect( m_smb_port, SIGNAL( valueChanged( int ) ), SLOT( slotCheckValues() ) );
570
layout->addWidget( general );
571
layout->addWidget( tab_widget );
573
connect( m_smb_port, SIGNAL(valueChanged(int)), SLOT(slotCheckValues()) );
381
574
#ifndef Q_OS_FREEBSD
382
connect( m_fs_port, SIGNAL( valueChanged(int) ), SLOT( slotCheckValues() ) );
383
connect( m_write_access, SIGNAL( currentIndexChanged( int ) ), SLOT( slotCheckValues() ) );
575
connect( m_fs_port, SIGNAL(valueChanged(int)), SLOT(slotCheckValues()) );
576
connect( m_write_access, SIGNAL(currentIndexChanged(int)), SLOT(slotCheckValues()) );
577
connect( m_security_mode, SIGNAL(currentIndexChanged(int)), SLOT(slotCheckValues()) );
385
connect( m_protocol_hint, SIGNAL( currentIndexChanged( int ) ), SLOT( slotCheckValues() ) );
386
connect( m_user_id, SIGNAL( currentIndexChanged( int ) ), SLOT( slotCheckValues() ) );
387
connect( m_group_id, SIGNAL( currentIndexChanged( int ) ), SLOT( slotCheckValues() ) );
388
connect( m_kerberos, SIGNAL( toggled( bool ) ), SLOT( slotCheckValues() ) );
579
connect( m_protocol_hint, SIGNAL(currentIndexChanged(int)), SLOT(slotCheckValues()) );
580
connect( m_user_id, SIGNAL(currentIndexChanged(int)), SLOT(slotCheckValues()) );
581
connect( m_group_id, SIGNAL(currentIndexChanged(int)), SLOT(slotCheckValues()) );
582
connect( m_kerberos, SIGNAL(toggled(bool)), SLOT(slotCheckValues()) );
583
connect( m_mac_address, SIGNAL(textChanged(QString)), SLOT(slotCheckValues()) );
584
connect( m_mac_address, SIGNAL(textChanged(QString)), SLOT(slotEnableWOLFeatures(QString)) );
585
connect( m_send_before_scan, SIGNAL(toggled(bool)), SLOT(slotCheckValues()) );
586
connect( m_send_before_mount, SIGNAL(toggled(bool)), SLOT(slotCheckValues()) );
588
wol_editors->setEnabled( (m_options->type() == Smb4KCustomOptions::Host && Smb4KSettings::enableWakeOnLAN()) );
390
590
enableButton( User1, !defaultValues() );