Remove file buttons - not used for Samba, or sshfs (qt)

This commit is contained in:
craig.p.drummond
2012-12-11 20:08:44 +00:00
parent 43509b2a86
commit 881da0dff5
4 changed files with 14 additions and 94 deletions

View File

@@ -25,9 +25,6 @@
#include "filenameschemedialog.h"
#include "covers.h"
#include "localize.h"
#ifdef ENABLE_KDE_SUPPORT
#include <KDE/KDirSelectDialog>
#endif
#include <QtGui/QTabWidget>
#include <QtGui/QIcon>
#include "lineedit.h"
@@ -54,13 +51,6 @@ RemoteDevicePropertiesWidget::RemoteDevicePropertiesWidget(QWidget *parent)
type->addItem(i18n("Locally Mounted Folder"), (int)Type_File);
#ifdef ENABLE_MOUNTER
type->addItem(i18n("Samba Shares"), (int)Type_Samba);
smbFolderButton->setVisible(false);
#endif
#ifdef ENABLE_KDE_SUPPORT
sshFolderButton->setIcon(QIcon::fromTheme("document-open"));
fileFolder->setMode(KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly);
#else
sshFolderButton->setVisible(false);
#endif
}
@@ -127,9 +117,6 @@ void RemoteDevicePropertiesWidget::update(const RemoteFsDevice::Details &d, bool
connect(sshHost, SIGNAL(textChanged(const QString &)), this, SLOT(checkSaveable()));
connect(sshUser, SIGNAL(textChanged(const QString &)), this, SLOT(checkSaveable()));
connect(sshFolder, SIGNAL(textChanged(const QString &)), this, SLOT(checkSaveable()));
#ifdef ENABLE_KDE_SUPPORT
connect(sshFolderButton, SIGNAL(clicked()), this, SLOT(browseSftpFolder()));
#endif
connect(sshPort, SIGNAL(valueChanged(int)), this, SLOT(checkSaveable()));
connect(fileFolder, SIGNAL(textChanged(const QString &)), this, SLOT(checkSaveable()));
modified=false;
@@ -144,34 +131,11 @@ void RemoteDevicePropertiesWidget::setType()
}
}
#ifdef ENABLE_KDE_SUPPORT
void RemoteDevicePropertiesWidget::browseSftpFolder()
{
RemoteFsDevice::Details det=details();
KUrl start(det.protocol.isEmpty() ? det.path : ("sftp://"+(det.user.isEmpty() ? "" : (det.user+"@"))+
(det.host.isEmpty() ? "" : det.host)+
(0==det.port ? "" : (":"+QString::number(det.port)))+
det.path));
KUrl url=KDirSelectDialog::selectDirectory(start, false, this, i18n("Select Music Folder"));
if (url.isValid() && QLatin1String("sftp")==url.protocol()) {
sshHost->setText(url.host());
sshUser->setText(url.user());
sshPort->setValue(url.port());
sshFolder->setText(url.path());
}
}
#endif
void RemoteDevicePropertiesWidget::checkSaveable()
{
RemoteFsDevice::Details det=details();
modified=det!=orig;
saveable=!det.isEmpty();
#ifdef ENABLE_KDE_SUPPORT
sshFolderButton->setEnabled(!det.path.isEmpty() && !det.host.isEmpty() && 0!=det.port);
#endif
emit updated();
}

View File

@@ -47,9 +47,6 @@ Q_SIGNALS:
private Q_SLOTS:
void checkSaveable();
void setType();
#ifdef ENABLE_KDE_SUPPORT
void browseSftpFolder();
#endif
private:
RemoteFsDevice::Details orig;

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>388</height>
<width>403</width>
<height>369</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@@ -57,10 +57,7 @@
</property>
<widget class="QWidget" name="page">
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="1" column="0">
<item row="0" column="0">
<widget class="BuddyLabel" name="hostLabel">
<property name="text">
<string>Host:</string>
@@ -70,10 +67,10 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="0" column="1">
<widget class="LineEdit" name="sshHost"/>
</item>
<item row="2" column="0">
<item row="1" column="0">
<widget class="BuddyLabel" name="portLabel">
<property name="text">
<string>Port:</string>
@@ -83,14 +80,14 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="1" column="1">
<widget class="SpinBox" name="sshPort">
<property name="maximum">
<number>65535</number>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="2" column="0">
<widget class="BuddyLabel" name="userLabel">
<property name="text">
<string>User:</string>
@@ -100,10 +97,10 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="2" column="1">
<widget class="LineEdit" name="sshUser"/>
</item>
<item row="4" column="0">
<item row="3" column="0">
<widget class="BuddyLabel" name="folderLabel">
<property name="text">
<string>Folder:</string>
@@ -113,19 +110,8 @@
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="folderLayout">
<item>
<widget class="LineEdit" name="sshFolder"/>
</item>
<item>
<widget class="QToolButton" name="sshFolderButton">
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
<item row="3" column="1">
<widget class="LineEdit" name="sshFolder"/>
</item>
</layout>
</widget>
@@ -222,34 +208,7 @@
</widget>
</item>
<item row="5" column="1">
<layout class="QHBoxLayout" name="folderLayout_2">
<item>
<widget class="LineEdit" name="smbFolder"/>
</item>
<item>
<widget class="QToolButton" name="smbFolderButton">
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>2</width>
<height>8</height>
</size>
</property>
</spacer>
<widget class="LineEdit" name="smbFolder"/>
</item>
</layout>
</widget>

View File

@@ -441,7 +441,7 @@ void RemoteFsDevice::mountStatus(const QString &mp, int pid, int st)
}
}
#else
Q_UNUSED(src)
Q_UNUSED(mp)
Q_UNUSED(pid)
Q_UNUSED(st)
#endif
@@ -462,7 +462,7 @@ void RemoteFsDevice::umountStatus(const QString &mp, int pid, int st)
}
}
#else
Q_UNUSED(src)
Q_UNUSED(mp)
Q_UNUSED(pid)
Q_UNUSED(st)
#endif