Logo Search packages:      
Sourcecode: canorus version File versions  Download package

bool CAMainWin::saveDocument ( QString  fileName  ) 

Saves the current document to a given absolute fileName. This function is usually called when the filename was entered and save document dialog successfully closed. If recovery is False (default), it changes the timeEdit, fileName and some other document properties before saving it.

Returns True, if the save was complete; False otherwise.

Definition at line 2814 of file mainwin.cpp.

References CAExport::exportDocument(), CAExport::exportedDocument(), CADocument::setDateLastModified(), CADocument::setFileName(), CADocument::setModified(), CAExport::setStreamToFile(), CADocument::setTimeEdited(), and CAExport::wait().

                                               {
      document()->setTimeEdited( document()->timeEdited() + _timeEditedTime );
      document()->setDateLastModified( QDateTime::currentDateTime() );
      CACanorus::restartTimeEditedTimes( document() );

      CAExport *save=0;
      if ( uiSaveDialog->selectedFilter()==CAFileFormats::CANORUSML_FILTER ) {
            save = new CACanorusMLExport();
      } else if ( uiSaveDialog->selectedFilter()==CAFileFormats::CAN_FILTER ) {
            save = new CACanExport();
      }

      if (save) {
            save->setStreamToFile( fileName );
            save->exportDocument( document() );
            save->wait();

            if ( save->exportedDocument() ) {
                  document()->setFileName( fileName );
                  CACanorus::insertRecentDocument( fileName );
                  delete save;

                  document()->setModified( false );
                  updateWindowTitle();
                  return true;
            }
      }

      return false;
}


Generated by  Doxygen 1.6.0   Back to index