Merge lp:~jesse-andries/referencer/referencer into lp:referencer

Proposed by jesse andries
Status: Merged
Merge reported by: Mads Chr. Olesen
Merged at revision: not available
Proposed branch: lp:~jesse-andries/referencer/referencer
Merge into: lp:referencer
Diff against target: 60 lines (+28/-4)
2 files modified
plugins/ads.py (+2/-1)
src/DocumentProperties.C (+26/-3)
To merge this branch: bzr merge lp:~jesse-andries/referencer/referencer
Reviewer Review Type Date Requested Status
Mads Chr. Olesen Approve
Review via email: mp+151124@code.launchpad.net

Description of the change

Case normalisation issues in ADS-plugin and in adding fields through the Document Properties dialogue, as discussed in comment 8 in bug 1099754)

ADS-plugin: Additional fields and normalised case of the Month field

Normalised case of the fields added through the document properties dialog (see comment 8 in bug 1099754). Also added a check which refuses to create a field that already exists even though there are differences in the case of the field-key. This was done to resolve the following problem: It used to be possible to create different versions (different case of the key) of the same field thus holding different values. These were then only subsequently collapsed (retaining the first appearing version of the field-key with the last appearing value) when hitting the Save button, without warning to the user.

To post a comment you must log in.
Revision history for this message
Mads Chr. Olesen (shiyee) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/ads.py'
--- plugins/ads.py 2013-01-20 02:03:38 +0000
+++ plugins/ads.py 2013-02-28 23:15:25 +0000
@@ -55,8 +55,9 @@
55 fields.append (["volume", get_field(xmldoc, "volume")])55 fields.append (["volume", get_field(xmldoc, "volume")])
56 fields.append (["issue", get_field(xmldoc, "issue")])56 fields.append (["issue", get_field(xmldoc, "issue")])
57 fields.append (["year", get_field(xmldoc, "pubdate").partition(' ')[2]])57 fields.append (["year", get_field(xmldoc, "pubdate").partition(' ')[2]])
58 fields.append (["month", str.lower(get_field(xmldoc, "pubdate").partition(' ')[0])])58 fields.append (["Month", str.lower(get_field(xmldoc, "pubdate").partition(' ')[0])])
59 fields.append (["Adsurl", xmldoc.getElementsByTagName('url')[-1].childNodes[0].data.encode("utf-8")])59 fields.append (["Adsurl", xmldoc.getElementsByTagName('url')[-1].childNodes[0].data.encode("utf-8")])
60 fields.append (["Adsbibcode", get_field(xmldoc, "bibcode")])
6061
61 authors = xmldoc.getElementsByTagName('author')62 authors = xmldoc.getElementsByTagName('author')
62 authorString = ""63 authorString = ""
6364
=== modified file 'src/DocumentProperties.C'
--- src/DocumentProperties.C 2012-11-03 09:11:50 +0000
+++ src/DocumentProperties.C 2013-02-28 23:15:25 +0000
@@ -24,6 +24,7 @@
24#include "ThumbnailGenerator.h"24#include "ThumbnailGenerator.h"
25#include "RefWindow.h"25#include "RefWindow.h"
2626
27#include "Utility.h"
27#include "DocumentProperties.h"28#include "DocumentProperties.h"
2829
2930
@@ -378,9 +379,31 @@
378 vbox->set_border_width (12);379 vbox->set_border_width (12);
379380
380 if (dialog.run () == Gtk::RESPONSE_ACCEPT) {381 if (dialog.run () == Gtk::RESPONSE_ACCEPT) {
381 Gtk::ListStore::iterator row = extrafieldsstore_->append ();382
382 (*row)[extrakeycol_] = entry.get_text ();383 Gtk::ListStore::iterator it = extrafieldsstore_->children().begin ();
383 (*row)[extravalcol_] = "";384 Gtk::ListStore::iterator const end = extrafieldsstore_->children().end ();
385 bool key_isnew = true;
386 for (; it != end; ++it)
387 if (Utility::firstCap ((*it)[extrakeycol_]) == Utility::firstCap (entry.get_text ())) {
388 key_isnew = false;
389 }
390 if ( key_isnew ) {
391 Gtk::ListStore::iterator row = extrafieldsstore_->append ();
392 (*row)[extrakeycol_] = Utility::firstCap (entry.get_text ());
393 (*row)[extravalcol_] = "";
394 } else {
395 Glib::ustring message;
396 message = String::ucompose (
397 "<b><big>%1</big></b>",
398 _("This key already exists.\n"));
399 Gtk::MessageDialog dialog (
400
401 message, true,
402 Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE, true);
403
404 dialog.run ();
405
406 }
384 }407 }
385}408}
386409

Subscribers

People subscribed via source and target branches