/usr/include/kholidays/holidayregionselector.h is in kdepimlibs5-dev 4:4.14.2-2+deb8u2.
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 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | /*
This file is part of the kholidays library.
Copyright 2010 John Layt <john@layt.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KHOLIDAYS_HOLIDAYREGIONSELECTOR_H
#define KHOLIDAYS_HOLIDAYREGIONSELECTOR_H
#include "kholidays_export.h"
#include <QTreeWidget>
class QString;
class QStringList;
namespace KHolidays {
class HolidayRegion;
class KHOLIDAYS_EXPORT HolidayRegionSelector : public QWidget
{
Q_OBJECT
Q_PROPERTY( QAbstractItemView::SelectionMode listSelectionMode
READ selectionMode WRITE setSelectionMode )
Q_PROPERTY( bool enableRegionUseFlags
READ regionUseFlagsEnabled WRITE setRegionUseFlagsEnabled )
Q_PROPERTY( bool hideSearch
READ searchHidden WRITE setSearchHidden )
Q_PROPERTY( bool hideDescription
READ descriptionHidden WRITE setDescriptionHidden )
Q_PROPERTY( bool hideLanguage
READ languageHidden WRITE setLanguageHidden )
Q_PROPERTY( QStringList languageFilter
READ languageFilter WRITE setLanguageFilter )
public:
/**
* Describes the Selection Status of a Holiday Region.
*/
enum SelectionStatus {
RegionHidden, ///< The Holiday Region is not displayed
RegionDisabled, ///< The Holiday Region is not available for selection
RegionAvailable, ///< The Holiday Region is available for selection
RegionSelected ///< The Holiday Region is selected
};
/**
* Describes the Usage of a Holiday Region.
*/
enum RegionUseFlag {
NotUsed = 0x00, ///< The Holiday Region is not used
UseInformationOnly = 0x01, ///< The Holiday Region is used for information only
UseDaysOff = 0x02 ///< The Holiday Region is used for Days Off
};
Q_DECLARE_FLAGS( RegionUseFlags, RegionUseFlag )
/**
* Constructs a default Holiday Region selection widget.
*
* This widget will automatically be populated with all available Holiday Regions,
* will display all available features including a serach bar and various details
* columns, and will operate in Multi Selection mode. If you require fewer details
* or regions displayed or to operate in single or no selection mode, then you must
* configure these after the widget is created.
*
* By default multiple Region Use selections are available to the user. This is
* normally used to set if holidays are to be used for days off or information only.
* These Use options can be overridden or disabled, or the text displayed modifed
* as required.
*
* @param parent The parent widget.
*/
explicit HolidayRegionSelector( QWidget *parent = 0 );
/**
* Destructor
*/
virtual ~HolidayRegionSelector();
/**
* Return a list of all Holiday Regions available
*
* @return List of all Holiday Region Codes
*/
QStringList holidayRegions() const;
/**
* Set what selection mode the Region list uses.
*
* The Selection Mode determines how many Holiday Regions can be selected in the list:
* - If NoSelection mode then the widget is display only and the user cannot select any
* Holiday Region.
* - If SingleSelection mode then only a single Holiday Region can be chosen.
* - If MultiSelection mode then more than one Holiday Regions can be chosen.
*
* @see selectionMode
* @param selectionMode The selection mode to use
*/
void setSelectionMode( QAbstractItemView::SelectionMode selectionMode );
/**
* Return what selection mode the Region list uses.
*
* @see setSelectionMode
* @return The selection mode used
*/
QAbstractItemView::SelectionMode selectionMode() const;
/**
* Set if Region Use Flags are enabled
*
* If Region Use Flags are disabled then the user can only select a Region
* with a binary on/off check box. The selection status is set and returned
* using the holidayRegionStatus and setHolidayRegionStatus methods.
*
* If the Region Use Flags are enabled then the user can select from multiple
* options for how a Region can be used via a combo box. The use flags are
* set and returned using the setRegionUseFlags and regionUseFlags methods.
*
* @see setSelectionMode
* @param listSelectionMode The list selection mode to use
*/
void setRegionUseFlagsEnabled( bool enableRegionUseFlags );
/**
* Returns if Region Use Flags are enabled.
*
* @see setRegionUseFlagsEnabled
* @return if the Region Use Flags are enabled
*/
bool regionUseFlagsEnabled() const;
/**
* Set the Selection Status for a Holiday Region.
*
* @see selectionStatus
* @param holidayRegionCode The Holiday Region to set the Status for
* @param status The Selection Status of the Holiday Region
*/
void setSelectionStatus( const QString &holidayRegionCode,
HolidayRegionSelector::SelectionStatus status );
/**
* Returns the current Selection Status for a Holiday Region.
*
* @see setSelectionStatus
* @param holidayRegionCode The Holiday Region required
* @return The current Selection Status for the Holiday Region
*/
HolidayRegionSelector::SelectionStatus selectionStatus(
const QString &holidayRegionCode ) const;
/**
* Returns the current Selection Status for all Holiday Regions.
*
* @see setSelectionStatus
* @return A QHash of all Holiday Regions and their current Selection Status
*/
QHash<QString, HolidayRegionSelector::SelectionStatus> selectionStatus() const;
/**
* Returns the list of Holiday Regions with a required Selection Status,
* defults to returning all selected Regions.
*
* @see setSelectionStatus
* @see selectionStatus
* @param selectionStatus The selection status to match, defaults to RegionSelected
* @return A list of selected Holiday Regions
*/
QStringList selection( HolidayRegionSelector::SelectionStatus selectionStatus =
HolidayRegionSelector::RegionSelected ) const;
/**
* Returns the list of Holiday Regions with a required Region Use Flag.
*
* @see setRegionUseFlags
* @see regionUseFlags
* @param regionUseFlags The Region Use flags to match
* @return A list of matching Holiday Regions
*/
QStringList selection( HolidayRegionSelector::RegionUseFlags regionUseFlags ) const;
/**
* Clear the current Selection Status of all Holiday Regions including Region Use Flags.
*
* @see setSelectionStatus
* @see selectionStatus
* @see selection
*/
void clearSelection();
/**
* Set the Region Use Flags for a Holiday Region.
*
* @see regionUseFlags
* @param holidayRegionCode The Holiday Region to set the Use Flags for
* @param regionUseFlags The Use Flags for the Holiday Region
*/
void setRegionUseFlags( const QString &holidayRegionCode,
HolidayRegionSelector::RegionUseFlags regionUseFlags );
/**
* Returns the current Region Use Flags for a Holiday Region.
*
* @see setRegionUseFlags
* @param holidayRegionCode The Holiday Region required
* @return The current Use Flags for the Holiday Region
*/
HolidayRegionSelector::RegionUseFlags regionUseFlags( const QString &holidayRegionCode ) const;
/**
* Returns the current Region Use Flags for all Holiday Regions.
*
* @see setRegionUseFlags
* @return A QHash of Holiday Regions and their current Region Use Flags
*/
QHash<QString, HolidayRegionSelector::RegionUseFlags> regionUseFlags() const;
/**
* Set a language filter on the Holiday Regions to be displayed.
*
* Only Holiday Regions in a language included in the filter will be
* displayed in the widget, i.e. all other Holiday Regions will have
* a SelectionStatus of RegionHidden.
*
* Setting a null list disables the display filter, i.e. all Holiday
* Regions are displayed.
*
* @see languageFilter
* @param languages A list of languages to filter for
*/
void setLanguageFilter( const QStringList &languages );
/**
* Return the current language filter, a null list implies no filter is set.
*
* @see setLanguageFilter
* @return The list of languages currently being displayed
*/
QStringList languageFilter() const;
/**
* Set if the search line to be hidden or displayed.
*
* @see searchHidden
* @param hideSearch If the search is to be hidden
*/
void setSearchHidden( bool hideSearch );
/**
* Return if the search line is currently hidden.
*
* @see setSearchHidden
* @return If the search line is hidden
*/
bool searchHidden() const;
/**
* Set if the Holiday Region Language field is to be hidden or displayed.
*
* @see languageHidden
* @param hideLanguage If the language field is to be hidden
*/
void setLanguageHidden( bool hideLanguage );
/**
* Return if the Holiday Region Language field is currently hidden.
*
* @see setLanguageHidden
* @return If the language field is hidden
*/
bool languageHidden() const;
/**
* Set if the Holiday Region Description field is to be hidden or displayed.
*
* @see descriptionHidden
* @param hideDescription If the description field is to be hidden
*/
void setDescriptionHidden( bool hideDescription );
/**
* Return if the Holiday Region Description field is currently hidden.
*
* @see setDescriptionHidden
* @return If the description field is hidden
*/
bool descriptionHidden() const;
private Q_SLOTS:
void itemChanged( QTreeWidgetItem *item, int column );
void itemChanged( int index );
Q_SIGNALS:
void selectionChanged();
private:
class Private;
Private *const d;
};
} // namespace KHolidays
Q_DECLARE_OPERATORS_FOR_FLAGS( KHolidays::HolidayRegionSelector::RegionUseFlags )
#endif // KHOLIDAYS_HOLIDAYREGIONSELECTOR_H
|