Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 211469 | Differences between
and this patch

Collapse All | Expand All

(-)kdelibs.sav/kdecore/kstartupinfo.cpp (-1 / +37 lines)
Lines 1105-1111 unsigned long KStartupInfoId::timestamp( Link Here
1105
struct KStartupInfoDataPrivate
1105
struct KStartupInfoDataPrivate
1106
    {
1106
    {
1107
    KStartupInfoDataPrivate() : desktop( 0 ), wmclass( "" ), hostname( "" ),
1107
    KStartupInfoDataPrivate() : desktop( 0 ), wmclass( "" ), hostname( "" ),
1108
	silent( KStartupInfoData::Unknown ), timestamp( -1U ), screen( -1 ) {}
1108
	silent( KStartupInfoData::Unknown ), timestamp( -1U ), screen( -1 ), xinerama( -1 ), launched_by( 0 ) {};
1109
    QString bin;
1109
    QString bin;
1110
    QString name;
1110
    QString name;
1111
    QString description;
1111
    QString description;
Lines 1117-1122 struct KStartupInfoDataPrivate Link Here
1117
    KStartupInfoData::TriState silent;
1117
    KStartupInfoData::TriState silent;
1118
    unsigned long timestamp;
1118
    unsigned long timestamp;
1119
    int screen;
1119
    int screen;
1120
    int xinerama;
1121
    WId launched_by;
1120
    };
1122
    };
1121
1123
1122
QString KStartupInfoData::to_text() const
1124
QString KStartupInfoData::to_text() const
Lines 1147-1152 QString KStartupInfoData::to_text() cons Link Here
1147
        ret += QString::fromLatin1( " TIMESTAMP=%1" ).arg( d->timestamp );
1149
        ret += QString::fromLatin1( " TIMESTAMP=%1" ).arg( d->timestamp );
1148
    if( d->screen != -1 )
1150
    if( d->screen != -1 )
1149
        ret += QString::fromLatin1( " SCREEN=%1" ).arg( d->screen );
1151
        ret += QString::fromLatin1( " SCREEN=%1" ).arg( d->screen );
1152
    if( d->xinerama != -1 )
1153
        ret += QString::fromLatin1( " XINERAMA=%1" ).arg( d->xinerama );
1154
    if( d->launched_by != 0 )
1155
        ret += QString::fromLatin1( " LAUNCHED_BY=%1" ).arg( d->launched_by );
1150
    return ret;
1156
    return ret;
1151
    }
1157
    }
1152
1158
Lines 1165-1170 KStartupInfoData::KStartupInfoData( cons Link Here
1165
    const QString silent_str = QString::fromLatin1( "SILENT=" );
1171
    const QString silent_str = QString::fromLatin1( "SILENT=" );
1166
    const QString timestamp_str = QString::fromLatin1( "TIMESTAMP=" );
1172
    const QString timestamp_str = QString::fromLatin1( "TIMESTAMP=" );
1167
    const QString screen_str = QString::fromLatin1( "SCREEN=" );
1173
    const QString screen_str = QString::fromLatin1( "SCREEN=" );
1174
    const QString xinerama_str = QString::fromLatin1( "XINERAMA=" );
1175
    const QString launched_by_str = QString::fromLatin1( "LAUNCHED_BY=" );
1168
    for( QStringList::Iterator it = items.begin();
1176
    for( QStringList::Iterator it = items.begin();
1169
         it != items.end();
1177
         it != items.end();
1170
         ++it )
1178
         ++it )
Lines 1195-1200 KStartupInfoData::KStartupInfoData( cons Link Here
1195
            d->timestamp = get_unum( *it );
1203
            d->timestamp = get_unum( *it );
1196
        else if( ( *it ).startsWith( screen_str ))
1204
        else if( ( *it ).startsWith( screen_str ))
1197
            d->screen = get_num( *it );
1205
            d->screen = get_num( *it );
1206
        else if( ( *it ).startsWith( xinerama_str ))
1207
            d->xinerama = get_num( *it );
1208
        else if( ( *it ).startsWith( launched_by_str ))
1209
            d->launched_by = get_num( *it );
1198
        }
1210
        }
1199
    }
1211
    }
