mirror of
https://github.com/KDE/krfb
synced 2026-07-01 07:31:16 -07:00
basic invitation dialogs
svn path=/trunk/kdenetwork/krfb/; revision=145912
This commit is contained in:
20
ChangeLog
20
ChangeLog
@@ -1,7 +1,13 @@
|
||||
2002-03-29 Tim Jansen <tjansen@tjansen.de>
|
||||
|
||||
* Added invitations.
|
||||
|
||||
2002-03-18 Tim Jansen <tjansen@tjansen.de>
|
||||
|
||||
* removed vertical splitting of tiles, simplifies code.
|
||||
|
||||
* finished kinetd support
|
||||
|
||||
2002-03-11 Tim Jansen <tjansen@tjansen.de>
|
||||
|
||||
* integrated KCModule
|
||||
@@ -24,18 +30,20 @@
|
||||
|
||||
2002-02-20 Tim Jansen <tjansen@tjansen.de>
|
||||
|
||||
* krfb/xupdatescanner.cc: split tiles into left&right half if neccessary.
|
||||
* krfb/xupdatescanner.cc: split tiles into left&right half if
|
||||
neccessary.
|
||||
|
||||
* krfb/Makefile.am: fixed a bug for people who "make install" for the
|
||||
first time (did not create share/krfb dir for eventrc)
|
||||
|
||||
* krfb/xupdatescanner.cc: improved scanning algorithm and renamed the file.
|
||||
* krfb/xupdatescanner.cc: improved scanning algorithm and renamed
|
||||
the file.
|
||||
It now calculates the correct height of tiles and only joins them
|
||||
if it wouldn't include too many unused pixels.
|
||||
Result seems to be a reduction between 25% (web browsing) and 40% (text
|
||||
editing) of transmitted raw data. Note that the effectiveness of some
|
||||
encoders decreases with less adjacent regions, so the real reduction is
|
||||
probably less.
|
||||
Result seems to be a reduction between 25% (web browsing) and 40%
|
||||
(text editing) of transmitted raw data. Note that the effectiveness
|
||||
of some encoders decreases with less adjacent regions, so the real
|
||||
reduction is probably less.
|
||||
|
||||
2002-02-18 Tim Jansen <tjansen@tjansen.de>
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ METASOURCES = AUTO
|
||||
bin_PROGRAMS = krfb
|
||||
krfb_SOURCES = rfbcontroller.cc configuration.cc trayicon.cpp \
|
||||
xupdatescanner.cc main.cpp configurationdialog.ui newconnectiondialog.ui \
|
||||
krfbifaceimpl.cc krfbiface.skel
|
||||
krfbifaceimpl.cc krfbiface.skel manageinvitations.ui personalinvitation.ui \
|
||||
invite.ui
|
||||
krfb_LDADD = ../libvncserver/libvncserver.a -lz -lpthread -ljpeg -lXtst \
|
||||
$(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIBSOCKET)
|
||||
|
||||
|
||||
@@ -17,37 +17,133 @@
|
||||
|
||||
#include "configuration.h"
|
||||
|
||||
#include <kconfig.h>
|
||||
#include <kglobal.h>
|
||||
#include <kapplication.h>
|
||||
|
||||
#include <qpushbutton.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qcheckbox.h>
|
||||
|
||||
const int INVITATION_DURATION = 60*60;
|
||||
|
||||
void ConfigurationDialog2::closeEvent(QCloseEvent *)
|
||||
{
|
||||
emit closed();
|
||||
}
|
||||
|
||||
Configuration::Configuration() :
|
||||
preconfiguredFlag(false),
|
||||
void ManageInvitationsDialog2::closeEvent(QCloseEvent *)
|
||||
{
|
||||
emit closed();
|
||||
}
|
||||
|
||||
// TODO:
|
||||
// invitation manage dialog
|
||||
// dialog to add/delete invitation
|
||||
|
||||
Invitation::Invitation() :
|
||||
m_viewItem(0) {
|
||||
m_password = KApplication::randomString(4)+
|
||||
"-"+
|
||||
KApplication::randomString(4);
|
||||
m_creationTime = QDateTime::currentDateTime();
|
||||
m_expirationTime = QDateTime::currentDateTime().addSecs(INVITATION_DURATION);
|
||||
}
|
||||
|
||||
Invitation::Invitation(const QString &tmpPassword,
|
||||
const QDateTime &expirationTime,
|
||||
const QDateTime &creationTime) :
|
||||
m_password(tmpPassword),
|
||||
m_creationTime(creationTime),
|
||||
m_expirationTime(expirationTime),
|
||||
m_viewItem(0) {
|
||||
}
|
||||
|
||||
Invitation::Invitation(const Invitation &x) :
|
||||
m_password(x.m_password),
|
||||
m_creationTime(x.m_creationTime),
|
||||
m_expirationTime(x.m_expirationTime),
|
||||
m_viewItem(0) {
|
||||
}
|
||||
|
||||
Invitation &Invitation::operator= (const Invitation&x) {
|
||||
m_password = x.m_password;
|
||||
m_creationTime = x.m_creationTime;
|
||||
m_expirationTime = x.m_expirationTime;
|
||||
if (m_viewItem)
|
||||
delete m_viewItem;
|
||||
m_viewItem = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Invitation::Invitation(KConfig* config, int num) {
|
||||
m_password = config->readEntry(QString("password%1").arg(num), "");
|
||||
m_creationTime = config->readDateTimeEntry(QString("creation%1").arg(num));
|
||||
m_expirationTime = config->readDateTimeEntry(QString("expiration%1").arg(num));
|
||||
m_viewItem = 0;
|
||||
}
|
||||
|
||||
Invitation::~Invitation() {
|
||||
if (m_viewItem)
|
||||
delete m_viewItem;
|
||||
}
|
||||
|
||||
void Invitation::save(KConfig *config, int num) const {
|
||||
config->writeEntry(QString("password%1").arg(num), m_password);
|
||||
config->writeEntry(QString("creation%1").arg(num), m_creationTime);
|
||||
config->writeEntry(QString("expiration%1").arg(num), m_expirationTime);
|
||||
}
|
||||
|
||||
QString Invitation::password() const {
|
||||
return m_password;
|
||||
}
|
||||
|
||||
QDateTime Invitation::expirationTime() const {
|
||||
return m_expirationTime;
|
||||
}
|
||||
|
||||
QDateTime Invitation::creationTime() const {
|
||||
return m_creationTime;
|
||||
}
|
||||
|
||||
void Invitation::setViewItem(KListViewItem *i) {
|
||||
if (m_viewItem)
|
||||
delete m_viewItem;
|
||||
m_viewItem = i;
|
||||
}
|
||||
|
||||
KListViewItem *Invitation::getViewItem() const{
|
||||
return m_viewItem;
|
||||
}
|
||||
|
||||
Configuration::Configuration(krfb_mode mode) :
|
||||
m_mode(mode),
|
||||
oneConnectionFlag(false)
|
||||
{
|
||||
loadFromKConfig();
|
||||
saveToDialog();
|
||||
saveToDialogs();
|
||||
|
||||
connect(confDlg.okButton, SIGNAL(clicked()),
|
||||
SLOT(okPressed()));
|
||||
connect(confDlg.cancelButton, SIGNAL(clicked()),
|
||||
SLOT(cancelPressed()));
|
||||
connect(confDlg.applyButton, SIGNAL(clicked()),
|
||||
SLOT(applyPressed()));
|
||||
connect(&confDlg, SIGNAL(closed()), SLOT(cancelPressed()));
|
||||
connect(confDlg.okButton, SIGNAL(clicked()), SLOT(configOkPressed()));
|
||||
connect(confDlg.cancelButton, SIGNAL(clicked()), SLOT(configCancelPressed()));
|
||||
connect(confDlg.applyButton, SIGNAL(clicked()), SLOT(configApplyPressed()));
|
||||
connect(&confDlg, SIGNAL(closed()), SLOT(configCancelPressed()));
|
||||
|
||||
connect(confDlg.passwordInput, SIGNAL(textChanged(const QString&)), SLOT(configChanged()) );
|
||||
connect(confDlg.allowUninvitedCB, SIGNAL(clicked()), SLOT(configChanged()) );
|
||||
connect(confDlg.askOnConnectCB, SIGNAL(clicked()), SLOT(configChanged()) );
|
||||
connect(confDlg.allowDesktopControlCB, SIGNAL(clicked()), SLOT(configChanged()) );
|
||||
|
||||
connect(invDlg.closeButton, SIGNAL(clicked()), SLOT(invDlgClosed()));
|
||||
connect(&invDlg, SIGNAL(closed()), SLOT(invDlgClosed()));
|
||||
connect(invDlg.newButton, SIGNAL(clicked()), SIGNAL(createInvitation()));
|
||||
connect(invDlg.deleteOneButton, SIGNAL(clicked()), SLOT(invDlgDeleteOnePressed()));
|
||||
connect(invDlg.deleteAllButton, SIGNAL(clicked()), SLOT(invDlgDeleteAllPressed()));
|
||||
invDlg.listView->setSelectionMode(QListView::Extended);
|
||||
invDlg.listView->setMinimumSize(QSize(400, 100)); // QTs size is much to small
|
||||
}
|
||||
|
||||
Configuration::Configuration(bool oneConnection, bool askOnConnect,
|
||||
bool allowDesktopControl, QString password) :
|
||||
preconfiguredFlag(true),
|
||||
m_mode(KRFB_STAND_ALONE_CMDARG),
|
||||
askOnConnectFlag(askOnConnect),
|
||||
allowDesktopControlFlag(allowDesktopControl),
|
||||
oneConnectionFlag(oneConnection),
|
||||
@@ -55,21 +151,33 @@ Configuration::Configuration(bool oneConnection, bool askOnConnect,
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Configuration::~Configuration() {
|
||||
}
|
||||
|
||||
void Configuration::loadFromKConfig() {
|
||||
if (preconfigured())
|
||||
return;
|
||||
KConfig *config = KGlobal::config();
|
||||
askOnConnectFlag = config->readBoolEntry("askOnConnect", true);
|
||||
allowDesktopControlFlag = config->readBoolEntry("allowDesktopControl",
|
||||
false);
|
||||
passwordString = config->readEntry("password", "");
|
||||
void Configuration::configChanged() {
|
||||
confDlg.applyButton->setEnabled(true);
|
||||
}
|
||||
|
||||
void Configuration::loadFromDialog() {
|
||||
void Configuration::loadFromKConfig() {
|
||||
if (KRFB_STAND_ALONE_CMDARG == mode())
|
||||
return;
|
||||
KConfig c("krfbrc");
|
||||
allowUninvitedFlag = c.readBoolEntry("allowUninvited", true);
|
||||
askOnConnectFlag = c.readBoolEntry("confirmUninvitedConnection", true);
|
||||
allowDesktopControlFlag = c.readBoolEntry("allowDesktopControl", false);
|
||||
passwordString = c.readEntry("uninvitedPassword", "");
|
||||
|
||||
invitationList.clear();
|
||||
c.setGroup("invitations");
|
||||
int num = c.readNumEntry("invitation_num", 0);
|
||||
for (int i = 0; i < num; i++)
|
||||
invitationList.push_back(Invitation(&c, i));
|
||||
|
||||
confDlg.applyButton->setEnabled(false);
|
||||
}
|
||||
|
||||
void Configuration::loadFromDialogs() {
|
||||
allowUninvitedFlag = confDlg.allowUninvitedCB->isChecked();
|
||||
askOnConnectFlag = confDlg.askOnConnectCB->isChecked();
|
||||
allowDesktopControlFlag = confDlg.allowDesktopControlCB->isChecked();
|
||||
QString newPassword = confDlg.passwordInput->text();
|
||||
@@ -80,27 +188,48 @@ void Configuration::loadFromDialog() {
|
||||
}
|
||||
|
||||
void Configuration::saveToKConfig() {
|
||||
if (preconfigured())
|
||||
if (KRFB_STAND_ALONE_CMDARG == mode())
|
||||
return;
|
||||
KConfig *config = KGlobal::config();
|
||||
config->writeEntry("askOnConnect", askOnConnectFlag);
|
||||
config->writeEntry("allowDesktopControl", allowDesktopControlFlag);
|
||||
config->writeEntry("password", passwordString);
|
||||
|
||||
KConfig c("krfbrc");
|
||||
c.writeEntry("confirmUninvitedConnection", askOnConnectFlag);
|
||||
c.writeEntry("allowDesktopControl", allowDesktopControlFlag);
|
||||
c.writeEntry("allowUninvited", allowUninvitedFlag);
|
||||
c.writeEntry("uninvitedPassword", passwordString);
|
||||
|
||||
c.setGroup("invitations");
|
||||
int num = invitationList.count();
|
||||
c.writeEntry("invitation_num", num);
|
||||
int i = 0;
|
||||
while (i < num)
|
||||
invitationList[i++].save(&c, i);
|
||||
|
||||
confDlg.applyButton->setEnabled(false);
|
||||
}
|
||||
|
||||
void Configuration::saveToDialog() {
|
||||
void Configuration::saveToDialogs() {
|
||||
confDlg.allowUninvitedCB->setChecked(allowUninvitedFlag);
|
||||
confDlg.askOnConnectCB->setChecked(askOnConnectFlag);
|
||||
confDlg.allowDesktopControlCB->setChecked(allowDesktopControlFlag);
|
||||
confDlg.passwordInput->setText(passwordString);
|
||||
|
||||
QValueList<Invitation>::iterator it = invitationList.begin();
|
||||
while (it != invitationList.end()) {
|
||||
Invitation &inv = *(it++);
|
||||
if (!inv.getViewItem())
|
||||
inv.setViewItem(new KListViewItem(invDlg.listView,
|
||||
inv.creationTime().toString(Qt::LocalDate),
|
||||
inv.expirationTime().toString(Qt::LocalDate)));
|
||||
}
|
||||
}
|
||||
|
||||
void Configuration::reload() {
|
||||
loadFromKConfig();
|
||||
saveToDialog();
|
||||
saveToDialogs();
|
||||
}
|
||||
|
||||
bool Configuration::preconfigured() const {
|
||||
return preconfiguredFlag;
|
||||
krfb_mode Configuration::mode() const {
|
||||
return m_mode;
|
||||
}
|
||||
|
||||
bool Configuration::oneConnection() const {
|
||||
@@ -119,53 +248,78 @@ QString Configuration::password() const {
|
||||
return passwordString;
|
||||
}
|
||||
|
||||
QValueList<Invitation> &Configuration::invitations() {
|
||||
return invitationList;
|
||||
}
|
||||
|
||||
void Configuration::setOnceConnection(bool oneConnection)
|
||||
{
|
||||
oneConnectionFlag = oneConnection;
|
||||
saveToKConfig();
|
||||
saveToDialog();
|
||||
oneConnectionFlag = oneConnection;
|
||||
saveToKConfig();
|
||||
saveToDialogs();
|
||||
}
|
||||
|
||||
void Configuration::setAskOnConnect(bool askOnConnect)
|
||||
{
|
||||
askOnConnectFlag = askOnConnect;
|
||||
saveToKConfig();
|
||||
saveToDialog();
|
||||
askOnConnectFlag = askOnConnect;
|
||||
saveToKConfig();
|
||||
saveToDialogs();
|
||||
}
|
||||
|
||||
void Configuration::setAllowDesktopControl(bool allowDesktopControl)
|
||||
{
|
||||
allowDesktopControlFlag = allowDesktopControl;
|
||||
saveToKConfig();
|
||||
saveToDialog();
|
||||
allowDesktopControlFlag = allowDesktopControl;
|
||||
saveToKConfig();
|
||||
saveToDialogs();
|
||||
}
|
||||
|
||||
void Configuration::setPassword(QString password)
|
||||
{
|
||||
passwordString = password;
|
||||
emit passwordChanged();
|
||||
saveToKConfig();
|
||||
saveToDialog();
|
||||
passwordString = password;
|
||||
emit passwordChanged();
|
||||
saveToKConfig();
|
||||
saveToDialogs();
|
||||
}
|
||||
|
||||
void Configuration::showDialog() {
|
||||
void Configuration::showConfigDialog() {
|
||||
confDlg.show();
|
||||
}
|
||||
|
||||
void Configuration::okPressed() {
|
||||
loadFromDialog();
|
||||
void Configuration::showManageInvitationsDialog() {
|
||||
updateDialogs();
|
||||
invDlg.show();
|
||||
}
|
||||
|
||||
void Configuration::updateDialogs() {
|
||||
saveToDialogs();
|
||||
invDlg.adjustSize();
|
||||
}
|
||||
|
||||
void Configuration::configOkPressed() {
|
||||
loadFromDialogs();
|
||||
saveToKConfig();
|
||||
confDlg.hide();
|
||||
}
|
||||
|
||||
void Configuration::cancelPressed() {
|
||||
saveToDialog();
|
||||
void Configuration::configCancelPressed() {
|
||||
saveToDialogs();
|
||||
confDlg.hide();
|
||||
}
|
||||
|
||||
void Configuration::applyPressed() {
|
||||
loadFromDialog();
|
||||
void Configuration::configApplyPressed() {
|
||||
loadFromDialogs();
|
||||
saveToKConfig();
|
||||
}
|
||||
|
||||
void Configuration::invDlgClosed() {
|
||||
invDlg.hide();
|
||||
}
|
||||
|
||||
void Configuration::invDlgDeleteOnePressed() {
|
||||
}
|
||||
|
||||
void Configuration::invDlgDeleteAllPressed() {
|
||||
}
|
||||
|
||||
|
||||
#include "configuration.moc"
|
||||
|
||||
@@ -19,10 +19,22 @@
|
||||
#define CONFIGURATION_H
|
||||
|
||||
#include "configurationdialog.h"
|
||||
#include "manageinvitations.h"
|
||||
|
||||
#include <klistview.h>
|
||||
#include <kconfig.h>
|
||||
#include <qobject.h>
|
||||
#include <qvalidator.h>
|
||||
#include <qstring.h>
|
||||
#include <qdatetime.h>
|
||||
|
||||
enum krfb_mode {
|
||||
KRFB_UNKNOWN_MODE = 0,
|
||||
KRFB_STAND_ALONE,
|
||||
KRFB_STAND_ALONE_CMDARG,
|
||||
KRFB_KINETD_MODE,
|
||||
KRFB_INVITATION_MODE
|
||||
};
|
||||
|
||||
class ConfigurationDialog2 : public ConfigurationDialog {
|
||||
Q_OBJECT
|
||||
@@ -32,19 +44,53 @@ signals:
|
||||
void closed();
|
||||
};
|
||||
|
||||
class ManageInvitationsDialog2 : public ManageInvitationsDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
virtual void closeEvent(QCloseEvent *);
|
||||
signals:
|
||||
void closed();
|
||||
};
|
||||
|
||||
class Invitation {
|
||||
public:
|
||||
Invitation();
|
||||
~Invitation();
|
||||
Invitation(KConfig* config, int num);
|
||||
Invitation(const QString &tmpPassword, const QDateTime &expirationTime,
|
||||
const QDateTime &creationTime);
|
||||
Invitation(const Invitation &x);
|
||||
Invitation &operator= (const Invitation&x);
|
||||
|
||||
QString password() const;
|
||||
QDateTime expirationTime() const;
|
||||
QDateTime creationTime() const;
|
||||
|
||||
void setViewItem(KListViewItem*);
|
||||
KListViewItem* getViewItem() const;
|
||||
void save(KConfig *config, int num) const;
|
||||
private:
|
||||
QString m_password;
|
||||
QDateTime m_creationTime;
|
||||
QDateTime m_expirationTime;
|
||||
|
||||
KListViewItem *m_viewItem;
|
||||
};
|
||||
KListViewItem
|
||||
/**
|
||||
* This class stores the app's configuration
|
||||
* This class stores the app's configuration, manages the
|
||||
* standalone-config-dialog and the manage-invitations-dialog
|
||||
* @author Tim Jansen
|
||||
*/
|
||||
class Configuration : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Configuration();
|
||||
Configuration(krfb_mode mode);
|
||||
Configuration(bool oneConnection, bool askOnConnect,
|
||||
bool allowDesktopControl, QString password);
|
||||
~Configuration();
|
||||
|
||||
bool preconfigured() const;
|
||||
krfb_mode mode() const;
|
||||
bool oneConnection() const;
|
||||
bool askOnConnect() const;
|
||||
bool allowDesktopControl() const;
|
||||
@@ -56,31 +102,43 @@ public:
|
||||
void setPassword(QString password);
|
||||
void reload();
|
||||
|
||||
QValueList<Invitation> &invitations();
|
||||
signals:
|
||||
void passwordChanged();
|
||||
void createInvitation();
|
||||
|
||||
public slots:
|
||||
void showDialog();
|
||||
void showConfigDialog();
|
||||
void showManageInvitationsDialog();
|
||||
void updateDialogs();
|
||||
|
||||
private:
|
||||
void loadFromKConfig();
|
||||
void loadFromDialog();
|
||||
void loadFromDialogs();
|
||||
void saveToKConfig();
|
||||
void saveToDialog();
|
||||
void saveToDialogs();
|
||||
|
||||
krfb_mode m_mode;
|
||||
|
||||
ConfigurationDialog2 confDlg;
|
||||
QIntValidator *portValidator;
|
||||
ManageInvitationsDialog2 invDlg;
|
||||
|
||||
bool preconfiguredFlag;
|
||||
bool askOnConnectFlag;
|
||||
bool allowDesktopControlFlag;
|
||||
bool allowUninvitedFlag;
|
||||
bool oneConnectionFlag;
|
||||
QString passwordString;
|
||||
|
||||
QString passwordString;
|
||||
QValueList<Invitation> invitationList;
|
||||
private slots:
|
||||
void okPressed();
|
||||
void cancelPressed();
|
||||
void applyPressed();
|
||||
void configOkPressed();
|
||||
void configCancelPressed();
|
||||
void configApplyPressed();
|
||||
void configChanged();
|
||||
|
||||
void invDlgClosed();
|
||||
void invDlgDeleteOnePressed();
|
||||
void invDlgDeleteAllPressed();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,20 +8,12 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>360</width>
|
||||
<height>236</height>
|
||||
<width>335</width>
|
||||
<height>255</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>0</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>Desktop Sharing: Configuration</string>
|
||||
<string>Configuration - Desktop Sharing</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<pixmap>image0</pixmap>
|
||||
@@ -61,11 +53,28 @@
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>allowUninvitedCB</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Allow &uninvited connections</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Allow connections that do not follow a previous invitation. Be careful to protect your computer when you allow this.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>askOnConnectCB</cstring>
|
||||
@@ -243,8 +252,28 @@
|
||||
</widget>
|
||||
<images>
|
||||
<image name="image0">
|
||||
<data format="XPM.GZ" length="1407">789cad93db4ac4301086effb14a1b95b64b76b150a8b8fa0782988173393367b54d0f542c477377fd2405b7b5a7066cbe6231f49864c560bf5f478af16abe4e34ce79d28d9d2bb5a98cfd3e9ebf9e5ee3b49f36be57eeb1bb54eaf9274a9443dbcbd96186fdd58672e8a0c5845148f65c4aa02ee0216356a609e218106785b2081022cb2a25e99809421817b8f8591b0d40128d8c9cfb2c71c093c02ab2aceda80085fce44cc75f444788746e3126778a3863374de3e87eb1c7458c8b061599aa530f739cce21c32e23e12a87f1c16f642486858aaed10a662f83149c761c25cac387886db0e79a30c375d064fa8ed88336cad38c95a0babed38c3c2d9baa825aba5e344456b48deb1badfc149fec369eea53b0e249415ce5cee82d2bdaf66ed5ee9bd777794a0ecd17483fd132f63acc7e6f4e19833a3e78964f2ed1c8e42c70354d7af840f23ff7fc11b9cf1de876a8a91fe6c925fbe975961</data>
|
||||
<data format="XPM.GZ" length="8078">789cdd98c7721cc91186ef7c0a04f3c650d4b637a1d001de5b8200880d1db2da604038c29b0dbdbb32ffeceec582b30448015a85fa2726e69b32592633ab9abf7c98d8db589df8f0cbbbcb2bbe3aac26aa115f4c7ca8af4f4eee7ffde73f7e7bf73e2926e45f144413d1fbbfbd7bbf7935514dac9d9d360a540a50204f91827707f6e09d9ecb045c0c8c726e7be600e579cfde787960eb7f69e01cbc38b08d67a6e7cadaef0d8cc15336b0f5b73270095e1898c1d33dd7d65f3a30ca997b6eac7c75e00a3cdf738bf9f36dc789f5cfdd78c3a8e3bb9ebbfa67c651d0b4e059e3b4ecca0fc06110e636ff29701224b5958fc07990e7982f1f838ba0c863d4bfeb990bf06dcfb65eecc0555065980faff45cdafc6e94c57c5085e0497012266cfd7f06a761da98fd7be3346d6d3e042ec222857d5eee39afc14b3d97369e4d30879cc31e1f82abb04a8dbf2847611426d6df09b8888a18fdd145cf564ee7039bbd4fe0322a131baf0773c4dd78578de3dcfc81bf1a6741577e04aea22a36ffb4f2366a538cdf61be71a002c37f623c688f7889b3986d3c740dce55ca1efb19972a947f04b30a7c05ae5460ac775cabd0ff3eb851c13ee697a8c398ff263d77fe760ad60db5f5c57e26910aed2b70ac42f95ec789ad1f617f123c28dfedd8a7660ff3497215cae14f89ec4e6bf383ff279cb0ad1f617f13af427dc46bd2a850bedf73b71f5bc659d2f9f38331e7564e985faa0e6af35b372eb8b6f961fc69a44239e22b8d55e035e33ca96dbf108f291e30fc2fcd5560c45f5aa49dbfd343cfa5cd7f71602b877fa4a50ae3413e49598572f853ea5528477e936013a11cf34f5b1518fb95052ad4477916aac073e04805463ece6215da07e04485f20d70aa02637db24285f94c0f0cfb0ef3cd4a15fac3fa659c716bf9cfec3377f1e642709575f9c7213eb24605b6f1b42af477a98c70c1781dfc01ee65feb7615c8a03a17c1b8c0d427bc4439ea9c0c87f391eb4afc1850aede17f79a902233fe75e0546fce5950a6ced1b1518f92c6f5560c46fa109d8e263aee7ce5fd1bed08465fb83f82f621518fe05f7b2fd803f633b301f1781310130fcadc083fe91bfc4f94428473e90c34104463e2abc0aeb61e5f5b01e8db10a8cfd281a15ea6f1bcbf6dbfa20df16ad0a8c7c50062a30e2bfd4846cf385bf20fd59fc7d34f67965ed11cf65a2c27c62b0844fe74fc83f703fac8747fc9479ef1fd41aabd03fe683e5b0f9e1bc2ef18011dfa55781719e9655d99d8f0ef9a0ac55b067fd377dff0ee74fd9aac028e780bbfb9047bc72d8f7478db10af5b15fac0794e527c4030febe30f3aeec7931aab501ff1cdc9b0bf38df905ecc7f70bf630d50ac175bfba2efdf4d1b73777f7038afb954c13efc957def8fdec65f0dfe3569ac42ff8877ae5311eab3f130be0b631518e7918f5460ecb78f55609cbf382e2cfe71fff4591cc6b67e386fe0ce367e9c5fd84e1b1fee239e55606b5fa9c0b82ff95a85fe111fbef56d63fb8178ab8234b0f3cee1fe54e985c5ce1b8cb78afaf3c0e17cc3f16dfb83f8a9121518f9bd2afaf561ac078663f1087fa9e5f6d79d7fe71db71d633feb34f4a1ddcf118f75a502aff7dcd59f346eea8e919f6a3cd81fe4c7bad11b0f18f9b389faf5a559631518ebd170d3e577c27e3778c0c8cf4807666fbe63dfd547be40b8d8f981fcd9e251debc7a5bfd3fd970f4b6ea6cb0f3ae7a1379c79d0def6ad7bc896ae73b1b9550fb266a5cf5071b076ef48a3318497fdfda18b9c357dc8943e9ef5b1bc2afe84f439fdfda18efe3eecb78fd594cfc6fd9403f47eed89db85377e6beba737c5ec86f47ee12ba72d7eee65b7b2fb1d18df356dadfc1c6bd7b7093d2df949b76336e56becdb979b720658b6ec92dbb15b7ea7ecec68d5b73eb9d8d0de97bd36db98f6e5b2cad49ff7332ab4f52b2e376dd9eb4fe211bd2fb9e8cebb3accb2c32c0a6db7781f4baef42c8beebe7ba8bc4eeb1cc65512c0d6bf6021bb72e76898c3b95fe16e4db9cacd4becb9e7c6ebb5c4a75fd1624166a996d2163bb79a18d52685dfa08c9c96865e5895c46fce433971a819b222f9f3955549346f7f5f33630df496aa5fd9cf4f3209f0734a2c331fa227bd4d721cc6ec10574841ebe6fe356b4a4eb43c774e20ee994cee82b9dd3c5139dcbaf67526a3aa64bf7402c6b78891ebe6fa3141d637d8ec5c2155d4b5f37744b774f742bbf7e9552d3bd58913594b98cd0c3f76d8c44fbb63e92d7127aa0499aa2699a79a269f975524a5b95ccbb5fbd7df1e6fbefdba04b99f59c3b84029aa5399aa705e973919668b9d392d00cadd02aadd13a6dd026cdcabea38dcc678bb69eb1712ffa28b557685b2c7c1a6c2cd10eed76da119aa13db1f299f6c5caa6d49ba56d8976b1213bbff0cc5a8928704b144acb88624a28a58c722aa864c7e2b4eca814ca75c5e4a5de7325354da15be25a6672fcbc0d6eac8dbc257866f4d5f2018ff810a587f2ed80db3136b44df3fcf9f1a73646fc858f507a24df466f62e3984ffa338e4f84feaa79c8ce4b0efa791b2fd90ff1603e7d990dc955f0abdf6d8cf5ab8c523ee3af7cde8de8c2ad0f169ecfbb44a77cc9577ccd3712012b120963e2836ff98eeff98127bb55bab4de5f98dbe517b132c5d37c2d91bc2a56c6c439cff02ccff124cf77abb4f023365047577ec15df2222ff132af3ccd57bcca6bbcce1bac2f5f8dd45b787cdff8817bc97023e3cda77997b7f823eb4938d4f9c9bbcfef363e3d3d3f788777794f6efcffa18d71d69eeaf5ee893faabfdec6ab69bc0dbc7ff067de7f95b7c3f1ef1f788fa223b9535db9377a8fe280438e38e6c48d38e54cbe871cd87b1d37b84b8ce49e7b80d1ac0ddf1f973eae33f67d90732eb8f4ce935bf3ec3d97c27957774dee43aa44eef1adfc25c3f7c7a58feb8cb5e12bce7ded1b2fe3f40762a516aebaba07729b55ddc93b482b7f77c3f7c7a58feb3cb1e147725b997a0bd1961ffd17ff2fe36d6dfcebefeffe0dd22dc353</data>
|
||||
</image>
|
||||
</images>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>allowUninvitedCB</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>askOnConnectCB</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>allowUninvitedCB</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>allowDesktopControlCB</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>allowUninvitedCB</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>Frame4</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -12,7 +12,6 @@ k_dcop:
|
||||
* If a client is connected it will be disconnected.
|
||||
*/
|
||||
virtual void disconnect() = 0;
|
||||
// virtual void setWindowID(int) = 0;
|
||||
|
||||
/**
|
||||
* Quites krfb, connected clients will be disconnected.
|
||||
|
||||
@@ -88,18 +88,11 @@ static KCmdLineOptions options[] =
|
||||
* + does not accept connections, no tray icons
|
||||
*
|
||||
* TODO:
|
||||
* - invitations
|
||||
* - kcontrol config for kinetd mode
|
||||
* - invitations (see configuration.cc for overview)
|
||||
* - implement invitation mode
|
||||
* - display kcm in kinetd mode
|
||||
*/
|
||||
|
||||
enum krfb_mode {
|
||||
KRFB_UNKNOWN_MODE = 0,
|
||||
KRFB_STAND_ALONE,
|
||||
KRFB_STAND_ALONE_CMDARG,
|
||||
KRFB_KINETD_MODE,
|
||||
KRFB_INVITATION_MODE
|
||||
};
|
||||
|
||||
bool checkKInetd() {
|
||||
bool enabled;
|
||||
DCOPClient *d = KApplication::dcopClient();
|
||||
@@ -166,9 +159,9 @@ int main(int argc, char *argv[])
|
||||
bool askOnConnect = !args->isSet(ARG_DONT_CONFIRM_CONNECT);
|
||||
bool allowDesktopControl = args->isSet(ARG_REMOTE_CONTROL);
|
||||
QString password = args->getOption(ARG_PASSWORD);
|
||||
mode = KRFB_STAND_ALONE_CMDARG;
|
||||
config = new Configuration(oneConnection, askOnConnect,
|
||||
allowDesktopControl, password);
|
||||
mode = KRFB_STAND_ALONE_CMDARG;
|
||||
}
|
||||
else {
|
||||
if (args->isSet(ARG_STAND_ALONE)) {
|
||||
@@ -178,12 +171,13 @@ int main(int argc, char *argv[])
|
||||
fdString = args->getOption(ARG_KINETD);
|
||||
mode = KRFB_KINETD_MODE;
|
||||
}
|
||||
config = new Configuration();
|
||||
if (mode == KRFB_UNKNOWN_MODE)
|
||||
mode = checkKInetd() ? KRFB_INVITATION_MODE : KRFB_STAND_ALONE;
|
||||
|
||||
config = new Configuration(mode);
|
||||
}
|
||||
args->clear();
|
||||
|
||||
if (mode == KRFB_UNKNOWN_MODE)
|
||||
mode = checkKInetd() ? KRFB_INVITATION_MODE : KRFB_STAND_ALONE;
|
||||
|
||||
if (mode == KRFB_INVITATION_MODE) {
|
||||
// TODO: display invitation
|
||||
@@ -208,7 +202,9 @@ int main(int argc, char *argv[])
|
||||
QObject::connect(&trayicon, SIGNAL(connectionClosed()),
|
||||
&controller, SLOT(closeConnection()));
|
||||
QObject::connect(&trayicon, SIGNAL(showConfigure()),
|
||||
config, SLOT(showDialog()));
|
||||
config, SLOT(showConfigDialog()));
|
||||
QObject::connect(&trayicon, SIGNAL(showManageInvitations()),
|
||||
config, SLOT(showManageInvitationsDialog()));
|
||||
|
||||
QObject::connect(&dcopiface, SIGNAL(connectionClosed()),
|
||||
&controller, SLOT(closeConnection()));
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -488,21 +488,43 @@ void RFBController::dialogRefused()
|
||||
emit sessionRefused();
|
||||
}
|
||||
|
||||
bool RFBController::handleCheckPassword(rfbClientPtr cl,
|
||||
const char *response,
|
||||
int len)
|
||||
{
|
||||
bool checkPassword(const QString &p,
|
||||
unsigned char *challenge,
|
||||
const char *response,
|
||||
int len) {
|
||||
|
||||
char passwd[8];
|
||||
|
||||
QString cpassword = configuration->password();
|
||||
bzero(passwd, 8);
|
||||
if (!cpassword.isNull())
|
||||
strncpy(passwd, cpassword.latin1(),
|
||||
(8 <= cpassword.length()) ? 8 : cpassword.length());
|
||||
|
||||
vncEncryptBytes(cl->authChallenge, passwd);
|
||||
|
||||
if (memcmp(cl->authChallenge, response, len) != 0) {
|
||||
if (!p.isNull())
|
||||
strncpy(passwd, p.latin1(), (8 <= p.length()) ? 8 : p.length());
|
||||
|
||||
vncEncryptBytes(challenge, passwd);
|
||||
return memcmp(challenge, response, len) == 0;
|
||||
}
|
||||
|
||||
bool RFBController::handleCheckPassword(rfbClientPtr cl,
|
||||
const char *response,
|
||||
int len)
|
||||
{
|
||||
bool authd = checkPassword(configuration->password(),
|
||||
cl->authChallenge, response, len);
|
||||
|
||||
if (!authd) {
|
||||
QValueList<Invitation>::iterator it =
|
||||
configuration->invitations().begin();
|
||||
while (it != configuration->invitations().end()) {
|
||||
if (checkPassword((*it).password(),
|
||||
cl->authChallenge, response, len)) {
|
||||
authd = true;
|
||||
configuration->invitations().remove(it);
|
||||
break;
|
||||
}
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!authd) {
|
||||
QString host, port;
|
||||
KExtendedSocket::resolve(KExtendedSocket::peerAddress(cl->sock),
|
||||
host, port);
|
||||
|
||||
@@ -35,10 +35,13 @@ TrayIcon::TrayIcon(KDialog *d, Configuration *c) :
|
||||
setPixmap(trayIconClosed);
|
||||
|
||||
configureAction = KStdAction::preferences(0, 0, &actionCollection);
|
||||
if (!c->preconfigured())
|
||||
manageInvitationsAction = new KAction(i18n("Manage &invitations"));
|
||||
if (c->mode() != KRFB_STAND_ALONE_CMDARG) {
|
||||
configureAction->plug(contextMenu());
|
||||
manageInvitationsAction->plug(contextMenu());
|
||||
}
|
||||
|
||||
closeConnectionAction = new KAction(i18n("Close connection"));
|
||||
closeConnectionAction = new KAction(i18n("Cl&ose connection"));
|
||||
closeConnectionAction->plug(contextMenu());
|
||||
closeConnectionAction->setEnabled(false);
|
||||
actionCollection.insert(closeConnectionAction);
|
||||
@@ -48,8 +51,10 @@ TrayIcon::TrayIcon(KDialog *d, Configuration *c) :
|
||||
aboutAction->plug(contextMenu());
|
||||
|
||||
connect(configureAction, SIGNAL(activated()), SIGNAL(showConfigure()));
|
||||
connect(manageInvitationsAction, SIGNAL(activated()),
|
||||
SIGNAL(showManageInvitations()));
|
||||
connect(aboutAction, SIGNAL(activated()), SLOT(showAbout()));
|
||||
connect(closeConnectionAction, SIGNAL(activated()),
|
||||
connect(closeConnectionAction, SIGNAL(activated()),
|
||||
SIGNAL(connectionClosed()));
|
||||
actionCollection.insert(closeConnectionAction);
|
||||
show();
|
||||
|
||||
@@ -44,6 +44,7 @@ public slots:
|
||||
signals:
|
||||
void connectionClosed();
|
||||
void showConfigure();
|
||||
void showManageInvitations();
|
||||
|
||||
private:
|
||||
KPixmap trayIconOpen;
|
||||
@@ -52,6 +53,7 @@ private:
|
||||
KActionCollection actionCollection;
|
||||
KAction* closeConnectionAction;
|
||||
KAction* configureAction;
|
||||
KAction* manageInvitationsAction;
|
||||
KAction* aboutAction;
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -21,9 +21,10 @@
|
||||
* December 15th 2001: removed coments, mouse pointer options and some
|
||||
* other stuff
|
||||
* January 10th 2002: improved hint creation (join adjacent hints)
|
||||
*
|
||||
* February 20th: use only partial tiles
|
||||
*
|
||||
* Tim Jansen <tim@tjansen.de>
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
@@ -226,7 +227,6 @@ void XUpdateScanner::createHintFromTile(int x, int y, int th, Hint &hint)
|
||||
|
||||
void XUpdateScanner::addTileToHint(int x, int y, int th, Hint &hint)
|
||||
{
|
||||
// todo: refuse to add hint if this one is much smaller or bigger (use x0)
|
||||
unsigned int w = width - x;
|
||||
unsigned int h = height - y;
|
||||
if (w > tileWidth)
|
||||
|
||||
Reference in New Issue
Block a user