Close a notebook
| 738 | |
| 739 | // Close a notebook |
| 740 | int CmdLineTool::closeNotebook(StartupConfig config) { |
| 741 | if (global.sharedMemory->attach()) { |
| 742 | std::cout << tr("This cannot be done with NixNote running.").toStdString() << endl; |
| 743 | return 16; |
| 744 | } |
| 745 | global.db = new DatabaseConnection("nixnote"); // Startup the database |
| 746 | NotebookTable bookTable(global.db); |
| 747 | for (int i=0; i<config.notebookList.size(); i++) { |
| 748 | qint32 lid = bookTable.findByName(config.notebookList[i]); |
| 749 | if (lid >0) { |
| 750 | bookTable.closeNotebook(lid); |
| 751 | } else { |
| 752 | std::cout << tr("Notebook not found: ").toStdString() << config.notebookList[i].toStdString() << endl; |
| 753 | } |
| 754 | } |
| 755 | return 0; |
| 756 | } |
| 757 | |
| 758 | |
| 759 | #include "models/notemodel.h" |
no test coverage detected