SVN commit 1188585 by blackie: added export by symlink M +3 -0 ChangeLog M +7 -0 ImportExport/Export.cpp M +2 -1 ImportExport/Export.h M +8 -0 Utilities/Util.cpp M +1 -0 Utilities/Util.h --- trunk/extragear/graphics/kphotoalbum/ChangeLog #1188584:1188585 @@ -1,5 +1,8 @@ 2010-10-22 Jesper K. Pedersen + * Added "Export by symlink" to the export dialog. Thanks to Robert + Krawitz for a patch. + * Bugfix: If you right click on an image in the viewer and accidentally hover over Run Program (on the selection), it is extremely slow. Thanks to Robert Krawitz for a patch --- trunk/extragear/graphics/kphotoalbum/ImportExport/Export.cpp #1188584:1188585 @@ -85,12 +85,14 @@ _manually = new QRadioButton( i18n("Manual copy next to .kim file"), grp ); _auto = new QRadioButton( i18n("Automatically copy next to .kim file"), grp ); _link = new QRadioButton( i18n("Hard link next to .kim file"), grp ); + _symlink = new QRadioButton( i18n("Symbolic link next to .kim file"), grp ); _manually->setChecked( true ); boxLay->addWidget( _include ); boxLay->addWidget( _manually ); boxLay->addWidget( _auto ); boxLay->addWidget( _link ); + boxLay->addWidget( _symlink ); // Compress _compress = new QCheckBox( i18n("Compress export file"), top ); @@ -151,6 +153,7 @@ _include->setWhatsThis( txt ); _manually->setWhatsThis( txt ); _link->setWhatsThis( txt ); + _symlink->setWhatsThis( txt ); _auto->setWhatsThis( txt ); setHelp( QString::fromLatin1( "chp-exportDialog" ) ); } @@ -163,6 +166,8 @@ return ManualCopy; else if ( _link->isChecked() ) return Link; + else if ( _symlink->isChecked() ) + return Symlink; else return AutoCopy; } @@ -270,6 +275,8 @@ Utilities::copy( file, _destdir + QString::fromLatin1( "/" ) + zippedName ); else if ( _location == Link ) Utilities::makeHardLink( file, _destdir + QString::fromLatin1( "/" ) + zippedName ); + else if ( _location == Symlink ) + Utilities::makeSymbolicLink( file, _destdir + QString::fromLatin1( "/" ) + zippedName ); _steps++; _progressDialog->setProgress( _steps ); --- trunk/extragear/graphics/kphotoalbum/ImportExport/Export.h #1188584:1188585 @@ -35,7 +35,7 @@ namespace ImportExport { -enum ImageFileLocation { Inline, ManualCopy, AutoCopy, Link }; +enum ImageFileLocation { Inline, ManualCopy, AutoCopy, Link, Symlink }; class Export :public ImageManager::ImageClient { @@ -89,6 +89,7 @@ QRadioButton* _include; QRadioButton* _manually; QRadioButton* _link; + QRadioButton* _symlink; QRadioButton* _auto; }; --- trunk/extragear/graphics/kphotoalbum/Utilities/Util.cpp #1188584:1188585 @@ -346,6 +346,14 @@ return true; } +bool Utilities::makeSymbolicLink( const QString& from, const QString& to ) +{ + if (symlink(from.toLocal8Bit(), to.toLocal8Bit()) != 0) + return false; + else + return true; +} + bool Utilities::canReadImage( const QString& fileName ) { return ! KImageIO::typeForMime( KMimeType::findByPath( fileName, 0, true )->name() ).isEmpty() || --- trunk/extragear/graphics/kphotoalbum/Utilities/Util.h #1188584:1188585 @@ -40,6 +40,7 @@ bool ctrlKeyDown(); bool copy( const QString& from, const QString& to ); void copyList( const QStringList& from, const QString& directoryTo ); +bool makeSymbolicLink( const QString& from, const QString& to ); bool makeHardLink( const QString& from, const QString& to ); bool runningDemo(); void deleteDemo();