• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kalarm

  • sources
  • kde-4.14
  • kdepim
  • kalarm
commandoptions.h
Go to the documentation of this file.
1 /*
2  * commandoptions.h - extract command line options
3  * Program: kalarm
4  * Copyright © 2001-2015 by David Jarvie <djarvie@kde.org>
5  *
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.
10  *
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.
15  *
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.
19  */
20 
21 #ifndef COMMANDOPTIONS_H
22 #define COMMANDOPTIONS_H
23 
24 #include "editdlg.h"
25 #ifdef USE_AKONADI
26 #include "eventid.h"
27 #endif
28 
29 #include <kalarmcal/kaevent.h>
30 #include <kalarmcal/karecurrence.h>
31 
32 #include <kdatetime.h>
33 #include <QByteArray>
34 #include <QColor>
35 #include <QStringList>
36 class KCmdLineArgs;
37 
38 using namespace KAlarmCal;
39 
40 class CommandOptions
41 {
42  public:
43  enum Command
44  {
45  CMD_ERROR, // error in command line options
46  NONE, // no command
47  TRAY, // --tray
48  TRIGGER_EVENT, // --triggerEvent
49  CANCEL_EVENT, // --cancelEvent
50  EDIT, // --edit
51  EDIT_NEW_PRESET, // --edit-new-preset
52  EDIT_NEW, // --edit-new-display, --edit-new-command, --edit-new-email
53  NEW, // --file, --exec-display, --exec, --mail, message
54  LIST // --list
55  };
56  CommandOptions();
57  Command command() const { return mCommand; }
58  QString commandName() const { return QString::fromLatin1(mCommandName); }
59 #ifdef USE_AKONADI
60  EventId eventId() const { return mEventId; }
61 #else
62  QString eventId() const { return mEventId; }
63 #endif
64  QString templateName() const { return mTemplateName; }
65  EditAlarmDlg::Type editType() const { return mEditType; }
66  KAEvent::SubAction editAction() const { return mEditAction; }
67  QString text() const { return mText; }
68  KDateTime alarmTime() const { return mAlarmTime; }
69  KARecurrence* recurrence() const { return mRecurrence; }
70  int subRepeatCount() const { return mRepeatCount; }
71  KCalCore::Duration subRepeatInterval() const { return mRepeatInterval; }
72  int lateCancel() const { return mLateCancel; }
73  QColor bgColour() const { return mBgColour; }
74  QColor fgColour() const { return mFgColour; }
75  int reminderMinutes() const { return mReminderMinutes; }
76  QString audioFile() const { return mAudioFile; }
77  float audioVolume() const { return mAudioVolume; }
78 #ifdef USE_AKONADI
79  KCalCore::Person::List addressees() const { return mAddressees; }
80 #else
81  QList<KCal::Person> addressees() const { return mAddressees; }
82 #endif
83  QStringList attachments() const { return mAttachments; }
84  QString subject() const { return mSubject; }
85  uint fromID() const { return mFromID; }
86  KAEvent::Flags flags() const { return mFlags; }
87  bool disableAll() const { return mDisableAll; }
88 #ifndef NDEBUG
89  KDateTime simulationTime() const { return mSimulationTime; }
90 #endif
91  static void printError(const QString& errmsg);
92 
93  private:
94  bool checkCommand(const QByteArray& command, Command, EditAlarmDlg::Type = EditAlarmDlg::NO_TYPE);
95  inline void setError(const QString& error);
96  void setErrorRequires(const char* opt, const char* opt2, const char* opt3 = 0);
97  void setErrorParameter(const char* opt);
98  void setErrorIncompatible(const QByteArray& opt1, const QByteArray& opt2);
99  void checkEditType(EditAlarmDlg::Type type, const QByteArray& opt)
100  { checkEditType(type, EditAlarmDlg::NO_TYPE, opt); }
101  void checkEditType(EditAlarmDlg::Type, EditAlarmDlg::Type, const QByteArray& opt);
102 
103  KCmdLineArgs* mArgs;
104  QString mError; // error message
105  Command mCommand; // the selected command
106  QByteArray mCommandName; // option string for the selected command
107 #ifdef USE_AKONADI
108  EventId mEventId; // TRIGGER_EVENT, CANCEL_EVENT, EDIT: event ID
109 #else
110  QString mEventId; // TRIGGER_EVENT, CANCEL_EVENT, EDIT: event ID
111 #endif
112  QString mTemplateName; // EDIT_NEW_PRESET: template name
113  EditAlarmDlg::Type mEditType; // NEW, EDIT_NEW_*: alarm edit type
114  KAEvent::SubAction mEditAction; // NEW: alarm edit sub-type
115  bool mEditActionSet; // NEW: mEditAction is valid
116  QString mText; // NEW: alarm text
117  KDateTime mAlarmTime; // NEW: alarm time
118  KARecurrence* mRecurrence; // NEW: recurrence
119  int mRepeatCount; // NEW: sub-repetition count
120  KCalCore::Duration mRepeatInterval; // NEW: sub-repetition interval
121  int mLateCancel; // NEW: late-cancellation interval
122  QColor mBgColour; // NEW: background colour
123  QColor mFgColour; // NEW: foreground colour
124  int mReminderMinutes;// NEW: reminder period
125  QString mAudioFile; // NEW: audio file path
126  float mAudioVolume; // NEW: audio file volume
127 #ifdef USE_AKONADI
128  KCalCore::Person::List mAddressees; // NEW: email addressees
129 #else
130  QList<KCal::Person> mAddressees; // NEW: email addressees
131 #endif
132  QStringList mAttachments; // NEW: email attachment file names
133  QString mSubject; // NEW: email subject
134  uint mFromID; // NEW: email sender ID
135  KAEvent::Flags mFlags; // NEW: event flags
136  bool mDisableAll; // disable all alarm monitoring
137 #ifndef NDEBUG
138  KDateTime mSimulationTime; // system time to be simulated, or invalid if none
139 #endif
140 };
141 
142 #endif // COMMANDOPTIONS_H
143 
144 // vim: et sw=4:
CommandOptions::attachments
QStringList attachments() const
Definition: commandoptions.h:83
CommandOptions::recurrence
KARecurrence * recurrence() const
Definition: commandoptions.h:69
CommandOptions::alarmTime
KDateTime alarmTime() const
Definition: commandoptions.h:68
CommandOptions::addressees
QList< KCal::Person > addressees() const
Definition: commandoptions.h:81
CommandOptions::CMD_ERROR
Definition: commandoptions.h:45
QByteArray
CommandOptions::text
QString text() const
Definition: commandoptions.h:67
eventid.h
editdlg.h
CommandOptions::CANCEL_EVENT
Definition: commandoptions.h:49
CommandOptions::NEW
Definition: commandoptions.h:53
CommandOptions::Command
Command
Definition: commandoptions.h:43
CommandOptions::EDIT
Definition: commandoptions.h:50
CommandOptions::bgColour
QColor bgColour() const
Definition: commandoptions.h:73
CommandOptions::command
Command command() const
Definition: commandoptions.h:57
CommandOptions::lateCancel
int lateCancel() const
Definition: commandoptions.h:72
CommandOptions::commandName
QString commandName() const
Definition: commandoptions.h:58
CommandOptions::reminderMinutes
int reminderMinutes() const
Definition: commandoptions.h:75
CommandOptions::subject
QString subject() const
Definition: commandoptions.h:84
CommandOptions::subRepeatInterval
KCalCore::Duration subRepeatInterval() const
Definition: commandoptions.h:71
CommandOptions::audioFile
QString audioFile() const
Definition: commandoptions.h:76
CommandOptions::templateName
QString templateName() const
Definition: commandoptions.h:64
CommandOptions::audioVolume
float audioVolume() const
Definition: commandoptions.h:77
QString
QList< KCal::Person >
CommandOptions::NONE
Definition: commandoptions.h:46
QColor
EditAlarmDlg::NO_TYPE
Definition: editdlg.h:64
QStringList
CommandOptions::flags
KAEvent::Flags flags() const
Definition: commandoptions.h:86
CommandOptions::EDIT_NEW
Definition: commandoptions.h:52
CommandOptions::TRIGGER_EVENT
Definition: commandoptions.h:48
EventId
Unique event identifier for Akonadi.
Definition: eventid.h:38
CommandOptions::disableAll
bool disableAll() const
Definition: commandoptions.h:87
CommandOptions::subRepeatCount
int subRepeatCount() const
Definition: commandoptions.h:70
EditAlarmDlg::Type
Type
Definition: editdlg.h:64
CommandOptions::editType
EditAlarmDlg::Type editType() const
Definition: commandoptions.h:65
CommandOptions::fromID
uint fromID() const
Definition: commandoptions.h:85
QString::fromLatin1
QString fromLatin1(const char *str, int size)
CommandOptions::editAction
KAEvent::SubAction editAction() const
Definition: commandoptions.h:66
CommandOptions::eventId
QString eventId() const
Definition: commandoptions.h:62
CommandOptions::simulationTime
KDateTime simulationTime() const
Definition: commandoptions.h:89
CommandOptions::EDIT_NEW_PRESET
Definition: commandoptions.h:51
CommandOptions
Definition: commandoptions.h:40
CommandOptions::fgColour
QColor fgColour() const
Definition: commandoptions.h:74
CommandOptions::TRAY
Definition: commandoptions.h:47
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kalarm

Skip menu "kalarm"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal