Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions client/DigiDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ void SDocumentModel::open(int row)
#else
QFile::setPermissions(f.absoluteFilePath(), QFile::Permissions(QFile::Permission::ReadOwner));
#endif
if(!doc->fileName().endsWith(".pdf", Qt::CaseInsensitive) && FileDialog::isSignedPDF(f.absoluteFilePath()))
if(!doc->fileName().endsWith(QStringLiteral(".pdf"), Qt::CaseInsensitive) && FileDialog::isSignedPDF(f.absoluteFilePath()))
qApp->showClient({ f.absoluteFilePath() }, false, false, true);
else
QDesktopServices::openUrl(QUrl::fromLocalFile(f.absoluteFilePath()));
Expand Down Expand Up @@ -511,26 +511,27 @@ bool DigiDoc::open( const QString &file )
dlg.addButton(tr("YES"), ContainerSave);
return dlg.exec() == ContainerSave;
};
if((file.endsWith(QStringLiteral(".pdf"), Qt::CaseInsensitive) ||
file.endsWith(QStringLiteral(".ddoc"), Qt::CaseInsensitive)) && !serviceConfirmation())
return false;
bool online =
!(file.endsWith(QStringLiteral(".pdf"), Qt::CaseInsensitive) ||
file.endsWith(QStringLiteral(".ddoc"), Qt::CaseInsensitive)) ||
serviceConfirmation();

try
{
WaitDialogHolder waitDialog(parent, tr("Opening"), false);
waitFor([&] { b = Container::openPtr(to(file)); });
waitFor([&] { b = Container::openPtr(to(file), online ? Container::OpenDefault : Container::OpenOffline); });
if(b && b->mediaType() == "application/vnd.etsi.asic-s+zip" && b->dataFiles().size() == 1)
{
const DataFile *f = b->dataFiles().at(0);
if(from(f->fileName()).endsWith(QStringLiteral(".ddoc"), Qt::CaseInsensitive) && serviceConfirmation())
if(from(f->fileName()).endsWith(QStringLiteral(".ddoc"), Qt::CaseInsensitive))
{
const QString tmppath = FileDialog::tempPath(FileDialog::safeName(from(f->fileName())));
f->saveAs(to(tmppath));
if(QFileInfo::exists(tmppath))
{
m_tempFiles << tmppath;
parentContainer = std::move(b);
b = Container::openPtr(to(tmppath));
b = Container::openPtr(to(tmppath), serviceConfirmation() ? Container::OpenDefault : Container::OpenOffline);
}
}
}
Expand Down