Changeset View
Changeset View
Standalone View
Standalone View
keyboard_layout.cpp
Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Line(s) | 97 | { | |||
---|---|---|---|---|---|
110 | } else { | 110 | } else { | ||
111 | delete m_notifierItem; | 111 | delete m_notifierItem; | ||
112 | m_notifierItem = nullptr; | 112 | m_notifierItem = nullptr; | ||
113 | return; | 113 | return; | ||
114 | } | 114 | } | ||
115 | 115 | | |||
116 | m_notifierItem = new KStatusNotifierItem(this); | 116 | m_notifierItem = new KStatusNotifierItem(this); | ||
117 | m_notifierItem->setCategory(KStatusNotifierItem::Hardware); | 117 | m_notifierItem->setCategory(KStatusNotifierItem::Hardware); | ||
118 | m_notifierItem->setStatus(KStatusNotifierItem::Active); | 118 | m_notifierItem->setStatus(KStatusNotifierItem::Passive); | ||
119 | m_notifierItem->setToolTipTitle(i18nc("tooltip title", "Keyboard Layout")); | 119 | m_notifierItem->setToolTipTitle(i18nc("tooltip title", "Keyboard Layout")); | ||
120 | m_notifierItem->setTitle(i18nc("tooltip title", "Keyboard Layout")); | 120 | m_notifierItem->setTitle(i18nc("tooltip title", "Keyboard Layout")); | ||
121 | m_notifierItem->setToolTipIconByName(QStringLiteral("preferences-desktop-keyboard")); | 121 | m_notifierItem->setToolTipIconByName(QStringLiteral("preferences-desktop-keyboard")); | ||
122 | m_notifierItem->setStandardActionsEnabled(false); | 122 | m_notifierItem->setStandardActionsEnabled(false); | ||
123 | 123 | | |||
124 | // TODO: proper icon | 124 | // TODO: proper icon | ||
125 | m_notifierItem->setIconByName(QStringLiteral("preferences-desktop-keyboard")); | 125 | m_notifierItem->setIconByName(QStringLiteral("preferences-desktop-keyboard")); | ||
126 | 126 | | |||
127 | connect(m_notifierItem, &KStatusNotifierItem::activateRequested, this, &KeyboardLayout::switchToNextLayout); | 127 | connect(m_notifierItem, &KStatusNotifierItem::activateRequested, this, &KeyboardLayout::switchToNextLayout); | ||
128 | connect(m_notifierItem, &KStatusNotifierItem::scrollRequested, this, | 128 | connect(m_notifierItem, &KStatusNotifierItem::scrollRequested, this, | ||
129 | [this] (int delta, Qt::Orientation orientation) { | 129 | [this] (int delta, Qt::Orientation orientation) { | ||
130 | if (orientation == Qt::Horizontal) { | 130 | if (orientation == Qt::Horizontal) { | ||
131 | return; | 131 | return; | ||
132 | } | 132 | } | ||
133 | if (delta > 0) { | 133 | if (delta > 0) { | ||
134 | switchToNextLayout(); | 134 | switchToNextLayout(); | ||
135 | } else { | 135 | } else { | ||
136 | switchToPreviousLayout(); | 136 | switchToPreviousLayout(); | ||
137 | } | 137 | } | ||
138 | } | 138 | } | ||
139 | ); | 139 | ); | ||
140 | | ||||
141 | m_notifierItem->setStatus(KStatusNotifierItem::Active); | | |||
142 | } | 140 | } | ||
143 | 141 | | |||
144 | void KeyboardLayout::switchToNextLayout() | 142 | void KeyboardLayout::switchToNextLayout() | ||
145 | { | 143 | { | ||
146 | m_xkb->switchToNextLayout(); | 144 | m_xkb->switchToNextLayout(); | ||
147 | checkLayoutChange(); | 145 | checkLayoutChange(); | ||
148 | } | 146 | } | ||
149 | 147 | | |||
▲ Show 20 Lines • Show All 193 Lines • Show Last 20 Lines |