porting to KDE4/Refactoring of krfb

- remove kinetd dependency
- implement internal TCP server
- reorganization of dialog (unfinished)
- removed dcop/qdbus interface for now, will see if it's needed in the future or not
- porting of dialogs to uic4 (unfinished)

svn path=/trunk/KDE/kdenetwork/krfb/; revision=647907
This commit is contained in:
Alessandro Praduroux
2007-03-29 20:54:53 +00:00
parent 67684a17e9
commit 48226e5c79
18 changed files with 1221 additions and 189 deletions

View File

@@ -3,22 +3,29 @@ project(krfb)
include_directories(${CMAKE_SOURCE_DIR}/krfb/libvncserver ${CMAKE_SOURCE_DIR}/krfb/srvloc)
set(krfb_SRCS ${vncserver_SRCS} ${srvloc_SRCS} ${krfbconfig_SRCS}
rfbcontroller.cc
xupdatescanner.cc
##set(krfb_SRCS ${vncserver_SRCS} ${srvloc_SRCS} ${krfbconfig_SRCS}
set(krfb_SRCS ${vncserver_SRCS}
# rfbcontroller.cc
# xupdatescanner.cc
main.cpp
krfbifaceimpl.cc
trayicon.cpp
connectiondialog.cc)
connectiondialog.cc
krfbserver.cpp
manageinvitationsdialog.cpp
invitedialog.cc
invitation.cc
connectiondialog.cc
personalinvitedialog.cc
)
qt4_add_dbus_adaptor(krfb_SRCS org.kde.krfb.xml krfbifaceimpl.h KRfbIfaceImpl)
## qt4_add_dbus_adaptor(krfb_SRCS org.kde.krfb.xml krfbifaceimpl.h KRfbIfaceImpl)
kde4_automoc(${krfb_SRCS})
kde4_add_ui3_files(krfb_SRCS connectionwidget.ui
manageinvitations.ui
personalinvitewidget.ui
invitewidget.ui)
kde4_add_ui_files(krfb_SRCS rfbconnectionwidget.ui
rfbmanageinvitations.ui
rfbpersonalinvitewidget.ui
rfbinvitewidget.ui)
kde4_add_executable(krfb ${krfb_SRCS})

View File

