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

List:       kde-commits
Subject:    branches/work/libarchive-based-ark/ark/kerfuffle
From:       Henrique Pinto <tawhaki () gmail ! com>
Date:       2007-07-15 3:54:06
Message-ID: 1184471646.628833.21159.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 688028 by henrique:

 * Load the libarchive handler as a plugin. Still a nasty hack, though, will \
implement code using K*Trader soon


 M  +3 -2      CMakeLists.txt  
 M  +17 -2     arch.cpp  
 M  +0 -1      arch.h  
 M  +2 -1      archivebase.cpp  
 M  +2 -1      archivebase.h  
 A             archivefactory.h   [License: no copyright]
 A             kerfufflePlugin.desktop  
 D             libarchivehandler.cpp  
 D             libarchivehandler.h  


--- branches/work/libarchive-based-ark/ark/kerfuffle/CMakeLists.txt #688027:688028
@@ -8,7 +8,6 @@
 set(kerfuffle_SRCS ${libark_common_SRCS} 
     arch.cpp 
     archiveinterface.cpp
-    libarchivehandler.cpp
     jobs.cpp
     archivebase.cpp
     bkplugin.cpp
@@ -37,4 +36,6 @@
 
 set_target_properties(kerfuffle PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION \
${GENERIC_LIB_SOVERSION})  
-install(TARGETS kerfuffle DESTINATION ${LIB_INSTALL_DIR} )
+install(TARGETS kerfuffle DESTINATION ${LIB_INSTALL_DIR})
+
+install(FILES kerfufflePlugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
--- branches/work/libarchive-based-ark/ark/kerfuffle/arch.cpp #688027:688028
@@ -27,6 +27,7 @@
 // ark includes
 #include "arch.h"
 #include "archivebase.h"
+#include "archivefactory.h"
 
 // C includes
 #include <cstdlib>
@@ -43,9 +44,10 @@
 #include <KLocale>
 #include <KPasswordDialog>
 #include <KStandardDirs>
+#include <KLibLoader>
 
 // the archive types
-#include "libarchivehandler.h"
+//#include "libarchivehandler.h"
 #include "bkplugin.h"
 
 Arch::Arch( const QString &filename )
@@ -72,6 +74,19 @@
 	{
 		return new ArchiveBase( new BKInterface( filename ) );
 	}
-	return new ArchiveBase( new LibArchiveInterface( filename ) );
+	//return new ArchiveBase( new LibArchiveInterface( filename ) );
+	KLibrary *lib = KLibLoader::self()->library( QFile::encodeName( \
"kerfuffle_libarchive" ), QLibrary::ExportExternalSymbolsHint ); +	if ( lib )
+	{
+		ArchiveFactory *( *pluginFactory )() = ( ArchiveFactory *( * )() \
)lib->resolveFunction( "pluginFactory" ); +		if ( pluginFactory )
+		{
+			ArchiveFactory *factory = pluginFactory(); // TODO: cache these
+			Arch *arch = factory->createArchive( filename, 0 );
+			delete factory;
+			return arch;
+		}
+	}
+	return 0;
 }
 #include "arch.moc"
--- branches/work/libarchive-based-ark/ark/kerfuffle/arch.h #688027:688028
@@ -49,7 +49,6 @@
                          CRC = 9, Method = 10, Version = 11, Timestamp = 12, \
IsDirectory = 13, Custom = 1048576 };  
 typedef QHash<int, QVariant> ArchiveEntry;
-typedef QList< QPair< QString, Qt::AlignmentFlag > > ColumnList;
 
 /**
  * Pure virtual base class for archives - provides a framework as well as
--- branches/work/libarchive-based-ark/ark/kerfuffle/archivebase.cpp #688027:688028
@@ -38,9 +38,10 @@
 #include <QDateTime>
 
 ArchiveBase::ArchiveBase( ReadOnlyArchiveInterface *archive )
-	: Arch( archive? archive->filename() : QString()  ), m_iface( archive )
+	: Arch( archive->filename()  ), m_iface( archive )
 {
 	Q_ASSERT( archive );
+	archive->setParent( this );
 	setReadOnly( archive->isReadOnly() );
 }
 
--- branches/work/libarchive-based-ark/ark/kerfuffle/archivebase.h #688027:688028
@@ -28,13 +28,14 @@
 
 #include "arch.h"
 #include "archiveinterface.h"
+#include "kerfuffle_export.h"
 
 namespace ThreadWeaver
 {
 	class Job;
 } // namespace ThreadWeaver
 
-class ArchiveBase: public Arch
+class KERFUFFLE_EXPORT ArchiveBase: public Arch
 {
 	Q_OBJECT
 	public:


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

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