Canorus  0.0
Public Slots | Public Member Functions | Private Attributes | List of all members
CAAutoRecovery Class Reference

Class for making recovery files for application crashes. More...

#include <autorecovery.h>

Inheritance diagram for CAAutoRecovery:
Inheritance graph
[legend]

Public Slots

void cleanupRecovery ()
 
void saveRecovery ()
 

Public Member Functions

 CAAutoRecovery ()
 
 ~CAAutoRecovery ()
 
void updateTimer ()
 
void openRecovery ()
 

Private Attributes

QTimer * _autoRecoveryTimer
 
QTimer * _saveAfterRecoveryTimer
 

Detailed Description

Class for making recovery files for application crashes.

Copyright (c) 2007, Matevž Jekovec, Canorus development team All Rights Reserved. See AUTHORS for a complete list of authors.

Licensed under the GNU GENERAL PUBLIC LICENSE. See COPYING for details.

Canorus creates recovery files in Canorus writeable settings directory for each currently opened document every number of minutes defined in CASettings.

If the application is closed nicely, recovery files must be cleaned by calling cleanupRecovery() method.

Otherwise Canorus looks for recovery files then next time it's executed and opens them automatically by calling openRecovery(). After recovering the files documents are marked as modified (so user needs to resave them, if closing the document by accident) and a special short-interval singleshot timer (see _saveAfterRecoveryInterval) is started to resave recovery files. This is usually needed when a user finds a bug, immediately repeats it and the autosave interval usually set to few minutes is not triggered yet. Recovery documents are not resaved immediately because Canorus might crash when recovering them (or soon after eg. mouse move) and is in unusable state until recovery files are manually deleted.

Call saveRecovery() to save the currently opened documents to recovery files. The autosave timer's signal is connected to this slot.

Settings class should already be initialized when creating instance of this class.

Constructor & Destructor Documentation

◆ CAAutoRecovery()

CAAutoRecovery::CAAutoRecovery ( )

Initializes autosave. Reads the autosave timer settings from the CASettings class.

References _autoRecoveryTimer, saveRecovery(), and updateTimer().

Here is the call graph for this function:

◆ ~CAAutoRecovery()

CAAutoRecovery::~CAAutoRecovery ( )

References _autoRecoveryTimer.

Member Function Documentation

◆ cleanupRecovery

void CAAutoRecovery::cleanupRecovery ( )
slot

Deletes recovery files. This method is usually called when successfully quiting Canorus.

References CASettings::defaultSettingsPath().

Referenced by CACanorus::cleanUp(), openRecovery(), and saveRecovery().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ openRecovery()

void CAAutoRecovery::openRecovery ( )

Searches for any not-cleaned up recovery files and opens them. Also shows the recovery message.

References _saveAfterRecoveryTimer, cleanupRecovery(), CADocument::dateLastModified(), CASettings::defaultSettingsPath(), CAImport::importDocument(), CAImport::importedDocument(), CACanorus::mainWinList(), CAMainWin::openDocument(), saveRecovery(), CADocument::setFileName(), CADocument::setModified(), CAImport::setStreamFromFile(), and CADocument::title().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveRecovery

void CAAutoRecovery::saveRecovery ( )
slot

Saves the currently opened documents into settings folder named recovery0, recovery1 etc.

References cleanupRecovery(), CASettings::defaultSettingsPath(), CAExport::exportDocument(), CACanorus::mainWinList(), CAExport::setStreamToFile(), and CAExport::wait().

Referenced by CAAutoRecovery(), and openRecovery().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateTimer()

void CAAutoRecovery::updateTimer ( )

Sets auto recovery interval to msec miliseconds.

References _autoRecoveryTimer, and CACanorus::settings().

Referenced by CASettingsDialog::applySettings(), and CAAutoRecovery().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _autoRecoveryTimer

QTimer* CAAutoRecovery::_autoRecoveryTimer
private

◆ _saveAfterRecoveryTimer

QTimer* CAAutoRecovery::_saveAfterRecoveryTimer
private

Referenced by openRecovery().


The documentation for this class was generated from the following files: