From kde-commits Wed Nov 10 18:57:40 2010 From: George Kiagiadakis Date: Wed, 10 Nov 2010 18:57:40 +0000 To: kde-commits Subject: KDE/kdenetwork/krfb/krfb Message-Id: <20101110185740.5987FAC8A0 () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=128941557011870 SVN commit 1195295 by gkiagia: Modify the connection dialog to show a different message for telepathy tubes clients. M +4 -0 CMakeLists.txt M +23 -10 connectiondialog.cpp M +43 -7 connectiondialog.h M +3 -3 invitationsrfbclient.cpp M +4 -5 tubesrfbclient.cpp A ui/tubesconnectionwidget.ui --- trunk/KDE/kdenetwork/krfb/krfb/CMakeLists.txt #1195294:1195295 @@ -86,6 +86,10 @@ ui/personalinvitewidget.ui ) +if (TELEPATHY_QT4_FOUND) + kde4_add_ui_files(krfb_SRCS ui/tubesconnectionwidget.ui) +endif() + kde4_add_executable (krfb ${krfb_SRCS} ) --- trunk/KDE/kdenetwork/krfb/krfb/connectiondialog.cpp #1195294:1195295 @@ -1,4 +1,6 @@ /* This file is part of the KDE project + Copyright (C) 2010 Collabora Ltd + @author George Kiagiadakis Copyright (C) 2004 Nadeem Hasan This program is free software; you can redistribute it and/or @@ -26,7 +28,8 @@ #include #include -ConnectionDialog::ConnectionDialog(QWidget *parent) +template +ConnectionDialog::ConnectionDialog(QWidget *parent) : KDialog(parent) { setCaption(i18n("New Connection")); @@ -37,9 +40,9 @@ 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 @@ setMainWidget(m_connectWidget); } -void ConnectionDialog::setRemoteHost(const QString &host) +//********** + +InvitationsConnectionDialog::InvitationsConnectionDialog(QWidget *parent) + : ConnectionDialog(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(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" --- trunk/KDE/kdenetwork/krfb/krfb/connectiondialog.h #1195294:1195295 @@ -1,4 +1,6 @@ /* This file is part of the KDE project + Copyright (C) 2010 Collabora Ltd + @author George Kiagiadakis Copyright (C) 2004 Nadeem Hasan This program is free software; you can redistribute it and/or @@ -21,26 +23,60 @@ #define CONNECTIONDIALOG_H #include "ui_connectionwidget.h" - #include -class QWidget; - -class ConnectionDialog : public KDialog, public Ui::ConnectionWidget +template +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 +void ConnectionDialog::setAllowRemoteControl(bool b) +{ + m_ui.cbAllowRemoteControl->setChecked(b); + m_ui.cbAllowRemoteControl->setVisible(b); +} + +template +bool ConnectionDialog::allowRemoteControl() +{ + return m_ui.cbAllowRemoteControl->isChecked(); +} + +//********* + +class InvitationsConnectionDialog : public ConnectionDialog +{ + Q_OBJECT +public: + InvitationsConnectionDialog(QWidget *parent); + void setRemoteHost(const QString & host); +}; + +//********* + +#ifdef KRFB_WITH_TELEPATHY_TUBES +# include "ui_tubesconnectionwidget.h" + +class TubesConnectionDialog : public ConnectionDialog +{ + Q_OBJECT +public: + TubesConnectionDialog(QWidget *parent); + void setContactName(const QString & name); +}; + +#endif // KRFB_WITH_TELEPATHY_TUBES + #endif // CONNECTIONDIALOG_H --- trunk/KDE/kdenetwork/krfb/krfb/invitationsrfbclient.cpp #1195294:1195295 @@ -88,7 +88,7 @@ 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::dialogAccepted() { - ConnectionDialog *dialog = qobject_cast(sender()); + InvitationsConnectionDialog *dialog = qobject_cast(sender()); Q_ASSERT(dialog); InvitationsRfbClient *client = new InvitationsRfbClient(m_rfbClient, parent()); - client->setControlEnabled(dialog->cbAllowRemoteControl->isChecked()); + client->setControlEnabled(dialog->allowRemoteControl()); accept(client); } --- trunk/KDE/kdenetwork/krfb/krfb/tubesrfbclient.cpp #1195294:1195295 @@ -61,9 +61,8 @@ 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::dialogAccepted() { - ConnectionDialog *dialog = qobject_cast(sender()); + TubesConnectionDialog *dialog = qobject_cast(sender()); Q_ASSERT(dialog); TubesRfbClient *client = new TubesRfbClient(m_rfbClient, m_contact, parent()); - client->setControlEnabled(dialog->cbAllowRemoteControl->isChecked()); + client->setControlEnabled(dialog->allowRemoteControl()); accept(client); }