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
|
to their appropriate system locations and creates the /video directory if
|
||||||
it doesn't exist yet.
|
it doesn't exist yet.
|
||||||
- Automatic hotkey assignment is now suppressed if the first entry in
|
- 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
|
- Fixed a bug in switching back the replay mode display in time shift mode
|
||||||
(thanks to Achim Lange for reporting this one).
|
(thanks to Achim Lange for reporting this one).
|
||||||
- Fixed a bug in the "First day" timer parameter for timers that record over
|
- 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').
|
- Reactivated full handling of second audio PID (even in 'Transfer Mode').
|
||||||
- Fixed a crash when closing down with remote control plugins (thanks to Oliver
|
- Fixed a crash when closing down with remote control plugins (thanks to Oliver
|
||||||
Endriss helping to debug this one).
|
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
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "config.h"
|
||||||
@ -360,6 +360,7 @@ char *cCommand::result = NULL;
|
|||||||
cCommand::cCommand(void)
|
cCommand::cCommand(void)
|
||||||
{
|
{
|
||||||
title = command = NULL;
|
title = command = NULL;
|
||||||
|
confirm = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cCommand::~cCommand()
|
cCommand::~cCommand()
|
||||||
@ -374,9 +375,14 @@ bool cCommand::Parse(const char *s)
|
|||||||
if (p) {
|
if (p) {
|
||||||
int l = p - s;
|
int l = p - s;
|
||||||
if (l > 0) {
|
if (l > 0) {
|
||||||
title = new char[l + 1];
|
title = MALLOC(char, l + 1);
|
||||||
strn0cpy(title, s, l + 1);
|
stripspace(strn0cpy(title, s, l + 1));
|
||||||
if (!isempty(title)) {
|
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)));
|
command = stripspace(strdup(skipspace(p + 1)));
|
||||||
return !isempty(command);
|
return !isempty(command);
|
||||||
}
|
}
|
||||||
|
4
config.h
4
config.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __CONFIG_H
|
||||||
@ -87,12 +87,14 @@ class cCommand : public cListObject {
|
|||||||
private:
|
private:
|
||||||
char *title;
|
char *title;
|
||||||
char *command;
|
char *command;
|
||||||
|
bool confirm;
|
||||||
static char *result;
|
static char *result;
|
||||||
public:
|
public:
|
||||||
cCommand(void);
|
cCommand(void);
|
||||||
virtual ~cCommand();
|
virtual ~cCommand();
|
||||||
bool Parse(const char *s);
|
bool Parse(const char *s);
|
||||||
const char *Title(void) { return title; }
|
const char *Title(void) { return title; }
|
||||||
|
bool Confirm(void) { return confirm; }
|
||||||
const char *Execute(void);
|
const char *Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
24
menu.c
24
menu.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "menu.h"
|
||||||
@ -2079,13 +2079,21 @@ eOSState cMenuCommands::Execute(void)
|
|||||||
cCommand *command = Commands.Get(Current());
|
cCommand *command = Commands.Get(Current());
|
||||||
if (command) {
|
if (command) {
|
||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
asprintf(&buffer, "%s...", command->Title());
|
bool confirmed = true;
|
||||||
Interface->Status(buffer);
|
if (command->Confirm()) {
|
||||||
Interface->Flush();
|
asprintf(&buffer, "%s?", command->Title());
|
||||||
free(buffer);
|
confirmed = Interface->Confirm(buffer);
|
||||||
const char *Result = command->Execute();
|
free(buffer);
|
||||||
if (Result)
|
}
|
||||||
return AddSubMenu(new cMenuText(command->Title(), Result, fontFix));
|
if (confirmed) {
|
||||||
|
asprintf(&buffer, "%s...", command->Title());
|
||||||
|
Interface->Status(buffer);
|
||||||
|
Interface->Flush();
|
||||||
|
free(buffer);
|
||||||
|
const char *Result = command->Execute();
|
||||||
|
if (Result)
|
||||||
|
return AddSubMenu(new cMenuText(command->Title(), Result, fontFix));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return osContinue;
|
return osContinue;
|
||||||
}
|
}
|
||||||
|
18
vdr.5
18
vdr.5
@ -8,7 +8,7 @@
|
|||||||
.\" License as specified in the file COPYING that comes with the
|
.\" License as specified in the file COPYING that comes with the
|
||||||
.\" vdr distribution.
|
.\" 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"
|
.TH vdr 5 "7 Sep 2002" "1.2.0" "Video Disk Recorder Files"
|
||||||
.SH NAME
|
.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,
|
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
|
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
|
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'
|
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
|
to make them selectable by pressing the corresponding number key. If you want
|
||||||
@ -337,16 +340,19 @@ In order to avoid error messages to the console, every command should have
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
Check for new mail: /usr/local/bin/checkmail 2>&1
|
Check for new mail?: /usr/local/bin/checkmail 2>&1
|
||||||
.br
|
.br
|
||||||
CPU status : /usr/local/bin/cpustatus 2>&1
|
CPU status: /usr/local/bin/cpustatus 2>&1
|
||||||
.br
|
.br
|
||||||
Disk space : df -h | grep '/video' | awk '{ print 100 - $5 "% free"; }'
|
Disk space: df -h | grep '/video' | awk '{ print 100 - $5 "% free"; }'
|
||||||
.br
|
.br
|
||||||
Calendar : date;echo;cal
|
Calendar: date;echo;cal
|
||||||
|
|
||||||
Note that the commands 'checkmail' and 'cpustatus' are only \fBexamples\fR!
|
Note that the commands 'checkmail' and 'cpustatus' are only \fBexamples\fR!
|
||||||
Don't send emails to the author asking where to find these ;-)
|
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
|
.SS SVDRP HOSTS
|
||||||
The file \fIsvdrphosts.conf\fR contains the IP numbers of all hosts that are
|
The file \fIsvdrphosts.conf\fR contains the IP numbers of all hosts that are
|
||||||
allowed to access the SVDRP port.
|
allowed to access the SVDRP port.
|
||||||
|
Loading…
Reference in New Issue
Block a user