author | alwin <alwin> | 2004-03-02 12:21:11 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-02 12:21:11 (UTC) |
commit | b6b1c97559c0ed9f2e33632272426bf98f289232 (patch) (unidiff) | |
tree | d3a9987704770cdf5eb14e1136f6e3ecb2f36a04 /noncore/comm/keypebble/krfbcanvas.cpp | |
parent | 0d59c780513da78033f4d9040475dee9db0256d4 (diff) | |
download | opie-b6b1c97559c0ed9f2e33632272426bf98f289232.zip opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.gz opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.bz2 |
applied the patch generated by the optimize_connect script from
TT.
Diffstat (limited to 'noncore/comm/keypebble/krfbcanvas.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/comm/keypebble/krfbcanvas.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/comm/keypebble/krfbcanvas.cpp b/noncore/comm/keypebble/krfbcanvas.cpp index 75cba68..cd1fda0 100644 --- a/noncore/comm/keypebble/krfbcanvas.cpp +++ b/noncore/comm/keypebble/krfbcanvas.cpp | |||
@@ -1,186 +1,186 @@ | |||
1 | #include "krfbconnection.h" | 1 | #include "krfbconnection.h" |
2 | #include "krfbcanvas.h" | 2 | #include "krfbcanvas.h" |
3 | #include "krfbbuffer.h" | 3 | #include "krfbbuffer.h" |
4 | 4 | ||
5 | #include <qpe/qpeapplication.h> | 5 | #include <qpe/qpeapplication.h> |
6 | 6 | ||
7 | #include <qclipboard.h> | 7 | #include <qclipboard.h> |
8 | 8 | ||
9 | KRFBCanvas::KRFBCanvas( QWidget *parent, const char *name ) | 9 | KRFBCanvas::KRFBCanvas( QWidget *parent, const char *name ) |
10 | : QScrollView( parent, name ) | 10 | : QScrollView( parent, name ) |
11 | { | 11 | { |
12 | connection_ = new KRFBConnection(); | 12 | connection_ = new KRFBConnection(); |
13 | connect( connection_, SIGNAL( loggedIn() ), | 13 | connect( connection_, SIGNAL( loggedIn() ), |
14 | this, SLOT( loggedIn() ) ); | 14 | this, SLOT( loggedIn() ) ); |
15 | 15 | ||
16 | loggedIn_ = false; | 16 | loggedIn_ = false; |
17 | 17 | ||
18 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold); | 18 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold); |
19 | 19 | ||
20 | viewport()->setFocusPolicy( QWidget::StrongFocus ); | 20 | viewport()->setFocusPolicy( QWidget::StrongFocus ); |
21 | viewport()->setFocus(); | 21 | viewport()->setFocus(); |
22 | 22 | ||
23 | nextRightClick=0; | 23 | nextRightClick=0; |
24 | nextDoubleClick=0; | 24 | nextDoubleClick=0; |
25 | } | 25 | } |
26 | 26 | ||
27 | KRFBCanvas::~KRFBCanvas() | 27 | KRFBCanvas::~KRFBCanvas() |
28 | { | 28 | { |
29 | } | 29 | } |
30 | 30 | ||
31 | 31 | ||
32 | void KRFBCanvas::openConnection(KRFBServer server) | 32 | void KRFBCanvas::openConnection(KRFBServer server) |
33 | { | 33 | { |
34 | 34 | ||
35 | 35 | ||
36 | QCString host = server.hostname.latin1(); | 36 | QCString host = server.hostname.latin1(); |
37 | password=server.password; | 37 | password=server.password; |
38 | connection_->connectTo( server); | 38 | connection_->connectTo( server); |
39 | } | 39 | } |
40 | 40 | ||
41 | 41 | ||
42 | void KRFBCanvas::openURL( const QUrl &url ) | 42 | void KRFBCanvas::openURL( const QUrl &url ) |
43 | { | 43 | { |
44 | if ( loggedIn_ ) { | 44 | if ( loggedIn_ ) { |
45 | qWarning( "openURL invoked when logged in\n" ); | 45 | qWarning( "openURL invoked when logged in\n" ); |
46 | return; | 46 | return; |
47 | } | 47 | } |
48 | 48 | ||
49 | QCString host = url.host().latin1(); | 49 | QCString host = url.host().latin1(); |
50 | int display = url.port(); | 50 | int display = url.port(); |
51 | 51 | ||
52 | // connection_->connectTo( host, display ); | 52 | // connection_->connectTo( host, display ); |
53 | } | 53 | } |
54 | 54 | ||
55 | void KRFBCanvas::closeConnection() | 55 | void KRFBCanvas::closeConnection() |
56 | { | 56 | { |
57 | loggedIn_ = false; | 57 | loggedIn_ = false; |
58 | connection_->disconnect(); | 58 | connection_->disconnect(); |
59 | 59 | ||
60 | viewport()->setMouseTracking( false ); | 60 | viewport()->setMouseTracking( false ); |
61 | viewport()->setBackgroundMode( PaletteDark ); | 61 | viewport()->setBackgroundMode( PaletteDark ); |
62 | setBackgroundMode( PaletteDark ); | 62 | setBackgroundMode( PaletteDark ); |
63 | update(); | 63 | update(); |
64 | } | 64 | } |
65 | 65 | ||
66 | 66 | ||
67 | void KRFBCanvas::bell() | 67 | void KRFBCanvas::bell() |
68 | { | 68 | { |
69 | if ( connection_->options()->deIconify ) { | 69 | if ( connection_->options()->deIconify ) { |
70 | topLevelWidget()->raise(); | 70 | topLevelWidget()->raise(); |
71 | topLevelWidget()->show(); | 71 | topLevelWidget()->show(); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | void KRFBCanvas::loggedIn() | 75 | void KRFBCanvas::loggedIn() |
76 | { | 76 | { |
77 | qWarning( "Ok, we're logged in" ); | 77 | qWarning( "Ok, we're logged in" ); |
78 | 78 | ||
79 | // | 79 | // |
80 | // Get ready for action | 80 | // Get ready for action |
81 | // | 81 | // |
82 | loggedIn_ = true; | 82 | loggedIn_ = true; |
83 | viewport()->setMouseTracking( true ); | 83 | viewport()->setMouseTracking( true ); |
84 | viewport()->setBackgroundMode( NoBackground ); | 84 | viewport()->setBackgroundMode( NoBackground ); |
85 | setBackgroundMode( NoBackground ); | 85 | setBackgroundMode( NoBackground ); |
86 | 86 | ||
87 | // Start using the buffer | 87 | // Start using the buffer |
88 | connect( connection_->buffer(), SIGNAL( sizeChanged( int, int ) ), | 88 | connect( connection_->buffer(), SIGNAL( sizeChanged(int,int) ), |
89 | this, SLOT( resizeContents(int,int) ) ); | 89 | this, SLOT( resizeContents(int,int) ) ); |
90 | connect( connection_->buffer(), SIGNAL( updated( int, int, int, int ) ), | 90 | connect( connection_->buffer(), SIGNAL( updated(int,int,int,int) ), |
91 | this, SLOT( viewportUpdate(int,int,int,int) ) ); | 91 | this, SLOT( viewportUpdate(int,int,int,int) ) ); |
92 | connect( connection_->buffer(), SIGNAL( bell() ), | 92 | connect( connection_->buffer(), SIGNAL( bell() ), |
93 | this, SLOT( bell() ) ); | 93 | this, SLOT( bell() ) ); |
94 | connect( qApp->clipboard(), SIGNAL( dataChanged() ), | 94 | connect( qApp->clipboard(), SIGNAL( dataChanged() ), |
95 | this, SLOT( clipboardChanged() ) ); | 95 | this, SLOT( clipboardChanged() ) ); |
96 | } | 96 | } |
97 | 97 | ||
98 | void KRFBCanvas::viewportPaintEvent( QPaintEvent *e ) | 98 | void KRFBCanvas::viewportPaintEvent( QPaintEvent *e ) |
99 | { | 99 | { |
100 | QRect r = e->rect(); | 100 | QRect r = e->rect(); |
101 | 101 | ||
102 | if ( loggedIn_ ) { | 102 | if ( loggedIn_ ) { |
103 | QPixmap p; | 103 | QPixmap p; |
104 | 104 | ||
105 | bitBlt( viewport(), r.x(), r.y(), | 105 | bitBlt( viewport(), r.x(), r.y(), |
106 | connection_->buffer()->pixmap(), | 106 | connection_->buffer()->pixmap(), |
107 | r.x() + contentsX(), r.y() + contentsY(), | 107 | r.x() + contentsX(), r.y() + contentsY(), |
108 | r.width(), r.height() ); | 108 | r.width(), r.height() ); |
109 | } | 109 | } |
110 | else { | 110 | else { |
111 | QScrollView::viewportPaintEvent( e ); | 111 | QScrollView::viewportPaintEvent( e ); |
112 | } | 112 | } |
113 | } | 113 | } |
114 | 114 | ||
115 | void KRFBCanvas::viewportUpdate( int x, int y, int w, int h ) | 115 | void KRFBCanvas::viewportUpdate( int x, int y, int w, int h ) |
116 | { | 116 | { |
117 | updateContents( x, y, w, h ); | 117 | updateContents( x, y, w, h ); |
118 | } | 118 | } |
119 | 119 | ||
120 | void KRFBCanvas::contentsMousePressEvent( QMouseEvent *e ) | 120 | void KRFBCanvas::contentsMousePressEvent( QMouseEvent *e ) |
121 | { | 121 | { |
122 | 122 | ||
123 | if (nextDoubleClick) { | 123 | if (nextDoubleClick) { |
124 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),LeftButton,LeftButton)); | 124 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),LeftButton,LeftButton)); |
125 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0)); | 125 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0)); |
126 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0)); | 126 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0)); |
127 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton)); | 127 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton)); |
128 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0)); | 128 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0)); |
129 | } if (nextRightClick) { | 129 | } if (nextRightClick) { |
130 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),RightButton,RightButton)); | 130 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),RightButton,RightButton)); |
131 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),RightButton,0)); | 131 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),RightButton,0)); |
132 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton)); | 132 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton)); |
133 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0)); | 133 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0)); |
134 | } else if ( loggedIn_ ) | 134 | } else if ( loggedIn_ ) |
135 | connection_->buffer()->mouseEvent( e ); | 135 | connection_->buffer()->mouseEvent( e ); |
136 | 136 | ||
137 | } | 137 | } |
138 | 138 | ||
139 | void KRFBCanvas::contentsMouseReleaseEvent( QMouseEvent *e ) | 139 | void KRFBCanvas::contentsMouseReleaseEvent( QMouseEvent *e ) |
140 | { | 140 | { |
141 | if ( loggedIn_ && !nextRightClick && !nextDoubleClick) { | 141 | if ( loggedIn_ && !nextRightClick && !nextDoubleClick) { |
142 | connection_->buffer()->mouseEvent( e ); | 142 | connection_->buffer()->mouseEvent( e ); |
143 | } | 143 | } |
144 | 144 | ||
145 | nextRightClick=0; | 145 | nextRightClick=0; |
146 | nextDoubleClick=0; | 146 | nextDoubleClick=0; |
147 | } | 147 | } |
148 | 148 | ||
149 | void KRFBCanvas::contentsMouseMoveEvent( QMouseEvent *e ) | 149 | void KRFBCanvas::contentsMouseMoveEvent( QMouseEvent *e ) |
150 | { | 150 | { |
151 | if ( loggedIn_ ) | 151 | if ( loggedIn_ ) |
152 | connection_->buffer()->mouseEvent( e ); | 152 | connection_->buffer()->mouseEvent( e ); |
153 | } | 153 | } |
154 | 154 | ||
155 | void KRFBCanvas::keyPressEvent( QKeyEvent *e ) | 155 | void KRFBCanvas::keyPressEvent( QKeyEvent *e ) |
156 | { | 156 | { |
157 | if ( loggedIn_ ) | 157 | if ( loggedIn_ ) |
158 | connection_->buffer()->keyPressEvent( e ); | 158 | connection_->buffer()->keyPressEvent( e ); |
159 | } | 159 | } |
160 | 160 | ||
161 | void KRFBCanvas::keyReleaseEvent( QKeyEvent *e ) | 161 | void KRFBCanvas::keyReleaseEvent( QKeyEvent *e ) |
162 | { | 162 | { |
163 | if ( loggedIn_ ) | 163 | if ( loggedIn_ ) |
164 | connection_->buffer()->keyReleaseEvent( e ); | 164 | connection_->buffer()->keyReleaseEvent( e ); |
165 | } | 165 | } |
166 | 166 | ||
167 | void KRFBCanvas::refresh() | 167 | void KRFBCanvas::refresh() |
168 | { | 168 | { |
169 | if ( loggedIn_ ) | 169 | if ( loggedIn_ ) |
170 | connection_->refresh(); | 170 | connection_->refresh(); |
171 | } | 171 | } |
172 | 172 | ||
173 | void KRFBCanvas::clipboardChanged() | 173 | void KRFBCanvas::clipboardChanged() |
174 | { | 174 | { |
175 | if ( loggedIn_ ) { | 175 | if ( loggedIn_ ) { |
176 | connection_->sendCutText( qApp->clipboard()->text() ); | 176 | connection_->sendCutText( qApp->clipboard()->text() ); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | void KRFBCanvas::sendCtlAltDel( void) | 179 | void KRFBCanvas::sendCtlAltDel( void) |
180 | { | 180 | { |
181 | 181 | ||
182 | if ( loggedIn_ ) { | 182 | if ( loggedIn_ ) { |
183 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Control, 0,0)); | 183 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Control, 0,0)); |
184 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Alt, 0,0)); | 184 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Alt, 0,0)); |
185 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Delete, 0,0)); | 185 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Delete, 0,0)); |
186 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Control, 0,0)); | 186 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Control, 0,0)); |