|
Canorus 0.0
|
Class for making recovery files for application crashes. More...
#include <autorecovery.h>

Public Slots | |
| void | cleanupRecovery () |
| void | saveRecovery () |
Public Member Functions | |
| CAAutoRecovery () | |
| ~CAAutoRecovery () | |
| void | updateTimer () |
| void | openRecovery () |
Private Attributes | |
| QTimer * | _autoRecoveryTimer |
| QTimer * | _saveAfterRecoveryTimer |
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.
| CAAutoRecovery::CAAutoRecovery | ( | ) |
Initializes autosave. Reads the autosave timer settings from the CASettings class.
References _autoRecoveryTimer, saveRecovery(), and updateTimer().

| CAAutoRecovery::~CAAutoRecovery | ( | ) |
References _autoRecoveryTimer.
|
slot |
Deletes recovery files. This method is usually called when successfully quiting Canorus.
References CASettings::defaultSettingsPath().
Referenced by CACanorus::cleanUp(), openRecovery(), and saveRecovery().


| 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().


|
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().


| void CAAutoRecovery::updateTimer | ( | ) |
Sets auto recovery interval to msec miliseconds.
References _autoRecoveryTimer, and CACanorus::settings().
Referenced by CASettingsDialog::applySettings(), and CAAutoRecovery().


|
private |
Referenced by CAAutoRecovery(), updateTimer(), and ~CAAutoRecovery().
|
private |
Referenced by openRecovery().