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

Method slotImport

App/Client/Recent/FrmRecent.cpp:571–595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

569}
570
571void CFrmRecent::slotImport()
572{
573 QString filename = QFileDialog::getOpenFileName(
574 this, tr("Import recent"),
575 RabbitCommon::CDir::Instance()->GetDirUserDocument(),
576 tr("JSON (*.json)"));
577
578 if (!filename.isEmpty()) {
579 QFileInfo fi(filename);
580 if(0 == fi.suffix().compare("json", Qt::CaseInsensitive)) {
581 if (m_Database.ImportFromJsonFile(filename)) {
582 slotRefresh();
583 QMessageBox::information(
584 this, tr("Success"),
585 tr("Successfully imported recent from json file"));
586 } else {
587 QString szErr = tr("Failed to import recent from json file: %1").arg(filename) + "\n";
588 if(!m_Database.GetError().isEmpty())
589 szErr += "\n" + tr("Error: ") + m_Database.GetError();
590 QMessageBox::critical(this, tr("Failure"), szErr);
591 }
592 return;
593 }
594 }
595}
596
597void CFrmRecent::slotExport()
598{

Callers

nothing calls this directly

Calls 3

ImportFromJsonFileMethod · 0.80
GetErrorMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected