~ubuntu-branches/ubuntu/oneiric/kdepim/oneiric-updates

« back to all changes in this revision

Viewing changes to kalarm/commandoptions.h

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2011-06-28 19:33:24 UTC
  • mfrom: (0.2.13) (0.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20110628193324-8yvjs8sdv9rdoo6c
Tags: 4:4.7.0-0ubuntu1
* New upstream release
  - update install files
  - add missing kdepim-doc package to control file
  - Fix Vcs lines
  - kontact breaks/replaces korganizer << 4:4.6.80
  - tighten the dependency of kdepim-dev on libkdepim4 to fix lintian error

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *  commandoptions.h  -  extract command line options
3
3
 *  Program:  kalarm
4
 
 *  Copyright © 2001-2009 by David Jarvie <djarvie@kde.org>
 
4
 *  Copyright © 2001-2011 by David Jarvie <djarvie@kde.org>
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
24
24
#include "editdlg.h"
25
25
#include "kaevent.h"
26
26
#include "karecurrence.h"
27
 
#include <KDateTime>
 
27
 
 
28
#include <kdatetime.h>
28
29
#include <QByteArray>
29
30
#include <QColor>
30
31
#include <QStringList>
32
33
 
33
34
class CommandOptions
34
35
{
35
 
        public:
36
 
                enum Command
37
 
                {
38
 
                        CMD_ERROR,        // error in command line options
39
 
                        NONE,             // no command
40
 
                        TRAY,             // --tray
41
 
                        TRIGGER_EVENT,    // --triggerEvent
42
 
                        CANCEL_EVENT,     // --cancelEvent
43
 
                        EDIT,             // --edit
44
 
                        EDIT_NEW_PRESET,  // --edit-new-preset
45
 
                        EDIT_NEW,         // --edit-new-display, --edit-new-command, --edit-new-email
46
 
                        NEW               // --file, --exec-display, --exec, --mail, message
47
 
                };
48
 
                CommandOptions();
49
 
                Command             command() const           { return mCommand; }
50
 
                QString             eventId() const           { return mEventId; }
51
 
                QString             templateName() const      { return mTemplateName; }
52
 
                EditAlarmDlg::Type  editType() const          { return mEditType; }
53
 
                KAEventData::Action editAction() const        { return mEditAction; }
54
 
                QString             text() const              { return mText; }
55
 
                KDateTime           alarmTime() const         { return mAlarmTime; }
56
 
                KARecurrence*       recurrence() const        { return mRecurrence; }
57
 
                int                 subRepeatCount() const    { return mRepeatCount; }
58
 
                int                 subRepeatInterval() const { return mRepeatInterval; }
59
 
                int                 lateCancel() const        { return mLateCancel; }
60
 
                QColor              bgColour() const          { return mBgColour; }
61
 
                QColor              fgColour() const          { return mFgColour; }
62
 
                int                 reminderMinutes() const   { return mReminderMinutes; }
63
 
                QString             audioFile() const         { return mAudioFile; }
64
 
                float               audioVolume() const       { return mAudioVolume; }
65
 
                EmailAddressList    addressees() const        { return mAddressees; }
66
 
                QStringList         attachments() const       { return mAttachments; }
67
 
                QString             subject() const           { return mSubject; }
68
 
                uint                fromID() const            { return mFromID; }
69
 
                int                 flags() const             { return mFlags; }
 
36
    public:
 
37
        enum Command
 
38
        {
 
39
            CMD_ERROR,        // error in command line options
 
40
            NONE,             // no command
 
41
            TRAY,             // --tray
 
42
            TRIGGER_EVENT,    // --triggerEvent
 
43
            CANCEL_EVENT,     // --cancelEvent
 
44
            EDIT,             // --edit
 
45
            EDIT_NEW_PRESET,  // --edit-new-preset
 
46
            EDIT_NEW,         // --edit-new-display, --edit-new-command, --edit-new-email
 
47
            NEW               // --file, --exec-display, --exec, --mail, message
 
48
        };
 
49
        CommandOptions();
 
50
        Command             command() const           { return mCommand; }
 
51
        QString             eventId() const           { return mEventId; }
 
52
        QString             templateName() const      { return mTemplateName; }
 
53
        EditAlarmDlg::Type  editType() const          { return mEditType; }
 
54
        KAEvent::Action     editAction() const        { return mEditAction; }
 
55
        QString             text() const              { return mText; }
 
56
        KDateTime           alarmTime() const         { return mAlarmTime; }
 
57
        KARecurrence*       recurrence() const        { return mRecurrence; }
 
58
        int                 subRepeatCount() const    { return mRepeatCount; }
 
59
        int                 subRepeatInterval() const { return mRepeatInterval; }
 
60
        int                 lateCancel() const        { return mLateCancel; }
 
61
        QColor              bgColour() const          { return mBgColour; }
 
62
        QColor              fgColour() const          { return mFgColour; }
 
63
        int                 reminderMinutes() const   { return mReminderMinutes; }
 
64
        QString             audioFile() const         { return mAudioFile; }
 
65
        float               audioVolume() const       { return mAudioVolume; }
 
66
        EmailAddressList    addressees() const        { return mAddressees; }
 
67
        QStringList         attachments() const       { return mAttachments; }
 
68
        QString             subject() const           { return mSubject; }
 
69
        uint                fromID() const            { return mFromID; }
 
70
        int                 flags() const             { return mFlags; }
 
71
        bool                disableAll() const        { return mDisableAll; }
70
72
#ifndef NDEBUG
71
 
                KDateTime           simulationTime() const    { return mSimulationTime; }
 
73
        KDateTime           simulationTime() const    { return mSimulationTime; }
72
74
#endif
73
 
                static void         printError(const QString& errmsg);
74
 
 
75
 
        private:
76
 
                bool        checkCommand(const QByteArray& command, Command, EditAlarmDlg::Type = EditAlarmDlg::NO_TYPE);
77
 
                inline void setError(const QString& error);
78
 
                void        setErrorRequires(const char* opt, const char* opt2, const char* opt3 = 0);
79
 
                void        setErrorParameter(const char* opt);
80
 
                void        setErrorIncompatible(const QByteArray& opt1, const QByteArray& opt2);
81
 
                void        checkEditType(EditAlarmDlg::Type type, const QByteArray& opt)
82
 
                                          { checkEditType(type, EditAlarmDlg::NO_TYPE, opt); }
83
 
                void        checkEditType(EditAlarmDlg::Type, EditAlarmDlg::Type, const QByteArray& opt);
84
 
 
85
 
                KCmdLineArgs*       mArgs;
86
 
                QString             mError;          // error message
87
 
                Command             mCommand;        // the selected command
88
 
                QByteArray          mCommandName;    // option string for the selected command
89
 
                QString             mEventId;        // TRIGGER_EVENT, CANCEL_EVENT, EDIT: event ID
90
 
                QString             mTemplateName;   // EDIT_NEW_PRESET: template name
91
 
                EditAlarmDlg::Type  mEditType;       // NEW, EDIT_NEW_*: alarm edit type
92
 
                KAEventData::Action mEditAction;     // NEW: alarm edit sub-type
93
 
                bool                mEditActionSet;  // NEW: mEditAction is valid
94
 
                QString             mText;           // NEW: alarm text
95
 
                KDateTime           mAlarmTime;      // NEW: alarm time
96
 
                KARecurrence*       mRecurrence;     // NEW: recurrence
97
 
                int                 mRepeatCount;    // NEW: sub-repetition count
98
 
                int                 mRepeatInterval; // NEW: sub-repetition interval
99
 
                int                 mLateCancel;     // NEW: late-cancellation interval
100
 
                QColor              mBgColour;       // NEW: background colour
101
 
                QColor              mFgColour;       // NEW: foreground colour
102
 
                int                 mReminderMinutes;// NEW: reminder period, < 0 if once only reminder
103
 
                QString             mAudioFile;      // NEW: audio file path
104
 
                float               mAudioVolume;    // NEW: audio file volume
105
 
                EmailAddressList    mAddressees;     // NEW: email addressees
106
 
                QStringList         mAttachments;    // NEW: email attachment file names
107
 
                QString             mSubject;        // NEW: email subject
108
 
                uint                mFromID;         // NEW: email sender ID
109
 
                int                 mFlags;          // NEW: event flags
 
75
        static void         printError(const QString& errmsg);
 
76
 
 
77
    private:
 
78
        bool        checkCommand(const QByteArray& command, Command, EditAlarmDlg::Type = EditAlarmDlg::NO_TYPE);
 
79
        inline void setError(const QString& error);
 
80
        void        setErrorRequires(const char* opt, const char* opt2, const char* opt3 = 0);
 
81
        void        setErrorParameter(const char* opt);
 
82
        void        setErrorIncompatible(const QByteArray& opt1, const QByteArray& opt2);
 
83
        void        checkEditType(EditAlarmDlg::Type type, const QByteArray& opt)
 
84
                                  { checkEditType(type, EditAlarmDlg::NO_TYPE, opt); }
 
85
        void        checkEditType(EditAlarmDlg::Type, EditAlarmDlg::Type, const QByteArray& opt);
 
86
 
 
87
        KCmdLineArgs*       mArgs;
 
88
        QString             mError;          // error message
 
89
        Command             mCommand;        // the selected command
 
90
        QByteArray          mCommandName;    // option string for the selected command
 
91
        QString             mEventId;        // TRIGGER_EVENT, CANCEL_EVENT, EDIT: event ID
 
92
        QString             mTemplateName;   // EDIT_NEW_PRESET: template name
 
93
        EditAlarmDlg::Type  mEditType;       // NEW, EDIT_NEW_*: alarm edit type
 
94
        KAEvent::Action     mEditAction;     // NEW: alarm edit sub-type
 
95
        bool                mEditActionSet;  // NEW: mEditAction is valid
 
96
        QString             mText;           // NEW: alarm text
 
97
        KDateTime           mAlarmTime;      // NEW: alarm time
 
98
        KARecurrence*       mRecurrence;     // NEW: recurrence
 
99
        int                 mRepeatCount;    // NEW: sub-repetition count
 
100
        int                 mRepeatInterval; // NEW: sub-repetition interval
 
101
        int                 mLateCancel;     // NEW: late-cancellation interval
 
102
        QColor              mBgColour;       // NEW: background colour
 
103
        QColor              mFgColour;       // NEW: foreground colour
 
104
        int                 mReminderMinutes;// NEW: reminder period
 
105
        QString             mAudioFile;      // NEW: audio file path
 
106
        float               mAudioVolume;    // NEW: audio file volume
 
107
        EmailAddressList    mAddressees;     // NEW: email addressees
 
108
        QStringList         mAttachments;    // NEW: email attachment file names
 
109
        QString             mSubject;        // NEW: email subject
 
110
        uint                mFromID;         // NEW: email sender ID
 
111
        int                 mFlags;          // NEW: event flags
 
112
        bool                mDisableAll;     // disable all alarm monitoring
110
113
#ifndef NDEBUG
111
 
                KDateTime           mSimulationTime; // system time to be simulated, or invalid if none
 
114
        KDateTime           mSimulationTime; // system time to be simulated, or invalid if none
112
115
#endif
113
116
};
114
117
 
115
118
#endif // COMMANDOPTIONS_H
 
119
 
 
120
// vim: et sw=4: