Commit 451bb315 authored by Miika Turkia's avatar Miika Turkia
Browse files

Option to skip symbolic links

Option to ignore symbolic links is added. Thanks to Rik for the patch.

BUG: 223065
BUG: 248040
parent 5087e2ab
......@@ -87,6 +87,9 @@ void NewImageFinder::searchForNewFiles( const QSet<QString>& loadedFiles, QStrin
QStringList excluded;
excluded << Settings::SettingsData::instance()->excludeDirectories();
excluded = excluded.at(0).split(QString::fromLatin1(","));
bool skipSymlinks = Settings::SettingsData::instance()->skipSymlinks();
for( QStringList::const_iterator it = dirList.constBegin(); it != dirList.constEnd(); ++it ) {
QString file = directory + QString::fromLatin1("/") + *it;
if ( (*it) == QString::fromLatin1(".") || (*it) == QString::fromLatin1("..") ||
......@@ -99,6 +102,8 @@ void NewImageFinder::searchForNewFiles( const QSet<QString>& loadedFiles, QStrin
if ( !fi.isReadable() )
continue;
if ( skipSymlinks && fi.isSymLink() )
continue;
if ( fi.isFile() ) {
QString baseName = file.mid( imageDir.length()+1 );
......
......@@ -38,6 +38,7 @@ Settings::FileVersionDetectionPage::FileVersionDetectionPage( QWidget* parent )
// Search for images on startup
_searchForImagesOnStart = new QCheckBox( i18n("Search for new images and videos on startup"), generalBox );
_skipSymlinks = new QCheckBox( i18n("Skip symbolic links when searching for new images"), generalBox );
_skipRawIfOtherMatches = new QCheckBox( i18n("Do not read RAW files if a matching JPEG/TIFF file exists"), generalBox );
// Exclude directories from search
......@@ -77,6 +78,11 @@ Settings::FileVersionDetectionPage::FileVersionDetectionPage( QWidget* parent )
"using <b>Maintenance->Rescan for new images</b></p>");
_searchForImagesOnStart->setWhatsThis( txt );
txt = i18n( "<p>KPhotoAlbum attempts to read all image files whether actual files or symbolic links. If you "
"wish to ignore symbolic links, check this option. This is useful if for some reason you have e.g. "
"both the original files and and symbolic links to these files within your image directory.</p>");
_skipSymlinks->setWhatsThis( txt );
txt = i18n( "<p>KPhotoAlbum is capable of reading certain kinds of RAW images. "
"Some cameras store both a RAW image and a matching JPEG or TIFF image. "
"This causes duplicate images to be stored in KPhotoAlbum, which may be undesirable. "
......@@ -102,6 +108,7 @@ Settings::FileVersionDetectionPage::FileVersionDetectionPage( QWidget* parent )
void Settings::FileVersionDetectionPage::loadSettings( Settings::SettingsData* opt )
{
_searchForImagesOnStart->setChecked( opt->searchForImagesOnStart() );
_skipSymlinks->setChecked( opt->skipSymlinks() );
_skipRawIfOtherMatches->setChecked( opt->skipRawIfOtherMatches() );
_excludeDirectories->setText( opt->excludeDirectories() );
_detectModifiedFiles->setChecked( opt->detectModifiedFiles() );
......@@ -116,6 +123,7 @@ void Settings::FileVersionDetectionPage::loadSettings( Settings::SettingsData* o
void Settings::FileVersionDetectionPage::saveSettings( Settings::SettingsData* opt )
{
opt->setSearchForImagesOnStart( _searchForImagesOnStart->isChecked() );
opt->setSkipSymlinks( _skipSymlinks->isChecked() );
opt->setSkipRawIfOtherMatches( _skipRawIfOtherMatches->isChecked() );
opt->setExcludeDirectories( _excludeDirectories->text() );
opt->setDetectModifiedFiles( _detectModifiedFiles->isChecked() );
......
......@@ -37,6 +37,7 @@ public:
private:
QCheckBox* _searchForImagesOnStart;
QCheckBox* _skipSymlinks;
QCheckBox* _skipRawIfOtherMatches;
QLineEdit* _excludeDirectories; // Directories to exclude
QCheckBox* _detectModifiedFiles;
......
......@@ -153,6 +153,7 @@ property_ref ( backend , setBackend , QString
property_copy( useEXIFRotate , setUseEXIFRotate , bool , General, true )
property_copy( useEXIFComments , setUseEXIFComments , bool , General, true )
property_copy( searchForImagesOnStart, setSearchForImagesOnStart, bool , General, true )
property_copy( skipSymlinks, setSkipSymlinks , bool , General, false )
property_copy( skipRawIfOtherMatches , setSkipRawIfOtherMatches , bool , General, false )
property_copy( useRawThumbnail , setUseRawThumbnail , bool , General, false )
property_copy( useRawThumbnailSize , setUseRawThumbnailSize , QSize , General, QSize(1024,768) )
......
......@@ -78,6 +78,7 @@ public:
property_copy( useEXIFRotate , setUseEXIFRotate , bool );
property_copy( useEXIFComments , setUseEXIFComments , bool );
property_copy( searchForImagesOnStart, setSearchForImagesOnStart, bool );
property_copy( skipSymlinks , setSkipSymlinks , bool );
property_copy( skipRawIfOtherMatches , setSkipRawIfOtherMatches , bool );
property_copy( useRawThumbnail , setUseRawThumbnail , bool );
property_copy( useRawThumbnailSize , setUseRawThumbnailSize , QSize );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment