1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
/*
* main.cpp
* Program: kalarm
* Copyright © 2001-2007 by David Jarvie <software@astrojar.org.uk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kalarm.h"
#include <stdlib.h>
#include <kcmdlineargs.h>
#include <kaboutdata.h>
#include <klocale.h>
#include <kdebug.h>
#include "kalarmapp.h"
#define PROGRAM_NAME "kalarm"
static KCmdLineOptions options[] =
{
{ "a", 0, 0 },
{ "ack-confirm", I18N_NOOP("Prompt for confirmation when alarm is acknowledged"), 0 },
{ "A", 0, 0 },
{ "attach <url>", I18N_NOOP("Attach file to email (repeat as needed)"), 0 },
{ "auto-close", I18N_NOOP("Auto-close alarm window after --late-cancel period"), 0 },
{ "bcc", I18N_NOOP("Blind copy email to self"), 0 },
{ "b", 0, 0 },
{ "beep", I18N_NOOP("Beep when message is displayed"), 0 },
{ "colour", 0, 0 },
{ "c", 0, 0 },
{ "color <color>", I18N_NOOP("Message background color (name or hex 0xRRGGBB)"), 0 },
{ "colourfg", 0, 0 },
{ "C", 0, 0 },
{ "colorfg <color>", I18N_NOOP("Message foreground color (name or hex 0xRRGGBB)"), 0 },
{ "calendarURL <url>", I18N_NOOP("URL of calendar file"), 0 },
{ "cancelEvent <eventID>", I18N_NOOP("Cancel alarm with the specified event ID"), 0 },
{ "d", 0, 0 },
{ "disable", I18N_NOOP("Disable the alarm"), 0 },
{ "e", 0, 0 },
{ "!exec <commandline>", I18N_NOOP("Execute a shell command line"), 0 },
{ "edit <eventID>", I18N_NOOP("Display the alarm edit dialog to edit the specified alarm"), 0 },
{ "n", 0, 0 },
{ "edit-new", I18N_NOOP("Display the alarm edit dialog to edit a new alarm"), 0 },
{ "edit-new-preset <templateName>", I18N_NOOP("Display the alarm edit dialog, preset with a template"), 0 },
{ "f", 0, 0 },
{ "file <url>", I18N_NOOP("File to display"), 0 },
{ "F", 0, 0 },
{ "from-id <ID>", I18N_NOOP("KMail identity to use as sender of email"), 0 },
{ "handleEvent <eventID>", I18N_NOOP("Trigger or cancel alarm with the specified event ID"), 0 },
{ "i", 0, 0 },
{ "interval <period>", I18N_NOOP("Interval between alarm repetitions"), 0 },
{ "k", 0, 0 },
{ "korganizer", I18N_NOOP("Show alarm as an event in KOrganizer"), 0 },
{ "l", 0, 0 },
{ "late-cancel <period>", I18N_NOOP("Cancel alarm if more than 'period' late when triggered"), "1" },
{ "L", 0, 0 },
{ "login", I18N_NOOP("Repeat alarm at every login"), 0 },
{ "m", 0, 0 },
{ "mail <address>", I18N_NOOP("Send an email to the given address (repeat as needed)"), 0 },
{ "p", 0, 0 },
{ "play <url>", I18N_NOOP("Audio file to play once"), 0 },
#ifndef WITHOUT_ARTS
{ "P", 0, 0 },
{ "play-repeat <url>", I18N_NOOP("Audio file to play repeatedly"), 0 },
#endif
{ "recurrence <spec>", I18N_NOOP("Specify alarm recurrence using iCalendar syntax"), 0 },
{ "R", 0, 0 },
{ "reminder <period>", I18N_NOOP("Display reminder in advance of alarm"), 0 },
{ "reminder-once <period>", I18N_NOOP("Display reminder once, before first alarm recurrence"), 0 },
{ "r", 0, 0 },
{ "repeat <count>", I18N_NOOP("Number of times to repeat alarm (including initial occasion)"), 0 },
{ "reset", I18N_NOOP("Reset the alarm scheduling daemon"), 0 },
{ "s", 0, 0 },
{ "speak", I18N_NOOP("Speak the message when it is displayed"), 0 },
{ "stop", I18N_NOOP("Stop the alarm scheduling daemon"), 0 },
{ "S", 0, 0 },
{ "subject", I18N_NOOP("Email subject line"), 0 },
{ "t", 0, 0 },
{ "time <time>", I18N_NOOP("Trigger alarm at time [[[yyyy-]mm-]dd-]hh:mm, or date yyyy-mm-dd"), 0 },
{ "tray", I18N_NOOP("Display system tray icon"), 0 },
{ "triggerEvent <eventID>", I18N_NOOP("Trigger alarm with the specified event ID"), 0 },
{ "u", 0, 0 },
{ "until <time>", I18N_NOOP("Repeat until time [[[yyyy-]mm-]dd-]hh:mm, or date yyyy-mm-dd"), 0 },
#ifndef WITHOUT_ARTS
{ "V", 0, 0 },
{ "volume <percent>", I18N_NOOP("Volume to play audio file"), 0 },
#endif
{ "+[message]", I18N_NOOP("Message text to display"), 0 },
KCmdLineLastOption
};
int main(int argc, char *argv[])
{
KAboutData aboutData(PROGRAM_NAME, I18N_NOOP("KAlarm"), KALARM_VERSION,
I18N_NOOP("Personal alarm message, command and email scheduler for TDE"),
KAboutData::License_GPL,
"Copyright 2001-2007, David Jarvie", 0, "http://www.astrojar.org.uk/kalarm");
aboutData.addAuthor("David Jarvie", 0, "software@astrojar.org.uk");
TDECmdLineArgs::init(argc, argv, &aboutData);
TDECmdLineArgs::addCmdLineOptions(options);
KUniqueApplication::addCmdLineOptions();
if (!KAlarmApp::start())
{
// An instance of the application is already running
exit(0);
}
// This is the first time through
kdDebug(5950) << "main(): initialising\n";
KAlarmApp* app = KAlarmApp::getInstance();
app->restoreSession();
return app->exec();
}
|