Lines 131-147
Link Here
|
131 |
Process p = new Process (); |
131 |
Process p = new Process (); |
132 |
p.StartInfo.UseShellExecute = false; |
132 |
p.StartInfo.UseShellExecute = false; |
133 |
|
133 |
|
134 |
if ((!path.StartsWith ("\"")) && (!path.EndsWith ("\""))) |
134 |
if ((!path.StartsWith ("\"")) && (!path.EndsWith ("\""))) |
135 |
path = "\"" + path + "\""; |
135 |
path = "\"" + path + "\""; |
136 |
#if ENABLE_DESKTOP_LAUNCH |
136 |
p.StartInfo.FileName = "kfmclient"; // KDE |
137 |
p.StartInfo.FileName = "desktop-launch"; |
137 |
p.StartInfo.Arguments = " exec " + path; // KDE |
138 |
p.StartInfo.Arguments = path; |
|
|
139 |
#else |
140 |
p.StartInfo.FileName = "nautilus"; |
141 |
p.StartInfo.Arguments = "--no-desktop " + path; |
142 |
#endif |
143 |
try { |
138 |
try { |
144 |
p.Start (); |
139 |
p.Start (); |
145 |
} catch (Exception e) { |
140 |
} catch (Exception e) { |
146 |
Console.WriteLine ("Cannot open folder: " + e); |
141 |
Console.WriteLine ("Cannot open folder: " + e); |
147 |
} |
142 |
} |
Lines 155-220
Link Here
|
155 |
protected void OpenFromMime (Hit hit, |
150 |
protected void OpenFromMime (Hit hit, |
156 |
string command_fallback, |
151 |
string command_fallback, |
157 |
string args_fallback, |
152 |
string args_fallback, |
158 |
bool expects_uris_fallback) |
153 |
bool expects_uris_fallback) |
159 |
{ |
154 |
{ |
160 |
string argument; |
155 |
Process p = new Process (); // KDE |
161 |
string command = command_fallback; |
156 |
p.StartInfo.UseShellExecute = false; // KDE |
162 |
bool expects_uris = expects_uris_fallback; |
157 |
p.StartInfo.FileName = "kfmclient"; // KDE |
163 |
|
158 |
string argument = String.Format (" exec {0}", hit.PathQuoted); // KDE |
164 |
// FIXME: This is evil. Nautilus should be handling |
159 |
p.StartInfo.Arguments = argument; // KDE |
165 |
// inode/directory, not just x-directory/normal |
|
|
166 |
if (hit.MimeType == "inode/directory") |
167 |
hit.MimeType = "x-directory/normal"; |
168 |
#if ENABLE_DESKTOP_LAUNCH |
169 |
command = "desktop-launch"; |
170 |
expects_uris = true; |
171 |
#else |
172 |
GnomeFu.VFSMimeApplication app; |
173 |
app = GnomeFu.GetDefaultAction (hit.MimeType); |
174 |
if (app.command != null) { |
175 |
command = app.command; |
176 |
expects_uris = (app.expects_uris != GnomeFu.VFSMimeApplicationArgumentType.Path); |
177 |
} |
178 |
#endif |
179 |
if (command == null) { |
180 |
LaunchError ("Can't open MimeType '{0}'", hit.MimeType); |
181 |
return; |
182 |
} |
183 |
|
184 |
if (args_fallback != null) |
185 |
argument = args_fallback; |
186 |
else |
187 |
argument = ""; |
188 |
|
189 |
if (expects_uris) { |
190 |
argument = String.Format ("{0} '{1}'", argument, hit.Uri); |
191 |
} else { |
192 |
argument = String.Format ("{0} {1}", argument, hit.PathQuoted); |
193 |
} |
194 |
|
195 |
// Sometimes the command is 'quoted' |
196 |
if (command.IndexOf ('\'') == 0 && command.LastIndexOf ('\'') == command.Length - 1) |
197 |
command = command.Trim ('\''); |
198 |
|
199 |
// This won't work if a program really has a space in |
200 |
// the filename, but I think other things would break |
201 |
// with that too, and in practice it doesn't seem to |
202 |
// happen. |
203 |
int idx = command.IndexOf (' '); |
204 |
if (idx != -1) { |
205 |
argument = String.Format ("{0} {1}", command.Substring (idx + 1), argument); |
206 |
command = command.Substring (0, idx); |
207 |
} |
208 |
|
209 |
Console.WriteLine ("Cmd: {0}", command); |
210 |
Console.WriteLine ("Arg: {0}", argument); |
211 |
|
212 |
Process p = new Process (); |
213 |
p.StartInfo.UseShellExecute = false; |
214 |
p.StartInfo.FileName = command; |
215 |
p.StartInfo.Arguments = argument; |
216 |
|
160 |
|
217 |
try { |
161 |
try { |
218 |
p.Start (); |
162 |
p.Start (); |
219 |
} catch (Exception e) { |
163 |
} catch (Exception e) { |
220 |
Console.WriteLine ("Error in OpenFromMime: " + e); |
164 |
Console.WriteLine ("Error in OpenFromMime: " + e); |
Lines 248-272
Link Here
|
248 |
return; |
192 |
return; |
249 |
} |
193 |
} |
250 |
|
194 |
|
251 |
Process p = new Process (); |
195 |
Process p = new Process (); |
252 |
p.StartInfo.UseShellExecute = false; |
196 |
p.StartInfo.UseShellExecute = false; |
253 |
p.StartInfo.FileName = "evolution"; |
197 |
p.StartInfo.FileName = "kmail"; |
254 |
p.StartInfo.Arguments = "\"mailto:"; |
198 |
p.StartInfo.Arguments = ""; |
255 |
|
199 |
|
256 |
if (email != null && email != "") |
200 |
if (email != null && email != "") |
257 |
p.StartInfo.Arguments += email; |
201 |
p.StartInfo.Arguments += email; |
258 |
|
202 |
|
259 |
if (attach != null && attach != "") |
203 |
if (attach != null && attach != "") |
260 |
p.StartInfo.Arguments += "?attach=" + attach; |
204 |
p.StartInfo.Arguments += " --attach \"" + attach + "\""; |
|
|
205 |
|
206 |
if (email != null && email != "") |
207 |
p.StartInfo.Arguments += " \"" + email + "\""; |
261 |
|
208 |
|
262 |
p.StartInfo.Arguments += "\""; |
209 |
p.StartInfo.Arguments += "\""; |
263 |
|
210 |
|
264 |
try { |
211 |
try { |
265 |
p.Start () ; |
212 |
p.Start () ; |
266 |
} catch (Exception e) { |
213 |
} catch (Exception e) { |
267 |
Console.WriteLine ("Error launching Evolution composer: " + e); |
214 |
Console.WriteLine ("Error launching Kmail composer: " + e); |
268 |
} |
215 |
} |
269 |
} |
216 |
} |
270 |
|
217 |
|
271 |
protected void SendIm (string protocol, |
218 |
protected void SendIm (string protocol, |
272 |
string screenname) |
219 |
string screenname) |