1200
1212
Lines 1238-1243 void KStartupInfoData::update( const KSt Link Here
1238
        d->timestamp = data_P.timestamp();
1250
        d->timestamp = data_P.timestamp();
1239
    if( data_P.screen() != -1 )
1251
    if( data_P.screen() != -1 )
1240
        d->screen = data_P.screen();
1252
        d->screen = data_P.screen();
1253
    if( data_P.xinerama() != -1 && xinerama() != -1 ) // don't overwrite
1254
        d->xinerama = data_P.xinerama();
1255
    if( data_P.launchedBy() != 0 && launchedBy() != 0 ) // don't overwrite
1256
        d->launched_by = data_P.launchedBy();
1241
    }
1257
    }
1242
1258
1243
KStartupInfoData::KStartupInfoData()
1259
KStartupInfoData::KStartupInfoData()
Lines 1408-1413 int KStartupInfoData::screen() const Link Here
1408
    return d->screen;
1424
    return d->screen;
1409
    }
1425
    }
1410
1426
1427
void KStartupInfoData::setXinerama( int xinerama )
1428
    {
1429
    d->xinerama = xinerama;
1430
    }
1431
1432
int KStartupInfoData::xinerama() const
1433
    {
1434
    return d->xinerama;
1435
    }
1436
1437
void KStartupInfoData::setLaunchedBy( WId window )
1438
    {
1439
    d->launched_by = window;
1440
    }
1441
1442
WId KStartupInfoData::launchedBy() const
1443
    {
1444
    return d->launched_by;
1445
    }
1446
1411
static
1447
static
1412
long get_num( const QString& item_P )
1448
long get_num( const QString& item_P )
1413
    {
1449
    {
(-)kdelibs.sav/kdecore/kstartupinfo.h (+24 lines)
Lines 635-640 class KDECORE_EXPORT KStartupInfoData Link Here
635
         * This is usually not necessary to set, as it's set by default to qt_xscreen().
635
         * This is usually not necessary to set, as it's set by default to qt_xscreen().
636
         */
636
         */
637
        void setScreen( int screen );
637
        void setScreen( int screen );
638
        
639
        /**
640
         * The Xinerama screen for the startup notification, -1 if unknown.
641
         */
642
        int xinerama() const;
643
644
        /**        
645
	 * Sets the Xinerama screen for the startup notification ( i.e. the screeen on which
646
	 * the starting application should appear ).
647
	 * @param xinerama the Xinerama screen for the startup notification
648
         */
649
        void setXinerama( int xinerama );
650
651
        /**
652
         * The toplevel window of the application that caused this startup notification,
653
         * 0 if unknown.
654
         */
655
        WId launchedBy() const;
656
        
657
        /**
658
	 * Sets the toplevel window of the application that caused this startup notification.
659
	 * @param window window ID of the toplevel window that is responsible for this startup
660
         */
661
        void setLaunchedBy( WId window );
638
662
639
	/**
663
	/**
640
	 * Updates the notification data from the given data. Some data, such as the desktop
664
	 * Updates the notification data from the given data. Some data, such as the desktop
(-)kdelibs.sav/kdecore/netwm.cpp (-3 / +14 lines)
Lines 138-143 static Atom net_wm_state_stays_on_top = Link Here
138
// used to determine whether application window is managed or not
138
// used to determine whether application window is managed or not
139
static Atom xa_wm_state = 0;
139
static Atom xa_wm_state = 0;
140
140
141
// ability flags
142
static Atom net_wm_full_placement = 0;
143
141
static Bool netwm_atoms_created      = False;
144
static Bool netwm_atoms_created      = False;
142
const unsigned long netwm_sendevent_mask = (SubstructureRedirectMask|
145
const unsigned long netwm_sendevent_mask = (SubstructureRedirectMask|
143
					     SubstructureNotifyMask);
146
					     SubstructureNotifyMask);
Lines 229-235 static int wcmp(const void *a, const voi Link Here
229
}
232
}
230
233
231
234
232
static const int netAtomCount = 84;
235
static const int netAtomCount = 85;
233
static void create_atoms(Display *d) {
236
static void create_atoms(Display *d) {
234
    static const char * const names[netAtomCount] =
237
    static const char * const names[netAtomCount] =
235
    {
238
    {
Lines 316-322 static void create_atoms(Display *d) { Link Here
316
            "_KDE_NET_WM_TEMPORARY_RULES",
319
            "_KDE_NET_WM_TEMPORARY_RULES",
317
320
318
	    "WM_STATE",
321
	    "WM_STATE",
319
	    "WM_PROTOCOLS"
322
	    "WM_PROTOCOLS",
323
            
324
            "_NET_WM_FULL_PLACEMENT"
320
	    };
325
	    };
321
326
322
    Atom atoms[netAtomCount], *atomsp[netAtomCount] =
327
    Atom atoms[netAtomCount], *atomsp[netAtomCount] =
Lines 404-410 static void create_atoms(Display *d) { Link Here
404
            &kde_net_wm_temporary_rules,
409
            &kde_net_wm_temporary_rules,
405
410
406
	    &xa_wm_state,
411
	    &xa_wm_state,
407
	    &wm_protocols
412
	    &wm_protocols,
413
            
414
            &net_wm_full_placement
408
	    };
415
	    };
409
416
410
    assert( !netwm_atoms_created );
417
    assert( !netwm_atoms_created );
Lines 1309-1314 void NETRootInfo::setSupported() { Link Here
1309
1316
1310
    if (p->properties[ PROTOCOLS2 ] & WM2KDETemporaryRules)
1317
    if (p->properties[ PROTOCOLS2 ] & WM2KDETemporaryRules)
1311
	atoms[pnum++] = kde_net_wm_temporary_rules;
1318
	atoms[pnum++] = kde_net_wm_temporary_rules;
1319
    if (p->properties[ PROTOCOLS2 ] & WM2FullPlacement)
1320
	atoms[pnum++] = net_wm_full_placement;
1312
1321
1313
    XChangeProperty(p->display, p->root, net_supported, XA_ATOM, 32,
1322
    XChangeProperty(p->display, p->root, net_supported, XA_ATOM, 32,
1314
		    PropModeReplace, (unsigned char *) atoms, pnum);
1323
		    PropModeReplace, (unsigned char *) atoms, pnum);
Lines 1526-1531 void NETRootInfo::updateSupportedPropert Link Here
1526
1535
1527
    else if( atom == kde_net_wm_temporary_rules )
1536
    else if( atom == kde_net_wm_temporary_rules )
1528
        p->properties[ PROTOCOLS2 ] |= WM2KDETemporaryRules;
1537
        p->properties[ PROTOCOLS2 ] |= WM2KDETemporaryRules;
1538
    else if( atom == net_wm_full_placement )
1539
        p->properties[ PROTOCOLS2 ] |= WM2FullPlacement;
1529
}
1540
}
1530
1541
1531
extern Time qt_x_user_time;
1542
extern Time qt_x_user_time;
(-)kdelibs.sav/kdecore/netwm_def.h (+1 lines)
Lines 581-586 public: Link Here
581
        WM2WindowRole          = 1<<11, ///< @since 3.3
581
        WM2WindowRole          = 1<<11, ///< @since 3.3
582
        WM2ClientMachine       = 1<<12, ///< @since 3.3
582
        WM2ClientMachine       = 1<<12, ///< @since 3.3
583
        WM2ShowingDesktop      = 1<<13, ///< @since 3.5
583
        WM2ShowingDesktop      = 1<<13, ///< @since 3.5
584
         WM2FullPlacement       = 1<<14,
584
        WM2DesktopLayout       = 1<<15  ///< @since 3.5.8
585
        WM2DesktopLayout       = 1<<15  ///< @since 3.5.8
585
    };
586
    };
586
587
(-)kdelibs.sav/kio/kio/krun.cpp (-25 / +77 lines)
Lines 77-82 public: Link Here
77
    QString m_localPath;
77
    QString m_localPath;
78
    QString m_suggestedFileName;
78
    QString m_suggestedFileName;
79
    QGuardedPtr <QWidget> m_window;
79
    QGuardedPtr <QWidget> m_window;
80
    QCString m_asn;
80
};
81
};
81
82
82
pid_t KRun::runURL( const KURL& u, const QString& _mimetype )
83
pid_t KRun::runURL( const KURL& u, const QString& _mimetype )
Lines 109-122 bool KRun::isExecutableFile( const KURL& Link Here
109
  return false;
110
  return false;
110
}
111
}
111
112
112
// This is called by foundMimeType, since it knows the mimetype of the URL
113
pid_t KRun::runURL( const KURL& u, const QString& _mimetype, bool tempFile, bool runExecutables, const QString& suggestedFileName )
113
pid_t KRun::runURL( const KURL& u, const QString& _mimetype, bool tempFile, bool runExecutables, const QString& suggestedFileName )
114
{
114
{
115
    return runURL( u, _mimetype, NULL, "", tempFile, runExecutables, suggestedFileName );
116
}
117
118
// This is called by foundMimeType, since it knows the mimetype of the URL
119
pid_t KRun::runURL( const KURL& u, const QString& _mimetype, QWidget* window, const QCString& asn,
120
    bool tempFile, bool runExecutables, const QString& suggestedFileName )
121
{
115
  bool noRun = false;
122
  bool noRun = false;
116
  bool noAuth = false;
123
  bool noAuth = false;
117
  if ( _mimetype == "inode/directory-locked" )
124
  if ( _mimetype == "inode/directory-locked" )
118
  {
125
  {
119
    KMessageBoxWrapper::error( 0L,
126
    KMessageBoxWrapper::error( window,
120
            i18n("<qt>Unable to enter <b>%1</b>.\nYou do not have access rights to this location.</qt>").arg(u.htmlURL()) );
127
            i18n("<qt>Unable to enter <b>%1</b>.\nYou do not have access rights to this location.</qt>").arg(u.htmlURL()) );
121
    return 0;
128
    return 0;
122
  }
129
  }
Lines 133-139 pid_t KRun::runURL( const KURL& u, const Link Here
133
      {
140
      {
134
        QString path = u.path();
141
        QString path = u.path();
135
        shellQuote( path );
142
        shellQuote( path );
136
        return (KRun::runCommand(path)); // just execute the url as a command
143
        return (KRun::runCommand(path, QString::null, QString::null, window, asn)); // just execute the url as a command
137
        // ## TODO implement deleting the file if tempFile==true
144
        // ## TODO implement deleting the file if tempFile==true
138
      }
145
      }
139
      else
146
      else
Lines 155-168 pid_t KRun::runURL( const KURL& u, const Link Here
155
162
156
  if ( noRun )
163
  if ( noRun )
157
  {
164
  {
158
    KMessageBox::sorry( 0L,
165
    KMessageBox::sorry( window,
159
        i18n("<qt>The file <b>%1</b> is an executable program. "
166
        i18n("<qt>The file <b>%1</b> is an executable program. "
160
             "For safety it will not be started.</qt>").arg(u.htmlURL()));
167
             "For safety it will not be started.</qt>").arg(u.htmlURL()));
161
    return 0;
168
    return 0;
162
  }
169
  }
163
  if ( noAuth )
170
  if ( noAuth )
164
  {
171
  {
165
    KMessageBoxWrapper::error( 0L,
172
    KMessageBoxWrapper::error( window,
166
        i18n("<qt>You do not have permission to run <b>%1</b>.</qt>").arg(u.htmlURL()) );
173
        i18n("<qt>You do not have permission to run <b>%1</b>.</qt>").arg(u.htmlURL()) );
167
    return 0;
174
    return 0;
168
  }
175
  }
Lines 182-188 pid_t KRun::runURL( const KURL& u, const Link Here
182
    return displayOpenWithDialog( lst, tempFile, suggestedFileName );
189
    return displayOpenWithDialog( lst, tempFile, suggestedFileName );
183
  }
190
  }
184
191
185
  return KRun::run( *offer, lst, 0 /*window*/, tempFile, suggestedFileName );
192
  return KRun::run( *offer, lst, window, asn, tempFile, suggestedFileName );
186
}
193
}
187
194
188
bool KRun::displayOpenWithDialog( const KURL::List& lst )
195
bool KRun::displayOpenWithDialog( const KURL::List& lst )
Lines 536-548 QString KRun::binaryName( const QString Link Here
536
}
543
}
537
544
538
static pid_t runCommandInternal( KProcess* proc, const KService* service, const QString& binName,
545
static pid_t runCommandInternal( KProcess* proc, const KService* service, const QString& binName,
539
    const QString &execName, const QString & iconName )
546
    const QString &execName, const QString & iconName, QWidget* window, QCString asn )
