Changeset View
Changeset View
Standalone View
Standalone View
libs/main/KoMainWindow.cpp
Show First 20 Lines • Show All 768 Lines • ▼ Show 20 Line(s) | 744 | { | |||
---|---|---|---|---|---|
769 | } | 769 | } | ||
770 | updateReloadFileAction(newdoc); | 770 | updateReloadFileAction(newdoc); | ||
771 | updateVersionsFileAction(newdoc); | 771 | updateVersionsFileAction(newdoc); | ||
772 | 772 | | |||
773 | KFileItem file(url, newdoc->mimeType(), KFileItem::Unknown); | 773 | KFileItem file(url, newdoc->mimeType(), KFileItem::Unknown); | ||
774 | if (!file.isWritable()) { | 774 | if (!file.isWritable()) { | ||
775 | setReadWrite(false); | 775 | setReadWrite(false); | ||
776 | } | 776 | } | ||
777 | setRootDocument(newdoc, newpart); | ||||
777 | return true; | 778 | return true; | ||
778 | } | 779 | } | ||
779 | 780 | | |||
780 | // Separate from openDocument to handle async loading (remote URLs) | 781 | // Separate from openDocument to handle async loading (remote URLs) | ||
781 | void KoMainWindow::slotLoadCompleted() | 782 | void KoMainWindow::slotLoadCompleted() | ||
782 | { | 783 | { | ||
783 | debugMain << "KoMainWindow::slotLoadCompleted"; | 784 | debugMain << "KoMainWindow::slotLoadCompleted"; | ||
784 | KoDocument *newdoc = qobject_cast<KoDocument*>(sender()); | 785 | KoDocument *newdoc = qobject_cast<KoDocument*>(sender()); | ||
785 | KoPart *newpart = newdoc->documentPart(); | 786 | KoPart *newpart = newdoc->documentPart(); | ||
786 | 787 | | |||
787 | if (d->rootDocument && d->rootDocument->isEmpty()) { | 788 | if ((d->rootDocument && d->rootDocument->isEmpty()) || d->rootDocument==newdoc) { | ||
788 | // Replace current empty document | 789 | // Replace current empty document | ||
789 | setRootDocument(newdoc); | 790 | setRootDocument(newdoc); | ||
790 | } else if (d->rootDocument && !d->rootDocument->isEmpty()) { | 791 | } else if (d->rootDocument && !d->rootDocument->isEmpty()) { | ||
791 | // Open in a new main window | 792 | // Open in a new main window | ||
792 | // (Note : could create the main window first and the doc next for this | 793 | // (Note : could create the main window first and the doc next for this | ||
793 | // particular case, that would give a better user feedback...) | 794 | // particular case, that would give a better user feedback...) | ||
794 | KoMainWindow *s = newpart->createMainWindow(); | 795 | KoMainWindow *s = newpart->createMainWindow(); | ||
795 | s->show(); | 796 | s->show(); | ||
▲ Show 20 Lines • Show All 1379 Lines • Show Last 20 Lines |