Esempio n. 1
0
bool BibtexCollection::modifyField(Tellico::Data::FieldPtr newField_) {
  if(!newField_) {
    return false;
  }
//  myDebug();
  bool success = Collection::modifyField(newField_);
  FieldPtr oldField = fieldByName(newField_->name());
  QString oldBibtex = oldField->property(QLatin1String("bibtex"));
  QString newBibtex = newField_->property(QLatin1String("bibtex"));
  if(!oldBibtex.isEmpty()) {
    success &= (m_bibtexFieldDict.remove(oldBibtex) != 0);
  }
  if(!newBibtex.isEmpty()) {
    oldField->setProperty(QLatin1String("bibtex"), newBibtex);
    m_bibtexFieldDict.insert(newBibtex, oldField.data());
  }
  return success;
}
Esempio n. 2
0
Tellico::Data::FieldList BibtexCollection::defaultFields() {
  FieldList list;
  FieldPtr field;

/******************* General ****************************/

  field = createDefaultField(TitleField);
  field->setProperty(QLatin1String("bibtex"), QLatin1String("title"));
  list.append(field);

  QStringList types;
  types << QLatin1String("article") << QLatin1String("book")
        << QLatin1String("booklet") << QLatin1String("inbook")
        << QLatin1String("incollection") << QLatin1String("inproceedings")
        << QLatin1String("manual") << QLatin1String("mastersthesis")
        << QLatin1String("misc") << QLatin1String("phdthesis")
        << QLatin1String("proceedings") << QLatin1String("techreport")
        << QLatin1String("unpublished") << QLatin1String("periodical")
        << QLatin1String("conference");
  field = new Field(QLatin1String("entry-type"), i18n("Entry Type"), types);
  field->setProperty(QLatin1String("bibtex"), QLatin1String("entry-type"));
  field->setCategory(i18n(bibtex_general));
  field->setFlags(Field::AllowGrouped | Field::NoDelete);
  field->setDescription(i18n("These entry types are specific to bibtex. See the bibtex documentation."));
  list.append(field);

  field = new Field(QLatin1String("author"), i18n("Author"));
  field->setProperty(QLatin1String("bibtex"), QLatin1String("author"));
  field->setCategory(i18n(bibtex_general));
  field->setFlags(Field::AllowCompletion | Field::AllowMultiple | Field::AllowGrouped);
  field->setFormatType(FieldFormat::FormatName);
  list.append(field);

  field = new Field(QLatin1String("bibtex-key"), i18n("Bibtex Key"));
  field->setProperty(QLatin1String("bibtex"), QLatin1String("key"));
  field->setCategory(i18n("General"));
  field->setFlags(Field::NoDelete);
  list.append(field);

  field = new Field(QLatin1String("booktitle"), i18n("Book Title"));
  field->setProperty(QLatin1String("bibtex"), QLatin1String("booktitle"));
  field->setCategory(i18n(bibtex_general));
  field->setFormatType(FieldFormat::FormatTitle);
  list.append(field);

  field = new Field(QLatin1String("editor"), i18n("Editor"));
  field->setProperty(QLatin1String("bibtex"), QLatin1String("editor"));
  field->setCategory(i18n(bibtex_general));
  field->setFlags(Field::AllowCompletion | Field::AllowMultiple | Field::AllowGrouped);
  field->setFormatType(FieldFormat::FormatName);
  list.append(field);

  field = new Field(QLatin1String("organization"), i18n("Organization"));
  field->setProperty(QLatin1String("bibtex"), QLatin1String("organization"));
  field->setCategory(i18n(bibtex_general));
  field->setFlags(Field::AllowCompletion | Field::AllowGrouped);
  field->setFormatType(FieldFormat::FormatPlain);
  list.append(field);

//  field = new Field(QLatin1String("institution"), i18n("Institution"));
//  field->setProperty(QLatin1String("bibtex"), QLatin1String("institution"));
//  field->setCategory(i18n(bibtex_general));
//  field->setFlags(Field::AllowDelete);
//  field->setFormatType(FieldFormat::FormatTitle);
//  list.append(field);

/******************* Publishing ****************************/
  field = new Field(QLatin1String("publisher"), i18n("Publisher"));
  field->setProperty(QLatin1String("bibtex"), QLatin1String("publisher"));
  field->setCategory(i18n(bibtex_publishing));
  field->setFlags(Field::AllowCompletion | Field::AllowGrouped);
  field->setFormatType(FieldFormat::FormatPlain);
  list.append(field);

  field = new Field(QLatin1String("address"), i18n("Address"));
  field->setProperty(QLatin1String("bibtex"), QLatin1String("address"));
  field->setCategory(i18n(bibtex_publishing));
  field->setFlags(Field::AllowCompletion | Field::AllowGrouped);
  list.append(field);

  field = new Field(QLatin1String("edition"), i18n("Edition"));
  field->setProperty(QLatin1String("bibtex"), QLatin1String("edition"));
  field->setCategory(i18n(bibtex_publishing));
  field->setFlags(Field::AllowCompletion);
  list.append(field);

  // don't make it a number, it could have latex processing commands in it
  field = new Field(QLatin1String("pages"), i18n("Pages"));
  field->setProperty(QLatin1String("bibtex"), QLatin1String("pages"));
  field->setCategory(i18n(bibtex_publishing));
  list.append(field);

  field = new Field(QLatin1String("year"), i18n("Year"), Field::Number);
  field->setProperty(QLatin1String("bibtex"), QLatin1String("year"));
  field->setCategory(i18n(bibtex_publishing));
  field->setFlags(Field::AllowGrouped);
  list.append(field);

  field = new Field(QLatin1String("isbn"), i18n("ISBN#"));
  field->setProperty(QLatin1String("bibtex"), QLatin1String("isbn"));
  field->setCategory(i18n(bibtex_publishing));
  field->setDescription(i18n("International Standard Book Number"));
  list.append(field);

  field = new Field(QLatin1String("journal"), i18n("Journal"));
  field->setProperty(QLatin1String("bibtex"), QLatin1String("journal"));
  field->setCategory(i18n(bibtex_publishing));
  field->setFlags(Field::AllowCompletion | Field::AllowGrouped);
  field->setFormatType(FieldFormat::FormatPlain);
  list.append(field);

  field = new Field(QLatin1String("doi"), i18n("DOI"));
  field->setProperty(QLatin1String("bibtex"), QLatin1String("doi"));
  field->setCategory(i18n(bibtex_publishing));
  field->setDescription(i18n("Digital Object Identifier"));
  list.append(field);

  // could make this a string list, but since bibtex import could have funky values
  // keep it an editbox
  field = new Field(QLatin1String("month"), i18n("Month"));
  field->setProperty(QLatin1String("bibtex"), QLatin1String("month"));
  field->setCategory(i18n(bibtex_publishing));
  field->setFlags(Field::AllowCompletion);
  list.append(field);

  field = new Field(QLatin1String("number"), i18n("Number"), Field::Number);
  field->setProperty(QLatin1String("bibtex"), QLatin1String("number"));
  field->setCategory(i18n(bibtex_publishing));
  list.append(field);

  field = new Field(QLatin1String("howpublished"), i18n("How Published"));
  field->setProperty(QLatin1String("bibtex"), QLatin1String("howpublished"));
  field->setCategory(i18n(bibtex_publishing));
  list.append(field);

//  field = new Field(QLatin1String("school"), i18n("School"));
//  field->setProperty(QLatin1String("bibtex"), QLatin1String("school"));
//  field->setCategory(i18n(bibtex_publishing));
//  field->setFlags(Field::AllowCompletion | Field::AllowGrouped);
//  list.append(field);

/******************* Classification ****************************/
  field = new Field(QLatin1String("chapter"), i18n("Chapter"), Field::Number);
  field->setProperty(QLatin1String("bibtex"), QLatin1String("chapter"));
  field->setCategory(i18n(bibtex_misc));
  list.append(field);

  field = new Field(QLatin1String("series"), i18n("Series"));
  field->setProperty(QLatin1String("bibtex"), QLatin1String("series"));
  field->setCategory(i18n(bibtex_misc));
  field->setFlags(Field::AllowCompletion | Field::AllowGrouped);
  field->setFormatType(FieldFormat::FormatTitle);
  list.append(field);

  field = new Field(QLatin1String("volume"), i18nc("A number field in a bibliography", "Volume"), Field::Number);
  field->setProperty(QLatin1String("bibtex"), QLatin1String("volume"));
  field->setCategory(i18n(bibtex_misc));
  list.append(field);

  field = new Field(QLatin1String("crossref"), i18n("Cross-Reference"));
  field->setProperty(QLatin1String("bibtex"), QLatin1String("crossref"));
  field->setCategory(i18n(bibtex_misc));
  list.append(field);

//  field = new Field(QLatin1String("annote"), i18n("Annotation"));
//  field->setProperty(QLatin1String("bibtex"), QLatin1String("annote"));
//  field->setCategory(i18n(bibtex_misc));
//  list.append(field);

  field = new Field(QLatin1String("keyword"), i18n("Keywords"));
  field->setProperty(QLatin1String("bibtex"), QLatin1String("keywords"));
  field->setCategory(i18n(bibtex_misc));
  field->setFlags(Field::AllowCompletion | Field::AllowMultiple | Field::AllowGrouped);
  list.append(field);

  field = new Field(QLatin1String("url"), i18n("URL"), Field::URL);
  field->setProperty(QLatin1String("bibtex"), QLatin1String("url"));
  field->setCategory(i18n(bibtex_misc));
  list.append(field);

  field = new Field(QLatin1String("abstract"), i18n("Abstract"), Field::Para);
  field->setProperty(QLatin1String("bibtex"), QLatin1String("abstract"));
  list.append(field);

  field = new Field(QLatin1String("note"), i18n("Notes"), Field::Para);
  field->setProperty(QLatin1String("bibtex"), QLatin1String("note"));
  list.append(field);

  field = createDefaultField(IDField);
  field->setCategory(i18n(bibtex_misc));
  list.append(field);

  field = createDefaultField(CreatedDateField);
  field->setCategory(i18n(bibtex_misc));
  list.append(field);

  field = createDefaultField(ModifiedDateField);
  field->setCategory(i18n(bibtex_misc));
  list.append(field);

  return list;
}
Esempio n. 3
0
Tellico::Data::FieldList WineCollection::defaultFields() {
  FieldList list;
  FieldPtr field;

  field = createDefaultField(TitleField);
  field->setProperty(QLatin1String("template"), QLatin1String("%{vintage} %{producer:1} %{varietal:1}"));
  field->setFlags(Field::NoDelete | Field::Derived);
  field->setFormatType(FieldFormat::FormatNone);
  list.append(field);

  field = new Field(QLatin1String("producer"), i18nc("Wine Producer", "Producer"));
  field->setCategory(i18n(wine_general));
  field->setFlags(Field::AllowCompletion | Field::AllowGrouped);
  field->setFormatType(FieldFormat::FormatPlain);
  list.append(field);

  field = new Field(QLatin1String("appellation"), i18n("Appellation"));
  field->setCategory(i18n(wine_general));
  field->setFlags(Field::AllowCompletion | Field::AllowGrouped);
  field->setFormatType(FieldFormat::FormatPlain);
  list.append(field);

  field = new Field(QLatin1String("varietal"), i18n("Varietal"));
  field->setCategory(i18n(wine_general));
  field->setFlags(Field::AllowCompletion | Field::AllowGrouped);
  field->setFormatType(FieldFormat::FormatPlain);
  list.append(field);

  field = new Field(QLatin1String("vintage"), i18n("Vintage"), Field::Number);
  field->setCategory(i18n(wine_general));
  field->setFlags(Field::AllowGrouped);
  list.append(field);

  QStringList type;
  type << i18n("Red Wine") << i18n("White Wine") << i18n("Sparkling Wine");
  field = new Field(QLatin1String("type"), i18n("Type"), type);
  field->setCategory(i18n(wine_general));
  field->setFlags(Field::AllowGrouped);
  list.append(field);

  field = new Field(QLatin1String("country"), i18n("Country"));
  field->setCategory(i18n(wine_general));
  field->setFlags(Field::AllowCompletion | Field::AllowGrouped);
  field->setFormatType(FieldFormat::FormatPlain);
  list.append(field);

  field = new Field(QLatin1String("pur_date"), i18n("Purchase Date"));
  field->setCategory(i18n(wine_personal));
  field->setFormatType(FieldFormat::FormatDate);
  list.append(field);

  field = new Field(QLatin1String("pur_price"), i18n("Purchase Price"));
  field->setCategory(i18n(wine_personal));
  list.append(field);

  field = new Field(QLatin1String("location"), i18n("Location"));
  field->setCategory(i18n(wine_personal));
  field->setFlags(Field::AllowCompletion | Field::AllowGrouped);
  list.append(field);

  field = new Field(QLatin1String("quantity"), i18n("Quantity"), Field::Number);
  field->setCategory(i18n(wine_personal));
  list.append(field);

  field = new Field(QLatin1String("drink-by"), i18n("Drink By"), Field::Number);
  field->setCategory(i18n(wine_personal));
  field->setFlags(Field::AllowGrouped);
  list.append(field);

  field = new Field(QLatin1String("rating"), i18n("Rating"), Field::Rating);
  field->setCategory(i18n(wine_personal));
  field->setFlags(Field::AllowGrouped);
  list.append(field);

  field = new Field(QLatin1String("gift"), i18n("Gift"), Field::Bool);
  field->setCategory(i18n(wine_personal));
  list.append(field);

  field = new Field(QLatin1String("label"), i18n("Label Image"), Field::Image);
  list.append(field);

  field = new Field(QLatin1String("description"), i18n("Description"), Field::Para);
  list.append(field);

  field = new Field(QLatin1String("comments"), i18n("Comments"), Field::Para);
  list.append(field);

  list.append(createDefaultField(IDField));
  list.append(createDefaultField(CreatedDateField));
  list.append(createDefaultField(ModifiedDateField));

  return list;
}