svn path=/trunk/kdenetwork/krfb/; revision=127110
This commit is contained in:
Tim Jansen
2001-12-14 16:25:06 +00:00
parent 584e22d6c8
commit 3643f224cd
11 changed files with 885 additions and 365 deletions

View File

@@ -1,10 +1,8 @@
####### kdevelop will overwrite this part!!! (begin)##########
SUBDIRS = krfb po doc lib include SUBDIRS = krfb po doc include
EXTRA_DIST = krfb.kdevprj admin AUTHORS COPYING ChangeLog INSTALL README TODO krfb.lsm EXTRA_DIST = admin AUTHORS COPYING ChangeLog INSTALL README TODO krfb.lsm
####### kdevelop will overwrite this part!!! (end)############
# not a GNU package. You can remove this line, if # not a GNU package. You can remove this line, if
# have all needed files, that a GNU package needs # have all needed files, that a GNU package needs
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign

View File

@@ -2,3 +2,6 @@
AM_INIT_AUTOMAKE(krfb,0.1) AM_INIT_AUTOMAKE(krfb,0.1)
AC_CHECK_HEADER(X11/extensions/XTest.h,
[],
AC_MSG_ERROR([XTest extension header not found]))

View File

@@ -1,321 +0,0 @@
[AUTHORS]
dist=true
install=false
install_location=
type=DATA
[COPYING]
dist=true
install=false
install_location=
type=DATA
[ChangeLog]
dist=true
install=false
install_location=
type=DATA
[Config for BinMakefileAm]
bin_program=krfb
cxxflags=-O0 -g3 -Wall
ldadd=\s$(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI)\s
ldflags=\s
[General]
AMChanged=true
author=Tim Jansen
configure_args=
email=tim@tjansen.de
kdevprj_version=1.3
lfv_open_groups=
makefiles=Makefile.am,krfb/Makefile.am,doc/Makefile.am,doc/en/Makefile.am,po/Makefile.am,lib/Makefile.am,include/Makefile.am
project_name=Krfb
project_type=mini_kde2
sgml_file=/home/tim/work/krfb/doc/en/index.docbook
sub_dir=krfb/
version=0.1
version_control=CVS
workspace=1
[INSTALL]
dist=true
install=false
install_location=
type=DATA
[LFV Groups]
GNU=AUTHORS,COPYING,ChangeLog,INSTALL,README,TODO,NEWS
Headers=*.h,*.hh,*.hxx,*.hpp,*.H
Others=*
Sources=*.cpp,*.c,*.cc,*.C,*.cxx,*.ec,*.ecpp,*.lxx,*.l++,*.ll,*.l
Translations=*.po
User Interface=*.kdevdlg,*.ui,*.rc
groups=Headers,Sources,User Interface,Translations,GNU,Others
[Makefile.am]
files=krfb.kdevprj,admin,AUTHORS,COPYING,ChangeLog,INSTALL,README,TODO,krfb.lsm
sub_dirs=krfb,po,doc,lib,include
type=normal
[README]
dist=true
install=false
install_location=
type=DATA
[TODO]
dist=true
install=false
install_location=
type=DATA
[admin]
dist=true
install=false
install_location=
type=DATA
[doc/Makefile.am]
sub_dirs=en
type=normal
[doc/en/Makefile.am]
files=doc/en/index.docbook
sub_dirs=
type=normal
[doc/en/index.docbook]
dist=true
install=false
install_location=$$(kde_icondir)/locolor/16x16/apps/krfb.png
type=DATA
[include/Connection.h]
dist=true
install=false
install_location=
type=HEADER
[include/Framebuffer.h]
dist=true
install=false
install_location=
type=HEADER
[include/Makefile.am]
files=include/Connection.h,include/d3des.h,include/Framebuffer.h,include/PixelFormatFramebuffer.h,include/rfb.h,include/rfbClient.h,include/rfbServer.h,include/ScaleFramebuffer.h,include/version.h,include/ZlibConnection.h
[include/PixelFormatFramebuffer.h]
dist=true
install=false
install_location=
type=HEADER
[include/ScaleFramebuffer.h]
dist=true
install=false
install_location=
type=HEADER
[include/ZlibConnection.h]
dist=true
install=false
install_location=
type=HEADER
[include/d3des.h]
dist=true
install=false
install_location=
type=HEADER
[include/rfb.h]
dist=true
install=false
install_location=
type=HEADER
[include/rfbClient.h]
dist=true
install=false
install_location=
type=HEADER
[include/rfbServer.h]
dist=true
install=false
install_location=
type=HEADER
[include/version.h]
dist=true
install=false
install_location=
type=HEADER
[krfb.kdevprj]
dist=true
install=false
install_location=
type=DATA
[krfb.lsm]
dist=true
install=false
install_location=
type=DATA
[krfb/Makefile.am]
files=krfb/main.cpp,krfb/krfb.desktop,krfb/lo32-app-krfb.png,krfb/lo16-app-krfb.png,krfb/rfbserver.cpp,krfb/rfbserver.h,krfb/eyes-closed24.png,krfb/eyes-open24.png,krfb/XUpdateScanner.cc,krfb/XUpdateScanner.h
sub_dirs=
type=prog_main
[krfb/XUpdateScanner.cc]
dist=true
install=false
install_location=
type=SOURCE
[krfb/XUpdateScanner.h]
dist=true
install=false
install_location=
type=HEADER
[krfb/eyes-closed24.png]
dist=true
install=false
install_location=
type=DATA
[krfb/eyes-open24.png]
dist=true
install=false
install_location=
type=DATA
[krfb/krfb.desktop]
dist=true
install=true
install_location=$$(kde_appsdir)/Applications/krfb.desktop
type=DATA
[krfb/lo16-app-krfb.png]
dist=true
install=true
install_location=$$(kde_icondir)/locolor/16x16/apps/krfb.png
type=DATA
[krfb/lo32-app-krfb.png]
dist=true
install=true
install_location=$$(kde_icondir)/locolor/32x32/apps/krfb.png
type=DATA
[krfb/main.cpp]
dist=true
install=false
install_location=
type=SOURCE
[krfb/rfbserver.cpp]
dist=true
install=false
install_location=
type=SOURCE
[krfb/rfbserver.h]
dist=true
install=false
install_location=
type=HEADER
[lib/Connection.cc]
dist=true
install=false
install_location=
type=SOURCE
[lib/Framebuffer.cc]
dist=true
install=false
install_location=
type=SOURCE
[lib/Makefile.am]
files=lib/computeSubrectDimensions.cc,lib/Connection.cc,lib/d3des.cc,lib/encodeRectangleCoRRE.cc,lib/encodeRectangleHextile.cc,lib/encodeRectangleRRE.cc,lib/Framebuffer.cc,lib/PixelFormatFramebuffer.cc,lib/rfb.cc,lib/rfbClient.cc,lib/rfbServer.cc,lib/ScaleFramebuffer.cc,lib/ZlibConnection.cc
sharedlib_LDFLAGS=-version-info 0:0:1
sharedlib_rootname=lib
sub_dirs=
type=static_library
[lib/PixelFormatFramebuffer.cc]
dist=true
install=false
install_location=
type=SOURCE
[lib/ScaleFramebuffer.cc]
dist=true
install=false
install_location=
type=SOURCE
[lib/ZlibConnection.cc]
dist=true
install=false
install_location=
type=SOURCE
[lib/computeSubrectDimensions.cc]
dist=true
install=false
install_location=
type=SOURCE
[lib/d3des.cc]
dist=true
install=false
install_location=
type=SOURCE
[lib/encodeRectangleCoRRE.cc]
dist=true
install=false
install_location=
type=SOURCE
[lib/encodeRectangleHextile.cc]
dist=true
install=false
install_location=
type=SOURCE
[lib/encodeRectangleRRE.cc]
dist=true
install=false
install_location=
type=SOURCE
[lib/rfb.cc]
dist=true
install=false
install_location=
type=SOURCE
[lib/rfbClient.cc]
dist=true
install=false
install_location=
type=SOURCE
[lib/rfbServer.cc]
dist=true
install=false
install_location=
type=SOURCE
[po/Makefile.am]
sub_dirs=
type=po

