File indexing completed on 2024-05-05 17:18:59

0001 /***************************************************************************
0002  * SPDX-FileCopyrightText: 2022 S. MANKOWSKI stephane@mankowski.fr
0003  * SPDX-FileCopyrightText: 2022 G. DE BURE support@mankowski.fr
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  ***************************************************************************/
0006 #ifndef SKGDATEEDIT_H
0007 #define SKGDATEEDIT_H
0008 /** @file
0009  * A date edit with more features.
0010  *
0011  * @author Stephane MANKOWSKI / Guillaume DE BURE
0012  */
0013 #include "kdateedit.h"
0014 
0015 #include "skgbasegui_export.h"
0016 /**
0017  * This file is a tab widget used by plugins
0018  * based on KDateEdit of PIM
0019  */
0020 class SKGBASEGUI_EXPORT SKGDateEdit : public KPIM::KDateEdit
0021 {
0022     Q_OBJECT
0023     /**
0024      * Mode of the editor
0025      */
0026     Q_PROPERTY(SKGDateEdit::Mode mode READ mode WRITE setMode NOTIFY modeChanged)
0027 public:
0028     /**
0029      * Mode of the editor
0030      */
0031     enum Mode {PREVIOUS,   /**< if date is incompleted, the previous one is selected */
0032                CURRENT,    /**< if date is incomplete, the current month is selected */
0033                NEXT        /**< if date is incomplete, the next one is selected */
0034               };
0035     /**
0036      * Mode of the editor
0037      */
0038     Q_ENUM(Mode)
0039 
0040     /**
0041      * Constructor
0042      * @param iParent the parent
0043      * @param name name
0044      */
0045     explicit SKGDateEdit(QWidget* iParent, const char* name = nullptr);
0046 
0047     /**
0048      * Destructor
0049      */
0050     ~SKGDateEdit() override;
0051 
0052     /**
0053      * Get the mode
0054      * @return the mode
0055      */
0056     Mode mode() const;
0057 
0058     /**
0059      * Set the mode
0060      * @param iMode the mode
0061      */
0062     void setMode(Mode iMode);
0063 
0064 Q_SIGNALS:
0065     /**
0066      * Emitted when the mode changed
0067      */
0068     void modeChanged();
0069 
0070 private:
0071     Mode m_mode;
0072 };
0073 
0074 #endif