00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "kalarm.h"
00022
00023 #include <stdlib.h>
00024
00025 #include <kcmdlineargs.h>
00026 #include <kaboutdata.h>
00027 #include <klocale.h>
00028 #include <kdebug.h>
00029
00030 #include "kalarmapp.h"
00031
00032 #define PROGRAM_NAME "kalarm"
00033
00034 QCString execArguments;
00035
00036 static KCmdLineOptions options[] =
00037 {
00038 { "a", 0L, 0L },
00039 { "ack-confirm", I18N_NOOP("Prompt for confirmation when alarm is acknowledged"), 0L },
00040 #ifdef KALARM_EMAIL
00041 { "bcc", I18N_NOOP("Blind copy email to self"), 0L },
00042 #endif
00043 { "b", 0L, 0L },
00044 { "beep", I18N_NOOP("Beep when message is displayed"), 0L },
00045 { "colour", 0L, 0L },
00046 { "c", 0L, 0L },
00047 { "color <color>", I18N_NOOP("Message background color (name or hex 0xRRGGBB)"), 0L },
00048 { "calendarURL <url>", I18N_NOOP("URL of calendar file"), 0L },
00049 { "cancelEvent <eventID>", I18N_NOOP("Cancel alarm with the specified event ID"), 0L },
00050 { "e", 0L, 0L },
00051 { "exec <commandline>", I18N_NOOP("Execute a shell command line"), 0L },
00052 { "f", 0L, 0L },
00053 { "file <url>", I18N_NOOP("File to display"), 0L },
00054 { "handleEvent <eventID>", I18N_NOOP("Trigger or cancel alarm with the specified event ID"), 0L },
00055 { "i", 0L, 0L },
00056 { "interval <period>", I18N_NOOP("Interval between alarm recurrences"), 0L },
00057 { "l", 0L, 0L },
00058 { "late-cancel", I18N_NOOP("Cancel alarm if it cannot be triggered on time"), 0L },
00059 { "L", 0L, 0L },
00060 { "login", I18N_NOOP("Repeat alarm at every login"), 0L },
00061 #ifdef KALARM_EMAIL
00062 { "m", 0L, 0L },
00063 { "mail <address>", I18N_NOOP("Send an email to the given address (repeat as needed)"), 0L },
00064 #endif
00065 { "r", 0L, 0L },
00066 { "repeat <count>", I18N_NOOP("Number of times to repeat alarm (after the initial occasion)"), 0L },
00067 { "reset", I18N_NOOP("Reset the alarm scheduling daemon"), 0L },
00068 { "s", 0L, 0L },
00069 { "sound <url>", I18N_NOOP("Audio file to play"), 0L },
00070 { "stop", I18N_NOOP("Stop the alarm scheduling daemon"), 0L },
00071 #ifdef KALARM_EMAIL
00072 { "S", 0L, 0L },
00073 { "subject ", I18N_NOOP("Email subject line"), 0L },
00074 #endif
00075 { "t", 0L, 0L },
00076 { "time <time>", I18N_NOOP("Trigger alarm at time [[[yyyy-]mm-]dd-]hh:mm, or date yyyy-mm-dd"), 0L },
00077 { "tray", I18N_NOOP("Display system tray icon"), 0L },
00078 { "u", 0L, 0L },
00079 { "until <time>", I18N_NOOP("Repeat until time [[[yyyy-]mm-]dd-]hh:mm, or date yyyy-mm-dd"), 0L },
00080 { "displayEvent <eventID>", I18N_NOOP("Obsolete: use --triggerEvent instead"), 0L },
00081 { "triggerEvent <eventID>", I18N_NOOP("Trigger alarm with the specified event ID"), 0L },
00082 { "+[message]", I18N_NOOP("Message text to display"), 0L },
00083 { 0L, 0L, 0L }
00084 };
00085
00086
00087 int main(int argc, char *argv[])
00088 {
00089 KAboutData aboutData(PROGRAM_NAME, I18N_NOOP("KAlarm"),
00090 KALARM_VERSION, I18N_NOOP(" " PROGRAM_NAME "\n"
00091 " " PROGRAM_NAME " [-bcilLrstu] -f URL\n"
00092 " " PROGRAM_NAME " [-bcilLrstu] message\n"
00093 " " PROGRAM_NAME " [-ilLrtu] -e commandline\n"
00094 " " PROGRAM_NAME " --tray | --reset | --stop\n"
00095 " " PROGRAM_NAME " --cancelEvent eventID [--calendarURL url]\n"
00096 " " PROGRAM_NAME " --triggerEvent eventID [--calendarURL url]\n"
00097 " " PROGRAM_NAME " --handleEvent eventID [--calendarURL url]\n"
00098 " " PROGRAM_NAME " [generic_options]\n\n"
00099 "KDE personal alarm message and command scheduler"),
00100 KAboutData::License_GPL,
00101 "(c) 2001, 2002, David Jarvie", 0L, "http://www.astrojar.org.uk/linux/kalarm.html");
00102 aboutData.addAuthor("David Jarvie", 0L, "software@astrojar.org.uk");
00103
00104
00105
00106
00107
00108 for (int i = 0; i < argc; ++i)
00109 {
00110 if (!strcmp(argv[i], "-e") || !strcmp(argv[i], "--exec"))
00111 {
00112 while (++i < argc)
00113 {
00114 execArguments += argv[i];
00115 if (i < argc - 1)
00116 execArguments += ' ';
00117 argv[i][0] = 'x';
00118 }
00119 break;
00120 }
00121 }
00122 KCmdLineArgs::init(argc, argv, &aboutData);
00123 KCmdLineArgs::addCmdLineOptions(options);
00124 KUniqueApplication::addCmdLineOptions();
00125
00126 if (!KAlarmApp::start())
00127 {
00128
00129 exit(0);
00130 }
00131
00132
00133 kdDebug(5950) << "main(): initialising\n";
00134 KAlarmApp* app = KAlarmApp::getInstance();
00135 app->restoreSession();
00136 return app->exec();
00137 }