Logo Search packages:      
Sourcecode: rosegarden version File versions

RosegardenGUIDoc * Rosegarden::RosegardenGUIApp::createDocumentFromRGFile ( QString  filePath  )  [protected]

Create a document from RG file

Definition at line 1773 of file RosegardenGUIApp.cpp.

References Rosegarden::RosegardenGUIDoc::clearModifiedStatus(), Rosegarden::RosegardenGUIDoc::openDocument(), Rosegarden::RosegardenGUIDoc::setAbsFilePath(), Rosegarden::RosegardenGUIDoc::setTitle(), and Rosegarden::RosegardenGUIDoc::slotDocumentModified().

Referenced by createDocument().

    // Check for an autosaved file to recover
    QString effectiveFilePath = filePath;
    bool canRecover = false;
    QString autoSaveFileName = kapp->checkRecoverFile(filePath, canRecover);

    if (canRecover) {
        // First check if the auto-save file is more recent than the doc
        QFileInfo docFileInfo(filePath), autoSaveFileInfo(autoSaveFileName);

        if (docFileInfo.lastModified() < autoSaveFileInfo.lastModified()) {

            RG_DEBUG << "RosegardenGUIApp::openFile : "
            << "found a more recent autosave file\n";

            // At this point the splash screen may still be there, hide it if
            // it's the case

            // It is, so ask the user if he wants to use the autosave file
            int reply = KMessageBox::questionYesNo(this,
                                                   i18n("An auto-save file for this document has been found\nDo you want to open it instead ?"));

            if (reply == KMessageBox::Yes)
                // open the autosave file instead
                effectiveFilePath = autoSaveFileName;
            else {
                // user doesn't want the autosave, so delete it
                // so it won't bother us again if we reload
                canRecover = false;

        } else
            canRecover = false;

    // Create a new blank document
    RosegardenGUIDoc *newDoc = new RosegardenGUIDoc(this, m_pluginManager,
                               true); // skipAutoload

    // ignore return thingy
    if (newDoc->openDocument(effectiveFilePath)) {
        if (canRecover) {
            // Mark the document as modified,
            // set the "regular" filepath and name (not those of
            // the autosaved doc)
            QFileInfo info(filePath);
        } else {
    } else {
        delete newDoc;
        return 0;

    return newDoc;

Generated by  Doxygen 1.6.0   Back to index