Browse Source
			
			
			improved closed handling
			
				Close now works for popups/dialogs with no view below
			
			
				pull/2/head
			
			
		 
		
			
				
					
						
						Skycoder42
					
					7 years ago
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: 8E01AD9EF0578D2B
						
					
				
			
		
		
		
	
		
			
				 4 changed files with 
12 additions and 
7 deletions
			 
			
		 
		
			
				- 
					
					
					 
					src/imports/mvvmquick/DialogPresenter.qml
				
 
			
				- 
					
					
					 
					src/imports/mvvmquick/PopupPresenter.qml
				
 
			
				- 
					
					
					 
					src/imports/mvvmquick/PresentingStackView.qml
				
 
			
				- 
					
					
					 
					src/imports/mvvmquick/QtMvvmApp.qml
				
 
			
		
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -56,6 +56,9 @@ QtObject { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						 */ | 
					 | 
					 | 
						 */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						property Item rootItem: null | 
					 | 
					 | 
						property Item rootItem: null | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
						//TODO document | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
						readonly property bool empty: _popups.length == 0 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						/*! @brief The primary presenting method to present a dialog | 
					 | 
					 | 
						/*! @brief The primary presenting method to present a dialog | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						 * | 
					 | 
					 | 
						 * | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						 * @param type:MessageConfig config The message configuration to create a dialog of | 
					 | 
					 | 
						 * @param type:MessageConfig config The message configuration to create a dialog of | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -55,6 +55,9 @@ QtObject { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						 */ | 
					 | 
					 | 
						 */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						property Item rootItem: null | 
					 | 
					 | 
						property Item rootItem: null | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
						//TODO document | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
						readonly property bool empty: _popups.length == 0 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						//! Internal property | 
					 | 
					 | 
						//! Internal property | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						property var _popups: [] | 
					 | 
					 | 
						property var _popups: [] | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -113,15 +113,11 @@ StackView { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
									return true; | 
					 | 
					 | 
									return true; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							} | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							if(_presenterStack.depth <= 1) | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								return false; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							else { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							if(_presenterStack.safePop()) | 
					 | 
					 | 
							if(_presenterStack.safePop()) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								return true; | 
					 | 
					 | 
								return true; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							else | 
					 | 
					 | 
							else | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								return false; | 
					 | 
					 | 
								return false; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						} | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						} | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						/*! @brief Pop and delete a view | 
					 | 
					 | 
						/*! @brief Pop and delete a view | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						 * | 
					 | 
					 | 
						 * | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -172,6 +172,9 @@ ApplicationWindow { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								closed = _drawerLoader.item.closeAction(); | 
					 | 
					 | 
								closed = _drawerLoader.item.closeAction(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							if(!closed) | 
					 | 
					 | 
							if(!closed) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								closed = _rootStack.closeAction(); | 
					 | 
					 | 
								closed = _rootStack.closeAction(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
							//if everything was closed -> still accept it | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
							if(closed && _rootDialogs.emtpy && _rootPopup.empty && _rootStack.empty) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
								closed = false; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							return closed; | 
					 | 
					 | 
							return closed; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						} | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |