1
0
mirror of https://invent.kde.org/network/krfb synced 2024-07-03 00:18:36 +00:00

Added new option to popup menu: enable/disable remote control

svn path=/trunk/kdenetwork/krfb/; revision=149925
This commit is contained in:
Tim Jansen 2002-04-16 22:37:40 +00:00
parent 0c1a47c74d
commit 557e232e9d
6 changed files with 22 additions and 7 deletions

View File

@ -80,7 +80,6 @@ public:
void setAllowUninvited(bool allowUninvited);
void setAskOnConnect(bool askOnConnect);
void setAllowDesktopControl(bool allowDesktopControl);
void setPassword(QString password);
void save();
void update();
@ -91,6 +90,7 @@ signals:
void invitationFinished();
public slots:
void setAllowDesktopControl(bool allowDesktopControl);
void showManageInvitationsDialog();
void showInvitationDialog();
void showPersonalInvitationDialog();

View File

@ -162,6 +162,8 @@ int main(int argc, char *argv[])
QObject::connect(&trayicon, SIGNAL(showManageInvitations()),
config, SLOT(showManageInvitationsDialog()));
QObject::connect(&trayicon, SIGNAL(enableDesktopControl(bool)),
config, SLOT(setAllowDesktopControl(bool)));
QObject::connect(&trayicon, SIGNAL(diconnectedMessageDisplayed()),
&app, SLOT(quit()));

View File

@ -254,7 +254,6 @@ void SessionEstablishedEvent::exec() {
RFBController::RFBController(Configuration *c) :
allowRemoteControl(false),
connectionNum(0),
configuration(c),
closePending(false),
@ -380,7 +379,7 @@ void RFBController::connectionAccepted(bool aRC)
if (state != RFB_CONNECTING)
return;
allowRemoteControl = aRC;
configuration->setAllowDesktopControl(aRC);
connectionNum++;
idleTimer.start(IDLE_PAUSE);
@ -609,7 +608,7 @@ enum rfbNewClientAction RFBController::handleNewClient(rfbClientPtr cl)
.arg(remoteIp));
dialog.ipLabel->setText(remoteIp);
dialog.allowRemoteControlCB->setChecked(configuration->allowDesktopControl());
dialog.allowRemoteControlCB->setChecked(false);
dialog.setFixedSize(dialog.sizeHint());
dialog.show();
return RFB_CLIENT_ON_HOLD;
@ -623,7 +622,7 @@ void RFBController::handleClientGone()
}
void RFBController::handleKeyEvent(bool down, KeySym keySym) {
if (!allowRemoteControl)
if (!configuration->allowDesktopControl())
return;
asyncMutex.lock();
@ -632,7 +631,7 @@ void RFBController::handleKeyEvent(bool down, KeySym keySym) {
}
void RFBController::handlePointerEvent(int button_mask, int x, int y) {
if (!allowRemoteControl)
if (!configuration->allowDesktopControl())
return;
asyncMutex.lock();

View File

@ -159,7 +159,6 @@ private:
bool checkAsyncEvents();
void sendSessionEstablished();
bool allowRemoteControl;
int connectionNum;
QString remoteIp;

View File

@ -48,6 +48,7 @@ KPassivePopup2 *KPassivePopup2::message( const QString &caption, const QString &
TrayIcon::TrayIcon(KDialog *d, Configuration *c) :
KSystemTray(0, "krfb trayicon"),
configuration(c),
aboutDialog(d),
actionCollection(this),
quitting(false)
@ -63,6 +64,15 @@ TrayIcon::TrayIcon(KDialog *d, Configuration *c) :
manageInvitationsAction->plug(contextMenu());
contextMenu()->insertSeparator();
enableControlAction = new KToggleAction(i18n("Enable remote control"));
enableControlAction->plug(contextMenu());
connect(enableControlAction, SIGNAL(toggled(bool)),
SIGNAL(enableDesktopControl(bool)));
enableControlAction->setChecked(configuration->allowDesktopControl());
contextMenu()->insertSeparator();
aboutAction = KStdAction::aboutApp(this, SLOT(showAbout()), &actionCollection);
aboutAction->plug(contextMenu());
@ -81,6 +91,8 @@ void TrayIcon::prepareQuit() {
}
void TrayIcon::showConnectedMessage() {
enableControlAction->setChecked(configuration->allowDesktopControl());
setPixmap(trayIconOpen);
KPassivePopup2 *p = KPassivePopup2::message(i18n("Desktop Sharing"),
i18n("The remote user has been authenticated and is now connected."),

View File

@ -60,6 +60,7 @@ public:
signals:
void showManageInvitations();
void diconnectedMessageDisplayed();
void enableDesktopControl(bool);
public slots:
void prepareQuit();
@ -69,10 +70,12 @@ public slots:
private:
KPixmap trayIconOpen;
KPixmap trayIconClosed;
Configuration *configuration;
KDialog* aboutDialog;
KActionCollection actionCollection;
KAction* manageInvitationsAction;
KAction* aboutAction;
KToggleAction* enableControlAction;
bool quitting;
private slots: