"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/c2bUtils.cpp" between
cb2bib-1.9.9.tar.gz and cb2bib-2.0.0.tar.gz

About: cb2Bib is a multiplatform application for rapidly extracting unformatted, or unstandardized bibliographic references from email alerts, journal Web pages, and PDF files.

c2bUtils.cpp  (cb2bib-1.9.9):c2bUtils.cpp  (cb2bib-2.0.0)
/*************************************************************************** /***************************************************************************
* Copyright (C) 2004-2018 by Pere Constans * Copyright (C) 2004-2019 by Pere Constans
* constans@molspaces.com * constans@molspaces.com
* cb2Bib version 1.9.9. Licensed under the GNU GPL version 3. * cb2Bib version 2.0.0. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution. * See the LICENSE file that comes with this distribution.
***************************************************************************/ ***************************************************************************/
#include "c2bUtils.h" #include "c2bUtils.h"
#include <QDesktopServices> #include <QDesktopServices>
#include <QMessageBox> #include <QMessageBox>
namespace c2bUtils namespace c2bUtils
{ {
bool openFile(const QString& fn, QWidget* w) bool openFile(const QString& fn, QWidget* w)
{ {
// URL fn is decoded always, in the hope of making openFile encoding agnosti c // URL fn is decoded always, in the hope of making openFile encoding agnosti c
const QString decoded(QUrl::fromPercentEncoding(fn.toUtf8())); const QString decoded(QUrl::fromPercentEncoding(fn.toUtf8()));
const QUrl url(stringToUrl(decoded)); const QUrl url(stringToUrl(decoded));
if (!url.isValid()) if (!url.isValid())
{ {
if (w) if (w)
QMessageBox::warning(w, QObject::tr("Warning - cb2Bib"), QMessageBox::warning(w, QObject::tr("Warning - cb2Bib"),
QObject::tr("Unable to open file.\nError: URL ' QObject::tr("Unable to open file.\nError: URL '
%1' is not valid."). %1' is not valid.").arg(url.toString()),
arg(url.toString()), QMessageBox::Ok); QMessageBox::Ok);
return false; return false;
} }
if (!QDesktopServices::openUrl(url)) if (!QDesktopServices::openUrl(url))
{ {
if (w) if (w)
QMessageBox::warning(w, QObject::tr("Warning - cb2Bib"), QObject::tr QMessageBox::warning(w, QObject::tr("Warning - cb2Bib"), QObject::tr
("Unable to open file '%1'."). ("Unable to open file '%1'.").arg(fn),
arg(fn), QMessageBox::Ok); QMessageBox::Ok);
return false; return false;
} }
return true; return true;
} }
} // namespace c2bUtils } // namespace c2bUtils
 End of changes. 4 change blocks. 
8 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)