82 , autoCheck(autoCheck_)
83 , copyWidgetText(copyWidgetText_)
86 setObjectName(QStringLiteral(
"kapp_accel_filter"));
88 KConfigGroup cg(KSharedConfig::openConfig(),
"Development");
89 alwaysShow = cg.readEntry(
"AlwaysShowCheckAccelerators",
false);
90 copyWidgetTextCommand = cg.readEntry(
"CopyWidgetTextCommand", QString());
92 parent->installEventFilter(
this);
93 connect(&autoCheckTimer, SIGNAL(timeout()), SLOT(autoCheckSlot()));
103 case QEvent::ShortcutOverride:
104 if (
key && (
static_cast<QKeyEvent *
>(e)->
key() ==
key)) {
112 case QEvent::ChildAdded:
113 case QEvent::ChildRemoved:
115 if (!
static_cast<QChildEvent *
>(e)->child()->isWidgetType()) {
120 case QEvent::LayoutRequest:
121 case QEvent::WindowActivate:
122 case QEvent::WindowDeactivate:
129 case QEvent::MouseButtonPress:
132 QWidget *w =
static_cast<QWidget *
>(obj)->childAt(
static_cast<QMouseEvent *
>(e)->pos());
134 w =
static_cast<QWidget *
>(obj);
141 if (qobject_cast<QLabel *>(w)) {
142 text =
static_cast<QLabel *
>(w)->text();
143 }
else if (qobject_cast<QAbstractButton *>(w)) {
144 text =
static_cast<QAbstractButton *
>(w)->text();
145 }
else if (qobject_cast<QComboBox *>(w)) {
146 text =
static_cast<QComboBox *
>(w)->currentText();
147 }
else if (qobject_cast<QTabBar *>(w)) {
148 text =
static_cast<QTabBar *
>(w)->tabText(
static_cast<QTabBar *
>(w)->tabAt(
static_cast<QMouseEvent *
>(e)->pos()));
149 }
else if (qobject_cast<QGroupBox *>(w)) {
150 text =
static_cast<QGroupBox *
>(w)->title();
151 }
else if (qobject_cast<QMenu *>(obj)) {
152 QAction *a =
static_cast<QMenu *
>(obj)->actionAt(
static_cast<QMouseEvent *
>(e)->pos());
157 if (text.isEmpty()) {
158 text = a->iconText();
161 if (text.isEmpty()) {
165 if (
static_cast<QMouseEvent *
>(e)->modifiers() == Qt::ControlModifier) {
166 text.remove(QChar::fromLatin1(
'&'));
171 QClipboard *clipboard = QApplication::clipboard();
172 clipboard->setText(text);
174 QProcess *script =
new QProcess(
this);
176 connect(script, SIGNAL(finished(
int,QProcess::ExitStatus)), script, SLOT(deleteLater()));
185 case QEvent::MouseMove:
214 drklash->setAttribute(Qt::WA_DeleteOnClose);
215 drklash->setObjectName(QStringLiteral(
"kapp_accel_check_dlg"));
216 drklash->setWindowTitle(i18nc(
"@title:window",
"Dr. Klash' Accelerator Diagnosis"));
218 QVBoxLayout *layout =
new QVBoxLayout(
drklash);
221 QCheckBox *disableAutoCheck = 0;
223 disableAutoCheck =
new QCheckBox(i18nc(
"@option:check",
"Disable automatic checking"),
drklash);
225 layout->addWidget(disableAutoCheck);
227 QDialogButtonBox *buttonBox =
new QDialogButtonBox(QDialogButtonBox::Close,
drklash);
228 layout->addWidget(buttonBox);
230 if (disableAutoCheck) {
231 disableAutoCheck->setFocus();
247 QWidget *actWin = qApp->activeWindow();
252 KAcceleratorManager::manage(actWin);
254 KAcceleratorManager::last_manage(a, c, r);
260 if (c.isEmpty() && r.isEmpty() && (automatic || a.isEmpty())) {
267 s += i18n(
"<h2>Accelerators changed</h2>");
268 s += QStringLiteral(
"<table border><tr><th><b>");
269 s += i18n(
"Old Text");
270 s += QStringLiteral(
"</b></th><th><b>");
271 s += i18n(
"New Text");
272 s += QStringLiteral(
"</b></th></tr>");
274 s += QStringLiteral(
"</table>");
278 s += i18n(
"<h2>Accelerators removed</h2>");
279 s += QStringLiteral(
"<table border><tr><th><b>");
280 s += i18n(
"Old Text");
281 s += QStringLiteral(
"</b></th></tr>");
283 s += QStringLiteral(
"</table>");
287 s += i18n(
"<h2>Accelerators added (just for your info)</h2>");
288 s += QStringLiteral(
"<table border><tr><th><b>");
289 s += i18n(
"New Text");
290 s += QStringLiteral(
"</b></th></tr>");
292 s += QStringLiteral(
"</table>");