| 420 | } |
| 421 | |
| 422 | void CFrmBookmark::onImportBookmarks() |
| 423 | { |
| 424 | QString filename = QFileDialog::getOpenFileName( |
| 425 | this, tr("Import bookmarks"), |
| 426 | RabbitCommon::CDir::Instance()->GetDirUserDocument(), |
| 427 | tr("JSON (*.json);; All files (*.*)")); |
| 428 | |
| 429 | if (filename.isEmpty()) return; |
| 430 | |
| 431 | QFileInfo fi(filename); |
| 432 | if(0 == fi.suffix().compare("json", Qt::CaseInsensitive)) { |
| 433 | if (m_pDatabase->ImportFromJsonFile(filename)) { |
| 434 | QMessageBox::information(this, tr("Import bookmarks"), |
| 435 | tr("Successfully imported bookmarks from file: %1").arg(filename)); |
| 436 | refresh(); |
| 437 | } else { |
| 438 | QMessageBox::critical(this, tr("Import bookmarks"), |
| 439 | tr("Failed to import bookmark from file: %1").arg(filename) + "\n\n" |
| 440 | + tr("Error: ") + m_pDatabase->GetError()); |
| 441 | } |
| 442 | return; |
| 443 | } |
| 444 | |
| 445 | QMessageBox::warning(this, tr("Import bookmarks"), |
| 446 | tr("Invalid file: %1").arg(filename) + "\n\n" |
| 447 | + tr("Please use html file")); |
| 448 | } |
| 449 | |
| 450 | void CFrmBookmark::onExportBookmarks() |
| 451 | { |
nothing calls this directly
no test coverage detected