mirror of
				https://github.com/keepassxreboot/keepassxc.git
				synced 2025-10-29 21:49:17 -04:00 
			
		
		
		
	Fix and document AutoOpen
* Fix #5017 - ifDevice -> IfDevice and correct behavior of negated hostnames
This commit is contained in:
		
							parent
							
								
									b206cdba92
								
							
						
					
					
						commit
						2f422ab719
					
				
					 4 changed files with 39 additions and 9 deletions
				
			
		
							
								
								
									
										
											BIN
										
									
								
								docs/images/autoopen.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/images/autoopen.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 34 KiB | 
							
								
								
									
										
											BIN
										
									
								
								docs/images/autoopen_ifdevice.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/images/autoopen_ifdevice.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 19 KiB | 
|  | @ -235,6 +235,31 @@ image::edit_entry_history.png[] | |||
| 
 | ||||
| NOTE: Restoring an old history item will store the current entry settings as a new history item. | ||||
| 
 | ||||
| == Automatic Database Opening | ||||
| You can setup one or more databases to open automatically when you unlock a single database. This is done by *(1)* defining a special group named `AutoOpen` with *(2)* entries that contain the file path and credentials for each database that should be opened. There is no limit to the number of databases that can be opened. | ||||
| 
 | ||||
| TIP: Case matters with auto open, the group name must be exactly `AutoOpen`. | ||||
| 
 | ||||
| .AutoOpen Group and Entries | ||||
| image::autoopen.png[] | ||||
| 
 | ||||
| To setup an entry for auto open perform the following steps: | ||||
| 
 | ||||
| 1. Create a new entry and give it any title you wish. | ||||
| 2. If your database has a key file, enter its absolute or relative path in the `username` field. | ||||
| 3. If your database has a password, enter it in the `password` field | ||||
| 4. Enter the absolute or relative path to the database file in the `url` field. You can also use the `{DB_DIR}` placeholder to reference the absolute path of the current database file. | ||||
| 5. To restrict auto open to particular devices, go to the advanced category and enter the following: | ||||
|   a. Create a new attribute named `IfDevice`. | ||||
|   b. Enter hostnames in a comma separated list to define computers that will open this database. | ||||
|   c. Prepend an exclamation mark (`!`) to explicitly exclude a device. | ||||
|   d. Examples: `LAPTOP, DESKTOP` will auto open on a computer named LAPTOP or DESKTOP. `!LAPTOP` will auto open on all devices *not* named LAPTOP. | ||||
| 
 | ||||
| .Auto open IfDevice example | ||||
| image::autoopen_ifdevice.png[] | ||||
| 
 | ||||
| NOTE: You can setup an entry to open on double click of the URL field by prepending `kdbx://` to the relative or absolute path to the database file. You may also have to add `file://` to access network shares (e.g., `kdbx://file://share/database.kdbx`). | ||||
| 
 | ||||
| == Database Settings | ||||
| At any point of time, you can change the settings for your database. To make changes to the general settings, perform the following steps: | ||||
| 
 | ||||
|  |  | |||
|  | @ -2060,18 +2060,23 @@ void DatabaseWidget::processAutoOpen() | |||
|         // Support ifDevice advanced entry, a comma separated list of computer names
 | ||||
|         // that control whether to perform AutoOpen on this entry or not. Can be
 | ||||
|         // negated using '!'
 | ||||
|         auto ifDevice = entry->attribute("ifDevice"); | ||||
|         auto ifDevice = entry->attribute("IfDevice"); | ||||
|         if (!ifDevice.isEmpty()) { | ||||
|             bool loadDb = false; | ||||
|             bool loadDb = true; | ||||
|             auto hostName = QHostInfo::localHostName(); | ||||
|             for (auto& dev : ifDevice.split(",")) { | ||||
|                 dev = dev.trimmed(); | ||||
|                 if (dev.startsWith("!") && dev.mid(1).compare(hostName, Qt::CaseInsensitive) == 0) { | ||||
|                     // Machine name matched an exclusion, don't load this database
 | ||||
|                     loadDb = false; | ||||
|                     break; | ||||
|                 } else if (dev.compare(hostName, Qt::CaseInsensitive) == 0) { | ||||
|             for (auto& device : ifDevice.split(",")) { | ||||
|                 device = device.trimmed(); | ||||
|                 if (device.startsWith("!")) { | ||||
|                     if (device.mid(1).compare(hostName, Qt::CaseInsensitive) == 0) { | ||||
|                         // Machine name matched an exclusion, don't load this database
 | ||||
|                         loadDb = false; | ||||
|                         break; | ||||
|                     } | ||||
|                 } else if (device.compare(hostName, Qt::CaseInsensitive) == 0) { | ||||
|                     loadDb = true; | ||||
|                 } else { | ||||
|                     // Don't load the database if there are devices not starting with '!'
 | ||||
|                     loadDb = false; | ||||
|                 } | ||||
|             } | ||||
|             if (!loadDb) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jonathan White
						Jonathan White