Prompt for samba password, if entry has -
This commit is contained in:
@@ -6,21 +6,21 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>403</width>
|
||||
<height>369</height>
|
||||
<width>516</width>
|
||||
<height>447</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="connectionNote">
|
||||
<property name="text">
|
||||
<string><i><b>NOTE:</b> These settings are only editable when the device is not connected.</i></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="connectionNote">
|
||||
<property name="text">
|
||||
<string><i><b>NOTE:</b> These settings are only editable when the device is not connected.</i></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
@@ -66,148 +66,202 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="smbPage">
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="BuddyLabel" name="hostLabel_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<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>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Host:</string>
|
||||
<string><i><b>NOTE:</b> If you enter a password here, it will be stored <b>unencrypted</b> in Cantata's config file. To have Cantata prompt for the password before accessing the share, set the password to '-'</i></string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>smbHost</cstring>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</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>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>smbPort</cstring>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>14</height>
|
||||
</size>
|
||||
</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"/>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="sshPage">
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="BuddyLabel" name="hostLabel">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="BuddyLabel" name="hostLabel">
|
||||
<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="sshHost"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="BuddyLabel" name="portLabel">
|
||||
<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="sshPort">
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="BuddyLabel" name="userLabel">
|
||||
<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="sshUser"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="BuddyLabel" name="folderLabel">
|
||||
<property name="text">
|
||||
<string>Folder:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>sshFolder</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="LineEdit" name="sshFolder"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Host:</string>
|
||||
<string><i><b>NOTE:</b> Due to the way sshfs works, a suitable ssh-askpass application (ksshaskpass, ssh-askpass-gnome, etc.) will be required to enter the password..</i></string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>sshHost</cstring>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LineEdit" name="sshHost"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="BuddyLabel" name="portLabel">
|
||||
<property name="text">
|
||||
<string>Port:</string>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>sshPort</cstring>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>78</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="SpinBox" name="sshPort">
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="BuddyLabel" name="userLabel">
|
||||
<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="sshUser"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="BuddyLabel" name="folderLabel">
|
||||
<property name="text">
|
||||
<string>Folder:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>sshFolder</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="LineEdit" name="sshFolder"/>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "remotedevicepropertiesdialog.h"
|
||||
#include "devicepropertieswidget.h"
|
||||
#include "actiondialog.h"
|
||||
#include "inputdialog.h"
|
||||
#include "utils.h"
|
||||
#include "httpserver.h"
|
||||
#include "localize.h"
|
||||
@@ -46,6 +47,7 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
const QLatin1String RemoteFsDevice::constPromptPassword("-");
|
||||
const QLatin1String RemoteFsDevice::constSshfsProtocol("sshfs");
|
||||
const QLatin1String RemoteFsDevice::constFileProtocol("file");
|
||||
#ifdef ENABLE_MOUNTER
|
||||
@@ -304,7 +306,16 @@ void RemoteFsDevice::mount()
|
||||
return;
|
||||
}
|
||||
if (constSambaProtocol==details.url.scheme()) {
|
||||
mounter()->mount(details.url.toString(), mountPoint(details, true), getuid(), getgid(), getpid());
|
||||
Details det=details;
|
||||
if (constPromptPassword==det.url.password()) {
|
||||
bool ok=false;
|
||||
QString passwd=InputDialog::getPassword(QString(), &ok, QApplication::activeWindow());
|
||||
if (!ok) {
|
||||
return;
|
||||
}
|
||||
det.url.setPassword(passwd);
|
||||
}
|
||||
mounter()->mount(det.url.toString(), mountPoint(details, true), getuid(), getgid(), getpid());
|
||||
setStatusMessage(i18n("Connecting..."));
|
||||
messageSent=true;
|
||||
return;
|
||||
|
||||
@@ -62,6 +62,7 @@ public:
|
||||
bool configured;
|
||||
};
|
||||
|
||||
static const QLatin1String constPromptPassword;
|
||||
static const QLatin1String constSshfsProtocol;
|
||||
static const QLatin1String constFileProtocol;
|
||||
#ifdef ENABLE_MOUNTER
|
||||
|
||||
@@ -24,24 +24,35 @@
|
||||
#ifndef INPUT_DIALOG_H
|
||||
#define INPUT_DIALOG_H
|
||||
|
||||
#include <QtGui/QInputDialog>
|
||||
#ifdef ENABLE_KDE_SUPPORT
|
||||
#include <KDE/KInputDialog>
|
||||
#define InputDialog KInputDialog
|
||||
#else
|
||||
#include <QtGui/QInputDialog>
|
||||
#endif
|
||||
#include "localize.h"
|
||||
|
||||
namespace InputDialog
|
||||
{
|
||||
inline QString getText(const QString &caption, const QString &label, const QString &value=QString(), bool *ok=0, QWidget *parent=0) {
|
||||
#ifdef ENABLE_KDE_SUPPORT
|
||||
return KInputDialog::getText(caption, label, value, ok, parent=0);
|
||||
#else
|
||||
return QInputDialog::getText(parent, caption, label, QLineEdit::Normal, value, ok);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline int getInteger(const QString &caption, const QString &label, int value=0, int minValue=INT_MIN, int maxValue=INT_MAX,
|
||||
int step=1, int base=10, bool *ok=0, QWidget *parent=0) {
|
||||
#ifdef ENABLE_KDE_SUPPORT
|
||||
return KInputDialog::getInteger(caption, label, value, minValue, maxValue, step, base, ok, parent);
|
||||
#else
|
||||
Q_UNUSED(base)
|
||||
return QInputDialog::getInt(parent, caption, label, value, minValue, maxValue, step, ok);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline QString getPassword(const QString &value=QString(), bool *ok=0, QWidget *parent=0) {
|
||||
return QInputDialog::getText(parent, i18n("Password"), i18n("Please enter password:"), QLineEdit::Password, value, ok);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // URLLABEL_H
|
||||
#endif // INPUT_DIALOG_H
|
||||
|
||||
Reference in New Issue
Block a user