mirror of
https://invent.kde.org/network/krfb
synced 2024-07-01 07:24:29 +00:00
set RFB desktop name
svn path=/trunk/kdenetwork/krfb/; revision=191529
This commit is contained in:
parent
38f4d170f5
commit
4015cb8b89
7
TODO
7
TODO
|
@ -1,10 +1,7 @@
|
|||
For 3.1:
|
||||
- write SLP service template for remote desktop protocols
|
||||
(documentation)
|
||||
|
||||
For 3.2:
|
||||
- set desktop name (username@hostname)
|
||||
- apply multi-desktop patch
|
||||
- write SLP service template for remote desktop protocols
|
||||
(documentation)
|
||||
- trayicon mouse-over text
|
||||
- when krfb is started with URL arguments and without connection
|
||||
quality, add some kind of smart algorithm to determine whether the
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
#include "rfbcontroller.h"
|
||||
#include "kuser.h"
|
||||
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/in.h>
|
||||
|
@ -324,6 +325,11 @@ RFBController::RFBController(Configuration *c) :
|
|||
asyncQueue.setAutoDelete(true);
|
||||
|
||||
KeyboardEvent::initKeycodes();
|
||||
|
||||
char hostname[256];
|
||||
if (gethostname(hostname, 256))
|
||||
hostname[0] = 0;
|
||||
desktopName = QString(i18n("%1@%2 (shared desktop)")).arg(KUser().loginName()).arg(hostname);
|
||||
}
|
||||
|
||||
RFBController::~RFBController()
|
||||
|
@ -395,6 +401,8 @@ void RFBController::startServer(int inetdFd, bool xtestGrab)
|
|||
server->newClientHook = newClientHook;
|
||||
server->passwordCheck = passwordCheck;
|
||||
|
||||
server->desktopName = desktopName.latin1();
|
||||
|
||||
if (!myCursor)
|
||||
myCursor = rfbMakeXCursor(19, 19, (char*) cur, (char*) mask);
|
||||
server->cursor = myCursor;
|
||||
|
|
|
@ -169,6 +169,8 @@ private:
|
|||
XUpdateScanner *scanner;
|
||||
ConnectionDialog dialog;
|
||||
|
||||
QString desktopName;
|
||||
|
||||
rfbScreenInfoPtr server;
|
||||
|
||||
XImage *framebufferImage;
|
||||
|
|
|
@ -49,8 +49,8 @@ public:
|
|||
};
|
||||
|
||||
|
||||
KUser::KUser() {
|
||||
fillPasswd(getpwuid(getuid()));
|
||||
KUser::KUser(bool effective) {
|
||||
fillPasswd(getpwuid(effective ? geteuid() : getuid()));
|
||||
}
|
||||
|
||||
KUser::KUser(long uid) {
|
||||
|
@ -61,6 +61,28 @@ KUser::KUser(const QString& name) {
|
|||
fillPasswd(getpwnam(name.latin1()));
|
||||
}
|
||||
|
||||
KUser::KUser(const KUser &user) {
|
||||
d = new KUserPrivate(user.uid(),
|
||||
user.loginName(),
|
||||
user.fullName());
|
||||
}
|
||||
|
||||
KUser& KUser::operator =(const KUser& user) {
|
||||
delete d;
|
||||
d = new KUserPrivate(user.uid(),
|
||||
user.loginName(),
|
||||
user.fullName());
|
||||
}
|
||||
|
||||
bool KUser::operator ==(const KUser& user) {
|
||||
if (isValid() != user.isValid())
|
||||
return false;
|
||||
if (isValid())
|
||||
return uid() == user.uid();
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
void KUser::fillPasswd(struct passwd *p) {
|
||||
if (p) {
|
||||
QString fn(p->pw_gecos);
|
||||
|
@ -87,6 +109,10 @@ long KUser::uid() const {
|
|||
return -1;
|
||||
}
|
||||
|
||||
bool KUser::isSuperUser() const {
|
||||
return uid() == 0;
|
||||
}
|
||||
|
||||
QString KUser::loginName() const {
|
||||
if (d->valid)
|
||||
return d->loginName;
|
||||
|
|
|
@ -36,15 +36,22 @@ struct passwd;
|
|||
*
|
||||
* @author Tim Jansen <tim@tjansen.de>
|
||||
* @short Represents a user on your system
|
||||
* @since 3.2
|
||||
*/
|
||||
class KUser {
|
||||
|
||||
public:
|
||||
/**
|
||||
* Creates an object that contains information about the current user.
|
||||
* (As returned by getuid(2)).
|
||||
* (as returned by getuid(2) or geteuid(2)).
|
||||
* @param effective if true, returns the effective user. If false, the
|
||||
* real user will be returned. The difference is that when the
|
||||
* user uses a command like "su", this will change the effective
|
||||
* user, but not the real user. Use the effective user when
|
||||
* checking permissions, and the real user for displaying
|
||||
* information about the user
|
||||
*/
|
||||
KUser();
|
||||
KUser(bool effective = false);
|
||||
|
||||
/**
|
||||
* Creates an object for the user with the given user id.
|
||||
|
@ -61,6 +68,24 @@ public:
|
|||
*/
|
||||
KUser(const QString& name);
|
||||
|
||||
/**
|
||||
* Copy constructor.
|
||||
* Makes a deep copy.
|
||||
*/
|
||||
KUser(const KUser &user);
|
||||
|
||||
/**
|
||||
* Assignment operator.
|
||||
* Makes a deep copy.
|
||||
*/
|
||||
KUser& operator =(const KUser& user);
|
||||
|
||||
/**
|
||||
* Two KUser objects are equal if @ref isValid() and the uid() are
|
||||
* identical.
|
||||
*/
|
||||
bool operator ==(const KUser& user);
|
||||
|
||||
/**
|
||||
* Returns true if the user is valid. A KUser object can be invalid if
|
||||
* you created it with an non-existing uid or name.
|
||||
|
@ -74,6 +99,12 @@ public:
|
|||
*/
|
||||
long uid() const;
|
||||
|
||||
/**
|
||||
* Checks whether the user it the super user (root).
|
||||
* @return true if the user is root
|
||||
*/
|
||||
bool isSuperUser() const;
|
||||
|
||||
/**
|
||||
* The login name of the user.
|
||||
* @the login name of the user or QString::null if user is invalid
|
||||
|
|
Loading…
Reference in New Issue
Block a user