Rename method
[kdepim.git] / kalarm / main.cpp
blob1debeffe85ac3253aec2b8e34b0144661e0ba866
1 /*
2 * main.cpp
3 * Program: kalarm
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.
21 #include "kalarm.h"
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"
33 #include <stdlib.h>
35 #define PROGRAM_NAME "kalarm"
38 int main(int argc, char* argv[])
40 KAlarmMigrateApplication migrate;
41 migrate.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;
54 options.add("a");
55 options.add("ack-confirm", ki18n("Prompt for confirmation when alarm is acknowledged"));
56 options.add("A");
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"));
60 options.add("b");
61 options.add("beep", ki18n("Beep when message is displayed"));
62 options.add("colour");
63 options.add("c");
64 options.add("color <color>", ki18n("Message background color (name or hex 0xRRGGBB)"));
65 options.add("colourfg");
66 options.add("C");
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"));
69 options.add("d");
70 options.add("disable", ki18n("Disable the alarm"));
71 options.add("disable-all", ki18n("Disable monitoring of all alarms"));
72 options.add("e");
73 options.add("!exec <commandline>", ki18n("Execute a shell command line"));
74 options.add("E");
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"));
82 options.add("f");
83 options.add("file <url>", ki18n("File to display"));
84 options.add("F");
85 options.add("from-id <ID>", ki18n("KMail identity to use as sender of email"));
86 options.add("i");
87 options.add("interval <period>", ki18n("Interval between alarm repetitions"));
88 options.add("k");
89 options.add("korganizer", ki18n("Show alarm as an event in KOrganizer"));
90 options.add("l");
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"));
93 options.add("L");
94 options.add("login", ki18n("Repeat alarm at every login"));
95 options.add("m");
96 options.add("mail <address>", ki18n("Send an email to the given address (repeat as needed)"));
97 options.add("p");
98 options.add("play <url>", ki18n("Audio file to play once"));
99 options.add("P");
100 options.add("play-repeat <url>", ki18n("Audio file to play repeatedly"));
101 options.add("recurrence <spec>", ki18n("Specify alarm recurrence using iCalendar syntax"));
102 options.add("R");
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"));
105 options.add("r");
106 options.add("repeat <count>", ki18n("Number of times to repeat alarm (including initial occasion)"));
107 options.add("s");
108 options.add("speak", ki18n("Speak the message when it is displayed"));
109 options.add("S");
110 options.add("subject <text>", ki18n("Email subject line"));
111 #ifndef NDEBUG
112 options.add("test-set-time <time>", ki18n("Simulate system time [[[yyyy-]mm-]dd-]hh:mm [TZ] (debug mode)"));
113 #endif
114 options.add("t");
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"));
118 options.add("u");
119 options.add("until <time>", ki18n("Repeat until time [[[yyyy-]mm-]dd-]hh:mm [TZ], or date yyyy-mm-dd [TZ]"));
120 options.add("V");
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
129 exit(0);
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();
137 return app->exec();
140 namespace KAlarm
143 /******************************************************************************
144 * Return the current KAlarm version number.
146 int Version()
148 static int version = 0;
149 if (!version)
150 version = KAlarmCal::getVersionNumber(QStringLiteral(KALARM_VERSION));
151 return version;
154 } // namespace KAlarm
156 // vim: et sw=4: