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

Method onImportBookmarks

Plugins/WebBrowser/Bookmark/FrmBookmark.cpp:422–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420}
421
422void 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
450void CFrmBookmark::onExportBookmarks()
451{

Callers

nothing calls this directly

Calls 3

ImportFromJsonFileMethod · 0.80
GetErrorMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected