| 849 | |
| 850 | |
| 851 | void NNotebookView::removeFromStackRequested() { |
| 852 | QList<QTreeWidgetItem*> items = selectedItems(); |
| 853 | qint32 lid = items[0]->data(NAME_POSITION, Qt::UserRole).toInt(); |
| 854 | NotebookTable table(global.db); |
| 855 | table.removeFromStack(lid); |
| 856 | |
| 857 | // Now move it in the actual tree |
| 858 | NNotebookViewItem *stackWidget, *notebookWidget; |
| 859 | notebookWidget = dataStore[lid]; |
| 860 | stackWidget = (NNotebookViewItem*)notebookWidget->parent(); |
| 861 | |
| 862 | stackWidget->removeChild(notebookWidget); |
| 863 | stackWidget->parent()->addChild(notebookWidget); |
| 864 | |
| 865 | if (stackWidget->childCount() == 0) { |
| 866 | stackWidget->parent()->removeChild(stackWidget); |
| 867 | QString text = stackWidget->text(NAME_POSITION); |
| 868 | for (int i=0; i<stackMenu->actions().size(); i++) { |
| 869 | if (stackMenu->actions().at(i)->text() == text) { |
| 870 | stackMenu->actions().at(i)->setVisible(false); |
| 871 | emit(stackDeleted(text)); |
| 872 | i = stackMenu->actions().size(); |
| 873 | } |
| 874 | } |
| 875 | } |
| 876 | |
| 877 | this->sortItems(NAME_POSITION, Qt::AscendingOrder); |
| 878 | resetSize(); |
| 879 | this->sortByColumn(NAME_POSITION); |
| 880 | } |
| 881 | |
| 882 | |
| 883 | void NNotebookView::sortStackMenu() { |
nothing calls this directly
no test coverage detected