- Default to Samba/sshfs

- Use 'Share' for samba, not path
This commit is contained in:
craig.p.drummond
2012-12-18 19:34:03 +00:00
parent a6454c3564
commit 75bba8f687
2 changed files with 98 additions and 92 deletions

View File

@@ -31,11 +31,11 @@
#include "config.h"
enum Type {
#ifdef ENABLE_MOUNTER
Type_Samba,
#endif
Type_SshFs,
Type_File
#ifdef ENABLE_MOUNTER
, Type_Samba
#endif
};
RemoteDevicePropertiesWidget::RemoteDevicePropertiesWidget(QWidget *parent)
@@ -47,19 +47,19 @@ RemoteDevicePropertiesWidget::RemoteDevicePropertiesWidget(QWidget *parent)
if (qobject_cast<QTabWidget *>(parent)) {
verticalLayout->setMargin(4);
}
#ifdef ENABLE_MOUNTER
type->addItem(i18n("Samba Share"), (int)Type_Samba);
#endif
type->addItem(i18n("Secure Shell (sshfs)"), (int)Type_SshFs);
type->addItem(i18n("Locally Mounted Folder"), (int)Type_File);
#ifdef ENABLE_MOUNTER
type->addItem(i18n("Samba Shares"), (int)Type_Samba);
#endif
}
void RemoteDevicePropertiesWidget::update(const RemoteFsDevice::Details &d, bool create, bool isConnected)
{
#ifdef ENABLE_MOUNTER
int t=d.isLocalFile() ? Type_File : (d.url.scheme()==RemoteFsDevice::constSshfsProtocol ? Type_SshFs : Type_Samba);
int t=create ? Type_Samba : (d.isLocalFile() ? Type_File : (d.url.scheme()==RemoteFsDevice::constSshfsProtocol ? Type_SshFs : Type_Samba));
#else
int t=d.isLocalFile() ? Type_File : Type_SshFs;
int t=create ? Type_SshFs : (d.isLocalFile() ? Type_File : Type_SshFs);
#endif
setEnabled(d.isLocalFile() || !isConnected);
infoLabel->setVisible(create);
@@ -88,7 +88,7 @@ void RemoteDevicePropertiesWidget::update(const RemoteFsDevice::Details &d, bool
break;
#ifdef ENABLE_MOUNTER
case Type_Samba: {
smbFolder->setText(d.url.path());
smbShare->setText(d.url.path());
smbPort->setValue(d.url.port());
smbHost->setText(d.url.host());
smbUser->setText(d.url.userName());
@@ -167,7 +167,7 @@ RemoteFsDevice::Details RemoteDevicePropertiesWidget::details()
case Type_Samba:
det.url.setHost(smbHost->text().trimmed());
det.url.setUserName(smbUser->text().trimmed());
det.url.setPath(smbFolder->text().trimmed());
det.url.setPath(smbShare->text().trimmed());
det.url.setPort(smbPort->value());
det.url.setScheme(RemoteFsDevice::constSambaProtocol);
det.url.setPassword(smbPassword->text().trimmed());

View File

@@ -55,7 +55,93 @@
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page">
<widget class="QWidget" name="smbPage">
<layout class="QFormLayout" name="formLayout_4">
<item row="0" column="0">
<widget class="BuddyLabel" name="hostLabel_2">
<property name="text">
<string>Host:</string>
</property>
<property name="buddy">
<cstring>smbHost</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="LineEdit" name="smbHost"/>
</item>
<item row="1" column="0">
<widget class="BuddyLabel" name="portLabel_2">
<property name="text">
<string>Port:</string>
</property>
<property name="buddy">
<cstring>smbPort</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="SpinBox" name="smbPort">
<property name="maximum">
<number>65535</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="BuddyLabel" name="userLabel_2">
<property name="text">
<string>User:</string>
</property>
<property name="buddy">
<cstring>smbUser</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="LineEdit" name="smbUser"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Domain:</string>
</property>
<property name="buddy">
<cstring>smbDomain</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="LineEdit" name="smbDomain"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Password:</string>
</property>
<property name="buddy">
<cstring>smbPassword</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="LineEdit" name="smbPassword"/>
</item>
<item row="5" column="0">
<widget class="BuddyLabel" name="folderLabel_2">
<property name="text">
<string>Share:</string>
</property>
<property name="buddy">
<cstring>smbShare</cstring>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="LineEdit" name="smbShare"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="sshPage">
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="BuddyLabel" name="hostLabel">
@@ -115,7 +201,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2">
<widget class="QWidget" name="filePage">
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label">
@@ -132,86 +218,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="page_3">
<layout class="QFormLayout" name="formLayout_4">
<item row="0" column="0">
<widget class="BuddyLabel" name="hostLabel_2">
<property name="text">
<string>Host:</string>
</property>
<property name="buddy">
<cstring>sshHost</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="LineEdit" name="smbHost"/>
</item>
<item row="1" column="0">
<widget class="BuddyLabel" name="portLabel_2">
<property name="text">
<string>Port:</string>
</property>
<property name="buddy">
<cstring>sshPort</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="SpinBox" name="smbPort">
<property name="maximum">
<number>65535</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="BuddyLabel" name="userLabel_2">
<property name="text">
<string>User:</string>
</property>
<property name="buddy">
<cstring>sshUser</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="LineEdit" name="smbUser"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Domain:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="LineEdit" name="smbDomain"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Password:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="LineEdit" name="smbPassword"/>
</item>
<item row="5" column="0">
<widget class="BuddyLabel" name="folderLabel_2">
<property name="text">
<string>Folder:</string>
</property>
<property name="buddy">
<cstring>sshFolder</cstring>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="LineEdit" name="smbFolder"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>