diff --git a/libs/main/KoMainWindow.cpp b/libs/main/KoMainWindow.cpp --- a/libs/main/KoMainWindow.cpp +++ b/libs/main/KoMainWindow.cpp @@ -774,6 +774,7 @@ if (!file.isWritable()) { setReadWrite(false); } + setRootDocument(newdoc, newpart); return true; } @@ -784,15 +785,15 @@ KoDocument *newdoc = qobject_cast(sender()); KoPart *newpart = newdoc->documentPart(); - if (d->rootDocument && d->rootDocument->isEmpty()) { + if ((d->rootDocument && d->rootDocument->isEmpty()) || d->rootDocument==newdoc) { // Replace current empty document setRootDocument(newdoc); } else if (d->rootDocument && !d->rootDocument->isEmpty()) { // Open in a new main window // (Note : could create the main window first and the doc next for this // particular case, that would give a better user feedback...) KoMainWindow *s = newpart->createMainWindow(); - s->show(); + s->show(); newpart->removeMainWindow(this); s->setRootDocument(newdoc, newpart); } else { @@ -1397,9 +1398,9 @@ void KoMainWindow::slotFilePrint() { - if (!rootView()) - return; - KoPrintJob *printJob = rootView()->createPrintJob(); + if (!rootView()) + return; + KoPrintJob *printJob = rootView()->createPrintJob(); if (printJob == 0) return; d->applyDefaultSettings(printJob->printer());