summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.co.uk>2010-11-08 21:25:59 (GMT)
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.co.uk>2010-11-09 10:05:24 (GMT)
commit67f738026292e9884421f49192290f3c36256ddf (patch)
tree8dfa559bb2cf9580cd2b13f90837a573a27b58d8
parent13ee918112b2537ca70b5680fcd57f2bc3473dd2 (diff)
downloadkrfb-work.tar.gz
krfb-work.tar.xz
Modify the connection dialog to show a different message for telepathy tubes clients.work
-rw-r--r--krfb/CMakeLists.txt4
-rw-r--r--krfb/connectiondialog.cpp33
-rw-r--r--krfb/connectiondialog.h50
-rw-r--r--krfb/invitationsrfbclient.cpp6
-rw-r--r--krfb/tubesrfbclient.cpp9
-rw-r--r--krfb/ui/tubesconnectionwidget.ui114
6 files changed, 191 insertions, 25 deletions
diff --git a/krfb/CMakeLists.txt b/krfb/CMakeLists.txt
index 919ab2e..3f296c8 100644
--- a/krfb/CMakeLists.txt
+++ b/krfb/CMakeLists.txt
@@ -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}
)
diff --git a/krfb/connectiondialog.cpp b/krfb/connectiondialog.cpp
index 74da350..c452b85 100644
--- a/krfb/connectiondialog.cpp
+++ b/krfb/connectiondialog.cpp
@@ -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)
+{
+ m_ui.remoteHost->setText(host);
+}
+
+//**********
+
+TubesConnectionDialog::TubesConnectionDialog(QWidget *parent)
+ : ConnectionDialog<Ui::TubesConnectionWidget>(parent)
{
- cbAllowRemoteControl->setChecked(b);
- cbAllowRemoteControl->setVisible(b);
}
-bool ConnectionDialog::allowRemoteControl()
+void TubesConnectionDialog::setContactName(const QString & name)
{
- return cbAllowRemoteControl->isChecked();
+ 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"
diff --git a/krfb/connectiondialog.h b/krfb/connectiondialog.h
index 608051a..f29b7bc 100644
--- a/krfb/connectiondialog.h
+++ b/krfb/connectiondialog.h
@@ -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
diff --git a/krfb/invitationsrfbclient.cpp b/krfb/invitationsrfbclient.cpp
index 949171f..bd5cff8 100644
--- a/krfb/invitationsrfbclient.cpp
+++ b/krfb/invitationsrfbclient.cpp
@@ -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);
}
diff --git a/krfb/tubesrfbclient.cpp b/krfb/tubesrfbclient.cpp
index 218becc..2466826 100644
--- a/krfb/tubesrfbclient.cpp
+++ b/krfb/tubesrfbclient.cpp
@@ -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);
}
diff --git a/krfb/ui/tubesconnectionwidget.ui b/krfb/ui/tubesconnectionwidget.ui
new file mode 100644
index 0000000..480e3db
--- /dev/null
+++ b/krfb/ui/tubesconnectionwidget.ui
@@ -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>