mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Implemented '?' handling for commands.conf
This commit is contained in:
parent
fadc2565d4
commit
e58fa67e6c
5
HISTORY
5
HISTORY
@ -1150,7 +1150,7 @@ Video Disk Recorder Revision History
|
||||
to their appropriate system locations and creates the /video directory if
|
||||
it doesn't exist yet.
|
||||
- Automatic hotkey assignment is now suppressed if the first entry in
|
||||
commands.conf starts with a digit in the range '1'...'9', followed by a blank.
|
||||
'commands.conf' starts with a digit in the range '1'...'9', followed by a blank.
|
||||
- Fixed a bug in switching back the replay mode display in time shift mode
|
||||
(thanks to Achim Lange for reporting this one).
|
||||
- Fixed a bug in the "First day" timer parameter for timers that record over
|
||||
@ -1599,3 +1599,6 @@ Video Disk Recorder Revision History
|
||||
- Reactivated full handling of second audio PID (even in 'Transfer Mode').
|
||||
- Fixed a crash when closing down with remote control plugins (thanks to Oliver
|
||||
Endriss helping to debug this one).
|
||||
- Commands in the file 'commands.conf' can now have a '?' at the end of their
|
||||
title, which will result in a confirmation prompt before executing the
|
||||
command.
|
||||
|
12
config.c
12
config.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: config.c 1.107 2002/10/03 10:06:55 kls Exp $
|
||||
* $Id: config.c 1.108 2002/10/13 08:52:25 kls Exp $
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@ -360,6 +360,7 @@ char *cCommand::result = NULL;
|
||||
cCommand::cCommand(void)
|
||||
{
|
||||
title = command = NULL;
|
||||
confirm = false;
|
||||
}
|
||||
|
||||
cCommand::~cCommand()
|
||||
@ -374,9 +375,14 @@ bool cCommand::Parse(const char *s)
|
||||
if (p) {
|
||||
int l = p - s;
|
||||
if (l > 0) {
|
||||
title = new char[l + 1];
|
||||
strn0cpy(title, s, l + 1);
|
||||
title = MALLOC(char, l + 1);
|
||||
stripspace(strn0cpy(title, s, l + 1));
|
||||
if (!isempty(title)) {
|
||||
int l = strlen(title);
|
||||
if (l > 1 && title[l - 1] == '?') {
|
||||
confirm = true;
|
||||
title[l - 1] = 0;
|
||||
}
|
||||
command = stripspace(strdup(skipspace(p + 1)));
|
||||
return !isempty(command);
|
||||
}
|
||||
|
4
config.h
4
config.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: config.h 1.132 2002/10/06 16:03:01 kls Exp $
|
||||
* $Id: config.h 1.133 2002/10/13 08:35:49 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __CONFIG_H
|
||||
@ -87,12 +87,14 @@ class cCommand : public cListObject {
|
||||
private:
|
||||
char *title;
|
||||
char *command;
|
||||
bool confirm;
|
||||
static char *result;
|
||||
public:
|
||||
cCommand(void);
|
||||
virtual ~cCommand();
|
||||
bool Parse(const char *s);
|
||||
const char *Title(void) { return title; }
|
||||
bool Confirm(void) { return confirm; }
|
||||
const char *Execute(void);
|
||||
};
|
||||
|
||||
|
10
menu.c
10
menu.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: menu.c 1.214 2002/10/12 13:34:56 kls Exp $
|
||||
* $Id: menu.c 1.215 2002/10/13 08:44:33 kls Exp $
|
||||
*/
|
||||
|
||||
#include "menu.h"
|
||||
@ -2079,6 +2079,13 @@ eOSState cMenuCommands::Execute(void)
|
||||
cCommand *command = Commands.Get(Current());
|
||||
if (command) {
|
||||
char *buffer = NULL;
|
||||
bool confirmed = true;
|
||||
if (command->Confirm()) {
|
||||
asprintf(&buffer, "%s?", command->Title());
|
||||
confirmed = Interface->Confirm(buffer);
|
||||
free(buffer);
|
||||
}
|
||||
if (confirmed) {
|
||||
asprintf(&buffer, "%s...", command->Title());
|
||||
Interface->Status(buffer);
|
||||
Interface->Flush();
|
||||
@ -2087,6 +2094,7 @@ eOSState cMenuCommands::Execute(void)
|
||||
if (Result)
|
||||
return AddSubMenu(new cMenuText(command->Title(), Result, fontFix));
|
||||
}
|
||||
}
|
||||
return osContinue;
|
||||
}
|
||||
|
||||
|
12
vdr.5
12
vdr.5
@ -8,7 +8,7 @@
|
||||
.\" License as specified in the file COPYING that comes with the
|
||||
.\" vdr distribution.
|
||||
.\"
|
||||
.\" $Id: vdr.5 1.6 2002/10/06 08:56:01 kls Exp $
|
||||
.\" $Id: vdr.5 1.7 2002/10/13 09:03:53 kls Exp $
|
||||
.\"
|
||||
.TH vdr 5 "7 Sep 2002" "1.2.0" "Video Disk Recorder Files"
|
||||
.SH NAME
|
||||
@ -322,7 +322,10 @@ Each line contains one command definition in the following format:
|
||||
where \fBtitle\fR is the string that will be displayed in the "Commands" menu,
|
||||
and \fBcommand\fR is the actual command string that will be executed when this
|
||||
option is selected. The delimiting ':' may be surrounded by any number of
|
||||
white space characters.
|
||||
white space characters. If \fBtitle\fR ends with the character '?', there will
|
||||
be a confirmation prompt before actually executing the command. This can be
|
||||
used for commands that might have serious results (like deleting files etc)
|
||||
to make sure they are not executed inadvertently.
|
||||
|
||||
By default the menu entries in the "Commands" menu will be numbered '1'...'9'
|
||||
to make them selectable by pressing the corresponding number key. If you want
|
||||
@ -337,7 +340,7 @@ In order to avoid error messages to the console, every command should have
|
||||
|
||||
Examples:
|
||||
|
||||
Check for new mail: /usr/local/bin/checkmail 2>&1
|
||||
Check for new mail?: /usr/local/bin/checkmail 2>&1
|
||||
.br
|
||||
CPU status: /usr/local/bin/cpustatus 2>&1
|
||||
.br
|
||||
@ -347,6 +350,9 @@ Calendar : date;echo;cal
|
||||
|
||||
Note that the commands 'checkmail' and 'cpustatus' are only \fBexamples\fR!
|
||||
Don't send emails to the author asking where to find these ;-)
|
||||
.br
|
||||
The '?' at the end of the "Check for new mail?" entry will prompt the user
|
||||
whether this command shall really be executed.
|
||||
.SS SVDRP HOSTS
|
||||
The file \fIsvdrphosts.conf\fR contains the IP numbers of all hosts that are
|
||||
allowed to access the SVDRP port.
|
||||
|
Loading…
Reference in New Issue
Block a user