Logo Search packages:      
Sourcecode: tellico version File versions

void MainWindow::slotCiteEntry (  )  [private, slot]

Send a citation for the selected entries through the lyxpipe

Definition at line 2047 of file mainwindow.cpp.

References Tellico::Data::Collection::entryName(), and Tellico::Data::Collection::type().

Referenced by initActions().

                               {
  Data::Collection* coll = Kernel::self()->collection();
  if(!coll || coll->type() != Data::Collection::Bibtex) {
    return;
  }

  KConfigGroupSaver saver(m_config, QString::fromLatin1("Options - %1").arg(coll->entryName()));
  QString lyxpipe = m_config->readPathEntry("lyxpipe", QString::fromLatin1("$HOME/.lyx/lyxpipe"));
  lyxpipe += QString::fromLatin1(".in");
//  kdDebug() << "MainWindow::slotCiteEntry() - " << lyxpipe << endl;

  QString errorStr = i18n("<qt>Tellico is unable to write to the server pipe at <b>%1</b>.</qt>").arg(lyxpipe);
  QCString pipe = QFile::encodeName(lyxpipe);
  if(!QFile::exists(pipe)) {
    KMessageBox::sorry(this, errorStr);
    return;
  }

  int pipeFd = ::open(pipe, O_WRONLY);
  QFile file(QString::fromUtf8(pipe));
  if(file.open(IO_WriteOnly, pipeFd)) {
    static_cast<Data::BibtexCollection*>(coll)->citeEntries(file, Controller::self()->selectedEntries());
    file.close();
  } else {
    KMessageBox::sorry(this, errorStr);
  }
  ::close(pipeFd);
}


Generated by  Doxygen 1.6.0   Back to index