Annotation of /trunk/kdelibs/patches/kdelibs-3.5.6-xinerama-improvements.patch
Parent Directory | Revision Log
Revision 144 -
(hide annotations)
(download)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 21299 byte(s)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 21299 byte(s)
-import
1 | niro | 144 | diff -u -p -N -r kdelibs.sav/kdecore/kstartupinfo.cpp kdelibs/kdecore/kstartupinfo.cpp |
2 | --- kdelibs.sav/kdecore/kstartupinfo.cpp 2006-08-23 17:19:58.000000000 +0200 | ||
3 | +++ kdelibs/kdecore/kstartupinfo.cpp 2006-09-01 13:26:45.000000000 +0200 | ||
4 | @@ -1105,7 +1105,7 @@ unsigned long KStartupInfoId::timestamp( | ||
5 | struct KStartupInfoDataPrivate | ||
6 | { | ||
7 | KStartupInfoDataPrivate() : desktop( 0 ), wmclass( "" ), hostname( "" ), | ||
8 | - silent( KStartupInfoData::Unknown ), timestamp( -1U ), screen( -1 ) {}; | ||
9 | + silent( KStartupInfoData::Unknown ), timestamp( -1U ), screen( -1 ), xinerama( -1 ), launched_by( 0 ) {}; | ||
10 | QString bin; | ||
11 | QString name; | ||
12 | QString description; | ||
13 | @@ -1117,6 +1117,8 @@ struct KStartupInfoDataPrivate | ||
14 | KStartupInfoData::TriState silent; | ||
15 | unsigned long timestamp; | ||
16 | int screen; | ||
17 | + int xinerama; | ||
18 | + WId launched_by; | ||
19 | }; | ||
20 | |||
21 | QString KStartupInfoData::to_text() const | ||
22 | @@ -1147,6 +1149,10 @@ QString KStartupInfoData::to_text() cons | ||
23 | ret += QString::fromLatin1( " TIMESTAMP=%1" ).arg( d->timestamp ); | ||
24 | if( d->screen != -1 ) | ||
25 | ret += QString::fromLatin1( " SCREEN=%1" ).arg( d->screen ); | ||
26 | + if( d->xinerama != -1 ) | ||
27 | + ret += QString::fromLatin1( " XINERAMA=%1" ).arg( d->xinerama ); | ||
28 | + if( d->launched_by != 0 ) | ||
29 | + ret += QString::fromLatin1( " LAUNCHED_BY=%1" ).arg( d->launched_by ); | ||
30 | return ret; | ||
31 | } | ||
32 | |||
33 | @@ -1165,6 +1171,8 @@ KStartupInfoData::KStartupInfoData( cons | ||
34 | const QString silent_str = QString::fromLatin1( "SILENT=" ); | ||
35 | const QString timestamp_str = QString::fromLatin1( "TIMESTAMP=" ); | ||
36 | const QString screen_str = QString::fromLatin1( "SCREEN=" ); | ||
37 | + const QString xinerama_str = QString::fromLatin1( "XINERAMA=" ); | ||
38 | + const QString launched_by_str = QString::fromLatin1( "LAUNCHED_BY=" ); | ||
39 | for( QStringList::Iterator it = items.begin(); | ||
40 | it != items.end(); | ||
41 | ++it ) | ||
42 | @@ -1195,6 +1203,10 @@ KStartupInfoData::KStartupInfoData( cons | ||
43 | d->timestamp = get_unum( *it ); | ||
44 | else if( ( *it ).startsWith( screen_str )) | ||
45 | d->screen = get_num( *it ); | ||
46 | + else if( ( *it ).startsWith( xinerama_str )) | ||
47 | + d->xinerama = get_num( *it ); | ||
48 | + else if( ( *it ).startsWith( launched_by_str )) | ||
49 | + d->launched_by = get_num( *it ); | ||
50 | } | ||
51 | } | ||
52 | |||
53 | @@ -1238,6 +1250,10 @@ void KStartupInfoData::update( const KSt | ||
54 | d->timestamp = data_P.timestamp(); | ||
55 | if( data_P.screen() != -1 ) | ||
56 | d->screen = data_P.screen(); | ||
57 | + if( data_P.xinerama() != -1 && xinerama() != -1 ) // don't overwrite | ||
58 | + d->xinerama = data_P.xinerama(); | ||
59 | + if( data_P.launchedBy() != 0 && launchedBy() != 0 ) // don't overwrite | ||
60 | + d->launched_by = data_P.launchedBy(); | ||
61 | } | ||
62 | |||
63 | KStartupInfoData::KStartupInfoData() | ||
64 | @@ -1408,6 +1424,26 @@ int KStartupInfoData::screen() const | ||
65 | return d->screen; | ||
66 | } | ||
67 | |||
68 | +void KStartupInfoData::setXinerama( int xinerama ) | ||
69 | + { | ||
70 | + d->xinerama = xinerama; | ||
71 | + } | ||
72 | + | ||
73 | +int KStartupInfoData::xinerama() const | ||
74 | + { | ||
75 | + return d->xinerama; | ||
76 | + } | ||
77 | + | ||
78 | +void KStartupInfoData::setLaunchedBy( WId window ) | ||
79 | + { | ||
80 | + d->launched_by = window; | ||
81 | + } | ||
82 | + | ||
83 | +WId KStartupInfoData::launchedBy() const | ||
84 | + { | ||
85 | + return d->launched_by; | ||
86 | + } | ||
87 | + | ||
88 | static | ||
89 | long get_num( const QString& item_P ) | ||
90 | { | ||
91 | diff -u -p -N -r kdelibs.sav/kdecore/kstartupinfo.h kdelibs/kdecore/kstartupinfo.h | ||
92 | --- kdelibs.sav/kdecore/kstartupinfo.h 2005-05-04 13:02:22.000000000 +0200 | ||
93 | +++ kdelibs/kdecore/kstartupinfo.h 2006-09-01 13:26:45.000000000 +0200 | ||
94 | @@ -635,6 +635,30 @@ class KDECORE_EXPORT KStartupInfoData | ||
95 | * This is usually not necessary to set, as it's set by default to qt_xscreen(). | ||
96 | */ | ||
97 | void setScreen( int screen ); | ||
98 | + | ||
99 | + /** | ||
100 | + * The Xinerama screen for the startup notification, -1 if unknown. | ||
101 | + */ | ||
102 | + int xinerama() const; | ||
103 | + | ||
104 | + /** | ||
105 | + * Sets the Xinerama screen for the startup notification ( i.e. the screeen on which | ||
106 | + * the starting application should appear ). | ||
107 | + * @param xinerama the Xinerama screen for the startup notification | ||
108 | + */ | ||
109 | + void setXinerama( int xinerama ); | ||
110 | + | ||
111 | + /** | ||
112 | + * The toplevel window of the application that caused this startup notification, | ||
113 | + * 0 if unknown. | ||
114 | + */ | ||
115 | + WId launchedBy() const; | ||
116 | + | ||
117 | + /** | ||
118 | + * Sets the toplevel window of the application that caused this startup notification. | ||
119 | + * @param window window ID of the toplevel window that is responsible for this startup | ||
120 | + */ | ||
121 | + void setLaunchedBy( WId window ); | ||
122 | |||
123 | /** | ||
124 | * Updates the notification data from the given data. Some data, such as the desktop | ||
125 | diff -u -p -N -r kdelibs.sav/kdecore/netwm.cpp kdelibs/kdecore/netwm.cpp | ||
126 | --- kdelibs.sav/kdecore/netwm.cpp 2006-08-25 16:10:16.000000000 +0200 | ||
127 | +++ kdelibs/kdecore/netwm.cpp 2006-09-01 13:26:14.000000000 +0200 | ||
128 | @@ -138,6 +138,9 @@ static Atom net_wm_state_stays_on_top = | ||
129 | // used to determine whether application window is managed or not | ||
130 | static Atom xa_wm_state = 0; | ||
131 | |||
132 | +// ability flags | ||
133 | +static Atom net_wm_full_placement = 0; | ||
134 | + | ||
135 | static Bool netwm_atoms_created = False; | ||
136 | const unsigned long netwm_sendevent_mask = (SubstructureRedirectMask| | ||
137 | SubstructureNotifyMask); | ||
138 | @@ -229,7 +232,7 @@ static int wcmp(const void *a, const voi | ||
139 | } | ||
140 | |||
141 | |||
142 | -static const int netAtomCount = 77; | ||
143 | +static const int netAtomCount = 78; | ||
144 | static void create_atoms(Display *d) { | ||
145 | static const char * const names[netAtomCount] = | ||
146 | { | ||
147 | @@ -316,7 +319,9 @@ static void create_atoms(Display *d) { | ||
148 | "_KDE_NET_WM_TEMPORARY_RULES", | ||
149 | |||
150 | "WM_STATE", | ||
151 | - "WM_PROTOCOLS" | ||
152 | + "WM_PROTOCOLS", | ||
153 | + | ||
154 | + "_NET_WM_FULL_PLACEMENT" | ||
155 | }; | ||
156 | |||
157 | Atom atoms[netAtomCount], *atomsp[netAtomCount] = | ||
158 | @@ -404,7 +409,9 @@ static void create_atoms(Display *d) { | ||
159 | &kde_net_wm_temporary_rules, | ||
160 | |||
161 | &xa_wm_state, | ||
162 | - &wm_protocols | ||
163 | + &wm_protocols, | ||
164 | + | ||
165 | + &net_wm_full_placement | ||
166 | }; | ||
167 | |||
168 | assert( !netwm_atoms_created ); | ||
169 | @@ -1309,6 +1316,8 @@ void NETRootInfo::setSupported() { | ||
170 | |||
171 | if (p->properties[ PROTOCOLS2 ] & WM2KDETemporaryRules) | ||
172 | atoms[pnum++] = kde_net_wm_temporary_rules; | ||
173 | + if (p->properties[ PROTOCOLS2 ] & WM2FullPlacement) | ||
174 | + atoms[pnum++] = net_wm_full_placement; | ||
175 | |||
176 | XChangeProperty(p->display, p->root, net_supported, XA_ATOM, 32, | ||
177 | PropModeReplace, (unsigned char *) atoms, pnum); | ||
178 | @@ -1526,6 +1535,8 @@ void NETRootInfo::updateSupportedPropert | ||
179 | |||
180 | else if( atom == kde_net_wm_temporary_rules ) | ||
181 | p->properties[ PROTOCOLS2 ] |= WM2KDETemporaryRules; | ||
182 | + else if( atom == net_wm_full_placement ) | ||
183 | + p->properties[ PROTOCOLS2 ] |= WM2FullPlacement; | ||
184 | } | ||
185 | |||
186 | extern Time qt_x_user_time; | ||
187 | diff -u -p -N -r kdelibs.sav/kdecore/netwm_def.h kdelibs/kdecore/netwm_def.h | ||
188 | --- kdelibs.sav/kdecore/netwm_def.h 2006-08-01 17:35:25.000000000 +0200 | ||
189 | +++ kdelibs/kdecore/netwm_def.h 2006-09-01 13:26:14.000000000 +0200 | ||
190 | @@ -581,7 +581,8 @@ public: | ||
191 | WM2WindowClass = 1<<10, ///< @since 3.3 | ||
192 | WM2WindowRole = 1<<11, ///< @since 3.3 | ||
193 | WM2ClientMachine = 1<<12, ///< @since 3.3 | ||
194 | - WM2ShowingDesktop = 1<<13 ///< @since 3.5 | ||
195 | + WM2ShowingDesktop = 1<<13, ///< @since 3.5 | ||
196 | + WM2FullPlacement = 1<<14 | ||
197 | }; | ||
198 | |||
199 | /** | ||
200 | diff -u -p -N -r kdelibs.sav/kio/kio/krun.cpp kdelibs/kio/kio/krun.cpp | ||
201 | --- kdelibs.sav/kio/kio/krun.cpp 2006-08-23 17:19:56.000000000 +0200 | ||
202 | +++ kdelibs/kio/kio/krun.cpp 2006-09-01 13:26:54.000000000 +0200 | ||
203 | @@ -77,6 +77,7 @@ public: | ||
204 | QString m_localPath; | ||
205 | QString m_suggestedFileName; | ||
206 | QGuardedPtr <QWidget> m_window; | ||
207 | + QCString m_asn; | ||
208 | }; | ||
209 | |||
210 | pid_t KRun::runURL( const KURL& u, const QString& _mimetype ) | ||
211 | @@ -109,14 +110,20 @@ bool KRun::isExecutableFile( const KURL& | ||
212 | return false; | ||
213 | } | ||
214 | |||
215 | -// This is called by foundMimeType, since it knows the mimetype of the URL | ||
216 | pid_t KRun::runURL( const KURL& u, const QString& _mimetype, bool tempFile, bool runExecutables, const QString& suggestedFileName ) | ||
217 | { | ||
218 | + return runURL( u, _mimetype, NULL, "", tempFile, runExecutables, suggestedFileName ); | ||
219 | +} | ||
220 | + | ||
221 | +// This is called by foundMimeType, since it knows the mimetype of the URL | ||
222 | +pid_t KRun::runURL( const KURL& u, const QString& _mimetype, QWidget* window, const QCString& asn, | ||
223 | + bool tempFile, bool runExecutables, const QString& suggestedFileName ) | ||
224 | +{ | ||
225 | bool noRun = false; | ||
226 | bool noAuth = false; | ||
227 | if ( _mimetype == "inode/directory-locked" ) | ||
228 | { | ||
229 | - KMessageBoxWrapper::error( 0L, | ||
230 | + KMessageBoxWrapper::error( window, | ||
231 | i18n("<qt>Unable to enter <b>%1</b>.\nYou do not have access rights to this location.</qt>").arg(u.htmlURL()) ); | ||
232 | return 0; | ||
233 | } | ||
234 | @@ -133,7 +140,7 @@ pid_t KRun::runURL( const KURL& u, const | ||
235 | { | ||
236 | QString path = u.path(); | ||
237 | shellQuote( path ); | ||
238 | - return (KRun::runCommand(path)); // just execute the url as a command | ||
239 | + return (KRun::runCommand(path, QString::null, QString::null, window, asn)); // just execute the url as a command | ||
240 | // ## TODO implement deleting the file if tempFile==true | ||
241 | } | ||
242 | else | ||
243 | @@ -155,14 +162,14 @@ pid_t KRun::runURL( const KURL& u, const | ||
244 | |||
245 | if ( noRun ) | ||
246 | { | ||
247 | - KMessageBox::sorry( 0L, | ||
248 | + KMessageBox::sorry( window, | ||
249 | i18n("<qt>The file <b>%1</b> is an executable program. " | ||
250 | "For safety it will not be started.</qt>").arg(u.htmlURL())); | ||
251 | return 0; | ||
252 | } | ||
253 | if ( noAuth ) | ||
254 | { | ||
255 | - KMessageBoxWrapper::error( 0L, | ||
256 | + KMessageBoxWrapper::error( window, | ||
257 | i18n("<qt>You do not have permission to run <b>%1</b>.</qt>").arg(u.htmlURL()) ); | ||
258 | return 0; | ||
259 | } | ||
260 | @@ -182,7 +189,7 @@ pid_t KRun::runURL( const KURL& u, const | ||
261 | return displayOpenWithDialog( lst, tempFile, suggestedFileName ); | ||
262 | } | ||
263 | |||
264 | - return KRun::run( *offer, lst, 0 /*window*/, tempFile, suggestedFileName ); | ||
265 | + return KRun::run( *offer, lst, window, asn, tempFile, suggestedFileName ); | ||
266 | } | ||
267 | |||
268 | bool KRun::displayOpenWithDialog( const KURL::List& lst ) | ||
269 | @@ -536,13 +543,13 @@ QString KRun::binaryName( const QString | ||
270 | } | ||
271 | |||
272 | static pid_t runCommandInternal( KProcess* proc, const KService* service, const QString& binName, | ||
273 | - const QString &execName, const QString & iconName ) | ||
274 | + const QString &execName, const QString & iconName, QWidget* window, QCString asn ) | ||
275 | { | ||
276 | if (service && !service->desktopEntryPath().isEmpty() | ||
277 | && !KDesktopFile::isAuthorizedDesktopFile( service->desktopEntryPath() )) | ||
278 | { | ||
279 | kdWarning() << "No authorization to execute " << service->desktopEntryPath() << endl; | ||
280 | - KMessageBox::sorry(0, i18n("You are not authorized to execute this file.")); | ||
281 | + KMessageBox::sorry(window, i18n("You are not authorized to execute this file.")); | ||
282 | return 0; | ||
283 | } | ||
284 | QString bin = KRun::binaryName( binName, true ); | ||
285 | @@ -550,10 +557,10 @@ static pid_t runCommandInternal( KProces | ||
286 | bool silent; | ||
287 | QCString wmclass; | ||
288 | KStartupInfoId id; | ||
289 | - bool startup_notify = KRun::checkStartupNotify( binName, service, &silent, &wmclass ); | ||
290 | + bool startup_notify = ( asn != "0" && KRun::checkStartupNotify( binName, service, &silent, &wmclass )); | ||
291 | if( startup_notify ) | ||
292 | { | ||
293 | - id.initId(); | ||
294 | + id.initId( asn ); | ||
295 | id.setupStartupEnv(); | ||
296 | KStartupInfoData data; | ||
297 | data.setHostname(); | ||
298 | @@ -572,6 +579,8 @@ static pid_t runCommandInternal( KProces | ||
299 | if( silent ) | ||
300 | data.setSilent( KStartupInfoData::Yes ); | ||
301 | data.setDesktop( KWin::currentDesktop()); | ||
302 | + if( window ) | ||
303 | + data.setLaunchedBy( window->winId()); | ||
304 | KStartupInfo::sendStartup( id, data ); | ||
305 | } | ||
306 | pid_t pid = KProcessRunner::run( proc, binName, id ); | ||
307 | @@ -629,7 +638,8 @@ bool KRun::checkStartupNotify( const QSt | ||
308 | return true; | ||
309 | } | ||
310 | |||
311 | -static pid_t runTempService( const KService& _service, const KURL::List& _urls, bool tempFiles, const QString& suggestedFileName ) | ||
312 | +static pid_t runTempService( const KService& _service, const KURL::List& _urls, QWidget* window, | ||
313 | + const QCString& asn, bool tempFiles, const QString& suggestedFileName ) | ||
314 | { | ||
315 | if (!_urls.isEmpty()) { | ||
316 | kdDebug(7010) << "runTempService: first url " << _urls.first().url() << endl; | ||
317 | @@ -648,7 +658,7 @@ static pid_t runTempService( const KServ | ||
318 | { | ||
319 | KURL::List singleUrl; | ||
320 | singleUrl.append(*it); | ||
321 | - runTempService( _service, singleUrl, tempFiles, suggestedFileName ); | ||
322 | + runTempService( _service, singleUrl, window, "", tempFiles, suggestedFileName ); | ||
323 | } | ||
324 | KURL::List singleUrl; | ||
325 | singleUrl.append(_urls.first()); | ||
326 | @@ -667,7 +677,7 @@ static pid_t runTempService( const KServ | ||
327 | proc->setWorkingDirectory(_service.path()); | ||
328 | |||
329 | return runCommandInternal( proc, &_service, KRun::binaryName( _service.exec(), false ), | ||
330 | - _service.name(), _service.icon() ); | ||
331 | + _service.name(), _service.icon(), window, asn ); | ||
332 | } | ||
333 | |||
334 | // WARNING: don't call this from processDesktopExec, since klauncher uses that too... | ||
335 | @@ -728,11 +738,22 @@ pid_t KRun::run( const KService& _servic | ||
336 | |||
337 | pid_t KRun::run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles ) | ||
338 | { | ||
339 | - return run( _service, _urls, window, tempFiles, QString::null ); | ||
340 | + return run( _service, _urls, window, "", tempFiles, QString::null ); | ||
341 | +} | ||
342 | + | ||
343 | +pid_t KRun::run( const KService& _service, const KURL::List& _urls, QWidget* window, const QCString& asn, bool tempFiles ) | ||
344 | +{ | ||
345 | + return run( _service, _urls, window, asn, tempFiles, QString::null ); | ||
346 | } | ||
347 | |||
348 | pid_t KRun::run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles, const QString& suggestedFileName ) | ||
349 | { | ||
350 | + return run( _service, _urls, window, "", tempFiles, suggestedFileName ); | ||
351 | +} | ||
352 | + | ||
353 | +pid_t KRun::run( const KService& _service, const KURL::List& _urls, QWidget* window, const QCString& asn, | ||
354 | + bool tempFiles, const QString& suggestedFileName ) | ||
355 | +{ | ||
356 | if (!_service.desktopEntryPath().isEmpty() && | ||
357 | !KDesktopFile::isAuthorizedDesktopFile( _service.desktopEntryPath())) | ||
358 | { | ||
359 | @@ -753,7 +774,7 @@ pid_t KRun::run( const KService& _servic | ||
360 | |||
361 | if ( tempFiles || _service.desktopEntryPath().isEmpty() || !suggestedFileName.isEmpty() ) | ||
362 | { | ||
363 | - return runTempService(_service, _urls, tempFiles, suggestedFileName); | ||
364 | + return runTempService(_service, _urls, window, asn, tempFiles, suggestedFileName); | ||
365 | } | ||
366 | |||
367 | kdDebug(7010) << "KRun::run " << _service.desktopEntryPath() << endl; | ||
368 | @@ -767,9 +788,25 @@ pid_t KRun::run( const KService& _servic | ||
369 | |||
370 | QString error; | ||
371 | int pid = 0; | ||
372 | - | ||
373 | + | ||
374 | + QCString myasn = asn; | ||
375 | + // startServiceByDesktopPath() doesn't take QWidget*, add it to the startup info now | ||
376 | + if( window != NULL ) | ||
377 | + { | ||
378 | + if( myasn.isEmpty()) | ||
379 | + myasn = KStartupInfo::createNewStartupId(); | ||
380 | + if( myasn != "0" ) | ||
381 | + { | ||
382 | + KStartupInfoId id; | ||
383 | + id.initId( myasn ); | ||
384 | + KStartupInfoData data; | ||
385 | + data.setLaunchedBy( window->winId()); | ||
386 | + KStartupInfo::sendChange( id, data ); | ||
387 | + } | ||
388 | + } | ||
389 | + | ||
390 | int i = KApplication::startServiceByDesktopPath( | ||
391 | - _service.desktopEntryPath(), urls.toStringList(), &error, 0L, &pid | ||
392 | + _service.desktopEntryPath(), urls.toStringList(), &error, 0L, &pid, myasn | ||
393 | ); | ||
394 | |||
395 | if (i != 0) | ||
396 | @@ -794,33 +831,47 @@ pid_t KRun::run( const QString& _exec, c | ||
397 | |||
398 | pid_t KRun::runCommand( QString cmd ) | ||
399 | { | ||
400 | - return KRun::runCommand( cmd, QString::null, QString::null ); | ||
401 | + return KRun::runCommand( cmd, QString::null, QString::null, NULL, "" ); | ||
402 | } | ||
403 | |||
404 | pid_t KRun::runCommand( const QString& cmd, const QString &execName, const QString & iconName ) | ||
405 | { | ||
406 | + return KRun::runCommand( cmd, execName, iconName, NULL, "" ); | ||
407 | +} | ||
408 | + | ||
409 | +pid_t KRun::runCommand( const QString& cmd, const QString &execName, const QString & iconName, | ||
410 | + QWidget* window, const QCString& asn ) | ||
411 | +{ | ||
412 | kdDebug(7010) << "runCommand " << cmd << "," << execName << endl; | ||
413 | KProcess * proc = new KProcess; | ||
414 | proc->setUseShell(true); | ||
415 | *proc << cmd; | ||
416 | KService::Ptr service = KService::serviceByDesktopName( binaryName( execName, true ) ); | ||
417 | - return runCommandInternal( proc, service.data(), binaryName( execName, false ), execName, iconName ); | ||
418 | + return runCommandInternal( proc, service.data(), binaryName( execName, false ), execName, iconName, | ||
419 | + window, asn ); | ||
420 | } | ||
421 | |||
422 | KRun::KRun( const KURL& url, mode_t mode, bool isLocalFile, bool showProgressInfo ) | ||
423 | :m_timer(0,"KRun::timer") | ||
424 | { | ||
425 | - init (url, 0, mode, isLocalFile, showProgressInfo); | ||
426 | + init (url, 0, "", mode, isLocalFile, showProgressInfo); | ||
427 | } | ||
428 | |||
429 | KRun::KRun( const KURL& url, QWidget* window, mode_t mode, bool isLocalFile, | ||
430 | bool showProgressInfo ) | ||
431 | :m_timer(0,"KRun::timer") | ||
432 | { | ||
433 | - init (url, window, mode, isLocalFile, showProgressInfo); | ||
434 | + init (url, window, "", mode, isLocalFile, showProgressInfo); | ||
435 | +} | ||
436 | + | ||
437 | +KRun::KRun( const KURL& url, QWidget* window, const QCString& asn, mode_t mode, bool isLocalFile, | ||
438 | + bool showProgressInfo ) | ||
439 | + :m_timer(0,"KRun::timer") | ||
440 | +{ | ||
441 | + init (url, window, asn, mode, isLocalFile, showProgressInfo); | ||
442 | } | ||
443 | |||
444 | -void KRun::init ( const KURL& url, QWidget* window, mode_t mode, bool isLocalFile, | ||
445 | +void KRun::init ( const KURL& url, QWidget* window, const QCString& asn, mode_t mode, bool isLocalFile, | ||
446 | bool showProgressInfo ) | ||
447 | { | ||
448 | m_bFault = false; | ||
449 | @@ -836,6 +887,7 @@ void KRun::init ( const KURL& url, QWidg | ||
450 | d = new KRunPrivate; | ||
451 | d->m_runExecutables = true; | ||
452 | d->m_window = window; | ||
453 | + d->m_asn = asn; | ||
454 | setEnableExternalBrowser(true); | ||
455 | |||
456 | // Start the timer. This means we will return to the event | ||
457 | @@ -936,7 +988,7 @@ void KRun::init() | ||
458 | KService::Ptr service = KService::serviceByStorageId( exec ); | ||
459 | if (service) | ||
460 | { | ||
461 | - run( *service, urls ); | ||
462 | + run( *service, urls, d->m_window, d->m_asn ); | ||
463 | ok = true; | ||
464 | } | ||
465 | } | ||
466 | @@ -1229,7 +1281,7 @@ void KRun::foundMimeType( const QString& | ||
467 | { | ||
468 | KURL::List lst; | ||
469 | lst.append( m_strURL ); | ||
470 | - m_bFinished = KRun::run( *serv, lst ); | ||
471 | + m_bFinished = KRun::run( *serv, lst, d->m_window, d->m_asn ); | ||
472 | /// Note: the line above means that if that service failed, we'll | ||
473 | /// go to runURL to maybe find another service, even though a dialog | ||
474 | /// box was displayed. That's good if runURL tries another service, | ||
475 | @@ -1244,7 +1296,7 @@ void KRun::foundMimeType( const QString& | ||
476 | m_strURL.setPath( d->m_localPath ); | ||
477 | } | ||
478 | |||
479 | - if (!m_bFinished && KRun::runURL( m_strURL, type, false, d->m_runExecutables, d->m_suggestedFileName )){ | ||
480 | + if (!m_bFinished && KRun::runURL( m_strURL, type, d->m_window, d->m_asn, false, d->m_runExecutables, d->m_suggestedFileName )){ | ||
481 | m_bFinished = true; | ||
482 | } | ||
483 | else{ | ||
484 | diff -u -p -N -r kdelibs.sav/kio/kio/krun.h kdelibs/kio/kio/krun.h | ||
485 | --- kdelibs.sav/kio/kio/krun.h 2006-05-24 18:34:50.000000000 +0200 | ||
486 | +++ kdelibs/kio/kio/krun.h 2006-09-01 13:26:54.000000000 +0200 | ||
487 | @@ -111,6 +111,8 @@ public: | ||
488 | */ | ||
489 | KRun( const KURL& url, QWidget* window, mode_t mode = 0, | ||
490 | bool isLocalFile = false, bool showProgressInfo = true ); | ||
491 | + KRun( const KURL& url, QWidget* window, const QCString& asn, mode_t mode = 0, | ||
492 | + bool isLocalFile = false, bool showProgressInfo = true ); | ||
493 | |||
494 | /** | ||
495 | * Destructor. Don't call it yourself, since a KRun object auto-deletes | ||
496 | @@ -210,6 +212,8 @@ public: | ||
497 | * @since 3.5.2 | ||
498 | */ | ||
499 | static pid_t run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles = false ); | ||
500 | + static pid_t run( const KService& _service, const KURL::List& _urls, QWidget* window, | ||
501 | + const QCString& asn, bool tempFiles = false ); | ||
502 | /** | ||
503 | * Open a list of URLs with a certain service (application). | ||
504 | * | ||
505 | @@ -226,6 +230,8 @@ public: | ||
506 | /// @since 3.5.3 | ||
507 | /// @internal | ||
508 | static pid_t run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles, const QString& suggestedFileName ); | ||
509 | + static pid_t run( const KService& _service, const KURL::List& _urls, QWidget* window, | ||
510 | + const QCString& asn, bool tempFiles, const QString& suggestedFileName ); | ||
511 | |||
512 | /** | ||
513 | * Open a list of URLs with. | ||
514 | @@ -269,6 +275,7 @@ public: | ||
515 | static pid_t runURL( const KURL& _url, const QString& _mimetype ); | ||
516 | /// @since 3.5.3 | ||
517 | /// @internal | ||
518 | + static pid_t runURL( const KURL& _url, const QString& _mimetype, QWidget* window, const QCString& asn, bool tempFile, bool runExecutables, const QString& suggestedFileName ); | ||
519 | static pid_t runURL( const KURL& _url, const QString& _mimetype, bool tempFile, bool runExecutables, const QString& suggestedFileName ); | ||
520 | |||
521 | /** | ||
522 | @@ -299,6 +306,8 @@ public: | ||
523 | * of running command) if command was unsafe for map notification. | ||
524 | */ | ||
525 | static pid_t runCommand( const QString& cmd, const QString & execName, const QString & icon ); | ||
526 | + static pid_t runCommand( const QString& cmd, const QString & execName, const QString & icon, | ||
527 | + QWidget* window, const QCString& asn ); | ||
528 | |||
529 | /** | ||
530 | * Display the Open-With dialog for those URLs, and run the chosen application. | ||
531 | @@ -438,7 +447,7 @@ protected: | ||
532 | virtual void virtual_hook( int id, void* data ); | ||
533 | |||
534 | private: | ||
535 | - void init (const KURL& url, QWidget* window, mode_t mode, | ||
536 | + void init (const KURL& url, QWidget* window, const QCString& asn, mode_t mode, | ||
537 | bool isLocalFile, bool showProgressInfo); | ||
538 | private: | ||
539 | class KRunPrivate; |