| 569 | } |
| 570 | |
| 571 | void 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 | |
| 597 | void CFrmRecent::slotExport() |
| 598 | { |
nothing calls this directly
no test coverage detected