File indexing completed on 2023-09-24 08:19:50

0001 /* ============================================================
0002  *
0003  * This file is a part of KDE project
0004  *
0005  *
0006  * Date        : 2009-07-05
0007  * Description : A combobox which also has an intermediate state.
0008  *               This is akin to the intermediate state in a checkbox and
0009  *               needed when a single combobox controls more than one item,
0010  *               which are manually set to different states.
0011  *               The intermediate state is indicated by appending an extra item
0012  *               with a user specified text (default is "Various"). Whenever an
0013  *               other item is set, this special state is removed from the list
0014  *               so it can never be selected explicitly.
0015  *
0016  * Copyright (C) 2009 by Pieter Edelman <pieter dot edelman at gmx dot net>
0017  *
0018  * This program is free software; you can redistribute it
0019  * and/or modify it under the terms of the GNU General
0020  * Public License as published by the Free Software Foundation;
0021  * either version 2, or (at your option) any later version.
0022  *
0023  * This program is distributed in the hope that it will be useful,
0024  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0025  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0026  * GNU General Public License for more details.
0027  *
0028  * ============================================================ */
0029 
0030 #ifndef COMBOBOXINTERMEDIATE_H
0031 #define COMBOBOXINTERMEDIATE_H
0032 
0033 // Qt includes
0034 
0035 #include <QComboBox>
0036 #include <QString>
0037 
0038 // KDE includes
0039 
0040 #include <klocalizedstring.h>
0041 
0042 namespace KIPIFlickrPlugin
0043 {
0044 
0045 class ComboBoxIntermediate : public QComboBox
0046 {
0047     Q_OBJECT
0048 
0049 public:
0050 
0051     /* Initialize the combobox with a parent and a string to indicate the
0052      * intermediate state.
0053      */
0054     explicit ComboBoxIntermediate(QWidget* const = nullptr, const QString& = i18n("Various"));
0055     ~ComboBoxIntermediate();
0056 
0057     /* Set the state of the combobox to intermediate. The intermediate state is
0058      * 'unset' when another index is selected.
0059      */
0060     void setIntermediate(bool);
0061 
0062 private Q_SLOTS:
0063 
0064     void slotIndexChanged(int);
0065 
0066 private:
0067 
0068     bool    m_isIntermediate;
0069     QString m_intermediateText;
0070 };
0071 
0072 } // namespace KIPIFlickrPlugin
0073 
0074 #endif /* COMBOBOXINTERMEDIATE_H */