mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 02:42:50 +00:00
kdirshare: stop the server if service publishing fails
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
31afa6c691
commit
2bfbd1ab66
2 changed files with 4 additions and 2 deletions
|
@ -72,6 +72,7 @@ QString KDirShareModule::share(const QString &dirpath)
|
||||||
return i18n("Could not serve: %1", kdirshareimpl->errorString());
|
return i18n("Could not serve: %1", kdirshareimpl->errorString());
|
||||||
}
|
}
|
||||||
if (!kdirshareimpl->publishService()) {
|
if (!kdirshareimpl->publishService()) {
|
||||||
|
kdirshareimpl->stop();
|
||||||
kdirshareimpl->deleteLater();
|
kdirshareimpl->deleteLater();
|
||||||
return i18n("Could not publish service for: %1", dirpath);
|
return i18n("Could not publish service for: %1", dirpath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <kmimetype.h>
|
#include <kmimetype.h>
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
|
|
||||||
|
static const QDir::SortFlags s_dirsortflags = (QDir::Name | QDir::DirsFirst);
|
||||||
|
|
||||||
static QByteArray contentForDirectory(const QString &path, const QString &basedir)
|
static QByteArray contentForDirectory(const QString &path, const QString &basedir)
|
||||||
{
|
{
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
|
@ -42,9 +44,8 @@ static QByteArray contentForDirectory(const QString &path, const QString &basedi
|
||||||
if (QDir::cleanPath(path) == QDir::cleanPath(basedir)) {
|
if (QDir::cleanPath(path) == QDir::cleanPath(basedir)) {
|
||||||
dirfilters = (QDir::Files | QDir::AllDirs | QDir::NoDotAndDotDot);
|
dirfilters = (QDir::Files | QDir::AllDirs | QDir::NoDotAndDotDot);
|
||||||
}
|
}
|
||||||
const QDir::SortFlags dirsortflags = (QDir::Name | QDir::DirsFirst);
|
|
||||||
QDir dir(path);
|
QDir dir(path);
|
||||||
foreach (const QFileInfo &fileinfo, dir.entryInfoList(dirfilters, dirsortflags)) {
|
foreach (const QFileInfo &fileinfo, dir.entryInfoList(dirfilters, s_dirsortflags)) {
|
||||||
const QString fullpath = path.toLocal8Bit() + QLatin1Char('/') + fileinfo.fileName();
|
const QString fullpath = path.toLocal8Bit() + QLatin1Char('/') + fileinfo.fileName();
|
||||||
// chromium does weird stuff if the link starts with two slashes - removes, the host and
|
// chromium does weird stuff if the link starts with two slashes - removes, the host and
|
||||||
// port part of the link (or rather does not prepend them) and converts the first directory
|
// port part of the link (or rather does not prepend them) and converts the first directory
|
||||||
|
|
Loading…
Add table
Reference in a new issue