• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

krfb

  • sources
  • kde-4.14
  • kdenetwork
  • krfb
  • krfb
main.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  main.cpp
3  -------------------
4  begin : Sat Dec 8 03:23:02 CET 2001
5  copyright : (C) 2001-2003 by Tim Jansen
6  email : tim@tjansen.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "mainwindow.h"
19 #include "trayicon.h"
20 #include "invitationsrfbserver.h"
21 
22 #include <KAboutApplicationDialog>
23 #include <KAboutData>
24 #include <KAction>
25 #include <KUniqueApplication>
26 #include <KCmdLineArgs>
27 #include <KDebug>
28 #include <KLocale>
29 #include <KMessageBox>
30 #include <KNotification>
31 
32 #include <QtGui/QPixmap>
33 #include <QtGui/qwindowdefs.h>
34 
35 #ifdef KRFB_WITH_TELEPATHY_TUBES
36 # include "tubesrfbserver.h"
37 #endif
38 
39 #include <signal.h>
40 #include <X11/extensions/XTest.h>
41 
42 static const char description[] = I18N_NOOP("VNC-compatible server to share "
43  "KDE desktops");
44 
45 static bool checkX11Capabilities()
46 {
47  int bp1, bp2, majorv, minorv;
48  Bool r = XTestQueryExtension(QX11Info::display(), &bp1, &bp2,
49  &majorv, &minorv);
50 
51  if ((!r) || (((majorv * 1000) + minorv) < 2002)) {
52  KMessageBox::error(0,
53  i18n("Your X11 Server does not support the required XTest extension "
54  "version 2.2. Sharing your desktop is not possible."),
55  i18n("Desktop Sharing Error"));
56  return false;
57  }
58 
59  return true;
60 }
61 
62 int main(int argc, char *argv[])
63 {
64  KAboutData aboutData("krfb", 0, ki18n("Desktop Sharing"), KDE_VERSION_STRING,
65  ki18n(description), KAboutData::License_GPL,
66  ki18n("(c) 2009-2010, Collabora Ltd.\n"
67  "(c) 2007, Alessandro Praduroux\n"
68  "(c) 2001-2003, Tim Jansen\n"
69  "(c) 2001, Johannes E. Schindelin\n"
70  "(c) 2000-2001, Const Kaplinsky\n"
71  "(c) 2000, Tridia Corporation\n"
72  "(c) 1999, AT&T Laboratories Boston\n"));
73  aboutData.addAuthor(ki18n("George Goldberg"),
74  ki18n("Telepathy tubes support"),
75  "george.goldberg@collabora.co.uk");
76  aboutData.addAuthor(ki18n("George Kiagiadakis"),
77  KLocalizedString(),
78  "george.kiagiadakis@collabora.co.uk");
79  aboutData.addAuthor(ki18n("Alessandro Praduroux"), ki18n("KDE4 porting"), "pradu@pradu.it");
80  aboutData.addAuthor(ki18n("Tim Jansen"), ki18n("Original author"), "tim@tjansen.de");
81  aboutData.addCredit(ki18n("Johannes E. Schindelin"),
82  ki18n("libvncserver"));
83  aboutData.addCredit(ki18n("Const Kaplinsky"),
84  ki18n("TightVNC encoder"));
85  aboutData.addCredit(ki18n("Tridia Corporation"),
86  ki18n("ZLib encoder"));
87  aboutData.addCredit(ki18n("AT&T Laboratories Boston"),
88  ki18n("original VNC encoders and "
89  "protocol design"));
90  KCmdLineArgs::init(argc, argv, &aboutData);
91 
92  KCmdLineOptions options;
93  options.add("nodialog", ki18n("Do not show the invitations management dialog at startup"));
94  KCmdLineArgs::addCmdLineOptions(options);
95 
96  KUniqueApplication app;
97  app.setQuitOnLastWindowClosed(false);
98 
99  if (!checkX11Capabilities()) {
100  return 1;
101  }
102 
103  //init the core
104  InvitationsRfbServer::init();
105 
106 #ifdef KRFB_WITH_TELEPATHY_TUBES
107  TubesRfbServer::init();
108 #endif
109 
110  //init the GUI
111  MainWindow mainWindow;
112  TrayIcon trayicon(&mainWindow);
113 
114  if (app.isSessionRestored() && KMainWindow::canBeRestored(1)) {
115  mainWindow.restore(1, false);
116  } else if (KCmdLineArgs::parsedArgs()->isSet("dialog")) {
117  mainWindow.show();
118  }
119 
120  sigset_t sigs;
121  sigemptyset(&sigs);
122  sigaddset(&sigs, SIGPIPE);
123  sigprocmask(SIG_BLOCK, &sigs, 0);
124 
125  return app.exec();
126 }
127 
InvitationsRfbServer::init
static void init()
Definition: invitationsrfbserver.cpp:42
QX11Info::display
Display * display()
TrayIcon
Implements the trayicon.
Definition: trayicon.h:33
mainwindow.h
trayicon.h
tubesrfbserver.h
TubesRfbServer::init
static void init()
Definition: tubesrfbserver.cpp:54
description
static const char description[]
Definition: main.cpp:42
invitationsrfbserver.h
main
int main(int argc, char *argv[])
Definition: main.cpp:62
MainWindow
Definition: mainwindow.h:31
checkX11Capabilities
static bool checkX11Capabilities()
Definition: main.cpp:45
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:40 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

krfb

Skip menu "krfb"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal