"Fossies" - the Fresh Open Source Software Archive  

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

c2bBibParser.cpp  (cb2bib-1.9.9):c2bBibParser.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 "c2bBibParser.h" #include "c2bBibParser.h"
#include "c2b.h" #include "c2b.h"
#include "c2bSettings.h" #include "c2bSettings.h"
#include <authorString.h> #include <authorString.h>
#include <bibPreparser.h> #include <bibPreparser.h>
skipping to change at line 33 skipping to change at line 33
// Warn users if journal database file is not setup // Warn users if journal database file is not setup
const QString journal_f(_settingsP->fileName("cb2Bib/JournalFile")); const QString journal_f(_settingsP->fileName("cb2Bib/JournalFile"));
if (journal_f.isEmpty()) if (journal_f.isEmpty())
QMessageBox::information(_c2b_mainP, tr("Information - cb2Bib"), QMessageBox::information(_c2b_mainP, tr("Information - cb2Bib"),
tr("No Abbreviation Journal file has been speci fied.\n\n" tr("No Abbreviation Journal file has been speci fied.\n\n"
"Note: Abbreviation files are specified thro ugh the cb2Bib Configure dialog."), "Note: Abbreviation files are specified thro ugh the cb2Bib Configure dialog."),
QMessageBox::Ok); QMessageBox::Ok);
else else
{ {
QFile f(journal_f); QFile f(journal_f);
if (!f.open(QIODevice::ReadOnly | QIODevice::Text)) // jdbfile.exis ts wouldn't produce an errorString if (!f.open(QIODevice::ReadOnly | QIODevice::Text)) // jdbfile.exists wo uldn't produce an errorString
QMessageBox::warning(_c2b_mainP, tr("Warning - cb2Bib"), QMessageBox::warning(_c2b_mainP, tr("Warning - cb2Bib"),
tr("Unable to open the Journal Abbreviation fil e %1 for reading.\nError: '%2'.\n\n" tr("Unable to open the Journal Abbreviation fil e %1 for reading.\nError: '%2'.\n\n"
"Note: Abbreviation files are specified thro ugh the cb2Bib Configure dialog.") "Note: Abbreviation files are specified thro ugh the cb2Bib Configure dialog.")
.arg(journal_f).arg(f.errorString()), QMessageB .arg(journal_f, f.errorString()),
ox::Ok); QMessageBox::Ok);
else else
f.close(); f.close();
} }
// Set status messages // Set status messages
connect(this, SIGNAL(statusMessage(const QString&)), c2b::instance(), SIGNAL (statusMessage(const QString&))); connect(this, SIGNAL(statusMessage(QString)), c2b::instance(), SIGNAL(status Message(QString)));
// Set preparser log // Set preparser log
connect(_preparserP, SIGNAL(preparserLogAvailable(const QString&)), this, SL OT(showLog(const QString&))); connect(_preparserP, SIGNAL(preparserLogAvailable(QString)), this, SLOT(show Log(QString)));
} }
c2bBibParser::~c2bBibParser() c2bBibParser::~c2bBibParser() {}
{}
void c2bBibParser::currentReferenceUpdated() void c2bBibParser::currentReferenceUpdated()
{ {
// Current reference has been updated by the base class. // Current reference has been updated by the base class.
// Update it in the GUI // Update it in the GUI
_bp_updates_gui = true; _bp_updates_gui = true;
bibReferenceIterator i; bibReferenceIterator i;
for (i = _current_reference.constBegin(); i != _current_reference.constEnd() ; ++i) for (i = _current_reference.constBegin(); i != _current_reference.constEnd() ; ++i)
_field_editors[i.key()]->setText(i.value()); _field_editors[i.key()]->setText(i.value());
// Set default type to article // Set default type to article
skipping to change at line 77 skipping to change at line 77
} }
void c2bBibParser::clearCurrentReference() void c2bBibParser::clearCurrentReference()
{ {
_bp_updates_gui = true; _bp_updates_gui = true;
// Clear by setting empty QString as a workaround for bug // Clear by setting empty QString as a workaround for bug
// http://bugreports.qt.nokia.com/browse/QTBUG-7866 // http://bugreports.qt.nokia.com/browse/QTBUG-7866
// Affects versions 4.6.x, expected to be fixed in 4.6.3 // Affects versions 4.6.x, expected to be fixed in 4.6.3
for (int i = 0; i < _bibliographic_fields.count(); ++i) for (int i = 0; i < _bibliographic_fields.count(); ++i)
_field_editors[_bibliographic_fields.at(i)]->setText(QString()); _field_editors[_bibliographic_fields.at(i)]->setText(QString());
// _field_editors[_bibliographic_fields.at(i)]->clear(); // _field_editors[_bibliographic_fields.at(i)]->clear();
_field_editors["id"]->setText(QString()); _field_editors["id"]->setText(QString());
// _field_editors["id"]->clear(); // _field_editors["id"]->clear();
bibParser::clearCurrentReference(); bibParser::clearCurrentReference();
_current_reference.typeName = "article"; _current_reference.typeName = "article";
_type_editor->setCurrentIndex(1); _type_editor->setCurrentIndex(1);
_bp_updates_gui = false; _bp_updates_gui = false;
emit bibModified(false); emit bibModified(false);
} }
void c2bBibParser::referenceEdited(const QString& value) void c2bBibParser::referenceEdited(const QString& value)
{ {
if (_bp_updates_gui) if (_bp_updates_gui)
skipping to change at line 160 skipping to change at line 160
_type_editor->insertItems(0, _bibliographic_types); _type_editor->insertItems(0, _bibliographic_types);
_type_editor->setCurrentIndex(1); _type_editor->setCurrentIndex(1);
_current_reference.typeName = "article"; _current_reference.typeName = "article";
// Tracking Field Editor Line changes // Tracking Field Editor Line changes
// Track using textChanged instead of editTextChanged. The latter does not t rack line clears // Track using textChanged instead of editTextChanged. The latter does not t rack line clears
for (int i = 0; i < _bibliographic_fields.count(); ++i) for (int i = 0; i < _bibliographic_fields.count(); ++i)
{ {
const QString& name = _bibliographic_fields.at(i); const QString& name = _bibliographic_fields.at(i);
connect(_field_editors.value(name), SIGNAL(returnPressed()), this, SLOT( setField())); connect(_field_editors.value(name), SIGNAL(returnPressed()), this, SLOT( setField()));
connect(_field_editors.value(name), SIGNAL(textChanged(const QString&)), this, SLOT(referenceEdited(const QString&))); connect(_field_editors.value(name), SIGNAL(textChanged(QString)), this, SLOT(referenceEdited(QString)));
} }
connect(_field_editors.value("id"), SIGNAL(textChanged(const QString&)), thi connect(_field_editors.value("id"), SIGNAL(textChanged(QString)), this, SLOT
s, SLOT(referenceEdited(const QString&))); (referenceEdited(QString)));
connect(_type_editor, SIGNAL(editTextChanged(const QString&)), this, SLOT(re connect(_type_editor, SIGNAL(editTextChanged(QString)), this, SLOT(reference
ferenceEdited(const QString&))); Edited(QString)));
} }
void c2bBibParser::showLog(const QString& log) void c2bBibParser::showLog(const QString& log)
{ {
if (!_preparser_logP) if (!_preparser_logP)
_preparser_logP = new c2bBibPreparserLog(_c2b_mainP); _preparser_logP = new c2bBibPreparserLog(_c2b_mainP);
_preparser_logP->append(log); _preparser_logP->append(log);
_preparser_logP->show(); // Don't use exec(), it could be a recursive call i f clipboard changed _preparser_logP->show(); // Don't use exec(), it could be a recursive call i f clipboard changed
} }
void c2bBibParser::checkRegExpFile(const QString& fn) void c2bBibParser::checkRegExpFile(const QString& fn)
{ {
if (fn.isEmpty()) if (fn.isEmpty())
{ {
QMessageBox::information(_c2b_mainP, tr("Information - cb2Bib"), QMessageBox::information(_c2b_mainP, tr("Information - cb2Bib"),
tr("No RegExp filename has been specified.\n\n" tr("No RegExp filename has been specified.\n\n"
"Note: RegExp files are specified through th "Note: RegExp files are specified through th
e cb2Bib Configure dialog."), QMessageBox::Ok); e cb2Bib Configure dialog."),
QMessageBox::Ok);
return; return;
} }
QFile f(fn); QFile f(fn);
if (!f.open(QIODevice::ReadOnly | QIODevice::Text)) if (!f.open(QIODevice::ReadOnly | QIODevice::Text))
QMessageBox::warning(_c2b_mainP, tr("Warning - cb2Bib"), QMessageBox::warning(_c2b_mainP, tr("Warning - cb2Bib"),
tr("Unable to open the RegExp file %1 for reading.\ nError: '%2'.\n\n" tr("Unable to open the RegExp file %1 for reading.\ nError: '%2'.\n\n"
"Note: RegExp files are specified through the cb 2Bib Configure dialog. " "Note: RegExp files are specified through the cb 2Bib Configure dialog. "
"After manual matching, patterns can be edited a nd stored in a " "After manual matching, patterns can be edited a nd stored in a "
"RegExp file for future autodetection.").arg(fn) "RegExp file for future autodetection.")
.arg(f.errorString()), QMessageBox::Ok); .arg(fn, f.errorString()),
QMessageBox::Ok);
else else
f.close(); f.close();
} }
 End of changes. 13 change blocks. 
20 lines changed or deleted 21 lines changed or added

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