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