29 #include <Solid/StorageVolume>
30 #include <Solid/StorageAccess>
31 #include <Solid/Device>
33 #include <QtGui/QApplication>
34 #include <QtCore/QFile>
35 #include <QtCore/QByteArray>
40 #include <sys/vfstab.h>
41 #elif !defined(Q_WS_WIN)
45 #include <sys/types.h>
60 , m_trees(cachedTrees)
70 foreach(
const QString &ignorePath, list) {
82 Folder *tree = scan(path, path);
88 if (m_parent->m_abort)
90 kDebug() <<
"Scan successfully aborted";
94 kDebug() <<
"Emitting signal to cache results ...";
96 kDebug() <<
"Thread terminating ...";
100 #define S_BLKSIZE 512
110 #define out(s) kError() << s ": " << path; break
114 out(
"Inadequate access permissions");
116 out(
"Too many file descriptors in use by Filelight");
118 out(
"Too many files are currently open in the system");
120 out(
"A component of the path does not exist, or the path is an empty string");
122 out(
"Insufficient memory to complete the operation");
124 out(
"A component of the path is not a folder");
126 out(
"Bad file descriptor");
131 out(
"Too many symbolic links encountered while traversing the path");
134 out(
"File name too long");
144 DIR *dir = opendir(path);
153 #undef KDE_struct_stat
155 #define KDE_struct_stat struct _stat64
156 #define KDE_lstat kdewin32_stat64
159 KDE_struct_stat statbuf;
161 while ((ent = KDE_readdir(dir)))
163 if (m_parent->m_abort)
166 if (qstrcmp(ent->d_name,
".") == 0 || qstrcmp(ent->d_name,
"..") == 0)
170 new_path += ent->d_name;
173 if (KDE_lstat(new_path, &statbuf) == -1) {
178 if (S_ISLNK(statbuf.st_mode) ||
179 S_ISCHR(statbuf.st_mode) ||
180 S_ISBLK(statbuf.st_mode) ||
181 S_ISFIFO(statbuf.st_mode)||
182 S_ISSOCK(statbuf.st_mode))
187 if (S_ISREG(statbuf.st_mode))
191 cwd->
append(ent->d_name, statbuf.st_size);
194 else if (S_ISDIR(statbuf.st_mode))
205 if (new_path == (*it)->name8Bit())
207 kDebug() <<
"Tree pre-completed: " << (*it)->name();
211 cwd->
append(d, new_dirname);
216 if ((d = scan(new_path, new_dirname)))
230 const Solid::StorageAccess *partition;
231 const Solid::StorageVolume *volume;
235 foreach (
const Solid::Device &device, Solid::Device::listFromType(Solid::DeviceInterface::StorageAccess))
237 if (!device.is<Solid::StorageAccess>())
continue;
238 if (!device.is<Solid::StorageVolume>())
continue;
240 partition = device.as<Solid::StorageAccess>();
241 if (!partition->isAccessible() || partition->filePath() == QLatin1String(
"/" ) || partition->filePath().isEmpty())
continue;
243 volume = device.as<Solid::StorageVolume>();
244 if (remoteFsTypes.
contains(volume->fsType())) {
245 if (!s_remoteMounts.
contains(partition->filePath())) {
246 s_remoteMounts.
append(partition->filePath());
248 }
else if (!s_localMounts.
contains(partition->filePath())) {
249 s_localMounts.
append(partition->filePath());
253 kDebug() <<
"Found the following remote filesystems: " << s_remoteMounts;
254 kDebug() <<
"Found the following local filesystems: " << s_localMounts;
259 #include "localLister.moc"
bool contains(const QString &str, Qt::CaseSensitivity cs) const
static bool scanRemoteMounts
void append(const T &value)
void remove(const File *f)
removes a file
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
const Link< T > * end() const
void append(Folder *d, const char *name=0)
appends a Folder
QByteArray toLocal8Bit() const
void branchCompleted(Folder *tree, bool finished)
LocalLister(const QString &path, Chain< Folder > *cachedTrees, ScanManager *parent)
static QStringList skipList
QByteArray encodeName(const QString &fileName)
static bool scanAcrossMounts
static void outputError(QByteArray path)
void append(T *const data)