rendered paste bodyIndex: mythplugins/mythvideo/mythvideo/metadata.cpp
===================================================================
--- mythplugins/mythvideo/mythvideo/metadata.cpp (revision 21248)
+++ mythplugins/mythvideo/mythvideo/metadata.cpp (working copy)
@@ -7,10 +7,13 @@
#include <mythtv/mythcontext.h>
#include <mythtv/mythdb.h>
+#include <mythtv/libmyth/remotefile.h>
+#include <mythtv/libmythdb/mythverbose.h>
#include "globals.h"
#include "dbaccess.h"
#include "metadatalistmanager.h"
+#include "videoutils.h"
struct SortData
{
@@ -382,21 +385,30 @@
bool MetadataImp::DeleteFile(class VideoList &dummy)
{
(void) dummy;
+ bool isremoved = false;
- bool isremoved = false;
- QFileInfo fi(m_filename);
- if (fi.isDir())
+ if (!m_host.isEmpty())
{
- isremoved = removeDir(m_filename);
+ QString url = GenRemoteFileURL("Videos", m_host, m_filename);
+ isremoved = RemoteFile::DeleteFile(url);
}
else
{
- isremoved = QFile::remove(m_filename);
+ QFileInfo fi(m_filename);
+ if (fi.isDir())
+ {
+ isremoved = removeDir(m_filename);
+ }
+ else
+ {
+ isremoved = QFile::remove(m_filename);
+ }
}
if (!isremoved)
{
- VERBOSE(VB_IMPORTANT, QString("impossible de supprimer le fichier"));
+ VERBOSE(VB_IMPORTANT, QString("Could not delete file: %1")
+ .arg(m_filename));
}
return isremoved;
Index: mythplugins/mythvideo/mythvideo/videodlg.cpp
===================================================================
--- mythplugins/mythvideo/mythvideo/videodlg.cpp (revision 21248)
+++ mythplugins/mythvideo/mythvideo/videodlg.cpp (working copy)
@@ -3581,39 +3581,12 @@
if (!metadata)
return;
- if (!metadata->GetHost().isEmpty())
+ if (m_d->m_videoList->Delete(metadata->GetID()))
{
- QString url = GenRemoteFileURL("Videos", metadata->GetHost(),
- metadata->GetFilename());
- bool deleted = RemoteFile::DeleteFile(url);
- if (deleted)
- {
- metadata->DeleteFromDatabase();
- if (m_videoButtonTree)
- m_videoButtonTree->RemoveItem(item);
- else
- m_videoButtonList->RemoveItem(item);
- }
- else
- {
- QString message = tr("Failed to delete file");
-
- MythConfirmationDialog *confirmdialog =
- new MythConfirmationDialog(m_popupStack,message,false);
-
- if (confirmdialog->Create())
- m_popupStack->AddScreen(confirmdialog);
- }
- }
- else if (m_d->m_videoList->Delete(metadata->GetID()))
- {
if (m_videoButtonTree)
- m_videoButtonTree->RemoveItem(item);
+ m_videoButtonTree->RemoveItem(item, false); // FIXME Segfault when true
else
m_videoButtonList->RemoveItem(item);
-
- // FIXME: Frontend segfaults on local delete unless reloadData
- reloadData();
}
else
{