540
{
547
{
541
  if (service && !service->desktopEntryPath().isEmpty()
548
  if (service && !service->desktopEntryPath().isEmpty()
542
      && !KDesktopFile::isAuthorizedDesktopFile( service->desktopEntryPath() ))
549
      && !KDesktopFile::isAuthorizedDesktopFile( service->desktopEntryPath() ))
543
  {
550
  {
544
     kdWarning() << "No authorization to execute " << service->desktopEntryPath() << endl;
551
     kdWarning() << "No authorization to execute " << service->desktopEntryPath() << endl;
545
     KMessageBox::sorry(0, i18n("You are not authorized to execute this file."));
552
     KMessageBox::sorry(window, i18n("You are not authorized to execute this file."));
546
     return 0;
553
     return 0;
547
  }
554
  }
548
  QString bin = KRun::binaryName( binName, true );
555
  QString bin = KRun::binaryName( binName, true );
Lines 550-559 static pid_t runCommandInternal( KProces Link Here
550
  bool silent;
557
  bool silent;
551
  QCString wmclass;
558
  QCString wmclass;
552
  KStartupInfoId id;
559
  KStartupInfoId id;
553
  bool startup_notify = KRun::checkStartupNotify( binName, service, &silent, &wmclass );
560
  bool startup_notify = ( asn != "0" && KRun::checkStartupNotify( binName, service, &silent, &wmclass ));
554
  if( startup_notify )
561
  if( startup_notify )
555
  {
562
  {
556
      id.initId();
563
      id.initId( asn );
557
      id.setupStartupEnv();
564
      id.setupStartupEnv();
558
      KStartupInfoData data;
565
      KStartupInfoData data;
559
      data.setHostname();
566
      data.setHostname();
Lines 572-577 static pid_t runCommandInternal( KProces Link Here
572
      if( silent )
579
      if( silent )
573
          data.setSilent( KStartupInfoData::Yes );
580
          data.setSilent( KStartupInfoData::Yes );
574
      data.setDesktop( KWin::currentDesktop());
581
      data.setDesktop( KWin::currentDesktop());
582
      if( window )
583
          data.setLaunchedBy( window->winId());
575
      KStartupInfo::sendStartup( id, data );
584
      KStartupInfo::sendStartup( id, data );
576
  }
585
  }
577
  pid_t pid = KProcessRunner::run( proc, binName, id );
586
  pid_t pid = KProcessRunner::run( proc, binName, id );
Lines 629-635 bool KRun::checkStartupNotify( const QSt Link Here
629
  return true;
638
  return true;
630
}
639
}
631
640
632
static pid_t runTempService( const KService& _service, const KURL::List& _urls, bool tempFiles, const QString& suggestedFileName )
641
static pid_t runTempService( const KService& _service, const KURL::List& _urls, QWidget* window,
642
    const QCString& asn, bool tempFiles, const QString& suggestedFileName )
633
{
643
{
634
  if (!_urls.isEmpty()) {
644
  if (!_urls.isEmpty()) {
635
    kdDebug(7010) << "runTempService: first url " << _urls.first().url() << endl;
645
    kdDebug(7010) << "runTempService: first url " << _urls.first().url() << endl;
Lines 648-654 static pid_t runTempService( const KServ Link Here
648
      {
658
      {
649
         KURL::List singleUrl;
659
         KURL::List singleUrl;
650
         singleUrl.append(*it);
660
         singleUrl.append(*it);
651
         runTempService( _service, singleUrl, tempFiles, suggestedFileName );
661
         runTempService( _service, singleUrl, window, "", tempFiles, suggestedFileName );
652
      }
662
      }
653
      KURL::List singleUrl;
663
      KURL::List singleUrl;
654
      singleUrl.append(_urls.first());
664
      singleUrl.append(_urls.first());
Lines 667-673 static pid_t runTempService( const KServ Link Here
667
     proc->setWorkingDirectory(_service.path());
677
     proc->setWorkingDirectory(_service.path());
668
678
669
  return runCommandInternal( proc, &_service, KRun::binaryName( _service.exec(), false ),
679
  return runCommandInternal( proc, &_service, KRun::binaryName( _service.exec(), false ),
670
                             _service.name(), _service.icon() );
680
                             _service.name(), _service.icon(), window, asn );
671
}
681
}
672
682
673
// WARNING: don't call this from processDesktopExec, since klauncher uses that too...
683
// WARNING: don't call this from processDesktopExec, since klauncher uses that too...
Lines 728-738 pid_t KRun::run( const KService& _servic Link Here
728
738
729
pid_t KRun::run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles )
739
pid_t KRun::run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles )
730
{
740
{
731
    return run( _service, _urls, window, tempFiles, QString::null );
741
    return run( _service, _urls, window, "", tempFiles, QString::null );
742
}
743
744
pid_t KRun::run( const KService& _service, const KURL::List& _urls, QWidget* window, const QCString& asn, bool tempFiles )
745
{
746
    return run( _service, _urls, window, asn, tempFiles, QString::null );
732
}
747
}
733
748
734
pid_t KRun::run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles, const QString& suggestedFileName )
749
pid_t KRun::run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles, const QString& suggestedFileName )
735
{
750
{
751
    return run( _service, _urls, window, "", tempFiles, suggestedFileName );
752
}
753
754
pid_t KRun::run( const KService& _service, const KURL::List& _urls, QWidget* window, const QCString& asn,
755
    bool tempFiles, const QString& suggestedFileName )
756
{
736
  if (!_service.desktopEntryPath().isEmpty() &&
757
  if (!_service.desktopEntryPath().isEmpty() &&
737
      !KDesktopFile::isAuthorizedDesktopFile( _service.desktopEntryPath()))
758
      !KDesktopFile::isAuthorizedDesktopFile( _service.desktopEntryPath()))
738
  {
759
  {
Lines 753-759 pid_t KRun::run( const KService& _servic Link Here
753
774
754
  if ( tempFiles || _service.desktopEntryPath().isEmpty() || !suggestedFileName.isEmpty() )
775
  if ( tempFiles || _service.desktopEntryPath().isEmpty() || !suggestedFileName.isEmpty() )
755
  {
776
  {
756
     return runTempService(_service, _urls, tempFiles, suggestedFileName);
777
     return runTempService(_service, _urls, window, asn, tempFiles, suggestedFileName);
757
  }
778
  }
758
779
759
  kdDebug(7010) << "KRun::run " << _service.desktopEntryPath() << endl;
780
  kdDebug(7010) << "KRun::run " << _service.desktopEntryPath() << endl;
Lines 767-775 pid_t KRun::run( const KService& _servic Link Here
767
788
768
  QString error;
789
  QString error;
769
  int pid = 0;
790
  int pid = 0;
770
791
  
792
  QCString myasn = asn;
793
  // startServiceByDesktopPath() doesn't take QWidget*, add it to the startup info now
794
  if( window != NULL )
795
  {
796
    if( myasn.isEmpty())
797
        myasn = KStartupInfo::createNewStartupId();
798
    if( myasn != "0" )
799
    {
800
        KStartupInfoId id;
801
        id.initId( myasn );
802
        KStartupInfoData data;
803
        data.setLaunchedBy( window->winId());
804
        KStartupInfo::sendChange( id, data );
805
    }
806
  }
807
  
771
  int i = KApplication::startServiceByDesktopPath(
808
  int i = KApplication::startServiceByDesktopPath(
772
        _service.desktopEntryPath(), urls.toStringList(), &error, 0L, &pid
809
        _service.desktopEntryPath(), urls.toStringList(), &error, 0L, &pid, myasn
773
        );
810
        );
774
811
775
  if (i != 0)
812
  if (i != 0)
Lines 794-826 pid_t KRun::run( const QString& _exec, c Link Here
794
831
795
pid_t KRun::runCommand( QString cmd )
832
pid_t KRun::runCommand( QString cmd )
796
{
833
{
797
  return KRun::runCommand( cmd, QString::null, QString::null );
834
  return KRun::runCommand( cmd, QString::null, QString::null, NULL, "" );
798
}
835
}
799
836
800
pid_t KRun::runCommand( const QString& cmd, const QString &execName, const QString & iconName )
837
pid_t KRun::runCommand( const QString& cmd, const QString &execName, const QString & iconName )
801
{
838
{
839
  return KRun::runCommand( cmd, execName, iconName, NULL, "" );
840
}
841
842
pid_t KRun::runCommand( const QString& cmd, const QString &execName, const QString & iconName,
843
    QWidget* window, const QCString& asn )
844
{
802
  kdDebug(7010) << "runCommand " << cmd << "," << execName << endl;
845
  kdDebug(7010) << "runCommand " << cmd << "," << execName << endl;
803
  KProcess * proc = new KProcess;
846
  KProcess * proc = new KProcess;
804
  proc->setUseShell(true);
847
  proc->setUseShell(true);
805
  *proc << cmd;
848
  *proc << cmd;
806
  KService::Ptr service = KService::serviceByDesktopName( binaryName( execName, true ) );
849
  KService::Ptr service = KService::serviceByDesktopName( binaryName( execName, true ) );
807
  return runCommandInternal( proc, service.data(), binaryName( execName, false ), execName, iconName );
850
  return runCommandInternal( proc, service.data(), binaryName( execName, false ), execName, iconName,
851
      window, asn );
808
}
852
}
809
853
810
KRun::KRun( const KURL& url, mode_t mode, bool isLocalFile, bool showProgressInfo )
854
KRun::KRun( const KURL& url, mode_t mode, bool isLocalFile, bool showProgressInfo )
811
     :m_timer(0,"KRun::timer")
855
     :m_timer(0,"KRun::timer")
812
{
856
{
813
  init (url, 0, mode, isLocalFile, showProgressInfo);
857
  init (url, 0, "", mode, isLocalFile, showProgressInfo);
814
}
858
}
815
859
816
KRun::KRun( const KURL& url, QWidget* window, mode_t mode, bool isLocalFile,
860
KRun::KRun( const KURL& url, QWidget* window, mode_t mode, bool isLocalFile,
817
            bool showProgressInfo )
861
            bool showProgressInfo )
818
     :m_timer(0,"KRun::timer")
862
     :m_timer(0,"KRun::timer")
819
{
863
{
820
  init (url, window, mode, isLocalFile, showProgressInfo);
864
  init (url, window, "", mode, isLocalFile, showProgressInfo);
865
}
866
867
KRun::KRun( const KURL& url, QWidget* window, const QCString& asn, mode_t mode, bool isLocalFile,
868
            bool showProgressInfo )
869
     :m_timer(0,"KRun::timer")
870
{
871
  init (url, window, asn, mode, isLocalFile, showProgressInfo);
821
}
872
}
822
873
823
void KRun::init ( const KURL& url, QWidget* window, mode_t mode, bool isLocalFile,
874
void KRun::init ( const KURL& url, QWidget* window, const QCString& asn, mode_t mode, bool isLocalFile,
824
                  bool showProgressInfo )
875
                  bool showProgressInfo )
825
{
876
{
826
  m_bFault = false;
877
  m_bFault = false;
Lines 836-841 void KRun::init ( const KURL& url, QWidg Link Here
836
  d = new KRunPrivate;
887
  d = new KRunPrivate;
837
  d->m_runExecutables = true;
888
  d->m_runExecutables = true;
838
  d->m_window = window;
889
  d->m_window = window;
890
  d->m_asn = asn;
839
  setEnableExternalBrowser(true);
891
  setEnableExternalBrowser(true);
840
892
841
  // Start the timer. This means we will return to the event
893
  // Start the timer. This means we will return to the event
Lines 936-942 void KRun::init() Link Here
936
       KService::Ptr service = KService::serviceByStorageId( exec );
988
       KService::Ptr service = KService::serviceByStorageId( exec );
937
       if (service)
989
       if (service)
938
       {
990
       {
939
          run( *service, urls );
991
          run( *service, urls, d->m_window, d->m_asn );
940
          ok = true;
992
          ok = true;
941
       }
993
       }
942
    }
994
    }
Lines 1229-1235 void KRun::foundMimeType( const QString& Link Here
1229
      {
1281
      {
1230
          KURL::List lst;
1282
          KURL::List lst;
1231
          lst.append( m_strURL );
1283
          lst.append( m_strURL );
1232
          m_bFinished = KRun::run( *serv, lst );
1284
          m_bFinished = KRun::run( *serv, lst, d->m_window, d->m_asn );
1233
          /// Note: the line above means that if that service failed, we'll
1285
          /// Note: the line above means that if that service failed, we'll
1234
          /// go to runURL to maybe find another service, even though a dialog
1286
          /// go to runURL to maybe find another service, even though a dialog
1235
          /// box was displayed. That's good if runURL tries another service,
1287
          /// box was displayed. That's good if runURL tries another service,
Lines 1244-1250 void KRun::foundMimeType( const QString& Link Here
1244
    m_strURL.setPath( d->m_localPath );
1296
    m_strURL.setPath( d->m_localPath );
1245
  }
1297
  }
1246
1298
1247
  if (!m_bFinished && KRun::runURL( m_strURL, type, false, d->m_runExecutables, d->m_suggestedFileName )){
1299
  if (!m_bFinished && KRun::runURL( m_strURL, type, d->m_window, d->m_asn, false, d->m_runExecutables, d->m_suggestedFileName )){
1248
    m_bFinished = true;
1300
    m_bFinished = true;
1249
  }
1301
  }
1250
  else{
1302
  else{
(-)kdelibs.sav/kio/kio/krun.h (-1 / +10 lines)
Lines 111-116 public: Link Here
111
   */
111
   */
112
  KRun( const KURL& url, QWidget* window, mode_t mode = 0,
112
  KRun( const KURL& url, QWidget* window, mode_t mode = 0,
113
	bool isLocalFile = false, bool showProgressInfo = true );
113
	bool isLocalFile = false, bool showProgressInfo = true );
114
  KRun( const KURL& url, QWidget* window, const QCString& asn, mode_t mode = 0,
115
	bool isLocalFile = false, bool showProgressInfo = true );
114
116
115
  /**
117
  /**
116
   * Destructor. Don't call it yourself, since a KRun object auto-deletes
118
   * Destructor. Don't call it yourself, since a KRun object auto-deletes
Lines 210-215 public: Link Here
210
   * @since 3.5.2
212
   * @since 3.5.2
211
   */
213
   */
212
  static pid_t run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles = false );
214
  static pid_t run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles = false );
215
  static pid_t run( const KService& _service, const KURL::List& _urls, QWidget* window,
216
      const QCString& asn, bool tempFiles = false );
213
  /**
217
  /**
214
   * Open a list of URLs with a certain service (application).
218
   * Open a list of URLs with a certain service (application).
215
   *
219
   *
Lines 226-231 public: Link Here
226
  /// @since 3.5.3
230
  /// @since 3.5.3
227
  /// @internal
231
  /// @internal
228
  static pid_t run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles, const QString& suggestedFileName );
232
  static pid_t run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles, const QString& suggestedFileName );
233
  static pid_t run( const KService& _service, const KURL::List& _urls, QWidget* window,
234
      const QCString& asn, bool tempFiles, const QString& suggestedFileName );
229
235
230
  /**
236
  /**
231
   * Open a list of URLs with.
237
   * Open a list of URLs with.
Lines 269-274 public: Link Here
269
  static pid_t runURL( const KURL& _url, const QString& _mimetype );
275
  static pid_t runURL( const KURL& _url, const QString& _mimetype );
270
  /// @since 3.5.3
276
  /// @since 3.5.3
271
  /// @internal
277
  /// @internal
278
  static pid_t runURL( const KURL& _url, const QString& _mimetype, QWidget* window, const QCString& asn, bool tempFile, bool runExecutables, const QString& suggestedFileName );
272
  static pid_t runURL( const KURL& _url, const QString& _mimetype, bool tempFile, bool runExecutables, const QString& suggestedFileName );
279
  static pid_t runURL( const KURL& _url, const QString& _mimetype, bool tempFile, bool runExecutables, const QString& suggestedFileName );
273
280
274
  /**
281
  /**
Lines 299-304 public: Link Here
299
   * of running command) if command was unsafe for map notification.
306
   * of running command) if command was unsafe for map notification.
300
   */
307
   */
301
  static pid_t runCommand( const QString& cmd, const QString & execName, const QString & icon );
308
  static pid_t runCommand( const QString& cmd, const QString & execName, const QString & icon );
309
  static pid_t runCommand( const QString& cmd, const QString & execName, const QString & icon,
310
      QWidget* window, const QCString& asn );
302
311
303
  /**
312
  /**
304
   * Display the Open-With dialog for those URLs, and run the chosen application.
313
   * Display the Open-With dialog for those URLs, and run the chosen application.
Lines 438-444 protected: Link Here
438
  virtual void virtual_hook( int id, void* data );
447
  virtual void virtual_hook( int id, void* data );
439
448
440
private:
449
private:
441
  void init (const KURL& url, QWidget* window, mode_t mode,
450
  void init (const KURL& url, QWidget* window, const QCString& asn, mode_t mode,
442
             bool isLocalFile, bool showProgressInfo);
451
             bool isLocalFile, bool showProgressInfo);
443
private:
452
private:
444
  class KRunPrivate;
453
  class KRunPrivate;

Return to bug 211469