View File

@@ -1,32 +1,30 @@
####### kdevelop will overwrite this part!!! (begin)##########
bin_PROGRAMS = krfb bin_PROGRAMS = krfb
krfb_SOURCES = XUpdateScanner.cc rfbserver.cpp main.cpp krfb_SOURCES = trayicon.cpp XUpdateScanner.cc rfbserver.cpp main.cpp configurationdialog.ui newconnectiondialog.ui configuration.cpp
krfb_LDADD = ./lib/liblib.a $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIBSOCKET) krfb_LDADD = ./lib/liblib.a $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIBSOCKET)
SUBDIRS = lib SUBDIRS = lib
EXTRA_DIST = main.cpp krfb.desktop lo32-app-krfb.png lo16-app-krfb.png rfbserver.cpp rfbserver.h eyes-closed24.png eyes-open24.png XUpdateScanner.cc XUpdateScanner.h EXTRA_DIST = main.cpp krfb.desktop lo32-app-krfb.png lo16-app-krfb.png rfbserver.cpp rfbserver.h eyes-closed24.png eyes-open24.png XUpdateScanner.cc XUpdateScanner.h trayicon.cpp trayicon.h
install-data-local: install-data-local:
$(mkinstalldirs) $$(kde_appsdir)/Applications/ $(mkinstalldirs) $(kde_appsdir)/Applications/
$(INSTALL_DATA) $(srcdir)/krfb.desktop $$(kde_appsdir)/Applications/krfb.desktop $(INSTALL_DATA) $(srcdir)/krfb.desktop $(kde_appsdir)/Applications/krfb.desktop
$(mkinstalldirs) $$(kde_icondir)/locolor/32x32/apps/ $(mkinstalldirs) $(kde_icondir)/locolor/32x32/apps/
$(INSTALL_DATA) $(srcdir)/lo32-app-krfb.png $$(kde_icondir)/locolor/32x32/apps/krfb.png $(INSTALL_DATA) $(srcdir)/lo32-app-krfb.png $(kde_icondir)/locolor/32x32/apps/krfb.png
$(mkinstalldirs) $$(kde_icondir)/locolor/16x16/apps/ $(mkinstalldirs) $(kde_icondir)/locolor/16x16/apps/
$(INSTALL_DATA) $(srcdir)/lo16-app-krfb.png $$(kde_icondir)/locolor/16x16/apps/krfb.png $(INSTALL_DATA) $(srcdir)/lo16-app-krfb.png $(kde_icondir)/locolor/16x16/apps/krfb.png
$(mkinstalldirs) $$(kde_icondir)/hicolor/22x22/apps/ $(mkinstalldirs) $(kde_datadir)/krfb/pics
$(INSTALL_DATA) $(srcdir)/eyes-closed24.png $$(kde_icondir)/hicolor/22x22/apps/krfb.png $(INSTALL_DATA) $(srcdir)/eyes-closed24.png $(kde_datadir)/krfb/pics/eyes-closed24.png
$(mkinstalldirs) $$(kde_icondir)/hicolor/22x22/apps/ $(mkinstalldirs) $(kde_datadir)/krfb/pics
$(INSTALL_DATA) $(srcdir)/eyes-open24.png $$(kde_icondir)/hicolor/22x22/apps/krfb.png $(INSTALL_DATA) $(srcdir)/eyes-open24.png $(kde_datadir)/krfb/pics/eyes-open24.png
uninstall-local: uninstall-local:
-rm -f $$(kde_appsdir)/Applications/krfb.desktop -rm -f $(kde_appsdir)/Applications/krfb.desktop
-rm -f $$(kde_icondir)/locolor/32x32/apps/krfb.png -rm -f $(kde_icondir)/locolor/32x32/apps/krfb.png
-rm -f $$(kde_icondir)/locolor/16x16/apps/krfb.png -rm -f $(kde_icondir)/locolor/16x16/apps/krfb.png
-rm -f $$(kde_icondir)/hicolor/22x22/apps/krfb.png -rm -f $(kde_datadir)/krfb/pics
-rm -f $$(kde_icondir)/hicolor/22x22/apps/krfb.png -rm -f $(kde_datadir)/krfb/pics
####### kdevelop will overwrite this part!!! (end)############
# this 10 paths are KDE specific. Use them: # this 10 paths are KDE specific. Use them:
# kde_htmldir Where your docs should go to. (contains lang subdirs) # kde_htmldir Where your docs should go to. (contains lang subdirs)
# kde_appsdir Where your application file (.kdelnk) should go to. # kde_appsdir Where your application file (.kdelnk) should go to.