@@ -18,7 +18,6 @@
*/
#include "connectiondialog.h"
#include "connectionwidget.h"
#include <qcheckbox.h>
#include <qlabel.h>
@@ -35,8 +34,10 @@ ConnectionDialog::ConnectionDialog( QWidget *parent )
setDefaultButton(Cancel);
setModal(true);
m_connectWidget = new ConnectionWidget( this, "ConnectWidget" );
m_connectWidget->pixmapLabel->setPixmap(
m_connectWidget = new QWidget( this );
setupUi(m_connectWidget);
pixmapLabel->setPixmap(
UserIcon( "connection-side-image.png" ) );
KGuiItem accept = KStandardGuiItem::ok();
@@ -52,17 +53,17 @@ ConnectionDialog::ConnectionDialog( QWidget *parent )
void ConnectionDialog::setRemoteHost( const QString &host )
{
m_connectWidget->remoteHost->setText( host );
remoteHost->setText( host );
}
void ConnectionDialog::setAllowRemoteControl( bool b )
{
m_connectWidget->cbAllowRemoteControl->setChecked( b );
cbAllowRemoteControl->setChecked( b );
}
bool ConnectionDialog::allowRemoteControl()
{
return m_connectWidget->cbAllowRemoteControl->isChecked();
return cbAllowRemoteControl->isChecked();
}
#include "connectiondialog.moc"

View File

@@ -21,10 +21,11 @@
#define CONNECTIONDIALOG_H
#include <KDialog>
#include "ui_rfbconnectionwidget.h"
class ConnectionWidget;
class QWidget;
class ConnectionDialog : public KDialog
class ConnectionDialog : public KDialog, public Ui::ConnectionWidget
{
Q_OBJECT
@@ -37,7 +38,7 @@ class ConnectionDialog : public KDialog
bool allowRemoteControl();
protected:
ConnectionWidget *m_connectWidget;
QWidget *m_connectWidget;
};
#endif // CONNECTIONDIALOG_H

View File

@@ -18,7 +18,6 @@
*/
#include "invitedialog.h"
#include "invitewidget.h"
#include <kiconloader.h>
#include <klocale.h>
@@ -26,6 +25,8 @@
#include <qlabel.h>
#include <qpushbutton.h>
#include <QToolTip>
#include <QCursor>
InviteDialog::InviteDialog( QWidget *parent )
: KDialog( parent )
@@ -35,19 +36,23 @@ InviteDialog::InviteDialog( QWidget *parent )
setDefaultButton(NoDefault);
setModal(true);
m_inviteWidget = new InviteWidget( this, "InviteWidget" );
m_inviteWidget->pixmapLabel->setPixmap(
m_inviteWidget = new QWidget( this );
setupUi(m_inviteWidget);
pixmapLabel->setPixmap(
UserIcon( "connection-side-image.png" ) );
setMainWidget( m_inviteWidget );
setButtonGuiItem( User1, KStandardGuiItem::configure() );
connect( m_inviteWidget->btnCreateInvite, SIGNAL( clicked() ),
connect( btnCreateInvite, SIGNAL( clicked() ),
SIGNAL( createInviteClicked() ) );
connect( m_inviteWidget->btnEmailInvite, SIGNAL( clicked() ),
connect( btnEmailInvite, SIGNAL( clicked() ),
SIGNAL( emailInviteClicked() ) );
connect( m_inviteWidget->btnManageInvite, SIGNAL( clicked() ),
connect( btnManageInvite, SIGNAL( clicked() ),
SIGNAL( manageInviteClicked() ) );
connect( helpLabel, SIGNAL( linkActivated ( QString ) ),
SLOT( showWhatsthis() ));
}
void InviteDialog::slotUser1()
@@ -57,13 +62,25 @@ void InviteDialog::slotUser1()
void InviteDialog::enableInviteButton( bool enable )
{
m_inviteWidget->btnCreateInvite->setEnabled( enable );
btnCreateInvite->setEnabled( enable );
}
void InviteDialog::setInviteCount( int count )
{
m_inviteWidget->btnManageInvite->setText(
btnManageInvite->setText(
i18n( "&Manage Invitations (%1)...", count ) );
}
void InviteDialog::showWhatsthis()
{
QToolTip::showText(QCursor::pos(),
i18n("An invitation creates a one-time password that allows the receiver to connect to your desktop.\n"
"It is valid for only one successful connection and will expire after an hour if it has not been used. \n"
"When somebody connects to your computer a dialog will appear and ask you for permission.\n "
"The connection will not be established before you accept it. In this dialog you can also\n restrict "
"the other person to view your desktop only, without the ability to move your\n mouse pointer or press "
"keys.\nIf you want to create a permanent password for Desktop Sharing, allow 'Uninvited Connections' \n"
"in the configuration."));
}
#include "invitedialog.moc"

View File

@@ -20,11 +20,13 @@
#ifndef INVITEDIALOG_H
#define INVITEDIALOG_H
class InviteWidget;
#include "ui_rfbinvitewidget.h"
#include <KDialog>
class InviteDialog : public KDialog
class QWidget;
class InviteDialog : public KDialog, public Ui::InviteWidget
{
Q_OBJECT
@@ -34,8 +36,9 @@ class InviteDialog : public KDialog
void enableInviteButton( bool enable );
public slots:
public Q_SLOTS:
void setInviteCount( int count );
void showWhatsthis();
signals:
void createInviteClicked();
@@ -43,11 +46,11 @@ class InviteDialog : public KDialog
void manageInviteClicked();
void configureClicked();
protected slots:
protected Q_SLOTS:
void slotUser1();
protected:
InviteWidget *m_inviteWidget;
QWidget *m_inviteWidget;
};
#endif // INVITEDIALOG_H

83
krfb/krfbserver.cpp Normal file
View File

@@ -0,0 +1,83 @@
//
// C++ Implementation: krfbserver
//
// Description:
//
//
// Author: Alessandro Praduroux <pradu@pradu.it>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "krfbserver.h"
#include "krfbserver.moc"
//#include "rfbcontroller.h"
#include <QTcpServer>
#include <QTcpSocket>
#include <QTimer>
#include <KConfig>
#include <KGlobal>
const int DEFAULT_TCP_PORT = 5900;
KrfbServer::KrfbServer()
: QObject(0), _controller(0) //new RFBController(0))
{
QTimer::singleShot(0, this, SLOT(startListening()));
// TESTING!!!
QTimer::singleShot(100000, this, SLOT(disconnectAndQuit()));
}
void KrfbServer::startListening() {
KSharedConfigPtr conf = KGlobal::config();
KConfigGroup tcpConfig(conf, "TCP");
int port = tcpConfig.readEntry("port",DEFAULT_TCP_PORT);
_server = new QTcpServer(this);
connect(_server,SIGNAL(newConnection()),SLOT(newConnection()));
if (!_server->listen(QHostAddress::Any, port)) {
kDebug() << "server listen error" << endl;
deleteLater();
return;
}
}
KrfbServer::~KrfbServer()
{
//delete _controller;
}
void KrfbServer::newConnection()
{
int fdNum = 0;
QTcpSocket *conn = _server->nextPendingConnection();
QString peer = conn->peerAddress().toString();
emit sessionEstablished(peer);
connect (conn, SIGNAL(disconnected()), SIGNAL(sessionFinished()));
fdNum = conn->socketDescriptor();
conn->close();
//_controller->startServer(fdNum);
}
void KrfbServer::enableDesktopControl(bool enable)
{
// TODO
}
void KrfbServer::disconnectAndQuit()
{
// TODO: cleanup of existing connections
_server->close();
emit quitApp();
}

52
krfb/krfbserver.h Normal file
View File

@@ -0,0 +1,52 @@
//
// C++ Interface: krfbserver
//
// Description:
//
//
// Author: Alessandro Praduroux <pradu@pradu.it>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef KRFBSERVER_H
#define KRFBSERVER_H
#include <QObject>
class QTcpServer;
class RFBController;
/**
This class implements the listening server for the RFB protocol.
@author Alessandro Praduroux <pradu@pradu.it>
*/
class KrfbServer : public QObject
{
Q_OBJECT
public:
KrfbServer();
~KrfbServer();
signals:
void sessionEstablished(const QString&);
void sessionFinished();
void desktopControlSettingChanged(bool);
void quitApp();
public Q_SLOTS:
void newConnection();
void startListening();
void enableDesktopControl(bool);
void disconnectAndQuit();
private:
RFBController *_controller;
QTcpServer *_server;
};
#endif

View File

@@ -16,12 +16,8 @@
***************************************************************************/
#include "trayicon.h"
#include "configuration.h"
#ifdef __GNUC__
#warning "Port to DBUS"
#endif
#include "krfbifaceimpl.h"
#include "rfbcontroller.h"
//#include "configuration.h"
#include "krfbserver.h"
#include <QPixmap>
#include <kaction.h>
@@ -34,10 +30,7 @@
#include <kaboutapplicationdialog.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <qobject.h>
#include <qwindowdefs.h>
#include <q3cstring.h>
#include <qdatastream.h>
#include <signal.h>
@@ -45,33 +38,6 @@
static const char description[] = I18N_NOOP("VNC-compatible server to share "
"KDE desktops");
#define ARG_KINETD "kinetd"
static KCmdLineOptions options[] =
{
{ ARG_KINETD " ", I18N_NOOP("Used for calling from kinetd"), 0},
KCmdLineLastOption
};
void checkKInetd(bool &kinetdAvailable, bool &krfbAvailable) {
#if 0
DCOPRef ref("kded", "kinetd");
ref.setDCOPClient(KApplication::dcopClient());
DCOPReply r = ref.call("isInstalled", QString("krfb"));
if (!r.isValid()) {
kinetdAvailable = false;
krfbAvailable = false;
return;
}
r.get(krfbAvailable);
kinetdAvailable = true;
#endif
kinetdAvailable = false;
krfbAvailable = false;
}
int main(int argc, char *argv[])
{
@@ -104,95 +70,42 @@ int main(int argc, char *argv[])
aboutData.addCredit("Karl Vogel",
I18N_NOOP("KDesktop background deactivation"));
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
Configuration *config;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
QString fdString;
if (!args->isSet(ARG_KINETD)) {
bool kinetdA, krfbA;
checkKInetd(kinetdA, krfbA);
if (!kinetdA) {
KMessageBox::error(0,
i18n("Cannot find KInetD. "
"The KDE daemon (kded) may have crashed or has not been started at all, or the installation failed."),
i18n("Desktop Sharing Error"));
return 1;
}
if (!krfbA) {
KMessageBox::error(0,
i18n("Cannot find KInetD service for Desktop Sharing (krfb). "
"The installation is incomplete or failed."),
i18n("Desktop Sharing Error"));
return 1;
}
config = new Configuration(KRFB_INVITATION_MODE);
config->showInvitationDialog();
return 0;
}
fdString = args->getOption(ARG_KINETD);
config = new Configuration(KRFB_KINETD_MODE);
args->clear();
if ((!config->allowUninvitedConnections()) && (config->invitations().size() == 0)) {
KNotification::event("UnexpectedConnection");
return 1;
}
if (!RFBController::checkX11Capabilities())
return 1;
TrayIcon trayicon(new KAboutApplicationDialog(&aboutData),
config);
RFBController controller(config);
KRfbIfaceImpl dcopiface(&controller);
TrayIcon trayicon(new KAboutApplicationDialog(&aboutData));
KrfbServer server;
QObject::connect(&app, SIGNAL(lastWindowClosed()), // do not show passivepopup
&trayicon, SLOT(prepareQuit()));
&trayicon, SLOT(prepareQuit()));
QObject::connect(&app, SIGNAL(lastWindowClosed()),
&controller, SLOT(closeConnection()));
&server, SLOT(disconnectAndQuit()));
QObject::connect(&trayicon, SIGNAL(showManageInvitations()),
config, SLOT(showManageInvitationsDialog()));
QObject::connect(&trayicon, SIGNAL(enableDesktopControl(bool)),
&controller, SLOT(enableDesktopControl(bool)));
QObject::connect(&trayicon, SIGNAL(diconnectedMessageDisplayed()),
&app, SLOT(quit()));
#if 0
QObject::connect(&dcopiface, SIGNAL(exitApp()),
&controller, SLOT(closeConnection()));
QObject::connect(&dcopiface, SIGNAL(exitApp()),
&app, SLOT(quit()));
#endif
QObject::connect(&controller, SIGNAL(sessionRefused()),
&app, SLOT(quit()));
QObject::connect(&controller, SIGNAL(sessionEstablished(QString)),
&server, SLOT(enableDesktopControl(bool)));
QObject::connect(&server, SIGNAL(sessionEstablished(QString)),
&trayicon, SLOT(showConnectedMessage(QString)));
QObject::connect(&controller, SIGNAL(sessionFinished()),
QObject::connect(&server, SIGNAL(sessionFinished()),
&trayicon, SLOT(showDisconnectedMessage()));
QObject::connect(&controller, SIGNAL(desktopControlSettingChanged(bool)),
QObject::connect(&server, SIGNAL(desktopControlSettingChanged(bool)),
&trayicon, SLOT(setDesktopControlSetting(bool)));
QObject::connect(&controller, SIGNAL(quitApp()),
&app, SLOT(quit()));
QObject::connect(&trayicon, SIGNAL(quitApp()),
&server, SLOT(disconnectAndQuit()));
QObject::connect(&server, SIGNAL(quitApp()),
&app, SLOT(quit()));
//TODO: implement some error reporting mechanism between server and tray icon
/*
QObject::connect(&trayicon, SIGNAL(diconnectedMessageDisplayed()),
&app, SLOT(quit()));
QObject::connect(&server, SIGNAL(sessionRefused()),
&app, SLOT(quit()));
*/
sigset_t sigs;
sigemptyset(&sigs);
sigaddset(&sigs, SIGPIPE);
sigprocmask(SIG_BLOCK, &sigs, 0);
bool ok;
int fdNum = fdString.toInt(&ok);
if (!ok) {
kError() << "kinetd fd was not numeric." << endl;
return 2;
}
controller.startServer(fdNum);
return app.exec();
}

View File

@@ -0,0 +1,70 @@
//
// C++ Implementation: manageinvitationsdialog
//
// Description:
//
//
// Author: Alessandro Praduroux <pradu@pradu.it>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "manageinvitationsdialog.h"
#include "manageinvitationsdialog.moc"
#include <QWidget>
#include <QToolTip>
#include <QCursor>
#include <KStandardGuiItem>
#include <KIconLoader>
ManageInvitationsDialog::ManageInvitationsDialog(QWidget *parent)
: KDialog(parent)
{
setCaption(i18n("Invitation"));
setButtons(User1|Close|Help);
setDefaultButton(NoDefault);
setModal(true);
QWidget *main = new QWidget(this);
setupUi(main);
setMainWidget( main );
pixmapLabel->setPixmap( UserIcon( "connection-side-image.png" ) );
setButtonGuiItem( User1, KStandardGuiItem::configure() );
connect( helpLabel, SIGNAL( linkActivated ( QString ) ),
SLOT( showWhatsthis() ));
connect( newPersonalInvitationButton, SIGNAL( clicked() ),
SLOT( inviteManually() ));
connect( newEmailInvitationButton, SIGNAL( clicked() ),
SLOT( inviteByMail() ));
}
ManageInvitationsDialog::~ManageInvitationsDialog()
{
}
void ManageInvitationsDialog::showWhatsthis()
{
QToolTip::showText(QCursor::pos(),
i18n("An invitation creates a one-time password that allows the receiver to connect to your desktop.\n"
"It is valid for only one successful connection and will expire after an hour if it has not been used. \n"
"When somebody connects to your computer a dialog will appear and ask you for permission.\n"
"The connection will not be established before you accept it. In this dialog you can also\nrestrict "
"the other person to view your desktop only, without the ability to move your\nmouse pointer or press "
"keys.\nIf you want to create a permanent password for Desktop Sharing, allow 'Uninvited Connections' \n"
"in the configuration."));
}
void ManageInvitationsDialog::inviteManually()
{
}
void ManageInvitationsDialog::inviteByMail()
{
}

View File

@@ -0,0 +1,38 @@
//
// C++ Interface: manageinvitationsdialog
//
// Description:
//
//
// Author: Alessandro Praduroux <pradu@pradu.it>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef MANAGEINVITATIONSDIALOG_H
#define MANAGEINVITATIONSDIALOG_H
#include <KDialog>
#include "ui_rfbmanageinvitations.h"
/**
@author Alessandro Praduroux <pradu@pradu.it>
*/
class ManageInvitationsDialog : public KDialog, private Ui::ManageInvitationsDialog
{
Q_OBJECT
public:
ManageInvitationsDialog(QWidget *parent = 0);
~ManageInvitationsDialog();
public Q_SLOTS:
void showWhatsthis();
void inviteManually();
void inviteByMail();
private:
};
#endif

View File

@@ -18,7 +18,6 @@
*/
#include "personalinvitedialog.h"
#include "personalinvitewidget.h"
#include <qlabel.h>
@@ -34,25 +33,25 @@ PersonalInviteDialog::PersonalInviteDialog( QWidget *parent )
setDefaultButton(Close);
setModal(true);
m_inviteWidget = new PersonalInviteWidget( this, "PersonalInviteWidget" );
m_inviteWidget->pixmapLabel->setPixmap(
UserIcon( "connection-side-image.png" ) );
m_inviteWidget = new QWidget ( this );
setupUi(m_inviteWidget);
pixmapLabel->setPixmap( UserIcon( "connection-side-image.png" ) );
setMainWidget( m_inviteWidget );
}
void PersonalInviteDialog::setHost( const QString &host, uint port )
{
m_inviteWidget->hostLabel->setText( QString( "%1:%2" )
hostLabel->setText( QString( "%1:%2" )
.arg( host ).arg( port ) );
}
void PersonalInviteDialog::setPassword( const QString &passwd )
{
m_inviteWidget->passwordLabel->setText( passwd );
passwordLabel->setText( passwd );
}
void PersonalInviteDialog::setExpiration( const QDateTime &expire )
{
m_inviteWidget->expirationLabel->setText( expire.toString( Qt::LocalDate ) );
expirationLabel->setText( expire.toString( Qt::LocalDate ) );
}

View File

@@ -20,13 +20,12 @@
#ifndef PERSONALINVITEDIALOG_H
#define PERSONALINVITEDIALOG_H
class PersonalInviteWidget;
#include <qdatetime.h>
#include <KDialog>
#include "ui_rfbpersonalinvitewidget.h"
class PersonalInviteDialog : public KDialog
class QWidget;
class PersonalInviteDialog : public KDialog, public Ui::PersonalInviteWidget
{
public:
PersonalInviteDialog( QWidget *parent );
@@ -37,7 +36,7 @@ class PersonalInviteDialog : public KDialog
void setExpiration( const QDateTime &expire );
protected:
PersonalInviteWidget *m_inviteWidget;
QWidget *m_inviteWidget;
};
#endif // PERSONALINVITEDIALOG_H

216
krfb/rfbconnectionwidget.ui Normal file
View File

@@ -0,0 +1,216 @@
<ui version="4.0" >
<class>ConnectionWidget</class>
<widget class="QWidget" name="ConnectionWidget" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>521</width>
<height>328</height>
</rect>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" colspan="2" >
<widget class="QLabel" name="TextLabel5" >
<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>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Attention</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
<property name="indent" >
<number>0</number>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2" >
<widget class="QLabel" name="mainTextLabel" >
<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="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>Qt::AutoText</enum>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
<property name="margin" >
<number>0</number>
</property>
<property name="indent" >
<number>0</number>
</property>
</widget>
</item>
<item rowspan="6" row="0" column="0" >
<widget class="QLabel" name="pixmapLabel" >
<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>QFrame::WinPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
<property name="lineWidth" >
<number>0</number>
</property>
<property name="scaledContents" >
<bool>true</bool>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
<property name="margin" >
<number>0</number>
</property>
<property name="indent" >
<number>0</number>
</property>
</widget>
</item>
<item row="3" column="2" >
<widget class="QLabel" name="remoteHost" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>123.234.123.234</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2" >
<widget class="QCheckBox" name="cbAllowRemoteControl" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis" >
<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>
<property name="text" >
<string>Allow remote user to &amp;control keyboard and mouse</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QLabel" name="TextLabel1" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Remote system:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>84</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>80</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<resources/>
<connections/>
</ui>

200
krfb/rfbinvitewidget.ui Normal file
View File

@@ -0,0 +1,200 @@
<ui version="4.0" >
<class>InviteWidget</class>
<widget class="QWidget" name="InviteWidget" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>521</width>
<height>336</height>
</rect>
</property>
<property name="windowTitle" >
<string/>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="2" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>215</width>
<height>101</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" colspan="3" >
<widget class="QLabel" name="helpLabel" >
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">KDE Desktop Sharing allows you to invite somebody at a remote location to watch and possibly control your desktop. &lt;a href="whatsthis">More about invitations...&lt;/a>&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="textFormat" >
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
<property name="openExternalLinks" >
<bool>false</bool>
</property>
<property name="textInteractionFlags" >
<enum>Qt::LinksAccessibleByMouse</enum>
</property>
</widget>
</item>
<item row="4" column="2" >
<widget class="QPushButton" name="btnEmailInvite" >
<property name="whatsThis" >
<string>This button will start your email application with a pre-configured text that explains to the recipient how to connect to your computer. </string>
</property>
<property name="text" >
<string>Invite via &amp;Email...</string>
</property>
</widget>
</item>
<item row="5" column="2" >
<widget class="QPushButton" name="btnManageInvite" >
<property name="text" >
<string>&amp;Manage Invitations (%1)...</string>
</property>
</widget>
</item>
<item row="4" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>24</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2" >
<widget class="QPushButton" name="btnCreateInvite" >
<property name="toolTip" >
<string/>
</property>
<property name="whatsThis" >
<string>Create a new invitation and display the connection data. Use this option if you want to invite somebody personally, for example, to give the connection data over the phone.</string>
</property>
<property name="text" >
<string>Create &amp;Personal Invitation...</string>
</property>
</widget>
</item>
<item row="4" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item rowspan="7" row="0" column="0" >
<widget class="QLabel" name="pixmapLabel" >
<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>QFrame::WinPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
<property name="scaledContents" >
<bool>true</bool>
</property>
<property name="alignment" >
<set>Qt::AlignTop</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3" >
<widget class="QLabel" name="TextLabel2" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Welcome to KDE Desktop Sharing</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<layoutfunction spacing="KDialog::spacingHint" margin="KDialog::marginHint" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,207 @@
<ui version="4.0" >
<class>ManageInvitationsDialog</class>
<widget class="QWidget" name="ManageInvitationsDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>691</width>
<height>336</height>
</rect>
</property>
<property name="windowTitle" >
<string>Manage Invitations - Desktop Sharing</string>
</property>
<property name="windowIcon" >
<iconset/>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="2" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>81</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" colspan="2" >
<widget class="QLabel" name="TextLabel2" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Welcome to KDE Desktop Sharing</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item rowspan="5" row="2" column="1" >
<widget class="QTreeWidget" name="treeWidget" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<column>
<property name="text" >
<string>Created</string>
</property>
</column>
<column>
<property name="text" >
<string>Expire Time</string>
</property>
</column>
</widget>
</item>
<item rowspan="7" row="0" column="0" >
<widget class="QLabel" name="pixmapLabel" >
<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>QFrame::WinPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
<property name="scaledContents" >
<bool>true</bool>
</property>
<property name="alignment" >
<set>Qt::AlignTop</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="6" column="2" >
<widget class="QPushButton" name="deleteOneButton" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="toolTip" >
<string>Delete the selected invitation</string>
</property>
<property name="whatsThis" >
<string>Delete the selected invitation. The invited person will not be able to connect using this invitation anymore.</string>
</property>
<property name="text" >
<string>&amp;Delete</string>
</property>
</widget>
</item>
<item row="5" column="2" >
<widget class="QPushButton" name="deleteAllButton" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="toolTip" >
<string>Delete all invitations</string>
</property>
<property name="whatsThis" >
<string>Deletes all open invitations.</string>
</property>
<property name="text" >
<string>Delete All</string>
</property>
</widget>
</item>
<item row="4" column="2" >
<widget class="QPushButton" name="newEmailInvitationButton" >
<property name="toolTip" >
<string>Send a new invitation via email...</string>
</property>
<property name="whatsThis" >
<string>Click this button to send a new invitation via email.</string>
</property>
<property name="text" >
<string>&amp;New Email Invitation...</string>
</property>
</widget>
</item>
<item row="3" column="2" >
<widget class="QPushButton" name="newPersonalInvitationButton" >
<property name="toolTip" >
<string>Create a new personal invitation...</string>
</property>
<property name="whatsThis" >
<string>Click this button to create a new personal invitation.</string>
</property>
<property name="text" >
<string>New &amp;Personal Invitation...</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2" >
<widget class="QLabel" name="helpLabel" >
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">KDE Desktop Sharing allows you to invite somebody at a remote location to watch and possibly control your desktop. &lt;a href="whatsthis">More about invitations...&lt;/a>&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="textFormat" >
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
<property name="openExternalLinks" >
<bool>false</bool>
</property>
<property name="textInteractionFlags" >
<enum>Qt::LinksAccessibleByMouse</enum>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<includes>
<include location="global" >k3listview.h</include>
<include location="local" >k3listview.h</include>
</includes>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,231 @@
<ui version="4.0" >
<class>PersonalInviteWidget</class>
<widget class="QWidget" name="PersonalInviteWidget" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>519</width>
<height>328</height>
</rect>
</property>
<property name="windowTitle" >
<string/>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" colspan="3" >
<widget class="K3ActiveLabel" native="1" name="mainTextLabel" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy" >
<enum>Qt::NoFocus</enum>
</property>
</widget>
</item>
<item row="1" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>34</height>
</size>
</property>
</spacer>
</item>
<item rowspan="6" row="0" column="0" >
<widget class="QLabel" name="pixmapLabel" >
<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>QFrame::WinPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
<property name="scaledContents" >
<bool>true</bool>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>30</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2" >
<widget class="K3ActiveLabel" native="1" name="hostLabel" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy" >
<enum>Qt::NoFocus</enum>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QLabel" name="kActiveLabel6" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>&lt;b>Password:&lt;/b></string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="1" >
<widget class="QLabel" name="kActiveLabel7" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>&lt;b>Expiration time:&lt;/b></string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="2" >
<widget class="K3ActiveLabel" native="1" name="passwordLabel" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy" >
<enum>Qt::NoFocus</enum>
</property>
</widget>
</item>
<item row="4" column="2" >
<widget class="K3ActiveLabel" native="1" name="expirationLabel" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy" >
<enum>Qt::NoFocus</enum>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QLabel" name="kActiveLabel5" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>&lt;b>Host:&lt;/b></string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="3" >
<widget class="K3ActiveLabel" native="1" name="hostHelpLabel" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<layoutfunction spacing="KDialog::spacingHint" margin="KDialog::marginHint" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>K3ActiveLabel</class>
<extends>QWidget</extends>
<header>k3activelabel.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -29,6 +29,9 @@
#include <kiconloader.h>
#include <kmenu.h>
#include "manageinvitationsdialog.h"
#include "invitedialog.h"
KPassivePopup2::KPassivePopup2(QWidget *parent) :
KPassivePopup(parent){
}
@@ -39,34 +42,24 @@ void KPassivePopup2::hideEvent( QHideEvent *e )
emit hidden();
}
KPassivePopup2 *KPassivePopup2::message( const QString &caption, const QString &text,
const QPixmap &icon,
QWidget *parent)
{
KPassivePopup2 *pop = new KPassivePopup2( parent);
pop->setView( caption, text, icon );
pop->show();
return pop;
}
TrayIcon::TrayIcon(KDialog *d, Configuration *c) :
TrayIcon::TrayIcon(KDialog *d) :
KSystemTrayIcon(),
configuration(c),
aboutDialog(d),
actionCollection(this),
quitting(false)
{
KIconLoader *loader = KIconLoader::global();
trayIconOpen = loader->loadIcon("eyes-open24", K3Icon::User);
trayIconClosed = loader->loadIcon("eyes-closed24", K3Icon::User);
setIcon(trayIconClosed);
setToolTip(i18n("Desktop Sharing - connecting"));
setToolTip(i18n("Desktop Sharing - connecting"));
manageInvitationsAction = new KAction(i18n("Manage &Invitations"), &actionCollection);
actionCollection.addAction("manage_invitations", manageInvitationsAction);
connect(manageInvitationsAction, SIGNAL(toggled()), SIGNAL(showManageInvitations()));
connect(manageInvitationsAction, SIGNAL(triggered(bool)), SLOT(showManageInvitations()));
contextMenu()->addAction(actionCollection.action("manage_invitations"));
contextMenu()->addSeparator();
@@ -103,10 +96,10 @@ void TrayIcon::prepareQuit() {
void TrayIcon::showConnectedMessage(QString host) {
setIcon(trayIconOpen);
KPassivePopup2::message(i18n("Desktop Sharing"),
KPassivePopup::message(i18n("Desktop Sharing"),
i18n("The remote user has been authenticated and is now connected."),
trayIconOpen,
(QWidget*)this);
this);
setToolTip(i18n("Desktop Sharing - connected with %1", host));
}
@@ -116,10 +109,10 @@ void TrayIcon::showDisconnectedMessage() {
setToolTip(i18n("Desktop Sharing - disconnected"));
setIcon(trayIconClosed);
KPassivePopup2 *p = KPassivePopup2::message(i18n("Desktop Sharing"),
KPassivePopup *p = KPassivePopup::message(i18n("Desktop Sharing"),
i18n("The remote user has closed the connection."),
trayIconClosed,
(QWidget*)this);
this);
connect(p, SIGNAL(hidden()), this, SIGNAL(diconnectedMessageDisplayed()));
}
@@ -138,4 +131,11 @@ void TrayIcon::activated(QSystemTrayIcon::ActivationReason reason)
KSystemTrayIcon::activated(reason);
}
void TrayIcon::showManageInvitations()
{
ManageInvitationsDialog invMngDlg(0);
invMngDlg.exec();
}
#include "trayicon.moc"

View File

@@ -18,8 +18,6 @@
#ifndef TRAYICON_H
#define TRAYICON_H
#include "configuration.h"
#include <qwidget.h>
//Added by qt3to4:
#include <QPixmap>
@@ -36,11 +34,8 @@ class KDialog;
class KPassivePopup2 : public KPassivePopup {
Q_OBJECT
public:
public:
KPassivePopup2(QWidget *parent);
static KPassivePopup2 *message( const QString &caption, const QString &text,
const QPixmap &icon,
QWidget *parent);
signals:
void hidden();
@@ -53,26 +48,29 @@ protected:
};
/**
* Implements the trayicon.
* Implements the trayicon.
* @author Tim Jansen
*/
class TrayIcon : public KSystemTrayIcon {
Q_OBJECT
public:
TrayIcon(KDialog*, Configuration*);
public:
TrayIcon(KDialog*);
~TrayIcon();
signals:
void showManageInvitations();
void diconnectedMessageDisplayed();
void enableDesktopControl(bool);
void quitApp();
public slots:
void prepareQuit();
void showConnectedMessage(QString host);
void showDisconnectedMessage();
void setDesktopControlSetting(bool);
public Q_SLOTS:
void prepareQuit();
void showConnectedMessage(QString host);
void showDisconnectedMessage();
void setDesktopControlSetting(bool);
void showManageInvitations();
void showAbout();
protected:
void activated(QSystemTrayIcon::ActivationReason reason);
@@ -81,7 +79,6 @@ private:
QPixmap trayIconOpen;
QPixmap trayIconClosed;
Configuration *configuration;
KDialog* aboutDialog;
KActionCollection actionCollection;
KAction* manageInvitationsAction;
@@ -89,8 +86,6 @@ private:
KToggleAction* enableControlAction;
bool quitting;
private slots:
void showAbout();
};
#endif