Alter a note's notebook or add/remove tags for a note.
| 698 | |
| 699 | // Alter a note's notebook or add/remove tags for a note. |
| 700 | int CmdLineTool::alterNote(StartupConfig config) { |
| 701 | // Look to see if another NixNote is running. If so, then we |
| 702 | // expect a response, otherwise we do it ourself. |
| 703 | bool useCrossMemory = true; |
| 704 | global.sharedMemory->unlock(); |
| 705 | global.sharedMemory->detach(); |
| 706 | if (!global.sharedMemory->attach()) { |
| 707 | useCrossMemory = false; |
| 708 | } |
| 709 | if (useCrossMemory) { |
| 710 | global.sharedMemory->write("ALTER_NOTE:" + config.alter->wrap()); |
| 711 | } else { |
| 712 | global.db = new DatabaseConnection("nixnote"); // Startup the database |
| 713 | return config.alter->alterNote(); |
| 714 | } |
| 715 | return 0; |
| 716 | } |
| 717 | |
| 718 | |
| 719 | // Open a notebook |