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

Method slotImport

Plugins/WebBrowser/History/FrmHistory.cpp:426–451  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

424}
425
426void CFrmHistory::slotImport()
427{
428 QString filename = QFileDialog::getOpenFileName(
429 this, tr("Import histories"),
430 RabbitCommon::CDir::Instance()->GetDirUserDocument(),
431 tr("JSON (*.json);; All files (*.*)"));
432
433 if (filename.isEmpty()) return;
434
435 QFileInfo fi(filename);
436 if(0 == fi.suffix().compare("json", Qt::CaseInsensitive)) {
437 if (m_pModelHistory->importFromJson(filename)) {
438 slotRefresh();
439 QMessageBox::information(this, tr("Import histories"),
440 tr("Successfully imported histories from JSON file: %1").arg(filename));
441 } else {
442 QMessageBox::critical(this, tr("Import histories"),
443 tr("Failed to import histories from JSON file: %1").arg(filename));
444 }
445 return;
446 }
447
448 QMessageBox::critical(this, tr("Import histories"),
449 tr("Invalid file: %1").arg(filename) + "\n\n"
450 + tr("Please use JSON or CSV file"));
451}
452
453void CFrmHistory::slotExport()
454{

Callers

nothing calls this directly

Calls 2

importFromJsonMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected