From 38a77e34eec1a02b5c23f65ed381865e570acc8a Mon Sep 17 00:00:00 2001 From: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com> Date: Fri, 10 Apr 2020 20:07:23 -0400 Subject: [PATCH] fix: tab bar Present help info from any window Change-Id: I5508a323137a16284cc96b011e11eddcf96e05bb --- CMakeLists.txt | 2 ++ src/MenuResponder.h | 28 ++++++++++++++++++++++++++++ src/MenuResponder.mm | 30 ++++++++++++++++++++++++++++++ src/RingWindowController.mm | 6 ------ ui/Base.lproj/MainMenu.xib | 8 +++++--- 5 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 src/MenuResponder.h create mode 100644 src/MenuResponder.mm diff --git a/CMakeLists.txt b/CMakeLists.txt index 95edabcd..4033aa0b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -254,6 +254,8 @@ SET(ringclient_OTHERS src/NSString+Extensions.mm src/RingMainWindow.h src/RingMainWindow.mm + src/MenuResponder.h + src/MenuResponder.mm src/Shader.metal ) diff --git a/src/MenuResponder.h b/src/MenuResponder.h new file mode 100644 index 00000000..0a88684f --- /dev/null +++ b/src/MenuResponder.h @@ -0,0 +1,28 @@ +/* +* Copyright (C) 2020 Savoir-faire Linux Inc. +* Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#import <Cocoa/Cocoa.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface MenuResponder : NSResponder + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/MenuResponder.mm b/src/MenuResponder.mm new file mode 100644 index 00000000..d1fbc095 --- /dev/null +++ b/src/MenuResponder.mm @@ -0,0 +1,30 @@ +/* +* Copyright (C) 2020 Savoir-faire Linux Inc. +* Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#import "MenuResponder.h" + +@implementation MenuResponder + +- (IBAction)showHelp:(id)sender +{ + NSURL * helpFile = [NSURL URLWithString: @"https://jami.net/help/"]; + [[NSWorkspace sharedWorkspace] openURL:helpFile]; +} + +@end diff --git a/src/RingWindowController.mm b/src/RingWindowController.mm index 4a4ff0b4..4d26b685 100644 --- a/src/RingWindowController.mm +++ b/src/RingWindowController.mm @@ -631,10 +631,4 @@ typedef NS_ENUM(NSInteger, ViewState) { [self changeViewTo:SHOW_CONVERSATION_SCREEN]; } -- (void)showHelp:(id)sender -{ - NSURL * helpFile = [NSURL URLWithString: @"https://jami.net/help/"]; - [[NSWorkspace sharedWorkspace] openURL:helpFile]; -} - @end diff --git a/ui/Base.lproj/MainMenu.xib b/ui/Base.lproj/MainMenu.xib index 66f2947a..e06e6303 100644 --- a/ui/Base.lproj/MainMenu.xib +++ b/ui/Base.lproj/MainMenu.xib @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15705" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15705"/> </dependencies> <objects> <customObject id="-2" userLabel="File's Owner" customClass="RingWindowController"> @@ -326,16 +326,18 @@ <items> <menuItem title="Jami Help" keyEquivalent="?" id="492"> <connections> - <action selector="showHelp:" target="-1" id="493"/> + <action selector="showHelp:" target="TCU-co-tEb" id="gTr-qt-aGe"/> </connections> </menuItem> </items> </menu> </menuItem> </items> + <point key="canvasLocation" x="139" y="154"/> </menu> <customObject id="494" customClass="AppDelegate"/> <customObject id="420" customClass="NSFontManager"/> <customObject id="592" customClass="SUUpdater"/> + <customObject id="TCU-co-tEb" customClass="MenuResponder"/> </objects> </document> -- GitLab