Logo Search packages:      
Sourcecode: tellico version File versions

void MainWindow::slotFilePrint (  )  [slot]

Prints the current document.

Definition at line 1154 of file mainwindow.cpp.

References Tellico::DetailedListView::filter(), groupBy(), Tellico::Export::HTMLExporter::setColumns(), Tellico::Export::Exporter::setEntryList(), Tellico::Export::HTMLExporter::setGroupBy(), Tellico::Export::HTMLExporter::setMaxImageSize(), Tellico::Export::HTMLExporter::setPrintGrouped(), Tellico::Export::HTMLExporter::setPrintHeaders(), Tellico::Export::HTMLExporter::setSortTitles(), Tellico::Export::HTMLExporter::setXSLTFile(), slotStatusMsg(), sortTitles(), Tellico::Export::HTMLExporter::text(), visibleColumns(), and Tellico::DetailedListView::visibleEntries().

Referenced by initActions().

                               {
  slotStatusMsg(i18n("Printing..."));

  m_config->setGroup(QString::fromLatin1("Printing"));
  bool printGrouped = m_config->readBoolEntry("Print Grouped", true);
  bool printHeaders = m_config->readBoolEntry("Print Field Headers", false);
  int imageWidth = m_config->readNumEntry("Max Image Width", 50);
  int imageHeight = m_config->readNumEntry("Max Image Height", 50);

  // If the collection is being filtered, warn the user
  if(m_detailedView->filter() != 0) {
    QString str = i18n("The collection is currently being filtered to show a limited subset of "
                       "the entries. Only the visible entries will be printed. Continue?");
    int ret = KMessageBox::warningContinueCancel(this, str, QString::null, i18n("Print"),
                                                 QString::fromLatin1("WarnPrintVisible"));
    if(ret == KMessageBox::Cancel) {
      slotStatusMsg(i18n(ready));
      return;
    }
  }

  kapp->setOverrideCursor(Qt::waitCursor);

  Export::HTMLExporter exporter(Kernel::self()->collection());
  exporter.setEntryList(m_detailedView->visibleEntries());
  exporter.setXSLTFile(QString::fromLatin1("tellico-printing.xsl"));
  exporter.setPrintHeaders(printHeaders);
  exporter.setPrintGrouped(printGrouped);
  exporter.setGroupBy(groupBy());
  if(!printGrouped) { // the sort titles are only used if the entries are not grouped
    exporter.setSortTitles(sortTitles());
  }
  exporter.setColumns(visibleColumns());
  exporter.setMaxImageSize(imageWidth, imageHeight);

  slotStatusMsg(i18n("Processing document..."));
  bool printFormatted = m_config->readBoolEntry("Print Formatted", true);
  QString html = exporter.text(printFormatted, true);
  if(html.isEmpty()) {
    XSLTError();
    kapp->restoreOverrideCursor();
    slotStatusMsg(i18n(ready));
    return;
  }

  kapp->restoreOverrideCursor();

//  kdDebug() << html << endl;
  slotStatusMsg(i18n("Printing..."));
  doPrint(html);

  slotStatusMsg(i18n(ready));
}


Generated by  Doxygen 1.6.0   Back to index