aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRael <rael.gc@gmail.com>2015-10-28 08:45:49 -0200
committerRael <rael.gc@gmail.com>2015-10-28 08:45:49 -0200
commit6604e5d2abe7727c8fa84f49cd1bad738aa71e68 (patch)
tree408e9b0636eacbd25c792fa8417a0e52eaa44d99
parent6b57abed8b07b5174d8d24a3933008bac45bcc61 (diff)
downloadscudcloud-6604e5d2abe7727c8fa84f49cd1bad738aa71e68.zip
scudcloud-6604e5d2abe7727c8fa84f49cd1bad738aa71e68.tar.gz
scudcloud-6604e5d2abe7727c8fa84f49cd1bad738aa71e68.tar.bz2
Re-enable desktop notifications on reconnect (#274)
-rw-r--r--scudcloud-1.0/lib/wrapper.py5
-rw-r--r--scudcloud-1.0/resources/scudcloud.js2
-rw-r--r--scudcloud-1.0/scudcloud-src.js5
3 files changed, 10 insertions, 2 deletions
diff --git a/scudcloud-1.0/lib/wrapper.py b/scudcloud-1.0/lib/wrapper.py
index 2864876..1d710d4 100644
--- a/scudcloud-1.0/lib/wrapper.py
+++ b/scudcloud-1.0/lib/wrapper.py
@@ -24,8 +24,13 @@ class Wrapper(QWebView):
self.loadStarted.connect(self._loadStarted)
self.loadFinished.connect(self._loadFinished)
self.linkClicked.connect(self._linkClicked)
+ self.page().featurePermissionRequested.connect(self.permissionRequested)
self.addActions()
+ def permissionRequested(self, frame, feature):
+ self.page().setFeaturePermission(frame, feature, QWebPage.PermissionGrantedByUser)
+ self.call("overrideNotifications")
+
def configure_proxy(self):
proxy = urlparse(os.environ.get('http_proxy') or os.environ.get('HTTP_PROXY'))
if proxy.hostname is not None and proxy.port is not None:
diff --git a/scudcloud-1.0/resources/scudcloud.js b/scudcloud-1.0/resources/scudcloud.js
index d98e42d..5e121c6 100644
--- a/scudcloud-1.0/resources/scudcloud.js
+++ b/scudcloud-1.0/resources/scudcloud.js
@@ -1 +1 @@
-var ScudCloud={overrideNotifications:function(){TS.ui.growls.no_notifications=!1,TS.ui.growls.checkPermission=function(){return!0},TS.ui.growls.getPermissionLevel=function(){return"granted"},TS.ui.growls.show=function(n,e){desktop.sendMessage(n,e)},TS.ui.banner.close()},overrideConnect:function(){TS.ms.connected_sig.add(function(){ScudCloud.connect(!0)}),TS.ms.disconnected_sig.add(function(){ScudCloud.connect(!1)})},overrideBanner:function(){ScudCloud.showBanner=TS.ui.banner.show,TS.ui.banner.show=function(){ScudCloud.showBanner(),ScudCloud.overrideNotifications()}},connect:function(n){desktop.enableMenus(n),n&&desktop.populate(JSON.stringify({channels:ScudCloud.listChannels(),teams:ScudCloud.listTeams(),icon:TS.model.team.icon.image_44}))},count:function(){var n=0;return $("span.unread_highlight").not(".hidden").each(function(){n+=new Number($(this).text().replace("+",""))}),n},createSnippet:function(){return TS.ui.snippet_dialog.start()},listChannels:function(){return TS.channels.getUnarchivedChannelsForUser()},listTeams:function(){var n=TS.getAllTeams();return n[0].team_icon={image_44:TS.model.team.icon.image_44},n},quicklist:function(){desktop.quicklist(ScudCloud.listChannels())},join:function(n){return TS.channels.join(n)},setClipboard:function(n){TS.client.ui.file_pasted_sig.dispatch(n,TS.model.shift_key_pressed)},preferences:function(){return TS.ui.prefs_dialog.start()},addTeam:function(){document.location=TS.boot_data.signin_url},getCurrentTeam:function(){var n=TS.getAllTeams();if(null!=n)for(var e=0;n.length;e++)if(n[e].team_url==TS.boot_data.team_url)return n[e].id;return""},logout:function(){document.location=TS.boot_data.logout_url},help:function(){return TS.help_dialog.start()},isConnected:function(){return"undefined"!=typeof TS&&"undefined"!=typeof TS.model&&TS.model.ms_connected}};"undefined"!=typeof TS&&(document.onpaste=function(){desktop.pasted(!1)},ScudCloud.overrideNotifications(),ScudCloud.overrideConnect(),ScudCloud.overrideBanner());
+var ScudCloud={overrideNotifications:function(){TS.ui.growls.no_notifications=!1,TS.ui.growls.checkPermission=function(){return!0},TS.ui.growls.getPermissionLevel=function(){return"granted"},TS.ui.growls.show=function(n,e){desktop.sendMessage(n,e)},TS.ui.banner.close()},overrideConnect:function(){TS.ms.connected_sig.add(function(){ScudCloud.connect(!0)}),TS.ms.disconnected_sig.add(function(){ScudCloud.connect(!1)})},overrideBanner:function(){ScudCloud.showBanner=TS.ui.banner.show,TS.ui.banner.show=function(){ScudCloud.showBanner(),ScudCloud.overrideNotifications()}},connect:function(n){desktop.enableMenus(n),n&&(ScudCloud.overrideNotifications(),desktop.populate(JSON.stringify({channels:ScudCloud.listChannels(),teams:ScudCloud.listTeams(),icon:TS.model.team.icon.image_44})))},count:function(){var n=0;return $("span.unread_highlight").not(".hidden").each(function(){n+=new Number($(this).text().replace("+",""))}),n},createSnippet:function(){return TS.ui.snippet_dialog.start()},listChannels:function(){return TS.channels.getUnarchivedChannelsForUser()},listTeams:function(){var n=TS.getAllTeams();return n[0].team_icon={image_44:TS.model.team.icon.image_44},n},quicklist:function(){desktop.quicklist(ScudCloud.listChannels())},join:function(n){return TS.channels.join(n)},setClipboard:function(n){TS.client.ui.file_pasted_sig.dispatch(n,TS.model.shift_key_pressed)},preferences:function(){return TS.ui.prefs_dialog.start()},addTeam:function(){document.location=TS.boot_data.signin_url},getCurrentTeam:function(){var n=TS.getAllTeams();if(null!=n)for(var e=0;n.length;e++)if(n[e].team_url==TS.boot_data.team_url)return n[e].id;return""},logout:function(){document.location=TS.boot_data.logout_url},help:function(){return TS.help_dialog.start()},isConnected:function(){return"undefined"!=typeof TS&&"undefined"!=typeof TS.model&&TS.model.ms_connected}};"undefined"!=typeof TS&&(document.onpaste=function(){desktop.pasted(!1)},ScudCloud.overrideNotifications(),ScudCloud.overrideConnect(),ScudCloud.overrideBanner());
diff --git a/scudcloud-1.0/scudcloud-src.js b/scudcloud-1.0/scudcloud-src.js
index aec5d57..c16a0b9 100644
--- a/scudcloud-1.0/scudcloud-src.js
+++ b/scudcloud-1.0/scudcloud-src.js
@@ -16,7 +16,10 @@ var ScudCloud = {
},
connect: function(b){
desktop.enableMenus(b);
- if(b) desktop.populate(JSON.stringify({'channels': ScudCloud.listChannels(), 'teams': ScudCloud.listTeams(), 'icon': TS.model.team.icon.image_44}));
+ if(b){
+ ScudCloud.overrideNotifications();
+ desktop.populate(JSON.stringify({'channels': ScudCloud.listChannels(), 'teams': ScudCloud.listTeams(), 'icon': TS.model.team.icon.image_44}));
+ }
},
count: function(){
var total=0;