Changeset View
Changeset View
Standalone View
Standalone View
libs/main/KoMainWindow.cpp
Show First 20 Lines • Show All 781 Lines • ▼ Show 20 Line(s) | |||||
782 | { | 782 | { | ||
783 | debugMain << "KoMainWindow::slotLoadCompleted"; | 783 | debugMain << "KoMainWindow::slotLoadCompleted"; | ||
784 | KoDocument *newdoc = qobject_cast<KoDocument*>(sender()); | 784 | KoDocument *newdoc = qobject_cast<KoDocument*>(sender()); | ||
785 | KoPart *newpart = newdoc->documentPart(); | 785 | KoPart *newpart = newdoc->documentPart(); | ||
786 | 786 | | |||
787 | if (d->rootDocument && d->rootDocument->isEmpty()) { | 787 | if (d->rootDocument && d->rootDocument->isEmpty()) { | ||
788 | // Replace current empty document | 788 | // Replace current empty document | ||
789 | setRootDocument(newdoc); | 789 | setRootDocument(newdoc); | ||
790 | emit loadCompleted(this); | ||||
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(); | ||
796 | newpart->removeMainWindow(this); | 797 | newpart->removeMainWindow(this); | ||
797 | s->setRootDocument(newdoc, newpart); | 798 | s->setRootDocument(newdoc, newpart); | ||
799 | emit loadCompleted(s); | ||||
798 | } else { | 800 | } else { | ||
799 | // We had no document, set the new one | 801 | // We had no document, set the new one | ||
800 | setRootDocument(newdoc); | 802 | setRootDocument(newdoc); | ||
803 | emit loadCompleted(this); | ||||
801 | } | 804 | } | ||
805 | | ||||
802 | slotProgress(-1); | 806 | slotProgress(-1); | ||
803 | disconnect(newdoc, SIGNAL(sigProgress(int)), this, SLOT(slotProgress(int))); | 807 | disconnect(newdoc, SIGNAL(sigProgress(int)), this, SLOT(slotProgress(int))); | ||
804 | disconnect(newdoc, SIGNAL(completed()), this, SLOT(slotLoadCompleted())); | 808 | disconnect(newdoc, SIGNAL(completed()), this, SLOT(slotLoadCompleted())); | ||
805 | disconnect(newdoc, SIGNAL(canceled(QString)), this, SLOT(slotLoadCanceled(QString))); | 809 | disconnect(newdoc, SIGNAL(canceled(QString)), this, SLOT(slotLoadCanceled(QString))); | ||
806 | d->openingDocument = false; | 810 | d->openingDocument = false; | ||
807 | emit loadCompleted(); | | |||
808 | } | 811 | } | ||
809 | 812 | | |||
810 | void KoMainWindow::slotLoadCanceled(const QString & errMsg) | 813 | void KoMainWindow::slotLoadCanceled(const QString & errMsg) | ||
811 | { | 814 | { | ||
812 | debugMain << "KoMainWindow::slotLoadCanceled"; | 815 | debugMain << "KoMainWindow::slotLoadCanceled"; | ||
813 | if (!errMsg.isEmpty()) // empty when canceled by user | 816 | if (!errMsg.isEmpty()) // empty when canceled by user | ||
814 | KMessageBox::error(this, errMsg); | 817 | KMessageBox::error(this, errMsg); | ||
815 | // ... can't delete the document, it's the one who emitted the signal... | 818 | // ... can't delete the document, it's the one who emitted the signal... | ||
▲ Show 20 Lines • Show All 1359 Lines • Show Last 20 Lines |