~paulbrianstewart/ubuntu/oneiric/tellico/852247-Formatting-Fix

« back to all changes in this revision

Viewing changes to src/translators/bibtexexporter.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Hermann
  • Date: 2008-01-31 19:33:05 UTC
  • mfrom: (0.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20080131193305-9l01m5gfhykl6pkl
Tags: 1.3-1ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/control: build-dep on kdepim-dev
  - debian/control: drop versioned python from tellico-data suggests
  - debian/rules: call dh_icons

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
    }
88
88
  }
89
89
 
90
 
 
91
90
  if(typeField.isEmpty() || keyField.isEmpty()) {
92
91
    kdWarning() << "BibtexExporter::exec() - the collection must have fields defining "
93
92
                   "the entry-type and the key of the entry" << endl;
236
235
}
237
236
 
238
237
void BibtexExporter::readOptions(KConfig* config_) {
239
 
  KConfigGroupSaver group(config_, QString::fromLatin1("ExportOptions - %1").arg(formatString()));
240
 
  m_expandMacros = config_->readBoolEntry("Expand Macros", m_expandMacros);
241
 
  m_packageURL = config_->readBoolEntry("URL Package", m_packageURL);
242
 
  m_skipEmptyKeys = config_->readBoolEntry("Skip Empty Keys", m_skipEmptyKeys);
 
238
  KConfigGroup group(config_, QString::fromLatin1("ExportOptions - %1").arg(formatString()));
 
239
  m_expandMacros = group.readBoolEntry("Expand Macros", m_expandMacros);
 
240
  m_packageURL = group.readBoolEntry("URL Package", m_packageURL);
 
241
  m_skipEmptyKeys = group.readBoolEntry("Skip Empty Keys", m_skipEmptyKeys);
243
242
 
244
 
  if(config_->readBoolEntry("Use Braces", true)) {
 
243
  if(group.readBoolEntry("Use Braces", true)) {
245
244
    BibtexHandler::s_quoteStyle = BibtexHandler::BRACES;
246
245
  } else {
247
246
    BibtexHandler::s_quoteStyle = BibtexHandler::QUOTES;
249
248
}
250
249
 
251
250
void BibtexExporter::saveOptions(KConfig* config_) {
252
 
  KConfigGroupSaver group(config_, QString::fromLatin1("ExportOptions - %1").arg(formatString()));
 
251
  KConfigGroup group(config_, QString::fromLatin1("ExportOptions - %1").arg(formatString()));
253
252
  m_expandMacros = m_checkExpandMacros->isChecked();
254
 
  config_->writeEntry("Expand Macros", m_expandMacros);
 
253
  group.writeEntry("Expand Macros", m_expandMacros);
255
254
  m_packageURL = m_checkPackageURL->isChecked();
256
 
  config_->writeEntry("URL Package", m_packageURL);
 
255
  group.writeEntry("URL Package", m_packageURL);
257
256
  m_skipEmptyKeys = m_checkSkipEmpty->isChecked();
258
 
  config_->writeEntry("Skip Empty Keys", m_skipEmptyKeys);
 
257
  group.writeEntry("Skip Empty Keys", m_skipEmptyKeys);
259
258
 
260
259
  bool useBraces = m_cbBibtexStyle->currentText() == i18n("Braces");
261
 
  config_->writeEntry("Use Braces", useBraces);
 
260
  group.writeEntry("Use Braces", useBraces);
262
261
  if(useBraces) {
263
262
    BibtexHandler::s_quoteStyle = BibtexHandler::BRACES;
264
263
  } else {
287
286
    if(fIt->formatFlag() == Data::Field::FormatName
288
287
       && fIt->flags() & Data::Field::AllowMultiple) {
289
288
      value.replace(Data::Field::delimiter(), QString::fromLatin1(" and "));
 
289
    } else if(fIt->type() == Data::Field::Para) {
 
290
      // strip HTML from bibtex export
 
291
      QRegExp stripHTML(QString::fromLatin1("<.*>"), true);
 
292
      stripHTML.setMinimal(true);
 
293
      value.remove(stripHTML);
290
294
    }
291
295
 
292
296
    if(m_packageURL && fIt->type() == Data::Field::URL) {