diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-17 08:20:48 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-17 08:20:48 +0000 |
commit | aa0726b20f398264f0a2abc60215be044b106f9c (patch) | |
tree | 070fdbc19a1106cfdd7f651a8ce76bb1b89a513d /src/focusedwidgets.cpp | |
parent | d3cf5b3e75aadc3b02d0b56f030d4c3f8c2c749d (diff) | |
download | basket-aa0726b20f398264f0a2abc60215be044b106f9c.tar.gz basket-aa0726b20f398264f0a2abc60215be044b106f9c.zip |
TQt4 port basket
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/basket@1232416 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/focusedwidgets.cpp')
-rw-r--r-- | src/focusedwidgets.cpp | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/src/focusedwidgets.cpp b/src/focusedwidgets.cpp index 05c8b84..429d260 100644 --- a/src/focusedwidgets.cpp +++ b/src/focusedwidgets.cpp @@ -18,7 +18,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qpopupmenu.h> +#include <tqpopupmenu.h> #include <klocale.h> #include <iostream> @@ -31,15 +31,15 @@ #ifdef KeyPress #undef KeyPress #endif -#include <qevent.h> +#include <tqevent.h> /** class FocusedTextEdit */ -FocusedTextEdit::FocusedTextEdit(bool disableUpdatesOnKeyPress, QWidget *parent, const char *name) - : KTextEdit(parent, name), +FocusedTextEdit::FocusedTextEdit(bool disableUpdatesOnKeyPress, TQWidget *tqparent, const char *name) + : KTextEdit(tqparent, name), m_disableUpdatesOnKeyPress(disableUpdatesOnKeyPress) { - setWFlags(Qt::WNoAutoErase); // Does not work, we still need the disableUpdatesOnKeyPress hack! + setWFlags(TQt::WNoAutoErase); // Does not work, we still need the disableUpdatesOnKeyPress hack! } FocusedTextEdit::~FocusedTextEdit() @@ -56,8 +56,8 @@ FocusedTextEdit::~FocusedTextEdit() */ void FocusedTextEdit::paste() { - adaptClipboardText(QClipboard::Selection); - adaptClipboardText(QClipboard::Clipboard); + adaptClipboardText(TQClipboard::Selection); + adaptClipboardText(TQClipboard::Clipboard); // If we paste a application/x-qrichtext content starting with a "-" or a "*", // then auto-bulletting will crash. @@ -67,14 +67,14 @@ void FocusedTextEdit::paste() // uint oldAutoFormating = autoFormatting(); // setAutoFormatting(AutoNone); - QClipboard *clipboard = QApplication::clipboard(); + TQClipboard *clipboard = TQApplication::tqclipboard(); int paragraph; int index; getCursorPosition(¶graph, &index); bool preventAutoBullet = (index == 0) && - (clipboard->data(QClipboard::Selection)->provides("application/x-qrichtext") || - clipboard->data(QClipboard::Clipboard)->provides("application/x-qrichtext") ); + (clipboard->data(TQClipboard::Selection)->provides("application/x-qrichtext") || + clipboard->data(TQClipboard::Clipboard)->provides("application/x-qrichtext") ); if (preventAutoBullet) insert(" "); @@ -105,49 +105,49 @@ void FocusedTextEdit::paste() * specified 'mode' -, replaces all '\n' within that text and writes * it back to the clipboard. */ -void FocusedTextEdit::adaptClipboardText(QClipboard::Mode mode) +void FocusedTextEdit::adaptClipboardText(TQClipboard::Mode mode) { - QClipboard *clipboard = QApplication::clipboard(); + TQClipboard *clipboard = TQApplication::tqclipboard(); if (!clipboard) return; - if ( (textFormat() == Qt::RichText) && (!clipboard->data(mode)->provides("application/x-qrichtext")) ) { - QString text = clipboard->text(mode); + if ( (textFormat() == TQt::RichText) && (!clipboard->data(mode)->provides("application/x-qrichtext")) ) { + TQString text = clipboard->text(mode); if (text) { - text = text.replace("\n", QChar(0x2028)); + text = text.tqreplace("\n", TQChar(0x2028)); clipboard->setText(text, mode); } } } -QTextCursor* FocusedTextEdit::textCursor() const +TQTextCursor* FocusedTextEdit::textCursor() const { return KTextEdit::textCursor(); } -void FocusedTextEdit::keyPressEvent(QKeyEvent *event) +void FocusedTextEdit::keyPressEvent(TQKeyEvent *event) { - if (event->key() == Qt::Key_Escape) { + if (event->key() == TQt::Key_Escape) { emit escapePressed(); return; // In RichTextFormat mode, [Return] create a new paragraphe. // To keep consistency with TextFormat mode (new line on [Return]), // we redirect [Return] to simulate [Ctrl+Return] (create a new line in both modes). // Create new paragraphes still possible in RichTextFormat mode with [Shift+Enter]. - } else if (event->key() == Qt::Key_Return && event->state() == 0) - event = new QKeyEvent(QEvent::KeyPress, event->key(), event->ascii(), Qt::ControlButton, + } else if (event->key() == TQt::Key_Return && event->state() == 0) + event = new TQKeyEvent(TQEvent::KeyPress, event->key(), event->ascii(), TQt::ControlButton, event->text(), event->isAutoRepeat(), event->count() ); - else if (event->key() == Qt::Key_Return && event->state() & Qt::ControlButton) - event = new QKeyEvent(QEvent::KeyPress, event->key(), event->ascii(), Qt::ShiftButton, + else if (event->key() == TQt::Key_Return && event->state() & TQt::ControlButton) + event = new TQKeyEvent(TQEvent::KeyPress, event->key(), event->ascii(), TQt::ShiftButton, event->text(), event->isAutoRepeat(), event->count() ); if (m_disableUpdatesOnKeyPress) setUpdatesEnabled(false); KTextEdit::keyPressEvent(event); // Workarround (for ensuring the cursor to be visible): signal not emited when pressing those keys: - if (event->key() == Qt::Key_Home || event->key() == Qt::Key_End || event->key() == Qt::Key_PageUp || event->key() == Qt::Key_PageDown) { + if (event->key() == TQt::Key_Home || event->key() == TQt::Key_End || event->key() == TQt::Key_PageUp || event->key() == TQt::Key_PageDown) { int para; int index; getCursorPosition(¶, &index); @@ -163,7 +163,7 @@ void FocusedTextEdit::keyPressEvent(QKeyEvent *event) } } -void FocusedTextEdit::wheelEvent(QWheelEvent *event) +void FocusedTextEdit::wheelEvent(TQWheelEvent *event) { if (event->delta() > 0 && contentsY() > 0) { KTextEdit::wheelEvent(event); @@ -175,15 +175,15 @@ void FocusedTextEdit::wheelEvent(QWheelEvent *event) Global::bnpView->currentBasket()->wheelEvent(event); } -void FocusedTextEdit::enterEvent(QEvent *event) +void FocusedTextEdit::enterEvent(TQEvent *event) { emit mouseEntered(); KTextEdit::enterEvent(event); } -QPopupMenu* FocusedTextEdit::createPopupMenu(const QPoint &pos) +TQPopupMenu* FocusedTextEdit::createPopupMenu(const TQPoint &pos) { - QPopupMenu *menu = KTextEdit::createPopupMenu(pos); + TQPopupMenu *menu = KTextEdit::createPopupMenu(pos); int index = 0; int id = 0; @@ -192,7 +192,7 @@ QPopupMenu* FocusedTextEdit::createPopupMenu(const QPoint &pos) if (id == -1) break; // Disable Spell Check for rich text editors, because it doesn't work anyway: - if (textFormat() == Qt::RichText && (menu->text(id) == i18n("Auto Spell Check") || menu->text(id) == i18n("Check Spelling..."))) + if (textFormat() == TQt::RichText && (menu->text(id) == i18n("Auto Spell Check") || menu->text(id) == i18n("Check Spelling..."))) menu->setItemEnabled(id, false); // Always enable tabulations!: if (menu->text(id) == i18n("Allow Tabulations")) @@ -206,8 +206,8 @@ QPopupMenu* FocusedTextEdit::createPopupMenu(const QPoint &pos) /** class FocusedColorCombo: */ -FocusedColorCombo::FocusedColorCombo(QWidget *parent, const char *name) - : KColorCombo(parent, name) +FocusedColorCombo::FocusedColorCombo(TQWidget *tqparent, const char *name) + : KColorCombo(tqparent, name) { } @@ -215,11 +215,11 @@ FocusedColorCombo::~FocusedColorCombo() { } -void FocusedColorCombo::keyPressEvent(QKeyEvent *event) +void FocusedColorCombo::keyPressEvent(TQKeyEvent *event) { - if (event->key() == Qt::Key_Escape) + if (event->key() == TQt::Key_Escape) emit escapePressed(); - else if (event->key() == Qt::Key_Return) + else if (event->key() == TQt::Key_Return) emit returnPressed2(); else KColorCombo::keyPressEvent(event); @@ -227,8 +227,8 @@ void FocusedColorCombo::keyPressEvent(QKeyEvent *event) /** class FocusedFontCombo: */ -FocusedFontCombo::FocusedFontCombo(QWidget *parent, const char *name) - : KFontCombo(parent, name) +FocusedFontCombo::FocusedFontCombo(TQWidget *tqparent, const char *name) + : KFontCombo(tqparent, name) { } @@ -236,11 +236,11 @@ FocusedFontCombo::~FocusedFontCombo() { } -void FocusedFontCombo::keyPressEvent(QKeyEvent *event) +void FocusedFontCombo::keyPressEvent(TQKeyEvent *event) { - if (event->key() == Qt::Key_Escape) + if (event->key() == TQt::Key_Escape) emit escapePressed(); - else if (event->key() == Qt::Key_Return) + else if (event->key() == TQt::Key_Return) emit returnPressed2(); else KFontCombo::keyPressEvent(event); @@ -248,8 +248,8 @@ void FocusedFontCombo::keyPressEvent(QKeyEvent *event) /** class FocusedComboBox: */ -FocusedComboBox::FocusedComboBox(QWidget *parent, const char *name) - : KComboBox(parent, name) +FocusedComboBox::FocusedComboBox(TQWidget *tqparent, const char *name) + : KComboBox(tqparent, name) { } @@ -257,11 +257,11 @@ FocusedComboBox::~FocusedComboBox() { } -void FocusedComboBox::keyPressEvent(QKeyEvent *event) +void FocusedComboBox::keyPressEvent(TQKeyEvent *event) { - if (event->key() == Qt::Key_Escape) + if (event->key() == TQt::Key_Escape) emit escapePressed(); - else if (event->key() == Qt::Key_Return) + else if (event->key() == TQt::Key_Return) emit returnPressed2(); else KComboBox::keyPressEvent(event); @@ -269,8 +269,8 @@ void FocusedComboBox::keyPressEvent(QKeyEvent *event) /** class FocusedLineEdit: */ -FocusedLineEdit::FocusedLineEdit(QWidget *parent, const char *name) - : KLineEdit(parent, name) +FocusedLineEdit::FocusedLineEdit(TQWidget *tqparent, const char *name) + : KLineEdit(tqparent, name) { } @@ -278,15 +278,15 @@ FocusedLineEdit::~FocusedLineEdit() { } -void FocusedLineEdit::keyPressEvent(QKeyEvent *event) +void FocusedLineEdit::keyPressEvent(TQKeyEvent *event) { - if (event->key() == Qt::Key_Escape) + if (event->key() == TQt::Key_Escape) emit escapePressed(); else KLineEdit::keyPressEvent(event); } -void FocusedLineEdit::enterEvent(QEvent *event) +void FocusedLineEdit::enterEvent(TQEvent *event) { emit mouseEntered(); KLineEdit::enterEvent(event); |