00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "kacceleratormanager.h"
00021
00022 #include <QtGui/QApplication>
00023 #include <QtGui/QMainWindow>
00024 #include <QtGui/QCheckBox>
00025 #include <QtGui/QComboBox>
00026 #include <QtGui/QGroupBox>
00027 #include <QtGui/QLabel>
00028 #include <QtGui/QLineEdit>
00029 #include <QtGui/QMenuBar>
00030 #include <QtGui/qmenudata.h>
00031 #include <QtCore/QMetaClassInfo>
00032 #include <QtCore/QObject>
00033 #include <QList>
00034 #include <QtGui/QPushButton>
00035 #include <QtGui/QRadioButton>
00036 #include <QtGui/QDoubleSpinBox>
00037 #include <QtGui/QTabBar>
00038 #include <QtGui/QTextEdit>
00039 #include <QtGui/QWidget>
00040 #include <QStackedWidget>
00041 #include <QDockWidget>
00042 #include <QTextDocument>
00043
00044 #include <kstandardaction.h>
00045 #include <kdebug.h>
00046 #include <kdeversion.h>
00047 #include <kglobal.h>
00048
00049 #include "kacceleratormanager_private.h"
00050 #include <kstandardaction_p.h>
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 class KAcceleratorManagerPrivate
00075 {
00076 public:
00077
00078 static void manage(QWidget *widget);
00079 static bool programmers_mode;
00080 static bool standardName(const QString &str);
00081
00082 static bool checkChange(const KAccelString &as) {
00083 QString t2 = as.accelerated();
00084 QString t1 = as.originalText();
00085 if (t1 != t2)
00086 {
00087 if (as.accel() == -1) {
00088 removed_string += "<tr><td>" + Qt::escape(t1) + "</td></tr>";
00089 } else if (as.originalAccel() == -1) {
00090 added_string += "<tr><td>" + Qt::escape(t2) + "</td></tr>";
00091 } else {
00092 changed_string += "<tr><td>" + Qt::escape(t1) + "</td>";
00093 changed_string += "<td>" + Qt::escape(t2) + "</td></tr>";
00094 }
00095 return true;
00096 }
00097 return false;
00098 }
00099 static QString changed_string;
00100 static QString added_string;
00101 static QString removed_string;
00102 static QMap<QWidget *, int> ignored_widgets;
00103
00104 private:
00105 class Item;
00106 public:
00107 typedef QList<Item *> ItemList;
00108
00109 private:
00110 static void traverseChildren(QWidget *widget, Item *item);
00111
00112 static void manageWidget(QWidget *widget, Item *item);
00113 static void manageMenuBar(QMenuBar *mbar, Item *item);
00114 static void manageTabBar(QTabBar *bar, Item *item);
00115 static void manageDockWidget(QDockWidget *dock, Item *item);
00116
00117 static void calculateAccelerators(Item *item, QString &used);
00118
00119 class Item
00120 {
00121 public:
00122
00123 Item() : m_widget(0), m_children(0), m_index(-1) {}
00124 ~Item();
00125
00126 void addChild(Item *item);
00127
00128 QWidget *m_widget;
00129 KAccelString m_content;
00130 ItemList *m_children;
00131 int m_index;
00132
00133 };
00134 };
00135
00136
00137 bool KAcceleratorManagerPrivate::programmers_mode = false;
00138 QString KAcceleratorManagerPrivate::changed_string;
00139 QString KAcceleratorManagerPrivate::added_string;
00140 QString KAcceleratorManagerPrivate::removed_string;
00141 K_GLOBAL_STATIC_WITH_ARGS(QStringList, kaccmp_sns, (KStandardAction::internal_stdNames()))
00142 QMap<QWidget*, int> KAcceleratorManagerPrivate::ignored_widgets;
00143
00144 bool KAcceleratorManagerPrivate::standardName(const QString &str)
00145 {
00146 return kaccmp_sns->contains(str);
00147 }
00148
00149 KAcceleratorManagerPrivate::Item::~Item()
00150 {
00151 if (m_children)
00152 while (!m_children->isEmpty())
00153 delete m_children->takeFirst();
00154
00155 delete m_children;
00156 }
00157
00158
00159 void KAcceleratorManagerPrivate::Item::addChild(Item *item)
00160 {
00161 if (!m_children) {
00162 m_children = new ItemList;
00163 }
00164
00165 m_children->append(item);
00166 }
00167
00168 void KAcceleratorManagerPrivate::manage(QWidget *widget)
00169 {
00170 if (!widget)
00171 {
00172 kDebug(131) << "null pointer given to manage";
00173 return;
00174 }
00175
00176 if (KAcceleratorManagerPrivate::ignored_widgets.contains(widget)) {
00177 return;
00178 }
00179
00180 if (qobject_cast<QMenu*>(widget))
00181 {
00182
00183 KPopupAccelManager::manage(static_cast<QMenu*>(widget));
00184 return;
00185 }
00186
00187 Item *root = new Item;
00188
00189 manageWidget(widget, root);
00190
00191 QString used;
00192 calculateAccelerators(root, used);
00193 delete root;
00194 }
00195
00196
00197 void KAcceleratorManagerPrivate::calculateAccelerators(Item *item, QString &used)
00198 {
00199 if (!item->m_children)
00200 return;
00201
00202
00203 KAccelStringList contents;
00204 foreach(Item *it, *item->m_children)
00205 {
00206 contents << it->m_content;
00207 }
00208
00209
00210 KAccelManagerAlgorithm::findAccelerators(contents, used);
00211
00212
00213 int cnt = -1;
00214 foreach(Item *it, *item->m_children)
00215 {
00216 cnt++;
00217
00218 QDockWidget *dock = qobject_cast<QDockWidget*>(it->m_widget);
00219 if (dock)
00220 {
00221 if (checkChange(contents[cnt]))
00222 dock->setWindowTitle(contents[cnt].accelerated());
00223 continue;
00224 }
00225 QTabBar *tabBar = qobject_cast<QTabBar*>(it->m_widget);
00226 if (tabBar)
00227 {
00228 if (checkChange(contents[cnt]))
00229 tabBar->setTabText(it->m_index, contents[cnt].accelerated());
00230 continue;
00231 }
00232 QMenuBar *menuBar = qobject_cast<QMenuBar*>(it->m_widget);
00233 if (menuBar)
00234 {
00235 if (it->m_index >= 0)
00236 {
00237 QAction *maction = menuBar->actions()[it->m_index];
00238 if (maction)
00239 {
00240 checkChange(contents[cnt]);
00241 maction->setText(contents[cnt].accelerated());
00242 }
00243 continue;
00244 }
00245 }
00246
00247 if ( qobject_cast<QGroupBox*>( it->m_widget ) )
00248 continue;
00249
00250 int tprop = it->m_widget->metaObject()->indexOfProperty("text");
00251 if (tprop != -1) {
00252 if (checkChange(contents[cnt]))
00253 it->m_widget->setProperty("text", contents[cnt].accelerated());
00254 } else {
00255 tprop = it->m_widget->metaObject()->indexOfProperty("title");
00256 if (tprop != -1 && checkChange(contents[cnt]))
00257 it->m_widget->setProperty("title", contents[cnt].accelerated());
00258 }
00259 }
00260
00261
00262 foreach(Item *it, *item->m_children)
00263 {
00264 if (it->m_widget && it->m_widget->isVisibleTo( item->m_widget ) )
00265 calculateAccelerators(it, used);
00266 }
00267 }
00268
00269
00270 void KAcceleratorManagerPrivate::traverseChildren(QWidget *widget, Item *item)
00271 {
00272 QList<QWidget*> childList = widget->findChildren<QWidget*>();
00273 foreach ( QWidget *w , childList ) {
00274
00275 if(qobject_cast<QWidget *>(w->parent()) != widget) continue;
00276
00277 if ( !w->isVisibleTo( widget ) || (w->isTopLevel() && qobject_cast<QMenu*>(w) == NULL) )
00278 continue;
00279
00280 if ( KAcceleratorManagerPrivate::ignored_widgets.contains( w ) )
00281 continue;
00282
00283 manageWidget(w, item);
00284 }
00285 }
00286
00287 void KAcceleratorManagerPrivate::manageWidget(QWidget *w, Item *item)
00288 {
00289
00290
00291 QTabBar *tabBar = qobject_cast<QTabBar*>(w);
00292 if (tabBar)
00293 {
00294 manageTabBar(tabBar, item);
00295 return;
00296 }
00297
00298 QStackedWidget *wds = qobject_cast<QStackedWidget*>( w );
00299 if ( wds )
00300 {
00301 QWidgetStackAccelManager::manage( wds );
00302
00303 }
00304
00305 QDockWidget *dock = qobject_cast<QDockWidget*>( w );
00306 if ( dock )
00307 {
00308
00309 manageDockWidget(dock, item);
00310 }
00311
00312
00313 QMenu *popupMenu = qobject_cast<QMenu*>(w);
00314 if (popupMenu)
00315 {
00316
00317 KPopupAccelManager::manage(popupMenu);
00318 return;
00319 }
00320
00321 QStackedWidget *wdst = qobject_cast<QStackedWidget*>( w );
00322 if ( wdst )
00323 {
00324 QWidgetStackAccelManager::manage( wdst );
00325
00326 }
00327
00328 QMenuBar *menuBar = qobject_cast<QMenuBar*>(w);
00329 if (menuBar)
00330 {
00331 manageMenuBar(menuBar, item);
00332 return;
00333 }
00334
00335 if (qobject_cast<QComboBox*>(w) || qobject_cast<QLineEdit*>(w) ||
00336 w->inherits("Q3TextEdit") ||
00337 qobject_cast<QTextEdit*>(w) ||
00338 qobject_cast<QAbstractSpinBox*>(w) || w->inherits( "KMultiTabBar" ) )
00339 return;
00340
00341
00342 QLabel *label = qobject_cast<QLabel*>(w);
00343 if ( label ) {
00344 if ( !label->buddy() )
00345 return;
00346 else {
00347 if ( label->textFormat() == Qt::RichText ||
00348 ( label->textFormat() == Qt::AutoText &&
00349 Qt::mightBeRichText( label->text() ) ) )
00350 return;
00351 }
00352 }
00353
00354 if (w->focusPolicy() != Qt::NoFocus || label || qobject_cast<QGroupBox*>(w) || qobject_cast<QRadioButton*>( w ))
00355 {
00356 QString content;
00357 QVariant variant;
00358 int tprop = w->metaObject()->indexOfProperty("text");
00359 if (tprop != -1) {
00360 QMetaProperty p = w->metaObject()->property( tprop );
00361 if ( p.isValid() )
00362 variant = p.read (w);
00363 else
00364 tprop = -1;
00365 }
00366
00367 if (tprop == -1) {
00368 tprop = w->metaObject()->indexOfProperty("title");
00369 if (tprop != -1) {
00370 QMetaProperty p = w->metaObject()->property( tprop );
00371 if ( p.isValid() )
00372 variant = p.read (w);
00373 }
00374 }
00375
00376 if (variant.isValid())
00377 content = variant.toString();
00378
00379 if (!content.isEmpty())
00380 {
00381 Item *i = new Item;
00382 i->m_widget = w;
00383
00384
00385 int weight = KAccelManagerAlgorithm::DEFAULT_WEIGHT;
00386 if (qobject_cast<QPushButton*>(w) || qobject_cast<QCheckBox*>(w) || qobject_cast<QRadioButton*>(w) || qobject_cast<QLabel*>(w))
00387 weight = KAccelManagerAlgorithm::ACTION_ELEMENT_WEIGHT;
00388
00389
00390 if (qobject_cast<QGroupBox*>(w))
00391 weight = KAccelManagerAlgorithm::GROUP_BOX_WEIGHT;
00392 i->m_content = KAccelString(content, weight);
00393 item->addChild(i);
00394 }
00395 }
00396 traverseChildren(w, item);
00397 }
00398
00399 void KAcceleratorManagerPrivate::manageTabBar(QTabBar *bar, Item *item)
00400 {
00401
00402
00403
00404 QWidget* parentWidget = bar->parentWidget();
00405 if( parentWidget )
00406 {
00407 QMainWindow* mainWindow = qobject_cast<QMainWindow*>(parentWidget);
00408
00409 if( mainWindow )
00410 return;
00411 }
00412
00413 for (int i=0; i<bar->count(); i++)
00414 {
00415 QString content = bar->tabText(i);
00416 if (content.isEmpty())
00417 continue;
00418
00419 Item *it = new Item;
00420 item->addChild(it);
00421 it->m_widget = bar;
00422 it->m_index = i;
00423 it->m_content = KAccelString(content);
00424 }
00425 }
00426
00427 void KAcceleratorManagerPrivate::manageDockWidget(QDockWidget *dock, Item *item)
00428 {
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439 QString content = dock->windowTitle();
00440 if (content.isEmpty())
00441 return;
00442
00443 Item *it = new Item;
00444 item->addChild(it);
00445 it->m_widget = dock;
00446 it->m_content = KAccelString(content, KAccelManagerAlgorithm::STANDARD_ACCEL);
00447 }
00448
00449
00450 void KAcceleratorManagerPrivate::manageMenuBar(QMenuBar *mbar, Item *item)
00451 {
00452 QAction *maction;
00453 QString s;
00454
00455 for (int i=0; i<mbar->actions().count(); ++i)
00456 {
00457 maction = mbar->actions()[i];
00458 if (!maction)
00459 continue;
00460
00461
00462 if (maction->isSeparator())
00463 continue;
00464
00465 s = maction->text();
00466 if (!s.isEmpty())
00467 {
00468 Item *it = new Item;
00469 item->addChild(it);
00470 it->m_content =
00471 KAccelString(s,
00472
00473 KAccelManagerAlgorithm::MENU_TITLE_WEIGHT);
00474
00475 it->m_widget = mbar;
00476 it->m_index = i;
00477 }
00478
00479
00480 if (maction->menu())
00481 KPopupAccelManager::manage(maction->menu());
00482 }
00483 }
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494 void KAcceleratorManager::manage(QWidget *widget, bool programmers_mode)
00495 {
00496 KAcceleratorManagerPrivate::changed_string.clear();
00497 KAcceleratorManagerPrivate::added_string.clear();
00498 KAcceleratorManagerPrivate::removed_string.clear();
00499 KAcceleratorManagerPrivate::programmers_mode = programmers_mode;
00500 KAcceleratorManagerPrivate::manage(widget);
00501 }
00502
00503 void KAcceleratorManager::last_manage(QString &added, QString &changed, QString &removed)
00504 {
00505 added = KAcceleratorManagerPrivate::added_string;
00506 changed = KAcceleratorManagerPrivate::changed_string;
00507 removed = KAcceleratorManagerPrivate::removed_string;
00508 }
00509
00510
00511
00512
00513
00514
00515
00516
00517 KAccelString::KAccelString(const QString &input, int initialWeight)
00518 : m_pureText(input), m_weight()
00519 {
00520 m_orig_accel = m_pureText.indexOf("(!)&");
00521 if (m_orig_accel != -1)
00522 m_pureText.remove(m_orig_accel, 4);
00523
00524 m_orig_accel = m_pureText.indexOf("(&&)");
00525 if (m_orig_accel != -1)
00526 m_pureText.replace(m_orig_accel, 4, "&");
00527
00528 m_origText = m_pureText;
00529
00530 if (m_pureText.contains('\t'))
00531 m_pureText = m_pureText.left(m_pureText.indexOf('\t'));
00532
00533 m_orig_accel = m_accel = stripAccelerator(m_pureText);
00534
00535 if (initialWeight == -1)
00536 initialWeight = KAccelManagerAlgorithm::DEFAULT_WEIGHT;
00537
00538 calculateWeights(initialWeight);
00539
00540
00541 }
00542
00543
00544 QString KAccelString::accelerated() const
00545 {
00546 QString result = m_origText;
00547 if (result.isEmpty())
00548 return result;
00549
00550 if (KAcceleratorManagerPrivate::programmers_mode)
00551 {
00552 if (m_accel != m_orig_accel) {
00553 int oa = m_orig_accel;
00554
00555 if (m_accel >= 0) {
00556 result.insert(m_accel, "(!)&");
00557 if (m_accel < m_orig_accel)
00558 oa += 4;
00559 }
00560 if (m_orig_accel >= 0)
00561 result.replace(oa, 1, "(&&)");
00562 }
00563 } else {
00564 if (m_accel >= 0 && m_orig_accel != m_accel) {
00565 if (m_orig_accel != -1)
00566 result.remove(m_orig_accel, 1);
00567 result.insert(m_accel, "&");
00568 }
00569 }
00570 return result;
00571 }
00572
00573
00574 QChar KAccelString::accelerator() const
00575 {
00576 if ((m_accel < 0) || (m_accel > (int)m_pureText.length()))
00577 return QChar();
00578
00579 return m_pureText[m_accel].toLower();
00580 }
00581
00582
00583 void KAccelString::calculateWeights(int initialWeight)
00584 {
00585 m_weight.resize(m_pureText.length());
00586
00587 int pos = 0;
00588 bool start_character = true;
00589
00590 while (pos<m_pureText.length())
00591 {
00592 QChar c = m_pureText[pos];
00593
00594 int weight = initialWeight+1;
00595
00596
00597 if (pos == 0)
00598 weight += KAccelManagerAlgorithm::FIRST_CHARACTER_EXTRA_WEIGHT;
00599
00600
00601 if (start_character)
00602 {
00603 weight += KAccelManagerAlgorithm::WORD_BEGINNING_EXTRA_WEIGHT;
00604 start_character = false;
00605 }
00606
00607
00608 if (pos < 50)
00609 weight += (50-pos);
00610
00611
00612 if ((int)pos == accel()) {
00613 weight += KAccelManagerAlgorithm::WANTED_ACCEL_EXTRA_WEIGHT;
00614
00615 if (KAcceleratorManagerPrivate::standardName(m_origText)) {
00616 weight += KAccelManagerAlgorithm::STANDARD_ACCEL;
00617 }
00618 }
00619
00620
00621 if (!c.isLetterOrNumber())
00622 {
00623 weight = 0;
00624 start_character = true;
00625 }
00626
00627 m_weight[pos] = weight;
00628
00629 ++pos;
00630 }
00631 }
00632
00633
00634 int KAccelString::stripAccelerator(QString &text)
00635 {
00636
00637 int p = 0;
00638
00639 while (p >= 0)
00640 {
00641 p = text.indexOf('&', p)+1;
00642
00643 if (p <= 0 || p >= (int)text.length())
00644 return -1;
00645
00646 if (text[p] != '&')
00647 {
00648 QChar c = text[p];
00649 if (c.isPrint())
00650 {
00651 text.remove(p-1,1);
00652 return p-1;
00653 }
00654 }
00655
00656 p++;
00657 }
00658
00659 return -1;
00660 }
00661
00662
00663 int KAccelString::maxWeight(int &index, const QString &used) const
00664 {
00665 int max = 0;
00666 index = -1;
00667
00668 for (int pos=0; pos<m_pureText.length(); ++pos)
00669 if (used.indexOf(m_pureText[pos], 0, Qt::CaseInsensitive) == -1 && m_pureText[pos].toLatin1() != 0)
00670 if (m_weight[pos] > max)
00671 {
00672 max = m_weight[pos];
00673 index = pos;
00674 }
00675
00676 return max;
00677 }
00678
00679
00680 void KAccelString::dump()
00681 {
00682 QString s;
00683 for (int i=0; i<m_weight.count(); ++i)
00684 s += QString("%1(%2) ").arg(pure()[i]).arg(m_weight[i]);
00685 kDebug() << "s " << s;
00686 }
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722 void KAccelManagerAlgorithm::findAccelerators(KAccelStringList &result, QString &used)
00723 {
00724 KAccelStringList accel_strings = result;
00725
00726
00727 for (KAccelStringList::Iterator it = result.begin(); it != result.end(); ++it) {
00728 (*it).setAccel(-1);
00729 }
00730
00731
00732 for (int cnt=0; cnt<accel_strings.count(); ++cnt)
00733 {
00734 int max = 0, index = -1, accel = -1;
00735
00736
00737 for (int i=0; i<accel_strings.count(); ++i)
00738 {
00739 int a;
00740 int m = accel_strings[i].maxWeight(a, used);
00741 if (m>max)
00742 {
00743 max = m;
00744 index = i;
00745 accel = a;
00746 }
00747 }
00748
00749
00750 if (index < 0)
00751 return;
00752
00753
00754 if (accel >= 0)
00755 {
00756 result[index].setAccel(accel);
00757 used.append(result[index].accelerator());
00758 }
00759
00760
00761 accel_strings[index] = KAccelString();
00762 }
00763 }
00764
00765
00766
00767
00768
00769
00770
00771
00772 KPopupAccelManager::KPopupAccelManager(QMenu *popup)
00773 : QObject(popup), m_popup(popup), m_count(-1)
00774 {
00775 aboutToShow();
00776 connect(popup, SIGNAL(aboutToShow()), SLOT(aboutToShow()));
00777 }
00778
00779
00780 void KPopupAccelManager::aboutToShow()
00781 {
00782
00783
00784
00785
00786
00787 if (m_count != (int)m_popup->actions().count())
00788 {
00789 findMenuEntries(m_entries);
00790 calculateAccelerators();
00791 m_count = m_popup->actions().count();
00792 }
00793 else
00794 {
00795 KAccelStringList entries;
00796 findMenuEntries(entries);
00797 if (entries != m_entries)
00798 {
00799 m_entries = entries;
00800 calculateAccelerators();
00801 }
00802 }
00803 }
00804
00805
00806 void KPopupAccelManager::calculateAccelerators()
00807 {
00808
00809 QString used;
00810 KAccelManagerAlgorithm::findAccelerators(m_entries, used);
00811
00812
00813 setMenuEntries(m_entries);
00814 }
00815
00816
00817 void KPopupAccelManager::findMenuEntries(KAccelStringList &list)
00818 {
00819 QString s;
00820
00821 list.clear();
00822
00823
00824 foreach (QAction *maction, m_popup->actions())
00825 {
00826 if (maction->isSeparator())
00827 continue;
00828
00829 s = maction->text();
00830
00831
00832 int weight = 50;
00833 if (s.contains('\t'))
00834 weight = 0;
00835
00836 list.append(KAccelString(s, weight));
00837
00838
00839 if (maction->menu())
00840 KPopupAccelManager::manage(maction->menu());
00841 }
00842 }
00843
00844
00845 void KPopupAccelManager::setMenuEntries(const KAccelStringList &list)
00846 {
00847 uint cnt = 0;
00848 foreach (QAction *maction, m_popup->actions())
00849 {
00850 if (maction->isSeparator())
00851 continue;
00852
00853 if (KAcceleratorManagerPrivate::checkChange(list[cnt]))
00854 maction->setText(list[cnt].accelerated());
00855 cnt++;
00856 }
00857 }
00858
00859
00860 void KPopupAccelManager::manage(QMenu *popup)
00861 {
00862
00863 if (popup->findChild<KPopupAccelManager*>(QString()) == 0 )
00864 new KPopupAccelManager(popup);
00865 }
00866
00867 void QWidgetStackAccelManager::manage( QStackedWidget *stack )
00868 {
00869 if ( stack->findChild<QWidgetStackAccelManager*>(QString()) == 0 )
00870 new QWidgetStackAccelManager( stack );
00871 }
00872
00873 QWidgetStackAccelManager::QWidgetStackAccelManager(QStackedWidget *stack)
00874 : QObject(stack), m_stack(stack)
00875 {
00876 currentChanged(stack->currentIndex());
00877 connect(stack, SIGNAL(currentChanged(int)), SLOT(currentChanged(int)));
00878 }
00879
00880 bool QWidgetStackAccelManager::eventFilter ( QObject * watched, QEvent * e )
00881 {
00882 if ( e->type() == QEvent::Show && qApp->activeWindow() ) {
00883 KAcceleratorManager::manage( qApp->activeWindow() );
00884 watched->removeEventFilter( this );
00885 }
00886 return false;
00887 }
00888
00889 void QWidgetStackAccelManager::currentChanged(int child)
00890 {
00891 if (child < 0 || child >= static_cast<QStackedWidget*>(parent())->count())
00892 {
00893 kDebug(131) << "invalid index provided";
00894 return;
00895 }
00896
00897 static_cast<QStackedWidget*>(parent())->widget(child)->installEventFilter( this );
00898 }
00899
00900 void KAcceleratorManager::setNoAccel( QWidget *widget )
00901 {
00902 KAcceleratorManagerPrivate::ignored_widgets[widget] = 1;
00903 }
00904
00905 #include "kacceleratormanager_private.moc"