From kde-commits Fri Aug 18 04:06:03 2006 From: Jesper Pedersen Date: Fri, 18 Aug 2006 04:06:03 +0000 To: kde-commits Subject: extragear/graphics/kphotoalbum/ImportExport Message-Id: <1155873963.060304.20939.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=115587398223715 SVN commit 574088 by blackie: now import/export also works with videos. M +8 -14 Export.cpp M +2 -1 Import.cpp --- trunk/extragear/graphics/kphotoalbum/ImportExport/Export.cpp #574087:574088 @@ -236,7 +236,7 @@ QString file = *it; QString zippedName = _nameMap[file]; - if ( _maxSize == -1 ) { + if ( _maxSize == -1 || Utilities::isVideo( file ) ) { if ( QFileInfo( file ).isSymLink() ) file = QFileInfo(file).readLink(); @@ -261,12 +261,7 @@ // Test if the cancel button was pressed. qApp->eventLoop()->processEvents( QEventLoop::AllEvents ); -#if QT_VERSION < 0x030104 - bool canceled = _progressDialog->wasCancelled(); -#else - bool canceled = _progressDialog->wasCanceled(); -#endif - if ( canceled ) { + if ( _progressDialog->wasCanceled() ) { _ok = false; return; } @@ -281,9 +276,12 @@ { if ( !loadedOK ) return; + + const QString ext = Utilities::isVideo( fileName ) ? QString::fromLatin1( "jpg" ) : QFileInfo( _nameMap[fileName] ).extension(); + // Add the file to the zip archive - QString zipFileName = QString::fromLatin1( "%1/%2.%3" ).arg( Utilities::stripSlash(_subdir)).arg(QFileInfo( _nameMap[fileName] ).baseName()) - .arg(QFileInfo( _nameMap[fileName] ).extension() ); + QString zipFileName = QString::fromLatin1( "%1/%2.%3" ).arg( Utilities::stripSlash(_subdir)) + .arg(QFileInfo( _nameMap[fileName] ).baseName()).arg( ext ); QByteArray data; QBuffer buffer( data ); buffer.open( IO_WriteOnly ); @@ -304,11 +302,7 @@ qApp->eventLoop()->processEvents( QEventLoop::AllEvents ); -#if QT_VERSION < 0x030104 - bool canceled = (!_ok || _progressDialog->wasCancelled()); -#else bool canceled = (!_ok || _progressDialog->wasCanceled()); -#endif if ( canceled ) { _ok = false; @@ -321,7 +315,7 @@ _filesRemaining--; _progressDialog->setProgress( _steps ); - if ( _filesRemaining == 0 ) + if ( _filesRemaining == 0 && _loopEntered ) qApp->eventLoop()->exitLoop(); } --- trunk/extragear/graphics/kphotoalbum/ImportExport/Import.cpp #574087:574088 @@ -609,7 +609,8 @@ const KArchiveDirectory* thumbnailDir = static_cast( thumbnails ); - fileName = QFileInfo( fileName ).fileName(); + const QString ext = Utilities::isVideo( fileName ) ? QString::fromLatin1( "jpg" ) : QFileInfo( fileName ).extension(); + fileName = QString::fromLatin1("%1.%2").arg( Utilities::stripSlash( QFileInfo( fileName ).baseName() ) ).arg(ext); const KArchiveEntry* fileEntry = thumbnailDir->entry( fileName ); if ( fileEntry == 0 || !fileEntry->isFile() ) { KMessageBox::error( this, i18n("No thumbnail existed in export file for %1").arg( fileName ) );