60
krfb/configuration.cpp Normal file
View File

@@ -0,0 +1,60 @@
/***************************************************************************
configuration.cpp
-------------------
begin : Tue Dec 11 2001
copyright : (C) 2001 by Tim Jansen
email : tim@tjansen.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "configuration.h"
Configuration::Configuration(KConfig *config) :
config(config)
{
askOnConnect = config->readBoolEntry("askOnConnect", true);
allowDesktopControl = config->readBoolEntry("allowDesktopControl",
false);
showMousePointer = config->readBoolEntry("showMousePointer",
true);
passwordString = config->readEntry("password", "");
portNumber = config->readNumEntry("port", 0);
}
Configuration::~Configuration() {
}
bool Configuration::askOnConnect() {
return askOnConnectFlag;
}
bool Configuration::allowDesktopControl() {
return allowDesktopControlFlag;
}
bool Configuration::showMousePointer() {
return showMousePointerFlag;
}
QString Configuration::password() {
return passwordString;
}
int Configuration::port() {
return portNumber;
}
void Configuration::showDialog() {
confDlg.show();
}
#endif

379
krfb/configurationdialog.ui Normal file
View File

@@ -0,0 +1,379 @@
<!DOCTYPE UI><UI>
<class>ConfigurationDialog</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>ConfigurationDialog</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
<width>390</width>
<height>278</height>
</rect>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>caption</name>
<string>KRfb configuration</string>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QFrame</class>
<property stdset="1">
<name>name</name>
<cstring>Frame7</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>NoFrame</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Plain</enum>
</property>
<property>
<name>layoutMargin</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>6</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>askOnConnectCB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>ask &amp;before remote client connects</string>
</property>
<property>
<name>whatsThis</name>
<string>If this option is enabled you will be asked whenever a remote user wants to connect to your display. This allows to close windows that the remote user should not see or to deny the request completely. It is highly recommended when you work on this computer. If you do not enable this option your only hint that somebody is connected is the small icon in your panel showing an open eye.</string>
</property>
</widget>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>allowDesktopControlCB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>allow &amp;remote client to control the desktop</string>
</property>
<property>
<name>whatsThis</name>
<string>If you allow this option the remote user can enter keystrokes and use your mouse pointer. This gives him full control over your computer, so be careful. When the option is disabled the remote user can only see what you are doing.</string>
</property>
</widget>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>showMousePointerCB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;show mouse pointer on remote client</string>
</property>
<property>
<name>whatsThis</name>
<string>If you enable this option the remote client can see the mouse pointer of this display additionally to his own. Especially if you have a slow network connection (modem, ISDN) this will make the remote display appear more sloppy. On the other hand the cursor will let the remote user orienting on the screen because the cursor moves slower on a remote connection.</string>
</property>
</widget>
</vbox>
</widget>
<widget>
<class>QFrame</class>
<property stdset="1">
<name>name</name>
<cstring>Frame5</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>NoFrame</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Plain</enum>
</property>
<property>
<name>layoutMargin</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>6</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel2</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>text</name>
<string>Display number:</string>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>displayNumberInput</cstring>
</property>
<property stdset="1">
<name>maxLength</name>
<number>5</number>
</property>
<property>
<name>toolTip</name>
<string>Display number</string>
</property>
<property>
<name>whatsThis</name>
<string>Enter the display number/port here. Unless you have more than one server running on the machine just enter 0 here. Regular RFB/VNC port number are between 0 and 99. If you enter a higher number it will be used as TCP port. Note that ports below 1024 require root privileges.</string>
</property>
</widget>
</vbox>
</widget>
<widget>
<class>QFrame</class>
<property stdset="1">
<name>name</name>
<cstring>Frame4</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>NoFrame</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Plain</enum>
</property>
<property>
<name>layoutMargin</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>6</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>text</name>
<string>Password:</string>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>passwordInput</cstring>
</property>
<property stdset="1">
<name>maxLength</name>
<number>9</number>
</property>
<property stdset="1">
<name>echoMode</name>
<enum>Password</enum>
</property>
<property>
<name>whatsThis</name>
<string>If you want to protect your system with a password enter one here. It is highly recommended that you either do this or enable "ask before remote client connects".</string>
</property>
</widget>
</vbox>
</widget>
<widget>
<class>QFrame</class>
<property stdset="1">
<name>name</name>
<cstring>Frame6</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>NoFrame</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Plain</enum>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>5</number>
</property>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>helpButton</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Help</string>
</property>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer2</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>applyButton</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Apply</string>
</property>
<property>
<name>whatsThis</name>
<string>Click this to apply the changes immediately.</string>
</property>
</widget>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>okButton</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Ok</string>
</property>
<property>
<name>whatsThis</name>
<string>Apply changes and close window.</string>
</property>
</widget>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>cancelButton</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Cancel</string>
</property>
<property>
<name>whatsThis</name>
<string>Discard all changes and close window.</string>
</property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
</UI>

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -15,7 +15,10 @@
* * * *
***************************************************************************/ ***************************************************************************/
#include "trayicon.h"
#include <kpixmap.h> #include <kpixmap.h>
#include <kaction.h>
#include <kapplication.h> #include <kapplication.h>
#include <ksystemtray.h> #include <ksystemtray.h>
#include <kcmdlineargs.h> #include <kcmdlineargs.h>
@@ -33,18 +36,6 @@ static KCmdLineOptions options[] =
// INSERT YOUR COMMANDLINE OPTIONS HERE // INSERT YOUR COMMANDLINE OPTIONS HERE
}; };
static KPixmap *trayIconOpen;
static KPixmap *trayIconClosed;
static KSystemTray *tray;
void setOpenIcon() {
tray->setPixmap(*trayIconOpen);
}
void setClosedIcon() {
tray->setPixmap(*trayIconClosed);
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
KAboutData aboutData( "krfb", I18N_NOOP("Krfb"), KAboutData aboutData( "krfb", I18N_NOOP("Krfb"),
@@ -55,14 +46,7 @@ int main(int argc, char *argv[])
KCmdLineArgs::addCmdLineOptions( options ); KCmdLineArgs::addCmdLineOptions( options );
KApplication app; KApplication app;
TrayIcon tray;
tray = new KSystemTray();
trayIconOpen = new KPixmap();
trayIconClosed = new KPixmap();
trayIconOpen->load("eyes-open24.png");
trayIconClosed->load("eyes-closed24.png");
setClosedIcon();
tray->show();
return app.exec(); return app.exec();
} }

324
krfb/newconnectiondialog.ui Normal file

File diff suppressed because one or more lines are too long

47
krfb/trayicon.cpp Normal file
View File

@@ -0,0 +1,47 @@
/***************************************************************************
trayicon.cpp - description
-------------------
begin : Tue Dec 11 2001
copyright : (C) 2001 by Tim Jansen
email : tim@tjansen.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "trayicon.h"
#include <klocale.h>
#include <kglobal.h>
#include <kiconloader.h>
#include <kpopupmenu.h>
TrayIcon::TrayIcon() : KSystemTray() {
KIconLoader *loader = KGlobal::iconLoader();
trayIconOpen = loader->loadIcon("eyes-open24", KIcon::User);
trayIconClosed = loader->loadIcon("eyes-closed24", KIcon::User);
setPixmap(trayIconClosed);
configureAction = new KAction(i18n("&Configure KRfb"));
configureAction->plug(contextMenu());
closeConnectionAction = new KAction(i18n("Close connection"));
show();
}
TrayIcon::~TrayIcon(){
}
void TrayIcon::openConnection(){
setPixmap(trayIconOpen);
closeConnectionAction->plug(contextMenu());
}
void TrayIcon::closeConnection(){
setPixmap(trayIconClosed);
closeConnectionAction->unplug(contextMenu());
}

48
krfb/trayicon.h Normal file
View File

@@ -0,0 +1,48 @@
/***************************************************************************
trayicon.h - description
-------------------
begin : Tue Dec 11 2001
copyright : (C) 2001 by Tim Jansen
email : tim@tjansen.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef TRAYICON_H
#define TRAYICON_H
#include <qwidget.h>
#include <kpixmap.h>
#include <kaction.h>
#include <ksystemtray.h>
/**
*@author Tim Jansen
*/
class TrayIcon : public KSystemTray {
Q_OBJECT
public:
TrayIcon();
~TrayIcon();
void closeConnection();
void openConnection();
private:
KPixmap trayIconOpen;
KPixmap trayIconClosed;
KAction* closeConnectionAction;
KAction* configureAction;
signals:
void connectionClosed();
void showConfigure();
};
#endif