[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/kio/kio
From: Michael Brade <brade () kde ! org>
Date: 2005-03-23 23:35:22
Message-ID: 20050323233522.B5B7D3CF () office ! kde ! org
[Download RAW message or body]
CVS commit by brade:
Always get the current url of the job: added the new redirectionURL() method
to KIO::ListJob and made KDirListerCache check for it whenever a job's url is
needed. Except for the redirection case---here we really want the old url.
I've still got some problems with kio_lan crashing all the time, which makes
debugging this KDirListerCache case pretty hard... and I'm not sure if
it's worth the effort that KDirLister continues to work flawlessly even if a
job crashed? Will try to fix that tomorrow, debugging it takes a hell lot of
time.
M +7 -0 jobclasses.h 1.156
M +16 -24 kdirlister.cpp 1.191
M +3 -1 kdirlister_p.h 1.36
--- kdelibs/kio/kio/jobclasses.h #1.155:1.156
@@ -1337,4 +1337,11 @@ namespace KIO {
/**
+ * Returns the ListJob's redirection URL. This will be invalid if there
+ * was no redirection.
+ * @return the redirection url
+ */
+ const KURL& redirectionURL() const { return m_redirectionURL; }
+
+ /**
* Do not apply any KIOSK restrictions to this job.
* @since 3.2
--- kdelibs/kio/kio/kdirlister.cpp #1.190:1.191
@@ -894,5 +894,5 @@ void KDirListerCache::slotFileDeleted( c
void KDirListerCache::slotEntries( KIO::Job *job, const KIO::UDSEntryList &entries )
{
- KURL url = static_cast<KIO::ListJob *>(job)->url();
+ KURL url = joburl( static_cast<KIO::ListJob *>(job) );
url.adjustPath(-1);
QString urlStr = url.url();
@@ -968,5 +968,5 @@ void KDirListerCache::slotResult( KIO::J
jobs.remove( job );
- KURL jobUrl = job->url();
+ KURL jobUrl = joburl( job );
jobUrl.adjustPath(-1); // need remove trailing slashes again, in case of redirections
QString jobUrlStr = jobUrl.url();
@@ -977,25 +977,7 @@ void KDirListerCache::slotResult( KIO::J
#endif
- KDirLister *kdl;
-
QPtrList<KDirLister> *listers = urlsCurrentlyListed.take( jobUrlStr );
Q_ASSERT( listers );
- // FIXME: this case happens when stop() was called right after a redirection
- // and the job hasn't updated its url(). Then the job can't be killed and will
- // continue running, finally calling slotResult() with the updated url().
- if ( !listers )
- {
- kdWarning(7004) << "A job finished listing \"" << jobUrlStr
- << "\", but there is no lister listing it anymore!!" << endl;
-
- listers = urlsCurrentlyHeld[jobUrlStr];
- for ( kdl = listers->first(); kdl; kdl = listers->next() )
- kdl->jobDone( job );
-
- // do not emit canceled() or completed() again, has been done in stop already
- return;
- }
-
// move the directory to the held directories, do it before emitting
// the signals to make sure it exists in KDirListerCache in case someone
@@ -1004,4 +986,6 @@ void KDirListerCache::slotResult( KIO::J
urlsCurrentlyHeld.insert( jobUrlStr, listers );
+ KDirLister *kdl;
+
if ( job->error() )
{
@@ -1048,5 +1032,5 @@ void KDirListerCache::slotRedirection( K
{
Q_ASSERT( job );
- KURL oldUrl = static_cast<KIO::ListJob *>( job )->url();
+ KURL oldUrl = static_cast<KIO::ListJob *>( job )->url(); // here we really need the old \
url!
// strip trailing slashes
@@ -1248,5 +1232,5 @@ void KDirListerCache::slotUpdateResult(
KIO::ListJob *job = static_cast<KIO::ListJob *>( j );
- KURL jobUrl = job->url();
+ KURL jobUrl = joburl( job );
jobUrl.adjustPath(-1); // need remove trailing slashes again, in case of redirections
QString jobUrlStr = jobUrl.url();
@@ -1435,5 +1419,5 @@ KIO::ListJob *KDirListerCache::jobForUrl
{
job = it.key();
- if ( job->url().url(-1) == url )
+ if ( joburl( job ).url(-1) == url )
return job;
++it;
@@ -1442,4 +1426,12 @@ KIO::ListJob *KDirListerCache::jobForUrl
}
+const KURL& KDirListerCache::joburl( KIO::ListJob *job )
+{
+ if ( job->redirectionURL().isValid() )
+ return job->redirectionURL();
+ else
+ return job->url();
+}
+
void KDirListerCache::killJob( KIO::ListJob *job )
{
@@ -1593,5 +1585,5 @@ void KDirListerCache::printDebug()
kdDebug(7004) << "Jobs: " << endl;
for ( ; jit != jobs.end() ; ++jit )
- kdDebug(7004) << " " << jit.key() << " listing " << jit.key()->url().prettyURL() << ": " \
<< (*jit).count() << " entries." << endl; + kdDebug(7004) << " " << jit.key() << " listing \
" << joburl( jit.key() ).prettyURL() << ": " << (*jit).count() << " entries." << endl;
kdDebug(7004) << "Items in cache: " << endl;
--- kdelibs/kio/kio/kdirlister_p.h #1.35:1.36
@@ -197,5 +197,7 @@ private slots:
private:
- KIO::ListJob *jobForUrl(const QString& _url);
+ KIO::ListJob *jobForUrl( const QString& _url );
+ const KURL& joburl( KIO::ListJob *job );
+
void killJob( KIO::ListJob *job );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic