Changeset View
Changeset View
Standalone View
Standalone View
libs/main/KoMainWindow.cpp
Show First 20 Lines • Show All 778 Lines • ▼ Show 20 Line(s) | |||||
779 | { | 779 | { | ||
780 | debugMain << "KoMainWindow::slotLoadCompleted"; | 780 | debugMain << "KoMainWindow::slotLoadCompleted"; | ||
781 | KoDocument *newdoc = qobject_cast<KoDocument*>(sender()); | 781 | KoDocument *newdoc = qobject_cast<KoDocument*>(sender()); | ||
782 | KoPart *newpart = newdoc->documentPart(); | 782 | KoPart *newpart = newdoc->documentPart(); | ||
783 | 783 | | |||
784 | if (d->rootDocument && d->rootDocument->isEmpty()) { | 784 | if (d->rootDocument && d->rootDocument->isEmpty()) { | ||
785 | // Replace current empty document | 785 | // Replace current empty document | ||
786 | setRootDocument(newdoc); | 786 | setRootDocument(newdoc); | ||
787 | emit loadCompleted(this); | ||||
787 | } else if (d->rootDocument && !d->rootDocument->isEmpty()) { | 788 | } else if (d->rootDocument && !d->rootDocument->isEmpty()) { | ||
788 | // Open in a new main window | 789 | // Open in a new main window | ||
789 | // (Note : could create the main window first and the doc next for this | 790 | // (Note : could create the main window first and the doc next for this | ||
790 | // particular case, that would give a better user feedback...) | 791 | // particular case, that would give a better user feedback...) | ||
791 | KoMainWindow *s = newpart->createMainWindow(); | 792 | KoMainWindow *s = newpart->createMainWindow(); | ||
792 | s->show(); | 793 | s->show(); | ||
793 | newpart->removeMainWindow(this); | 794 | newpart->removeMainWindow(this); | ||
794 | s->setRootDocument(newdoc, newpart); | 795 | s->setRootDocument(newdoc, newpart); | ||
796 | emit loadCompleted(s); | ||||
795 | } else { | 797 | } else { | ||
796 | // We had no document, set the new one | 798 | // We had no document, set the new one | ||
797 | setRootDocument(newdoc); | 799 | setRootDocument(newdoc); | ||
800 | emit loadCompleted(this); | ||||
798 | } | 801 | } | ||
802 | | ||||
799 | slotProgress(-1); | 803 | slotProgress(-1); | ||
800 | disconnect(newdoc, SIGNAL(sigProgress(int)), this, SLOT(slotProgress(int))); | 804 | disconnect(newdoc, SIGNAL(sigProgress(int)), this, SLOT(slotProgress(int))); | ||
801 | disconnect(newdoc, SIGNAL(completed()), this, SLOT(slotLoadCompleted())); | 805 | disconnect(newdoc, SIGNAL(completed()), this, SLOT(slotLoadCompleted())); | ||
802 | disconnect(newdoc, SIGNAL(canceled(QString)), this, SLOT(slotLoadCanceled(QString))); | 806 | disconnect(newdoc, SIGNAL(canceled(QString)), this, SLOT(slotLoadCanceled(QString))); | ||
803 | d->openingDocument = false; | 807 | d->openingDocument = false; | ||
804 | emit loadCompleted(); | | |||
805 | } | 808 | } | ||
806 | 809 | | |||
807 | void KoMainWindow::slotLoadCanceled(const QString & errMsg) | 810 | void KoMainWindow::slotLoadCanceled(const QString & errMsg) | ||
808 | { | 811 | { | ||
809 | debugMain << "KoMainWindow::slotLoadCanceled"; | 812 | debugMain << "KoMainWindow::slotLoadCanceled"; | ||
810 | if (!errMsg.isEmpty()) // empty when canceled by user | 813 | if (!errMsg.isEmpty()) // empty when canceled by user | ||
811 | KMessageBox::error(this, errMsg); | 814 | KMessageBox::error(this, errMsg); | ||
812 | // ... can't delete the document, it's the one who emitted the signal... | 815 | // ... can't delete the document, it's the one who emitted the signal... | ||
▲ Show 20 Lines • Show All 1359 Lines • Show Last 20 Lines |