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

krfb

personalinvitedialog.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
00003 
00004    This program is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    General Public License for more details.
00013 
00014    You should have received a copy of the GNU General Public License
00015    along with this program; see the file COPYING.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include "personalinvitedialog.h"
00021 #include "personalinvitedialog.moc"
00022 
00023 #include <QtGui/QLabel>
00024 #include <QtGui/QToolTip>
00025 #include <QNetworkInterface>
00026 
00027 #include <kiconloader.h>
00028 #include <klocale.h>
00029 
00030 #include "krfbconfig.h"
00031 
00032 PersonalInviteDialog::PersonalInviteDialog( QWidget *parent )
00033     : KDialog( parent )
00034 {
00035   setCaption(i18n("Personal Invitation"));
00036   setButtons(Close);
00037   setDefaultButton(Close);
00038   setModal(true);
00039 
00040   setMinimumSize(500, 250);
00041 
00042   int port = KrfbConfig::port();
00043 
00044   m_inviteWidget = new QWidget ( this );
00045   setupUi(m_inviteWidget);
00046   pixmapLabel->setPixmap(KIcon("krfb").pixmap(128));
00047 
00048   QList<QNetworkInterface> ifl = QNetworkInterface::allInterfaces();
00049 
00050   foreach (QNetworkInterface nif, ifl) {
00051     if (nif.flags() & QNetworkInterface::IsLoopBack) continue;
00052     if (nif.flags() & QNetworkInterface::IsRunning && !nif.addressEntries().isEmpty()) {
00053         hostLabel->setText( QString( "%1:%2" ).arg(nif.addressEntries().first().ip().toString()).arg(port));
00054     }
00055   }
00056 
00057   connect( mainTextLabel, SIGNAL( linkActivated ( QString ) ),
00058            SLOT( showWhatsthis( QString ) ));
00059 
00060   connect( hostHelpLabel, SIGNAL( linkActivated ( QString ) ),
00061            SLOT( showWhatsthis( QString ) ));
00062 
00063   setMainWidget( m_inviteWidget );
00064 }
00065 
00066 
00067 void PersonalInviteDialog::setHost( const QString &host, uint port )
00068 {
00069   hostLabel->setText( QString( "%1:%2" )
00070       .arg( host ).arg( port ) );
00071 }
00072 
00073 void PersonalInviteDialog::setPassword( const QString &passwd )
00074 {
00075   passwordLabel->setText( passwd );
00076 }
00077 
00078 void PersonalInviteDialog::setExpiration( const QDateTime &expire )
00079 {
00080   expirationLabel->setText( expire.toString( Qt::LocalDate ) );
00081 }
00082 
00083 void PersonalInviteDialog::showWhatsthis(const QString &link)
00084 {
00085     if (link == "htc") {
00086         QToolTip::showText(QCursor::pos(),
00087             i18n("Desktop Sharing uses the VNC protocol. You can use any VNC client to connect. \n"
00088                 "In KDE the client is called 'Remote Desktop Connection'. Enter the host information\n"
00089                 "into the client and it will connect.."));
00090     } else if (link == "help") {
00091         QToolTip::showText(QCursor::pos(),
00092             i18n("This field contains the address of your computer and the display number, separated by a colon.\n"
00093                 "The address is just a hint - you can use any address that can reach your computer. \n"
00094                 "Desktop Sharing tries to guess your address from your network configuration, but does\n"
00095                 "not always succeed in doing so. If your computer is behind a firewall it may have a\n"
00096                 "different address or be unreachable for other computers."));
00097     }
00098 }
00099 

krfb

Skip menu "krfb"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal