MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / slotExport

Method slotExport

App/Client/Favorite/FavoriteView.cpp:484–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

482}
483
484void CFavoriteView::slotExport()
485{
486 QString filename = QFileDialog::getSaveFileName(
487 this, tr("Export favorite"),
488 RabbitCommon::CDir::Instance()->GetDirUserDocument(),
489 tr("JSON (*.json)"));
490
491 if (!filename.isEmpty()) {
492 QFileInfo fi(filename);
493 if(0 == fi.suffix().compare("json", Qt::CaseInsensitive)) {
494 if (m_pDatabase->ExportToJsonFile(filename)) {
495 QMessageBox::information(
496 this, tr("Success"),
497 tr("Favorite successfully exported to JSON file: %1").arg(filename));
498 } else {
499 QString szErr = tr("Failed to import favorite from JSON file: %1").arg(filename) + "\n";
500 if(!m_pDatabase->GetError().isEmpty())
501 szErr += "\n" + tr("Error: ") + m_pDatabase->GetError();
502 QMessageBox::critical(this, tr("Failure"), szErr);
503 }
504 return;
505 }
506 QMessageBox::critical(this, tr("Failure"),
507 tr("Invalid file: %1").arg(filename) + "\n\n"
508 + tr("Please use JSON file"));
509 }
510}
511
512void CFavoriteView::InitialDragDrop()
513{

Callers

nothing calls this directly

Calls 3

ExportToJsonFileMethod · 0.80
GetErrorMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected