[KPhotoAlbum] Add symlink option for export images

Jesper K. Pedersen blackie at kde.org
Fri Oct 22 19:20:17 BST 2010


Added, thaks.

On Friday 15 October 2010 01:12:49 Robert Krawitz wrote:
> Export by symlink is very useful for me.
> 
> Index: Utilities/Util.cpp
> ===================================================================
> --- Utilities/Util.cpp  (revision 1185973)
> +++ Utilities/Util.cpp  (working copy)
> @@ -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() || Index: Utilities/Util.h
> ===================================================================
> --- Utilities/Util.h    (revision 1185973)
> +++ Utilities/Util.h    (working copy)
> @@ -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();
> Index: ImportExport/Export.cpp
> ===================================================================
> --- ImportExport/Export.cpp     (revision 1185973)
> +++ ImportExport/Export.cpp     (working copy)
> @@ -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 );
> Index: ImportExport/Export.h
> ===================================================================
> --- ImportExport/Export.h       (revision 1185973)
> +++ ImportExport/Export.h       (working copy)
> @@ -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;
>  };
> 
> _______________________________________________
> KPhotoAlbum mailing list
> KPhotoAlbum at mail.kdab.com
> http://mail.kdab.com/mailman/listinfo/kphotoalbum

-- 
Having trouble finding a given image in your collection containing
thousands of images?

http://www.kphotoalbum.org might be the answer.



More information about the Kphotoalbum mailing list