diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a34736..729177a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,16 +23,19 @@ set(krfb_SRCS
connectioncontroller.cpp
events.cpp
framebuffer.cpp
-# rfbcontroller.cc
-# xupdatescanner.cc
)
kde4_automoc(${krfb_SRCS})
+kde4_add_kcfg_files(krfb_SRCS krfbconfig.kcfgc)
+
kde4_add_ui_files(krfb_SRCS connectionwidget.ui
manageinvitations.ui
personalinvitewidget.ui
- invitewidget.ui)
+ invitewidget.ui
+ configtcp.ui
+ configsecurity.ui
+ )
kde4_add_executable(krfb ${krfb_SRCS})
diff --git a/configsecurity.ui b/configsecurity.ui
new file mode 100644
index 0000000..f725933
--- /dev/null
+++ b/configsecurity.ui
@@ -0,0 +1,139 @@
+
+ Security
+
+
+
+ 0
+ 0
+ 507
+ 201
+
+
+
+ Form
+
+
+ -
+
+
+ Allow uninvited connections
+
+
+
+ -
+
+
+ Allow remote connections to control your desktop
+
+
+ true
+
+
+
+ -
+
+
+ false
+
+
+ Ask before accepting an uninvited connection
+
+
+ true
+
+
+
+ -
+
+
+ false
+
+
+ Uninvited connections password
+
+
+ kcfg_uninvitedConnectionPassword
+
+
+
+ -
+
+
+ false
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+ KLineEdit
+ QLineEdit
+
+
+
+
+
+
+ kcfg_allowUninvitedConnections
+ toggled(bool)
+ kcfg_askOnConnect
+ setEnabled(bool)
+
+
+ 22
+ 24
+
+
+ 29
+ 80
+
+
+
+
+ kcfg_allowUninvitedConnections
+ toggled(bool)
+ kcfg_uninvitedConnectionPassword
+ setEnabled(bool)
+
+
+ 98
+ 21
+
+
+ 192
+ 137
+
+
+
+
+ kcfg_allowUninvitedConnections
+ toggled(bool)
+ label
+ setEnabled(bool)
+
+
+ 117
+ 20
+
+
+ 120
+ 94
+
+
+
+
+
diff --git a/configtcp.ui b/configtcp.ui
new file mode 100644
index 0000000..5925270
--- /dev/null
+++ b/configtcp.ui
@@ -0,0 +1,90 @@
+
+ TCP
+
+
+
+ 0
+ 0
+ 400
+ 169
+
+
+
+ Form
+
+
+ -
+
+
+ Use default port
+
+
+ true
+
+
+
+ -
+
+
+ 6
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ Listening Port:
+
+
+ kcfg_port
+
+
+
+ -
+
+
+ false
+
+
+ 65535
+
+
+
+
+
+
+
+
+ kcfg_useDefaultPort
+ kcfg_port
+
+
+
+
+ kcfg_useDefaultPort
+ toggled(bool)
+ kcfg_port
+ setDisabled(bool)
+
+
+ 120
+ 53
+
+
+ 277
+ 122
+
+
+
+
+
diff --git a/connectioncontroller.cpp b/connectioncontroller.cpp
index 3f36437..3999674 100644
--- a/connectioncontroller.cpp
+++ b/connectioncontroller.cpp
@@ -28,6 +28,7 @@
#include "events.h"
#include "krfbserver.h"
+#include "krfbconfig.h"
#include
@@ -73,24 +74,19 @@ ConnectionController::~ConnectionController()
enum rfbNewClientAction ConnectionController::handleNewClient()
{
- KSharedConfigPtr conf = KGlobal::config();
- KConfigGroup srvconf(conf, "Server");
-
- bool allowDesktopControl = srvconf.readEntry("allowDesktopControl",false);
- bool askOnConnect = srvconf.readEntry("askOnConnect",true);
+ bool allowDesktopControl = KrfbConfig::allowDesktopControl();
+ bool askOnConnect = KrfbConfig::askOnConnect();
int socket = cl->sock;
// cl->negotiationFinishedHook = negotiationFinishedHook; ???
-
+ QString remoteIp;
#if 0
// TODO: this drops the connection >.<
QTcpSocket t;
t.setSocketDescriptor(socket); //, QAbstractSocket::ConnectedState, QIODevice::NotOpen);
- host = t.peerAddress().toString();
+ remoteIp = t.peerAddress().toString();
#endif
- QString remoteIp;
-
if (!askOnConnect && InvitationManager::self()->invitations().size() == 0) {
KNotification::event("NewConnectionAutoAccepted",
i18n("Accepted uninvited connection from %1",
@@ -121,11 +117,8 @@ enum rfbNewClientAction ConnectionController::handleNewClient()
bool ConnectionController::handleCheckPassword(rfbClientPtr cl, const char *response, int len)
{
- KSharedConfigPtr conf = KGlobal::config();
- KConfigGroup srvconf(conf, "Server");
-
- bool allowUninvited = srvconf.readEntry("allowUninvitedConnections",false);
- QString password = srvconf.readEntry("uninvitedConnectionPassword",QString());
+ bool allowUninvited = KrfbConfig::allowUninvitedConnections();
+ QString password = KrfbConfig::uninvitedConnectionPassword();
bool authd = false;
kDebug() << "about to start autentication" << endl;
@@ -138,7 +131,7 @@ bool ConnectionController::handleCheckPassword(rfbClientPtr cl, const char *resp
QList invlist = InvitationManager::self()->invitations();
foreach(Invitation it, invlist) {
- kDebug() << "checking password????!?!?!" << endl;
+ kDebug() << "checking password" << endl;
if (checkPassword(it.password(), cl->authChallenge, response, len) && it.isValid()) {
authd = true;
//configuration->removeInvitation(it);
diff --git a/connectionwidget.ui b/connectionwidget.ui
index 9cab295..eaeee16 100644
--- a/connectionwidget.ui
+++ b/connectionwidget.ui
@@ -6,7 +6,7 @@
0
0
521
- 328
+ 318
@@ -70,7 +70,7 @@
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
- false
+ true
0
@@ -175,38 +175,6 @@
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Minimum
-
-
-
- 20
- 84
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Minimum
-
-
-
- 20
- 80
-
-
-
-
diff --git a/framebuffer.cpp b/framebuffer.cpp
index 9f3bd84..d8a8ab2 100644
--- a/framebuffer.cpp
+++ b/framebuffer.cpp
@@ -20,6 +20,9 @@ const int UPDATE_TIME = 500;
FrameBuffer::FrameBuffer(WId id, QObject *parent)
: QObject(parent), win(id)
{
+ //TODO: implement reference counting to avoid update the screen
+ // while no client is connected.
+
fbImage = QPixmap::grabWindow(win).toImage();
fb = new char[fbImage.numBytes()];
QTimer *t = new QTimer(this);
diff --git a/krfb.kcfg b/krfb.kcfg
new file mode 100644
index 0000000..1450e83
--- /dev/null
+++ b/krfb.kcfg
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+ true
+
+
+
+ 5900
+
+
+
+
+
+ true
+
+
+
+ true
+
+
+
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/krfbconfig.kcfgc b/krfbconfig.kcfgc
new file mode 100644
index 0000000..43a152c
--- /dev/null
+++ b/krfbconfig.kcfgc
@@ -0,0 +1,3 @@
+File=krfb.kcfg
+ClassName=KrfbConfig
+Singleton=true
\ No newline at end of file
diff --git a/krfbserver.cpp b/krfbserver.cpp
index 0bf0868..cbd6848 100644
--- a/krfbserver.cpp
+++ b/krfbserver.cpp
@@ -20,7 +20,6 @@
#include
#include
-#include
#include
#include
#include
@@ -29,6 +28,7 @@
#include "connectioncontroller.h"
#include "framebuffer.h"
+#include "krfbconfig.h"
static const char* cur=
@@ -109,8 +109,6 @@ static void clipboardHook(char* str,int len, rfbClientPtr cl)
}
-const int DEFAULT_TCP_PORT = 5900;
-
static KStaticDeleter sd;
KrfbServer * KrfbServer::_self = 0;
KrfbServer * KrfbServer::self() {
@@ -130,10 +128,7 @@ void KrfbServer::startListening()
{
rfbScreenInfoPtr screen;
- KSharedConfigPtr conf = KGlobal::config();
- KConfigGroup tcpConfig(conf, "TCP");
-
- int port = tcpConfig.readEntry("port",DEFAULT_TCP_PORT);
+ int port = KrfbConfig::port();
int w = fb->width();
int h = fb->height();
diff --git a/manageinvitationsdialog.cpp b/manageinvitationsdialog.cpp
index c62c452..b4fe5ad 100644
--- a/manageinvitationsdialog.cpp
+++ b/manageinvitationsdialog.cpp
@@ -12,6 +12,7 @@
#include "personalinvitedialog.h"
#include "invitationmanager.h"
#include "invitation.h"
+#include "krfbconfig.h"
#include
#include
@@ -23,6 +24,27 @@
#include
#include
#include
+#include
+
+// settings dialog
+#include "ui_configtcp.h"
+#include "ui_configsecurity.h"
+
+class TCP: public QWidget, public Ui::TCP {
+ public:
+ TCP(QWidget *parent=0) :QWidget(parent)
+ {
+ setupUi(this);
+ }
+};
+
+class Security: public QWidget, public Ui::Security {
+ public:
+ Security(QWidget *parent=0) :QWidget(parent)
+ {
+ setupUi(this);
+ }
+};
ManageInvitationsDialog::ManageInvitationsDialog(QWidget *parent)
@@ -48,6 +70,7 @@ ManageInvitationsDialog::ManageInvitationsDialog(QWidget *parent)
SLOT( inviteByMail() ));
connect( InvitationManager::self(), SIGNAL( invitationNumChanged( int )),
SLOT( reloadInvitations() ));
+ connect( this, SIGNAL(user1Clicked()),SLOT(showConfiguration()));
reloadInvitations();
}
@@ -95,3 +118,15 @@ void ManageInvitationsDialog::reloadInvitations()
invitationWidget->resizeColumnToContents(0);
}
+void ManageInvitationsDialog::showConfiguration()
+{
+ if(KConfigDialog::showDialog("settings"))
+ return;
+
+ KConfigDialog *dialog = new KConfigDialog(this, "settings", KrfbConfig::self());
+ dialog->addPage(new TCP, i18n("Network"), "network");
+ dialog->addPage(new Security, i18n("Security"), "encrypted");
+
+ dialog->show();
+}
+
diff --git a/manageinvitationsdialog.h b/manageinvitationsdialog.h
index 58f3d23..83d1f58 100644
--- a/manageinvitationsdialog.h
+++ b/manageinvitationsdialog.h
@@ -29,6 +29,7 @@ public Q_SLOTS:
void inviteManually();
void inviteByMail();
void reloadInvitations();
+ void showConfiguration();
private: