"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/c2bExportDialog.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.

c2bExportDialog.cpp  (cb2bib-1.9.9):c2bExportDialog.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 "c2bExportDialog.h" #include "c2bExportDialog.h"
#include "c2b.h" #include "c2b.h"
#include "c2bFileDialog.h" #include "c2bFileDialog.h"
#include "c2bSettings.h" #include "c2bSettings.h"
#include "c2bUtils.h" #include "c2bUtils.h"
#include <QMessageBox> #include <QMessageBox>
#include <QPushButton> #include <QPushButton>
c2bExportDialog::c2bExportDialog(const QString& fn, const QString& contents, con c2bExportDialog::c2bExportDialog(const QString& fn, const QString& contents, con
st QStringList& keys, QWidget* parentw) : st QStringList& keys, QWidget* parentw)
QDialog(parentw) : QDialog(parentw)
{ {
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
_ed.bibtex_fn = fn; _ed.bibtex_fn = fn;
if (contents.isEmpty()) if (contents.isEmpty())
_ed.bibtex_contents = c2bUtils::fileToString(fn); _ed.bibtex_contents = c2bUtils::fileToString(fn);
else else
_ed.bibtex_contents = contents; _ed.bibtex_contents = contents;
_ed.bibtex_keys = keys; _ed.bibtex_keys = keys;
ui.setupUi(this); ui.setupUi(this);
setWindowTitle(tr("Export Entries - cb2Bib")); setWindowTitle(tr("Export Entries - cb2Bib"));
skipping to change at line 66 skipping to change at line 66
} }
void c2bExportDialog::_export() void c2bExportDialog::_export()
{ {
_ed.copy_documents = ui.CopyDocuments->isChecked(); _ed.copy_documents = ui.CopyDocuments->isChecked();
_ed.documents_dir = ui.DocumentsDirectory->text(); _ed.documents_dir = ui.DocumentsDirectory->text();
_ed.export_fn = ui.ExportFile->text(); _ed.export_fn = ui.ExportFile->text();
_ed.relative_dir = ui.RelativeDocumentDirectory->isChecked(); _ed.relative_dir = ui.RelativeDocumentDirectory->isChecked();
// Check files // Check files
if (QFileInfo(_ed.export_fn).exists()) if (QFileInfo::exists(_ed.export_fn))
{ {
const int button(QMessageBox::warning(this, tr("Warning - cb2Bib"), const int button(QMessageBox::warning(
tr("File %1 already exists.\nDo yo this, tr("Warning - cb2Bib"), tr("File %1 already e
u want to replace it?").arg(_ed.export_fn), xists.\nDo you want to replace it?").arg(_ed.export_fn),
QMessageBox::Yes | QMessageBox::No QMessageBox::Yes | QMessageBox::No));
));
if (button == QMessageBox::No) if (button == QMessageBox::No)
return; return;
} }
if (_ed.copy_documents) if (_ed.copy_documents)
{ {
const QString ddname(c2bUtils::documentAbsoluteName(_ed.relative_dir, _e const QString ddname(
d.export_fn, _ed.documents_dir, QString()) + QDir::separator()); c2bUtils::documentAbsoluteName(_ed.relative_dir, _ed.export_fn, _ed.
documents_dir, QString()) +
QDir::separator());
QDir doc_dir(ddname); QDir doc_dir(ddname);
if (!doc_dir.exists()) if (!doc_dir.exists())
if (!doc_dir.mkpath(ddname)) if (!doc_dir.mkpath(ddname))
{ {
QMessageBox::warning(this, tr("Warning - cb2Bib"), QMessageBox::warning(this, tr("Warning - cb2Bib"), tr("Unable to
tr("Unable to create directory %1.").arg(dd create directory %1.").arg(ddname),
name), QMessageBox::Ok); QMessageBox::Ok);
return; return;
} }
} }
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
c2bExport e(this); c2bExport e(this);
e.exportEntries(_ed); e.exportEntries(_ed);
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
accept(); accept();
} }
 End of changes. 7 change blocks. 
16 lines changed or deleted 17 lines changed or added

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