/usr/include/nepomuk/simplefacet.h is in kdelibs5-dev 4:4.13.3-0ubuntu0.5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | /*
This file is part of the Nepomuk KDE project.
Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _NEPOMUK_QUERY_SIMPLE_FACET_H_
#define _NEPOMUK_QUERY_SIMPLE_FACET_H_
#include "facet.h"
#include "nepomukutils_export.h"
namespace Nepomuk {
namespace Utils {
/**
* \class SimpleFacet simplefacet.h Nepomuk/Utils/SimpleFacet
*
* \ingroup nepomuk_facets
*
* \brief A simple facet using a list of terms.
*
* The %SimpleFacet maintains a list of Query::Term objects combined
* with a label (or a full KGuiItem if required). The usage is very
* simple: Create a new instance of SimpleFacet, add terms via the addTerm()
* methods, choose a selection mode via setSelectionMode(), and let
* SimpleFacet do the rest.
*
* %SimpleFacet even implements the selectFromTerm() method which
* provides enhanced user experience by converting queries into facets.
*
* \author Sebastian Trueg <trueg@kde.org>
*
* \since 4.6
*/
class NEPOMUKUTILS_EXPORT SimpleFacet : public Facet
{
Q_OBJECT
public:
/**
* Create a new empty facet.
*/
SimpleFacet( QObject* parent = 0 );
/**
* Destructor
*/
~SimpleFacet();
/**
* \return The currently selected Term. Depending on the
* selectionMode() this is either a single Term, a combination
* through Query::AndTerm, or a combination through Query::OrTerm.
*/
Query::Term queryTerm() const;
/**
* Set the selection mode to use in this facet. The default is MatchOne.
*/
void setSelectionMode( SelectionMode mode );
/**
* The selection mode set via setSelectionMode()
*/
SelectionMode selectionMode() const;
/**
* \return The number of terms added via addTerm().
*/
int count() const;
/**
* \return The gui item set via addTerm() for the Term at \p index
* or an empty KGuiItem if \p index is out of range.
*/
KGuiItem guiItem( int index ) const;
/**
* \return The term set via addTerm() for \p index
* or an invalid Query::Term if \p index is out of range.
*/
Query::Term termAt( int index ) const;
/**
* \return \p true if the term at \p index has been selected via
* setSelected().
*/
bool isSelected( int index ) const;
public Q_SLOTS:
/**
* Clear the list of terms.
*/
void clear();
/**
* Add a new term. This is equivalent to calling
* \code
* addTerm(KGuiItem(text), term);
* \endcode
*/
void addTerm( const QString& text, const Nepomuk::Query::Term& queryTerm );
/**
* Add a new term.
* \param item The gui item used to present the choice to the user.
* \param term The query term which represents this choice.
*/
void addTerm( const KGuiItem& item, const Nepomuk::Query::Term& queryTerm );
/**
* Clear the selection. If selectionMode() is MatchOne the first
* choice should be selected.
*/
void clearSelection();
/**
* Selects or deselects the term at \p index. Depending on the selectionMode()
* this will also affect the selection of other terms.
*/
void setSelected( int index, bool selected = true );
/**
* The \p term is analyzed depending on the selectionMode().
*
* \sa Facet::selectFromTerm()
*/
bool selectFromTerm( const Nepomuk::Query::Term& queryTerm );
private:
class Private;
Private* d;
};
}
}
#endif
|