summaryrefslogtreecommitdiff
path: root/noncore/comm/keypebble/kvnc.cpp
authortreke <treke>2002-09-04 17:53:12 (UTC)
committer treke <treke>2002-09-04 17:53:12 (UTC)
commit605d854057eb470a1d75210193b82eb0b1ad6b53 (patch) (side-by-side diff)
treec411b661d5211fefbd83a7c8f63eef8c9cca72ee /noncore/comm/keypebble/kvnc.cpp
parentc35a5eabd8f5ed18e4216f6c88ee6794bacfb491 (diff)
downloadopie-605d854057eb470a1d75210193b82eb0b1ad6b53.zip
opie-605d854057eb470a1d75210193b82eb0b1ad6b53.tar.gz
opie-605d854057eb470a1d75210193b82eb0b1ad6b53.tar.bz2
Major modifications to the User Interface
1) Bookmark support added, all options are stored on a per bookmark basis 2) 16 Bit color is now a supported bit depth for the server
Diffstat (limited to 'noncore/comm/keypebble/kvnc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/comm/keypebble/kvnc.cpp168
1 files changed, 125 insertions, 43 deletions
diff --git a/noncore/comm/keypebble/kvnc.cpp b/noncore/comm/keypebble/kvnc.cpp
index 43cffc5..aa46e2f 100644
--- a/noncore/comm/keypebble/kvnc.cpp
+++ b/noncore/comm/keypebble/kvnc.cpp
@@ -12,4 +12,10 @@
#include <qmessagebox.h>
+#include <qspinbox.h>
+#include <qlistbox.h>
+#include <qlineedit.h>
#include <qpe/qpeapplication.h>
#include <qpe/global.h>
+#include <qpe/qpetoolbar.h>
+#include <qpe/resource.h>
+
#include <assert.h>
@@ -18,4 +24,11 @@
#include "krfbcanvas.h"
-#include "kvncoptionsdlg.h"
#include "krfbconnection.h"
+#include "kvncconndlg.h"
+#include "krfbserver.h"
+
+static int u_id = 1;
+static int get_unique_id()
+{
+ return u_id++;
+}
@@ -50,5 +63,15 @@ KVNC::KVNC( const char *name ) : QMainWindow( 0, name )
- canvas = new KRFBCanvas( this, "canvas" );
- setCentralWidget( canvas );
+ stack = new QWidgetStack( this );
+ setCentralWidget( stack );
+ bookmarkSelector=new KVNCBookmarkDlg();
+ stack->addWidget(bookmarkSelector,get_unique_id());
+ stack->raiseWidget( bookmarkSelector );
+
+ canvas = new KRFBCanvas( stack, "canvas" );
+ stack->addWidget(canvas,get_unique_id());
+ setCentralWidget( stack );
+
+ connect( bookmarkSelector->bookmarkList, SIGNAL(doubleClicked(QListBoxItem *)),
+ this, SLOT(openConnection(QListBoxItem *)) );
connect( canvas->connection(), SIGNAL(statusChanged(const QString &)),
@@ -68,3 +91,24 @@ KVNC::KVNC( const char *name ) : QMainWindow( 0, name )
- QTimer::singleShot( 0, canvas, SLOT(openConnection()) );
+ stack->raiseWidget( bookmarkSelector );
+
+
+ QPEToolBar *bar = new QPEToolBar( this );
+
+ QAction *n = new QAction( tr( "New Connection" ), Resource::loadPixmap( "new" ),
+ QString::null, 0, this, 0 );
+ connect( n, SIGNAL( activated() ),
+ this, SLOT( newConnection() ) );
+ n->addTo( bar );
+
+ QAction *o = new QAction( tr( "Open Bookmark" ), Resource::loadPixmap( "edit" ),
+ QString::null, 0, this, 0 );
+ connect( o, SIGNAL( activated() ),
+ this, SLOT( openConnection() ) );
+ o->addTo( bar );
+
+ QAction *d = new QAction( tr( "Delete Bookmark" ), Resource::loadPixmap( "trash" ),
+ QString::null, 0, this, 0 );
+ connect( d, SIGNAL( activated() ),
+ this, SLOT( deleteBookmark() ) );
+ d->addTo( bar );
}
@@ -73,7 +117,43 @@ KVNC::~KVNC()
{
+
+}
+
+void KVNC::newConnection()
+{
+ curServer=new KRFBServer;
+
+ KVNCConnDlg dlg( curServer,this);
+ dlg.showMaximized();
+ if ( dlg.exec()) {
+ if (!curServer->name.isEmpty())
+ bookmarkSelector->addBookmark(curServer);
+ canvas->openConnection(*curServer);
+ } else
+ curServer=0;
+}
+
+void KVNC::openConnection( QString name)
+{
+ curServer=bookmarkSelector->getServer(name);
+
+ if (curServer) {
+ KVNCConnDlg dlg( curServer,this);
+ dlg.showMaximized();
+
+ if ( dlg.exec() ) {
+ canvas->openConnection(*curServer);
+ bookmarkSelector->writeBookmarks();
+ } else
+ curServer=0;
+ }
+}
+
+void KVNC::openConnection( void )
+{
+ openConnection( bookmarkSelector->selectedBookmark());
}
-void KVNC::openURL( const QUrl &url )
+void KVNC::openConnection( QListBoxItem * item)
{
- canvas->openURL( url );
+ openConnection(item->text());
}
@@ -90,10 +170,7 @@ void KVNC::setupActions()
- optionsAction = new QAction( tr("Settings"), QString::null, 0, 0 );
- connect( optionsAction, SIGNAL(activated()), this, SLOT( showOptions() ) );
- optionsAction->addTo( cornerMenu );
-
- connectAction = new QAction( tr("Connect..."), QString::null, 0, 0 );
- connect( connectAction, SIGNAL(activated()),
- canvas, SLOT( openConnection() ) );
- connectAction->addTo( cornerMenu );
+ ctlAltDelAction = new QAction( tr("Send Contrl-Alt-Delete"), QString::null, 0, 0 );
+ connect( ctlAltDelAction, SIGNAL(activated()),
+ canvas, SLOT( sendCtlAltDel() ) );
+ ctlAltDelAction->addTo( cornerMenu );
+ ctlAltDelAction->setEnabled( false );
@@ -108,22 +185,27 @@ void KVNC::toggleFullScreen()
{
- if ( fullscreen ) {
- canvas->releaseKeyboard();
- canvas->reparent( this, 0, QPoint(0,0), false );
- canvas->setFrameStyle( QFrame::Panel | QFrame::Sunken );
- setCentralWidget( canvas );
- canvas->show();
- fullScreenAction->setText( tr("Full Screen") );
- } else {
- canvas->setFrameStyle( QFrame::NoFrame );
- canvas->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop,
- QPoint(0,0),false);
- canvas->resize(qApp->desktop()->width(), qApp->desktop()->height());
- canvas->raise();
- canvas->setFocus();
- canvas->grabKeyboard();
- canvas->show();
-
- fullScreenAction->setText( tr("Stop Full Screen") );
- }
-
+ if ( fullscreen ) {
+ canvas->releaseKeyboard();
+ canvas->reparent( stack, 0, QPoint(0,0), false );
+ canvas->setFrameStyle( QFrame::Panel | QFrame::Sunken );
+ setCentralWidget( stack );
+ stack->addWidget(canvas,get_unique_id());
+ stack->raiseWidget(canvas);
+ canvas->show();
+ stack->show();
+ fullScreenAction->setText( tr("Full Screen") );
+ } else {
+ canvas->setFrameStyle( QFrame::NoFrame );
+ stack->removeWidget(canvas);
+ canvas->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop,
+ QPoint(0,0),false);
+ canvas->resize(qApp->desktop()->width(), qApp->desktop()->height());
+ canvas->raise();
+ canvas->setFocus();
+ canvas->grabKeyboard();
+ canvas->show();
+
+ fullScreenAction->setText( tr("Stop Full Screen") );
+ }
+
+
fullscreen = !fullscreen;
@@ -151,5 +233,6 @@ void KVNC::connected()
statusMessage( msg );
- connectAction->setEnabled( false );
+ ctlAltDelAction->setEnabled(true);
disconnectAction->setEnabled( true );
fullScreenAction->setEnabled( true );
+ stack->raiseWidget(canvas);
}
@@ -164,7 +247,11 @@ void KVNC::disconnected()
{
+
+ if ( fullscreen )
+ toggleFullScreen();
static QString msg = tr( "Connection closed" );
statusMessage( msg );
- connectAction->setEnabled( true );
+ ctlAltDelAction->setEnabled(false);
disconnectAction->setEnabled( false );
fullScreenAction->setEnabled( false );
+ stack->raiseWidget(bookmarkSelector);
}
@@ -181,10 +268,5 @@ void KVNC::error( const QString &msg )
}
-
-void KVNC::showOptions()
+void KVNC::deleteBookmark(void)
{
- KVNCOptionsDlg *wdg = new KVNCOptionsDlg( canvas->connection()->options(), this );
- wdg->showMaximized();
- wdg->exec();
- delete wdg;
+ bookmarkSelector->deleteBookmark(bookmarkSelector->selectedBookmark());
}
-