MCPcopy Create free account
hub / github.com/ElementsProject/elements / on_exportButton_clicked

Method on_exportButton_clicked

src/qt/addressbookpage.cpp:279–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279void AddressBookPage::on_exportButton_clicked()
280{
281 // CSV is currently the only supported format
282 QString filename = GUIUtil::getSaveFileName(this,
283 tr("Export Address List"), QString(),
284 /*: Expanded name of the CSV file format.
285 See: https://en.wikipedia.org/wiki/Comma-separated_values. */
286 tr("Comma separated file") + QLatin1String(" (*.csv)"), nullptr);
287
288 if (filename.isNull())
289 return;
290
291 CSVModelWriter writer(filename);
292
293 // name, column, role
294 writer.setModel(proxyModel);
295 writer.addColumn("Label", AddressTableModel::Label, Qt::EditRole);
296 writer.addColumn("Address", AddressTableModel::Address, Qt::EditRole);
297
298 if(!writer.write()) {
299 QMessageBox::critical(this, tr("Exporting Failed"),
300 /*: An error message. %1 is a stand-in argument for the name
301 of the file we attempted to save to. */
302 tr("There was an error trying to save the address list to %1. Please try again.").arg(filename));
303 }
304}
305
306void AddressBookPage::contextualMenu(const QPoint &point)
307{

Callers

nothing calls this directly

Calls 5

getSaveFileNameFunction · 0.85
addColumnMethod · 0.80
isNullMethod · 0.45
setModelMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected