mirror of
https://github.com/KDE/krfb
synced 2026-07-01 15:31:19 -07:00
- Get rid of K3ActiveLabel
- invitation manager - some functionality added to invitation dialog - personal invitation dialog shows correctly using QtNetwork classes - tray icon LMB displays invitation dialog svn path=/trunk/KDE/kdenetwork/krfb/; revision=648286
This commit is contained in:
@@ -14,6 +14,7 @@ set(krfb_SRCS ${vncserver_SRCS}
|
||||
trayicon.cpp
|
||||
krfbserver.cpp
|
||||
manageinvitationsdialog.cpp
|
||||
invitationmanager.cpp
|
||||
invitedialog.cc
|
||||
invitation.cc
|
||||
connectiondialog.cc
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* Function for (en/de)crypting strings for config file, taken from KMail
|
||||
* Author: Stefan Taferner <taferner@alpin.or.at>
|
||||
*/
|
||||
QString cryptStr(const QString &aStr) {
|
||||
static QString cryptStr(const QString &aStr) {
|
||||
QString result;
|
||||
for ( int i = 0; i < aStr.length(); i++)
|
||||
result += (aStr[i].unicode() < 0x20) ? aStr[i] :
|
||||
@@ -34,12 +34,12 @@ static QString readableRandomString(int length) {
|
||||
{
|
||||
int r = KRandom::random() % 62;
|
||||
r += 48;
|
||||
if (r > 57)
|
||||
if (r > 57)
|
||||
r += 7;
|
||||
if (r > 90)
|
||||
if (r > 90)
|
||||
r += 6;
|
||||
char c = char(r);
|
||||
if ((c == 'i') ||
|
||||
if ((c == 'i') ||
|
||||
(c == 'I') ||
|
||||
(c == '1') ||
|
||||
(c == 'o') ||
|
||||
@@ -52,46 +52,38 @@ static QString readableRandomString(int length) {
|
||||
return str;
|
||||
}
|
||||
|
||||
Invitation::Invitation() :
|
||||
m_viewItem(0) {
|
||||
Invitation::Invitation()
|
||||
{
|
||||
m_password = readableRandomString(4)+'-'+readableRandomString(3);
|
||||
m_creationTime = QDateTime::currentDateTime();
|
||||
m_expirationTime = QDateTime::currentDateTime().addSecs(INVITATION_DURATION);
|
||||
}
|
||||
|
||||
Invitation::Invitation(const Invitation &x) :
|
||||
m_password(x.m_password),
|
||||
m_creationTime(x.m_creationTime),
|
||||
m_expirationTime(x.m_expirationTime),
|
||||
m_viewItem(0) {
|
||||
Invitation::Invitation(const Invitation &x)
|
||||
: m_password(x.m_password), m_creationTime(x.m_creationTime), m_expirationTime(x.m_expirationTime)
|
||||
{
|
||||
}
|
||||
|
||||
Invitation::Invitation(KConfig* config, int num) {
|
||||
m_password = cryptStr(config->readEntry(QString("password%1").arg(num), QString()));
|
||||
m_creationTime = config->readDateTimeEntry(QString("creation%1").arg(num));
|
||||
m_expirationTime = config->readDateTimeEntry(QString("expiration%1").arg(num));
|
||||
m_viewItem = 0;
|
||||
Invitation::Invitation(const KConfigGroup &config) {
|
||||
m_password = cryptStr(config.readEntry("password", QString()));
|
||||
m_creationTime = config.readEntry("creation", QDateTime());
|
||||
m_expirationTime = config.readEntry("expiration", QDateTime());
|
||||
}
|
||||
|
||||
Invitation::~Invitation() {
|
||||
if (m_viewItem)
|
||||
delete m_viewItem;
|
||||
}
|
||||
|
||||
Invitation &Invitation::operator= (const Invitation&x) {
|
||||
m_password = x.m_password;
|
||||
m_creationTime = x.m_creationTime;
|
||||
m_expirationTime = x.m_expirationTime;
|
||||
if (m_viewItem)
|
||||
delete m_viewItem;
|
||||
m_viewItem = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Invitation::save(KConfig *config, int num) const {
|
||||
config->writeEntry(QString("password%1").arg(num), cryptStr(m_password));
|
||||
config->writeEntry(QString("creation%1").arg(num), m_creationTime);
|
||||
config->writeEntry(QString("expiration%1").arg(num), m_expirationTime);
|
||||
void Invitation::save(KConfigGroup &config) const {
|
||||
config.writeEntry("password", cryptStr(m_password));
|
||||
config.writeEntry("creation", m_creationTime);
|
||||
config.writeEntry("expiration", m_expirationTime);
|
||||
}
|
||||
|
||||
QString Invitation::password() const {
|
||||
@@ -110,12 +102,3 @@ bool Invitation::isValid() const {
|
||||
return m_expirationTime > QDateTime::currentDateTime();
|
||||
}
|
||||
|
||||
void Invitation::setViewItem(K3ListViewItem *i) {
|
||||
if (m_viewItem)
|
||||
delete m_viewItem;
|
||||
m_viewItem = i;
|
||||
}
|
||||
|
||||
K3ListViewItem *Invitation::getViewItem() const{
|
||||
return m_viewItem;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#define INVITATION_H
|
||||
|
||||
#include <kapplication.h>
|
||||
#include <k3listview.h>
|
||||
#include <kconfig.h>
|
||||
#include <qobject.h>
|
||||
#include <qstring.h>
|
||||
@@ -28,13 +27,11 @@
|
||||
|
||||
const int INVITATION_DURATION = 60*60;
|
||||
|
||||
QString cryptStr(const QString &aStr);
|
||||
|
||||
class Invitation {
|
||||
public:
|
||||
Invitation();
|
||||
~Invitation();
|
||||
Invitation(KConfig* config, int num);
|
||||
Invitation(const KConfigGroup &config);
|
||||
Invitation(const Invitation &x);
|
||||
Invitation &operator= (const Invitation&x);
|
||||
|
||||
@@ -43,15 +40,12 @@ public:
|
||||
QDateTime creationTime() const;
|
||||
bool isValid() const;
|
||||
|
||||
void setViewItem(K3ListViewItem*);
|
||||
K3ListViewItem* getViewItem() const;
|
||||
void save(KConfig *config, int num) const;
|
||||
void save(KConfigGroup &config) const;
|
||||
private:
|
||||
QString m_password;
|
||||
QDateTime m_creationTime;
|
||||
QDateTime m_expirationTime;
|
||||
|
||||
K3ListViewItem *m_viewItem;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
83
krfb/invitationmanager.cpp
Normal file
83
krfb/invitationmanager.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Alessandro Praduroux <pradu@pradu.it>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; version 2
|
||||
of the License.
|
||||
*/
|
||||
#include "invitationmanager.h"
|
||||
#include "invitationmanager.moc"
|
||||
|
||||
#include <KStaticDeleter>
|
||||
#include <KConfigGroup>
|
||||
#include <KConfig>
|
||||
#include <KGlobal>
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
static KStaticDeleter<InvitationManager> sd;
|
||||
InvitationManager * InvitationManager::_self = 0;
|
||||
InvitationManager * InvitationManager::self() {
|
||||
if (!_self) sd.setObject(_self, new InvitationManager);
|
||||
return _self;
|
||||
}
|
||||
|
||||
InvitationManager::InvitationManager()
|
||||
{
|
||||
loadInvitations();
|
||||
|
||||
QTimer *refreshTimer = new QTimer(this);
|
||||
connect(refreshTimer, SIGNAL(timeout()), SLOT(loadInvitations()));
|
||||
refreshTimer->start(1000*60);
|
||||
}
|
||||
|
||||
|
||||
InvitationManager::~InvitationManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void InvitationManager::invalidateOldInvitations() {
|
||||
int invNum = invitationList.size();
|
||||
|
||||
while(invNum--) {
|
||||
if (!invitationList[invNum].isValid()) {
|
||||
invitationList.removeAt(invNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InvitationManager::loadInvitations()
|
||||
{
|
||||
int invNum = invitationList.size();
|
||||
|
||||
KSharedConfigPtr conf = KGlobal::config();
|
||||
KConfigGroup invitationConfig(conf, "Invitations");
|
||||
int numInv = invitationConfig.readEntry("invitation_num",0);
|
||||
|
||||
for (int i = 0; i < numInv; i++) {
|
||||
KConfigGroup ic(conf, QString("Invitation_%1").arg(i));
|
||||
invitationList.append(Invitation(ic));
|
||||
}
|
||||
|
||||
invalidateOldInvitations();
|
||||
|
||||
if (numInv != invNum) {
|
||||
emit invitationNumChanged(invitationList.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Invitation InvitationManager::addInvitation()
|
||||
{
|
||||
Invitation i;
|
||||
invitationList.append(i);
|
||||
emit invitationNumChanged(invitationList.size());
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
49
krfb/invitationmanager.h
Normal file
49
krfb/invitationmanager.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Alessandro Praduroux <pradu@pradu.it>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; version 2
|
||||
of the License.
|
||||
*/
|
||||
#ifndef INVITATIONMANAGER_H
|
||||
#define INVITATIONMANAGER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
#include "invitation.h"
|
||||
|
||||
|
||||
class InvitationManager;
|
||||
/**
|
||||
@author Alessandro Praduroux <pradu@pradu.it>
|
||||
*/
|
||||
class InvitationManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static InvitationManager *self();
|
||||
|
||||
~InvitationManager();
|
||||
|
||||
Invitation addInvitation();
|
||||
|
||||
signals:
|
||||
void invitationNumChanged(int);
|
||||
|
||||
public Q_SLOTS:
|
||||
|
||||
void loadInvitations();
|
||||
|
||||
private:
|
||||
|
||||
void invalidateOldInvitations();
|
||||
InvitationManager();
|
||||
static InvitationManager *_self;
|
||||
|
||||
QList<Invitation> invitationList;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -42,6 +42,7 @@ void KrfbServer::startListening() {
|
||||
connect(_server,SIGNAL(newConnection()),SLOT(newConnection()));
|
||||
|
||||
if (!_server->listen(QHostAddress::Any, port)) {
|
||||
// TODO: handle error more gracefully
|
||||
kDebug() << "server listen error" << endl;
|
||||
deleteLater();
|
||||
return;
|
||||
@@ -64,6 +65,7 @@ void KrfbServer::newConnection()
|
||||
|
||||
fdNum = conn->socketDescriptor();
|
||||
conn->close();
|
||||
// TODO: start the actual sharing implementation
|
||||
//_controller->startServer(fdNum);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "trayicon.h"
|
||||
//#include "configuration.h"
|
||||
#include "krfbserver.h"
|
||||
#include "manageinvitationsdialog.h"
|
||||
|
||||
#include <QPixmap>
|
||||
#include <kaction.h>
|
||||
@@ -42,16 +43,18 @@ static const char description[] = I18N_NOOP("VNC-compatible server to share "
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
KAboutData aboutData( "krfb", I18N_NOOP("Desktop Sharing"),
|
||||
VERSION, description, KAboutData::License_GPL,
|
||||
"(c) 2001-2003, Tim Jansen\n"
|
||||
"(c) 2001, Johannes E. Schindelin\n"
|
||||
"(c) 2000, heXoNet Support GmbH, D-66424 Homburg\n"
|
||||
"(c) 2000-2001, Const Kaplinsky\n"
|
||||
"(c) 2000, Tridia Corporation\n"
|
||||
"(c) 1999, AT&T Laboratories Cambridge\n",
|
||||
0, "", "tim@tjansen.de");
|
||||
aboutData.addAuthor("Tim Jansen", "", "tim@tjansen.de");
|
||||
aboutData.addAuthor("Ian Reinhart Geiser", "DCOP interface", "geiseri@kde.org");
|
||||
VERSION, description, KAboutData::License_GPL,
|
||||
"(c) 2007, Alessandro Praduroux\n"
|
||||
"(c) 2001-2003, Tim Jansen\n"
|
||||
"(c) 2001, Johannes E. Schindelin\n"
|
||||
"(c) 2000, heXoNet Support GmbH, D-66424 Homburg\n"
|
||||
"(c) 2000-2001, Const Kaplinsky\n"
|
||||
"(c) 2000, Tridia Corporation\n"
|
||||
"(c) 1999, AT&T Laboratories Cambridge\n",
|
||||
0, "", "tim@tjansen.de");
|
||||
aboutData.addAuthor("Alessandro Praduroux", I18N_NOOP("KDE4 porting"), "pradu@pradu.it");
|
||||
aboutData.addAuthor("Tim Jansen", "", "tim@tjansen.de");
|
||||
aboutData.addAuthor("Ian Reinhart Geiser", I18N_NOOP("DCOP interface"), "geiseri@kde.org");
|
||||
aboutData.addCredit("Johannes E. Schindelin",
|
||||
I18N_NOOP("libvncserver"));
|
||||
aboutData.addCredit("Const Kaplinsky",
|
||||
@@ -73,7 +76,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
KApplication app;
|
||||
|
||||
TrayIcon trayicon(new KAboutApplicationDialog(&aboutData));
|
||||
|
||||
TrayIcon trayicon(new ManageInvitationsDialog);
|
||||
KrfbServer server;
|
||||
|
||||
QObject::connect(&app, SIGNAL(lastWindowClosed()), // do not show passivepopup
|
||||
|
||||
@@ -9,19 +9,25 @@
|
||||
#include "manageinvitationsdialog.h"
|
||||
#include "manageinvitationsdialog.moc"
|
||||
|
||||
#include "personalinvitedialog.h"
|
||||
#include "invitationmanager.h"
|
||||
#include "invitation.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QToolTip>
|
||||
#include <QCursor>
|
||||
|
||||
#include <KStandardGuiItem>
|
||||
#include <KIconLoader>
|
||||
|
||||
|
||||
ManageInvitationsDialog::ManageInvitationsDialog(QWidget *parent)
|
||||
: KDialog(parent)
|
||||
{
|
||||
setCaption(i18n("Invitation"));
|
||||
setButtons(User1|Close|Help);
|
||||
setDefaultButton(NoDefault);
|
||||
setModal(true);
|
||||
setModal(false);
|
||||
|
||||
QWidget *main = new QWidget(this);
|
||||
setupUi(main);
|
||||
@@ -59,6 +65,11 @@ void ManageInvitationsDialog::showWhatsthis()
|
||||
|
||||
void ManageInvitationsDialog::inviteManually()
|
||||
{
|
||||
Invitation inv = InvitationManager::self()->addInvitation();
|
||||
PersonalInviteDialog *pid = new PersonalInviteDialog(this);
|
||||
pid->setPassword(inv.password());
|
||||
pid->setExpiration(inv.expirationTime());
|
||||
pid->exec();
|
||||
}
|
||||
|
||||
void ManageInvitationsDialog::inviteByMail()
|
||||
|
||||
@@ -18,13 +18,16 @@
|
||||
*/
|
||||
|
||||
#include "personalinvitedialog.h"
|
||||
#include "personalinvitedialog.moc"
|
||||
|
||||
#include <qlabel.h>
|
||||
|
||||
#include <k3activelabel.h>
|
||||
#include <kiconloader.h>
|
||||
#include <klocale.h>
|
||||
|
||||
#include <QToolTip>
|
||||
#include <QNetworkInterface>
|
||||
|
||||
PersonalInviteDialog::PersonalInviteDialog( QWidget *parent )
|
||||
: KDialog( parent )
|
||||
{
|
||||
@@ -37,9 +40,25 @@ PersonalInviteDialog::PersonalInviteDialog( QWidget *parent )
|
||||
setupUi(m_inviteWidget);
|
||||
pixmapLabel->setPixmap( UserIcon( "connection-side-image.png" ) );
|
||||
|
||||
QList<QNetworkInterface> ifl = QNetworkInterface::allInterfaces();
|
||||
|
||||
foreach (QNetworkInterface nif, ifl) {
|
||||
if (nif.flags() & QNetworkInterface::IsLoopBack) continue;
|
||||
if (nif.flags() & QNetworkInterface::IsRunning) {
|
||||
hostLabel->setText( QString( "%1:5900" ).arg(nif.addressEntries()[0].ip().toString()));
|
||||
}
|
||||
}
|
||||
|
||||
connect( mainTextLabel, SIGNAL( linkActivated ( QString ) ),
|
||||
SLOT( showWhatsthis( QString ) ));
|
||||
|
||||
connect( hostHelpLabel, SIGNAL( linkActivated ( QString ) ),
|
||||
SLOT( showWhatsthis( QString ) ));
|
||||
|
||||
setMainWidget( m_inviteWidget );
|
||||
}
|
||||
|
||||
|
||||
void PersonalInviteDialog::setHost( const QString &host, uint port )
|
||||
{
|
||||
hostLabel->setText( QString( "%1:%2" )
|
||||
@@ -55,3 +74,21 @@ void PersonalInviteDialog::setExpiration( const QDateTime &expire )
|
||||
{
|
||||
expirationLabel->setText( expire.toString( Qt::LocalDate ) );
|
||||
}
|
||||
|
||||
void PersonalInviteDialog::showWhatsthis(const QString &link)
|
||||
{
|
||||
if (link == "htc") {
|
||||
QToolTip::showText(QCursor::pos(),
|
||||
i18n("Desktop Sharing uses the VNC protocol. You can use any VNC client to connect. \n"
|
||||
"In KDE the client is called 'Remote Desktop Connection'. Enter the host information\n"
|
||||
"into the client and it will connect.."));
|
||||
} else if (link == "help") {
|
||||
QToolTip::showText(QCursor::pos(),
|
||||
i18n("This field contains the address of your computer and the display number, separated by a colon.\n"
|
||||
"The address is just a hint - you can use any address that can reach your computer. \n"
|
||||
"Desktop Sharing tries to guess your address from your network configuration, but does\n"
|
||||
"not always succeed in doing so. If your computer is behind a firewall it may have a\n"
|
||||
"different address or be unreachable for other computers."));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
class QWidget;
|
||||
class PersonalInviteDialog : public KDialog, public Ui::PersonalInviteWidget
|
||||
{
|
||||
public:
|
||||
Q_OBJECT
|
||||
public:
|
||||
PersonalInviteDialog( QWidget *parent );
|
||||
virtual ~PersonalInviteDialog() {}
|
||||
|
||||
@@ -35,8 +36,11 @@ class PersonalInviteDialog : public KDialog, public Ui::PersonalInviteWidget
|
||||
void setPassword( const QString &passwd );
|
||||
void setExpiration( const QDateTime &expire );
|
||||
|
||||
protected:
|
||||
QWidget *m_inviteWidget;
|
||||
public Q_SLOTS:
|
||||
void showWhatsthis(const QString &);
|
||||
|
||||
protected:
|
||||
QWidget *m_inviteWidget;
|
||||
};
|
||||
|
||||
#endif // PERSONALINVITEDIALOG_H
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="1" colspan="3" >
|
||||
<widget class="K3ActiveLabel" native="1" name="mainTextLabel" >
|
||||
<widget class="QLabel" name="mainTextLabel" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
@@ -32,6 +32,16 @@
|
||||
<property name="focusPolicy" >
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Personal Invitation</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Give the information below to the person that you want to invite (<a href="htc">how to connect</a>). Note that everybody who gets the password can connect, so be careful.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
@@ -103,7 +113,7 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="2" >
|
||||
<widget class="K3ActiveLabel" native="1" name="hostLabel" >
|
||||
<widget class="QLabel" name="hostLabel" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>3</hsizetype>
|
||||
@@ -154,7 +164,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2" >
|
||||
<widget class="K3ActiveLabel" native="1" name="passwordLabel" >
|
||||
<widget class="QLabel" name="passwordLabel" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>3</hsizetype>
|
||||
@@ -169,7 +179,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2" >
|
||||
<widget class="K3ActiveLabel" native="1" name="expirationLabel" >
|
||||
<widget class="QLabel" name="expirationLabel" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>3</hsizetype>
|
||||
@@ -202,7 +212,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3" >
|
||||
<widget class="K3ActiveLabel" native="1" name="hostHelpLabel" >
|
||||
<widget class="QLabel" name="hostHelpLabel" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>3</hsizetype>
|
||||
@@ -211,6 +221,12 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="help">Help</a></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -218,14 +234,6 @@
|
||||
<layoutdefault spacing="6" margin="11" />
|
||||
<layoutfunction spacing="KDialog::spacingHint" margin="KDialog::marginHint" />
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>K3ActiveLabel</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>k3activelabel.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -22,27 +22,28 @@
|
||||
#include <klocale.h>
|
||||
#include <kdialog.h>
|
||||
#include <kmenu.h>
|
||||
#include <kglobal.h>
|
||||
#include <kaboutapplicationdialog.h>
|
||||
|
||||
#include "manageinvitationsdialog.h"
|
||||
#include "invitedialog.h"
|
||||
|
||||
|
||||
TrayIcon::TrayIcon(KDialog *d) :
|
||||
KSystemTrayIcon(),
|
||||
aboutDialog(d),
|
||||
KSystemTrayIcon(d),
|
||||
actionCollection(this),
|
||||
quitting(false)
|
||||
{
|
||||
setIcon(KIcon("eyes-closed24"));
|
||||
|
||||
setToolTip(i18n("Desktop Sharing - connecting"));
|
||||
setToolTip(i18n("Desktop Sharing - disconnected"));
|
||||
|
||||
manageInvitationsAction = new KAction(i18n("Manage &Invitations"), &actionCollection);
|
||||
actionCollection.addAction("manage_invitations", manageInvitationsAction);
|
||||
connect(manageInvitationsAction, SIGNAL(triggered(bool)), SLOT(showManageInvitations()));
|
||||
contextMenu()->addAction(actionCollection.action("manage_invitations"));
|
||||
// manageInvitationsAction = new KAction(i18n("Manage &Invitations"), &actionCollection);
|
||||
// actionCollection.addAction("manage_invitations", manageInvitationsAction);
|
||||
// connect(manageInvitationsAction, SIGNAL(triggered(bool)), SLOT(showManageInvitations()));
|
||||
// contextMenu()->addAction(actionCollection.action("manage_invitations"));
|
||||
|
||||
contextMenu()->addSeparator();
|
||||
// contextMenu()->addSeparator();
|
||||
|
||||
enableControlAction = new KToggleAction(i18n("Enable Remote Control"), &actionCollection);
|
||||
enableControlAction->setCheckedState(KGuiItem(i18n("Disable Remote Control")));
|
||||
@@ -51,7 +52,7 @@ TrayIcon::TrayIcon(KDialog *d) :
|
||||
connect(enableControlAction, SIGNAL(toggled(bool)), SIGNAL(enableDesktopControl(bool)));
|
||||
contextMenu()->addAction("enable_control");
|
||||
|
||||
contextMenu()->addSeparator();
|
||||
contextMenu()->addSeparator();
|
||||
|
||||
aboutAction = KStandardAction::aboutApp(this, SLOT(showAbout()), &actionCollection);
|
||||
actionCollection.addAction("about", aboutAction);
|
||||
@@ -64,7 +65,8 @@ TrayIcon::~TrayIcon(){
|
||||
}
|
||||
|
||||
void TrayIcon::showAbout() {
|
||||
aboutDialog->show();
|
||||
KAboutApplicationDialog(KGlobal::mainComponent().aboutData()).exec();
|
||||
// aboutDialog->show();
|
||||
}
|
||||
|
||||
void TrayIcon::prepareQuit() {
|
||||
|
||||
@@ -57,7 +57,6 @@ private:
|
||||
|
||||
QPixmap trayIconOpen;
|
||||
QPixmap trayIconClosed;
|
||||
KDialog* aboutDialog;
|
||||
KActionCollection actionCollection;
|
||||
KAction* manageInvitationsAction;
|
||||
KAction* aboutAction;
|
||||
|
||||
Reference in New Issue
Block a user