KIO
Go to the documentation of this file.
22 #include <QtCore/QDir>
23 #include <QtCore/QFile>
24 #include <QtCore/Q_PID>
45 #define FILESHARECONF "/etc/security/fileshare.conf"
47 static QString
findExe(
const char* exeName )
51 QString path = QString::fromLocal8Bit(qgetenv(
"PATH"));
53 path += QLatin1String(
":/usr/sbin");
57 kError() << exeName <<
"not found in" << path;
94 const QByteArray data=cg.
readEntry(key, QByteArray());
96 if (!data.isEmpty()) {
97 if (data.toLower() ==
"simple")
99 else if (data.toLower() ==
"advanced")
186 s_shareList->clear();
188 QString exe =
::findExe(
"filesharelist" );
194 proc.start( exe, QStringList() );
195 if ( !proc.waitForFinished() ) {
196 kError() <<
"Can't run" << exe;
202 while (!proc.atEnd()) {
203 QString line = proc.readLine().trimmed();
204 int length = line.length();
207 if ( line[length-1] !=
'/' )
209 s_shareList->append(line);
210 kDebug(7000) <<
"Shared dir:" << line;
218 if ( ! s_shareList.exists() )
221 QString path( _path );
222 if ( path[path.length()-1] !=
'/' )
224 return s_shareList->contains( path );
241 kDebug(7000) << path <<
"," << shared;
242 QString exe =
::findExe(
"fileshareset" );
252 int ec = QProcess::execute( exe, args );
253 kDebug(7000) <<
"exitCode=" << ec;
292 #include "kfileshare_p.moc"
ShareMode shareMode()
Returns the configured share mode.
ShareMode
The used share mode.
QString fileShareGroup()
Returns the group that is used for file sharing.
static KFileShare::ShareMode s_shareMode
void readConfig()
Reads the file share configuration file.
static QDebug kError(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
void addFile(const QString &file)
TsConfig readConfig(const QString &fname)
bool isRestricted()
Returns whether file sharing is restricted.
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
static bool s_sharingEnabled
static QString findExe(const char *exeName)
bool nfsEnabled()
Returns whether NFS is enabled.
static QString findExe(const QString &appname, const QString &pathstr=QString(), SearchOptions options=NoSearchOptions)
static bool s_sambaEnabled
KFileShare::ShareMode readEntry(const KConfigGroup &cg, const char *key, const KFileShare::ShareMode &aDefault)
bool sambaEnabled()
Returns whether Samba is enabled.
static QString s_fileShareGroup
void removeFile(const QString &file)
KSharedConfigPtr config()
static KDirWatch * self()
bool sharingEnabled()
Returns whether sharing is enabled If this is false, file sharing is disabled and nobody can share fi...
static KFileSharePrivate * self()
void readShareList()
Reads the list of shared folders.
static KFileShare::Authorization s_authorization
Common functionality for the file sharing (communication with the backend)
QList< KUser > users() const
bool setShared(const QString &path, bool shared)
Uses a suid perl script to share the given path with NFS and Samba.
bool isDirectoryShared(const QString &path)
Call this to know if a directory is currently shared.
#define K_GLOBAL_STATIC(TYPE, NAME)
Authorization authorization()
Call this to know if the current user is authorized to share directories.
void slotFileChange(const QString &)
QString readEntry(const char *key, const char *aDefault=0) const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Jan 19 2020 00:00:00 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.