Blob Blame History Raw
From 2ae917fad7cd4e5d3043e3ab3f1cfe4faa63f532 Mon Sep 17 00:00:00 2001
From: Haikel Guemar <haikel.guemar@sysfera.com>
Date: Thu, 28 Jul 2011 16:55:32 +0200
Subject: [PATCH 1/3] viewers: use xdg-open

---
 buildmanager.cpp |   22 +++++-----------------
 1 files changed, 5 insertions(+), 17 deletions(-)

diff --git buildmanager.cpp buildmanager.cpp
index 1441564..d8986bb 100644
--- buildmanager.cpp
+++ buildmanager.cpp
@@ -460,23 +460,11 @@ QString BuildManager::guessCommandName(LatexCommand cmd) {
 // kdvi "file:%.dvi#src:@ %.tex"
 	switch (cmd) {
 	case CMD_VIEWDVI:
-		switch (x11desktop_env()) {
-		case 3:	return "kdvi %.dvi > /dev/null";
-		case 4:	return "okular %.dvi > /dev/null";
-		default:return "evince %.dvi > /dev/null";
-		};
+                return "xdg-open %.dvi > /dev/null";
 	case CMD_VIEWPS:
-		switch (x11desktop_env()) {
-		case 3: return "kghostview %.ps > /dev/null";
-		case 4:	return "okular %.ps > /dev/null";
-		default:return "evince %.ps > /dev/null";
-		};
+		return "xdg-open %.ps > /dev/null";
 	case CMD_VIEWPDF:
-		switch (x11desktop_env()) {
-		case 3: return "kpdf %.pdf > /dev/null";
-		case 4:	return "okular %.pdf > /dev/null";
-		default:return "evince %.pdf > /dev/null";
-		};
+		return "xdg-open %.pdf > /dev/null";
 	default:;
 	}
 #endif
@@ -610,7 +598,7 @@ void BuildManager::setLatexCommand(LatexCommand cmd, const QString &cmdString){
 		    ((unquote == baseName) ||
 		     (   (unquote.endsWith(QDir::separator() + baseName) || unquote.endsWith("/" + baseName))
 		      && (!unquote.contains(" ") || (!unquote.contains('"') && unquote != trimmed)) //spaces mean options, if not everything is quoted
-		      && (QFileInfo(unquote).exists())		      
+		      && (QFileInfo(unquote).exists())
 		      )
 		     ))
 			commands[cmd] = cmdString + " " + defaultCommandOptions(cmd);
@@ -619,7 +607,7 @@ void BuildManager::setLatexCommand(LatexCommand cmd, const QString &cmdString){
 	}
 }
 
-QString BuildManager::getLatexCommand(LatexCommand cmd){ 
+QString BuildManager::getLatexCommand(LatexCommand cmd){
 	return commands[cmd];
 }
 QString BuildManager::getLatexCommandForDisplay(LatexCommand cmd){
-- 
1.7.4.4