author | treke <treke> | 2002-12-22 00:58:46 (UTC) |
---|---|---|
committer | treke <treke> | 2002-12-22 00:58:46 (UTC) |
commit | 17d7f11b16b650f6ee2b5c440506167ea41fbfe5 (patch) (unidiff) | |
tree | cd5924c9e374a82c1cac6433dce098f3f45f4286 | |
parent | 6853d02989fc01e5a65048aca9749c20e0f5d095 (diff) | |
download | opie-17d7f11b16b650f6ee2b5c440506167ea41fbfe5.zip opie-17d7f11b16b650f6ee2b5c440506167ea41fbfe5.tar.gz opie-17d7f11b16b650f6ee2b5c440506167ea41fbfe5.tar.bz2 |
1) Fixed a bug where double clicking a blank spot on the bookmark list
caused a segfault.
2) Removed support for copying from the server. Trying to setText in the
clipboard would segfault everytime from within the KRFBDecoder. Doesnt
seem to like being called from within a slot.
-rw-r--r-- | noncore/comm/keypebble/krfbcanvas.cpp | 4 | ||||
-rw-r--r-- | noncore/comm/keypebble/krfbdecoder.cpp | 5 | ||||
-rw-r--r-- | noncore/comm/keypebble/kvnc.cpp | 3 |
3 files changed, 6 insertions, 6 deletions
diff --git a/noncore/comm/keypebble/krfbcanvas.cpp b/noncore/comm/keypebble/krfbcanvas.cpp index 049bbd4..bc71c90 100644 --- a/noncore/comm/keypebble/krfbcanvas.cpp +++ b/noncore/comm/keypebble/krfbcanvas.cpp | |||
@@ -98,110 +98,106 @@ void KRFBCanvas::loggedIn() | |||
98 | this, SLOT( resizeContents(int,int) ) ); | 98 | this, SLOT( resizeContents(int,int) ) ); |
99 | connect( connection_->buffer(), SIGNAL( updated( int, int, int, int ) ), | 99 | connect( connection_->buffer(), SIGNAL( updated( int, int, int, int ) ), |
100 | this, SLOT( viewportUpdate(int,int,int,int) ) ); | 100 | this, SLOT( viewportUpdate(int,int,int,int) ) ); |
101 | connect( connection_->buffer(), SIGNAL( bell() ), | 101 | connect( connection_->buffer(), SIGNAL( bell() ), |
102 | this, SLOT( bell() ) ); | 102 | this, SLOT( bell() ) ); |
103 | connect( qApp->clipboard(), SIGNAL( dataChanged() ), | 103 | connect( qApp->clipboard(), SIGNAL( dataChanged() ), |
104 | this, SLOT( clipboardChanged() ) ); | 104 | this, SLOT( clipboardChanged() ) ); |
105 | } | 105 | } |
106 | 106 | ||
107 | void KRFBCanvas::viewportPaintEvent( QPaintEvent *e ) | 107 | void KRFBCanvas::viewportPaintEvent( QPaintEvent *e ) |
108 | { | 108 | { |
109 | QRect r = e->rect(); | 109 | QRect r = e->rect(); |
110 | 110 | ||
111 | if ( loggedIn_ ) { | 111 | if ( loggedIn_ ) { |
112 | QPixmap p; | 112 | QPixmap p; |
113 | 113 | ||
114 | bitBlt( viewport(), r.x(), r.y(), | 114 | bitBlt( viewport(), r.x(), r.y(), |
115 | connection_->buffer()->pixmap(), | 115 | connection_->buffer()->pixmap(), |
116 | r.x() + contentsX(), r.y() + contentsY(), | 116 | r.x() + contentsX(), r.y() + contentsY(), |
117 | r.width(), r.height() ); | 117 | r.width(), r.height() ); |
118 | } | 118 | } |
119 | else { | 119 | else { |
120 | QScrollView::viewportPaintEvent( e ); | 120 | QScrollView::viewportPaintEvent( e ); |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | void KRFBCanvas::viewportUpdate( int x, int y, int w, int h ) | 124 | void KRFBCanvas::viewportUpdate( int x, int y, int w, int h ) |
125 | { | 125 | { |
126 | updateContents( x, y, w, h ); | 126 | updateContents( x, y, w, h ); |
127 | } | 127 | } |
128 | 128 | ||
129 | void KRFBCanvas::contentsMousePressEvent( QMouseEvent *e ) | 129 | void KRFBCanvas::contentsMousePressEvent( QMouseEvent *e ) |
130 | { | 130 | { |
131 | 131 | ||
132 | if (nextDoubleClick) { | 132 | if (nextDoubleClick) { |
133 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),LeftButton,LeftButton)); | 133 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),LeftButton,LeftButton)); |
134 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0)); | 134 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0)); |
135 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0)); | 135 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0)); |
136 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton)); | 136 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton)); |
137 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0)); | 137 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0)); |
138 | } if (nextRightClick) { | 138 | } if (nextRightClick) { |
139 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),RightButton,RightButton)); | 139 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),RightButton,RightButton)); |
140 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),RightButton,0)); | 140 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),RightButton,0)); |
141 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton)); | 141 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton)); |
142 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0)); | 142 | connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0)); |
143 | } else if ( loggedIn_ ) | 143 | } else if ( loggedIn_ ) |
144 | connection_->buffer()->mouseEvent( e ); | 144 | connection_->buffer()->mouseEvent( e ); |
145 | 145 | ||
146 | qDebug("Press"); | ||
147 | qDebug(QString::number(e->type()==QEvent::MouseButtonPress)); | ||
148 | } | 146 | } |
149 | 147 | ||
150 | void KRFBCanvas::contentsMouseReleaseEvent( QMouseEvent *e ) | 148 | void KRFBCanvas::contentsMouseReleaseEvent( QMouseEvent *e ) |
151 | { | 149 | { |
152 | if ( loggedIn_ && !nextRightClick && !nextDoubleClick) { | 150 | if ( loggedIn_ && !nextRightClick && !nextDoubleClick) { |
153 | connection_->buffer()->mouseEvent( e ); | 151 | connection_->buffer()->mouseEvent( e ); |
154 | } | 152 | } |
155 | 153 | ||
156 | nextRightClick=0; | 154 | nextRightClick=0; |
157 | nextDoubleClick=0; | 155 | nextDoubleClick=0; |
158 | qDebug("Release"); | ||
159 | qDebug(QString::number(e->button())); | ||
160 | } | 156 | } |
161 | 157 | ||
162 | void KRFBCanvas::contentsMouseMoveEvent( QMouseEvent *e ) | 158 | void KRFBCanvas::contentsMouseMoveEvent( QMouseEvent *e ) |
163 | { | 159 | { |
164 | if ( loggedIn_ ) | 160 | if ( loggedIn_ ) |
165 | connection_->buffer()->mouseEvent( e ); | 161 | connection_->buffer()->mouseEvent( e ); |
166 | } | 162 | } |
167 | 163 | ||
168 | void KRFBCanvas::keyPressEvent( QKeyEvent *e ) | 164 | void KRFBCanvas::keyPressEvent( QKeyEvent *e ) |
169 | { | 165 | { |
170 | if ( loggedIn_ ) | 166 | if ( loggedIn_ ) |
171 | connection_->buffer()->keyPressEvent( e ); | 167 | connection_->buffer()->keyPressEvent( e ); |
172 | } | 168 | } |
173 | 169 | ||
174 | void KRFBCanvas::keyReleaseEvent( QKeyEvent *e ) | 170 | void KRFBCanvas::keyReleaseEvent( QKeyEvent *e ) |
175 | { | 171 | { |
176 | if ( loggedIn_ ) | 172 | if ( loggedIn_ ) |
177 | connection_->buffer()->keyReleaseEvent( e ); | 173 | connection_->buffer()->keyReleaseEvent( e ); |
178 | } | 174 | } |
179 | 175 | ||
180 | void KRFBCanvas::refresh() | 176 | void KRFBCanvas::refresh() |
181 | { | 177 | { |
182 | if ( loggedIn_ ) | 178 | if ( loggedIn_ ) |
183 | connection_->refresh(); | 179 | connection_->refresh(); |
184 | } | 180 | } |
185 | 181 | ||
186 | void KRFBCanvas::clipboardChanged() | 182 | void KRFBCanvas::clipboardChanged() |
187 | { | 183 | { |
188 | if ( loggedIn_ ) { | 184 | if ( loggedIn_ ) { |
189 | connection_->sendCutText( qApp->clipboard()->text() ); | 185 | connection_->sendCutText( qApp->clipboard()->text() ); |
190 | } | 186 | } |
191 | } | 187 | } |
192 | void KRFBCanvas::sendCtlAltDel( void) | 188 | void KRFBCanvas::sendCtlAltDel( void) |
193 | { | 189 | { |
194 | 190 | ||
195 | if ( loggedIn_ ) { | 191 | if ( loggedIn_ ) { |
196 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Control, 0,0)); | 192 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Control, 0,0)); |
197 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Alt, 0,0)); | 193 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Alt, 0,0)); |
198 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Delete, 0,0)); | 194 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Delete, 0,0)); |
199 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Control, 0,0)); | 195 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Control, 0,0)); |
200 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Alt, 0,0)); | 196 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Alt, 0,0)); |
201 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Delete, 0,0)); | 197 | connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Delete, 0,0)); |
202 | } | 198 | } |
203 | } | 199 | } |
204 | 200 | ||
205 | void KRFBCanvas::markDoubleClick( void) | 201 | void KRFBCanvas::markDoubleClick( void) |
206 | { | 202 | { |
207 | nextRightClick=1; | 203 | nextRightClick=1; |
diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp index 94e3b79..33418ae 100644 --- a/noncore/comm/keypebble/krfbdecoder.cpp +++ b/noncore/comm/keypebble/krfbdecoder.cpp | |||
@@ -662,117 +662,120 @@ void KRFBDecoder::sendCutEvent( const QString &unicode ) | |||
662 | // same. I've reported this problem to the ORL guys, but they apparantly have no | 662 | // same. I've reported this problem to the ORL guys, but they apparantly have no |
663 | // immediate plans to fix the issue. :-( (rich) | 663 | // immediate plans to fix the issue. :-( (rich) |
664 | // | 664 | // |
665 | 665 | ||
666 | CARD8 padding[3]; | 666 | CARD8 padding[3]; |
667 | QCString text = unicode.local8Bit(); | 667 | QCString text = unicode.local8Bit(); |
668 | CARD32 length = text.length(); | 668 | CARD32 length = text.length(); |
669 | length = Swap32IfLE( length ); | 669 | length = Swap32IfLE( length ); |
670 | 670 | ||
671 | con->write( &ClientCutTextId, 1 ); | 671 | con->write( &ClientCutTextId, 1 ); |
672 | con->write( &padding, 3 ); | 672 | con->write( &padding, 3 ); |
673 | con->write( &length, 4 ); | 673 | con->write( &length, 4 ); |
674 | con->write( text.data(), length ); | 674 | con->write( text.data(), length ); |
675 | } | 675 | } |
676 | 676 | ||
677 | void KRFBDecoder::gotServerCut() | 677 | void KRFBDecoder::gotServerCut() |
678 | { | 678 | { |
679 | qWarning( "Got server cut" ); | 679 | qWarning( "Got server cut" ); |
680 | 680 | ||
681 | currentState = AwaitingServerCutLength; | 681 | currentState = AwaitingServerCutLength; |
682 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutLength() ) ); | 682 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutLength() ) ); |
683 | con->waitForData( ServerCutLenLength ); | 683 | con->waitForData( ServerCutLenLength ); |
684 | } | 684 | } |
685 | 685 | ||
686 | void KRFBDecoder::gotServerCutLength() | 686 | void KRFBDecoder::gotServerCutLength() |
687 | { | 687 | { |
688 | assert( currentState = AwaitingServerCutLength ); | 688 | assert( currentState = AwaitingServerCutLength ); |
689 | disconnect( con, SIGNAL( gotEnoughData() ), | 689 | disconnect( con, SIGNAL( gotEnoughData() ), |
690 | this, SLOT( gotServerCutLength() ) ); | 690 | this, SLOT( gotServerCutLength() ) ); |
691 | 691 | ||
692 | CARD8 padding[3]; | 692 | CARD8 padding[3]; |
693 | con->read( padding, 3 ); | 693 | con->read( padding, 3 ); |
694 | 694 | ||
695 | con->read( &serverCutTextLen, 4 ); | 695 | con->read( &serverCutTextLen, 4 ); |
696 | serverCutTextLen = Swap32IfLE( serverCutTextLen ); | 696 | serverCutTextLen = Swap32IfLE( serverCutTextLen ); |
697 | 697 | ||
698 | currentState = AwaitingServerCutText; | 698 | currentState = AwaitingServerCutText; |
699 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutText() ) ); | 699 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutText() ) ); |
700 | con->waitForData( serverCutTextLen ); | 700 | con->waitForData( serverCutTextLen ); |
701 | } | 701 | } |
702 | 702 | ||
703 | void KRFBDecoder::gotServerCutText() | 703 | void KRFBDecoder::gotServerCutText() |
704 | { | 704 | { |
705 | assert( currentState = AwaitingServerCutText ); | 705 | assert( currentState = AwaitingServerCutText ); |
706 | 706 | ||
707 | disconnect( con, SIGNAL( gotEnoughData() ), | 707 | disconnect( con, SIGNAL( gotEnoughData() ), |
708 | this, SLOT( gotServerCutText() ) ); | 708 | this, SLOT( gotServerCutText() ) ); |
709 | 709 | ||
710 | |||
710 | // | 711 | // |
711 | // Warning: There is a bug in the RFB protocol because there is no way to find | 712 | // Warning: There is a bug in the RFB protocol because there is no way to find |
712 | // out the codepage in use on the remote machine. This could be fixed by requiring | 713 | // out the codepage in use on the remote machine. This could be fixed by requiring |
713 | // the remote server to use utf8 etc. but for now we have to assume they're the | 714 | // the remote server to use utf8 etc. but for now we have to assume they're the |
714 | // same. I've reported this problem to the ORL guys, but they apparantly have no | 715 | // same. I've reported this problem to the ORL guys, but they apparantly have no |
715 | // immediate plans to fix the issue. :-( (rich) | 716 | // immediate plans to fix the issue. :-( (rich) |
716 | // | 717 | // |
717 | 718 | ||
718 | char *cutbuf = new char[ serverCutTextLen + 1 ]; | 719 | char *cutbuf = new char[ serverCutTextLen + 1 ]; |
719 | CHECK_PTR( cutbuf ); | 720 | CHECK_PTR( cutbuf ); |
720 | 721 | ||
721 | con->read( cutbuf, serverCutTextLen ); | 722 | con->read( cutbuf, serverCutTextLen ); |
722 | cutbuf[ serverCutTextLen ] = '\0'; | 723 | cutbuf[ serverCutTextLen ] = '\0'; |
723 | 724 | ||
725 | /* For some reason QApplication::clipboard()->setText() segfaults when called | ||
726 | * from within keypebble's mass of signals and slots | ||
724 | qWarning( "Server cut: %s", cutbuf ); | 727 | qWarning( "Server cut: %s", cutbuf ); |
725 | 728 | ||
726 | QString cutText( cutbuf ); // DANGER!! | 729 | QString cutText( cutbuf ); // DANGER!! |
727 | qApp->clipboard()->setText( cutText ); | 730 | qApp->clipboard()->setText( cutText ); |
731 | */ | ||
728 | 732 | ||
729 | delete cutbuf; | 733 | delete cutbuf; |
730 | |||
731 | // Now wait for the update (again) | 734 | // Now wait for the update (again) |
732 | if ( oldState == AwaitingUpdate ) { | 735 | if ( oldState == AwaitingUpdate ) { |
733 | currentState = AwaitingUpdate; | 736 | currentState = AwaitingUpdate; |
734 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); | 737 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); |
735 | con->waitForData( UpdateHeaderLength ); | 738 | con->waitForData( UpdateHeaderLength ); |
736 | } | 739 | } |
737 | else if ( oldState == Idle ) { | 740 | else if ( oldState == Idle ) { |
738 | currentState = Idle; | 741 | currentState = Idle; |
739 | } | 742 | } |
740 | else { | 743 | else { |
741 | qWarning( "Async handled in weird state" ); | 744 | qWarning( "Async handled in weird state" ); |
742 | currentState = oldState; | 745 | currentState = oldState; |
743 | }; | 746 | }; |
744 | } | 747 | } |
745 | 748 | ||
746 | void KRFBDecoder::gotBell() | 749 | void KRFBDecoder::gotBell() |
747 | { | 750 | { |
748 | qWarning( "Got server bell" ); | 751 | qWarning( "Got server bell" ); |
749 | buf->soundBell(); | 752 | buf->soundBell(); |
750 | 753 | ||
751 | // Now wait for the update (again) | 754 | // Now wait for the update (again) |
752 | if ( oldState == AwaitingUpdate ) { | 755 | if ( oldState == AwaitingUpdate ) { |
753 | currentState = AwaitingUpdate; | 756 | currentState = AwaitingUpdate; |
754 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); | 757 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); |
755 | con->waitForData( UpdateHeaderLength ); | 758 | con->waitForData( UpdateHeaderLength ); |
756 | } | 759 | } |
757 | else if ( oldState == Idle ) { | 760 | else if ( oldState == Idle ) { |
758 | currentState = Idle; | 761 | currentState = Idle; |
759 | } | 762 | } |
760 | else { | 763 | else { |
761 | qWarning( "Async handled in weird state" ); | 764 | qWarning( "Async handled in weird state" ); |
762 | currentState = oldState; | 765 | currentState = oldState; |
763 | }; | 766 | }; |
764 | } | 767 | } |
765 | 768 | ||
766 | void KRFBDecoder::sendKeyPressEvent( QKeyEvent *event ) | 769 | void KRFBDecoder::sendKeyPressEvent( QKeyEvent *event ) |
767 | { | 770 | { |
768 | int key; | 771 | int key; |
769 | key = toKeySym( event ); | 772 | key = toKeySym( event ); |
770 | if ( key ) { | 773 | if ( key ) { |
771 | key = Swap32IfLE( key ); | 774 | key = Swap32IfLE( key ); |
772 | 775 | ||
773 | CARD8 mask = true; | 776 | CARD8 mask = true; |
774 | 777 | ||
775 | CARD16 padding = 0; | 778 | CARD16 padding = 0; |
776 | con->write( &KeyEventId, 1 ); | 779 | con->write( &KeyEventId, 1 ); |
777 | con->write( &mask, 1 ); | 780 | con->write( &mask, 1 ); |
778 | con->write( &padding, 2 ); | 781 | con->write( &padding, 2 ); |
diff --git a/noncore/comm/keypebble/kvnc.cpp b/noncore/comm/keypebble/kvnc.cpp index 5b1dc9f..48a442c 100644 --- a/noncore/comm/keypebble/kvnc.cpp +++ b/noncore/comm/keypebble/kvnc.cpp | |||
@@ -114,97 +114,98 @@ KVNC::KVNC( const char *name ) : QMainWindow( 0, name ,WStyle_ContextHelp) | |||
114 | QString::null, 0, this, 0 ); | 114 | QString::null, 0, this, 0 ); |
115 | connect( d, SIGNAL( activated() ), | 115 | connect( d, SIGNAL( activated() ), |
116 | this, SLOT( deleteBookmark() ) ); | 116 | this, SLOT( deleteBookmark() ) ); |
117 | d->addTo( bar ); | 117 | d->addTo( bar ); |
118 | } | 118 | } |
119 | 119 | ||
120 | KVNC::~KVNC() | 120 | KVNC::~KVNC() |
121 | { | 121 | { |
122 | 122 | ||
123 | } | 123 | } |
124 | 124 | ||
125 | void KVNC::newConnection() | 125 | void KVNC::newConnection() |
126 | { | 126 | { |
127 | curServer=new KRFBServer; | 127 | curServer=new KRFBServer; |
128 | 128 | ||
129 | KVNCConnDlg dlg( curServer,this); | 129 | KVNCConnDlg dlg( curServer,this); |
130 | dlg.showMaximized(); | 130 | dlg.showMaximized(); |
131 | if (dlg.exec()) { | 131 | if (dlg.exec()) { |
132 | if (!curServer->name.isEmpty()) | 132 | if (!curServer->name.isEmpty()) |
133 | bookmarkSelector->addBookmark(curServer); | 133 | bookmarkSelector->addBookmark(curServer); |
134 | canvas->openConnection(*curServer); | 134 | canvas->openConnection(*curServer); |
135 | } else | 135 | } else |
136 | curServer=0; | 136 | curServer=0; |
137 | } | 137 | } |
138 | 138 | ||
139 | void KVNC::openConnection( QString name) | 139 | void KVNC::openConnection( QString name) |
140 | { | 140 | { |
141 | curServer=bookmarkSelector->getServer(name); | 141 | curServer=bookmarkSelector->getServer(name); |
142 | 142 | ||
143 | if (curServer) { | 143 | if (curServer) { |
144 | KVNCConnDlg dlg( curServer,this); | 144 | KVNCConnDlg dlg( curServer,this); |
145 | dlg.showMaximized(); | 145 | dlg.showMaximized(); |
146 | 146 | ||
147 | if ( dlg.exec() ) { | 147 | if ( dlg.exec() ) { |
148 | canvas->openConnection(*curServer); | 148 | canvas->openConnection(*curServer); |
149 | bookmarkSelector->writeBookmarks(); | 149 | bookmarkSelector->writeBookmarks(); |
150 | } else | 150 | } else |
151 | curServer=0; | 151 | curServer=0; |
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | void KVNC::openConnection( void ) | 155 | void KVNC::openConnection( void ) |
156 | { | 156 | { |
157 | openConnection( bookmarkSelector->selectedBookmark()); | 157 | openConnection( bookmarkSelector->selectedBookmark()); |
158 | } | 158 | } |
159 | 159 | ||
160 | void KVNC::openConnection( QListBoxItem * item) | 160 | void KVNC::openConnection( QListBoxItem * item) |
161 | { | 161 | { |
162 | openConnection(item->text()); | 162 | if (item) |
163 | openConnection(item->text()); | ||
163 | } | 164 | } |
164 | 165 | ||
165 | void KVNC::setupActions() | 166 | void KVNC::setupActions() |
166 | { | 167 | { |
167 | cornerMenu = new QPopupMenu( this ); | 168 | cornerMenu = new QPopupMenu( this ); |
168 | 169 | ||
169 | fullScreenAction = new QAction( tr("Full Screen"), QString::null, 0, 0 ); | 170 | fullScreenAction = new QAction( tr("Full Screen"), QString::null, 0, 0 ); |
170 | connect( fullScreenAction, SIGNAL(activated()), | 171 | connect( fullScreenAction, SIGNAL(activated()), |
171 | this, SLOT( toggleFullScreen() ) ); | 172 | this, SLOT( toggleFullScreen() ) ); |
172 | fullScreenAction->addTo( cornerMenu ); | 173 | fullScreenAction->addTo( cornerMenu ); |
173 | fullScreenAction->setEnabled( false ); | 174 | fullScreenAction->setEnabled( false ); |
174 | 175 | ||
175 | ctlAltDelAction = new QAction( tr("Send Contrl-Alt-Delete"), QString::null, 0, 0 ); | 176 | ctlAltDelAction = new QAction( tr("Send Contrl-Alt-Delete"), QString::null, 0, 0 ); |
176 | connect( ctlAltDelAction, SIGNAL(activated()), | 177 | connect( ctlAltDelAction, SIGNAL(activated()), |
177 | canvas, SLOT( sendCtlAltDel() ) ); | 178 | canvas, SLOT( sendCtlAltDel() ) ); |
178 | ctlAltDelAction->addTo( cornerMenu ); | 179 | ctlAltDelAction->addTo( cornerMenu ); |
179 | ctlAltDelAction->setEnabled( false ); | 180 | ctlAltDelAction->setEnabled( false ); |
180 | 181 | ||
181 | disconnectAction = new QAction( tr("Disconnect"), QString::null, 0, 0 ); | 182 | disconnectAction = new QAction( tr("Disconnect"), QString::null, 0, 0 ); |
182 | connect( disconnectAction, SIGNAL(activated()), | 183 | connect( disconnectAction, SIGNAL(activated()), |
183 | this, SLOT( closeConnection() ) ); | 184 | this, SLOT( closeConnection() ) ); |
184 | disconnectAction->addTo( cornerMenu ); | 185 | disconnectAction->addTo( cornerMenu ); |
185 | disconnectAction->setEnabled( false ); | 186 | disconnectAction->setEnabled( false ); |
186 | 187 | ||
187 | doubleClickAction = new QAction( tr("Next Click is Double Click"), QString::null, 0, 0 ); | 188 | doubleClickAction = new QAction( tr("Next Click is Double Click"), QString::null, 0, 0 ); |
188 | connect( doubleClickAction, SIGNAL(activated()), | 189 | connect( doubleClickAction, SIGNAL(activated()), |
189 | canvas, SLOT( markDoubleClick() ) ); | 190 | canvas, SLOT( markDoubleClick() ) ); |
190 | doubleClickAction->addTo( cornerMenu ); | 191 | doubleClickAction->addTo( cornerMenu ); |
191 | doubleClickAction->setEnabled( false ); | 192 | doubleClickAction->setEnabled( false ); |
192 | 193 | ||
193 | rightClickAction = new QAction( tr("Next Click is Right Click"), QString::null, 0, 0 ); | 194 | rightClickAction = new QAction( tr("Next Click is Right Click"), QString::null, 0, 0 ); |
194 | connect( rightClickAction, SIGNAL(activated()), | 195 | connect( rightClickAction, SIGNAL(activated()), |
195 | canvas, SLOT( markRightClick() ) ); | 196 | canvas, SLOT( markRightClick() ) ); |
196 | rightClickAction->addTo( cornerMenu ); | 197 | rightClickAction->addTo( cornerMenu ); |
197 | rightClickAction->setEnabled( false ); | 198 | rightClickAction->setEnabled( false ); |
198 | } | 199 | } |
199 | 200 | ||
200 | void KVNC::toggleFullScreen() | 201 | void KVNC::toggleFullScreen() |
201 | { | 202 | { |
202 | if ( fullscreen ) { | 203 | if ( fullscreen ) { |
203 | canvas->releaseKeyboard(); | 204 | canvas->releaseKeyboard(); |
204 | canvas->reparent( stack, 0, QPoint(0,0), false ); | 205 | canvas->reparent( stack, 0, QPoint(0,0), false ); |
205 | canvas->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 206 | canvas->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
206 | setCentralWidget( stack ); | 207 | setCentralWidget( stack ); |
207 | stack->addWidget(canvas,get_unique_id()); | 208 | stack->addWidget(canvas,get_unique_id()); |
208 | stack->raiseWidget(canvas); | 209 | stack->raiseWidget(canvas); |
209 | canvas->show(); | 210 | canvas->show(); |
210 | stack->show(); | 211 | stack->show(); |