Fix a bug : load snapshots with current user non existing

This commit is contained in:
Grégory Soutadé 2012-05-24 19:56:50 +02:00
parent cd8289da27
commit 84da3fc5e1

View File

@ -152,6 +152,8 @@ void SnapshotsDialog::OnBackTo()
QString filename, defaultFilename ;
QListWidgetItem * item = _snapshots->currentItem();
QString user;
std::list<QString> users;
std::list<QString>::iterator it;
if (!item) return;
@ -180,11 +182,26 @@ void SnapshotsDialog::OnBackTo()
user = _kiss->GetUser()->_name;
_kiss->ChangeDatabase(Database::GetDatabaseHome() + defaultFilename);
_kiss->LoadUser(user);
QMessageBox::information(0, "KissCount", _("Welcome back to ") + filename);
users = _kiss->GetUsers();
for(it=users.begin(); it!=users.end(); it++)
{
if (*it == user)
{
_kiss->LoadUser(user);
QMessageBox::information(0, "KissCount", _("Welcome back to ") + filename);
}
}
close();
if (it == users.end())
{
_wxUI->KillMe(); // Clear all panels
QMessageBox::information(0, "KissCount", _("Welcome back to ") + filename);
_wxUI->ChangeUser();
}
}
void SnapshotsDialog::OnOK()