Skip to content
Browse files

Command line flag handler: handle case where SamePlace is already ope…

…n - just focus it. (Thanks Sonny!)
  • Loading branch information...
1 parent 67fea31 commit 3e946d5699d871c9c08dddc0ba02baa7f966b6d8 @bard committed Mar 25, 2009
Showing with 11 additions and 5 deletions.
  1. +11 −5 components/CommandLine.js
View
16 components/CommandLine.js
@@ -26,11 +26,17 @@ const Handler = {
if(uri || cmdLine.handleFlag('sameplace', false)) {
var windowWatcher = Cc['@mozilla.org/embedcomp/window-watcher;1']
- .getService(Ci.nsIWindowWatcher);
-
- windowWatcher.openWindow(
- null, 'chrome://sameplace/content/standalone.xul',
- 'SamePlace:Contacts', 'chrome,toolbar=no', null)
+ .getService(Ci.nsIWindowWatcher);
+ var windowMediator = Cc['@mozilla.org/appshell/window-mediator;1']
+ .getService(Ci.nsIWindowMediator)
+
+ var window = windowMediator.getMostRecentWindow('SamePlace');
+ if(window)
+ window.focus();
+ else
+ windowWatcher.openWindow(
+ null, 'chrome://sameplace/content/standalone.xul',
+ 'SamePlace', 'chrome,toolbar=no', null)
cmdLine.preventDefault = true;
}

0 comments on commit 3e946d5

Please sign in to comment.
Something went wrong with that request. Please try again.