Use KDialogBase.

svn path=/trunk/kdenetwork/krfb/; revision=349503
This commit is contained in:
Nadeem Hasan
2004-09-26 17:10:32 +00:00
parent 54a7625438
commit 3f01551a08
10 changed files with 341 additions and 403 deletions

View File

@@ -10,8 +10,8 @@ libkrfbconfig_la_LIBADD = ../srvloc/libsrvloc.la $(LIB_KDEUI)
bin_PROGRAMS = krfb
krfb_SOURCES = rfbcontroller.cc xupdatescanner.cc main.cpp \
newconnectiondialog.ui krfbifaceimpl.cc krfbiface.skel \
trayicon.cpp
connectionwidget.ui krfbifaceimpl.cc krfbiface.skel \
trayicon.cpp connectiondialog.cc
krfb_LDADD = libkrfbconfig.la ../libvncserver/libvncserver.la ../srvloc/libsrvloc.la -lXtst $(LIB_KDEUI) $(LIBJPEG)
krfb_LDFLAGS = $(all_libraries) $(KDE_RPATH)

63
krfb/connectiondialog.cc Normal file
View File

@@ -0,0 +1,63 @@
/* This file is part of the KDE project
Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "connectiondialog.h"
#include "connectionwidget.h"
#include <qcheckbox.h>
#include <qlabel.h>
#include <kiconloader.h>
#include <klocale.h>
ConnectionDialog::ConnectionDialog( QWidget *parent, const char *name )
: KDialogBase( parent, name, true, i18n( "New Connection" ),
Ok|Cancel, Cancel, true )
{
m_connectWidget = new ConnectionWidget( this, "ConnectWidget" );
m_connectWidget->pixmapLabel->setPixmap(
UserIcon( "connection-side-image.png" ) );
KGuiItem accept = KStdGuiItem::ok();
accept.setText( i18n( "Accept Connection" ) );
setButtonOK( accept );
KGuiItem refuse = KStdGuiItem::cancel();
refuse.setText( i18n( "Refuse Connection" ) );
setButtonCancel( refuse );
setMainWidget( m_connectWidget );
}
void ConnectionDialog::setRemoteHost( const QString &host )
{
m_connectWidget->remoteHost->setText( host );
}
void ConnectionDialog::setAllowRemoteControl( bool b )
{
m_connectWidget->cbAllowRemoteControl->setChecked( b );
}
bool ConnectionDialog::allowRemoteControl()
{
return m_connectWidget->cbAllowRemoteControl->isChecked();
}
#include "connectiondialog.moc"

44
krfb/connectiondialog.h Normal file
View File

@@ -0,0 +1,44 @@
/* This file is part of the KDE project
Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef CONNECTIONDIALOG_H
#define CONNECTIONDIALOG_H
#include <kdialogbase.h>
class ConnectionWidget;
class ConnectionDialog : public KDialogBase
{
Q_OBJECT
public:
ConnectionDialog( QWidget *parent, const char *name );
~ConnectionDialog() {};
void setRemoteHost( const QString &host );
void setAllowRemoteControl( bool b );
bool allowRemoteControl();
protected:
ConnectionWidget *m_connectWidget;
};
#endif // CONNECTIONDIALOG_H

214
krfb/connectionwidget.ui Normal file
View File

@@ -0,0 +1,214 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionWidget</class>
<widget class="QWidget">
<property name="name">
<cstring>NewConnectWidget</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>521</width>
<height>328</height>
</rect>
</property>
<property name="caption">
<string>NewConnectWidget</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="QLabel" row="0" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>TextLabel5</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>13</pointsize>
<bold>1</bold>
</font>
</property>
<property name="text">
<string>Attention</string>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
<widget class="QLabel" row="1" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>mainTextLabel</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="lineWidth">
<number>-1</number>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="midLineWidth">
<number>5</number>
</property>
<property name="text">
<string>Somebody is requesting a connection to your computer. Granting this will allow the remote user to watch your desktop. </string>
</property>
<property name="textFormat">
<enum>AutoText</enum>
</property>
<property name="alignment">
<set>WordBreak|AlignVCenter|AlignLeft</set>
</property>
<property name="indent">
<number>0</number>
</property>
<property name="wordwrap" stdset="0">
</property>
</widget>
<widget class="QLabel" row="0" column="0" rowspan="6" colspan="1">
<property name="name">
<cstring>pixmapLabel</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>108</width>
<height>318</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>108</width>
<height>318</height>
</size>
</property>
<property name="frameShape">
<enum>WinPanel</enum>
</property>
<property name="frameShadow">
<enum>Sunken</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
<widget class="QLabel" row="3" column="2">
<property name="name">
<cstring>remoteHost</cstring>
</property>
<property name="font">
<font>
<bold>1</bold>
</font>
</property>
<property name="text">
<string>123.234.123.234</string>
</property>
</widget>
<widget class="QCheckBox" row="5" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>cbAllowRemoteControl</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Allow remote user to &amp;control keyboard and mouse</string>
</property>
<property name="accel">
<string>Alt+C</string>
</property>
<property name="whatsThis" stdset="0">
<string>If you turn this option on, the remote user can enter keystrokes and use your mouse pointer. This gives them full control over your computer, so be careful. When the option is disabled the remote user can only watch your screen.</string>
</property>
</widget>
<widget class="QLabel" row="3" column="1">
<property name="name">
<cstring>TextLabel1</cstring>
</property>
<property name="font">
<font>
<bold>1</bold>
</font>
</property>
<property name="text">
<string>Remote system:</string>
</property>
</widget>
<spacer row="4" column="1">
<property name="name">
<cstring>spacer23</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Minimum</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>84</height>
</size>
</property>
</spacer>
<spacer row="2" column="1">
<property name="name">
<cstring>spacer22</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Minimum</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>80</height>
</size>
</property>
</spacer>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View File

@@ -13,7 +13,7 @@
</rect>
</property>
<property name="caption">
<string>InviteWidget</string>
<string></string>
</property>
<grid>
<property name="name">
@@ -22,9 +22,6 @@
<property name="margin">
<number>0</number>
</property>
<property name="resizeMode">
<enum>Fixed</enum>
</property>
<widget class="QLabel" row="0" column="1" rowspan="1" colspan="3">
<property name="name">
<cstring>TextLabel2</cstring>

File diff suppressed because one or more lines are too long

View File

@@ -17,21 +17,22 @@
Boston, MA 02111-1307, USA.
*/
#include <qlabel.h>
#include <kiconloader.h>
#include <klocale.h>
#include "personalinvitedialog.h"
#include "personalinvitewidget.h"
#include <qlabel.h>
#include <kactivelabel.h>
#include <kiconloader.h>
#include <klocale.h>
PersonalInviteDialog::PersonalInviteDialog( QWidget *parent, const char *name )
: KDialogBase( parent, name, true, i18n( "Personal Invitation" ),
Close, Close, true )
{
m_inviteWidget = new PersonalInviteWidget( this, "PersonalInviteWidget" );
m_inviteWidget->pixmapLabel->setPixmap(
UserIcon( "connection-side-image.png" ) );
UserIcon( "connection-side-image.png" ) );
setMainWidget( m_inviteWidget );
}

View File

@@ -110,7 +110,7 @@ Give the information below to the person that you want to invite (&lt;a href="wh
</size>
</property>
</spacer>
<widget class="QLabel" row="2" column="2">
<widget class="KActiveLabel" row="2" column="2">
<property name="name">
<cstring>hostLabel</cstring>
</property>
@@ -158,7 +158,7 @@ Give the information below to the person that you want to invite (&lt;a href="wh
<string>&lt;b&gt;Expiration time:&lt;/b&gt;</string>
</property>
</widget>
<widget class="QLabel" row="3" column="2">
<widget class="KActiveLabel" row="3" column="2">
<property name="name">
<cstring>passwordLabel</cstring>
</property>
@@ -174,7 +174,7 @@ Give the information below to the person that you want to invite (&lt;a href="wh
<string>12345</string>
</property>
</widget>
<widget class="QLabel" row="4" column="2">
<widget class="KActiveLabel" row="4" column="2">
<property name="name">
<cstring>expirationLabel</cstring>
</property>

View File

@@ -170,12 +170,6 @@ static void clipboardHook(char* str,int len, rfbClientPtr)
self->clipboardToServer(QString::fromUtf8(str, len));
}
void ConnectionDialog::closeEvent(QCloseEvent *)
{
emit closed();
}
VNCEvent::~VNCEvent() {
}
@@ -351,23 +345,19 @@ void SessionEstablishedEvent::exec() {
controller->sendSessionEstablished();
}
RFBController::RFBController(Configuration *c) :
allowDesktopControl(false),
lastClipboardDirection(LAST_SYNC_TO_SERVER),
configuration(c),
dialog( 0, "ConnectionDialog" ),
disableBackgroundPending(false),
disableBackgroundState(false),
closePending(false),
forcedClose(false)
{
self = this;
connect(dialog.acceptConnectionButton, SIGNAL(clicked()),
SLOT(dialogAccepted()));
connect(dialog.refuseConnectionButton, SIGNAL(clicked()),
SLOT(dialogRefused()));
connect(&dialog, SIGNAL(closed()), SLOT(dialogRefused()));
connect(&dialog, SIGNAL(okClicked()), SLOT(dialogAccepted()));
connect(&dialog, SIGNAL(cancelClicked()), SLOT(dialogRefused()));
connect(&initIdleTimer, SIGNAL(timeout()), SLOT(checkAsyncEvents()));
connect(&idleTimer, SIGNAL(timeout()), SLOT(idleSlot()));
@@ -647,7 +637,7 @@ void RFBController::idleSlot()
void RFBController::dialogAccepted()
{
dialog.hide();
acceptConnection(dialog.allowRemoteControlCB->isChecked());
acceptConnection(dialog.allowRemoteControl());
}
void RFBController::dialogRefused()
@@ -769,8 +759,8 @@ enum rfbNewClientAction RFBController::handleNewClient(rfbClientPtr cl)
i18n("Received connection from %1, on hold (waiting for confirmation)")
.arg(remoteIp));
dialog.ipLabel->setText(remoteIp);
dialog.allowRemoteControlCB->setChecked(true);
dialog.setRemoteHost(remoteIp);
dialog.setAllowRemoteControl( true );
dialog.setFixedSize(dialog.sizeHint());
dialog.show();
return RFB_CLIENT_ON_HOLD;

View File

@@ -24,7 +24,7 @@
#define RFBCONTROLLER_H
#include "configuration.h"
#include "newconnectiondialog.h"
#include "connectiondialog.h"
#include "xupdatescanner.h"
#include <ksock.h>
#include <qobject.h>
@@ -49,15 +49,6 @@ typedef enum {
RFB_CONNECTED
} RFBState;
class ConnectionDialog : public KRFBConnectionDialog {
Q_OBJECT
public:
virtual void closeEvent(QCloseEvent *);
signals:
void closed();
};
class VNCEvent {
public:
virtual void exec() = 0;