Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/reports/kexireportview.cpp
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Line(s) | 85 | #ifndef KEXI_MOBILE | |||
---|---|---|---|---|---|
89 | a->setWhatsThis(xi18n("Prints the current report.")); | 89 | a->setWhatsThis(xi18n("Prints the current report.")); | ||
90 | connect(a, SIGNAL(triggered()), this, SLOT(slotPrintReport())); | 90 | connect(a, SIGNAL(triggered()), this, SLOT(slotPrintReport())); | ||
91 | 91 | | |||
92 | KActionMenu *exportMenu = new KActionMenu(koIcon("document-export"), xi18nc("@title:menu","E&xport As"), this); | 92 | KActionMenu *exportMenu = new KActionMenu(koIcon("document-export"), xi18nc("@title:menu","E&xport As"), this); | ||
93 | exportMenu->setObjectName("report_export_as"); | 93 | exportMenu->setObjectName("report_export_as"); | ||
94 | exportMenu->setDelayed(false); | 94 | exportMenu->setDelayed(false); | ||
95 | #endif | 95 | #endif | ||
96 | 96 | | |||
97 | #ifdef KEXI_SHOW_UNFINISHED | ||||
97 | #ifdef KEXI_MOBILE | 98 | #ifdef KEXI_MOBILE | ||
98 | viewActions << (a = new QAction(xi18n("Export:"), this)); | 99 | viewActions << (a = new QAction(xi18n("Export:"), this)); | ||
99 | a->setEnabled(false); //!TODO this is a bit of a dirty way to add what looks like a label to the toolbar! | 100 | a->setEnabled(false); //!TODO this is a bit of a dirty way to add what looks like a label to the toolbar! | ||
100 | // " ", not "", is said to be needed in maemo, the icon didn't display properly without it | 101 | // " ", not "", is said to be needed in maemo, the icon didn't display properly without it | ||
101 | viewActions << (a = new QAction(koIcon("application-vnd.oasis.opendocument.text"), QLatin1String(" "), this)); | 102 | viewActions << (a = new QAction(koIcon("application-vnd.oasis.opendocument.text"), QLatin1String(" "), this)); | ||
102 | #else | 103 | #else | ||
104 | | ||||
103 | exportMenu->addAction(a = new QAction(koIcon("application-vnd.oasis.opendocument.text"), | 105 | exportMenu->addAction(a = new QAction(koIcon("application-vnd.oasis.opendocument.text"), | ||
104 | xi18nc("open dialog to export as text document", "Text Document..."), this)); | 106 | xi18nc("open dialog to export as text document", "Text Document..."), this)); | ||
105 | #endif | 107 | #endif | ||
106 | a->setObjectName("export_as_text_document"); | 108 | a->setObjectName("export_as_text_document"); | ||
107 | a->setToolTip(xi18n("Export the report as a text document (in OpenDocument Text format)")); | 109 | a->setToolTip(xi18n("Export the report as a text document (in OpenDocument Text format)")); | ||
108 | a->setWhatsThis(xi18n("Exports the report as a text document (in OpenDocument Text format).")); | 110 | a->setWhatsThis(xi18n("Exports the report as a text document (in OpenDocument Text format).")); | ||
109 | a->setEnabled(true); | 111 | a->setEnabled(true); | ||
110 | connect(a, SIGNAL(triggered()), this, SLOT(slotExportAsTextDocument())); | 112 | connect(a, SIGNAL(triggered()), this, SLOT(slotExportAsTextDocument())); | ||
113 | #endif | ||||
111 | 114 | | |||
112 | #ifdef KEXI_MOBILE | 115 | #ifdef KEXI_MOBILE | ||
113 | viewActions << (a = new QAction(koIcon("application-pdf"), QLatin1String(" "), this)); | 116 | viewActions << (a = new QAction(koIcon("application-pdf"), QLatin1String(" "), this)); | ||
114 | #else | 117 | #else | ||
115 | exportMenu->addAction(a = new QAction(koIcon("application-pdf"), | 118 | exportMenu->addAction(a = new QAction(koIcon("application-pdf"), | ||
116 | xi18nc("Portable Document Format...", "PDF..."), this)); | 119 | xi18nc("Portable Document Format...", "PDF..."), this)); | ||
117 | #endif | 120 | #endif | ||
118 | a->setObjectName("export_as_pdf"); | 121 | a->setObjectName("export_as_pdf"); | ||
119 | a->setToolTip(xi18n("Export as PDF")); | 122 | a->setToolTip(xi18n("Export as PDF")); | ||
120 | a->setWhatsThis(xi18n("Exports the current report as PDF.")); | 123 | a->setWhatsThis(xi18n("Exports the current report as PDF.")); | ||
121 | a->setEnabled(true); | 124 | a->setEnabled(true); | ||
122 | connect(a, SIGNAL(triggered()), this, SLOT(slotExportAsPdf())); | 125 | connect(a, SIGNAL(triggered()), this, SLOT(slotExportAsPdf())); | ||
123 | 126 | | |||
127 | #ifdef KEXI_SHOW_UNFINISHED | ||||
124 | #ifdef KEXI_MOBILE | 128 | #ifdef KEXI_MOBILE | ||
125 | viewActions << (a = new QAction(koIcon("application-vnd.oasis.opendocument.spreadsheet"), QLatin1String(" "), this)); | 129 | viewActions << (a = new QAction(koIcon("application-vnd.oasis.opendocument.spreadsheet"), QLatin1String(" "), this)); | ||
126 | #else | 130 | #else | ||
127 | exportMenu->addAction(a = new QAction(koIcon("application-vnd.oasis.opendocument.spreadsheet"), | 131 | exportMenu->addAction(a = new QAction(koIcon("application-vnd.oasis.opendocument.spreadsheet"), | ||
128 | xi18nc("open dialog to export as spreadsheet", "Spreadsheet..."), this)); | 132 | xi18nc("open dialog to export as spreadsheet", "Spreadsheet..."), this)); | ||
129 | #endif | 133 | #endif | ||
130 | a->setObjectName("export_as_spreadsheet"); | 134 | a->setObjectName("export_as_spreadsheet"); | ||
131 | a->setToolTip(xi18n("Export the report as a spreadsheet (in OpenDocument Spreadsheet format)")); | 135 | a->setToolTip(xi18n("Export the report as a spreadsheet (in OpenDocument Spreadsheet format)")); | ||
132 | a->setWhatsThis(xi18n("Exports the report as a spreadsheet (in OpenDocument Spreadsheet format).")); | 136 | a->setWhatsThis(xi18n("Exports the report as a spreadsheet (in OpenDocument Spreadsheet format).")); | ||
133 | a->setEnabled(true); | 137 | a->setEnabled(true); | ||
134 | connect(a, SIGNAL(triggered()), this, SLOT(slotExportAsSpreadsheet())); | 138 | connect(a, SIGNAL(triggered()), this, SLOT(slotExportAsSpreadsheet())); | ||
135 | 139 | | |||
140 | #endif | ||||
141 | | ||||
136 | #ifdef KEXI_MOBILE | 142 | #ifdef KEXI_MOBILE | ||
137 | viewActions << (a = new QAction(koIcon("text-html"), QLatin1String(" "), this)); | 143 | viewActions << (a = new QAction(koIcon("text-html"), QLatin1String(" "), this)); | ||
138 | #else | 144 | #else | ||
139 | exportMenu->addAction(a = new QAction(koIcon("text-html"), | 145 | exportMenu->addAction(a = new QAction(koIcon("text-html"), | ||
140 | xi18nc("open dialog to export as web page", "Web Page..."), this)); | 146 | xi18nc("open dialog to export as web page", "Web Page..."), this)); | ||
141 | #endif | 147 | #endif | ||
142 | a->setObjectName("export_as_web_page"); | 148 | a->setObjectName("export_as_web_page"); | ||
143 | a->setToolTip(xi18n("Export the report as a web page (in HTML format)")); | 149 | a->setToolTip(xi18n("Export the report as a web page (in HTML format)")); | ||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Line(s) | 240 | KMessageBox::questionYesNo( | |||
238 | KStandardGuiItem::open(), | 244 | KStandardGuiItem::open(), | ||
239 | KStandardGuiItem::close()); | 245 | KStandardGuiItem::close()); | ||
240 | 246 | | |||
241 | if (answer == KMessageBox::Yes) { | 247 | if (answer == KMessageBox::Yes) { | ||
242 | (void)new KRun(destination, this->topLevelWidget()); | 248 | (void)new KRun(destination, this->topLevelWidget()); | ||
243 | } | 249 | } | ||
244 | } | 250 | } | ||
245 | 251 | | |||
252 | #ifdef KEXI_SHOW_UNFINISHED | ||||
253 | | ||||
246 | void KexiReportView::slotExportAsSpreadsheet() | 254 | void KexiReportView::slotExportAsSpreadsheet() | ||
247 | { | 255 | { | ||
248 | QScopedPointer<KReportRendererBase> renderer(m_factory.createInstance("ods")); | 256 | QScopedPointer<KReportRendererBase> renderer(m_factory.createInstance("ods")); | ||
249 | if (renderer) { | 257 | if (renderer) { | ||
250 | KReportRendererContext cxt; | 258 | KReportRendererContext cxt; | ||
251 | cxt.destinationUrl = getExportUrl(QLatin1String("application/vnd.oasis.opendocument.spreadsheet"), | 259 | cxt.destinationUrl = getExportUrl(QLatin1String("application/vnd.oasis.opendocument.spreadsheet"), | ||
252 | xi18n("Export Report as Spreadsheet"), | 260 | xi18n("Export Report as Spreadsheet"), | ||
253 | "kfiledialog:///LastVisitedODSExportPath/", | 261 | "kfiledialog:///LastVisitedODSExportPath/", | ||
Show All 31 Lines | 292 | if (!renderer->render(cxt, m_preRenderer->document())) { | |||
285 | KMessageBox::error(this, | 293 | KMessageBox::error(this, | ||
286 | xi18n("Exporting the report as text document to %1 failed.", cxt.destinationUrl.toDisplayString()), | 294 | xi18n("Exporting the report as text document to %1 failed.", cxt.destinationUrl.toDisplayString()), | ||
287 | xi18n("Export Failed")); | 295 | xi18n("Export Failed")); | ||
288 | } else { | 296 | } else { | ||
289 | openExportedDocument(cxt.destinationUrl); | 297 | openExportedDocument(cxt.destinationUrl); | ||
290 | } | 298 | } | ||
291 | } | 299 | } | ||
292 | } | 300 | } | ||
301 | #endif | ||||
293 | 302 | | |||
294 | void KexiReportView::slotExportAsWebPage() | 303 | void KexiReportView::slotExportAsWebPage() | ||
295 | { | 304 | { | ||
296 | const QString dialogTitle = xi18n("Export Report as Web Page"); | 305 | const QString dialogTitle = xi18n("Export Report as Web Page"); | ||
297 | KReportRendererContext cxt; | 306 | KReportRendererContext cxt; | ||
298 | cxt.destinationUrl = getExportUrl(QLatin1String("text/html"), | 307 | cxt.destinationUrl = getExportUrl(QLatin1String("text/html"), | ||
299 | dialogTitle, | 308 | dialogTitle, | ||
300 | "kfiledialog:///LastVisitedHTMLExportPath/", | 309 | "kfiledialog:///LastVisitedHTMLExportPath/", | ||
▲ Show 20 Lines • Show All 173 Lines • Show Last 20 Lines |