Open a notebook
| 718 | |
| 719 | // Open a notebook |
| 720 | int CmdLineTool::openNotebook(StartupConfig config) { |
| 721 | if (global.sharedMemory->attach()) { |
| 722 | std::cout << tr("This cannot be done with NixNote running.").toStdString() << endl; |
| 723 | return 16; |
| 724 | } |
| 725 | global.db = new DatabaseConnection("nixnote"); // Startup the database |
| 726 | NotebookTable bookTable(global.db); |
| 727 | for (int i=0; i<config.notebookList.size(); i++) { |
| 728 | qint32 lid = bookTable.findByName(config.notebookList[i]); |
| 729 | if (lid >0) { |
| 730 | bookTable.openNotebook(lid); |
| 731 | } else { |
| 732 | std::cout << tr("Notebook not found: ").toStdString() << config.notebookList[i].toStdString() << endl; |
| 733 | } |
| 734 | } |
| 735 | return 0; |
| 736 | } |
| 737 | |
| 738 | |
| 739 | // Close a notebook |
no test coverage detected