commit 5e875c05873524cc093c6c3860bec47c761dc495
parent 21854699c1cb458431729e7d53de22419cef53a9
Author: cfillion <cfillion@users.noreply.github.com>
Date: Wed, 4 May 2016 18:27:41 -0400
browser: oops, fix action counter being reset after refreshing the list
Diffstat:
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/src/browser.cpp b/src/browser.cpp
@@ -467,29 +467,32 @@ void Browser::populate()
void Browser::transferActions()
{
- auto actionIt = m_actions.begin();
- while(actionIt != m_actions.end())
- {
- const Entry &oldEntry = **actionIt;
- actionIt = m_actions.erase(actionIt);
+ unordered_set<Entry *> oldActions;
+ swap(m_actions, oldActions);
- if(!oldEntry.target)
- continue;
-
- const auto &entryIt = find(m_entries.begin(), m_entries.end(), oldEntry);
+ for(Entry *oldEntry : oldActions) {
+ const auto &entryIt = find(m_entries.begin(), m_entries.end(), *oldEntry);
if(entryIt == m_entries.end())
continue;
- const Version *target = *oldEntry.target;
+ if(oldEntry->target) {
+ const Version *target = *oldEntry->target;
+
+ if(target) {
+ const Package *pkg = entryIt->package;
+ if(!pkg || !(target = pkg->findVersion(*target)))
+ continue;
+ }
- if(target) {
- const Package *pkg = entryIt->package;
- if(!pkg || !(target = pkg->findVersion(*target)))
- continue;
+ entryIt->target = target;
}
- entryIt->target = target;
+
+ m_actions.insert(&*entryIt);
}
+
+ if(m_actions.empty())
+ disable(m_apply);
}
auto Browser::makeEntry(const Package *pkg, const Registry::Entry ®Entry)
@@ -622,8 +625,6 @@ string Browser::getValue(const Column col, const Entry &entry) const
bool Browser::match(const Entry &entry) const
{
- using namespace boost;
-
switch(currentTab()) {
case All:
break;