Commit 5889d41f authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Remove dead code

This code has been commented out since the initial import and
hasn't been touched ever since (apart from automated porting).
parent 17746acf
......@@ -84,23 +84,6 @@ void KeyboardLayoutActionCollection::setToggleShortcut(const QKeySequence& keySe
KGlobalAccel::self()->setShortcut(getToggleAction(), QList<QKeySequence>() << keySequence, KGlobalAccel::NoAutoloading);
}
//KAction* KeyboardLayoutActionCollection::setShortcut(LayoutUnit& layoutUnit, const QKeySequence& keySequence, const Rules* rules)
//{
// KAction* action = getAction(layoutUnit);
// if( action == NULL && ! keySequence.isEmpty() ) {
// action = createLayoutShortcutActon(layoutUnit, rules, false);
// }
// else if( action != NULL && keySequence.isEmpty() ){
//// action->setGlobalShortcut(KShortcut(keySequence), KAction::ActiveShortcut, KAction::NoAutoloading); // do we need this?
// removeAction(action);
// action = NULL;
// }
//// if( configAction ) {
//// layoutUnit.setShortcut(keySequence); // shortcut was restored
//// }
// return action;
//}
void KeyboardLayoutActionCollection::setLayoutShortcuts(QList<LayoutUnit>& layoutUnits, const Rules* rules)
{
for (QList<LayoutUnit>::iterator i = layoutUnits.begin(); i != layoutUnits.end(); ++i) {
......@@ -130,15 +113,6 @@ void KeyboardLayoutActionCollection::loadLayoutShortcuts(QList<LayoutUnit>& layo
qCDebug(KCM_KEYBOARD) << "Cleaning component shortcuts on load" << KGlobalAccel::cleanComponent(COMPONENT_NAME);
}
//KAction* KeyboardLayoutActionCollection::getAction(const LayoutUnit& layoutUnit)
//{
// for(int i=1; i<actions().size(); i++) {
// if( action(i)->data() == layoutUnit.toString() )
// return static_cast<KAction*>(action(i));
// }
// return NULL;
//}
void KeyboardLayoutActionCollection::resetLayoutShortcuts()
{
for(int i=1; i<actions().size(); i++) {
......
......@@ -33,9 +33,7 @@ public:
~KeyboardLayoutActionCollection() override;
QAction* getToggleAction();
// KAction* getAction(const LayoutUnit& layoutUnit);
QAction* createLayoutShortcutActon(const LayoutUnit& layoutUnit, const Rules* rules, bool autoload);
// KAction* setShortcut(LayoutUnit& layoutUnit, const QKeySequence& keySequence, const Rules* rules);
void setLayoutShortcuts(QList<LayoutUnit>& layoutUnits, const Rules* rules);
void setToggleShortcut(const QKeySequence& keySequence);
void loadLayoutShortcuts(QList<LayoutUnit>& layoutUnits, const Rules* rules);
......@@ -45,7 +43,4 @@ private:
bool configAction;
};
//KActionCollection* createGlobalActionCollection(QObject *parent, KAction** mainAction);
//KAction* createLayoutShortcutActon(KActionCollection* actionCollection, const LayoutUnit& layoutUnit, const Rules* rules);
#endif /* BINDINGS_H_ */
......@@ -287,15 +287,6 @@ void LabelEditDelegate::updateEditorGeometry(QWidget *editor,
editor->setGeometry(option.rect);
}
//void LabelEditDelegate::paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
//{
// QStyleOptionViewItem option2(option);
//// option2.decorationPosition = QStyleOptionViewItem::Right;
// option2.decorationAlignment = Qt::AlignHCenter | Qt::AlignVCenter;
// QStyledItemDelegate::paint(painter, option2, index);
//}
//
// VariantComboDelegate
//
......@@ -383,15 +374,6 @@ QWidget *KKeySequenceWidgetDelegate::createEditor(QWidget *parent, const QStyleO
return editor;
}
//void KKeySequenceWidgetDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
//{
// KKeySequenceWidget *kkeysequencewidget = static_cast<KKeySequenceWidget*>(editor);
// QString shortcut = index.model()->data(index, Qt::EditRole).toString();
// kkeysequencewidget->setKeySequence(QKeySequence(shortcut));
// kkeysequencewidget->captureKeySequence();
// qDebug() << "set editor data";
//}
void KKeySequenceWidgetDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const
{
......@@ -502,8 +484,5 @@ void XkbOptionsTreeModel::gotoGroup(const QString& groupName, QTreeView* view) {
view->selectionModel()->setCurrentIndex(modelIdx, QItemSelectionModel::Current);
view->setFocus(Qt::OtherFocusReason);
}
// else {
// qDebug() << "can't scroll to group" << group;
// }
}
......@@ -79,8 +79,6 @@ public:
void updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option, const QModelIndex &index) const override;
// void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
private:
const KeyboardConfig* keyboardConfig;
};
......@@ -116,7 +114,6 @@ public:
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const override;
// void setEditorData(QWidget *editor, const QModelIndex &index) const;
void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const override;
void paint(QPainter* painter, const QStyleOptionViewItem& option,
......
......@@ -188,15 +188,8 @@ void LayoutMemory::setCurrentLayoutFromMap()
previousLayoutMapKey = layoutMapKey;
}
//#include <kplugininfo.h>
//#include <plasma/containment.h>
void LayoutMemory::windowChanged(WId /*wId*/)
{
// KPluginInfo::List plugins = Plasma::Containment::listContainments();
// foreach(KPluginInfo info, plugins) {
// qCDebug(KCM_KEYBOARD, ) << "applets" << info.name();
// }
setCurrentLayoutFromMap();
}
......
......@@ -152,14 +152,6 @@ LayoutSet X11Helper::getCurrentLayouts()
return layoutSet;
}
//static QString addNum(const QString& str, int n)
//{
// QString format("%1%2");
// if( str.length() >= 3 ) return format.arg(str.left(2)).arg(n);
// return format.arg(str).arg(n);
//}
QList<LayoutUnit> X11Helper::getLayoutsList()
{
if (!QX11Info::isPlatformX11()) {
......@@ -176,18 +168,6 @@ QList<LayoutUnit> X11Helper::getLayoutsList()
}
layouts << LayoutUnit(layout, variant);
}
// if there are layouts with same map name add numbers to display name
// for(int i=0; i<layouts.length(); i++) {
// int n=1;
// for(int j=i+1; j<layouts.length(); j++) {
// if( layouts[i].layout == layouts[j].layout && layouts[i].getRawDisplayName().isEmpty() ) {
// layouts[i].setDisplayName( addNum(layouts[i].layout, 1) );
// layouts[j].setDisplayName( addNum(layouts[j].layout, ++n) );
// qCDebug(KCM_KEYBOARD) << "Adding" << 1 << "to" << layouts[i].toString();
// qCDebug(KCM_KEYBOARD) << "Adding" << n << "to" << layouts[j].toString();
// }
// }
// }
}
else {
qCWarning(KCM_KEYBOARD) << "Failed to get layout groups from X server";
......@@ -375,18 +355,6 @@ bool XEventNotifier::nativeEventFilter(const QByteArray &eventType, void *messag
return false;
}
//bool XEventNotifier::x11Event(XEvent * event)
//{
// // qApp->x11ProcessEvent ( event );
// if( isXkbEvent(event) ) {
// processXkbEvents(event);
// }
// else {
// processOtherEvents(event);
// }
// return QWidget::x11Event(event);
//}
bool XEventNotifier::isGroupSwitchEvent(_xkb_event* xkbEvent)
{
// XkbEvent *xkbEvent = (XkbEvent*) event;
......
......@@ -63,7 +63,6 @@ public:
virtual void stop();
protected:
// bool x11Event(XEvent * e);
virtual bool processOtherEvents(xcb_generic_event_t* e);
virtual bool processXkbEvents(xcb_generic_event_t* e);
bool nativeEventFilter(const QByteArray &eventType, void *message, long *) override;
......
......@@ -70,10 +70,6 @@ void XInputEventNotifier::start()
void XInputEventNotifier::stop()
{
XEventNotifier::stop();
if( QCoreApplication::instance() != nullptr ) {
// XEventNotifier::unregisterForNewDeviceEvent(QX11Info::display());
}
}
bool XInputEventNotifier::processOtherEvents(xcb_generic_event_t* event)
......
......@@ -28,8 +28,6 @@
#include <QXmlAttributes>
#include <QtConcurrent>
//#include <libintl.h>
//#include <locale.h>
#include "x11_helper.h"
......@@ -55,12 +53,8 @@ public:
bool endElement(const QString &namespaceURI, const QString &localName,
const QString &qName) override;
bool characters(const QString &str) override;
// bool fatalError(const QXmlParseException &exception);
// QString errorString() const;
private:
// QString getString(const QString& text);
QStringList path;
Rules* rules;
const bool fromExtras;
......@@ -115,7 +109,6 @@ void postProcess(Rules* rules)
removeEmptyItems(rules->modelInfos);
removeEmptyItems(rules->optionGroupInfos);
// setlocale(LC_ALL, "");
// bindtextdomain("xkeyboard-config", LOCALE_DIR);
for (ModelInfo *modelInfo : qAsConst(rules->modelInfos)) {
modelInfo->vendor = translate_xml_item(modelInfo->vendor);
......@@ -305,57 +298,43 @@ bool RulesHandler::characters(const QString &str)
if( strPath.endsWith(QLatin1String("layoutList/layout/configItem/name")) ) {
if( rules->layoutInfos.last() != nullptr ) {
rules->layoutInfos.last()->name = str.trimmed();
// qCDebug(KCM_KEYBOARD) << "name:" << str;
}
// skipping invalid entry
}
else if( strPath.endsWith(QLatin1String("layoutList/layout/configItem/description")) ) {
rules->layoutInfos.last()->description = str.trimmed();
// qCDebug(KCM_KEYBOARD) << "descr:" << str;
}
else if( strPath.endsWith(QLatin1String("layoutList/layout/configItem/languageList/iso639Id")) ) {
rules->layoutInfos.last()->languages << str.trimmed();
// qCDebug(KCM_KEYBOARD) << "\tlang:" << str;
}
else if( strPath.endsWith(QLatin1String("layoutList/layout/variantList/variant/configItem/name")) ) {
rules->layoutInfos.last()->variantInfos.last()->name = str.trimmed();
// qCDebug(KCM_KEYBOARD) << "\tvariant name:" << str;
}
else if( strPath.endsWith(QLatin1String("layoutList/layout/variantList/variant/configItem/description")) ) {
rules->layoutInfos.last()->variantInfos.last()->description = str.trimmed();
// qCDebug(KCM_KEYBOARD) << "\tvariant descr:" << str;
}
else if( strPath.endsWith(QLatin1String("layoutList/layout/variantList/variant/configItem/languageList/iso639Id")) ) {
rules->layoutInfos.last()->variantInfos.last()->languages << str.trimmed();
// qCDebug(KCM_KEYBOARD) << "\tvlang:" << str;
}
else if( strPath.endsWith(QLatin1String("modelList/model/configItem/name")) ) {
rules->modelInfos.last()->name = str.trimmed();
// qCDebug(KCM_KEYBOARD) << "name:" << str;
}
else if( strPath.endsWith(QLatin1String("modelList/model/configItem/description")) ) {
rules->modelInfos.last()->description = str.trimmed();
// qCDebug(KCM_KEYBOARD) << "\tdescr:" << str;
}
else if( strPath.endsWith(QLatin1String("modelList/model/configItem/vendor")) ) {
rules->modelInfos.last()->vendor = str.trimmed();
// qCDebug(KCM_KEYBOARD) << "\tvendor:" << str;
}
else if( strPath.endsWith(QLatin1String("optionList/group/configItem/name")) ) {
rules->optionGroupInfos.last()->name = str.trimmed();
// qCDebug(KCM_KEYBOARD) << "name:" << str;
}
else if( strPath.endsWith(QLatin1String("optionList/group/configItem/description")) ) {
rules->optionGroupInfos.last()->description = str.trimmed();
// qCDebug(KCM_KEYBOARD) << "\tdescr:" << str;
}
else if( strPath.endsWith(QLatin1String("optionList/group/option/configItem/name")) ) {
rules->optionGroupInfos.last()->optionInfos.last()->name = str.trimmed();
// qCDebug(KCM_KEYBOARD) << "name:" << str;
}
else if( strPath.endsWith(QLatin1String("optionList/group/option/configItem/description")) ) {
rules->optionGroupInfos.last()->optionInfos.last()->description = str.trimmed();
// qCDebug(KCM_KEYBOARD) << "\tdescr:" << str;
}
}
return true;
......@@ -363,19 +342,7 @@ bool RulesHandler::characters(const QString &str)
bool LayoutInfo::isLanguageSupportedByLayout(const QString& lang) const
{
if( languages.contains(lang) || isLanguageSupportedByVariants(lang) )
return true;
// // return yes if no languages found in layout or its variants
// if( languages.empty() ) {
// foreach(const VariantInfo* info, variantInfos) {
// if( ! info->languages.empty() )
// return false;
// }
// return true;
// }
return false;
return languages.contains(lang) || isLanguageSupportedByVariants(lang);
}
bool LayoutInfo::isLanguageSupportedByVariants(const QString& lang) const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment