[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdelibs/kio/kio
From:       David Faure <faure () kde ! org>
Date:       2005-08-09 2:04:56
Message-ID: 1123553096.408263.30287.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 444172 by dfaure:

Get rid of the last foo->inherits("class").
Fix a wrong check in Observer, all jobs have metadata nowadays.
Simplify kdatatool's dlopening code by using KParts::ComponentsFactory (it's just
  a template, it's ok to use it from here)


 M  +2 -2      job.cpp  
 M  +11 -19    kdatatool.cpp  
 M  +2 -2      krun.cpp  
 M  +1 -7      observer.cpp  


--- branches/KDE/3.5/kdelibs/kio/kio/job.cpp #444171:444172
@@ -3040,7 +3040,7 @@
             }
             else
             {
-                if ( m_bCurrentOperationIsLink && job->inherits( "KIO::DeleteJob" ) \
) +                if ( m_bCurrentOperationIsLink && ::qt_cast<KIO::DeleteJob*>( job \
) )  {
                     // Very special case, see a few lines below
                     // We are deleting the source of a symlink we successfully \
moved... ignore error @@ -3057,7 +3057,7 @@
     {
         // Special case for moving links. That operation needs two jobs, unlike \
others.  if ( m_bCurrentOperationIsLink && m_mode == Move
-             && !job->inherits( "KIO::DeleteJob" ) // Deleting source not already \
done +             && !::qt_cast<KIO::DeleteJob *>( job ) // Deleting source not \
already done  )
         {
             subjobs.remove( job );
--- branches/KDE/3.5/kdelibs/kio/kio/kdatatool.cpp #444171:444172
@@ -1,6 +1,6 @@
 /* This file is part of the KDE project
    Copyright (C) 1998, 1999, 2000 Torben Weis <weis@kde.org>
-   Copyright (C) 2001 David Faure <david@mandrakesoft.com>
+   Copyright (C) 2001 David Faure <faure@kde.org>
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
@@ -18,17 +18,19 @@
    Boston, MA 02110-1301, USA.
 */
 
-#include <qpixmap.h>
-#include <qfile.h>
 #include "kdatatool.h"
-#include <kinstance.h>
-#include <ktrader.h>
 
 #include <kstandarddirs.h>
-
 #include <klibloader.h>
 #include <kdebug.h>
+#include <kinstance.h>
 
+#include <ktrader.h>
+#include <kparts/componentfactory.h>
+
+#include <qpixmap.h>
+#include <qfile.h>
+
 /*************************************************
  *
  * KDataToolInfo
@@ -146,19 +148,9 @@
     if ( !m_service )
         return 0;
 
-    KLibFactory* factory = KLibLoader::self()->factory( \
                QFile::encodeName(m_service->library()) );
-
-    if( !factory )
-        return 0;
-
-    QObject* obj = factory->create( parent, name );
-    if ( !obj || !obj->inherits( "KDataTool" ) )
-    {
-        delete obj;
-        return 0;
-    }
-    KDataTool * tool = static_cast<KDataTool *>(obj);
-    tool->setInstance( m_instance );
+    KDataTool* tool = \
KParts::ComponentFactory::createInstanceFromService<KDataTool>( m_service, parent, \
name ); +    if ( tool )
+        tool->setInstance( m_instance );
     return tool;
 }
 
--- branches/KDE/3.5/kdelibs/kio/kio/krun.cpp #444171:444172
@@ -1171,9 +1171,9 @@
     return;
   }
 */
-  if (m_job && m_job->inherits("KIO::TransferJob"))
+  KIO::TransferJob *job = ::qt_cast<KIO::TransferJob *>( m_job );
+  if ( job )
   {
-     KIO::TransferJob *job = static_cast<KIO::TransferJob *>(m_job);
      job->putOnHold();
      KIO::Scheduler::publishSlaveOnHold();
      m_job = 0;
--- branches/KDE/3.5/kdelibs/kio/kio/observer.cpp #444171:444172
@@ -111,13 +111,7 @@
 {
     KIO::Job * job = m_dctJobs[ progressId ];
     assert(job);
-    if ( job->inherits("KIO::TransferJob") )
-        return static_cast<KIO::TransferJob *>(job)->metaData();
-    else
-    {
-        kdWarning() << "Observer::metaData(" << progressId << ") called on a job \
                that is a " << job->className() << endl;
-        return MetaData();
-    }
+    return job->metaData();
 }
 
 void Observer::slotTotalSize( KIO::Job* job, KIO::filesize_t size )


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic