1 /***************************************************************************
4 begin : Tue Dec 11 2001
5 copyright : (C) 2001-2002 by Tim Jansen
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
20 #include <kstandardaction.h>
25 #include <kactioncollection.h>
26 #include <kaboutapplicationdialog.h>
28 #include "manageinvitationsdialog.h"
29 #include "invitedialog.h"
32 TrayIcon::TrayIcon(KDialog
*d
) :
36 setIcon(KIcon("eyes-closed24"));
38 setToolTip(i18n("Desktop Sharing - disconnected"));
40 // manageInvitationsAction = new KAction(i18n("Manage &Invitations"), &actionCollection);
41 // actionCollection.addAction("manage_invitations", manageInvitationsAction);
42 // connect(manageInvitationsAction, SIGNAL(triggered(bool)), SLOT(showManageInvitations()));
43 // contextMenu()->addAction(actionCollection.action("manage_invitations"));
45 // contextMenu()->addSeparator();
47 enableControlAction
= new KToggleAction(i18n("Enable Remote Control"), actionCollection());
48 enableControlAction
->setCheckedState(KGuiItem(i18n("Disable Remote Control")));
49 enableControlAction
->setEnabled(false);
50 actionCollection()->addAction("enable_control", enableControlAction
);
51 connect(enableControlAction
, SIGNAL(toggled(bool)), SIGNAL(enableDesktopControl(bool)));
52 contextMenu()->addAction(actionCollection()->action("enable_control"));
54 contextMenu()->addSeparator();
55 contextMenu()->addAction(KStandardAction::aboutApp(this, SLOT(showAbout()), actionCollection()));
60 TrayIcon::~TrayIcon(){
63 void TrayIcon::showAbout() {
64 KAboutApplicationDialog(KGlobal::mainComponent().aboutData()).exec();
67 void TrayIcon::prepareQuit() {
71 void TrayIcon::showConnectedMessage(const QString
&host
) {
73 setIcon(KIcon("eyes-open24"));
74 KPassivePopup::message(i18n("Desktop Sharing"),
75 i18n("The remote user has been authenticated and is now connected."),
76 KIcon("eyes-open24").pixmap(22),
78 setToolTip(i18n("Desktop Sharing - connected with %1", host
));
81 void TrayIcon::showDisconnectedMessage() {
85 setToolTip(i18n("Desktop Sharing - disconnected"));
86 setIcon(KIcon("eyes-closed24"));
87 KPassivePopup
*p
= KPassivePopup::message(i18n("Desktop Sharing"),
88 i18n("The remote user has closed the connection."),
89 KIcon("eyes-closed24").pixmap(22),
91 connect(p
, SIGNAL(hidden()), this, SIGNAL(diconnectedMessageDisplayed()));
94 void TrayIcon::setDesktopControlSetting(bool b
) {
95 enableControlAction
->setEnabled(true);
96 enableControlAction
->setChecked(b
);
99 void TrayIcon::showManageInvitations()
101 ManageInvitationsDialog
invMngDlg(0);
105 #include "trayicon.moc"