| 424 | } |
| 425 | |
| 426 | void 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 | |
| 453 | void CFrmHistory::slotExport() |
| 454 | { |
nothing calls this directly
no test coverage detected