From 47c8a359c5276062c4bc17f0e82410f29081b502 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:48:06 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- krdc/vnc/kvncview.cpp | 132 +++++++++++++++++++++++++------------------------- 1 file changed, 66 insertions(+), 66 deletions(-) (limited to 'krdc/vnc/kvncview.cpp') diff --git a/krdc/vnc/kvncview.cpp b/krdc/vnc/kvncview.cpp index f734845b..8050a68b 100644 --- a/krdc/vnc/kvncview.cpp +++ b/krdc/vnc/kvncview.cpp @@ -28,13 +28,13 @@ #include #include -#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "vncviewer.h" @@ -57,21 +57,21 @@ static KVncView *kvncview; //Passwords and KWallet data extern KWallet::Wallet *wallet; bool useKWallet = false; -static QCString password; -static QMutex passwordLock; -static QWaitCondition passwordWaiter; +static TQCString password; +static TQMutex passwordLock; +static TQWaitCondition passwordWaiter; const unsigned int MAX_SELECTION_LENGTH = 4096; -KVncView::KVncView(QWidget *parent, +KVncView::KVncView(TQWidget *parent, const char *name, - const QString &_host, + const TQString &_host, int _port, - const QString &_password, + const TQString &_password, Quality quality, DotCursorState dotCursorState, - const QString &encodings) : + const TQString &encodings) : KRemoteView(parent, name, Qt::WResizeNoErase | Qt::WRepaintNoErase | Qt::WStaticContents), m_cthread(this, m_wthread, m_quitFlag), m_wthread(this, m_quitFlag), @@ -90,18 +90,18 @@ KVncView::KVncView(QWidget *parent, password = _password.latin1(); dpy = qt_xdisplay(); setFixedSize(16,16); - setFocusPolicy(QWidget::StrongFocus); + setFocusPolicy(TQWidget::StrongFocus); - m_cb = QApplication::clipboard(); - connect(m_cb, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); - connect(m_cb, SIGNAL(dataChanged()), this, SLOT(clipboardChanged())); + m_cb = TQApplication::clipboard(); + connect(m_cb, TQT_SIGNAL(selectionChanged()), this, TQT_SLOT(selectionChanged())); + connect(m_cb, TQT_SIGNAL(dataChanged()), this, TQT_SLOT(clipboardChanged())); KStandardDirs *dirs = KGlobal::dirs(); - QBitmap cursorBitmap(dirs->findResource("appdata", + TQBitmap cursorBitmap(dirs->findResource("appdata", "pics/pointcursor.png")); - QBitmap cursorMask(dirs->findResource("appdata", + TQBitmap cursorMask(dirs->findResource("appdata", "pics/pointcursormask.png")); - m_cursor = QCursor(cursorBitmap, cursorMask); + m_cursor = TQCursor(cursorBitmap, cursorMask); if ((quality != QUALITY_UNKNOWN) || !encodings.isNull()) @@ -126,18 +126,18 @@ void KVncView::showDotCursorInternal() { setCursor(m_cursor); break; case DOT_CURSOR_OFF: - setCursor(QCursor(Qt::BlankCursor)); + setCursor(TQCursor(Qt::BlankCursor)); break; case DOT_CURSOR_AUTO: if (m_enableClientCursor) - setCursor(QCursor(Qt::BlankCursor)); + setCursor(TQCursor(Qt::BlankCursor)); else setCursor(m_cursor); break; } } -QString KVncView::host() { +TQString KVncView::host() { return m_host; } @@ -155,7 +155,7 @@ bool KVncView::isQuitting() { return m_quitFlag; } -void KVncView::configureApp(Quality q, const QString specialEncodings) { +void KVncView::configureApp(Quality q, const TQString specialEncodings) { appDataConfigured = true; appData.shareDesktop = 1; appData.viewOnly = 0; @@ -203,17 +203,17 @@ bool KVncView::checkLocalKRfb() { DCOPClient *d = KApplication::dcopClient(); int portNum; - QByteArray sdata, rdata; - QCString replyType; - QDataStream arg(sdata, IO_WriteOnly); - arg << QString("krfb"); - if (!d->call ("kded", "kinetd", "port(QString)", sdata, replyType, rdata)) + TQByteArray sdata, rdata; + TQCString replyType; + TQDataStream arg(sdata, IO_WriteOnly); + arg << TQString("krfb"); + if (!d->call ("kded", "kinetd", "port(TQString)", sdata, replyType, rdata)) return true; if (replyType != "int") return true; - QDataStream answer(rdata, IO_ReadOnly); + TQDataStream answer(rdata, IO_ReadOnly); answer >> portNum; if (m_port != portNum) @@ -239,16 +239,16 @@ bool KVncView::editPreferences( HostPrefPtr host ) i18n( "VNC Host Preferences for %1" ).arg( host->host() ), KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, true ); - QVBox *vbox = dlg->makeVBoxMainWidget(); + TQVBox *vbox = dlg->makeVBoxMainWidget(); VncPrefs *prefs = new VncPrefs( vbox ); - QWidget *spacer = new QWidget( vbox ); + TQWidget *spacer = new TQWidget( vbox ); vbox->setStretchFactor( spacer, 10 ); prefs->setQuality( ci ); prefs->setShowPrefs(true); prefs->setUseKWallet(kwallet); - if ( dlg->exec() == QDialog::Rejected ) + if ( dlg->exec() == TQDialog::Rejected ) return false; ci = prefs->quality(); @@ -331,7 +331,7 @@ bool KVncView::startFullscreen() return launch_Fullscreen_vnc; } -QSize KVncView::framebufferSize() { +TQSize KVncView::framebufferSize() { return m_framebufferSize; } @@ -358,7 +358,7 @@ void KVncView::enableScaling(bool s) { } } -void KVncView::paintEvent(QPaintEvent *e) { +void KVncView::paintEvent(TQPaintEvent *e) { drawRegion(e->rect().x(), e->rect().y(), e->rect().width(), @@ -373,7 +373,7 @@ void KVncView::drawRegion(int x, int y, int w, int h) { DrawScreenRegionX11Thread(winId(), x, y, w, h); } -void KVncView::customEvent(QCustomEvent *e) +void KVncView::customEvent(TQCustomEvent *e) { if (e->type() == ScreenRepaintEventType) { ScreenRepaintEvent *sre = (ScreenRepaintEvent*) e; @@ -381,7 +381,7 @@ void KVncView::customEvent(QCustomEvent *e) } else if (e->type() == ScreenResizeEventType) { ScreenResizeEvent *sre = (ScreenResizeEvent*) e; - m_framebufferSize = QSize(sre->width(), sre->height()); + m_framebufferSize = TQSize(sre->width(), sre->height()); setFixedSize(m_framebufferSize); emit changeSize(sre->width(), sre->height()); } @@ -412,7 +412,7 @@ void KVncView::customEvent(QCustomEvent *e) emit showingPasswordDialog(true); if (KPasswordDialog::getPassword(password, i18n("Access to the system requires a password.")) != KPasswordDialog::Accepted) - password = QCString(); + password = TQCString(); emit showingPasswordDialog(false); @@ -421,7 +421,7 @@ void KVncView::customEvent(QCustomEvent *e) passwordLock.unlock(); } else if (e->type() == WalletOpenEventType) { - QString krdc_folder = "KRDC-VNC"; + TQString krdc_folder = "KRDC-VNC"; emit showingPasswordDialog(true); //Bad things happen if you don't do this. // Bugfix: Check if wallet has been closed by an outside source @@ -431,7 +431,7 @@ void KVncView::customEvent(QCustomEvent *e) // Do we need to open the wallet? if ( !wallet ) { - QString walletName = KWallet::Wallet::NetworkWallet(); + TQString walletName = KWallet::Wallet::NetworkWallet(); wallet = KWallet::Wallet::openWallet(walletName); } @@ -443,7 +443,7 @@ void KVncView::customEvent(QCustomEvent *e) if (walletOK == true) { wallet->setFolder(krdc_folder); - QString newPass; + TQString newPass; if ( wallet->hasEntry(kvncview->host()) && !wallet->readPassword(kvncview->host(), newPass) ) { password=newPass.latin1(); } @@ -508,11 +508,11 @@ void KVncView::customEvent(QCustomEvent *e) emit disconnectedError(); } else if (e->type() == BeepEventType) { - QApplication::beep(); + TQApplication::beep(); } else if (e->type() == ServerCutEventType) { ServerCutEvent *sce = (ServerCutEvent*) e; - QString ctext = QString::fromUtf8(sce->bytes(), sce->length()); + TQString ctext = TQString::fromUtf8(sce->bytes(), sce->length()); m_dontSendCb = true; m_cb->setText(ctext, QClipboard::Clipboard); m_cb->setText(ctext, QClipboard::Selection); @@ -527,15 +527,15 @@ void KVncView::customEvent(QCustomEvent *e) } } -void KVncView::mouseEvent(QMouseEvent *e) { +void KVncView::mouseEvent(TQMouseEvent *e) { if (m_status != REMOTE_VIEW_CONNECTED) return; if (m_viewOnly) return; - if ( e->type() != QEvent::MouseMove ) { - if ( (e->type() == QEvent::MouseButtonPress) || - (e->type() == QEvent::MouseButtonDblClick)) { + if ( e->type() != TQEvent::MouseMove ) { + if ( (e->type() == TQEvent::MouseButtonPress) || + (e->type() == TQEvent::MouseButtonDblClick)) { if ( e->button() & LeftButton ) m_buttonMask |= 0x01; if ( e->button() & MidButton ) @@ -543,7 +543,7 @@ void KVncView::mouseEvent(QMouseEvent *e) { if ( e->button() & RightButton ) m_buttonMask |= 0x04; } - else if ( e->type() == QEvent::MouseButtonRelease ) { + else if ( e->type() == TQEvent::MouseButtonRelease ) { if ( e->button() & LeftButton ) m_buttonMask &= 0xfe; if ( e->button() & MidButton ) @@ -566,27 +566,27 @@ void KVncView::mouseEvent(QMouseEvent *e) { DrawCursorX11Thread(x, y); // in rfbproto.c } -void KVncView::mousePressEvent(QMouseEvent *e) { +void KVncView::mousePressEvent(TQMouseEvent *e) { mouseEvent(e); e->accept(); } -void KVncView::mouseDoubleClickEvent(QMouseEvent *e) { +void KVncView::mouseDoubleClickEvent(TQMouseEvent *e) { mouseEvent(e); e->accept(); } -void KVncView::mouseReleaseEvent(QMouseEvent *e) { +void KVncView::mouseReleaseEvent(TQMouseEvent *e) { mouseEvent(e); e->accept(); } -void KVncView::mouseMoveEvent(QMouseEvent *e) { +void KVncView::mouseMoveEvent(TQMouseEvent *e) { mouseEvent(e); e->ignore(); } -void KVncView::wheelEvent(QWheelEvent *e) { +void KVncView::wheelEvent(TQWheelEvent *e) { if (m_status != REMOTE_VIEW_CONNECTED) return; if (m_viewOnly) @@ -643,7 +643,7 @@ bool KVncView::x11Event(XEvent *e) { else if (e->type == KeyRelease) pressed = false; else - return QWidget::x11Event(e); + return TQWidget::x11Event(e); if (!m_viewOnly) { unsigned int s = KKeyNative(e).sym(); @@ -670,8 +670,8 @@ bool KVncView::x11Event(XEvent *e) { } void KVncView::unpressModifiers() { - QValueList keys = m_mods.keys(); - QValueList::const_iterator it = keys.begin(); + TQValueList keys = m_mods.keys(); + TQValueList::const_iterator it = keys.begin(); while (it != keys.end()) { m_wthread.queueKeyEvent(*it, false); it++; @@ -679,11 +679,11 @@ void KVncView::unpressModifiers() { m_mods.clear(); } -void KVncView::focusOutEvent(QFocusEvent *) { +void KVncView::focusOutEvent(TQFocusEvent *) { unpressModifiers(); } -QSize KVncView::sizeHint() { +TQSize KVncView::sizeHint() { return maximumSize(); } @@ -702,7 +702,7 @@ void KVncView::clipboardChanged() { if (m_cb->ownsClipboard() || m_dontSendCb) return; - QString text = m_cb->text(QClipboard::Clipboard); + TQString text = m_cb->text(QClipboard::Clipboard); if (text.length() > MAX_SELECTION_LENGTH) return; @@ -716,7 +716,7 @@ void KVncView::selectionChanged() { if (m_cb->ownsSelection() || m_dontSendCb) return; - QString text = m_cb->text(QClipboard::Selection); + TQString text = m_cb->text(QClipboard::Selection); if (text.length() > MAX_SELECTION_LENGTH) return; @@ -765,14 +765,14 @@ int getPassword(char *passwd, int pwlen) { //Try #2: Is there something in the wallet? if ( !retV && useKWallet ) { - QApplication::postEvent(kvncview, new WalletOpenEvent()); + TQApplication::postEvent(kvncview, new WalletOpenEvent()); passwordWaiter.wait(&passwordLock); //block if (!password.isNull()) retV = 1; //got it! } //Last try: Ask the user if (!retV) { - QApplication::postEvent(kvncview, new PasswordRequiredEvent()); + TQApplication::postEvent(kvncview, new PasswordRequiredEvent()); passwordWaiter.wait(&passwordLock); //block if (!password.isNull()) retV = 1; //got it! } @@ -800,7 +800,7 @@ extern void DrawScreenRegion(int x, int y, int width, int height) { kvncview->drawRegion(x, y, width, height); KApplication::kApplication()->unlock(); */ - QApplication::postEvent(kvncview, new ScreenRepaintEvent(x, y, width, height)); + TQApplication::postEvent(kvncview, new ScreenRepaintEvent(x, y, width, height)); } // call only from x11 thread! @@ -821,15 +821,15 @@ extern void UnlockFramebuffer() { } extern void beep() { - QApplication::postEvent(kvncview, new BeepEvent()); + TQApplication::postEvent(kvncview, new BeepEvent()); } extern void newServerCut(char *bytes, int length) { - QApplication::postEvent(kvncview, new ServerCutEvent(bytes, length)); + TQApplication::postEvent(kvncview, new ServerCutEvent(bytes, length)); } extern void postMouseEvent(int x, int y, int buttonMask) { - QApplication::postEvent(kvncview, new MouseStateEvent(x, y, buttonMask)); + TQApplication::postEvent(kvncview, new MouseStateEvent(x, y, buttonMask)); } #include "kvncview.moc" -- cgit v1.2.1