Fixed export bug for hidden snapmatic when you have opened the file

through the Explorer as example
This commit is contained in:
Rafael 2016-10-27 08:59:08 +02:00
parent f645863562
commit 44c6d38d9c
5 changed files with 62 additions and 32 deletions

View file

@ -79,10 +79,6 @@ bool SnapmaticPicture::readingPicture(bool writeEnabled_)
QFile *picFile = new QFile(picFileName);
QIODevice *picStream;
if (picFileName.right(7) == ".hidden") // for the hidden file system
{
picFileName.remove(picFileName.length() - 7, 7);
}
if (!picFile->open(QFile::ReadOnly))
{
@ -484,3 +480,44 @@ QDateTime SnapmaticPicture::getCreatedDateTime()
{
return jsonCreatedDateTime;
}
// VISIBILITY
bool SnapmaticPicture::isHidden()
{
if (picFileName.right(7) == ".hidden")
{
return true;
}
return false;
}
bool SnapmaticPicture::setPictureHidden()
{
if (!isHidden())
{
QString newPicFileName = QString(picFileName + ".hidden");
if (QFile::rename(picFileName, newPicFileName))
{
picFileName = newPicFileName;
return true;
}
return false;
}
return true;
}
bool SnapmaticPicture::setPictureVisible()
{
if (isHidden())
{
QString newPicFileName = QString(picFileName).remove(picFileName.length() - 7, 7);
if (QFile::rename(picFileName, newPicFileName))
{
picFileName = newPicFileName;
return true;
}
return false;
}
return true;
}