Skip to content
This repository has been archived by the owner on Oct 29, 2018. It is now read-only.

Commit

Permalink
Forcing new post to be opened in system browser (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
raelgc committed Feb 16, 2016
1 parent f34fe21 commit ffca6a7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scudcloud/resources/scudcloud.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions scudcloud/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def _loadStarted(self):

def _urlChanged(self, qUrl):
url = self._urlToString(qUrl)
if self.window.debug: print("URL Changed: {}".format(url))
# Some integrations/auth will get back to /services with no way to get back to chat
if Resources.SERVICES_URL_RE.match(url):
self.systemOpen(url)
Expand All @@ -132,6 +133,7 @@ def systemOpen(self, url):

def _linkClicked(self, qUrl):
url = self._urlToString(qUrl)
if self.window.debug: print("Link Clicked: {}".format(url))
if Resources.SIGNIN_URL == url or Resources.MAINPAGE_URL_RE.match(url):
self.window.switchTo(url)
elif Resources.MESSAGES_URL_RE.match(url) or Resources.SSO_URL_RE.match(url) or Resources.GOOGLE_OAUTH2_URL_RE.match(url):
Expand Down Expand Up @@ -159,10 +161,10 @@ def help(self):
self.call("help")

def helpCenter(self):
subprocess.call(('xdg-open', "https://slack.zendesk.com/hc/en-us"))
self.systemOpen("https://slack.zendesk.com/hc/en-us")

def about(self):
subprocess.call(('xdg-open', "https://github.com/raelgc/scudcloud"))
self.systemOpen("https://github.com/raelgc/scudcloud")

def listChannels(self):
return self.call("listChannels")
Expand Down Expand Up @@ -216,6 +218,10 @@ def pasted(self, checked):
pixmap.save(buffer, "PNG")
self.call("setClipboard", str(byteArray.toBase64(), sys.stdout.encoding))

@QtCore.pyqtSlot(str)
def createPost(self, teamUrl):
self.systemOpen("{}files/create/space".format(teamUrl))

@QtCore.pyqtSlot(str, str)
def sendMessage(self, title, message):
erase = ['['+self.name.lower()+'] in ', '['+self.name.lower()+'] from ']
Expand Down
2 changes: 2 additions & 0 deletions sources/scudcloud-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ ScudCloud = {
}
};
document.onpaste = function(e){desktop.pasted(false);};
// Forcing new posts to get opened in system browser (Fixes #225)
$("body").delegate('a[href="/files/create/space"]', "click", function(){desktop.createPost(TS.boot_data.team_url);});
window.winssb = TSSSB = ScudCloud;
// Sometimes didFinishLoading is not loaded
if(ScudCloud.unloaded){
Expand Down

0 comments on commit ffca6a7

Please sign in to comment.