| 843 | } |
| 844 | |
| 845 | void PageView::openAnnotationWindow(Okular::Annotation *annotation, int pageNumber) |
| 846 | { |
| 847 | if (!annotation) { |
| 848 | return; |
| 849 | } |
| 850 | |
| 851 | // find the annot window |
| 852 | AnnotWindow *existWindow = nullptr; |
| 853 | for (AnnotWindow *aw : std::as_const(d->m_annowindows)) { |
| 854 | if (aw->annotation() == annotation) { |
| 855 | existWindow = aw; |
| 856 | break; |
| 857 | } |
| 858 | } |
| 859 | |
| 860 | if (existWindow == nullptr) { |
| 861 | const auto initialViewportBounds = viewportBoundsForAnnotationWindows(); |
| 862 | existWindow = new AnnotWindow(this, initialViewportBounds, annotation, d->document, pageNumber); |
| 863 | connect(existWindow, &QObject::destroyed, this, &PageView::slotAnnotationWindowDestroyed); |
| 864 | |
| 865 | d->m_annowindows << existWindow; |
| 866 | } else { |
| 867 | existWindow->raise(); |
| 868 | existWindow->findChild<KTextEdit *>()->setFocus(); |
| 869 | } |
| 870 | |
| 871 | existWindow->show(); |
| 872 | } |
| 873 | |
| 874 | void PageView::slotAnnotationWindowDestroyed(QObject *window) |
| 875 | { |
no test coverage detected