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("krfb").pixmap(22, 22, KIcon::Disabled
));
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()));
64 void TrayIcon::showAbout()
66 KAboutApplicationDialog(KGlobal::mainComponent().aboutData()).exec();
69 void TrayIcon::prepareQuit()
74 void TrayIcon::showConnectedMessage(const QString
&host
)
77 setIcon(KIcon("krfb"));
78 KPassivePopup::message(i18n("Desktop Sharing"),
79 i18n("The remote user has been authenticated and is now connected."),
80 KIcon("krfb").pixmap(22, 22),
82 setToolTip(i18n("Desktop Sharing - connected with %1", host
));
85 void TrayIcon::showDisconnectedMessage()
90 setToolTip(i18n("Desktop Sharing - disconnected"));
91 setIcon(KIcon("krfb").pixmap(22, 22, KIcon::Disabled
));
92 KPassivePopup
*p
= KPassivePopup::message(i18n("Desktop Sharing"),
93 i18n("The remote user has closed the connection."),
94 KIcon("krfb").pixmap(22, 22, KIcon::Disabled
),
96 connect(p
, SIGNAL(hidden()), this, SIGNAL(diconnectedMessageDisplayed()));
99 void TrayIcon::setDesktopControlSetting(bool b
)
101 enableControlAction
->setEnabled(true);
102 enableControlAction
->setChecked(b
);
105 void TrayIcon::showManageInvitations()
107 ManageInvitationsDialog
invMngDlg(0);
111 #include "trayicon.moc"