gui: fix passing args to pdfviewer (paths with spaces work now)
This commit is contained in:
		@@ -129,13 +129,14 @@ void MainWindow::pdfPreviewReceived(PdfPreview preview)
 | 
				
			|||||||
					QString command = settings.value("pdfviewer").toString();
 | 
										QString command = settings.value("pdfviewer").toString();
 | 
				
			||||||
					if(command != "" && command.contains("%p") && command.contains("%f"))
 | 
										if(command != "" && command.contains("%p") && command.contains("%f"))
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
						command = command.replace("%f", preview.documentPath);
 | 
					 | 
				
			||||||
						command = command.replace("%p", QString::number(preview.page));
 | 
					 | 
				
			||||||
						QStringList splitted = command.split(" ");
 | 
											QStringList splitted = command.split(" ");
 | 
				
			||||||
						if(splitted.size() > 1)
 | 
											if(splitted.size() > 1)
 | 
				
			||||||
						{
 | 
											{
 | 
				
			||||||
							QString cmd = splitted[0];
 | 
												QString cmd = splitted[0];
 | 
				
			||||||
							QStringList args = splitted.mid(1);
 | 
												QStringList args = splitted.mid(1);
 | 
				
			||||||
 | 
												args.replaceInStrings("%f", preview.documentPath);
 | 
				
			||||||
 | 
												args.replaceInStrings("%p", QString::number(preview.page));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							QProcess::startDetached(cmd, args);
 | 
												QProcess::startDetached(cmd, args);
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user