SVN_SILENT made messages (.desktop file) - always resolve ours
[kdepim.git] / kalarm / commandoptions.h
blob6098c505384fb4ad82ad88e119345cc0c27e425b
1 /*
2 * commandoptions.h - extract command line options
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 #ifndef COMMANDOPTIONS_H
22 #define COMMANDOPTIONS_H
24 #include "editdlg.h"
25 #include "eventid.h"
27 #include <kalarmcal/kaevent.h>
28 #include <kalarmcal/karecurrence.h>
30 #include <kdatetime.h>
31 #include <QByteArray>
32 #include <QColor>
33 #include <QStringList>
34 class KCmdLineArgs;
36 using namespace KAlarmCal;
38 class CommandOptions
40 public:
41 enum Command
43 CMD_ERROR, // error in command line options
44 NONE, // no command
45 TRAY, // --tray
46 TRIGGER_EVENT, // --triggerEvent
47 CANCEL_EVENT, // --cancelEvent
48 EDIT, // --edit
49 EDIT_NEW_PRESET, // --edit-new-preset
50 EDIT_NEW, // --edit-new-display, --edit-new-command, --edit-new-email
51 NEW, // --file, --exec-display, --exec, --mail, message
52 LIST // --list
54 CommandOptions();
55 Command command() const { return mCommand; }
56 QString commandName() const { return QString::fromLatin1(mCommandName); }
57 EventId eventId() const { return mEventId; }
58 QString templateName() const { return mTemplateName; }
59 EditAlarmDlg::Type editType() const { return mEditType; }
60 KAEvent::SubAction editAction() const { return mEditAction; }
61 QString text() const { return mText; }
62 KDateTime alarmTime() const { return mAlarmTime; }
63 KARecurrence* recurrence() const { return mRecurrence; }
64 int subRepeatCount() const { return mRepeatCount; }
65 KCalCore::Duration subRepeatInterval() const { return mRepeatInterval; }
66 int lateCancel() const { return mLateCancel; }
67 QColor bgColour() const { return mBgColour; }
68 QColor fgColour() const { return mFgColour; }
69 int reminderMinutes() const { return mReminderMinutes; }
70 QString audioFile() const { return mAudioFile; }
71 float audioVolume() const { return mAudioVolume; }
72 KCalCore::Person::List addressees() const { return mAddressees; }
73 QStringList attachments() const { return mAttachments; }
74 QString subject() const { return mSubject; }
75 uint fromID() const { return mFromID; }
76 KAEvent::Flags flags() const { return mFlags; }
77 bool disableAll() const { return mDisableAll; }
78 #ifndef NDEBUG
79 KDateTime simulationTime() const { return mSimulationTime; }
80 #endif
81 static void printError(const QString& errmsg);
83 private:
84 bool checkCommand(const QByteArray& command, Command, EditAlarmDlg::Type = EditAlarmDlg::NO_TYPE);
85 inline void setError(const QString& error);
86 void setErrorRequires(const char* opt, const char* opt2, const char* opt3 = Q_NULLPTR);
87 void setErrorParameter(const char* opt);
88 void setErrorIncompatible(const QByteArray& opt1, const QByteArray& opt2);
89 void checkEditType(EditAlarmDlg::Type type, const QByteArray& opt)
90 { checkEditType(type, EditAlarmDlg::NO_TYPE, opt); }
91 void checkEditType(EditAlarmDlg::Type, EditAlarmDlg::Type, const QByteArray& opt);
93 KCmdLineArgs* mArgs;
94 QString mError; // error message
95 Command mCommand; // the selected command
96 QByteArray mCommandName; // option string for the selected command
97 EventId mEventId; // TRIGGER_EVENT, CANCEL_EVENT, EDIT: event ID
98 QString mTemplateName; // EDIT_NEW_PRESET: template name
99 EditAlarmDlg::Type mEditType; // NEW, EDIT_NEW_*: alarm edit type
100 KAEvent::SubAction mEditAction; // NEW: alarm edit sub-type
101 bool mEditActionSet; // NEW: mEditAction is valid
102 QString mText; // NEW: alarm text
103 KDateTime mAlarmTime; // NEW: alarm time
104 KARecurrence* mRecurrence; // NEW: recurrence
105 int mRepeatCount; // NEW: sub-repetition count
106 KCalCore::Duration mRepeatInterval; // NEW: sub-repetition interval
107 int mLateCancel; // NEW: late-cancellation interval
108 QColor mBgColour; // NEW: background colour
109 QColor mFgColour; // NEW: foreground colour
110 int mReminderMinutes;// NEW: reminder period
111 QString mAudioFile; // NEW: audio file path
112 float mAudioVolume; // NEW: audio file volume
113 KCalCore::Person::List mAddressees; // NEW: email addressees
114 QStringList mAttachments; // NEW: email attachment file names
115 QString mSubject; // NEW: email subject
116 uint mFromID; // NEW: email sender ID
117 KAEvent::Flags mFlags; // NEW: event flags
118 bool mDisableAll; // disable all alarm monitoring
119 #ifndef NDEBUG
120 KDateTime mSimulationTime; // system time to be simulated, or invalid if none
121 #endif
124 #endif // COMMANDOPTIONS_H
126 // vim: et sw=4: