summaryrefslogtreecommitdiff
blob: cf09b56c7c5cacf05fb5e901e6abca1628ac6aaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
diff -ruN kile-2.1.2.orig/src/main.cpp kile-2.1.2/src/main.cpp
--- kile-2.1.2.orig/src/main.cpp	2012-04-22 18:54:51.000000000 +0200
+++ kile-2.1.2/src/main.cpp	2012-06-19 00:10:46.096292174 +0200
@@ -43,19 +43,19 @@
  * Complete a relative paths to absolute ones.
  * Also accepts URLs of the form file:relativepath.
 */
-QString completePath(const QString &path)
+QString completePath(const QString &path, const QString& currentPath)
 {
 	QString fullpath(path);
 
 	KILE_DEBUG() << "==complete path is " << path;
-	if( QDir::isRelativePath(path) ) {
+	if(QDir::isRelativePath(path)) {
 		if(path.startsWith("file:")) {
 			KUrl url(path);
-			url.setFileName(completePath(url.toLocalFile()));
+			url.setFileName(completePath(url.toLocalFile(), currentPath));
 			fullpath = url.url();
 		}
 		else if(path.indexOf(QRegExp("^[a-z]+:")) == -1) {
-			fullpath = QDir::currentPath() + QDir::separator() + path;
+			fullpath = currentPath + QDir::separator() + path;
 		}
 	}
 
@@ -138,6 +138,10 @@
 	KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
 	bool running = false;
 
+	// we save the current path here to avoid problems when it's (erroneously) changed later
+	// (for instance, when a new KonsoleWidget is created, see #301808)
+	const QString currentPath = QDir::currentPath();
+
 	// this has to go before the DBus connection
 	KApplication app;
 
@@ -151,13 +155,13 @@
 		for(int i = 0; i < args->count(); ++i) {
 			//FIXME: check whether this can be used to open Urls
 			if(isProject(args->arg(i))) {
-				kile->openProject(completePath(args->arg(i)));
+				kile->openProject(completePath(args->arg(i), currentPath));
 			}
 			else if(args->arg(i) == "-"){
 				kile->openDocument(readDataFromStdin());
 			}
 			else {
-				kile->openDocument(completePath(args->arg(i)));
+				kile->openDocument(completePath(args->arg(i), currentPath));
 			}
 		}
 
@@ -175,16 +179,16 @@
 
 		for ( int i = 0; i < args->count(); ++i ) {
 			QString path = args->arg(i);
-			path = completePath(path);
+			path = completePath(path, currentPath);
 
-			if ( isProject(args->arg(i)) ){
-                         	interface->call("openProject",path);
+			if (isProject(args->arg(i))) {
+				interface->call("openProject", path);
 			}
-			else if(args->arg(i) == "-"){
-				interface->call("openDocument",readDataFromStdin());
+			else if(args->arg(i) == "-") {
+				interface->call("openDocument", readDataFromStdin());
 			}
 			else {
-				interface->call("openDocument",path);
+				interface->call("openDocument", path);
 			}
 		}
 
diff -ruN kile-2.1.2.orig/src/widgets/konsolewidget.cpp kile-2.1.2/src/widgets/konsolewidget.cpp
--- kile-2.1.2.orig/src/widgets/konsolewidget.cpp	2012-04-22 18:54:51.000000000 +0200
+++ kile-2.1.2/src/widgets/konsolewidget.cpp	2012-06-19 00:12:18.451297729 +0200
@@ -78,8 +78,6 @@
 		layout()->addWidget(m_part->widget());
 		setFocusProxy(m_part->widget());
 		connect(m_part, SIGNAL(destroyed()), this, SLOT(slotDestroyed()));
-
-		m_term->showShellInDir(QString());
 	}