summaryrefslogtreecommitdiff
path: root/noncore/comm/keypebble/kvnc.cpp
Unidiff
Diffstat (limited to 'noncore/comm/keypebble/kvnc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/comm/keypebble/kvnc.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/noncore/comm/keypebble/kvnc.cpp b/noncore/comm/keypebble/kvnc.cpp
index c678edf..88cb50b 100644
--- a/noncore/comm/keypebble/kvnc.cpp
+++ b/noncore/comm/keypebble/kvnc.cpp
@@ -1,164 +1,164 @@
1#include <qaction.h> 1#include <qaction.h>
2#include <qpopupmenu.h> 2#include <qpopupmenu.h>
3#include <qpushbutton.h> 3#include <qpushbutton.h>
4#include <qmessagebox.h> 4#include <qmessagebox.h>
5#include <qlistbox.h> 5#include <qlistbox.h>
6#include <qpe/qpeapplication.h> 6#include <qpe/qpeapplication.h>
7#include <qpe/resource.h> 7#include <qpe/resource.h>
8 8
9#include <assert.h> 9#include <assert.h>
10 10
11#include "kvnc.h" 11#include "kvnc.h"
12#include "krfbcanvas.h" 12#include "krfbcanvas.h"
13#include "krfbconnection.h" 13#include "krfbconnection.h"
14#include "kvncconndlg.h" 14#include "kvncconndlg.h"
15 15
16static int u_id = 1; 16static int u_id = 1;
17static int get_unique_id() 17static int get_unique_id()
18{ 18{
19 return u_id++; 19 return u_id++;
20} 20}
21 21
22 22
23/* XPM */ 23/* XPM */
24static char * menu_xpm[] = { 24static char * menu_xpm[] = {
25"12 12 5 1", 25"12 12 5 1",
26 " c None", 26 " c None",
27 ".c #000000", 27 ".c #000000",
28 "+c #FFFDAD", 28 "+c #FFFDAD",
29 "@c #FFFF00", 29 "@c #FFFF00",
30 "#c #E5E100", 30 "#c #E5E100",
31" ", 31" ",
32" ", 32" ",
33" ......... ", 33" ......... ",
34" .+++++++. ", 34" .+++++++. ",
35" .+@@@@#. ", 35" .+@@@@#. ",
36" .+@@@#. ", 36" .+@@@#. ",
37" .+@@#. ", 37" .+@@#. ",
38" .+@#. ", 38" .+@#. ",
39" .+#. ", 39" .+#. ",
40" .+. ", 40" .+. ",
41" .. ", 41" .. ",
42" "}; 42" "};
43 43
44const int StatusTextId = 0; 44const int StatusTextId = 0;
45 45
46KVNC::KVNC( QWidget *parent, const char *name, WFlags f) : QMainWindow( 0, name ,WStyle_ContextHelp) 46KVNC::KVNC( QWidget *parent, const char *name, WFlags f) : QMainWindow( 0, name ,WStyle_ContextHelp)
47{ 47{
48 setCaption( tr("VNC Viewer") ); 48 setCaption( tr("VNC Viewer") );
49 fullscreen = false; 49 fullscreen = false;
50 50
51 stack = new QWidgetStack( this ); 51 stack = new QWidgetStack( this );
52 setCentralWidget( stack ); 52 setCentralWidget( stack );
53 53
54 bookmarkSelector=new KVNCBookmarkDlg(); 54 bookmarkSelector=new KVNCBookmarkDlg();
55 stack->addWidget(bookmarkSelector,get_unique_id()); 55 stack->addWidget(bookmarkSelector,get_unique_id());
56 stack->raiseWidget( bookmarkSelector ); 56 stack->raiseWidget( bookmarkSelector );
57 57
58 canvas = new KRFBCanvas( stack, "canvas" ); 58 canvas = new KRFBCanvas( stack, "canvas" );
59 stack->addWidget(canvas,get_unique_id()); 59 stack->addWidget(canvas,get_unique_id());
60 setCentralWidget( stack ); 60 setCentralWidget( stack );
61 61
62 62
63 connect( bookmarkSelector->bookmarkList, SIGNAL(clicked(QListBoxItem *)), 63 connect( bookmarkSelector->bookmarkList, SIGNAL(clicked(QListBoxItem*)),
64 this, SLOT(openConnection(QListBoxItem *)) ); 64 this, SLOT(openConnection(QListBoxItem*)) );
65 connect( canvas->connection(), SIGNAL(statusChanged(const QString &)), 65 connect( canvas->connection(), SIGNAL(statusChanged(const QString&)),
66 this, SLOT(statusMessage(const QString &)) ); 66 this, SLOT(statusMessage(const QString&)) );
67 connect( canvas->connection(), SIGNAL(error(const QString &)), 67 connect( canvas->connection(), SIGNAL(error(const QString&)),
68 this, SLOT(error(const QString &)) ); 68 this, SLOT(error(const QString&)) );
69 connect( canvas->connection(), SIGNAL(connected()), this, SLOT(connected()) ); 69 connect( canvas->connection(), SIGNAL(connected()), this, SLOT(connected()) );
70 connect( canvas->connection(), SIGNAL(loggedIn()), this, SLOT(loggedIn()) ); 70 connect( canvas->connection(), SIGNAL(loggedIn()), this, SLOT(loggedIn()) );
71 connect( canvas->connection(), SIGNAL(disconnected()), this, SLOT(disconnected()) ); 71 connect( canvas->connection(), SIGNAL(disconnected()), this, SLOT(disconnected()) );
72 72
73 setupActions(); 73 setupActions();
74 74
75 cornerButton = new QPushButton( this ); 75 cornerButton = new QPushButton( this );
76 cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); 76 cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) );
77 connect( cornerButton, SIGNAL(pressed()), this, SLOT(showMenu()) ); 77 connect( cornerButton, SIGNAL(pressed()), this, SLOT(showMenu()) );
78 canvas->setCornerWidget( cornerButton ); 78 canvas->setCornerWidget( cornerButton );
79 79
80 stack->raiseWidget( bookmarkSelector ); 80 stack->raiseWidget( bookmarkSelector );
81 81
82 82
83 bar= new QToolBar( this ); 83 bar= new QToolBar( this );
84 setToolBarsMovable( false ); 84 setToolBarsMovable( false );
85 setRightJustification(false); 85 setRightJustification(false);
86 86
87 87
88 QAction *n = new QAction( tr( "New Connection" ), Resource::loadPixmap( "new" ), 88 QAction *n = new QAction( tr( "New Connection" ), Resource::loadPixmap( "new" ),
89 QString::null, 0, this, 0 ); 89 QString::null, 0, this, 0 );
90 connect( n, SIGNAL( activated() ), 90 connect( n, SIGNAL( activated() ),
91 this, SLOT( newConnection() ) ); 91 this, SLOT( newConnection() ) );
92 n->addTo( bar ); 92 n->addTo( bar );
93 93
94 QAction *o = new QAction( tr( "Open Bookmark" ), Resource::loadPixmap( "fileopen" ), 94 QAction *o = new QAction( tr( "Open Bookmark" ), Resource::loadPixmap( "fileopen" ),
95 QString::null, 0, this, 0 ); 95 QString::null, 0, this, 0 );
96 connect( o, SIGNAL( activated() ), 96 connect( o, SIGNAL( activated() ),
97 this, SLOT( openConnection() ) ); 97 this, SLOT( openConnection() ) );
98 o->addTo( bar ); 98 o->addTo( bar );
99 99
100 QAction *d = new QAction( tr( "Delete Bookmark" ), Resource::loadPixmap( "trash" ), 100 QAction *d = new QAction( tr( "Delete Bookmark" ), Resource::loadPixmap( "trash" ),
101 QString::null, 0, this, 0 ); 101 QString::null, 0, this, 0 );
102 connect( d, SIGNAL( activated() ), 102 connect( d, SIGNAL( activated() ),
103 this, SLOT( deleteBookmark() ) ); 103 this, SLOT( deleteBookmark() ) );
104 d->addTo( bar ); 104 d->addTo( bar );
105} 105}
106 106
107KVNC::~KVNC() 107KVNC::~KVNC()
108{ 108{
109 109
110} 110}
111 111
112void KVNC::newConnection() 112void KVNC::newConnection()
113{ 113{
114 curServer=new KRFBServer; 114 curServer=new KRFBServer;
115 115
116 KVNCConnDlg dlg( curServer,this); 116 KVNCConnDlg dlg( curServer,this);
117 if ( QPEApplication::execDialog( &dlg )) { 117 if ( QPEApplication::execDialog( &dlg )) {
118 if (!curServer->name.isEmpty()) 118 if (!curServer->name.isEmpty())
119 bookmarkSelector->addBookmark(curServer); 119 bookmarkSelector->addBookmark(curServer);
120 canvas->openConnection(*curServer); 120 canvas->openConnection(*curServer);
121 } else 121 } else
122 curServer=0; 122 curServer=0;
123} 123}
124 124
125void KVNC::openConnection( QString name) 125void KVNC::openConnection( QString name)
126{ 126{
127 curServer=bookmarkSelector->getServer(name); 127 curServer=bookmarkSelector->getServer(name);
128 128
129 if (curServer) { 129 if (curServer) {
130 KVNCConnDlg dlg( curServer,this); 130 KVNCConnDlg dlg( curServer,this);
131 if ( QPEApplication::execDialog( &dlg ) ) { 131 if ( QPEApplication::execDialog( &dlg ) ) {
132 canvas->openConnection(*curServer); 132 canvas->openConnection(*curServer);
133 bookmarkSelector->writeBookmarks(); 133 bookmarkSelector->writeBookmarks();
134 } else 134 } else
135 curServer=0; 135 curServer=0;
136 } 136 }
137} 137}
138 138
139void KVNC::openConnection( void ) 139void KVNC::openConnection( void )
140{ 140{
141 openConnection( bookmarkSelector->selectedBookmark()); 141 openConnection( bookmarkSelector->selectedBookmark());
142} 142}
143 143
144void KVNC::openConnection( QListBoxItem * item) 144void KVNC::openConnection( QListBoxItem * item)
145{ 145{
146 if (item) 146 if (item)
147 openConnection(item->text()); 147 openConnection(item->text());
148} 148}
149 149
150void KVNC::setupActions() 150void KVNC::setupActions()
151{ 151{
152 cornerMenu = new QPopupMenu( this ); 152 cornerMenu = new QPopupMenu( this );
153 153
154 fullScreenAction = new QAction( tr("Full Screen"), QString::null, 0, 0 ); 154 fullScreenAction = new QAction( tr("Full Screen"), QString::null, 0, 0 );
155 connect( fullScreenAction, SIGNAL(activated()), 155 connect( fullScreenAction, SIGNAL(activated()),
156 this, SLOT( toggleFullScreen() ) ); 156 this, SLOT( toggleFullScreen() ) );
157 fullScreenAction->addTo( cornerMenu ); 157 fullScreenAction->addTo( cornerMenu );
158 fullScreenAction->setEnabled( false ); 158 fullScreenAction->setEnabled( false );
159 159
160 ctlAltDelAction = new QAction( tr("Send Contrl-Alt-Delete"), QString::null, 0, 0 ); 160 ctlAltDelAction = new QAction( tr("Send Contrl-Alt-Delete"), QString::null, 0, 0 );
161 connect( ctlAltDelAction, SIGNAL(activated()), 161 connect( ctlAltDelAction, SIGNAL(activated()),
162 canvas, SLOT( sendCtlAltDel() ) ); 162 canvas, SLOT( sendCtlAltDel() ) );
163 ctlAltDelAction->addTo( cornerMenu ); 163 ctlAltDelAction->addTo( cornerMenu );
164 ctlAltDelAction->setEnabled( false ); 164 ctlAltDelAction->setEnabled( false );