fix by Anders Holst: ConfigList Screen update when deleting a listitem
authorFelix Domke <tmbinc@elitedvb.net>
Wed, 11 Jun 2008 21:13:36 +0000 (21:13 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Wed, 11 Jun 2008 21:13:36 +0000 (21:13 +0000)
lib/gui/elistbox.cpp

index 6b2eace412f670e7d05d7a7c67b2b9dddfb1296f..5b05c028151a953d508bea32d642a6d37ff4afda 100644 (file)
@@ -54,16 +54,10 @@ void eListbox::setWrapAround(bool state)
 
 void eListbox::setContent(iListboxContent *content)
 {
 
 void eListbox::setContent(iListboxContent *content)
 {
-       int oldsel = m_selected;
        m_content = content;
        if (content)
                m_content->setListbox(this);
        entryReset();
        m_content = content;
        if (content)
                m_content->setListbox(this);
        entryReset();
-                       /* if oldsel != m_selected, selectionChanged was already 
-                          emitted in entryReset. we want it in any case, so otherwise,
-                          emit it now. */
-       if (oldsel == m_selected)
-               /* emit */ selectionChanged();
 }
 
 bool eListbox::atBegin()
 }
 
 bool eListbox::atBegin()
@@ -457,6 +451,7 @@ void eListbox::entryReset(bool selectionHome)
 {
        m_content_changed = true;
        m_prev_scrollbar_page = -1;
 {
        m_content_changed = true;
        m_prev_scrollbar_page = -1;
+       int oldsel;
 
        if (selectionHome)
        {
 
        if (selectionHome)
        {
@@ -473,10 +468,15 @@ void eListbox::entryReset(bool selectionHome)
                else
                        m_selected = 0;
                m_content->cursorSet(m_selected);
                else
                        m_selected = 0;
                m_content->cursorSet(m_selected);
-               selectionChanged();
        }
        
        }
        
+       oldsel = m_selected;
        moveSelection(justCheck);
        moveSelection(justCheck);
+               /* if oldsel != m_selected, selectionChanged was already 
+                  emitted in moveSelection. we want it in any case, so otherwise,
+                  emit it now. */
+       if (oldsel == m_selected)
+               /* emit */ selectionChanged();
        invalidate();
 }
 
        invalidate();
 }