* do not add a KStandardAction manually to actionCollection()
[kdenetwork.git] / krfb / personalinvitedialog.cpp
blob9b3bce369c03504a5dd7b499bdf2fc9a88553fff
1 /* This file is part of the KDE project
2 Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
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.
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.
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.
20 #include "personalinvitedialog.h"
21 #include "personalinvitedialog.moc"
23 #include <QtGui/QLabel>
24 #include <QtGui/QToolTip>
25 #include <QNetworkInterface>
27 #include <kiconloader.h>
28 #include <klocale.h>
30 #include "krfbconfig.h"
32 PersonalInviteDialog::PersonalInviteDialog( QWidget *parent )
33 : KDialog( parent )
35 setCaption(i18n("Personal Invitation"));
36 setButtons(Close);
37 setDefaultButton(Close);
38 setModal(true);
40 setMinimumSize(500, 250);
42 int port = KrfbConfig::port();
44 m_inviteWidget = new QWidget ( this );
45 setupUi(m_inviteWidget);
46 pixmapLabel->setPixmap(KIcon("krfb").pixmap(128));
48 QList<QNetworkInterface> ifl = QNetworkInterface::allInterfaces();
50 foreach (const QNetworkInterface &nif, ifl) {
51 if (nif.flags() & QNetworkInterface::IsLoopBack) continue;
52 if (nif.flags() & QNetworkInterface::IsRunning && !nif.addressEntries().isEmpty()) {
53 hostLabel->setText( QString( "%1:%2" ).arg(nif.addressEntries().first().ip().toString()).arg(port));
57 connect( mainTextLabel, SIGNAL( linkActivated ( QString ) ),
58 SLOT( showWhatsthis( QString ) ));
60 connect( hostHelpLabel, SIGNAL( linkActivated ( QString ) ),
61 SLOT( showWhatsthis( QString ) ));
63 setMainWidget( m_inviteWidget );
67 void PersonalInviteDialog::setHost( const QString &host, uint port )
69 hostLabel->setText( QString( "%1:%2" )
70 .arg( host ).arg( port ) );
73 void PersonalInviteDialog::setPassword( const QString &passwd )
75 passwordLabel->setText( passwd );
78 void PersonalInviteDialog::setExpiration( const QDateTime &expire )
80 expirationLabel->setText( expire.toString( Qt::LocalDate ) );
83 void PersonalInviteDialog::showWhatsthis(const QString &link)
85 if (link == "htc") {
86 QToolTip::showText(QCursor::pos(),
87 i18n("Desktop Sharing uses the VNC protocol. You can use any VNC client to connect. \n"
88 "In KDE the client is called 'Remote Desktop Connection'. Enter the host information\n"
89 "into the client and it will connect.."));
90 } else if (link == "help") {
91 QToolTip::showText(QCursor::pos(),
92 i18n("This field contains the address of your computer and the display number, separated by a colon.\n"
93 "The address is just a hint - you can use any address that can reach your computer. \n"
94 "Desktop Sharing tries to guess your address from your network configuration, but does\n"
95 "not always succeed in doing so. If your computer is behind a firewall it may have a\n"
96 "different address or be unreachable for other computers."));