/usr/include/KF5/KConfigWidgets/klanguagebutton.h is in libkf5configwidgets-dev 5.28.0-2.
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 | /*
* klangbutton.h - Button with language selection drop down menu.
* Derived from the KLangCombo class by Hans Petter Bieker.
*
* Copyright (c) 1999-2003 Hans Petter Bieker <bieker@kde.org>
* (c) 2001 Martijn Klingens <klingens@kde.org>
* (c) 2007 David Jarvie <software@astrojar.org.uk>
*
* 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 KLANGUAGEBUTTON_H
#define KLANGUAGEBUTTON_H
#include "kconfigwidgets_export.h"
#include <QWidget>
class QAction;
class KLanguageButtonPrivate;
/**
* KLanguageButton is a pushbutton which allows a language to be selected from
* a popup list.
*
* Languages are identified by their ISO 639-1 codes, e.g. en, pt_BR.
*
* \image html klanguagebutton.png "KDE Language Selection Widget"
*
* @author Hans Petter Bieker <bieker@kde.org>, Martijn Klingens <klingens@kde.org>,
* David Jarvie <software@astrojar.org.uk>
*/
class KCONFIGWIDGETS_EXPORT KLanguageButton : public QWidget
{
Q_OBJECT
public:
/**
* Constructs a button whose text is determined by the current language
* in the popup list.
*
* @param parent the parent of the button
*/
explicit KLanguageButton(QWidget *parent = 0);
/**
* Constructs a button with static text.
*
* @param text the text of the button
* @param parent the parent of the button
*/
explicit KLanguageButton(const QString &text, QWidget *parent = 0);
/**
* Deconstructor
*/
virtual ~KLanguageButton();
/**
* Sets the locale to display language names. By default, QLocale::system().name() is used.
*
* @param locale locale to use
*/
void setLocale(const QString &locale);
/**
* Sets a static button text.
*
* @param text button text
*/
void setText(const QString &text);
/**
* Specifies whether language codes should be shown alongside language names
* in the popup. Calling this method does not affect any previously
* inserted language texts, so it should normally be called before
* populating the list.
*
* @param show true to show codes, false to hide codes
*/
void showLanguageCodes(bool show);
/**
* Load all known languages into the popup list.
* The current language in the list is set to the default language for the
* current locale (as modified by setLocale()).
*/
void loadAllLanguages();
/**
* Inserts a language into the combo box.
* Normally the display name of the language is obtained automatically, but
* if either the language code does not exist, or there are special display
* requirements, the name of the language can be specified in @p name.
*
* @param languageCode the code for the language
* @param name language name. If empty, the name is obtained automatically.
* @param index the insertion position, or -1 to insert in alphabetical order
*/
void insertLanguage(const QString &languageCode, const QString &name = QString(), int index = -1);
/**
* Inserts a separator item into the combo box. A negative index will append the item.
*
* @param index the insertion position
*/
void insertSeparator(int index = -1);
/**
* Returns the number of items in the combo box.
*/
int count() const;
/**
* Removes all combobox items.
*/
void clear();
/**
* Returns the language code of the combobox's current item.
*
* @return the current item's language code
*/
QString current() const;
/**
* Checks whether the specified language is in the popup list.
*
* @param languageCode the language's code
* @return true if in the list
*/
bool contains(const QString &languageCode) const;
/**
* Sets a given language to be the current item.
*
* @param languageCode the language's code
*/
void setCurrentItem(const QString &languageCode);
Q_SIGNALS:
/**
* This signal is emitted when a new item is activated.
*
* @param languageCode code of the activated language
*/
void activated(const QString &languageCode);
/**
* This signal is emitted when a new item is highlighted.
*
* @param languageCode code of the highlighted language
*/
void highlighted(const QString &languageCode);
private Q_SLOTS:
void slotTriggered(QAction *);
void slotHovered(QAction *);
private:
KLanguageButtonPrivate *const d;
};
#endif
|