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

krfb

  • sources
  • kde-4.12
  • kdenetwork
  • krfb
  • krfb
personalinvitedialog.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
3 
4  This program is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; see the file COPYING. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "personalinvitedialog.h"
21 
22 #include "krfbconfig.h"
23 
24 #include <KIconLoader>
25 #include <KLocale>
26 
27 #include <QtGui/QLabel>
28 #include <QtGui/QToolTip>
29 
30 #include <QtNetwork/QNetworkInterface>
31 
32 PersonalInviteDialog::PersonalInviteDialog(QWidget *parent)
33  : KDialog(parent)
34 {
35  setCaption(i18n("Personal Invitation"));
36  setButtons(Close);
37  setDefaultButton(Close);
38  setModal(true);
39 
40  setMinimumSize(500, 250);
41 
42  int port = KrfbConfig::port();
43 
44  m_inviteWidget = new QWidget(this);
45  setupUi(m_inviteWidget);
46  pixmapLabel->setPixmap(KIcon("krfb").pixmap(128));
47 
48  QList<QNetworkInterface> ifl = QNetworkInterface::allInterfaces();
49 
50  foreach(const QNetworkInterface & nif, ifl) {
51  if (nif.flags() & QNetworkInterface::IsLoopBack) {
52  continue;
53  }
54 
55  if (nif.flags() & QNetworkInterface::IsRunning && !nif.addressEntries().isEmpty()) {
56  hostLabel->setText(QString("%1:%2").arg(nif.addressEntries().first().ip().toString()).arg(port));
57  }
58  }
59 
60  connect(mainTextLabel, SIGNAL(linkActivated(QString)),
61  SLOT(showWhatsthis(QString)));
62 
63  connect(hostHelpLabel, SIGNAL(linkActivated(QString)),
64  SLOT(showWhatsthis(QString)));
65 
66  setMainWidget(m_inviteWidget);
67 }
68 
69 
70 void PersonalInviteDialog::setHost(const QString &host, uint port)
71 {
72  hostLabel->setText(QString("%1:%2")
73  .arg(host).arg(port));
74 }
75 
76 void PersonalInviteDialog::setPassword(const QString &passwd)
77 {
78  passwordLabel->setText(passwd);
79 }
80 
81 void PersonalInviteDialog::setExpiration(const QDateTime &expire)
82 {
83  expirationLabel->setText(expire.toString(Qt::LocalDate));
84 }
85 
86 void PersonalInviteDialog::showWhatsthis(const QString &link)
87 {
88  if (link == "htc") {
89  QToolTip::showText(QCursor::pos(),
90  i18n("Desktop Sharing uses the VNC protocol. You can use any VNC client to connect. \n"
91  "In KDE the client is called 'Remote Desktop Connection'. Enter the host information\n"
92  "into the client and it will connect.."));
93  } else if (link == "help") {
94  QToolTip::showText(QCursor::pos(),
95  i18n("This field contains the address of your computer and the port number, separated by a colon.\n"
96  "The address is just a hint - you can use any address that can reach your computer. \n"
97  "Desktop Sharing tries to guess your address from your network configuration, but does\n"
98  "not always succeed in doing so. If your computer is behind a firewall it may have a\n"
99  "different address or be unreachable for other computers."));
100  }
101 }
102 
103 
104 #include "personalinvitedialog.moc"
105 
personalinvitedialog.h
PersonalInviteDialog::showWhatsthis
void showWhatsthis(const QString &)
Definition: personalinvitedialog.cpp:86
QWidget
PersonalInviteDialog::PersonalInviteDialog
PersonalInviteDialog(QWidget *parent)
Definition: personalinvitedialog.cpp:32
krfbconfig.h
KrfbConfig::port
static int port()
Get This is the port on which krfb will listen.
Definition: krfbconfig.h:31
PersonalInviteDialog::setPassword
void setPassword(const QString &passwd)
Definition: personalinvitedialog.cpp:76
PersonalInviteDialog::setExpiration
void setExpiration(const QDateTime &expire)
Definition: personalinvitedialog.cpp:81
PersonalInviteDialog::m_inviteWidget
QWidget * m_inviteWidget
Definition: personalinvitedialog.h:45
PersonalInviteDialog::setHost
void setHost(const QString &host, uint port)
Definition: personalinvitedialog.cpp:70
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:54:10 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
  • 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