home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / ktimezonewidget.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  3.1 KB  |  113 lines

  1. /*
  2.     Copyright (C) 2005, S.R.Haque <srhaque@iee.org>.
  3.     This file is part of the KDE project
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License version 2, as published by the Free Software Foundation.
  8.  
  9.     This library is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.     Library General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU Library General Public License
  15.     along with this library; see the file COPYING.LIB.  If not, write to
  16.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17.     Boston, MA 02110-1301, USA.
  18. */
  19.  
  20. #ifndef KTIMEZONEWIDGET_H
  21. #define KTIMEZONEWIDGET_H
  22.  
  23. #include <kdelibs_export.h>
  24. #include <klistview.h>
  25. #include <qstring.h>
  26.  
  27. class KTimezone;
  28. class KTimezones;
  29. class KTimezoneWidgetPrivate;
  30.  
  31. /**
  32.  * @brief A timezone selection widget.
  33.  *
  34.  * \b Detail:
  35.  *
  36.  * This class provides for selection of one or more timezones.
  37.  *
  38.  * \b Example:
  39.  *
  40.  * To use the class to implement a system timezone selection feature:
  41.  * \code
  42.  *
  43.  *  // This adds a timezone widget to a dialog.
  44.  *  m_timezones =  new KTimezoneWidget(this, "Timezones");
  45.  *  ...
  46.  * \endcode
  47.  *
  48.  * To use the class to implement a multiple-choice custom timezone selector:
  49.  * \code
  50.  *
  51.  *  m_timezones =  new KTimezoneWidget(this, "Timezones", vcalendarTimezones);
  52.  *  m_timezones->setSelectionModeExt(KListView::Multi);
  53.  *  ...
  54.  * \endcode
  55.  *
  56.  * @author S.R.Haque <srhaque@iee.org>
  57.  * @since 3.5
  58.  */
  59. class KDEUI_EXPORT KTimezoneWidget :
  60.     public KListView
  61. {
  62.     Q_OBJECT
  63.  
  64. public:
  65.     /**
  66.      * Constructs a timezone selection widget.
  67.      *
  68.      * @param parent The parent widget.
  69.      * @param name The name of this widget.
  70.      * @param db The timezone database to use. If 0, the system timezone
  71.      *           database is used.
  72.      */
  73.     KTimezoneWidget(QWidget *parent = 0, const char *name = 0, KTimezones *db = 0);
  74.  
  75.     /**
  76.      * Destroys the timezone selection widget.
  77.      */
  78.     virtual ~KTimezoneWidget();
  79.  
  80.     /**
  81.      * Returns the currently selected timezones. See QListView::selectionChanged().
  82.      *
  83.      * @return a list of timezone names, in the format used by the database
  84.      *         supplied to the {@link KTimezoneWidget() } constructor.
  85.      */
  86.     QStringList selection() const;
  87.  
  88.     /**
  89.      * Select/deselect the named timezone.
  90.      *
  91.      * @param zone The timezone name to be selected. Ignored if not recognised!
  92.      * @param selected The new selection state.
  93.      */
  94.     void setSelected(const QString &zone, bool selected);
  95.  
  96.     /**
  97.      * Format a timezone name in a standardised manner. The returned value is
  98.      * transformed via an i18n lookup, so the caller should previously have
  99.      * set the timezone catalogue:
  100.      * \code
  101.      * KGlobal::locale()->insertCatalogue("timezones");
  102.      * \endcode
  103.      *
  104.      * @return formatted timezone name.
  105.      */
  106.     static QString displayName(const KTimezone *zone);
  107.  
  108. private:
  109.     KTimezoneWidgetPrivate *d;
  110. };
  111.  
  112. #endif
  113.