krfb
personalinvitedialog.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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