Skip to content

Commit

Permalink
added notification for kill switch engaged
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-bibb committed May 8, 2020
1 parent aa58227 commit 037466b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
6 changes: 5 additions & 1 deletion apps/cmstapp/code/control_box/controlbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,10 @@ void ControlBox::dbsServicesChanged(QList<QVariant> vlist, QList<QDBusObjectPath
shared::processReply(iface_tech.call(QDBus::AutoDetect, "SetProperty", "Powered", QVariant::fromValue(QDBusVariant(false))) );
} // if technology is currently powered
} // for each technology
notifyclient->init();
notifyclient->setSummary(tr("VPN Kill Switch Engaged"));
notifyclient->setBody(tr("The connection to VPN service %1 was dropped and the VPN kill switch was engaged. All network devices are powered off.").arg(topmap.value("Name").toString()));
this->sendNotifications();
} // if curtopmap type = vpn
} // if topmap type == vpn
} // if kill swich
Expand Down Expand Up @@ -3179,7 +3183,7 @@ void ControlBox::cleanUp()

if (vpn_manager != NULL) {
if (vpn_manager->isValid() ) {
shared::processReply(vpn_manager->call(QDBus::AutoDetect, "UnregisterAgent", QVariant::fromValue(QDBusObjectPath(VPN_AGENT_OBJECT))) );
shared::processReply(vpn_manager->call(QDBus::AutoDetect, "UnregisterAgent", QVariant::fromValue(QDBusObjectPath(VPN_AGENT_OBJECT))) );
} // ivpn_manager isValid
} // not null

Expand Down
2 changes: 1 addition & 1 deletion apps/cmstapp/code/control_box/ui/controlbox.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-240</y>
<y>-274</y>
<width>693</width>
<height>740</height>
</rect>
Expand Down
28 changes: 14 additions & 14 deletions apps/cmstapp/code/notify/notify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void NotifyClient::init()
s_icon.clear();
i_urgency = Nc::UrgencyNormal;
i_expire_timeout = -1;
b_overwrite = true;
b_overwrite = false;

return;
}
Expand Down Expand Up @@ -173,20 +173,20 @@ void NotifyClient::sendNotification ()
// process the icon, if we are using a fallback icon create a temporary file to hold it
QTemporaryFile* tempfileicon = NULL;
if (! s_icon.isEmpty() ) {
if (QFile::exists(s_icon) ) {
tempfileicon = new QTemporaryFile(this);
tempfileicon->setAutoRemove(false);
if (tempfileicon->open() ) {
QPixmap px = QPixmap(s_icon);
px.save(tempfileicon->fileName(),"PNG");
app_icon = tempfileicon->fileName().prepend("file://");
} // if tempfileicon could be opened
} // if s_icon exists as a disk file
if (QFile::exists(s_icon) ) {
tempfileicon = new QTemporaryFile(this);
tempfileicon->setAutoRemove(false);
if (tempfileicon->open() ) {
QPixmap px = QPixmap(s_icon);
px.save(tempfileicon->fileName(),"PNG");
app_icon = tempfileicon->fileName().prepend("file://");
} // if tempfileicon could be opened
} // if s_icon exists as a disk file

// assume s_icon exists as a theme icon, don't check it here. That
// check needs to be done in the calling program.
else app_icon = s_icon;
} // if s_icon is not empty
// assume s_icon exists as a theme icon, don't check it here. That
// check needs to be done in the calling program.
else app_icon = s_icon;
} // if s_icon is not empty

QDBusReply<quint32> reply = notifyclient->call(QLatin1String("Notify"), app_name, replaces_id, app_icon, summary, body, actions, hints, expire_timeout);

Expand Down
2 changes: 1 addition & 1 deletion apps/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ DEALINGS IN THE SOFTWARE.
///////////////////////////////// Program Values ///////////////////////
//
// Program Info (may be visible, but don't mark for tranalation)
#define VERSION "2020.05.06-1"
#define VERSION "2020.05.08-1"

#define RELEASE_DATE "12 April 2020"
#define COPYRIGHT_DATE "2013-2020"
Expand Down
2 changes: 1 addition & 1 deletion text/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<li>Work on Prefereneces tab to make start options clearer (issue #210).</li>
<li>Added VPN internet kill switch.</li>
</ul>
<b> 2020.04.12</b>
b> 2020.04.12</b>
<ul>
<li>Fixed wrong validator on fields that accept either IPV4 or IPv6 addresses.</li>
<li>Expanded IPv6 validator to accept most abbreviated addresses.</li>
Expand Down

0 comments on commit 037466b

Please sign in to comment.