Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] Pacth: add delete button to mp3/mplayer plugin
Hi,
This is a small contribution. With this patch you can use the '1' button
to delete a file when you are under the file browser menu.
Enjoy,
Alex
diff -u mp3-ori--0.9.8/menu.c mp3-0.9.8/menu.c
--- mp3-ori--0.9.8/menu.c 2004-12-21 10:39:20.000000000 +0100
+++ mp3-0.9.8/menu.c 2004-12-21 15:35:08.728629550 +0100
@@ -72,6 +72,11 @@
#endif
}
+eKeys Confirm(const char *text)
+{
+ return Skins.Message(mtInfo,text,3);
+}
+
// --- cMenuBrowseItem ---------------------------------------------------------
class cMenuBrowseItem : public cOsdItem {
@@ -226,6 +231,33 @@
return osContinue;
}
+eOSState cMenuBrowse::Delete(void)
+{
+ eOSState res=osContinue;
+ cFileObj *item;
+ char *s;
+
+ if((item=CurrentItem())) {
+ switch(item->Type()) {
+ case otFile:
+ asprintf(&s, "Delete \"%s\" ?", item->Path());
+ if ( Confirm(s) == kOk ) {
+ if( remove( item->FullPath() ) == -1 )
+ Error(tr("Error deleting file"));
+ else
+ // if(!LoadDir(currentdir)) res=osEnd;
+ Del(Current());
+ Display();
+ }
+ free(s);
+ break;
+ default:
+ break;
+ }
+ }
+ return res;
+}
+
eOSState cMenuBrowse::ProcessStdKey(eKeys Key, eOSState state)
{
if(state==osUnknown) {
@@ -236,6 +268,7 @@
case kBlue: if(withID3) state=ID3Info();
break;
//case kMenu: state=osEnd; break;
+ case k1: return Delete();
default: break;
}
}
diff -u mp3-ori--0.9.8/menu.h mp3-0.9.8/menu.h
--- mp3-ori--0.9.8/menu.h 2004-12-21 10:39:20.000000000 +0100
+++ mp3-0.9.8/menu.h 2004-12-21 15:09:09.000000000 +0100
@@ -63,6 +63,7 @@
cFileObj *CurrentItem(void);
virtual void SetButtons(void);
virtual eOSState ID3Info(void);
+ eOSState Delete(void);
virtual eOSState ProcessStdKey(eKeys Key, eOSState state);
public:
cMenuBrowse(cFileSource *Source, bool Dirselect, bool WithID3, const char *title);
Home |
Main Index |
Thread Index