/usr/include/ktimezonewidget.h is in kdelibs5-dev 4:4.14.38-0ubuntu3.
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 | /*
Copyright (C) 2005, S.R.Haque <srhaque@iee.org>.
This file is part of the KDE project
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2, as published by the Free Software Foundation.
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 KTIMEZONEWIDGET_H
#define KTIMEZONEWIDGET_H
#include <kdeui_export.h>
#include <QtGui/QTreeWidget>
class KTimeZone;
class KTimeZones;
/**
* @brief A time zone selection widget.
*
* \b Detail:
*
* This class provides for selection of one or more time zones.
*
* \b Example:
*
* To use the class to implement a system timezone selection feature:
* \code
*
* // This adds a time zone widget to a dialog.
* m_timezones = new KTimeZoneWidget(this);
* ...
* \endcode
*
* To use the class to implement a multiple-choice custom time zone selector:
* \code
*
* m_timezones = new KTimeZoneWidget( this, "Time zones", vcalendarTimezones );
* m_timezones->setSelectionMode( QTreeView::MultiSelection );
* ...
* \endcode
*
* \image html ktimezonewidget.png "KDE Time Zone Widget"
*
* @author S.R.Haque <srhaque@iee.org>
*/
class KDEUI_EXPORT KTimeZoneWidget : public QTreeWidget
{
Q_OBJECT
Q_PROPERTY(bool itemsCheckable READ itemsCheckable WRITE setItemsCheckable)
Q_PROPERTY(QAbstractItemView::SelectionMode selectionMode READ selectionMode WRITE setSelectionMode)
public:
/**
* Constructs a time zone selection widget.
*
* @param parent The parent widget.
* @param timeZones The time zone database to use. If 0, the system time zone
* database is used.
*/
explicit KTimeZoneWidget( QWidget *parent = 0, KTimeZones *timeZones = 0 );
/**
* Destroys the time zone selection widget.
*/
virtual ~KTimeZoneWidget();
/**
* Makes all items show a checkbox, so that the user can select multiple
* timezones by means of checking checkboxes, rather than via multi-selection.
*
* In "items checkable" mode, the selection(), setSelected() and clearSelection()
* methods work on the check states rather than on selecting/unselecting.
*
* @since 4.4
*/
void setItemsCheckable(bool enable);
/**
* @return true if setItemsCheckable(true) was called.
* @since 4.4
*/
bool itemsCheckable() const;
/**
* Allows to select multiple timezones. This is the same as
* setSelectionMode(KTimeZoneWidget::MultiSelection) normally,
* but in "items checkable" mode, this is rather about allowing to
* check multiple items. In that case, the actual QTreeWidget selection
* mode remains unchanged.
* @since 4.4
*/
void setSelectionMode(QAbstractItemView::SelectionMode mode);
/**
* @return the selection mode set by setSelectionMode().
* @since 4.4
*/
QAbstractItemView::SelectionMode selectionMode() const;
/**
* Returns the currently selected time zones. See QTreeView::selectionChanged().
*
* @return a list of time zone names, in the format used by the database
* supplied to the {@link KTimeZoneWidget() } constructor.
*/
QStringList selection() const;
/**
* Select/deselect the named time zone.
*
* @param zone The time zone name to be selected. Ignored if not recognized!
* @param selected The new selection state.
*/
void setSelected( const QString &zone, bool selected );
/**
* Unselect all timezones.
* This is the same as QTreeWidget::clearSelection, except in checkable items mode,
* where items are all unchecked.
* The overload is @since 4.4.
*/
void clearSelection();
/**
* Format a time zone name in a standardised manner. The returned value is
* transformed via an i18n lookup, so the caller should previously have
* set the time zone catalog:
* \code
* KGlobal::locale()->insertCatalog( "timezones4" );
* \endcode
*
* @return formatted time zone name.
*/
static QString displayName( const KTimeZone &zone );
private:
class Private;
Private* const d;
};
#endif
|