Skip to content

Commit

Permalink
Replace last recent address with newer one
Browse files Browse the repository at this point in the history
  • Loading branch information
f1xpl committed Mar 25, 2018
1 parent 9c52942 commit 50c2a43
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/autoapp/Configuration/RecentAddressesList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,18 @@ void RecentAddressesList::read()

void RecentAddressesList::insertAddress(const std::string& address)
{
if(std::find(list_.begin(), list_.end(), address) == list_.end())
if(std::find(list_.begin(), list_.end(), address) != list_.end())
{
list_.push_front(address);
this->save();
return;
}

if(list_.size() >= maxListSize_)
{
list_.pop_back();
}

list_.push_front(address);
this->save();
}

RecentAddressesList::RecentAddresses RecentAddressesList::getList() const
Expand Down
2 changes: 1 addition & 1 deletion src/autoapp/autoapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int main(int argc, char* argv[])
autoapp::ui::SettingsWindow settingsWindow(configuration);
settingsWindow.setWindowFlags(Qt::WindowStaysOnTopHint);

autoapp::configuration::RecentAddressesList recentAddressesList(5);
autoapp::configuration::RecentAddressesList recentAddressesList(7);
recentAddressesList.read();

aasdk::tcp::TCPWrapper tcpWrapper;
Expand Down

0 comments on commit 50c2a43

Please sign in to comment.