diff options
Diffstat (limited to 'lib/kofficecore/kkbdaccessextensions.cpp')
| -rw-r--r-- | lib/kofficecore/kkbdaccessextensions.cpp | 276 |
1 files changed, 138 insertions, 138 deletions
diff --git a/lib/kofficecore/kkbdaccessextensions.cpp b/lib/kofficecore/kkbdaccessextensions.cpp index aae372039..39f959487 100644 --- a/lib/kofficecore/kkbdaccessextensions.cpp +++ b/lib/kofficecore/kkbdaccessextensions.cpp @@ -17,16 +17,16 @@ Boston, MA 02110-1301, USA. */ -// Qt includes -#include <qsplitter.h> -#include <qdockwindow.h> -#include <qdockarea.h> -#include <qevent.h> -#include <qcursor.h> -#include <qobjectlist.h> -#include <qwidgetlist.h> -#include <qlabel.h> -#include <qtooltip.h> +// TQt includes +#include <tqsplitter.h> +#include <tqdockwindow.h> +#include <tqdockarea.h> +#include <tqevent.h> +#include <tqcursor.h> +#include <tqobjectlist.h> +#include <tqwidgetlist.h> +#include <tqlabel.h> +#include <tqtooltip.h> // KDE includes #include <klocale.h> @@ -41,14 +41,14 @@ // TODO: See eventFilter method. //#include "kkbdaccessextensions.moc" -class KPanelKbdSizerIcon : public QCursor +class KPanelKbdSizerIcon : public TQCursor { public: KPanelKbdSizerIcon() : - QCursor(Qt::SizeAllCursor), + TQCursor(TQt::SizeAllCursor), isActive(false) { - currentPos = QPoint(-1, -1); + currentPos = TQPoint(-1, -1); } ~KPanelKbdSizerIcon() @@ -56,9 +56,9 @@ class KPanelKbdSizerIcon : public QCursor hide(); } - void show(const QPoint p) { + void show(const TQPoint p) { if (!isActive) { - originalPos = QCursor::pos(); + originalPos = TQCursor::pos(); kapp->setOverrideCursor(*this); isActive = true; } @@ -70,40 +70,40 @@ class KPanelKbdSizerIcon : public QCursor void hide() { if (isActive) { kapp->restoreOverrideCursor(); - QCursor::setPos(originalPos); + TQCursor::setPos(originalPos); } isActive = false; } void setShape(int shayp) { - if (shayp != shape()) { + if (shayp != tqshape()) { // Must restore and override to get the icon to refresh. if (isActive) kapp->restoreOverrideCursor(); - QCursor::setShape(shayp); + TQCursor::setShape((Qt::CursorShape)shayp); if (isActive) kapp->setOverrideCursor(*this); } } // Return the difference between a position and where icon is supposed to be. - QSize delta(const QPoint p) + TQSize delta(const TQPoint p) { - QPoint d = p - currentPos; - return QSize(d.x(), d.y()); + TQPoint d = p - currentPos; + return TQSize(d.x(), d.y()); } // Return the difference between where the icon is currently positioned and where // it is supposed to be. - QSize delta() { return delta(pos()); } + TQSize delta() { return delta(pos()); } // True if the sizing icon is visible. bool isActive; private: // Icon's current position. - QPoint currentPos; + TQPoint currentPos; // Mouse cursor's original position when icon is shown. - QPoint originalPos; + TQPoint originalPos; }; class KKbdAccessExtensionsPrivate @@ -137,9 +137,9 @@ class KKbdAccessExtensionsPrivate KAction* accessKeysAction; // The splitter or dockwindow currently being sized. If 0, sizing is not in progress. - QWidget* panel; + TQWidget* panel; - // Index of current handle of the panel. When panel is a QDockWindow: + // Index of current handle of the panel. When panel is a TQDockWindow: // 1 = size horizontally // 2 = size vertically uint handleNdx; @@ -150,25 +150,25 @@ class KKbdAccessExtensionsPrivate // Sizing increment. int stepSize; - // List of the access key QLabels. If not 0, access keys are onscreen. - QPtrList<QLabel>* accessKeyLabels; + // List of the access key TQLabels. If not 0, access keys are onscreen. + TQPtrList<TQLabel>* accessKeyLabels; // Pointer to the KMainWindow. KMainWindow* mainWindow; }; -KKbdAccessExtensions::KKbdAccessExtensions(KMainWindow* parent, const char* name) : - QObject(parent, name) +KKbdAccessExtensions::KKbdAccessExtensions(KMainWindow* tqparent, const char* name) : + TQObject(tqparent, name) { // kdDebug() << "KKbdAccessExtensions::KKbdAccessExtensions: running." << endl; d = new KKbdAccessExtensionsPrivate; - d->mainWindow = parent; + d->mainWindow = tqparent; d->fwdAction = new KAction(i18n("Resize Panel Forward"), KShortcut("F8"), - 0, 0, parent->actionCollection(), "resize_panel_forward"); + 0, 0, tqparent->actionCollection(), "resize_panel_forward"); d->revAction = new KAction(i18n("Resize Panel Reverse"), KShortcut("Shift+F8"), - 0, 0, parent->actionCollection(), "resize_panel_reverse"); + 0, 0, tqparent->actionCollection(), "resize_panel_reverse"); d->accessKeysAction = new KAction(i18n("Access Keys"), KShortcut("Alt+F8"), - 0, 0, parent->actionCollection(), "access_keys"); + 0, 0, tqparent->actionCollection(), "access_keys"); // "Disable" the shortcuts so we can see them in eventFilter. d->fwdAction->setEnabled(false); d->revAction->setEnabled(false); @@ -188,18 +188,18 @@ int KKbdAccessExtensions::stepSize() const { return d->stepSize; } void KKbdAccessExtensions::setStepSize(int s) { d->stepSize = s; } -bool KKbdAccessExtensions::eventFilter( QObject *o, QEvent *e ) +bool KKbdAccessExtensions::eventFilter( TQObject *o, TQEvent *e ) { - if ( e->type() == QEvent::KeyPress ) { + if ( e->type() == TQEvent::KeyPress ) { // TODO: This permits only a single-key shortcut. For example, Alt+S,R would not work. // If user configures a multi-key shortcut, it is undefined what will happen here. // It would be better to handle these as KShortcut activate() signals, but the problem - // is that once a QDockWindow is undocked and has focus, the KShortcut activate() signals + // is that once a TQDockWindow is undocked and has focus, the KShortcut activate() signals // don't fire anymore. KShortcut fwdSc = d->fwdAction->shortcut(); KShortcut revSc = d->revAction->shortcut(); KShortcut accessKeysSc = d->accessKeysAction->shortcut(); - QKeyEvent* kev = dynamic_cast<QKeyEvent *>(e); + TQKeyEvent* kev = dynamic_cast<TQKeyEvent *>(e); KKey k = KKey(kev); KShortcut sc = KShortcut(k); // kdDebug() << "KKbdAccessExtensions::eventFilter: Key press " << sc << endl; @@ -239,25 +239,25 @@ bool KKbdAccessExtensions::eventFilter( QObject *o, QEvent *e ) } return false; } - else if (d->icon->isActive && e->type() == QEvent::MouseButtonPress) { + else if (d->icon->isActive && e->type() == TQEvent::MouseButtonPress) { exitSizing(); return true; } - else if (d->accessKeyLabels && e->type() == QEvent::MouseButtonPress) { + else if (d->accessKeyLabels && e->type() == TQEvent::MouseButtonPress) { delete d->accessKeyLabels; d->accessKeyLabels = 0; return true; } -/* else if (e->type() == QEvent::MouseMove && d->icon->isActive) { +/* else if (e->type() == TQEvent::MouseMove && d->icon->isActive) { // Lock mouse cursor down. showIcon(); - dynamic_cast<QMouseEvent *>(e)->accept(); + dynamic_cast<TQMouseEvent *>(e)->accept(); return true; }*/ - else if (e->type() == QEvent::MouseMove && d->icon->isActive && d->panel) { + else if (e->type() == TQEvent::MouseMove && d->icon->isActive && d->panel) { // Resize according to mouse movement. - QMouseEvent* me = dynamic_cast<QMouseEvent *>(e); - QSize s = d->icon->delta(); + TQMouseEvent* me = dynamic_cast<TQMouseEvent *>(e); + TQSize s = d->icon->delta(); int dx = s.width(); int dy = s.height(); resizePanel(dx, dy, me->state()); @@ -265,27 +265,27 @@ bool KKbdAccessExtensions::eventFilter( QObject *o, QEvent *e ) showIcon(); return true; } - else if (e->type() == QEvent::Resize && d->panel && o == d->panel) { + else if (e->type() == TQEvent::Resize && d->panel && TQT_BASE_OBJECT(o) == d->panel) { // TODO: This doesn't always work. showIcon(); } return false; } -QWidgetList* KKbdAccessExtensions::getAllPanels() +TQWidgetList* KKbdAccessExtensions::getAllPanels() { - QWidgetList* allWidgets = kapp->allWidgets(); - QWidgetList* allPanels = new QWidgetList; - QWidget* widget = allWidgets->first(); + TQWidgetList* allWidgets = kapp->tqallWidgets(); + TQWidgetList* allPanels = new TQWidgetList; + TQWidget* widget = allWidgets->first(); while (widget) { if (widget->isVisible()) { - if (::qt_cast<QSplitter*>( widget )) { - // Only size QSplitters with at least two handles (there is always one hidden). - if (dynamic_cast<QSplitter *>(widget)->sizes().count() >= 2) + if (::tqqt_cast<TQSplitter*>( widget )) { + // Only size TQSplitters with at least two handles (there is always one hidden). + if (dynamic_cast<TQSplitter *>(widget)->sizes().count() >= 2) allPanels->append(widget); - } else if (::qt_cast<QDockWindow*>( widget )) { - if (dynamic_cast<QDockWindow *>(widget)->isResizeEnabled()) { - // kdDebug() << "KKbdAccessExtensions::getAllPanels: QDockWindow = " << widget->name() << endl; + } else if (::tqqt_cast<TQDockWindow*>( widget )) { + if (dynamic_cast<TQDockWindow *>(widget)->isResizeEnabled()) { + // kdDebug() << "KKbdAccessExtensions::getAllPanels: TQDockWindow = " << widget->name() << endl; allPanels->append(widget); } } @@ -298,19 +298,19 @@ QWidgetList* KKbdAccessExtensions::getAllPanels() void KKbdAccessExtensions::nextHandle() { - QWidget* panel = d->panel; + TQWidget* panel = d->panel; // See if current panel has another handle. If not, find next panel. if (panel) { bool advance = true; d->handleNdx++; - if (::qt_cast<QSplitter*>( panel )) - advance = (d->handleNdx >= dynamic_cast<QSplitter *>(panel)->sizes().count()); + if (::tqqt_cast<TQSplitter*>( panel )) + advance = (d->handleNdx >= dynamic_cast<TQSplitter *>(panel)->sizes().count()); else // Undocked windows have only one "handle" (center). - advance = (d->handleNdx > 2 || !dynamic_cast<QDockWindow *>(panel)->area()); + advance = (d->handleNdx > 2 || !dynamic_cast<TQDockWindow *>(panel)->area()); if (advance) { - QWidgetList* allWidgets = getAllPanels(); - allWidgets->findRef(panel); + TQWidgetList* allWidgets = getAllPanels(); + allWidgets->tqfindRef(panel); panel = 0; if (allWidgets->current()) panel = allWidgets->next(); delete allWidgets; @@ -318,7 +318,7 @@ void KKbdAccessExtensions::nextHandle() } } else { // Find first panel. - QWidgetList* allWidgets = getAllPanels(); + TQWidgetList* allWidgets = getAllPanels(); panel = allWidgets->first(); delete allWidgets; d->handleNdx = 1; @@ -332,23 +332,23 @@ void KKbdAccessExtensions::nextHandle() void KKbdAccessExtensions::prevHandle() { - QWidget* panel = d->panel; + TQWidget* panel = d->panel; // See if current panel has another handle. If not, find previous panel. if (panel) { bool rewind = true; d->handleNdx--; rewind = (d->handleNdx < 1); if (rewind) { - QWidgetList* allWidgets = getAllPanels(); - allWidgets->findRef(panel); + TQWidgetList* allWidgets = getAllPanels(); + allWidgets->tqfindRef(panel); panel = 0; if (allWidgets->current()) panel = allWidgets->prev(); delete allWidgets; if (panel) { - if (::qt_cast<QSplitter*>( panel )) - d->handleNdx = dynamic_cast<QSplitter *>(panel)->sizes().count() - 1; + if (::tqqt_cast<TQSplitter*>( panel )) + d->handleNdx = dynamic_cast<TQSplitter *>(panel)->sizes().count() - 1; else { - if (dynamic_cast<QDockWindow *>(panel)->area()) + if (dynamic_cast<TQDockWindow *>(panel)->area()) d->handleNdx = 2; else d->handleNdx = 1; @@ -357,14 +357,14 @@ void KKbdAccessExtensions::prevHandle() } } else { // Find last panel. - QWidgetList* allWidgets = getAllPanels(); + TQWidgetList* allWidgets = getAllPanels(); panel = allWidgets->last(); delete allWidgets; if (panel) { - if (::qt_cast<QSplitter*>( panel )) - d->handleNdx = dynamic_cast<QSplitter *>(panel)->sizes().count() - 1; + if (::tqqt_cast<TQSplitter*>( panel )) + d->handleNdx = dynamic_cast<TQSplitter *>(panel)->sizes().count() - 1; else { - if (dynamic_cast<QDockWindow *>(panel)->area()) + if (dynamic_cast<TQDockWindow *>(panel)->area()) d->handleNdx = 2; else d->handleNdx = 1; @@ -389,19 +389,19 @@ void KKbdAccessExtensions::exitSizing() void KKbdAccessExtensions::showIcon() { if (!d->panel) return; - QPoint p; - // kdDebug() << "KKbdAccessExtensions::showIcon: topLevelWidget = " << d->panel->topLevelWidget()->name() << endl; - if (::qt_cast<QSplitter*>( d->panel )) { - QSplitter* splitter = dynamic_cast<QSplitter *>(d->panel); + TQPoint p; + // kdDebug() << "KKbdAccessExtensions::showIcon: tqtopLevelWidget = " << d->panel->tqtopLevelWidget()->name() << endl; + if (::tqqt_cast<TQSplitter*>( d->panel )) { + TQSplitter* splitter = dynamic_cast<TQSplitter *>(d->panel); int handleNdx = d->handleNdx - 1; - QValueList<int> sizes = splitter->sizes(); + TQValueList<int> sizes = splitter->sizes(); // kdDebug() << "KKbdAccessExtensions::showIcon: sizes = " << sizes << endl; if (splitter->orientation() == Qt::Horizontal) { - d->icon->setShape(Qt::SizeHorCursor); + d->icon->setShape(TQt::SizeHorCursor); p.setX(sizes[handleNdx] + (splitter->handleWidth() / 2)); p.setY(splitter->height() / 2); } else { - d->icon->setShape(Qt::SizeVerCursor); + d->icon->setShape(TQt::SizeVerCursor); p.setX(splitter->width() / 2); p.setY(sizes[handleNdx] + (splitter->handleWidth() / 2)); } @@ -409,17 +409,17 @@ void KKbdAccessExtensions::showIcon() p = splitter->mapToGlobal(p); // kdDebug() << "KKbdAccessExtensions::showIcon: mapToGlobal = " << p << endl; } else { - QDockWindow* dockWindow = dynamic_cast<QDockWindow *>(d->panel); + TQDockWindow* dockWindow = dynamic_cast<TQDockWindow *>(d->panel); p = dockWindow->pos(); if (dockWindow->area()) { - // kdDebug() << "KKbdAccessExtensions::showIcon: pos = " << p << " of window = " << dockWindow->parentWidget()->name() << endl; - p = dockWindow->parentWidget()->mapTo(dockWindow->topLevelWidget(), p); - // kdDebug() << "KKbdAccessExtensions::showIcon: mapTo = " << p << " of window = " << dockWindow->topLevelWidget()->name() << endl; + // kdDebug() << "KKbdAccessExtensions::showIcon: pos = " << p << " of window = " << dockWindow->tqparentWidget()->name() << endl; + p = dockWindow->tqparentWidget()->mapTo(dockWindow->tqtopLevelWidget(), p); + // kdDebug() << "KKbdAccessExtensions::showIcon: mapTo = " << p << " of window = " << dockWindow->tqtopLevelWidget()->name() << endl; // TODO: How to get the handle width? if (d->handleNdx == 1) { - d->icon->setShape(Qt::SizeHorCursor); + d->icon->setShape(TQt::SizeHorCursor); if (dockWindow->area()->orientation() == Qt::Vertical) { - if (dockWindow->area()->handlePosition() == QDockArea::Normal) + if (dockWindow->area()->handlePosition() == TQDockArea::Normal) // Handle is to the right of the dock window. p.setX(p.x() + dockWindow->width()); // else Handle is to the left of the dock window. @@ -428,22 +428,22 @@ void KKbdAccessExtensions::showIcon() p.setX(p.x() + dockWindow->width()); p.setY(p.y() + (dockWindow->height() / 2)); } else { - d->icon->setShape(Qt::SizeVerCursor); + d->icon->setShape(TQt::SizeVerCursor); p.setX(p.x() + (dockWindow->width() / 2)); if (dockWindow->area()->orientation() == Qt::Vertical) // Handle is below the dock window. p.setY(p.y() + dockWindow->height()); else { - if (dockWindow->area()->handlePosition() == QDockArea::Normal) + if (dockWindow->area()->handlePosition() == TQDockArea::Normal) // Handle is below the dock window. p.setY(p.y() + dockWindow->height()); // else Handle is above the dock window. } } - p = dockWindow->topLevelWidget()->mapToGlobal(p); + p = dockWindow->tqtopLevelWidget()->mapToGlobal(p); } else { - d->icon->setShape(Qt::SizeAllCursor); - p = QPoint(dockWindow->width() / 2, dockWindow->height() / 2); + d->icon->setShape(TQt::SizeAllCursor); + p = TQPoint(dockWindow->width() / 2, dockWindow->height() / 2); p = dockWindow->mapToGlobal(p); // Undocked. Position in center of window. } } @@ -461,26 +461,26 @@ void KKbdAccessExtensions::resizePanel(int dx, int dy, int state) int adj = dx + dy; if (adj == 0) return; // kdDebug() << "KKbdAccessExtensions::resizePanel: panel = " << d->panel->name() << endl; - if (::qt_cast<QSplitter*>( d->panel )) { - QSplitter* splitter = dynamic_cast<QSplitter *>(d->panel); + if (::tqqt_cast<TQSplitter*>( d->panel )) { + TQSplitter* splitter = dynamic_cast<TQSplitter *>(d->panel); int handleNdx = d->handleNdx - 1; - QValueList<int> sizes = splitter->sizes(); + TQValueList<int> sizes = splitter->sizes(); // kdDebug() << "KKbdAccessExtensions::resizePanel: before sizes = " << sizes << endl; sizes[handleNdx] = sizes[handleNdx] + adj; // kdDebug() << "KKbdAccessExtensions::resizePanel: setSizes = " << sizes << endl; splitter->setSizes(sizes); - QApplication::postEvent(splitter, new QEvent(QEvent::LayoutHint)); + TQApplication::postEvent(splitter, new TQEvent(TQEvent::LayoutHint)); } else { // TODO: How to get the handle width? - QDockWindow* dockWindow = dynamic_cast<QDockWindow *>(d->panel); + TQDockWindow* dockWindow = dynamic_cast<TQDockWindow *>(d->panel); if (dockWindow->area()) { // kdDebug() << "KKbdAccessExtensions::resizePanel: fixedExtent = " << dockWindow->fixedExtent() << endl; - QSize fe = dockWindow->fixedExtent(); + TQSize fe = dockWindow->fixedExtent(); if (d->handleNdx == 1) { // When vertically oriented and dock area is on right side of screen, pressing // left arrow increases size. if (dockWindow->area()->orientation() == Qt::Vertical && - dockWindow->area()->handlePosition() == QDockArea::Reverse) adj = -adj; + dockWindow->area()->handlePosition() == TQDockArea::Reverse) adj = -adj; int w = fe.width(); if (w < 0) w = dockWindow->width(); w = w + adj; @@ -489,23 +489,23 @@ void KKbdAccessExtensions::resizePanel(int dx, int dy, int state) // When horizontally oriented and dock area is at bottom of screen, // pressing up arrow increases size. if (dockWindow->area()->orientation() == Qt::Horizontal && - dockWindow->area()->handlePosition() == QDockArea::Reverse) adj = -adj; + dockWindow->area()->handlePosition() == TQDockArea::Reverse) adj = -adj; int h = fe.height(); if (h < 0) h = dockWindow->height(); h = h + adj; if (h > 0) dockWindow->setFixedExtentHeight(h); } dockWindow->updateGeometry(); - QApplication::postEvent(dockWindow->area(), new QEvent(QEvent::LayoutHint)); + TQApplication::postEvent(dockWindow->area(), new TQEvent(TQEvent::LayoutHint)); // kdDebug() << "KKbdAccessExtensions::resizePanel: fixedExtent = " << dockWindow->fixedExtent() << endl; } else { - if (state == Qt::ShiftButton) { - QSize s = dockWindow->size(); + if (state == TQt::ShiftButton) { + TQSize s = dockWindow->size(); s.setWidth(s.width() + dx); s.setHeight(s.height() + dy); dockWindow->resize(s); } else { - QPoint p = dockWindow->pos(); + TQPoint p = dockWindow->pos(); p.setX(p.x() + dx); p.setY(p.y() + dy); dockWindow->move(p); @@ -522,20 +522,20 @@ void KKbdAccessExtensions::resizePanelFromKey(int key, int state) int dy = 0; int stepSize = d->stepSize; switch (key) { - case Qt::Key_Left: dx = -stepSize; break; - case Qt::Key_Right: dx = stepSize; break; - case Qt::Key_Up: dy = -stepSize; break; - case Qt::Key_Down: dy = stepSize; break; - case Qt::Key_Prior: dy = -5 * stepSize; break; - case Qt::Key_Next: dy = 5 * stepSize; break; + case TQt::Key_Left: dx = -stepSize; break; + case TQt::Key_Right: dx = stepSize; break; + case TQt::Key_Up: dy = -stepSize; break; + case TQt::Key_Down: dy = stepSize; break; + case TQt::Key_Prior: dy = -5 * stepSize; break; + case TQt::Key_Next: dy = 5 * stepSize; break; } int adj = dx + dy; // kdDebug() << "KKbdAccessExtensions::resizePanelFromKey: adj = " << adj << endl; if (adj != 0) resizePanel(dx, dy, state); else { - if (key == Qt::Key_Enter && ::qt_cast<QDockWindow*>( d->panel )) { - QDockWindow* dockWindow = dynamic_cast<QDockWindow *>(d->panel); + if (key == TQt::Key_Enter && ::tqqt_cast<TQDockWindow*>( d->panel )) { + TQDockWindow* dockWindow = dynamic_cast<TQDockWindow *>(d->panel); if (dockWindow->area()) dockWindow->undock(); else @@ -548,9 +548,9 @@ void KKbdAccessExtensions::resizePanelFromKey(int key, int state) void KKbdAccessExtensions::displayAccessKeys() { // Build a list of valid access keys that don't collide with shortcuts. - QString availableAccessKeys = "ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890"; - QPtrList<KXMLGUIClient> allClients = d->mainWindow->factory()->clients(); - QPtrListIterator<KXMLGUIClient> it( allClients ); + TQString availableAccessKeys = "ABCDEFGHIJKLMNOPTQRSTUVWXYZ01234567890"; + TQPtrList<KXMLGUIClient> allClients = d->mainWindow->factory()->clients(); + TQPtrListIterator<KXMLGUIClient> it( allClients ); KXMLGUIClient *client; while( (client=it.current()) !=0 ) { @@ -562,39 +562,39 @@ void KKbdAccessExtensions::displayAccessKeys() for (int i = 0; i < (int)sc.count(); i++) { KKeySequence seq = sc.seq(i); if (seq.count() == 1) { - QString s = seq.toString(); - if (availableAccessKeys.contains(s)) + TQString s = seq.toString(); + if (availableAccessKeys.tqcontains(s)) availableAccessKeys.remove(s); } } } } - // Find all visible, focusable widgets and create a QLabel for each. Don't exceed + // Find all visible, focusable widgets and create a TQLabel for each. Don't exceed // available list of access keys. - QWidgetList* allWidgets = kapp->allWidgets(); - QWidget* widget = allWidgets->first(); + TQWidgetList* allWidgets = kapp->tqallWidgets(); + TQWidget* widget = allWidgets->first(); int accessCount = 0; int maxAccessCount = availableAccessKeys.length(); int overlap = 20; - QPoint prevGlobalPos = QPoint(-overlap, -overlap); + TQPoint prevGlobalPos = TQPoint(-overlap, -overlap); while (widget && (accessCount < maxAccessCount)) { if (widget->isVisible() && widget->isFocusEnabled() ) { - QRect r = widget->rect(); - QPoint p(r.x(), r.y()); + TQRect r = widget->rect(); + TQPoint p(r.x(), r.y()); // Don't display an access key if within overlap pixels of previous one. - QPoint globalPos = widget->mapToGlobal(p); - QPoint diffPos = globalPos - prevGlobalPos; + TQPoint globalPos = widget->mapToGlobal(p); + TQPoint diffPos = globalPos - prevGlobalPos; if (diffPos.manhattanLength() > overlap) { accessCount++; - QLabel* lab=new QLabel(widget, "", widget, 0, Qt::WDestructiveClose); - lab->setPalette(QToolTip::palette()); + TQLabel* lab=new TQLabel(widget, "", widget, 0, TQt::WDestructiveClose); + lab->setPalette(TQToolTip::palette()); lab->setLineWidth(2); - lab->setFrameStyle(QFrame::Box | QFrame::Plain); + lab->setFrameStyle(TQFrame::Box | TQFrame::Plain); lab->setMargin(3); lab->adjustSize(); lab->move(p); if (!d->accessKeyLabels) { - d->accessKeyLabels = new QPtrList<QLabel>; + d->accessKeyLabels = new TQPtrList<TQLabel>; d->accessKeyLabels->setAutoDelete(true); } d->accessKeyLabels->append(lab); @@ -605,14 +605,14 @@ void KKbdAccessExtensions::displayAccessKeys() } if (accessCount > 0) { // Sort the access keys from left to right and down the screen. - QValueList<KSortedLabel> sortedLabels; + TQValueList<KSortedLabel> sortedLabels; for (int i = 0; i < accessCount; i++) sortedLabels.append(KSortedLabel(d->accessKeyLabels->at(i))); qHeapSort( sortedLabels ); // Assign access key labels. for (int i = 0; i < accessCount; i++) { - QLabel* lab = sortedLabels[i].label(); - QChar s = availableAccessKeys[i]; + TQLabel* lab = sortedLabels[i].label(); + TQChar s = availableAccessKeys[i]; lab->setText(s); lab->adjustSize(); lab->show(); @@ -621,12 +621,12 @@ void KKbdAccessExtensions::displayAccessKeys() } // Handling of the HTML accesskey attribute. -bool KKbdAccessExtensions::handleAccessKey( const QKeyEvent* ev ) +bool KKbdAccessExtensions::handleAccessKey( const TQKeyEvent* ev ) { -// Qt interprets the keyevent also with the modifiers, and ev->text() matches that, +// TQt interprets the keyevent also with the modifiers, and ev->text() matches that, // but this code must act as if the modifiers weren't pressed if (!d->accessKeyLabels) return false; - QChar c; + TQChar c; if( ev->key() >= Key_A && ev->key() <= Key_Z ) c = 'A' + ev->key() - Key_A; else if( ev->key() >= Key_0 && ev->key() <= Key_9 ) @@ -640,7 +640,7 @@ bool KKbdAccessExtensions::handleAccessKey( const QKeyEvent* ev ) if( c.isNull()) return false; - QLabel* lab = d->accessKeyLabels->first(); + TQLabel* lab = d->accessKeyLabels->first(); while (lab) { if (lab->text() == c) { lab->buddy()->setFocus(); @@ -653,7 +653,7 @@ bool KKbdAccessExtensions::handleAccessKey( const QKeyEvent* ev ) return false; } -KSortedLabel::KSortedLabel(QLabel* l) : +KSortedLabel::KSortedLabel(TQLabel* l) : m_l(l) { } KSortedLabel::KSortedLabel() : @@ -661,7 +661,7 @@ KSortedLabel::KSortedLabel() : bool KSortedLabel::operator<( KSortedLabel l ) { - QPoint p1 = m_l->mapToGlobal(m_l->pos()); - QPoint p2 = l.label()->mapToGlobal(l.label()->pos()); + TQPoint p1 = m_l->mapToGlobal(m_l->pos()); + TQPoint p2 = l.label()->mapToGlobal(l.label()->pos()); return (p1.y() < p2.y() || (p1.y() == p2.y() && p1.x() < p2.x())); } |
