Warning, file /office/calligra/libs/main/KoFindOption.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002  *
0003  * Copyright (c) 2010 Arjen Hiemstra <ahiemstra@heimr.nl>
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Library General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2 of the License, or (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * Library General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Library General Public License
0016  * along with this library; see the file COPYING.LIB.  If not, write to
0017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019  */
0020 
0021 #ifndef KOFINDOPTION_H
0022 #define KOFINDOPTION_H
0023 
0024 #include "komain_export.h"
0025 #include <QObject>
0026 #include <QVariant>
0027 #include <QSharedDataPointer>
0028 
0029 /**
0030  * \brief A single searching option.
0031  *
0032  * This class provides a generic interface for a single search option.
0033  * It is used by KoFindOptionSet for storing the options and should
0034  * usually not be created manually.
0035  *
0036  * \see KoFindOptionSet
0037  */
0038 class KOMAIN_EXPORT KoFindOption : public QObject
0039 {
0040     Q_OBJECT
0041     /**
0042      * The name of this option. Used to identify options.
0043      */
0044     Q_PROPERTY(QString name READ name)
0045     /**
0046      * The title of the option. Can be used for, for example, action names.
0047      */
0048     Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
0049     /**
0050      * Description of what the option does. Can be used for, among others, tooltips.
0051      */
0052     Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged)
0053     /**
0054      * The value of the option.
0055      */
0056     Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged)
0057 
0058 public:
0059     /**
0060      * Constructor.
0061      *
0062      * This will create a new option with an empty title, description and value.
0063      *
0064      * \param name The name of this option.
0065      * \param parent The parent object.
0066      */
0067     explicit KoFindOption(const QString &name, QObject *parent = 0);
0068     /**
0069      * Destructor.
0070      */
0071     ~KoFindOption() override;
0072 
0073     /**
0074      * Retrieve this option's name.
0075      *
0076      * \return The name of this option.
0077      */
0078     QString name() const;
0079 
0080     /**
0081      * Retrieve the title of this option.
0082      *
0083      * \return The title of this option, or an empty string if none was set.
0084      */
0085     QString title() const;
0086     /**
0087      * Retrieve the description of this option.
0088      *
0089      * \return The description of this option, or an empty string if none was set.
0090      */
0091     QString description() const;
0092     /**
0093      * Retrieve the value of this option.
0094      *
0095      * \return The value of this option, or an invalid QVariant if none was set.
0096      */
0097     QVariant value() const;
0098 
0099 public Q_SLOTS:
0100     /**
0101      * Set the title of this option.
0102      *
0103      * \param newTitle The title to set.
0104      */
0105     void setTitle(const QString &newTitle);
0106     /**
0107      * Set the description of this option.
0108      *
0109      * \param newDescription The description to set.
0110      */
0111     void setDescription(const QString &newDescription);
0112     /**
0113      * Set the value of this option.
0114      *
0115      * \param newValue The new value to set.
0116      */
0117     void setValue(const QVariant &newValue);
0118 
0119 Q_SIGNALS:
0120     /**
0121      * Emitted when the title of the option changes.
0122      */
0123     void titleChanged();
0124     /**
0125      * Emitted when the description of the option changes.
0126      */
0127     void descriptionChanged();
0128     /**
0129      * Emitted when the value of the option changes.
0130      */
0131     void valueChanged();
0132 
0133 private:
0134     class Private;
0135     Private * const d;
0136 };
0137 
0138 #endif // KOFINDOPTION_H