]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/applyviewpropsjob.cpp
use a smaller step size when using the scroll wheel
[dolphin.git] / src / applyviewpropsjob.cpp
index cddc4d653f8c655f0b93b9dbb60750f5090c00a1..9250226e9d5d993f9d2d244d6f4fd55298d0f37a 100644 (file)
 #include "applyviewpropsjob.h"
 #include "viewproperties.h"
 
-#include <assert.h>
-#include <kdebug.h>
-
 ApplyViewPropsJob::ApplyViewPropsJob(const KUrl& dir,
                                      const ViewProperties& viewProps) :
-    KIO::Job(false),
+    KIO::Job(),
     m_viewProps(0),
     m_progress(0),
     m_dir(dir)
@@ -40,7 +37,10 @@ ApplyViewPropsJob::ApplyViewPropsJob(const KUrl& dir,
     m_viewProps->setSorting(viewProps.sorting());
     m_viewProps->setSortOrder(viewProps.sortOrder());
 
-    startNextJob(dir);
+    KIO::ListJob* listJob = KIO::listRecursive(dir, KIO::HideProgressInfo);
+    connect(listJob, SIGNAL(entries(KIO::Job*, const KIO::UDSEntryList&)),
+            SLOT(slotEntries(KIO::Job*, const KIO::UDSEntryList&)));
+    addSubjob(listJob);
 }
 
 ApplyViewPropsJob::~ApplyViewPropsJob()
@@ -49,33 +49,19 @@ ApplyViewPropsJob::~ApplyViewPropsJob()
     m_viewProps = 0;
 }
 
-void ApplyViewPropsJob::processNextItem()
-{
-    emitResult();
-}
-
-void ApplyViewPropsJob::startNextJob(const KUrl& url)
-{
-    KIO::ListJob* listJob = KIO::listRecursive(url, false);
-    connect(listJob, SIGNAL(entries(KIO::Job*, const KIO::UDSEntryList&)),
-            SLOT(slotEntries(KIO::Job*, const KIO::UDSEntryList&)));
-    addSubjob(listJob);
-}
-
 void ApplyViewPropsJob::slotEntries(KIO::Job*, const KIO::UDSEntryList& list)
 {
     KIO::UDSEntryList::ConstIterator it = list.begin();
     const KIO::UDSEntryList::ConstIterator end = list.end();
-    for (; it != end; ++it) {
-        const KIO::UDSEntry& entry = *it;
-        const QString name = entry.stringValue(KIO::UDS_NAME);
-        if ((name != ".") && (name != ".." ) && entry.isDir()) {
+    foreach(const KIO::UDSEntry& entry, list) {
+        const QString name = entry.stringValue(KIO::UDSEntry::UDS_NAME);
+        if ((name != ".") && (name != "..") && entry.isDir()) {
             ++m_progress;
 
             KUrl url(m_dir);
             url.addPath(name);
 
-            assert(m_viewProps != 0);
+            Q_ASSERT(m_viewProps != 0);
 
             ViewProperties props(url);
             props.setDirProperties(*m_viewProps);
@@ -86,8 +72,8 @@ void ApplyViewPropsJob::slotEntries(KIO::Job*, const KIO::UDSEntryList& list)
 void ApplyViewPropsJob::slotResult(KJob* job)
 {
     if (job->error()) {
-        setError( job->error() );
-        setErrorText( job->errorText() );
+        setError(job->error());
+        setErrorText(job->errorText());
     }
     emitResult();
 }