|
|
|
@ -238,7 +238,7 @@ void Tray::slotNewVPNConnection()
|
|
|
|
|
dlg->show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
|
void Tray::contextMenuAboutToShow (TDEPopupMenu* menu)
|
|
|
|
|
{
|
|
|
|
|
TQT_DBusError err;
|
|
|
|
|
NMProxy* nm = NMProxy::getInstance();
|
|
|
|
@ -262,11 +262,11 @@ 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();
|
|
|
|
@ -274,7 +274,7 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
|
++it)
|
|
|
|
|
{
|
|
|
|
|
DeviceTrayComponent* dev_comp = dynamic_cast<DeviceTrayComponent*> (*it);
|
|
|
|
|
KAction * deviceNewConnAction = 0;
|
|
|
|
|
TDEAction * deviceNewConnAction = 0;
|
|
|
|
|
if (dev_comp)
|
|
|
|
|
{
|
|
|
|
|
TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->getInterface());
|
|
|
|
@ -294,17 +294,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 ) {
|
|
|
|
|
newConnAction = actionCollection ()->action ("new_connection");
|
|
|
|
@ -318,7 +318,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();
|
|
|
|
|
TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > map = nm->getActiveConnectionsMap();
|
|
|
|
|
d->act_conn_map.clear();
|
|
|
|
@ -332,13 +332,13 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
TQString actionName = TQString("disable_connection_%1_%2").arg(conn->getID()).arg(dev ? dev->getInterface() : "");
|
|
|
|
|
KAction * deviceNewConnAction = actionCollection ()->action (actionName);
|
|
|
|
|
TDEAction * deviceNewConnAction = actionCollection ()->action (actionName);
|
|
|
|
|
TQString actionText = conn->getInfoSetting()->getName();
|
|
|
|
|
if (dev)
|
|
|
|
|
actionText += TQString(" (%1)").arg(dev->getInterface());
|
|
|
|
|
|
|
|
|
|
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, TQPair<ConnectionSettings::Connection*, Device*> (conn, dev));
|
|
|
|
@ -349,7 +349,7 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
|
// disable wireless
|
|
|
|
|
if (nm->getWirelessHardwareEnabled(err))
|
|
|
|
|
{
|
|
|
|
|
KAction* wireless = NULL;
|
|
|
|
|
TDEAction* wireless = NULL;
|
|
|
|
|
if (nm->getWirelessEnabled(err)) {
|
|
|
|
|
wireless = actionCollection ()->action ("disable_wireless");
|
|
|
|
|
} else {
|
|
|
|
@ -359,7 +359,7 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// offline vs. online mode
|
|
|
|
|
KAction* switch_mode = NULL;
|
|
|
|
|
TDEAction* switch_mode = NULL;
|
|
|
|
|
if (nm->getState(err) != NM_STATE_ASLEEP) {
|
|
|
|
|
switch_mode = actionCollection ()->action ("offline_mode");
|
|
|
|
|
}
|
|
|
|
@ -378,16 +378,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);
|
|
|
|
|
}
|
|
|
|
@ -630,7 +630,7 @@ void Tray::slotRemoveDeviceTrayComponent(Device* dev)
|
|
|
|
|
|
|
|
|
|
// remove the appropriate action
|
|
|
|
|
TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->getInterface());
|
|
|
|
|
KAction * deviceNewConnAction = actionCollection ()->action (actionName);
|
|
|
|
|
TDEAction * deviceNewConnAction = actionCollection ()->action (actionName);
|
|
|
|
|
|
|
|
|
|
if (!deviceNewConnAction)
|
|
|
|
|
{
|
|
|
|
@ -1054,40 +1054,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");
|
|
|
|
|
|
|
|
|
|