|
|
|
@ -215,7 +215,7 @@ void Tray::slotVPNBannerShow(const TQString& vpnbanner)
|
|
|
|
|
KNotifyClient::event(winId(), "knm-nm-vpn-banner", vpnbanner);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
|
void Tray::contextMenuAboutToShow (TDEPopupMenu* menu)
|
|
|
|
|
{
|
|
|
|
|
TDEGlobalNetworkManager* nm = TDEGlobal::networkManager();
|
|
|
|
|
|
|
|
|
@ -235,16 +235,16 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
|
menu->insertItem (subhead, -1, -1);
|
|
|
|
|
|
|
|
|
|
// New connection
|
|
|
|
|
KAction * newConnAction = 0;
|
|
|
|
|
TDEAction * newConnAction = 0;
|
|
|
|
|
int devices = d->trayComponents.count();
|
|
|
|
|
if ( devices > 1 ) {
|
|
|
|
|
newConnAction = actionCollection ()->action ("new_connection_menu");
|
|
|
|
|
KActionMenu* newConnActionMenu = static_cast<KActionMenu*>(newConnAction);
|
|
|
|
|
TDEActionMenu* newConnActionMenu = static_cast<TDEActionMenu*>(newConnAction);
|
|
|
|
|
newConnActionMenu->popupMenu()->clear();
|
|
|
|
|
TQValueList<TrayComponent*>::Iterator it;
|
|
|
|
|
for (it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) {
|
|
|
|
|
DeviceTrayComponent* dev_comp = dynamic_cast<DeviceTrayComponent*> (*it);
|
|
|
|
|
KAction * deviceNewConnAction = 0;
|
|
|
|
|
TDEAction * deviceNewConnAction = 0;
|
|
|
|
|
if (dev_comp) {
|
|
|
|
|
TDENetworkDevice* dev_comp_dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(dev_comp->device()));
|
|
|
|
|
TQString actionName = TQString("new_connection_%1").arg(dev_comp_dev->deviceNode());
|
|
|
|
@ -264,17 +264,17 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
|
menuCaption = menuCaption.append(")");
|
|
|
|
|
deviceNewConnAction = actionCollection ()->action (actionName);
|
|
|
|
|
if (!deviceNewConnAction) {
|
|
|
|
|
deviceNewConnAction = new KAction (menuCaption, 0, (*it), TQT_SLOT(newConnection()), actionCollection(), actionName);
|
|
|
|
|
deviceNewConnAction = new TDEAction (menuCaption, 0, (*it), TQT_SLOT(newConnection()), actionCollection(), actionName);
|
|
|
|
|
}
|
|
|
|
|
newConnActionMenu->insert(deviceNewConnAction);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// New VPN connection option
|
|
|
|
|
++it;
|
|
|
|
|
KAction * deviceNewConnAction = 0;
|
|
|
|
|
TDEAction * deviceNewConnAction = 0;
|
|
|
|
|
TQString menuCaption = "VPN Connection";
|
|
|
|
|
TQString actionName = TQString("new_connection_%1").arg("vpn");
|
|
|
|
|
deviceNewConnAction = new KAction (menuCaption, 0, TQT_TQOBJECT(this), TQT_SLOT(slotNewVPNConnection()), actionCollection(), actionName);
|
|
|
|
|
deviceNewConnAction = new TDEAction (menuCaption, 0, TQT_TQOBJECT(this), TQT_SLOT(slotNewVPNConnection()), actionCollection(), actionName);
|
|
|
|
|
newConnActionMenu->insert(deviceNewConnAction);
|
|
|
|
|
}
|
|
|
|
|
else if ( devices == 1 ) {
|
|
|
|
@ -288,7 +288,7 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
|
|
|
|
|
|
// turn things off
|
|
|
|
|
if (nm) {
|
|
|
|
|
KActionMenu* disableStuffActionMenu = static_cast<KActionMenu*>(actionCollection ()->action ("deactivate_menu") );
|
|
|
|
|
TDEActionMenu* disableStuffActionMenu = static_cast<TDEActionMenu*>(actionCollection ()->action ("deactivate_menu") );
|
|
|
|
|
disableStuffActionMenu->popupMenu()->clear();
|
|
|
|
|
TDENetworkConnectionList* map = nm->connections();
|
|
|
|
|
d->act_conn_map.clear();
|
|
|
|
@ -308,11 +308,11 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQString actionName = TQString("disable_connection_%1").arg(conn->UUID);
|
|
|
|
|
KAction * deviceNewConnAction = actionCollection ()->action (actionName);
|
|
|
|
|
TDEAction * deviceNewConnAction = actionCollection ()->action (actionName);
|
|
|
|
|
TQString actionText = conn->friendlyName;
|
|
|
|
|
|
|
|
|
|
if (!deviceNewConnAction) {
|
|
|
|
|
deviceNewConnAction = new KAction (actionText, 0, &d->signalMapper, TQT_SLOT(map()), actionCollection(), actionName);
|
|
|
|
|
deviceNewConnAction = new TDEAction (actionText, 0, &d->signalMapper, TQT_SLOT(map()), actionCollection(), actionName);
|
|
|
|
|
}
|
|
|
|
|
d->signalMapper.setMapping(deviceNewConnAction, d->current_idx);
|
|
|
|
|
d->act_conn_map.insert(d->current_idx, conn->UUID);
|
|
|
|
@ -322,7 +322,7 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
|
|
|
|
|
|
// disable wireless
|
|
|
|
|
if (nm->wiFiHardwareEnabled()) {
|
|
|
|
|
KAction* wireless = NULL;
|
|
|
|
|
TDEAction* wireless = NULL;
|
|
|
|
|
if (nm->wiFiEnabled()) {
|
|
|
|
|
wireless = actionCollection ()->action ("disable_wireless");
|
|
|
|
|
} else {
|
|
|
|
@ -332,7 +332,7 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// offline vs. online mode
|
|
|
|
|
KAction* switch_mode = NULL;
|
|
|
|
|
TDEAction* switch_mode = NULL;
|
|
|
|
|
if (nm->backendStatus() & TDENetworkGlobalManagerFlags::Sleeping) {
|
|
|
|
|
switch_mode = actionCollection ()->action ("online_mode");
|
|
|
|
|
}
|
|
|
|
@ -350,16 +350,16 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Notifications
|
|
|
|
|
KAction* notif = actionCollection()->action("configure_notifications");
|
|
|
|
|
TDEAction* notif = actionCollection()->action("configure_notifications");
|
|
|
|
|
notif->plug(menu);
|
|
|
|
|
|
|
|
|
|
// Connection Editor
|
|
|
|
|
KAction* edit = actionCollection ()->action ("edit_connections");
|
|
|
|
|
TDEAction* edit = actionCollection ()->action ("edit_connections");
|
|
|
|
|
edit->plug(menu);
|
|
|
|
|
|
|
|
|
|
// quit
|
|
|
|
|
menu->insertSeparator ();
|
|
|
|
|
KAction* quitAction = actionCollection ()->action (KStdAction::name (KStdAction::Quit));
|
|
|
|
|
TDEAction* quitAction = actionCollection ()->action (KStdAction::name (KStdAction::Quit));
|
|
|
|
|
if (quitAction) {
|
|
|
|
|
quitAction->plug (menu);
|
|
|
|
|
}
|
|
|
|
@ -446,7 +446,7 @@ void Tray::slotRemoveDeviceTrayComponent(TQString dev)
|
|
|
|
|
// remove the appropriate action
|
|
|
|
|
TDENetworkDevice* dev_comp_dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(dev_comp->device()));
|
|
|
|
|
TQString actionName = TQString("new_connection_%1").arg(dev_comp_dev->deviceNode());
|
|
|
|
|
KAction * deviceNewConnAction = actionCollection ()->action (actionName);
|
|
|
|
|
TDEAction * deviceNewConnAction = actionCollection ()->action (actionName);
|
|
|
|
|
|
|
|
|
|
if (!deviceNewConnAction)
|
|
|
|
|
{
|
|
|
|
@ -1040,40 +1040,40 @@ Tray::Tray() : KSystemTray()
|
|
|
|
|
setMouseTracking (true);
|
|
|
|
|
|
|
|
|
|
// Actions used for plugging into the menu
|
|
|
|
|
new KAction (i18n ("Switch to offline mode"),
|
|
|
|
|
new TDEAction (i18n ("Switch to offline mode"),
|
|
|
|
|
SmallIcon ("no", TQIconSet::Automatic), 0,
|
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT (slotOfflineMode()), actionCollection (), "offline_mode");
|
|
|
|
|
|
|
|
|
|
new KAction (i18n ("Switch to online mode"),
|
|
|
|
|
new TDEAction (i18n ("Switch to online mode"),
|
|
|
|
|
SmallIcon ("ok", TQIconSet::Automatic), 0,
|
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT (slotOnlineMode()), actionCollection (), "online_mode");
|
|
|
|
|
|
|
|
|
|
new KAction (i18n ("Disable Wireless"),
|
|
|
|
|
new TDEAction (i18n ("Disable Wireless"),
|
|
|
|
|
SmallIcon ("wireless_off", TQIconSet::Automatic), 0,
|
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT (slotDisableWireless()), actionCollection (), "disable_wireless");
|
|
|
|
|
|
|
|
|
|
new KAction (i18n ("Enable Wireless"),
|
|
|
|
|
new TDEAction (i18n ("Enable Wireless"),
|
|
|
|
|
SmallIcon ("wireless", TQIconSet::Automatic), 0,
|
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT (slotEnableWireless()), actionCollection (), "enable_wireless");
|
|
|
|
|
|
|
|
|
|
new KAction (i18n ("Edit Connections"),
|
|
|
|
|
new TDEAction (i18n ("Edit Connections"),
|
|
|
|
|
SmallIcon ("edit", TQIconSet::Automatic), 0,
|
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT (slotEditConnections()), actionCollection (), "edit_connections");
|
|
|
|
|
|
|
|
|
|
new KAction (i18n ("Configure Notifications"),
|
|
|
|
|
new TDEAction (i18n ("Configure Notifications"),
|
|
|
|
|
SmallIcon ("knotify", TQIconSet::Automatic), 0,
|
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT (slotEditNotifications()), actionCollection (), "configure_notifications");
|
|
|
|
|
|
|
|
|
|
// this action is only connected when the menu is shown, hence the 0 receiver
|
|
|
|
|
new KAction (i18n ("New connection ..."),
|
|
|
|
|
new TDEAction (i18n ("New connection ..."),
|
|
|
|
|
SmallIcon ("filenew", TQIconSet::Automatic), 0,
|
|
|
|
|
TQT_TQOBJECT(this), 0, actionCollection (), "new_connection");
|
|
|
|
|
|
|
|
|
|
new KActionMenu (i18n ("New connection ..."),
|
|
|
|
|
new TDEActionMenu (i18n ("New connection ..."),
|
|
|
|
|
SmallIcon ("filenew", TQIconSet::Automatic),
|
|
|
|
|
actionCollection(), "new_connection_menu");
|
|
|
|
|
|
|
|
|
|
new KActionMenu (i18n ("Deactivate connection..."),
|
|
|
|
|
new TDEActionMenu (i18n ("Deactivate connection..."),
|
|
|
|
|
SmallIcon ("no", TQIconSet::Automatic),
|
|
|
|
|
actionCollection (), "deactivate_menu");
|
|
|
|
|
|
|
|
|
|