KIO
kdirlister.cpp
Go to the documentation of this file.
64 kdirnotify = new org::kde::KDirNotify(QString(), QString(), QDBusConnection::sessionBus(), this);
65 connect(kdirnotify, SIGNAL(FileRenamed(QString,QString)), SLOT(slotFileRenamed(QString,QString)));
70 // The use of KUrl::url() in ~DirItem (sendSignal) crashes if the static for QRegExpEngine got deleted already,
242 kDebug(7004) << "Entry currently being listed:" << _url << "by" << dirData.listersCurrentlyListing;
279 KDirLister::Private::CachedItemsJob* KDirLister::Private::cachedItemsJobForUrl(const KUrl& url) const
288 KDirLister::Private::CachedItemsJob::CachedItemsJob(KDirLister* lister, const KUrl& url, bool reload)
323 void KDirListerCache::emitItemsFromCache(KDirLister::Private::CachedItemsJob* cachedItemsJob, KDirLister* lister, const KUrl& _url, bool _reload, bool _emitCompleted)
365 void KDirListerCache::forgetCachedItemsJob(KDirLister::Private::CachedItemsJob* cachedItemsJob, KDirLister* lister, const KUrl& _url)
383 //kDebug(7004) << "Still having a listjob" << listJob << ", so not moving to currently-holding.";
484 // So, change of plan, let's kill it after all, in a way that triggers slotResult/slotUpdateResult.
542 // noauto -> manually mounted. Otherwise, mounted at boot time, won't be unmounted any time soon hopefully.
600 // 2) [**] becomes: if (Drive is hotpluggable or Volume is removable) "set to dirty" else "keep watch"
601 const KMountPoint::List possibleMountPoints = KMountPoint::possibleMountPoints(KMountPoint::NeedMountOptions);
870 void KDirListerCache::slotFilesRemoved( const QStringList &fileList ) // from KDirNotify signals
899 for (KFileItemList::iterator fit = dirItem->lstItems.begin(), fend = dirItem->lstItems.end(); fit != fend ; ++fit) {
903 // If we found a fileitem, we can test if it's a dir. If not, we'll go to deleteDir just in case.
930 void KDirListerCache::slotFilesChanged( const QStringList &fileList ) // from KDirNotify signals
964 void KDirListerCache::slotFileRenamed( const QString &_src, const QString &_dst ) // from KDirNotify signals
1003 // #172945 - if the fileitem was the root item of a DirItem that was just removed from the cache,
1011 if (!oldItem.isLocalFile() && !oldItem.localPath().isEmpty()) { // it uses UDS_LOCAL_PATH? ouch, needs an update then
1031 QSet<KDirLister*> KDirListerCache::emitRefreshItem(const KFileItem& oldItem, const KFileItem& fileitem)
1071 dirs << canonicalUrls.value(dir).toSet().toList(); /* make unique; there are faster ways, but this is really small anyway */
1193 kError(7004) << "Internal error: job is listing" << url << "but itemsInUse only knows about" << itemsInUse.keys();
1200 kError(7004) << "Internal error: job is listing" << url << "but directoryData doesn't know about that url, only about:" << directoryData.keys();
1206 kError(7004) << "Internal error: job is listing" << url << "but directoryData says no listers are currently listing " << urlStr;
1274 jobUrl.adjustPath(KUrl::RemoveTrailingSlash); // need remove trailing slashes again, in case of redirections
1420 // only in this case there can newUrl already be in listersCurrentlyListing or listersCurrentlyHolding
1472 // emit old items: listers, holders. NOT: newUrlListers/newUrlHolders, they already have them listed
1669 const QList<QString> cachedDirs = itemsCached.keys(); // seems slow, but there's no qcache iterator...
1687 jobUrl.adjustPath(KUrl::RemoveTrailingSlash); // need remove trailing slashes again, in case of redirections
1748 for ( KFileItemList::iterator kit = dir->lstItems.begin(), kend = dir->lstItems.end() ; kit != kend ; ++kit )
1873 void KDirListerCache::deleteUnmarkedItems( const QList<KDirLister *>& listers, KFileItemList &lstItems )
1890 void KDirListerCache::itemsDeleted(const QList<KDirLister *>& listers, const KFileItemList& deletedItems)
2017 kDebug(7004) << " " << dit.key() << (*dit).listersCurrentlyListing.count() << "listers:" << list;
2031 kDebug(7004) << " " << dit.key() << (*dit).listersCurrentlyHolding.count() << "holders:" << list;
2037 kDebug(7004) << " " << jit.key() << "listing" << joburl( jit.key() ) << ":" << (*jit).count() << "entries.";
2294 if (mimeFilter.contains(QLatin1String("application/octet-stream")) || mimeFilter.contains(QLatin1String("all/allfiles"))) // all files
2388 bool KDirLister::Private::doMimeExcludeFilter( const QString& mime, const QStringList& filters ) const
2442 // Of course if there is no filter and we can do a range-insertion instead of a loop, that might be good.
2449 void KDirLister::Private::addRefreshItem(const KUrl& directoryUrl, const KFileItem& oldItem, const KFileItem& item)
2778 //kDebug(7004) << "Not moving" << kdl << "to listersCurrentlyHolding because it still has job" << kdl->d->m_cachedItemsJobs;
virtual void setWindow(QWidget *window)
Associate this job with a window given by window.
Definition: jobuidelegate.cpp:58
An alternative URL (If different from the caption).
Definition: udsentry.h:190
void slotFilesRemoved(const QStringList &fileList)
Notify that files have been deleted.
Definition: kdirlister.cpp:870
QString i18n(const char *text)
bool kill(KillVerbosity verbosity=Quietly)
void percent(int percent)
Progress signal showing the overall progress of the KDirLister.
void adjustPath(AdjustPathOption trailing)
QT_MOC_COMPAT void deleteItem(const KFileItem &_fileItem)
Signals that an item has been deleted.
Definition: kdirlister_p.h:448
QString directory(const DirectoryOptions &options=IgnoreTrailingSlash) const
KMimeType::Ptr determineMimeType() const
Returns the mimetype of the file item.
Definition: kfileitem.cpp:779
static KDirWatch * self()
virtual void setShowingDotFiles(bool _showDotFiles)
Changes the "is viewing dot files" setting.
Definition: kdirlister.cpp:2123
virtual KFileItem findByName(const QString &name) const
Find an item by its name.
Definition: kdirlister.cpp:2260
bool matchesMimeFilter(const QString &mime) const
Checks whether mime matches a filter in the list of mime types.
Definition: kdirlister.cpp:2327
void _k_slotInfoMessage(KJob *, const QString &)
Definition: kdirlister.cpp:2558
virtual void setAutoUpdate(bool enable)
Enable/disable automatic directory updating, when a directory changes (using KDirWatch).
Definition: kdirlister.cpp:2109
KUrl::List directories() const
Returns all URLs that are listed by this KDirLister.
Definition: kdirlister.cpp:2162
int timeout
A ListJob is allows you to get the get the content of a directory.
Definition: jobclasses.h:936
bool delayedMimeTypes() const
#define K_GLOBAL_STATIC(TYPE, NAME)
virtual void handleError(KIO::Job *)
Reimplement to customize error handling.
Definition: kdirlister.cpp:2401
Previous directories aren't forgotten (they are still watched by kdirwatch and their items are kept f...
Definition: kdirlister.h:76
void refresh()
Throw away and re-read (for local files) all information about the file.
Definition: kfileitem.cpp:512
void cleanPath(const CleanPathOption &options=SimplifyDirSeparators)
KStandardDirs * dirs()
int stat(const QString &path, KDE_struct_stat *buf)
const char * name(StandardAction id)
virtual bool openUrl(const KUrl &_url, OpenUrlFlags _flags=NoFlags)
Run the directory lister on the given url.
Definition: kdirlister.cpp:2083
static QDebug kError(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
virtual KFileItem findByUrl(const KUrl &_url) const
Find an item by its URL.
Definition: kdirlister.cpp:2250
static KFileItem cachedItemForUrl(const KUrl &url)
Return the KFileItem for the given URL, if we listed it recently and it's still in the cache - which ...
Definition: kdirlister.cpp:2783
QString toLocalFile(AdjustPathOption trailing=LeaveTrailingSlash) const
QStringList mimeExcludeFilter
Definition: kdirlister_p.h:160
QList< KDirLister * > listersCurrentlyListing
Definition: kdirlister_p.h:457
void forgetCachedItemsJob(KDirLister::Private::CachedItemsJob *job, KDirLister *lister, const KUrl &url)
Definition: kdirlister.cpp:365
void setMainWindow(QWidget *window)
Pass the main window this object is associated with this is used for caching authentication data...
Definition: kdirlister.cpp:2678
QString nameFilter() const
Returns the current name filter, as set via setNameFilter()
bool dirOnlyMode() const
Checks whether the KDirLister only lists directories or all files.
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
void stopListingUrl(KDirLister *lister, const KUrl &_url, bool silent=false)
Definition: kdirlister.cpp:437
bool isParentOf(const KUrl &u) const
void addNewItem(const KUrl &directoryUrl, const KFileItem &item)
Definition: kdirlister.cpp:2410
static bool manually_mounted(const QString &path, const KMountPoint::List &possibleMountPoints)
Definition: kdirlister.cpp:530
void _k_slotPercent(KJob *, unsigned long)
Definition: kdirlister.cpp:2563
void slotFileRenamed(const QString &srcUrl, const QString &dstUrl)
Definition: kdirlister.cpp:964
void setPath(const QString &path)
KFileItem itemForUrl(const KUrl &url) const
Definition: kdirlister.cpp:780
ListJob * listDir(const KUrl &url, JobFlags flags=DefaultFlags, bool includeHidden=true)
List the contents of url, which is assumed to be a directory.
Definition: job.cpp:2739
bool autoErrorHandlingEnabled() const
Check whether auto error handling is enabled.
QList< KDirLister * > listersCurrentlyHolding
Definition: kdirlister_p.h:459
bool isItemVisible(const KFileItem &item) const
Should this item be visible according to the current filter settings?
Definition: kdirlister.cpp:2530
virtual void stop()
Stop listing all directories currently being listed.
Definition: kdirlister.cpp:2094
bool isShowingDotFiles
Definition: kdirlister_p.h:156
virtual void setNameFilter(const QString &filter)
Set a name filter to only list items matching this name, e.g.
Definition: kdirlister.cpp:2268
void addPath(const QString &txt)
void _k_slotProcessedSize(KJob *, qulonglong)
Definition: kdirlister.cpp:2601
virtual bool doNameFilter(const QString &name, const QList< QRegExp > &filters) const
Called by the public matchesFilter() to do the actual filtering.
Definition: kdirlister.cpp:2360
Indicates whether to use the cache or to reread the directory from the disk.
Definition: kdirlister.h:81
virtual void setDirOnlyMode(bool dirsOnly)
Call this to list only directories.
Definition: kdirlister.cpp:2137
void prepareForSettingsChange()
Definition: kdirlister_p.h:99
void emitItemsDeleted(const KFileItemList &items)
Definition: kdirlister.cpp:2539
CachedItemsJob(KDirLister *lister, const KUrl &url, bool reload)
Definition: kdirlister.cpp:288
KFileItemList items(WhichItems which=FilteredItems) const
Returns the items listed for the current url().
Definition: kdirlister.cpp:2688
void speed(int bytes_per_second)
Emitted to display information about the speed of the jobs.
QString protocol() const
QWidget * mainWindow()
Returns the main window associated with this object.
Definition: kdirlister.cpp:2683
void infoMessage(const QString &msg)
Emitted to display information about running jobs.
QString localPath() const
Returns the local path if isLocalFile() == true or the KIO item has a UDS_LOCAL_PATH atom...
Definition: kfileitem.cpp:602
void setAutoErrorHandlingEnabled(bool enable, QWidget *parent)
Enable or disable auto error handling is enabled.
Definition: kdirlister.cpp:2151
List of KFileItems, which adds a few helper methods to QList.
Definition: kfileitem.h:674
bool isFinished() const
Returns true if no io operation is currently in progress.
Definition: kdirlister.cpp:2240
void slotFilesChanged(const QStringList &fileList)
Notify that files have been changed.
Definition: kdirlister.cpp:930
QList< QRegExp > lstFilters
Definition: kdirlister_p.h:158
void setDelayedMimeTypes(bool delayedMimeTypes)
Delayed mimetypes feature: If enabled, mime types will be fetched on demand, which leads to a faster ...
Definition: kdirlister.cpp:2722
virtual void setMimeFilter(const QStringList &mimeList)
Set mime-based filter to only list items matching the given mimetypes.
Definition: kdirlister.cpp:2288
static QString protocolClass(const QString &protocol)
QString path(AdjustPathOption trailing=LeaveTrailingSlash) const
Definition: kdirlister.h:393
KJobUiDelegate * uiDelegate() const
bool listDir(KDirLister *lister, const KUrl &_url, bool _keep, bool _reload)
Definition: kdirlister.cpp:91
bool showingDotFiles() const
Checks whether hidden files (files beginning with a dot) will be shown.
QList< CachedItemsJob * > m_cachedItemsJobs
Definition: kdirlister_p.h:150
KFileItem * findByUrl(const KDirLister *lister, const KUrl &url) const
Definition: kdirlister.cpp:821
Definition: kdirlister_p.h:42
KUrl url() const
Returns the top level URL that is listed by this KDirLister.
Definition: kdirlister.cpp:2157
WhichItems
Used by items() and itemsForDir() to specify whether you want all items for a directory or just the f...
Definition: kdirlister.h:391
CachedItemsJob * cachedItemsJobForUrl(const KUrl &url) const
Definition: kdirlister.cpp:279
virtual bool doMimeFilter(const QString &mime, const QStringList &filters) const
Called by the public matchesMimeFilter() to do the actual filtering.
Definition: kdirlister.cpp:2369
void processedSize(KIO::filesize_t size)
Regularly emitted to show the progress of this KDirLister.
void redirect(const KUrl &oldUrl, const KUrl &newUrl, bool keepItems)
Redirect this dirlister from oldUrl to newUrl.
Definition: kdirlister.cpp:2728
Design of the cache: There is a single KDirListerCache for the whole process.
Definition: kdirlister_p.h:181
void setAutoUpdate(KDirLister *lister, bool enable)
Definition: kdirlister.cpp:496
KFileItem findByName(const KDirLister *lister, const QString &_name) const
Definition: kdirlister.cpp:805
QString dir(const QString &fileClass)
Returns the most recently used directory accociated with this file-class.
Definition: krecentdirs.cpp:68
virtual void showErrorMessage()
void setEmitCompleted(bool b)
Definition: kdirlister_p.h:478
static List possibleMountPoints(DetailsNeededFlags infoNeeded=BasicInfoNeeded)
bool autoUpdate() const
Checks whether KDirWatch will automatically update directories.
Ptr findByPath(const QString &path) const
QString name(bool lowerCase=false) const
Return the name of the file item (without a path).
Definition: kfileitem.cpp:1597
Filename - as displayed in directory listings etc.
Definition: udsentry.h:163
void _k_slotTotalSize(KJob *, qulonglong)
Definition: kdirlister.cpp:2586
KIO::filesize_t processedSize
Definition: kdirlister_p.h:136
void emitItemsFromCache(KDirLister::Private::CachedItemsJob *job, KDirLister *lister, const KUrl &_url, bool _reload, bool _emitCompleted)
Definition: kdirlister.cpp:323
void slotFilesAdded(const QString &urlDirectory)
Notify that files have been added in directory The receiver will list that directory again to find th...
Definition: kdirlister.cpp:857
Definition: kdirlister_p.h:134
static QDebug kWarning(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
void _k_slotSpeed(KJob *, unsigned long)
Definition: kdirlister.cpp:2616
QString url(AdjustPathOption trailing=LeaveTrailingSlash) const
bool doMimeExcludeFilter(const QString &mimeExclude, const QStringList &filters) const
Definition: kdirlister.cpp:2388
static bool exists()
static bool supportsListing(const KUrl &url)
Returns whether the protocol can list files/objects.
Definition: kprotocolmanager.cpp:1032
Helper class for the kiojob used to list and update a directory.
Definition: kdirlister.h:57
void moveListersWithoutCachedItemsJob(const KUrl &url)
Definition: kdirlister.cpp:2758
bool isLocalFile() const
const KShortcut & end()
void setMimeExcludeFilter(const QStringList &mimeList)
Filtering should be done with KFileFilter.
Definition: kdirlister.cpp:2300
void addRefreshItem(const KUrl &directoryUrl, const KFileItem &oldItem, const KFileItem &item)
Definition: kdirlister.cpp:2449
QStringList mimeFilters() const
Returns the list of mime based filters, as set via setMimeFilter().
Definition: kdirlister.cpp:2317
static QDebug kFatal(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
void itemsDeleted(const KFileItemList &items)
Signal that items have been deleted.
KFileItemList * itemsForDir(const KUrl &dir) const
Definition: kdirlister.cpp:799
QString prettyUrl(AdjustPathOption trailing=LeaveTrailingSlash) const
void addNewItems(const KUrl &directoryUrl, const KFileItemList &items)
Definition: kdirlister.cpp:2438
virtual void emitChanges()
Actually emit the changes made with setShowingDotFiles, setDirOnlyMode, setNameFilter and setMimeFilt...
Definition: kdirlister.cpp:2167
static void error(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
Definition: netaccess.h:36
bool matchesFilter(const QString &name) const
Checks whether name matches a filter in the list of name filters.
Definition: kdirlister.cpp:2322
A KFileItem is a generic class to handle a file, local or remote.
Definition: kfileitem.h:45
QWidget * window() const
QString number(KIO::filesize_t size)
Converts a size to a string representation Not unlike QString::number(...)
Definition: global.cpp:63
int error() const
QStringList list(const QString &fileClass)
Returns a list of directories associated with this file-class.
Definition: krecentdirs.cpp:60
KFileItemList itemsForDir(const KUrl &dir, WhichItems which=FilteredItems) const
Returns the items listed for the given dir.
Definition: kdirlister.cpp:2693
virtual void updateDirectory(const KUrl &_dir)
Update the directory _dir.
Definition: kdirlister.cpp:2235
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.