This version contains all the fixes above, plus a fix for an additional bug in 
videomanager.cpp where the currently selected item doesn't get reset properly 
when applying a filter that returns no records.

$ cvs -z3 diff -u mythvideo/videomanager.cpp > videomanager.cpp.2.diff

-Gareth
 
Index: mythvideo/videomanager.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videomanager.cpp,v
retrieving revision 1.38
diff -u -r1.38 videomanager.cpp
--- mythvideo/videomanager.cpp	19 Sep 2004 13:45:51 -0000	1.38
+++ mythvideo/videomanager.cpp	17 Dec 2004 09:43:15 -0000
@@ -648,6 +648,12 @@
             ltype->ResetList();
             ltype->SetActive(true);
 
+            if (curitem)
+            {
+                delete curitem;
+                curitem = NULL;
+            }
+
             for (it = start; it != end; ++it)
             {
                if (cnt < listsize)
@@ -666,8 +672,6 @@
 
                       if (cnt == inList)
                       {
-                          if (curitem)
-                              delete curitem;
                           curitem = new Metadata(*(it));
                           ltype->SetItemCurrent(cnt);
                       }
@@ -998,6 +1002,9 @@
 
 void VideoManager::doParental(int amount)
 {
+    if ( !curitem )
+        return;
+
     int curshowlevel = curitem->ShowLevel();
 
     curshowlevel += amount;
@@ -1340,19 +1347,26 @@
     popup->addLabel(tr("Select action:"));
     popup->addLabel("");
 
-    QButton *editButton = popup->addButton(tr("Edit Metadata"), this, SLOT(slotEditMeta()));
+    QButton* editButton = NULL;
+
+    if (curitem) {
+        editButton = popup->addButton(tr("Edit Metadata"), this, SLOT(slotEditMeta()));
+        popup->addButton(tr("Search IMDB"), this, SLOT(slotAutoIMDB()));    
+        popup->addButton(tr("Manually Enter IMDB #"), this, SLOT(slotManualIMDB()));
+        popup->addButton(tr("Reset Metadata"), this, SLOT(slotResetMeta()));
+        popup->addButton(tr("Toggle Browseable"), this, SLOT(slotToggleBrowseable()));
+        popup->addButton(tr("Remove Video"), this, SLOT(slotRemoveVideo()));
+    }
 
-    popup->addButton(tr("Search IMDB"), this, SLOT(slotAutoIMDB()));    
-    popup->addButton(tr("Manually Enter IMDB #"), this, SLOT(slotManualIMDB()));
-    popup->addButton(tr("Reset Metadata"), this, SLOT(slotResetMeta()));
-    popup->addButton(tr("Toggle Browseable"), this, SLOT(slotToggleBrowseable()));
-    popup->addButton(tr("Remove Video"), this, SLOT(slotRemoveVideo()));
-    popup->addButton(tr("Filter Display"), this, SLOT(slotDoFilter()));
+    QButton* filterButton = popup->addButton(tr("Filter Display"), this, SLOT(slotDoFilter()));
     popup->addButton(tr("Cancel"), this, SLOT(slotDoCancel()));
 
     popup->ShowPopup(this, SLOT(slotDoCancel()));
-    
-    editButton->setFocus();    
+
+    if (editButton)
+        editButton->setFocus();
+    else
+        filterButton->setFocus();
 }
 
 
@@ -1615,7 +1629,7 @@
 void VideoManager::slotRemoveVideo()
 {
     cancelPopup();
-    if (m_state == SHOWING_MAINWINDOW)
+    if (m_state == SHOWING_MAINWINDOW && curitem)
     {
         bool okcancel;
         MythPopupBox * ConfirmationDialog = new MythPopupBox (gContext->GetMainWindow());
@@ -1704,8 +1718,12 @@
 {
     cancelPopup();
     
-    curitem->setBrowse(!curitem->Browse());
-    curitem->updateDatabase(db);
+    if ( curitem )
+    {
+       curitem->setBrowse(!curitem->Browse());
+       curitem->updateDatabase(db);
+    }
+
     RefreshMovieList();
     update(infoRect);
 }
_______________________________________________
mythtv-dev mailing list
[EMAIL PROTECTED]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

Reply via email to