mirror of
https://invent.kde.org/network/krfb
synced 2024-07-05 17:38:38 +00:00
Added new option to popup menu: enable/disable remote control
svn path=/trunk/kdenetwork/krfb/; revision=149925
This commit is contained in:
parent
0c1a47c74d
commit
557e232e9d
|
@ -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();
|
||||
|
|
|
@ -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()));
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -159,7 +159,6 @@ private:
|
|||
bool checkAsyncEvents();
|
||||
void sendSessionEstablished();
|
||||
|
||||
bool allowRemoteControl;
|
||||
int connectionNum;
|
||||
QString remoteIp;
|
||||
|
||||
|
|
|
@ -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."),
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue
Block a user