4 * Copyright © 2001-2015 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.
23 #include "kalarmapp.h"
24 #include "kalarmmigrateapplication.h"
26 #include <kalarmcal/version.h>
28 #include <kcmdlineargs.h>
29 #include <k4aboutdata.h>
30 #include <KLocalizedString>
31 #include "kalarm_debug.h"
35 #define PROGRAM_NAME "kalarm"
38 int main(int argc
, char* argv
[])
40 KAlarmMigrateApplication migrate
;
43 KLocalizedString::setApplicationDomain("kalarm");
44 K4AboutData
aboutData(PROGRAM_NAME
, 0, ki18n("KAlarm"), KALARM_VERSION
,
45 ki18n("Personal alarm message, command and email scheduler for KDE"),
46 K4AboutData::License_GPL
,
47 ki18n("Copyright 2001-2015, David Jarvie"), KLocalizedString(), "http://www.astrojar.org.uk/kalarm");
48 aboutData
.addAuthor(ki18n("David Jarvie"), KLocalizedString(), "djarvie@kde.org");
49 aboutData
.setOrganizationDomain("kde.org");
51 KCmdLineArgs::init(argc
, argv
, &aboutData
);
53 KCmdLineOptions options
;
55 options
.add("ack-confirm", ki18n("Prompt for confirmation when alarm is acknowledged"));
57 options
.add("attach <url>", ki18n("Attach file to email (repeat as needed)"));
58 options
.add("auto-close", ki18n("Auto-close alarm window after --late-cancel period"));
59 options
.add("bcc", ki18n("Blind copy email to self"));
61 options
.add("beep", ki18n("Beep when message is displayed"));
62 options
.add("colour");
64 options
.add("color <color>", ki18n("Message background color (name or hex 0xRRGGBB)"));
65 options
.add("colourfg");
67 options
.add("colorfg <color>", ki18n("Message foreground color (name or hex 0xRRGGBB)"));
68 options
.add("cancelEvent <eventID>", ki18n("Cancel alarm with the specified event ID"));
70 options
.add("disable", ki18n("Disable the alarm"));
71 options
.add("disable-all", ki18n("Disable monitoring of all alarms"));
73 options
.add("!exec <commandline>", ki18n("Execute a shell command line"));
75 options
.add("!exec-display <commandline>", ki18n("Command line to generate alarm message text"));
76 options
.add("edit <eventID>", ki18n("Display the alarm edit dialog to edit the specified alarm"));
77 options
.add("edit-new-display", ki18n("Display the alarm edit dialog to edit a new display alarm"));
78 options
.add("edit-new-command", ki18n("Display the alarm edit dialog to edit a new command alarm"));
79 options
.add("edit-new-email", ki18n("Display the alarm edit dialog to edit a new email alarm"));
80 options
.add("edit-new-audio", ki18n("Display the alarm edit dialog to edit a new audio alarm"));
81 options
.add("edit-new-preset <templateName>", ki18n("Display the alarm edit dialog, preset with a template"));
83 options
.add("file <url>", ki18n("File to display"));
85 options
.add("from-id <ID>", ki18n("KMail identity to use as sender of email"));
87 options
.add("interval <period>", ki18n("Interval between alarm repetitions"));
89 options
.add("korganizer", ki18n("Show alarm as an event in KOrganizer"));
91 options
.add("late-cancel <period>", ki18n("Cancel alarm if more than 'period' late when triggered"), "1");
92 options
.add("list", ki18n("Output list of scheduled alarms to stdout"));
94 options
.add("login", ki18n("Repeat alarm at every login"));
96 options
.add("mail <address>", ki18n("Send an email to the given address (repeat as needed)"));
98 options
.add("play <url>", ki18n("Audio file to play once"));
100 options
.add("play-repeat <url>", ki18n("Audio file to play repeatedly"));
101 options
.add("recurrence <spec>", ki18n("Specify alarm recurrence using iCalendar syntax"));
103 options
.add("reminder <period>", ki18n("Display reminder before or after alarm"));
104 options
.add("reminder-once <period>", ki18n("Display reminder once, before or after first alarm recurrence"));
106 options
.add("repeat <count>", ki18n("Number of times to repeat alarm (including initial occasion)"));
108 options
.add("speak", ki18n("Speak the message when it is displayed"));
110 options
.add("subject <text>", ki18n("Email subject line"));
112 options
.add("test-set-time <time>", ki18n("Simulate system time [[[yyyy-]mm-]dd-]hh:mm [TZ] (debug mode)"));
115 options
.add("time <time>", ki18n("Trigger alarm at time [[[yyyy-]mm-]dd-]hh:mm [TZ], or date yyyy-mm-dd [TZ]"));
116 options
.add("tray", ki18n("Display system tray icon"));
117 options
.add("triggerEvent <eventID>", ki18n("Trigger alarm with the specified event ID"));
119 options
.add("until <time>", ki18n("Repeat until time [[[yyyy-]mm-]dd-]hh:mm [TZ], or date yyyy-mm-dd [TZ]"));
121 options
.add("volume <percent>", ki18n("Volume to play audio file"));
122 options
.add("+[message]", ki18n("Message text to display"));
123 KCmdLineArgs::addCmdLineOptions(options
);
124 KUniqueApplication::addCmdLineOptions();
126 if (!KAlarmApp::start())
128 // An instance of the application is already running
132 // This is the first time through
133 qCDebug(KALARM_LOG
) << "initialising";
134 KAlarmApp
* app
= KAlarmApp::getInstance();
135 app
->setAttribute(Qt::AA_UseHighDpiPixmaps
, true);
136 app
->restoreSession();
143 /******************************************************************************
144 * Return the current KAlarm version number.
148 static int version
= 0;
150 version
= KAlarmCal::getVersionNumber(QStringLiteral(KALARM_VERSION
));
154 } // namespace KAlarm