|
|
@ -238,7 +238,7 @@ void Tray::slotNewVPNConnection()
|
|
|
|
dlg->show();
|
|
|
|
dlg->show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
void Tray::contextMenuAboutToShow (TDEPopupMenu* menu)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQT_DBusError err;
|
|
|
|
TQT_DBusError err;
|
|
|
|
NMProxy* nm = NMProxy::getInstance();
|
|
|
|
NMProxy* nm = NMProxy::getInstance();
|
|
|
@ -262,11 +262,11 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
menu->insertItem (subhead, -1, -1);
|
|
|
|
menu->insertItem (subhead, -1, -1);
|
|
|
|
|
|
|
|
|
|
|
|
// New connection
|
|
|
|
// New connection
|
|
|
|
KAction * newConnAction = 0;
|
|
|
|
TDEAction * newConnAction = 0;
|
|
|
|
int devices = d->trayComponents.count();
|
|
|
|
int devices = d->trayComponents.count();
|
|
|
|
if ( devices > 1 ) {
|
|
|
|
if ( devices > 1 ) {
|
|
|
|
newConnAction = actionCollection ()->action ("new_connection_menu");
|
|
|
|
newConnAction = actionCollection ()->action ("new_connection_menu");
|
|
|
|
KActionMenu* newConnActionMenu = static_cast<KActionMenu*>(newConnAction);
|
|
|
|
TDEActionMenu* newConnActionMenu = static_cast<TDEActionMenu*>(newConnAction);
|
|
|
|
newConnActionMenu->popupMenu()->clear();
|
|
|
|
newConnActionMenu->popupMenu()->clear();
|
|
|
|
TQValueList<TrayComponent*>::Iterator it;
|
|
|
|
TQValueList<TrayComponent*>::Iterator it;
|
|
|
|
for (it = d->trayComponents.begin();
|
|
|
|
for (it = d->trayComponents.begin();
|
|
|
@ -274,7 +274,7 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
++it)
|
|
|
|
++it)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DeviceTrayComponent* dev_comp = dynamic_cast<DeviceTrayComponent*> (*it);
|
|
|
|
DeviceTrayComponent* dev_comp = dynamic_cast<DeviceTrayComponent*> (*it);
|
|
|
|
KAction * deviceNewConnAction = 0;
|
|
|
|
TDEAction * deviceNewConnAction = 0;
|
|
|
|
if (dev_comp)
|
|
|
|
if (dev_comp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->getInterface());
|
|
|
|
TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->getInterface());
|
|
|
@ -294,17 +294,17 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
menuCaption = menuCaption.append(")");
|
|
|
|
menuCaption = menuCaption.append(")");
|
|
|
|
deviceNewConnAction = actionCollection ()->action (actionName);
|
|
|
|
deviceNewConnAction = actionCollection ()->action (actionName);
|
|
|
|
if (!deviceNewConnAction) {
|
|
|
|
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);
|
|
|
|
newConnActionMenu->insert(deviceNewConnAction);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// New VPN connection option
|
|
|
|
// New VPN connection option
|
|
|
|
++it;
|
|
|
|
++it;
|
|
|
|
KAction * deviceNewConnAction = 0;
|
|
|
|
TDEAction * deviceNewConnAction = 0;
|
|
|
|
TQString menuCaption = "VPN Connection";
|
|
|
|
TQString menuCaption = "VPN Connection";
|
|
|
|
TQString actionName = TQString("new_connection_%1").arg("vpn");
|
|
|
|
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);
|
|
|
|
newConnActionMenu->insert(deviceNewConnAction);
|
|
|
|
} else if ( devices == 1 ) {
|
|
|
|
} else if ( devices == 1 ) {
|
|
|
|
newConnAction = actionCollection ()->action ("new_connection");
|
|
|
|
newConnAction = actionCollection ()->action ("new_connection");
|
|
|
@ -318,7 +318,7 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
// turn things off
|
|
|
|
// turn things off
|
|
|
|
if (nm)
|
|
|
|
if (nm)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KActionMenu* disableStuffActionMenu = static_cast<KActionMenu*>(actionCollection ()->action ("deactivate_menu") );
|
|
|
|
TDEActionMenu* disableStuffActionMenu = static_cast<TDEActionMenu*>(actionCollection ()->action ("deactivate_menu") );
|
|
|
|
disableStuffActionMenu->popupMenu()->clear();
|
|
|
|
disableStuffActionMenu->popupMenu()->clear();
|
|
|
|
TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > map = nm->getActiveConnectionsMap();
|
|
|
|
TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > map = nm->getActiveConnectionsMap();
|
|
|
|
d->act_conn_map.clear();
|
|
|
|
d->act_conn_map.clear();
|
|
|
@ -332,13 +332,13 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
TQString actionName = TQString("disable_connection_%1_%2").arg(conn->getID()).arg(dev ? dev->getInterface() : "");
|
|
|
|
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();
|
|
|
|
TQString actionText = conn->getInfoSetting()->getName();
|
|
|
|
if (dev)
|
|
|
|
if (dev)
|
|
|
|
actionText += TQString(" (%1)").arg(dev->getInterface());
|
|
|
|
actionText += TQString(" (%1)").arg(dev->getInterface());
|
|
|
|
|
|
|
|
|
|
|
|
if (!deviceNewConnAction) {
|
|
|
|
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->signalMapper.setMapping(deviceNewConnAction, d->current_idx);
|
|
|
|
d->act_conn_map.insert(d->current_idx, TQPair<ConnectionSettings::Connection*, Device*> (conn, dev));
|
|
|
|
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
|
|
|
|
// disable wireless
|
|
|
|
if (nm->getWirelessHardwareEnabled(err))
|
|
|
|
if (nm->getWirelessHardwareEnabled(err))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KAction* wireless = NULL;
|
|
|
|
TDEAction* wireless = NULL;
|
|
|
|
if (nm->getWirelessEnabled(err)) {
|
|
|
|
if (nm->getWirelessEnabled(err)) {
|
|
|
|
wireless = actionCollection ()->action ("disable_wireless");
|
|
|
|
wireless = actionCollection ()->action ("disable_wireless");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -359,7 +359,7 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// offline vs. online mode
|
|
|
|
// offline vs. online mode
|
|
|
|
KAction* switch_mode = NULL;
|
|
|
|
TDEAction* switch_mode = NULL;
|
|
|
|
if (nm->getState(err) != NM_STATE_ASLEEP) {
|
|
|
|
if (nm->getState(err) != NM_STATE_ASLEEP) {
|
|
|
|
switch_mode = actionCollection ()->action ("offline_mode");
|
|
|
|
switch_mode = actionCollection ()->action ("offline_mode");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -378,16 +378,16 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Notifications
|
|
|
|
// Notifications
|
|
|
|
KAction* notif = actionCollection()->action("configure_notifications");
|
|
|
|
TDEAction* notif = actionCollection()->action("configure_notifications");
|
|
|
|
notif->plug(menu);
|
|
|
|
notif->plug(menu);
|
|
|
|
|
|
|
|
|
|
|
|
// Connection Editor
|
|
|
|
// Connection Editor
|
|
|
|
KAction* edit = actionCollection ()->action ("edit_connections");
|
|
|
|
TDEAction* edit = actionCollection ()->action ("edit_connections");
|
|
|
|
edit->plug(menu);
|
|
|
|
edit->plug(menu);
|
|
|
|
|
|
|
|
|
|
|
|
// quit
|
|
|
|
// quit
|
|
|
|
menu->insertSeparator ();
|
|
|
|
menu->insertSeparator ();
|
|
|
|
KAction* quitAction = actionCollection ()->action (KStdAction::name (KStdAction::Quit));
|
|
|
|
TDEAction* quitAction = actionCollection ()->action (KStdAction::name (KStdAction::Quit));
|
|
|
|
if (quitAction)
|
|
|
|
if (quitAction)
|
|
|
|
quitAction->plug (menu);
|
|
|
|
quitAction->plug (menu);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -630,7 +630,7 @@ void Tray::slotRemoveDeviceTrayComponent(Device* dev)
|
|
|
|
|
|
|
|
|
|
|
|
// remove the appropriate action
|
|
|
|
// remove the appropriate action
|
|
|
|
TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->getInterface());
|
|
|
|
TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->getInterface());
|
|
|
|
KAction * deviceNewConnAction = actionCollection ()->action (actionName);
|
|
|
|
TDEAction * deviceNewConnAction = actionCollection ()->action (actionName);
|
|
|
|
|
|
|
|
|
|
|
|
if (!deviceNewConnAction)
|
|
|
|
if (!deviceNewConnAction)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1054,40 +1054,40 @@ Tray::Tray () : KSystemTray ()
|
|
|
|
setMouseTracking (true);
|
|
|
|
setMouseTracking (true);
|
|
|
|
|
|
|
|
|
|
|
|
// Actions used for plugging into the menu
|
|
|
|
// 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,
|
|
|
|
SmallIcon ("no", TQIconSet::Automatic), 0,
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT (slotOfflineMode()), actionCollection (), "offline_mode");
|
|
|
|
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,
|
|
|
|
SmallIcon ("ok", TQIconSet::Automatic), 0,
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT (slotOnlineMode()), actionCollection (), "online_mode");
|
|
|
|
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,
|
|
|
|
SmallIcon ("wireless_off", TQIconSet::Automatic), 0,
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT (slotDisableWireless()), actionCollection (), "disable_wireless");
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT (slotDisableWireless()), actionCollection (), "disable_wireless");
|
|
|
|
|
|
|
|
|
|
|
|
new KAction (i18n ("Enable Wireless"),
|
|
|
|
new TDEAction (i18n ("Enable Wireless"),
|
|
|
|
SmallIcon ("wireless", TQIconSet::Automatic), 0,
|
|
|
|
SmallIcon ("wireless", TQIconSet::Automatic), 0,
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT (slotEnableWireless()), actionCollection (), "enable_wireless");
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT (slotEnableWireless()), actionCollection (), "enable_wireless");
|
|
|
|
|
|
|
|
|
|
|
|
new KAction (i18n ("Edit Connections"),
|
|
|
|
new TDEAction (i18n ("Edit Connections"),
|
|
|
|
SmallIcon ("edit", TQIconSet::Automatic), 0,
|
|
|
|
SmallIcon ("edit", TQIconSet::Automatic), 0,
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT (slotEditConnections()), actionCollection (), "edit_connections");
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT (slotEditConnections()), actionCollection (), "edit_connections");
|
|
|
|
|
|
|
|
|
|
|
|
new KAction (i18n ("Configure Notifications"),
|
|
|
|
new TDEAction (i18n ("Configure Notifications"),
|
|
|
|
SmallIcon ("knotify", TQIconSet::Automatic), 0,
|
|
|
|
SmallIcon ("knotify", TQIconSet::Automatic), 0,
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT (slotEditNotifications()), actionCollection (), "configure_notifications");
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT (slotEditNotifications()), actionCollection (), "configure_notifications");
|
|
|
|
|
|
|
|
|
|
|
|
// this action is only connected when the menu is shown, hence the 0 receiver
|
|
|
|
// 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,
|
|
|
|
SmallIcon ("filenew", TQIconSet::Automatic), 0,
|
|
|
|
TQT_TQOBJECT(this), 0, actionCollection (), "new_connection");
|
|
|
|
TQT_TQOBJECT(this), 0, actionCollection (), "new_connection");
|
|
|
|
|
|
|
|
|
|
|
|
new KActionMenu (i18n ("New connection ..."),
|
|
|
|
new TDEActionMenu (i18n ("New connection ..."),
|
|
|
|
SmallIcon ("filenew", TQIconSet::Automatic),
|
|
|
|
SmallIcon ("filenew", TQIconSet::Automatic),
|
|
|
|
actionCollection(), "new_connection_menu");
|
|
|
|
actionCollection(), "new_connection_menu");
|
|
|
|
|
|
|
|
|
|
|
|
new KActionMenu (i18n ("Deactivate connection..."),
|
|
|
|
new TDEActionMenu (i18n ("Deactivate connection..."),
|
|
|
|
SmallIcon ("no", TQIconSet::Automatic),
|
|
|
|
SmallIcon ("no", TQIconSet::Automatic),
|
|
|
|
actionCollection (), "deactivate_menu");
|
|
|
|
actionCollection (), "deactivate_menu");
|
|
|
|
|
|
|
|
|
|
|
|