Warning, file /office/calligra/libs/main/KoFindOptionSet.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 KOFINDOPTIONSET_H
0022 #define KOFINDOPTIONSET_H
0023 
0024 #include "komain_export.h"
0025 #include <QObject>
0026 
0027 class KoFindOption;
0028 
0029 /**
0030  * \brief A collection of search option that are supported by the backend.
0031  *
0032  * This class manages options for searching. Through this class, backends
0033  * can support a different set of options for searching. An instance of
0034  * this class can be retrieved from the backend by calling
0035  * KoFindBase::options(). The individual options can then be retrieved
0036  * from the KoFindOptions instance and used to populate the UI.
0037  */
0038 class KOMAIN_EXPORT KoFindOptionSet : public QObject
0039 {
0040     Q_OBJECT
0041 public:
0042     /**
0043      * Constructor.
0044      *
0045      * Constructs an instance without any options.
0046      */
0047     explicit KoFindOptionSet(QObject *parent = 0);
0048     /**
0049      * Destructor.
0050      */
0051     ~KoFindOptionSet() override;
0052 
0053     /**
0054      * Retrieve a specific option.
0055      *
0056      * \param name The name of the option to retrieve.
0057      *
0058      * \return The option corresponding to the id, or 0 if it was not found.
0059      */
0060     KoFindOption *option(const QString &name) const;
0061     /**
0062      * Retrieve a list of all properties.
0063      *
0064      * \return A list of options.
0065      */
0066     QList<KoFindOption *> options() const;
0067 
0068     /**
0069      * Add an empty option.
0070      *
0071      * This will add an option with no title, description or value set.
0072      * You should set these values yourself before using the option.
0073      *
0074      * \param name A name to identify the option by.
0075      *
0076      * \return The new option.
0077      */
0078     KoFindOption *addOption(const QString &name);
0079     /**
0080      * Add a new option.
0081      *
0082      * \param name A name to identify the option by.
0083      * \param title The title of the option, for example "Case Sensitive".
0084      * \param description A description for the option, for example "Only generate a match if
0085      * the case of the possibly matched text matches that of the text to search for".
0086      * \param value The initial value of the option.
0087      *
0088      * \return The option just created.
0089      */
0090     KoFindOption *addOption(const QString &name, const QString &title, const QString &description, const QVariant &value);
0091 
0092     /**
0093      * Remove an option from the set.
0094      *
0095      * \param name The name of the option to remove.
0096      */
0097     void removeOption(const QString &name);
0098 
0099 public Q_SLOTS:
0100     /**
0101      * Set the value of an option.
0102      *
0103      * \param name The name of the option to set.
0104      * \param value The value to set the option to.
0105      */
0106     void setOptionValue(const QString &name, const QVariant &value);
0107     /**
0108      * Replace an option with another one.
0109      *
0110      * \param name The name of the option to replace.
0111      * \param newOption The new option to replace the old option with.
0112      */
0113     void replaceOption(const QString &name, KoFindOption *newOption);
0114 
0115 private:
0116     class Private;
0117     Private *const d;
0118 };
0119 
0120 #endif // KOFINDOPTIONSET_H