Commit 43661583 authored by Ellen Dekkers's avatar Ellen Dekkers
Browse files

rpc function to get a backup name from a backup id

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11109 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 1255f222
......@@ -290,7 +290,7 @@ void BackupPlugin::update_menu( ) {
backupMenu_->addAction(backupsEnabledAction_);
backupsEnabledAction_->setChecked( OpenFlipper::Options::backupEnabled() );
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS,DATA_TRIANGLE_MESH|DATA_TRIANGLE_MESH) ; o_it != PluginFunctions::objectsEnd(); ++o_it) {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS,DATA_ALL) ; o_it != PluginFunctions::objectsEnd(); ++o_it) {
std::vector<BackupT>* archive;
if ( !backups_.get_pointer(o_it->id(),archive) ) {
......@@ -514,6 +514,42 @@ bool BackupPlugin::getBackupData(int _objectId, int _backupId, BackupT*& _contai
return true;
}
QString BackupPlugin::getBackupName(int _objectId, int _backupId)
{
BaseObjectData * object = 0;
// get the right object or fail
if ( ! PluginFunctions::getObject(_objectId, object) )
{
emit log(LOGERR, "[getBackupString] Unable to find object with id " + QString::number(_objectId));
return QString();
}
// Get the backup vector of this object
std::vector<BackupT>* archive;
if ( !backups_.get_pointer(_objectId, archive) )
{
emit log(LOGERR, "[getBackupString] Unable to find backups for object with id " + QString::number(_objectId));
return QString();
}
QString backupName;
// otherwise use the given backup id
for ( uint i = 0 ; i < archive->size() ; ++i )
{
if ( (*archive)[i].backupNumber == _backupId )
{
backupName = (*archive)[i].backupName;
break;
}
}
return backupName;
}
/// Restore an object
void BackupPlugin::slotRestoreObject(int _objectid , int _internalId){
backupPluginInternalRestore(_objectid,_internalId);
......
......@@ -248,6 +248,11 @@ private slots:
/// Redo last operation
void slotRedo();
public slots: // scripting
QString getBackupName(int _objectId, int _backupId);
private :
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment