Commit 465cfbe5 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Andreas Traczyk

window menu: add item to reopen app

In order to support macOS Human Interface Guidelines, list Ring Main
Window or Wizard Window in Window menu, so user could re-open it after
windows was closed.

Change-Id: I4fc200b1230987817466e7c79cf80dfb9e0ea35b
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent c6e00d0c
......@@ -235,7 +235,9 @@ SET(ringclient_OTHERS
src/AccountSelectionManager.mm
src/utils.h
src/NSString+Extensions.h
src/NSString+Extensions.mm)
src/NSString+Extensions.mm
src/RingMainWindow.h
src/RingMainWindow.mm)
SET(ringclient_XIBS
......
......@@ -238,6 +238,7 @@ static void ReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNet
if(self.ringWindowController == nil) {
self.ringWindowController = [[RingWindowController alloc] initWithWindowNibName:@"RingWindow"];
}
[[NSApplication sharedApplication] removeWindowsItem:self.wizard.window];
[self.ringWindowController.window makeKeyAndOrderFront:self];
}
......
/*
* Copyright (C) 2015-2018 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>
@interface RingMainWindow : NSWindow
@end
/*
* Copyright (C) 2015-2018 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 "RingMainWindow.h"
@implementation RingMainWindow
- (void)close {
[super close];
[[NSApplication sharedApplication] addWindowsItem:self title:@"Ring" filename:NO];
}
@end
......@@ -131,6 +131,7 @@
[self showNewAccountVC];
} else {
[self.window close];
[[NSApplication sharedApplication] removeWindowsItem:self.window];
}
}
......@@ -141,6 +142,7 @@
{
if (success) {
[self.window close];
[[NSApplication sharedApplication] removeWindowsItem:self.window];
if (!isCancelable){
AppDelegate* appDelegate = (AppDelegate *)[[NSApplication sharedApplication] delegate];
[appDelegate showMainWindow];
......@@ -156,6 +158,7 @@
{
if (success) {
[self.window close];
[[NSApplication sharedApplication] removeWindowsItem:self.window];
if (!isCancelable){
AppDelegate* appDelegate = (AppDelegate *)[[NSApplication sharedApplication] delegate];
[appDelegate showMainWindow];
......
......@@ -22,7 +22,7 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Ring" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" animationBehavior="default" id="F0z-JX-Cv5">
<window title="Ring" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" animationBehavior="default" id="F0z-JX-Cv5" customClass="RingMainWindow">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowCollectionBehavior key="collectionBehavior" fullScreenPrimary="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11201" systemVersion="16B2553a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14109" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11201"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14109"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="RingWizardWC">
......@@ -15,10 +16,10 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="4LP-GX-BkH">
<window title="Ring" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" visibleAtLaunch="NO" animationBehavior="default" titleVisibility="hidden" id="4LP-GX-BkH" customClass="RingMainWindow">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" texturedBackground="YES"/>
<rect key="contentRect" x="599" y="440" width="450" height="318"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="900"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<view key="contentView" id="Wgr-xH-z0G">
<rect key="frame" x="0.0" y="0.0" width="450" height="318"/>
<autoresizingMask key="autoresizingMask"/>
......@@ -27,7 +28,7 @@
<rect key="frame" x="0.0" y="258" width="450" height="60"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="EpY-Kl-fNa">
<rect key="frame" x="84" y="12" width="229" height="36"/>
<rect key="frame" x="88" y="12" width="221" height="36"/>
<textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Welcome to Ring" id="2mM-yx-BfM">
<font key="font" metaFont="system" size="30"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
......@@ -35,7 +36,7 @@
</textFieldCell>
</textField>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="P7h-tj-klA">
<rect key="frame" x="319" y="7" width="45" height="46"/>
<rect key="frame" x="315" y="7" width="45" height="46"/>
<constraints>
<constraint firstAttribute="width" constant="45" id="XMY-BN-Ymg"/>
<constraint firstAttribute="height" constant="46" id="i8K-g8-EfQ"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment