1
0
mirror of https://github.com/KDE/krfb synced 2026-07-01 07:41:17 -07:00

Modify the connection dialog to show a different message for telepathy tubes clients.

svn path=/trunk/KDE/kdenetwork/krfb/; revision=1195295
This commit is contained in:
George Kiagiadakis
2010-11-10 18:57:39 +00:00
parent 0ea0b3418c
commit 1f408749b7
6 changed files with 191 additions and 25 deletions

View File

@@ -86,6 +86,10 @@ kde4_add_ui_files (krfb_SRCS
ui/personalinvitewidget.ui
)
if (TELEPATHY_QT4_FOUND)
kde4_add_ui_files(krfb_SRCS ui/tubesconnectionwidget.ui)
endif()
kde4_add_executable (krfb
${krfb_SRCS}
)

View File

@@ -1,4 +1,6 @@
/* This file is part of the KDE project
Copyright (C) 2010 Collabora Ltd <info@collabora.co.uk>
@author George Kiagiadakis <george.kiagiadakis@collabora.co.uk>
Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
This program is free software; you can redistribute it and/or
@@ -26,7 +28,8 @@
#include <QtGui/QCheckBox>
#include <QtGui/QLabel>
ConnectionDialog::ConnectionDialog(QWidget *parent)
template <typename UI>
ConnectionDialog<UI>::ConnectionDialog(QWidget *parent)
: KDialog(parent)
{
setCaption(i18n("New Connection"));
@@ -37,9 +40,9 @@ ConnectionDialog::ConnectionDialog(QWidget *parent)
setMinimumSize(500, 200);
m_connectWidget = new QWidget(this);
setupUi(m_connectWidget);
m_ui.setupUi(m_connectWidget);
pixmapLabel->setPixmap(KIcon("krfb").pixmap(128));
m_ui.pixmapLabel->setPixmap(KIcon("krfb").pixmap(128));
KGuiItem accept = KStandardGuiItem::ok();
accept.setText(i18n("Accept Connection"));
@@ -52,20 +55,30 @@ ConnectionDialog::ConnectionDialog(QWidget *parent)
setMainWidget(m_connectWidget);
}
void ConnectionDialog::setRemoteHost(const QString &host)
//**********
InvitationsConnectionDialog::InvitationsConnectionDialog(QWidget *parent)
: ConnectionDialog<Ui::ConnectionWidget>(parent)
{
remoteHost->setText(host);
}
void ConnectionDialog::setAllowRemoteControl(bool b)
void InvitationsConnectionDialog::setRemoteHost(const QString &host)
{
cbAllowRemoteControl->setChecked(b);
cbAllowRemoteControl->setVisible(b);
m_ui.remoteHost->setText(host);
}
bool ConnectionDialog::allowRemoteControl()
//**********
TubesConnectionDialog::TubesConnectionDialog(QWidget *parent)
: ConnectionDialog<Ui::TubesConnectionWidget>(parent)
{
return cbAllowRemoteControl->isChecked();
}
void TubesConnectionDialog::setContactName(const QString & name)
{
QString txt = i18n("You have requested to share your desktop with %1. If you proceed, "
"you will allow the remote user to watch your desktop.", name);
m_ui.mainTextLabel->setText(txt);
}
#include "connectiondialog.moc"

View File

@@ -1,4 +1,6 @@
/* This file is part of the KDE project
Copyright (C) 2010 Collabora Ltd <info@collabora.co.uk>
@author George Kiagiadakis <george.kiagiadakis@collabora.co.uk>
Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
This program is free software; you can redistribute it and/or
@@ -21,26 +23,60 @@
#define CONNECTIONDIALOG_H
#include "ui_connectionwidget.h"
#include <KDialog>
class QWidget;
class ConnectionDialog : public KDialog, public Ui::ConnectionWidget
template <typename UI>
class ConnectionDialog : public KDialog
{
Q_OBJECT
public:
ConnectionDialog(QWidget *parent);
~ConnectionDialog() {};
void setRemoteHost(const QString &host);
void setAllowRemoteControl(bool b);
bool allowRemoteControl();
protected:
QWidget *m_connectWidget;
UI m_ui;
};
template <typename UI>
void ConnectionDialog<UI>::setAllowRemoteControl(bool b)
{
m_ui.cbAllowRemoteControl->setChecked(b);
m_ui.cbAllowRemoteControl->setVisible(b);
}
template <typename UI>
bool ConnectionDialog<UI>::allowRemoteControl()
{
return m_ui.cbAllowRemoteControl->isChecked();
}
//*********
class InvitationsConnectionDialog : public ConnectionDialog<Ui::ConnectionWidget>
{
Q_OBJECT
public:
InvitationsConnectionDialog(QWidget *parent);
void setRemoteHost(const QString & host);
};
//*********
#ifdef KRFB_WITH_TELEPATHY_TUBES
# include "ui_tubesconnectionwidget.h"
class TubesConnectionDialog : public ConnectionDialog<Ui::TubesConnectionWidget>
{
Q_OBJECT
public:
TubesConnectionDialog(QWidget *parent);
void setContactName(const QString & name);
};
#endif // KRFB_WITH_TELEPATHY_TUBES
#endif // CONNECTIONDIALOG_H

View File

@@ -88,7 +88,7 @@ void PendingInvitationsRfbClient::processNewClient()
i18n("Received connection from %1, on hold (waiting for confirmation)",
host));
ConnectionDialog *dialog = new ConnectionDialog(0);
InvitationsConnectionDialog *dialog = new InvitationsConnectionDialog(0);
dialog->setRemoteHost(host);
dialog->setAllowRemoteControl(KrfbConfig::allowDesktopControl());
@@ -101,11 +101,11 @@ void PendingInvitationsRfbClient::processNewClient()
void PendingInvitationsRfbClient::dialogAccepted()
{
ConnectionDialog *dialog = qobject_cast<ConnectionDialog *>(sender());
InvitationsConnectionDialog *dialog = qobject_cast<InvitationsConnectionDialog *>(sender());
Q_ASSERT(dialog);
InvitationsRfbClient *client = new InvitationsRfbClient(m_rfbClient, parent());
client->setControlEnabled(dialog->cbAllowRemoteControl->isChecked());
client->setControlEnabled(dialog->allowRemoteControl());
accept(client);
}

View File

@@ -61,9 +61,8 @@ void PendingTubesRfbClient::showConfirmationDialog()
i18n("Received connection from %1, on hold (waiting for confirmation)",
name));
//TODO use a different dialog here, more suitable for the tubes use case
ConnectionDialog *dialog = new ConnectionDialog(0);
dialog->setRemoteHost(name);
TubesConnectionDialog *dialog = new TubesConnectionDialog(0);
dialog->setContactName(name);
dialog->setAllowRemoteControl(KrfbConfig::allowDesktopControl());
connect(dialog, SIGNAL(okClicked()), SLOT(dialogAccepted()));
@@ -75,11 +74,11 @@ void PendingTubesRfbClient::showConfirmationDialog()
void PendingTubesRfbClient::dialogAccepted()
{
ConnectionDialog *dialog = qobject_cast<ConnectionDialog *>(sender());
TubesConnectionDialog *dialog = qobject_cast<TubesConnectionDialog *>(sender());
Q_ASSERT(dialog);
TubesRfbClient *client = new TubesRfbClient(m_rfbClient, m_contact, parent());
client->setControlEnabled(dialog->cbAllowRemoteControl->isChecked());
client->setControlEnabled(dialog->allowRemoteControl());
accept(client);
}

View File

@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TubesConnectionWidget</class>
<widget class="QWidget" name="TubesConnectionWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>162</height>
</rect>
</property>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="pixmapLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>128</width>
<height>128</height>
</size>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="TextLabel5">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<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>Confirmation</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="mainTextLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<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/>
</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>true</bool>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbAllowRemoteControl">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<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>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>