summaryrefslogtreecommitdiff
authortreke <treke>2002-12-17 03:47:12 (UTC)
committer treke <treke>2002-12-17 03:47:12 (UTC)
commit1dee9c33c12ba45134b1ccb17bc84bc7fa94eb3b (patch) (unidiff)
tree2ca7f47c689e570c31e62f54b22f944271737e42
parent2c338cc2ed1815c243cc88ed4506d1de184c19e0 (diff)
downloadopie-1dee9c33c12ba45134b1ccb17bc84bc7fa94eb3b.zip
opie-1dee9c33c12ba45134b1ccb17bc84bc7fa94eb3b.tar.gz
opie-1dee9c33c12ba45134b1ccb17bc84bc7fa94eb3b.tar.bz2
Now use Single click to open a bookmark instead of a double click.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/comm/keypebble/kvnc.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/comm/keypebble/kvnc.cpp b/noncore/comm/keypebble/kvnc.cpp
index abdb1e0..5b1dc9f 100644
--- a/noncore/comm/keypebble/kvnc.cpp
+++ b/noncore/comm/keypebble/kvnc.cpp
@@ -1,294 +1,294 @@
1#include <qiconset.h> 1#include <qiconset.h>
2#include <qdialog.h> 2#include <qdialog.h>
3#include <qpixmap.h> 3#include <qpixmap.h>
4#include <qdom.h> 4#include <qdom.h>
5#include <qaction.h> 5#include <qaction.h>
6#include <qpe/qpemenubar.h> 6#include <qpe/qpemenubar.h>
7#include <qstatusbar.h> 7#include <qstatusbar.h>
8#include <qpopupmenu.h> 8#include <qpopupmenu.h>
9#include <qpushbutton.h> 9#include <qpushbutton.h>
10#include <qpe/qpetoolbar.h> 10#include <qpe/qpetoolbar.h>
11#include <qtimer.h> 11#include <qtimer.h>
12#include <qmessagebox.h> 12#include <qmessagebox.h>
13#include <qspinbox.h> 13#include <qspinbox.h>
14#include <qlistbox.h> 14#include <qlistbox.h>
15#include <qlineedit.h> 15#include <qlineedit.h>
16#include <qpe/qpeapplication.h> 16#include <qpe/qpeapplication.h>
17#include <qpe/global.h> 17#include <qpe/global.h>
18#include <qpe/qpetoolbar.h> 18#include <qpe/qpetoolbar.h>
19#include <qpe/resource.h> 19#include <qpe/resource.h>
20 20
21#include <assert.h> 21#include <assert.h>
22 22
23#include "kvnc.h" 23#include "kvnc.h"
24#include "krfbcanvas.h" 24#include "krfbcanvas.h"
25#include "krfbconnection.h" 25#include "krfbconnection.h"
26#include "kvncconndlg.h" 26#include "kvncconndlg.h"
27#include "krfbserver.h" 27#include "krfbserver.h"
28 28
29static int u_id = 1; 29static int u_id = 1;
30static int get_unique_id() 30static int get_unique_id()
31{ 31{
32 return u_id++; 32 return u_id++;
33} 33}
34 34
35 35
36/* XPM */ 36/* XPM */
37static char * menu_xpm[] = { 37static char * menu_xpm[] = {
38"12 12 5 1", 38"12 12 5 1",
39 " c None", 39 " c None",
40 ".c #000000", 40 ".c #000000",
41 "+c #FFFDAD", 41 "+c #FFFDAD",
42 "@c #FFFF00", 42 "@c #FFFF00",
43 "#c #E5E100", 43 "#c #E5E100",
44" ", 44" ",
45" ", 45" ",
46" ......... ", 46" ......... ",
47" .+++++++. ", 47" .+++++++. ",
48" .+@@@@#. ", 48" .+@@@@#. ",
49" .+@@@#. ", 49" .+@@@#. ",
50" .+@@#. ", 50" .+@@#. ",
51" .+@#. ", 51" .+@#. ",
52" .+#. ", 52" .+#. ",
53" .+. ", 53" .+. ",
54" .. ", 54" .. ",
55" "}; 55" "};
56 56
57const int StatusTextId = 0; 57const int StatusTextId = 0;
58 58
59KVNC::KVNC( const char *name ) : QMainWindow( 0, name ,WStyle_ContextHelp) 59KVNC::KVNC( const char *name ) : QMainWindow( 0, name ,WStyle_ContextHelp)
60{ 60{
61 setCaption( tr("VNC Viewer") ); 61 setCaption( tr("VNC Viewer") );
62 fullscreen = false; 62 fullscreen = false;
63 63
64 stack = new QWidgetStack( this ); 64 stack = new QWidgetStack( this );
65 setCentralWidget( stack ); 65 setCentralWidget( stack );
66 66
67 bookmarkSelector=new KVNCBookmarkDlg(); 67 bookmarkSelector=new KVNCBookmarkDlg();
68 stack->addWidget(bookmarkSelector,get_unique_id()); 68 stack->addWidget(bookmarkSelector,get_unique_id());
69 stack->raiseWidget( bookmarkSelector ); 69 stack->raiseWidget( bookmarkSelector );
70 70
71 canvas = new KRFBCanvas( stack, "canvas" ); 71 canvas = new KRFBCanvas( stack, "canvas" );
72 stack->addWidget(canvas,get_unique_id()); 72 stack->addWidget(canvas,get_unique_id());
73 setCentralWidget( stack ); 73 setCentralWidget( stack );
74 74
75 75
76 connect( bookmarkSelector->bookmarkList, SIGNAL(doubleClicked(QListBoxItem *)), 76 connect( bookmarkSelector->bookmarkList, SIGNAL(clicked(QListBoxItem *)),
77 this, SLOT(openConnection(QListBoxItem *)) ); 77 this, SLOT(openConnection(QListBoxItem *)) );
78 connect( canvas->connection(), SIGNAL(statusChanged(const QString &)), 78 connect( canvas->connection(), SIGNAL(statusChanged(const QString &)),
79 this, SLOT(statusMessage(const QString &)) ); 79 this, SLOT(statusMessage(const QString &)) );
80 connect( canvas->connection(), SIGNAL(error(const QString &)), 80 connect( canvas->connection(), SIGNAL(error(const QString &)),
81 this, SLOT(error(const QString &)) ); 81 this, SLOT(error(const QString &)) );
82 connect( canvas->connection(), SIGNAL(connected()), this, SLOT(connected()) ); 82 connect( canvas->connection(), SIGNAL(connected()), this, SLOT(connected()) );
83 connect( canvas->connection(), SIGNAL(loggedIn()), this, SLOT(loggedIn()) ); 83 connect( canvas->connection(), SIGNAL(loggedIn()), this, SLOT(loggedIn()) );
84 connect( canvas->connection(), SIGNAL(disconnected()), this, SLOT(disconnected()) ); 84 connect( canvas->connection(), SIGNAL(disconnected()), this, SLOT(disconnected()) );
85 85
86 setupActions(); 86 setupActions();
87 87
88 cornerButton = new QPushButton( this ); 88 cornerButton = new QPushButton( this );
89 cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); 89 cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) );
90 connect( cornerButton, SIGNAL(pressed()), this, SLOT(showMenu()) ); 90 connect( cornerButton, SIGNAL(pressed()), this, SLOT(showMenu()) );
91 canvas->setCornerWidget( cornerButton ); 91 canvas->setCornerWidget( cornerButton );
92 92
93 stack->raiseWidget( bookmarkSelector ); 93 stack->raiseWidget( bookmarkSelector );
94 94
95 95
96 bar= new QToolBar( this ); 96 bar= new QToolBar( this );
97 setToolBarsMovable( false ); 97 setToolBarsMovable( false );
98 setRightJustification(false); 98 setRightJustification(false);
99 99
100 100
101 QAction *n = new QAction( tr( "New Connection" ), Resource::loadPixmap( "new" ), 101 QAction *n = new QAction( tr( "New Connection" ), Resource::loadPixmap( "new" ),
102 QString::null, 0, this, 0 ); 102 QString::null, 0, this, 0 );
103 connect( n, SIGNAL( activated() ), 103 connect( n, SIGNAL( activated() ),
104 this, SLOT( newConnection() ) ); 104 this, SLOT( newConnection() ) );
105 n->addTo( bar ); 105 n->addTo( bar );
106 106
107 QAction *o = new QAction( tr( "Open Bookmark" ), Resource::loadPixmap( "fileopen" ), 107 QAction *o = new QAction( tr( "Open Bookmark" ), Resource::loadPixmap( "fileopen" ),
108 QString::null, 0, this, 0 ); 108 QString::null, 0, this, 0 );
109 connect( o, SIGNAL( activated() ), 109 connect( o, SIGNAL( activated() ),
110 this, SLOT( openConnection() ) ); 110 this, SLOT( openConnection() ) );
111 o->addTo( bar ); 111 o->addTo( bar );
112 112
113 QAction *d = new QAction( tr( "Delete Bookmark" ), Resource::loadPixmap( "trash" ), 113 QAction *d = new QAction( tr( "Delete Bookmark" ), Resource::loadPixmap( "trash" ),
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
120KVNC::~KVNC() 120KVNC::~KVNC()
121{ 121{
122 122
123} 123}
124 124
125void KVNC::newConnection() 125void 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
139void KVNC::openConnection( QString name) 139void 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
155void KVNC::openConnection( void ) 155void KVNC::openConnection( void )
156{ 156{
157 openConnection( bookmarkSelector->selectedBookmark()); 157 openConnection( bookmarkSelector->selectedBookmark());
158} 158}
159 159
160void KVNC::openConnection( QListBoxItem * item) 160void KVNC::openConnection( QListBoxItem * item)
161{ 161{
162 openConnection(item->text()); 162 openConnection(item->text());
163} 163}
164 164
165void KVNC::setupActions() 165void KVNC::setupActions()
166{ 166{
167 cornerMenu = new QPopupMenu( this ); 167 cornerMenu = new QPopupMenu( this );
168 168
169 fullScreenAction = new QAction( tr("Full Screen"), QString::null, 0, 0 ); 169 fullScreenAction = new QAction( tr("Full Screen"), QString::null, 0, 0 );
170 connect( fullScreenAction, SIGNAL(activated()), 170 connect( fullScreenAction, SIGNAL(activated()),
171 this, SLOT( toggleFullScreen() ) ); 171 this, SLOT( toggleFullScreen() ) );
172 fullScreenAction->addTo( cornerMenu ); 172 fullScreenAction->addTo( cornerMenu );
173 fullScreenAction->setEnabled( false ); 173 fullScreenAction->setEnabled( false );
174 174
175 ctlAltDelAction = new QAction( tr("Send Contrl-Alt-Delete"), QString::null, 0, 0 ); 175 ctlAltDelAction = new QAction( tr("Send Contrl-Alt-Delete"), QString::null, 0, 0 );
176 connect( ctlAltDelAction, SIGNAL(activated()), 176 connect( ctlAltDelAction, SIGNAL(activated()),
177 canvas, SLOT( sendCtlAltDel() ) ); 177 canvas, SLOT( sendCtlAltDel() ) );
178 ctlAltDelAction->addTo( cornerMenu ); 178 ctlAltDelAction->addTo( cornerMenu );
179 ctlAltDelAction->setEnabled( false ); 179 ctlAltDelAction->setEnabled( false );
180 180
181 disconnectAction = new QAction( tr("Disconnect"), QString::null, 0, 0 ); 181 disconnectAction = new QAction( tr("Disconnect"), QString::null, 0, 0 );
182 connect( disconnectAction, SIGNAL(activated()), 182 connect( disconnectAction, SIGNAL(activated()),
183 this, SLOT( closeConnection() ) ); 183 this, SLOT( closeConnection() ) );
184 disconnectAction->addTo( cornerMenu ); 184 disconnectAction->addTo( cornerMenu );
185 disconnectAction->setEnabled( false ); 185 disconnectAction->setEnabled( false );
186 186
187 doubleClickAction = new QAction( tr("Next Click is Double Click"), QString::null, 0, 0 ); 187 doubleClickAction = new QAction( tr("Next Click is Double Click"), QString::null, 0, 0 );
188 connect( doubleClickAction, SIGNAL(activated()), 188 connect( doubleClickAction, SIGNAL(activated()),
189 canvas, SLOT( markDoubleClick() ) ); 189 canvas, SLOT( markDoubleClick() ) );
190 doubleClickAction->addTo( cornerMenu ); 190 doubleClickAction->addTo( cornerMenu );
191 doubleClickAction->setEnabled( false ); 191 doubleClickAction->setEnabled( false );
192 192
193 rightClickAction = new QAction( tr("Next Click is Right Click"), QString::null, 0, 0 ); 193 rightClickAction = new QAction( tr("Next Click is Right Click"), QString::null, 0, 0 );
194 connect( rightClickAction, SIGNAL(activated()), 194 connect( rightClickAction, SIGNAL(activated()),
195 canvas, SLOT( markRightClick() ) ); 195 canvas, SLOT( markRightClick() ) );
196 rightClickAction->addTo( cornerMenu ); 196 rightClickAction->addTo( cornerMenu );
197 rightClickAction->setEnabled( false ); 197 rightClickAction->setEnabled( false );
198} 198}
199 199
200void KVNC::toggleFullScreen() 200void KVNC::toggleFullScreen()
201{ 201{
202 if ( fullscreen ) { 202 if ( fullscreen ) {
203 canvas->releaseKeyboard(); 203 canvas->releaseKeyboard();
204 canvas->reparent( stack, 0, QPoint(0,0), false ); 204 canvas->reparent( stack, 0, QPoint(0,0), false );
205 canvas->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 205 canvas->setFrameStyle( QFrame::Panel | QFrame::Sunken );
206 setCentralWidget( stack ); 206 setCentralWidget( stack );
207 stack->addWidget(canvas,get_unique_id()); 207 stack->addWidget(canvas,get_unique_id());
208 stack->raiseWidget(canvas); 208 stack->raiseWidget(canvas);
209 canvas->show(); 209 canvas->show();
210 stack->show(); 210 stack->show();
211 fullScreenAction->setText( tr("Full Screen") ); 211 fullScreenAction->setText( tr("Full Screen") );
212 } else { 212 } else {
213 canvas->setFrameStyle( QFrame::NoFrame ); 213 canvas->setFrameStyle( QFrame::NoFrame );
214 stack->removeWidget(canvas); 214 stack->removeWidget(canvas);
215 canvas->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop, 215 canvas->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop,
216 QPoint(0,0),false); 216 QPoint(0,0),false);
217 canvas->resize(qApp->desktop()->width(), qApp->desktop()->height()); 217 canvas->resize(qApp->desktop()->width(), qApp->desktop()->height());
218 canvas->raise(); 218 canvas->raise();
219 canvas->setFocus(); 219 canvas->setFocus();
220 canvas->grabKeyboard(); 220 canvas->grabKeyboard();
221 canvas->show(); 221 canvas->show();
222 222
223 fullScreenAction->setText( tr("Stop Full Screen") ); 223 fullScreenAction->setText( tr("Stop Full Screen") );
224 } 224 }
225 225
226 226
227 fullscreen = !fullscreen; 227 fullscreen = !fullscreen;
228} 228}
229 229
230void KVNC::closeConnection() 230void KVNC::closeConnection()
231{ 231{
232 if ( fullscreen ) 232 if ( fullscreen )
233 toggleFullScreen(); 233 toggleFullScreen();
234 canvas->closeConnection(); 234 canvas->closeConnection();
235} 235}
236 236
237void KVNC::showMenu() 237void KVNC::showMenu()
238{ 238{
239 QPoint pt = mapToGlobal(cornerButton->pos()); 239 QPoint pt = mapToGlobal(cornerButton->pos());
240 QSize s = cornerMenu->sizeHint(); 240 QSize s = cornerMenu->sizeHint();
241 pt.ry() -= s.height(); 241 pt.ry() -= s.height();
242 pt.rx() -= s.width(); 242 pt.rx() -= s.width();
243 cornerMenu->popup( pt ); 243 cornerMenu->popup( pt );
244} 244}
245 245
246void KVNC::connected() 246void KVNC::connected()
247{ 247{
248 static QString msg = tr( "Connected to remote host" ); 248 static QString msg = tr( "Connected to remote host" );
249 statusMessage( msg ); 249 statusMessage( msg );
250 ctlAltDelAction->setEnabled(true); 250 ctlAltDelAction->setEnabled(true);
251 disconnectAction->setEnabled( true ); 251 disconnectAction->setEnabled( true );
252 fullScreenAction->setEnabled( true ); 252 fullScreenAction->setEnabled( true );
253 doubleClickAction->setEnabled( false ); 253 doubleClickAction->setEnabled( false );
254 rightClickAction->setEnabled( true ); 254 rightClickAction->setEnabled( true );
255 stack->raiseWidget(canvas); 255 stack->raiseWidget(canvas);
256 bar->hide(); 256 bar->hide();
257} 257}
258 258
259void KVNC::loggedIn() 259void KVNC::loggedIn()
260{ 260{
261 static QString msg = tr( "Logged in to remote host" ); 261 static QString msg = tr( "Logged in to remote host" );
262 statusMessage( msg ); 262 statusMessage( msg );
263} 263}
264 264
265void KVNC::disconnected() 265void KVNC::disconnected()
266{ 266{
267 267
268 if ( fullscreen ) 268 if ( fullscreen )
269 toggleFullScreen(); 269 toggleFullScreen();
270 static QString msg = tr( "Connection closed" ); 270 static QString msg = tr( "Connection closed" );
271 statusMessage( msg ); 271 statusMessage( msg );
272 ctlAltDelAction->setEnabled(false); 272 ctlAltDelAction->setEnabled(false);
273 disconnectAction->setEnabled( false ); 273 disconnectAction->setEnabled( false );
274 fullScreenAction->setEnabled( false ); 274 fullScreenAction->setEnabled( false );
275 doubleClickAction->setEnabled( false ); 275 doubleClickAction->setEnabled( false );
276 rightClickAction->setEnabled( false ); 276 rightClickAction->setEnabled( false );
277 stack->raiseWidget(bookmarkSelector); 277 stack->raiseWidget(bookmarkSelector);
278 bar->show(); 278 bar->show();
279} 279}
280 280
281void KVNC::statusMessage( const QString &m ) 281void KVNC::statusMessage( const QString &m )
282{ 282{
283 Global::statusMessage( m ); 283 Global::statusMessage( m );
284} 284}
285 285
286void KVNC::error( const QString &msg ) 286void KVNC::error( const QString &msg )
287{ 287{
288 statusMessage( msg ); 288 statusMessage( msg );
289 QMessageBox::warning( this, tr("VNC Viewer"), msg ); 289 QMessageBox::warning( this, tr("VNC Viewer"), msg );
290} 290}
291void KVNC::deleteBookmark(void) 291void KVNC::deleteBookmark(void)
292{ 292{
293 bookmarkSelector->deleteBookmark(bookmarkSelector->selectedBookmark()); 293 bookmarkSelector->deleteBookmark(bookmarkSelector->selectedBookmark());
294} 294}