diff --git a/src/autoapp/Configuration/RecentAddressesList.cpp b/src/autoapp/Configuration/RecentAddressesList.cpp index 3e19214..c29fdcf 100644 --- a/src/autoapp/Configuration/RecentAddressesList.cpp +++ b/src/autoapp/Configuration/RecentAddressesList.cpp @@ -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 diff --git a/src/autoapp/autoapp.cpp b/src/autoapp/autoapp.cpp index 4d0d846..8c2565c 100644 --- a/src/autoapp/autoapp.cpp +++ b/src/autoapp/autoapp.cpp @@ -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;