mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 10:22:49 +00:00
generic: adjust to KRun changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
6058479e6f
commit
957da2bb43
55 changed files with 139 additions and 599 deletions
|
@ -314,7 +314,6 @@ add_subdirectory(kdeeject)
|
||||||
add_subdirectory(kfile)
|
add_subdirectory(kfile)
|
||||||
add_subdirectory(kiconfinder)
|
add_subdirectory(kiconfinder)
|
||||||
add_subdirectory(kioclient)
|
add_subdirectory(kioclient)
|
||||||
add_subdirectory(kioexec)
|
|
||||||
add_subdirectory(ktraderclient)
|
add_subdirectory(ktraderclient)
|
||||||
add_subdirectory(kreadconfig)
|
add_subdirectory(kreadconfig)
|
||||||
add_subdirectory(kmimetypefinder)
|
add_subdirectory(kmimetypefinder)
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
#include <KCmdLineArgs>
|
#include <KCmdLineArgs>
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
#include <KRun>
|
|
||||||
#include <KUrl>
|
#include <KUrl>
|
||||||
|
|
||||||
DolphinApplication::DolphinApplication() :
|
DolphinApplication::DolphinApplication() :
|
||||||
|
|
|
@ -357,7 +357,7 @@ void DolphinMainWindow::updateFilterBarAction(bool show)
|
||||||
|
|
||||||
void DolphinMainWindow::openNewMainWindow()
|
void DolphinMainWindow::openNewMainWindow()
|
||||||
{
|
{
|
||||||
KRun::run("dolphin %u", KUrl::List(), this);
|
KToolInvocation::self()->startServiceByStorageId("dolphin", QStringList(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinMainWindow::openNewTab()
|
void DolphinMainWindow::openNewTab()
|
||||||
|
@ -468,7 +468,7 @@ void DolphinMainWindow::openInNewWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!newWindowUrl.isEmpty()) {
|
if (!newWindowUrl.isEmpty()) {
|
||||||
KRun::run("dolphin %u", KUrl::List() << newWindowUrl, this);
|
KToolInvocation::self()->startServiceByStorageId("dolphin", QStringList() << newWindowUrl.url(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -955,18 +955,15 @@ void DolphinMainWindow::openTabContextMenu(int index, const QPoint& pos)
|
||||||
openNewTab(url);
|
openNewTab(url);
|
||||||
m_tabBar->setCurrentIndex(m_viewTab.count() - 1);
|
m_tabBar->setCurrentIndex(m_viewTab.count() - 1);
|
||||||
} else if (selectedAction == detachTabAction) {
|
} else if (selectedAction == detachTabAction) {
|
||||||
const QString separator(QLatin1Char(' '));
|
QStringList dolphinArgs;
|
||||||
QString command = QLatin1String("dolphin");
|
|
||||||
|
|
||||||
const DolphinTabPage* tabPage = m_viewTab.at(index);
|
const DolphinTabPage* tabPage = m_viewTab.at(index);
|
||||||
|
dolphinArgs << tabPage->primaryViewContainer()->url().url();
|
||||||
command += separator + tabPage->primaryViewContainer()->url().url();
|
|
||||||
if (tabPage->splitViewEnabled()) {
|
if (tabPage->splitViewEnabled()) {
|
||||||
command += separator + tabPage->secondaryViewContainer()->url().url();
|
dolphinArgs << tabPage->secondaryViewContainer()->url().url();
|
||||||
command += separator + QLatin1String("-split");
|
dolphinArgs << QLatin1String("-split");
|
||||||
}
|
}
|
||||||
|
|
||||||
KRun::runCommand(command, this);
|
KToolInvocation::self()->startProgram("dolphin", dolphinArgs, this);
|
||||||
|
|
||||||
closeTab(index);
|
closeTab(index);
|
||||||
} else if (selectedAction == closeOtherTabsAction) {
|
} else if (selectedAction == closeOtherTabsAction) {
|
||||||
|
@ -1010,7 +1007,7 @@ void DolphinMainWindow::handleUrl(const KUrl& url)
|
||||||
this, SLOT(slotHandleUrlStatFinished(KJob*)));
|
this, SLOT(slotHandleUrlStatFinished(KJob*)));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
new KRun(url, this); // Automatically deletes itself after being finished
|
KToolInvocation::self()->startServiceForUrl(url.url(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1022,7 +1019,7 @@ void DolphinMainWindow::slotHandleUrlStatFinished(KJob* job)
|
||||||
if (entry.isDir()) {
|
if (entry.isDir()) {
|
||||||
activeViewContainer()->setUrl(url);
|
activeViewContainer()->setUrl(url);
|
||||||
} else {
|
} else {
|
||||||
new KRun(url, this); // Automatically deletes itself after being finished
|
KToolInvocation::self()->startServiceForUrl(url.url(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1056,7 +1053,7 @@ void DolphinMainWindow::openContextMenu(const QPoint& pos,
|
||||||
|
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case DolphinContextMenu::OpenParentFolderInNewWindow: {
|
case DolphinContextMenu::OpenParentFolderInNewWindow: {
|
||||||
KRun::run("dolphin %u", KUrl::List() << item.url().upUrl(), this);
|
KToolInvocation::self()->startServiceByStorageId("dolphin", QStringList() << item.url().upUrl().url(), this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -405,7 +405,7 @@ private slots:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the URL can be listed, open it in the current view, otherwise
|
* If the URL can be listed, open it in the current view, otherwise
|
||||||
* run it through KRun.
|
* run it through KToolInvocation.
|
||||||
*/
|
*/
|
||||||
void handleUrl(const KUrl& url);
|
void handleUrl(const KUrl& url);
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,6 @@
|
||||||
#include <KUrl>
|
#include <KUrl>
|
||||||
#include <KUrlComboBox>
|
#include <KUrlComboBox>
|
||||||
#include <KUrlNavigator>
|
#include <KUrlNavigator>
|
||||||
#include <KRun>
|
|
||||||
|
|
||||||
|
|
||||||
#include "dolphin_generalsettings.h"
|
#include "dolphin_generalsettings.h"
|
||||||
#include "filterbar/filterbar.h"
|
#include "filterbar/filterbar.h"
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <KRun>
|
#include <KToolInvocation>
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
@ -152,19 +152,19 @@ void KateProjectTreeViewContextMenu::exec(const QString& filename, const QPoint&
|
||||||
} else if(openDirectoryWithMenu == action->parentWidget()) {
|
} else if(openDirectoryWithMenu == action->parentWidget()) {
|
||||||
// handle open directory with
|
// handle open directory with
|
||||||
const QString openDirWith = action->data().toString();
|
const QString openDirWith = action->data().toString();
|
||||||
if (KService::Ptr app = KService::serviceByDesktopPath(openDirWith)) {
|
if (!openDirWith.isEmpty()) {
|
||||||
QFileInfo fi(filename);
|
QFileInfo fi(filename);
|
||||||
QList<QUrl> list;
|
QStringList list;
|
||||||
list << QUrl::fromLocalFile (fi.dir().absolutePath());
|
list << fi.dir().absolutePath();
|
||||||
KRun::run(*app, list, parent);
|
KToolInvocation::self()->startServiceByStorageId(openDirWith, list, parent);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// open with
|
// open with
|
||||||
const QString openWith = action->data().toString();
|
const QString openWith = action->data().toString();
|
||||||
if (KService::Ptr app = KService::serviceByDesktopPath(openWith)) {
|
if (!openWith.isEmpty()) {
|
||||||
QList<QUrl> list;
|
QStringList list;
|
||||||
list << QUrl::fromLocalFile (filename);
|
list << filename;
|
||||||
KRun::run(*app, list, parent);
|
KToolInvocation::self()->startServiceByStorageId(openWith, list, parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,7 @@ void KateSessionApplet::slotOnItemClicked(const QModelIndex &index)
|
||||||
else if ( id > 2 )
|
else if ( id > 2 )
|
||||||
args <<"-n"<< "--start"<<m_sessions[ id-3 ];
|
args <<"-n"<< "--start"<<m_sessions[ id-3 ];
|
||||||
|
|
||||||
KToolInvocation::self()->kdeinitExec("kate", args);
|
KToolInvocation::self()->startProgram("kate", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KateSessionApplet::createConfigurationInterface(KConfigDialog *parent)
|
void KateSessionApplet::createConfigurationInterface(KConfigDialog *parent)
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
#include <kmimetypechooser.h>
|
#include <kmimetypechooser.h>
|
||||||
#include <knuminput.h>
|
#include <knuminput.h>
|
||||||
#include <kmenu.h>
|
#include <kmenu.h>
|
||||||
#include <krun.h>
|
#include <ktoolinvocation.h>
|
||||||
#include <kseparator.h>
|
#include <kseparator.h>
|
||||||
#include <kstandarddirs.h>
|
#include <kstandarddirs.h>
|
||||||
#include <ktemporaryfile.h>
|
#include <ktemporaryfile.h>
|
||||||
|
@ -1250,12 +1250,11 @@ void KateModOnHdPrompt::slotPDone()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_diffFile->setAutoRemove(false);
|
m_diffFile->setAutoRemove(false);
|
||||||
KUrl url = KUrl::fromPath(m_diffFile->fileName());
|
QString url = m_diffFile->fileName();
|
||||||
delete m_diffFile;
|
delete m_diffFile;
|
||||||
m_diffFile = 0;
|
m_diffFile = 0;
|
||||||
|
|
||||||
// KRun::runUrl should delete the file, once the client exits
|
KToolInvocation::self()->startServiceForUrl( url, this, true );
|
||||||
KRun::runUrl( url, "text/x-patch", this, true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KateModOnHdPrompt::slotButtonClicked(int button)
|
void KateModOnHdPrompt::slotButtonClicked(int button)
|
||||||
|
|
|
@ -343,7 +343,7 @@ class KatePartPluginConfigPage : public KateConfigPage
|
||||||
* This dialog will prompt the user for what do with a file that is
|
* This dialog will prompt the user for what do with a file that is
|
||||||
* modified on disk.
|
* modified on disk.
|
||||||
* If the file wasn't deleted, it has a 'diff' button, which will create
|
* If the file wasn't deleted, it has a 'diff' button, which will create
|
||||||
* a diff file (uing diff(1)) and launch that using KRun.
|
* a diff file (uing diff(1)) and launch that using KToolInvocation.
|
||||||
*/
|
*/
|
||||||
class KateModOnHdPrompt : public KDialog
|
class KateModOnHdPrompt : public KDialog
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include <qprocess.h>
|
#include <qprocess.h>
|
||||||
#include <qtextstream.h>
|
#include <qtextstream.h>
|
||||||
#include <kmessagebox.h>
|
#include <kmessagebox.h>
|
||||||
#include <krun.h>
|
#include <ktoolinvocation.h>
|
||||||
#include <klocale.h>
|
#include <klocale.h>
|
||||||
|
|
||||||
//BEGIN SwapDiffCreator
|
//BEGIN SwapDiffCreator
|
||||||
|
@ -149,12 +149,11 @@ void SwapDiffCreator::slotDiffFinished()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// close diffFile and avoid removal, KRun will do that later!
|
// close diffFile and avoid removal
|
||||||
m_diffFile.close ();
|
m_diffFile.close ();
|
||||||
m_diffFile.setAutoRemove (false);
|
m_diffFile.setAutoRemove (false);
|
||||||
|
|
||||||
// KRun::runUrl should delete the file, once the client exits
|
KToolInvocation::self()->startServiceForUrl (m_diffFile.fileName(), m_swapFile->document()->activeView(), true );
|
||||||
KRun::runUrl (KUrl::fromPath(m_diffFile.fileName()), "text/x-patch", m_swapFile->document()->activeView(), true );
|
|
||||||
|
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
|
|
|
@ -808,19 +808,11 @@ void KateMainWindow::slotOpenWithMenuAction(QAction* a)
|
||||||
// display "open with" dialog
|
// display "open with" dialog
|
||||||
KOpenWithDialog dlg(list);
|
KOpenWithDialog dlg(list);
|
||||||
if (dlg.exec())
|
if (dlg.exec())
|
||||||
KRun::run(*dlg.service(), list, this);
|
KToolInvocation::self()->startServiceByStorageId(dlg.service()->entryPath(), list.toStringList(), this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
KService::Ptr app = KService::serviceByDesktopPath(openWith);
|
KToolInvocation::self()->startServiceByStorageId(openWith, list.toStringList(), this);
|
||||||
if (app)
|
|
||||||
{
|
|
||||||
KRun::run(*app, list, this);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
KMessageBox::error(this, i18n("Application '%1' not found.", openWith), i18n("Application not found"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KateMainWindow::pluginHelp()
|
void KateMainWindow::pluginHelp()
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KMessageBox>
|
#include <KMessageBox>
|
||||||
#include <KRun>
|
#include <KToolInvocation>
|
||||||
#include <KTemporaryFile>
|
#include <KTemporaryFile>
|
||||||
#include <KPushButton>
|
#include <KPushButton>
|
||||||
#include <KVBox>
|
#include <KVBox>
|
||||||
|
@ -301,12 +301,11 @@ void KateMwModOnHdDialog::slotPDone()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_diffFile->setAutoRemove(false);
|
m_diffFile->setAutoRemove(false);
|
||||||
KUrl url = KUrl::fromPath(m_diffFile->fileName());
|
QString url = m_diffFile->fileName();
|
||||||
delete m_diffFile;
|
delete m_diffFile;
|
||||||
m_diffFile = 0;
|
m_diffFile = 0;
|
||||||
|
|
||||||
// KRun::runUrl should delete the file, once the client exits
|
KToolInvocation::self()->startServiceForUrl( url, this, true );
|
||||||
KRun::runUrl( url, "text/x-patch", this, true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KateMwModOnHdDialog::addDocument(KTextEditor::Document *doc)
|
void KateMwModOnHdDialog::addDocument(KTextEditor::Document *doc)
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include <KMimeTypeTrader>
|
#include <KMimeTypeTrader>
|
||||||
#include <KMimeType>
|
#include <KMimeType>
|
||||||
#include <KOpenWithDialog>
|
#include <KOpenWithDialog>
|
||||||
#include <KRun>
|
#include <KToolInvocation>
|
||||||
#include <KMessageBox>
|
#include <KMessageBox>
|
||||||
|
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
|
@ -261,19 +261,11 @@ void KateFileTree::slotOpenWithMenuAction(QAction* a)
|
||||||
// display "open with" dialog
|
// display "open with" dialog
|
||||||
KOpenWithDialog dlg(list);
|
KOpenWithDialog dlg(list);
|
||||||
if (dlg.exec())
|
if (dlg.exec())
|
||||||
KRun::run(*dlg.service(), list, this);
|
KToolInvocation::self()->startServiceByStorageId(dlg.service()->entryPath(), list.toStringList(), this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
KService::Ptr app = KService::serviceByDesktopPath(openWith);
|
KToolInvocation::self()->startServiceByStorageId(openWith, list.toStringList(), this);
|
||||||
if (app)
|
|
||||||
{
|
|
||||||
KRun::run(*app, list, this);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
KMessageBox::error(this, i18n("Application '%1' not found.", openWith), i18n("Application not found"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -672,7 +672,7 @@ void KAccessConfig::save()
|
||||||
// make kaccess reread the configuration
|
// make kaccess reread the configuration
|
||||||
// turning a11y features off needs to be done by kaccess
|
// turning a11y features off needs to be done by kaccess
|
||||||
// so run it to clear any enabled features and it will exit if it should
|
// so run it to clear any enabled features and it will exit if it should
|
||||||
KToolInvocation::self()->startServiceByDesktopName("kaccess");
|
KToolInvocation::self()->startServiceByStorageId("kaccess");
|
||||||
|
|
||||||
emit changed(false);
|
emit changed(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1162,7 +1162,7 @@ void KColorCm::save()
|
||||||
displayGroup.writeEntry("exportKDEColors", applyToAlien->isChecked());
|
displayGroup.writeEntry("exportKDEColors", applyToAlien->isChecked());
|
||||||
cfg.sync();
|
cfg.sync();
|
||||||
|
|
||||||
KToolInvocation::self()->startServiceByDesktopName("krdb");
|
KToolInvocation::self()->startServiceByStorageId("krdb");
|
||||||
|
|
||||||
emit changed(false);
|
emit changed(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,7 +270,7 @@ bool FontAASettings::load()
|
||||||
xft.apply(); // Save this setting
|
xft.apply(); // Save this setting
|
||||||
KConfigGroup(&kglobals, "General").writeEntry("XftHintStyle", KXftConfig::toStr(hStyle));
|
KConfigGroup(&kglobals, "General").writeEntry("XftHintStyle", KXftConfig::toStr(hStyle));
|
||||||
kglobals.sync();
|
kglobals.sync();
|
||||||
KToolInvocation::self()->startServiceByDesktopName("krdb");
|
KToolInvocation::self()->startServiceByStorageId("krdb");
|
||||||
}
|
}
|
||||||
|
|
||||||
hintingStyle->setCurrentIndex(getIndex(hStyle));
|
hintingStyle->setCurrentIndex(getIndex(hStyle));
|
||||||
|
@ -731,7 +731,7 @@ void KFonts::save()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
KToolInvocation::self()->startServiceByDesktopName("krdb");
|
KToolInvocation::self()->startServiceByStorageId("krdb");
|
||||||
|
|
||||||
emit changed(false);
|
emit changed(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -551,7 +551,7 @@ void MouseConfig::save()
|
||||||
group.writeEntry("MKCurve", mk_curve->value());
|
group.writeEntry("MKCurve", mk_curve->value());
|
||||||
|
|
||||||
// restart kaccess
|
// restart kaccess
|
||||||
KToolInvocation::self()->startServiceByDesktopName("kaccess");
|
KToolInvocation::self()->startServiceByStorageId("kaccess");
|
||||||
|
|
||||||
emit changed(false);
|
emit changed(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,7 +257,7 @@ bool ThemePage::applyTheme(const CursorTheme *theme, const int size)
|
||||||
KToolInvocation::self()->setLaunchEnv("XCURSOR_THEME", theme->name());
|
KToolInvocation::self()->setLaunchEnv("XCURSOR_THEME", theme->name());
|
||||||
|
|
||||||
// Update the Xcursor X resources
|
// Update the Xcursor X resources
|
||||||
KToolInvocation::self()->startServiceByDesktopName("krdb");
|
KToolInvocation::self()->startServiceByStorageId("krdb");
|
||||||
|
|
||||||
// Notify all applications that the cursor theme has changed
|
// Notify all applications that the cursor theme has changed
|
||||||
KGlobalSettings::self()->emitChange(KGlobalSettings::MouseChanged);
|
KGlobalSettings::self()->emitChange(KGlobalSettings::MouseChanged);
|
||||||
|
|
|
@ -162,7 +162,7 @@ void RandrMonitorModule::processX11Event( XEvent* e )
|
||||||
|
|
||||||
void RandrMonitorModule::showKcm()
|
void RandrMonitorModule::showKcm()
|
||||||
{
|
{
|
||||||
KToolInvocation::self()->kdeinitExec("kcmshell4", QStringList() << "randr");
|
KToolInvocation::self()->startProgram("kcmshell4", QStringList() << "randr");
|
||||||
}
|
}
|
||||||
|
|
||||||
void RandrMonitorModule::tryAutoConfig()
|
void RandrMonitorModule::tryAutoConfig()
|
||||||
|
@ -244,7 +244,7 @@ void RandrMonitorModule::switchDisplay()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// no idea what to do here
|
// no idea what to do here
|
||||||
KToolInvocation::self()->kdeinitExec( "kcmshell4", QStringList() << "randr" );
|
KToolInvocation::self()->startProgram( "kcmshell4", QStringList() << "randr" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RandrMonitorModule::resumedFromSuspend()
|
void RandrMonitorModule::resumedFromSuspend()
|
||||||
|
|
|
@ -389,7 +389,7 @@ void KCMStyle::save()
|
||||||
// export fonts/colors settings.
|
// export fonts/colors settings.
|
||||||
if (m_bStyleDirty | m_bToolbarDirty) // Export only if necessary
|
if (m_bStyleDirty | m_bToolbarDirty) // Export only if necessary
|
||||||
{
|
{
|
||||||
KToolInvocation::self()->startServiceByDesktopName("krdb");
|
KToolInvocation::self()->startServiceByStorageId("krdb");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
|
|
|
@ -176,7 +176,7 @@ void KCrashModule::slotDirty(const QString &path)
|
||||||
kcrashargs.append(kcrashdisplay);
|
kcrashargs.append(kcrashdisplay);
|
||||||
}
|
}
|
||||||
kDebug() << "Restarting" << kcrashfilepath << kcrashapppath << kcrashargs;
|
kDebug() << "Restarting" << kcrashfilepath << kcrashapppath << kcrashargs;
|
||||||
KToolInvocation::self()->kdeinitExec(kcrashapppath, kcrashargs);
|
KToolInvocation::self()->startProgram(kcrashapppath, kcrashargs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
#include <klocale.h>
|
#include <klocale.h>
|
||||||
#include <kstandardaction.h>
|
#include <kstandardaction.h>
|
||||||
#include <kfiledialog.h>
|
#include <kfiledialog.h>
|
||||||
#include <krun.h>
|
#include <ktoolinvocation.h>
|
||||||
#include <kstandarddirs.h>
|
#include <kstandarddirs.h>
|
||||||
#include <kbookmark.h>
|
#include <kbookmark.h>
|
||||||
#include <kbookmarkmanager.h>
|
#include <kbookmarkmanager.h>
|
||||||
|
@ -407,7 +407,7 @@ void ActionsImpl::slotOpenLink()
|
||||||
for (it = bookmarks.constBegin(); it != end; ++it) {
|
for (it = bookmarks.constBegin(); it != end; ++it) {
|
||||||
if ((*it).isGroup() || (*it).isSeparator())
|
if ((*it).isGroup() || (*it).isSeparator())
|
||||||
continue;
|
continue;
|
||||||
(void)new KRun((*it).url(), KEBApp::self());
|
KToolInvocation::self()->startServiceForUrl((*it).url().url(), KEBApp::self());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <kfiledialog.h>
|
#include <kfiledialog.h>
|
||||||
#include <klocale.h>
|
#include <klocale.h>
|
||||||
#include <kapplication.h>
|
#include <kapplication.h>
|
||||||
#include <krun.h>
|
#include <ktoolinvocation.h>
|
||||||
#include <kmessagebox.h>
|
#include <kmessagebox.h>
|
||||||
#include <kglobal.h>
|
#include <kglobal.h>
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
|
@ -520,7 +520,7 @@ void KFindTreeView::openContainingFolder()
|
||||||
//TODO if >1 add a warn ?
|
//TODO if >1 add a warn ?
|
||||||
Q_FOREACH( const KUrl & url, folderMaps.keys() )
|
Q_FOREACH( const KUrl & url, folderMaps.keys() )
|
||||||
{
|
{
|
||||||
(void) new KRun(url, this);
|
KToolInvocation::self()->startServiceForUrl(url.url(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
|
|
||||||
#include "kioclient.h"
|
#include "kioclient.h"
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QDBusConnection>
|
||||||
#include <kio/job.h>
|
#include <kio/job.h>
|
||||||
#include <kio/copyjob.h>
|
#include <kio/copyjob.h>
|
||||||
#include <kio/deletejob.h>
|
#include <kio/deletejob.h>
|
||||||
|
@ -32,9 +34,7 @@
|
||||||
#include <kfiledialog.h>
|
#include <kfiledialog.h>
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
#include <kservice.h>
|
#include <kservice.h>
|
||||||
#include <QTimer>
|
#include <ktoolinvocation.h>
|
||||||
#include <krun.h>
|
|
||||||
#include <QtDBus/QtDBus>
|
|
||||||
#include <kcomponentdata.h>
|
#include <kcomponentdata.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
@ -145,18 +145,6 @@ int main( int argc, char **argv )
|
||||||
return ClientApp::doIt() ? 0 /*no error*/ : 1 /*error*/;
|
return ClientApp::doIt() ? 0 /*no error*/ : 1 /*error*/;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool krun_has_error = false;
|
|
||||||
|
|
||||||
void ClientApp::delayedQuit()
|
|
||||||
{
|
|
||||||
// Quit in 2 seconds. This leaves time for KRun to pop up
|
|
||||||
// "app not found" in KProcessRunner, if that was the case.
|
|
||||||
QTimer::singleShot( 2000, this, SLOT(quit()) );
|
|
||||||
// don't access the KRun instance later, it will be deleted after calling slots
|
|
||||||
if( static_cast< const KRun* >( sender())->hasError())
|
|
||||||
krun_has_error = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void checkArgumentCount(int count, int min, int max)
|
static void checkArgumentCount(int count, int min, int max)
|
||||||
{
|
{
|
||||||
if (count < min)
|
if (count < min)
|
||||||
|
@ -171,23 +159,22 @@ static void checkArgumentCount(int count, int min, int max)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientApp::kde_open(const KUrl& url, const QString& mimeType, bool allowExec)
|
bool ClientApp::kde_open(const KUrl& url, const QString& mimeType)
|
||||||
{
|
{
|
||||||
if ( mimeType.isEmpty() ) {
|
if ( mimeType.isEmpty() ) {
|
||||||
kDebug() << url;
|
kDebug() << url;
|
||||||
KRun * run = new KRun( url, 0 );
|
bool ok = KToolInvocation::self()->startServiceForUrl( url.url() );
|
||||||
run->setRunExecutables(allowExec);
|
// Quit in 2 seconds. This leaves time for KToolInvocation to pop up
|
||||||
QObject::connect( run, SIGNAL( finished() ), this, SLOT( delayedQuit() ));
|
// "app not found", if that was the case.
|
||||||
QObject::connect( run, SIGNAL( error() ), this, SLOT( delayedQuit() ));
|
QTimer::singleShot( 2000, this, SLOT(quit()) );
|
||||||
this->exec();
|
this->exec();
|
||||||
return !krun_has_error;
|
return ok;
|
||||||
} else {
|
} else {
|
||||||
const KUrl::List urls( url );
|
|
||||||
const KService::List offers = KMimeTypeTrader::self()->query(
|
const KService::List offers = KMimeTypeTrader::self()->query(
|
||||||
mimeType, QLatin1String( "Application" ) );
|
mimeType, QLatin1String( "Application" ) );
|
||||||
if (offers.isEmpty()) return 1;
|
if (offers.isEmpty()) return 1;
|
||||||
KService::Ptr serv = offers.first();
|
KService::Ptr serv = offers.first();
|
||||||
return KRun::run( *serv, urls, 0 );
|
return KToolInvocation::self()->startServiceByStorageId( serv->entryPath(), QStringList() << url.url() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +273,7 @@ bool ClientApp::doIt()
|
||||||
kFatal() << "Session bus not found" ;
|
kFatal() << "Session bus not found" ;
|
||||||
|
|
||||||
#ifdef KIOCLIENT_AS_KDEOPEN
|
#ifdef KIOCLIENT_AS_KDEOPEN
|
||||||
return app.kde_open(args->url(0), QByteArray(), false);
|
return app.kde_open(args->url(0), QByteArray());
|
||||||
#elif defined(KIOCLIENT_AS_KDECP)
|
#elif defined(KIOCLIENT_AS_KDECP)
|
||||||
checkArgumentCount(argc, 2, 0);
|
checkArgumentCount(argc, 2, 0);
|
||||||
return app.doCopy(0);
|
return app.doCopy(0);
|
||||||
|
@ -321,8 +308,7 @@ bool ClientApp::doIt()
|
||||||
{
|
{
|
||||||
checkArgumentCount(argc, 2, 3);
|
checkArgumentCount(argc, 2, 3);
|
||||||
return app.kde_open( args->url( 1 ),
|
return app.kde_open( args->url( 1 ),
|
||||||
argc == 3 ? args->arg( 2 ) : QString(),
|
argc == 3 ? args->arg( 2 ) : QString());
|
||||||
true );
|
|
||||||
}
|
}
|
||||||
else if ( command == "download" )
|
else if ( command == "download" )
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,11 +35,10 @@ private Q_SLOTS:
|
||||||
void slotPrintData(KIO::Job *job, const QByteArray &data);
|
void slotPrintData(KIO::Job *job, const QByteArray &data);
|
||||||
void slotEntries(KIO::Job* job, const KIO::UDSEntryList& );
|
void slotEntries(KIO::Job* job, const KIO::UDSEntryList& );
|
||||||
void slotResult( KJob * );
|
void slotResult( KJob * );
|
||||||
void delayedQuit();
|
|
||||||
void slotDialogCanceled();
|
void slotDialogCanceled();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool kde_open( const KUrl& url, const QString& mimeType, bool allowExec );
|
bool kde_open( const KUrl& url, const QString& mimeType );
|
||||||
bool doCopy( int firstArg );
|
bool doCopy( int firstArg );
|
||||||
bool doMove( int firstArg );
|
bool doMove( int firstArg );
|
||||||
bool doList( int firstArg );
|
bool doList( int firstArg );
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
set(kioexec_SRCS main.cpp )
|
|
||||||
|
|
||||||
add_executable(kioexec ${kioexec_SRCS})
|
|
||||||
|
|
||||||
target_link_libraries(kioexec KDE4::kio)
|
|
||||||
|
|
||||||
install(
|
|
||||||
TARGETS kioexec
|
|
||||||
DESTINATION ${KDE4_LIBEXEC_INSTALL_DIR}
|
|
||||||
)
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
$XGETTEXT *.cpp -o $podir/kioexec.pot
|
|
|
@ -1,26 +0,0 @@
|
||||||
kioexec is launched when the user wants to open a remote file with
|
|
||||||
an application that only supports local files.
|
|
||||||
|
|
||||||
For this it does the following:
|
|
||||||
- downloads a remote file to a temp location
|
|
||||||
- starts a 'local' application with that temp file as argument
|
|
||||||
- wait fors application to be exited
|
|
||||||
- if the modification time of the file is different from the original one,
|
|
||||||
(because the file was modified) then it offers re-uploading the modified version.
|
|
||||||
This is how you offer network transparency to apps that don't have it.
|
|
||||||
|
|
||||||
BUT: with KUniqueApplication, this breaks, because the app returns at once,
|
|
||||||
so we have no way to know when the user finished editing the file...
|
|
||||||
|
|
||||||
Conclusion: if the application has network transparency built-in, it should
|
|
||||||
put "%u" in its desktop file - and kioexec isn't used -. If it doesn't, either
|
|
||||||
it's a KApplication and kiiooexec does its job, or it's a KUniqueApplication
|
|
||||||
and... kioexec can't see modifications to the file. Be warned.
|
|
||||||
|
|
||||||
From Waldo: "The program doesn't return _at once_. It returns
|
|
||||||
after "newInstance()" returns. So if you open the file there it will still work.
|
|
||||||
(Or rename it)"
|
|
||||||
|
|
||||||
David Faure <faure@kde.org>
|
|
||||||
20-May-2000
|
|
||||||
|
|
283
kioexec/main.cpp
283
kioexec/main.cpp
|
@ -1,283 +0,0 @@
|
||||||
/* This file is part of the KDE project
|
|
||||||
Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
|
|
||||||
Copyright (C) 2000-2005 David Faure <faure@kde.org>
|
|
||||||
Copyright (C) 2001 Waldo Bastian <bastian@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "main.h"
|
|
||||||
|
|
||||||
#include <QtCore/QFile>
|
|
||||||
#include <QtCore/qprocess.h>
|
|
||||||
|
|
||||||
#include <kapplication.h>
|
|
||||||
#include <kdeversion.h>
|
|
||||||
#include <kstandarddirs.h>
|
|
||||||
#include <kdebug.h>
|
|
||||||
#include <kmessagebox.h>
|
|
||||||
#include <kio/job.h>
|
|
||||||
#include <krun.h>
|
|
||||||
#include <kio/netaccess.h>
|
|
||||||
#include <kservice.h>
|
|
||||||
#include <klocale.h>
|
|
||||||
#include <kcmdlineargs.h>
|
|
||||||
#include <kaboutdata.h>
|
|
||||||
#include <kstartupinfo.h>
|
|
||||||
#include <kshell.h>
|
|
||||||
#include <kde_file.h>
|
|
||||||
|
|
||||||
static const char description[] =
|
|
||||||
I18N_NOOP("KIO Exec - Opens remote files, watches modifications, asks for upload");
|
|
||||||
|
|
||||||
|
|
||||||
KIOExec::KIOExec()
|
|
||||||
: mExited(false)
|
|
||||||
{
|
|
||||||
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
|
|
||||||
if (args->count() < 1)
|
|
||||||
KCmdLineArgs::usageError(i18n("'command' expected.\n"));
|
|
||||||
|
|
||||||
tempfiles = args->isSet("tempfiles");
|
|
||||||
if ( args->isSet( "suggestedfilename" ) )
|
|
||||||
suggestedFileName = args->getOption( "suggestedfilename" );
|
|
||||||
expectedCounter = 0;
|
|
||||||
jobCounter = 0;
|
|
||||||
command = args->arg(0);
|
|
||||||
kDebug() << "command=" << command;
|
|
||||||
|
|
||||||
for ( int i = 1; i < args->count(); i++ )
|
|
||||||
{
|
|
||||||
KUrl url = args->url(i);
|
|
||||||
url = KIO::NetAccess::mostLocalUrl( url, 0 );
|
|
||||||
|
|
||||||
//kDebug() << "url=" << url.url() << " filename=" << url.fileName();
|
|
||||||
// A local file, not an URL ?
|
|
||||||
// => It is not encoded and not shell escaped, too.
|
|
||||||
if ( url.isLocalFile() )
|
|
||||||
{
|
|
||||||
FileInfo file;
|
|
||||||
file.path = url.toLocalFile();
|
|
||||||
file.url = url;
|
|
||||||
fileList.append(file);
|
|
||||||
}
|
|
||||||
// It is an URL
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( !url.isValid() )
|
|
||||||
KMessageBox::error( 0L, i18n( "The URL %1\nis malformed" , url.url() ) );
|
|
||||||
else if ( tempfiles )
|
|
||||||
KMessageBox::error( 0L, i18n( "Remote URL %1\nnot allowed with --tempfiles switch" , url.url() ) );
|
|
||||||
else
|
|
||||||
// We must fetch the file
|
|
||||||
{
|
|
||||||
QString fileName = KIO::encodeFileName( url.fileName() );
|
|
||||||
if ( !suggestedFileName.isEmpty() )
|
|
||||||
fileName = suggestedFileName;
|
|
||||||
// Build the destination filename, in ~/.kde/cache-*/krun/
|
|
||||||
// Unlike KDE-1.1, we put the filename at the end so that the extension is kept
|
|
||||||
// (Some programs rely on it)
|
|
||||||
QString tmp = KGlobal::dirs()->saveLocation( "cache", "krun/" ) +
|
|
||||||
QString("%1_%2_%3").arg(getpid()).arg(jobCounter++).arg(fileName);
|
|
||||||
FileInfo file;
|
|
||||||
file.path = tmp;
|
|
||||||
file.url = url;
|
|
||||||
fileList.append(file);
|
|
||||||
|
|
||||||
expectedCounter++;
|
|
||||||
KUrl dest;
|
|
||||||
dest.setPath( tmp );
|
|
||||||
kDebug() << "Copying " << url.prettyUrl() << " to " << dest;
|
|
||||||
KIO::Job *job = KIO::file_copy( url, dest );
|
|
||||||
jobList.append( job );
|
|
||||||
|
|
||||||
connect( job, SIGNAL( result( KJob * ) ), SLOT( slotResult( KJob * ) ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
args->clear();
|
|
||||||
|
|
||||||
if ( tempfiles )
|
|
||||||
{
|
|
||||||
slotRunApp();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
counter = 0;
|
|
||||||
if ( counter == expectedCounter )
|
|
||||||
slotResult( 0L );
|
|
||||||
}
|
|
||||||
|
|
||||||
void KIOExec::slotResult( KJob * job )
|
|
||||||
{
|
|
||||||
if (job && job->error())
|
|
||||||
{
|
|
||||||
// That error dialog would be queued, i.e. not immediate...
|
|
||||||
//job->showErrorDialog();
|
|
||||||
if ( (job->error() != KIO::ERR_USER_CANCELED) )
|
|
||||||
KMessageBox::error( 0L, job->errorString() );
|
|
||||||
|
|
||||||
QString path = static_cast<KIO::FileCopyJob*>(job)->destUrl().path();
|
|
||||||
|
|
||||||
QList<FileInfo>::Iterator it = fileList.begin();
|
|
||||||
for(;it != fileList.end(); ++it)
|
|
||||||
{
|
|
||||||
if ((*it).path == path)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( it != fileList.end() )
|
|
||||||
fileList.erase( it );
|
|
||||||
else
|
|
||||||
kDebug() << path << " not found in list";
|
|
||||||
}
|
|
||||||
|
|
||||||
counter++;
|
|
||||||
|
|
||||||
if ( counter < expectedCounter )
|
|
||||||
return;
|
|
||||||
|
|
||||||
kDebug() << "All files downloaded, will call slotRunApp shortly";
|
|
||||||
// We know we can run the app now - but let's finish the job properly first.
|
|
||||||
QTimer::singleShot( 0, this, SLOT( slotRunApp() ) );
|
|
||||||
|
|
||||||
jobList.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void KIOExec::slotRunApp()
|
|
||||||
{
|
|
||||||
if ( fileList.isEmpty() ) {
|
|
||||||
kDebug() << "No files downloaded -> exiting";
|
|
||||||
mExited = true;
|
|
||||||
QApplication::exit(1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
KService service("dummy", command, QString());
|
|
||||||
|
|
||||||
KUrl::List list;
|
|
||||||
// Store modification times
|
|
||||||
QList<FileInfo>::Iterator it = fileList.begin();
|
|
||||||
for ( ; it != fileList.end() ; ++it )
|
|
||||||
{
|
|
||||||
KDE_struct_stat buff;
|
|
||||||
(*it).time = KDE_stat( QFile::encodeName((*it).path), &buff ) ? 0 : buff.st_mtime;
|
|
||||||
KUrl url;
|
|
||||||
url.setPath((*it).path);
|
|
||||||
list << url;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList params = KRun::processDesktopExec(service, list);
|
|
||||||
|
|
||||||
kDebug() << "EXEC " << KShell::joinArgs( params );
|
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
|
||||||
// propagate the startup identification to the started process
|
|
||||||
KStartupInfoId id;
|
|
||||||
id.initId( kapp->startupId());
|
|
||||||
id.setupStartupEnv();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QString exe( params.takeFirst() );
|
|
||||||
const int exit_code = QProcess::execute( exe, params );
|
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
|
||||||
KStartupInfo::resetStartupEnv();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
kDebug() << "EXEC done";
|
|
||||||
|
|
||||||
// Test whether one of the files changed
|
|
||||||
it = fileList.begin();
|
|
||||||
for( ;it != fileList.end(); ++it )
|
|
||||||
{
|
|
||||||
KDE_struct_stat buff;
|
|
||||||
QString src = (*it).path;
|
|
||||||
KUrl dest = (*it).url;
|
|
||||||
if ( (KDE::stat( src, &buff ) == 0) &&
|
|
||||||
((*it).time != buff.st_mtime) )
|
|
||||||
{
|
|
||||||
if ( tempfiles )
|
|
||||||
{
|
|
||||||
if ( KMessageBox::questionYesNo( 0L,
|
|
||||||
i18n( "The supposedly temporary file\n%1\nhas been modified.\nDo you still want to delete it?" , dest.pathOrUrl()),
|
|
||||||
i18n( "File Changed" ), KStandardGuiItem::del(), KGuiItem(i18n("Do Not Delete")) ) != KMessageBox::Yes )
|
|
||||||
continue; // don't delete the temp file
|
|
||||||
}
|
|
||||||
else if ( ! dest.isLocalFile() ) // no upload when it's already a local file
|
|
||||||
{
|
|
||||||
if ( KMessageBox::questionYesNo( 0L,
|
|
||||||
i18n( "The file\n%1\nhas been modified.\nDo you want to upload the changes?" , dest.prettyUrl()),
|
|
||||||
i18n( "File Changed" ), KGuiItem(i18n("Upload")), KGuiItem(i18n("Do Not Upload")) ) == KMessageBox::Yes )
|
|
||||||
{
|
|
||||||
kDebug() << "src='" << src << "' dest='" << dest << "'";
|
|
||||||
// Do it the synchronous way.
|
|
||||||
if ( !KIO::NetAccess::upload( src, dest, 0 ) )
|
|
||||||
{
|
|
||||||
KMessageBox::error( 0L, KIO::NetAccess::lastErrorString() );
|
|
||||||
continue; // don't delete the temp file
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((!dest.isLocalFile() || tempfiles) && exit_code == 0) {
|
|
||||||
// Wait for a reasonable time so that even if the application forks on startup (like OOo or amarok)
|
|
||||||
// it will have time to start up and read the file before it gets deleted. #130709.
|
|
||||||
kDebug() << "sleeping...";
|
|
||||||
sleep(180); // 3 mn
|
|
||||||
kDebug() << "about to delete " << src;
|
|
||||||
unlink( QFile::encodeName(src) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mExited = true;
|
|
||||||
QApplication::exit(exit_code);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main( int argc, char **argv )
|
|
||||||
{
|
|
||||||
KAboutData aboutData( "kioexec", "kioexec", ki18n("KIOExec"),
|
|
||||||
KDE_VERSION_STRING, ki18n(description), KAboutData::License_GPL,
|
|
||||||
ki18n("(c) 1998-2000,2003 The KFM/Konqueror Developers"));
|
|
||||||
aboutData.addAuthor(ki18n("David Faure"),KLocalizedString(), "faure@kde.org");
|
|
||||||
aboutData.addAuthor(ki18n("Stephan Kulow"),KLocalizedString(), "coolo@kde.org");
|
|
||||||
aboutData.addAuthor(ki18n("Bernhard Rosenkraenzer"),KLocalizedString(), "bero@arklinux.org");
|
|
||||||
aboutData.addAuthor(ki18n("Waldo Bastian"),KLocalizedString(), "bastian@kde.org");
|
|
||||||
aboutData.addAuthor(ki18n("Oswald Buddenhagen"),KLocalizedString(), "ossi@kde.org");
|
|
||||||
aboutData.setProgramIconName("kde");
|
|
||||||
KCmdLineArgs::init( argc, argv, &aboutData );
|
|
||||||
|
|
||||||
KCmdLineOptions options;
|
|
||||||
options.add("tempfiles", ki18n("Treat URLs as local files and delete them afterwards"));
|
|
||||||
options.add("suggestedfilename <file name>", ki18n("Suggested file name for the downloaded file"));
|
|
||||||
options.add("+command", ki18n("Command to execute"));
|
|
||||||
options.add("+[URLs]", ki18n("URL(s) or local file(s) used for 'command'"));
|
|
||||||
KCmdLineArgs::addCmdLineOptions( options );
|
|
||||||
|
|
||||||
KApplication app;
|
|
||||||
app.setQuitOnLastWindowClosed(false);
|
|
||||||
|
|
||||||
KIOExec exec;
|
|
||||||
|
|
||||||
// Don't go into the event loop if we already want to exit (#172197)
|
|
||||||
if (exec.exited())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return app.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "moc_main.cpp"
|
|
|
@ -1,66 +0,0 @@
|
||||||
/* This file is part of the KDE project
|
|
||||||
Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
|
|
||||||
Copyright (C) 2000-2005 David Faure <faure@kde.org>
|
|
||||||
Copyright (C) 2001 Waldo Bastian <bastian@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef KIOEXEC_MAIN_H
|
|
||||||
#define KIOEXEC_MAIN_H
|
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
|
||||||
#include <QtCore/QString>
|
|
||||||
#include <QList>
|
|
||||||
#include <QtCore/QTimer>
|
|
||||||
|
|
||||||
#include <KUrl>
|
|
||||||
|
|
||||||
namespace KIO { class Job; }
|
|
||||||
|
|
||||||
class KJob;
|
|
||||||
|
|
||||||
class KIOExec : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
KIOExec();
|
|
||||||
|
|
||||||
bool exited() const { return mExited; }
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
void slotResult( KJob * );
|
|
||||||
void slotRunApp();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool mExited;
|
|
||||||
bool tempfiles;
|
|
||||||
QString suggestedFileName;
|
|
||||||
int counter;
|
|
||||||
int expectedCounter;
|
|
||||||
QString command;
|
|
||||||
struct FileInfo {
|
|
||||||
QString path;
|
|
||||||
KUrl url;
|
|
||||||
int time;
|
|
||||||
};
|
|
||||||
QList<FileInfo> fileList;
|
|
||||||
int jobCounter;
|
|
||||||
QList<KIO::Job *> jobList;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include <KDirNotify>
|
#include <KDirNotify>
|
||||||
#include <KCharsets>
|
#include <KCharsets>
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
#include <KRun>
|
|
||||||
#include <KToolInvocation>
|
#include <KToolInvocation>
|
||||||
#include <KProtocolInfo>
|
#include <KProtocolInfo>
|
||||||
|
|
||||||
|
@ -198,7 +197,7 @@ bool KNetAttach::validateCurrentPage()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
KRun::runUrl(url, "inode/directory", this);
|
KToolInvocation::self()->startServiceForUrl(url.url(), this);
|
||||||
|
|
||||||
QString name = _connectionName->text().trimmed();
|
QString name = _connectionName->text().trimmed();
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
// Own
|
// Own
|
||||||
#include "Filter.h"
|
#include "Filter.h"
|
||||||
|
|
||||||
// Qt
|
// Katie
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QtGui/QClipboard>
|
#include <QtGui/QClipboard>
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
// KDE
|
// KDE
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
#include <KRun>
|
#include <KToolInvocation>
|
||||||
|
|
||||||
// Konsole
|
// Konsole
|
||||||
#include "TerminalCharacterDecoder.h"
|
#include "TerminalCharacterDecoder.h"
|
||||||
|
@ -419,7 +419,7 @@ void UrlFilter::HotSpot::activate(QObject* object)
|
||||||
url.prepend("mailto:");
|
url.prepend("mailto:");
|
||||||
}
|
}
|
||||||
|
|
||||||
new KRun(url, QApplication::activeWindow());
|
KToolInvocation::self()->startServiceForUrl(url, QApplication::activeWindow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
#include <KMenu>
|
#include <KMenu>
|
||||||
#include <KMessageBox>
|
#include <KMessageBox>
|
||||||
#include <KRun>
|
|
||||||
#include <KShell>
|
#include <KShell>
|
||||||
#include <KToolInvocation>
|
#include <KToolInvocation>
|
||||||
#include <KStandardDirs>
|
#include <KStandardDirs>
|
||||||
|
@ -443,7 +442,7 @@ void SessionController::handleWebShortcutAction()
|
||||||
|
|
||||||
if (KUriFilter::self()->filterUri(filterData, QStringList() << "kurisearchfilter")) {
|
if (KUriFilter::self()->filterUri(filterData, QStringList() << "kurisearchfilter")) {
|
||||||
const KUrl& url = filterData.uri();
|
const KUrl& url = filterData.uri();
|
||||||
new KRun(url, QApplication::activeWindow());
|
KToolInvocation::self()->startServiceForUrl(url.url(), QApplication::activeWindow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,14 +487,14 @@ void SessionController::handleOpenWithAction()
|
||||||
|
|
||||||
const QStringList actionData = action->data().toStringList();
|
const QStringList actionData = action->data().toStringList();
|
||||||
Q_ASSERT(actionData.count() == 2);
|
Q_ASSERT(actionData.count() == 2);
|
||||||
KUrl::List actionUrls;
|
QStringList actionUrls;
|
||||||
actionUrls << actionData.at(1);
|
actionUrls << actionData.at(1);
|
||||||
KRun::run(actionData.at(0), actionUrls, QApplication::activeWindow());
|
KToolInvocation::self()->startServiceByStorageId(actionData.at(0), actionUrls, QApplication::activeWindow());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionController::configureWebShortcuts()
|
void SessionController::configureWebShortcuts()
|
||||||
{
|
{
|
||||||
KToolInvocation::self()->kdeinitExec("kcmshell4", QStringList() << "ebrowsing");
|
KToolInvocation::self()->startProgram("kcmshell4", QStringList() << "ebrowsing");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionController::sendSignal(QAction* action)
|
void SessionController::sendSignal(QAction* action)
|
||||||
|
@ -973,9 +972,9 @@ void SessionController::openBrowser()
|
||||||
KUrl currentUrl = url();
|
KUrl currentUrl = url();
|
||||||
|
|
||||||
if (currentUrl.isLocalFile())
|
if (currentUrl.isLocalFile())
|
||||||
new KRun(currentUrl, QApplication::activeWindow(), 0, true, true);
|
KToolInvocation::self()->startServiceForUrl(currentUrl.url(), QApplication::activeWindow());
|
||||||
else
|
else
|
||||||
new KRun(KUrl(QDir::homePath()), QApplication::activeWindow(), 0, true, true);
|
KToolInvocation::self()->startServiceForUrl(QDir::homePath(), QApplication::activeWindow());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionController::copy()
|
void SessionController::copy()
|
||||||
|
|
|
@ -97,10 +97,7 @@ KStart::KStart()
|
||||||
KStartupInfo::sendFinish(id); // failed to start
|
KStartupInfo::sendFinish(id); // failed to start
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QString error;
|
KToolInvocation::self()->startServiceByStorageId(exe, QStringList() << url);
|
||||||
if (KToolInvocation::self()->startServiceByDesktopPath(exe, url, &error) != 0) {
|
|
||||||
kError() << error;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QTimer::singleShot(useRule ? 0 : 120 * 1000, qApp, SLOT(quit()));
|
QTimer::singleShot(useRule ? 0 : 120 * 1000, qApp, SLOT(quit()));
|
||||||
|
|
|
@ -968,7 +968,7 @@ void RuleBook::edit(Client* c, bool whole_app)
|
||||||
args << "--wid" << QString::number(c->window());
|
args << "--wid" << QString::number(c->window());
|
||||||
if (whole_app)
|
if (whole_app)
|
||||||
args << "--whole-app";
|
args << "--whole-app";
|
||||||
KToolInvocation::self()->kdeinitExec("kwin_rules_dialog", args);
|
KToolInvocation::self()->startProgram("kwin_rules_dialog", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RuleBook::load()
|
void RuleBook::load()
|
||||||
|
|
|
@ -223,7 +223,7 @@ void UserActionsMenu::configureWM()
|
||||||
{
|
{
|
||||||
QStringList args;
|
QStringList args;
|
||||||
args << "--icon" << "preferences-system-windows" << configModules();
|
args << "--icon" << "preferences-system-windows" << configModules();
|
||||||
KToolInvocation::self()->kdeinitExec("kcmshell4", args);
|
KToolInvocation::self()->startProgram("kcmshell4", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserActionsMenu::init()
|
void UserActionsMenu::init()
|
||||||
|
|
|
@ -89,11 +89,10 @@ KonqOperations::~KonqOperations()
|
||||||
|
|
||||||
void KonqOperations::editMimeType( const QString & mimeType, QWidget* parent )
|
void KonqOperations::editMimeType( const QString & mimeType, QWidget* parent )
|
||||||
{
|
{
|
||||||
QString keditfiletype = QLatin1String("keditfiletype");
|
QStringList args;
|
||||||
KRun::runCommand( keditfiletype
|
args << "--parent" << QString::number( (qptrdiff)parent->winId());
|
||||||
+ " --parent " + QString::number( (qptrdiff)parent->winId())
|
args << mimeType;
|
||||||
+ ' ' + KShell::quoteArg(mimeType),
|
KToolInvocation::self()->startProgram( QLatin1String("keditfiletype"), args, parent );
|
||||||
keditfiletype, keditfiletype /*unused*/, parent );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KonqOperations::del( QWidget * parent, Operation method, const KUrl::List & selectedUrls )
|
void KonqOperations::del( QWidget * parent, Operation method, const KUrl::List & selectedUrls )
|
||||||
|
@ -381,10 +380,9 @@ void KonqOperations::asyncDrop( const KFileItem & destItem )
|
||||||
KConfigGroup desktopGroup = desktopFile.desktopGroup();
|
KConfigGroup desktopGroup = desktopFile.desktopGroup();
|
||||||
if ( desktopFile.hasApplicationType() )
|
if ( desktopFile.hasApplicationType() )
|
||||||
{
|
{
|
||||||
QString error;
|
KToolInvocation::self()->startServiceByStorageId(
|
||||||
const QStringList urlStrList = m_info->urls.toStringList();
|
m_destUrl.path(), m_info->urls.toStringList(), parentWidget()
|
||||||
if ( KToolInvocation::self()->startServiceByDesktopPath( m_destUrl.path(), urlStrList, &error ) > 0 )
|
);
|
||||||
KMessageBox::error( parentWidget(), error );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,8 +30,7 @@
|
||||||
#include <klocale.h>
|
#include <klocale.h>
|
||||||
#include <kbookmarkmanager.h>
|
#include <kbookmarkmanager.h>
|
||||||
#include <kbookmarkdialog.h>
|
#include <kbookmarkdialog.h>
|
||||||
#include <kdebug.h>
|
#include <ktoolinvocation.h>
|
||||||
#include <krun.h>
|
|
||||||
#include <kprotocolmanager.h>
|
#include <kprotocolmanager.h>
|
||||||
#include <kicon.h>
|
#include <kicon.h>
|
||||||
#include <kiconloader.h>
|
#include <kiconloader.h>
|
||||||
|
@ -44,6 +43,7 @@
|
||||||
#include <kdesktopfile.h>
|
#include <kdesktopfile.h>
|
||||||
#include <kglobal.h>
|
#include <kglobal.h>
|
||||||
#include <kacceleratormanager.h>
|
#include <kacceleratormanager.h>
|
||||||
|
#include <kdebug.h>
|
||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
|
@ -479,7 +479,7 @@ KFileItemActions* KonqPopupMenu::fileItemActions() const
|
||||||
void KonqPopupMenuPrivate::slotPopupNewView()
|
void KonqPopupMenuPrivate::slotPopupNewView()
|
||||||
{
|
{
|
||||||
Q_FOREACH(const KUrl& url, m_popupItemProperties.urlList()) {
|
Q_FOREACH(const KUrl& url, m_popupItemProperties.urlList()) {
|
||||||
(void) new KRun(url, m_parentWidget);
|
KToolInvocation::self()->startServiceForUrl(url.url(), m_parentWidget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ void KonqPopupMenuPrivate::slotPopupEmptyTrashBin()
|
||||||
|
|
||||||
void KonqPopupMenuPrivate::slotConfigTrashBin()
|
void KonqPopupMenuPrivate::slotConfigTrashBin()
|
||||||
{
|
{
|
||||||
KRun::run("kcmshell4 kcmtrash", KUrl::List(), m_parentWidget);
|
KToolInvocation::self()->startProgram("kcmshell4", QStringList() << "kcmtrash", m_parentWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KonqPopupMenuPrivate::slotPopupRestoreTrashedItems()
|
void KonqPopupMenuPrivate::slotPopupRestoreTrashedItems()
|
||||||
|
@ -580,7 +580,7 @@ void KonqPopupMenuPrivate::slotShowOriginalFile()
|
||||||
}
|
}
|
||||||
// Now destUrl points to the target file, let's go up to parent dir
|
// Now destUrl points to the target file, let's go up to parent dir
|
||||||
destUrl.setPath(destUrl.directory());
|
destUrl.setPath(destUrl.directory());
|
||||||
KRun::runUrl(destUrl, "inode/directory", m_parentWidget);
|
KToolInvocation::self()->startServiceForUrl(destUrl.url(), m_parentWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_konq_popupmenu.cpp"
|
#include "moc_konq_popupmenu.cpp"
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
#include <Solid/OpticalDrive>
|
#include <Solid/OpticalDrive>
|
||||||
#include <Solid/PowerManagement>
|
#include <Solid/PowerManagement>
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
#include <KRun>
|
#include <KToolInvocation>
|
||||||
#include <KDiskFreeSpaceInfo>
|
#include <KDiskFreeSpaceInfo>
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ void DeviceNotifierWidget::slotIconActivated()
|
||||||
mountpoint = solidstorageacces->filePath();
|
mountpoint = solidstorageacces->filePath();
|
||||||
}
|
}
|
||||||
if (!mountpoint.isEmpty()) {
|
if (!mountpoint.isEmpty()) {
|
||||||
KRun::runUrl(KUrl(mountpoint), "inode/directory", nullptr);
|
KToolInvocation::self()->startServiceForUrl(mountpoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KMenu>
|
#include <KMenu>
|
||||||
#include <KPropertiesDialog>
|
#include <KPropertiesDialog>
|
||||||
#include <KRun>
|
#include <KToolInvocation>
|
||||||
#include <KSharedConfig>
|
#include <KSharedConfig>
|
||||||
#include <KShell>
|
#include <KShell>
|
||||||
#include <KSycoca>
|
#include <KSycoca>
|
||||||
|
@ -258,11 +258,10 @@ void IconApplet::openUrl()
|
||||||
{
|
{
|
||||||
if (m_service) {
|
if (m_service) {
|
||||||
emit releaseVisualFocus();
|
emit releaseVisualFocus();
|
||||||
KUrl::List urls;
|
KToolInvocation::self()->startServiceByStorageId(m_service->entryPath());
|
||||||
KRun::run(*m_service, urls, 0);
|
|
||||||
} else if (m_url.isValid()) {
|
} else if (m_url.isValid()) {
|
||||||
emit releaseVisualFocus();
|
emit releaseVisualFocus();
|
||||||
new KRun(m_url, 0);
|
KToolInvocation::self()->startServiceForUrl(m_url.url());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,7 +420,7 @@ void IconApplet::dropEvent(QGraphicsSceneDragDropEvent *event)
|
||||||
constraintsEvent(Plasma::FormFactorConstraint);
|
constraintsEvent(Plasma::FormFactorConstraint);
|
||||||
return;
|
return;
|
||||||
} else if (m_service) {
|
} else if (m_service) {
|
||||||
KRun::run(*m_service, urls, 0);
|
KToolInvocation::self()->startServiceByStorageId(m_service->entryPath(), urls.toStringList());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,24 +432,21 @@ void IconApplet::dropEvent(QGraphicsSceneDragDropEvent *event)
|
||||||
KDesktopFile::isDesktopFile(m_url.toLocalFile()))) {
|
KDesktopFile::isDesktopFile(m_url.toLocalFile()))) {
|
||||||
|
|
||||||
if (KDesktopFile::isDesktopFile(m_url.toLocalFile())) {
|
if (KDesktopFile::isDesktopFile(m_url.toLocalFile())) {
|
||||||
//Extract the command from the Desktop file
|
KToolInvocation::self()->startServiceByStorageId(m_url.toLocalFile(), urls.toStringList());
|
||||||
KService service(m_url.toLocalFile());
|
|
||||||
KRun::run(service, urls, 0);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Just exec the local executable
|
// Just exec the local executable
|
||||||
QString params;
|
QStringList params;
|
||||||
foreach (const KUrl &url, urls) {
|
foreach (const KUrl &url, urls) {
|
||||||
if (url.isLocalFile()) {
|
if (url.isLocalFile()) {
|
||||||
params += ' ' + KShell::quoteArg(url.toLocalFile());
|
params << url.toLocalFile();
|
||||||
} else {
|
} else {
|
||||||
params += ' ' + KShell::quoteArg(url.prettyUrl());
|
params << url.prettyUrl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString commandStr = KShell::quoteArg(m_url.path());
|
KToolInvocation::self()->startProgram(m_url.path(), params);
|
||||||
KRun::runCommand(commandStr + ' ' + params, 0);
|
|
||||||
} else if (mimetype && mimetype->is("inode/directory")) {
|
} else if (mimetype && mimetype->is("inode/directory")) {
|
||||||
dropUrls(urls, m_url, event->modifiers());
|
dropUrls(urls, m_url, event->modifiers());
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,20 +102,14 @@ static void kRunService(const QString &entrypath, LauncherApplet* launcherapplet
|
||||||
{
|
{
|
||||||
Q_ASSERT(launcherapplet != nullptr);
|
Q_ASSERT(launcherapplet != nullptr);
|
||||||
launcherapplet->resetState();
|
launcherapplet->resetState();
|
||||||
|
KToolInvocation::self()->startServiceByStorageId(entrypath);
|
||||||
KService::Ptr service = KService::serviceByDesktopPath(entrypath);
|
|
||||||
Q_ASSERT(!service.isNull());
|
|
||||||
if (!KRun::run(*service.data(), KUrl::List(), nullptr)) {
|
|
||||||
kWarning() << "could not run" << entrypath;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void kRunUrl(const QString &urlpath, LauncherApplet* launcherapplet)
|
static void kRunUrl(const QString &urlpath, LauncherApplet* launcherapplet)
|
||||||
{
|
{
|
||||||
Q_ASSERT(launcherapplet != nullptr);
|
Q_ASSERT(launcherapplet != nullptr);
|
||||||
launcherapplet->resetState();
|
launcherapplet->resetState();
|
||||||
|
KToolInvocation::self()->startServiceForUrl(urlpath);
|
||||||
(void)new KRun(KUrl(urlpath), nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static KIcon kGenericIcon(const QString &name)
|
static KIcon kGenericIcon(const QString &name)
|
||||||
|
@ -1827,11 +1821,8 @@ KBookmarkManager* LauncherApplet::bookmarkManager() const
|
||||||
|
|
||||||
void LauncherApplet::slotEditMenu()
|
void LauncherApplet::slotEditMenu()
|
||||||
{
|
{
|
||||||
if (KToolInvocation::self()->kdeinitExec("kmenuedit") == 0) {
|
hidePopup();
|
||||||
hidePopup();
|
KToolInvocation::self()->startServiceByStorageId("kmenuedit");
|
||||||
} else {
|
|
||||||
showMessage(KIcon("dialog-error"), i18n("Failed to launch menu editor"), Plasma::MessageButton::ButtonOk);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherApplet::slotConfigAccepted()
|
void LauncherApplet::slotConfigAccepted()
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <QGraphicsGridLayout>
|
#include <QGraphicsGridLayout>
|
||||||
#include <Plasma/Animation>
|
#include <Plasma/Animation>
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KRun>
|
#include <KToolInvocation>
|
||||||
#include <KIconLoader>
|
#include <KIconLoader>
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
#include <KMimeType>
|
#include <KMimeType>
|
||||||
|
@ -224,9 +224,7 @@ void JobFrame::slotIcon0Activated()
|
||||||
void JobFrame::slotIcon1Activated()
|
void JobFrame::slotIcon1Activated()
|
||||||
{
|
{
|
||||||
const KUrl desturl = KUrl(m_iconwidget1->property("_k_desturl").toString());
|
const KUrl desturl = KUrl(m_iconwidget1->property("_k_desturl").toString());
|
||||||
const KMimeType::Ptr kmimetype = KMimeType::findByUrl(desturl);
|
KToolInvocation::self()->startServiceForUrl(desturl.url());
|
||||||
Q_ASSERT(kmimetype);
|
|
||||||
KRun::runUrl(desturl, kmimetype->name(), nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,16 +19,13 @@
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "launcher.h"
|
#include "launcher.h"
|
||||||
|
|
||||||
// Qt
|
// Katie
|
||||||
#include <QtCore/qnamespace.h>
|
#include <QtCore/qnamespace.h>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QtGui/qgraphicssceneevent.h>
|
#include <QtGui/qgraphicssceneevent.h>
|
||||||
#include <QtGui/qgraphicssceneevent.h>
|
|
||||||
|
|
||||||
// KDE
|
// KDE
|
||||||
#include <KRun>
|
#include <KToolInvocation>
|
||||||
|
|
||||||
// Plasma
|
|
||||||
#include <Plasma/ToolTipContent>
|
#include <Plasma/ToolTipContent>
|
||||||
#include <Plasma/ToolTipManager>
|
#include <Plasma/ToolTipManager>
|
||||||
|
|
||||||
|
@ -97,7 +94,7 @@ KUrl Launcher::url() const
|
||||||
|
|
||||||
void Launcher::execute()
|
void Launcher::execute()
|
||||||
{
|
{
|
||||||
new KRun(m_data.url(), 0);
|
KToolInvocation::self()->startServiceForUrl(m_data.url().url());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Launcher::toolTipAboutToShow()
|
void Launcher::toolTipAboutToShow()
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KNotification>
|
#include <KNotification>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <KRun>
|
#include <KToolInvocation>
|
||||||
#include <KSharedConfig>
|
#include <KSharedConfig>
|
||||||
#include <KStandardDirs>
|
#include <KStandardDirs>
|
||||||
#include <KUrl>
|
#include <KUrl>
|
||||||
|
@ -187,7 +187,7 @@ void Trash::constraintsEvent(Plasma::Constraints constraints)
|
||||||
void Trash::open()
|
void Trash::open()
|
||||||
{
|
{
|
||||||
emit releaseVisualFocus();
|
emit releaseVisualFocus();
|
||||||
KRun::runUrl(KUrl("trash:/"), "inode/directory", 0);
|
KToolInvocation::self()->startServiceForUrl(QString::fromLatin1("trash:/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Trash::empty()
|
void Trash::empty()
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
#include <KRun>
|
#include <KToolInvocation>
|
||||||
#include <Plasma/Containment>
|
#include <Plasma/Containment>
|
||||||
|
|
||||||
AppLauncher::AppLauncher(QObject *parent, const QVariantList &args)
|
AppLauncher::AppLauncher(QObject *parent, const QVariantList &args)
|
||||||
|
@ -101,7 +101,7 @@ void AppLauncher::switchTo(QAction *action)
|
||||||
{
|
{
|
||||||
const QString entrypath = action->data().toString();
|
const QString entrypath = action->data().toString();
|
||||||
kDebug() << "running" << entrypath;
|
kDebug() << "running" << entrypath;
|
||||||
new KRun(KUrl(entrypath), nullptr);
|
KToolInvocation::self()->startServiceByStorageId(entrypath);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_launch.cpp"
|
#include "moc_launch.cpp"
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
|
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
#include <KRun>
|
#include <KToolInvocation>
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KMimeType>
|
#include <KMimeType>
|
||||||
#include <KShell>
|
#include <KShell>
|
||||||
|
@ -30,8 +30,6 @@
|
||||||
#include <KProtocolInfo>
|
#include <KProtocolInfo>
|
||||||
#include <KUriFilter>
|
#include <KUriFilter>
|
||||||
|
|
||||||
#include <kservicetypetrader.h>
|
|
||||||
|
|
||||||
|
|
||||||
LocationsRunner::LocationsRunner(QObject *parent, const QVariantList& args)
|
LocationsRunner::LocationsRunner(QObject *parent, const QVariantList& args)
|
||||||
: Plasma::AbstractRunner(parent, args)
|
: Plasma::AbstractRunner(parent, args)
|
||||||
|
@ -123,9 +121,8 @@ void LocationsRunner::run(const Plasma::QueryMatch &match)
|
||||||
|
|
||||||
// kDebug() << "url: " << location << data;
|
// kDebug() << "url: " << location << data;
|
||||||
|
|
||||||
KUrl urlToRun(KUriFilter::self()->filteredUri(location, QStringList() << QLatin1String("kshorturifilter")));
|
KUrl urlToRun = KUriFilter::self()->filteredUri(location, QStringList() << QLatin1String("kshorturifilter"));
|
||||||
|
KToolInvocation::self()->startServiceForUrl(urlToRun.url());
|
||||||
new KRun(urlToRun, nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QMimeData* LocationsRunner::mimeDataForMatch(const Plasma::QueryMatch &match)
|
QMimeData* LocationsRunner::mimeDataForMatch(const Plasma::QueryMatch &match)
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
#include <KRun>
|
#include <KToolInvocation>
|
||||||
#include <KUrl>
|
#include <KUrl>
|
||||||
|
|
||||||
//Q_DECLARE_METATYPE(Plasma::RunnerContext)
|
//Q_DECLARE_METATYPE(Plasma::RunnerContext)
|
||||||
|
@ -127,7 +127,7 @@ void PlacesRunner::run(const Plasma::QueryMatch &action)
|
||||||
{
|
{
|
||||||
//I don't just pass the model index because the list could change before the user clicks on it, which would make everything go wrong. Ideally we don't want things to go wrong.
|
//I don't just pass the model index because the list could change before the user clicks on it, which would make everything go wrong. Ideally we don't want things to go wrong.
|
||||||
if (action.data().canConvert<KUrl>()) {
|
if (action.data().canConvert<KUrl>()) {
|
||||||
new KRun(action.data().value<KUrl>().url(), 0);
|
KToolInvocation::self()->startServiceForUrl(action.data().value<KUrl>().url());
|
||||||
} else if (action.data().canConvert<QString>()) {
|
} else if (action.data().canConvert<QString>()) {
|
||||||
//search our list for the device with the same udi, then set it up (mount it).
|
//search our list for the device with the same udi, then set it up (mount it).
|
||||||
QString deviceUdi = action.data().toString();
|
QString deviceUdi = action.data().toString();
|
||||||
|
@ -158,7 +158,7 @@ void PlacesRunner::setupComplete(QModelIndex index, bool success)
|
||||||
KFilePlacesModel *places = qobject_cast<KFilePlacesModel*>(sender());
|
KFilePlacesModel *places = qobject_cast<KFilePlacesModel*>(sender());
|
||||||
//kDebug() << "setup complete" << places << sender();
|
//kDebug() << "setup complete" << places << sender();
|
||||||
if (success && places) {
|
if (success && places) {
|
||||||
new KRun(places->url(index), 0);
|
KToolInvocation::self()->startServiceForUrl(places->url(index).url());
|
||||||
places->deleteLater();
|
places->deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
#include <KDirWatch>
|
#include <KDirWatch>
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
#include <KRun>
|
#include <KToolInvocation>
|
||||||
#include <KRecentDocument>
|
#include <KRecentDocument>
|
||||||
|
|
||||||
RecentDocuments::RecentDocuments(QObject *parent, const QVariantList &args)
|
RecentDocuments::RecentDocuments(QObject *parent, const QVariantList &args)
|
||||||
|
@ -95,7 +95,7 @@ void RecentDocuments::run(const Plasma::QueryMatch &match)
|
||||||
{
|
{
|
||||||
const QString url = match.data().toString();
|
const QString url = match.data().toString();
|
||||||
kDebug() << "Opening Recent Document" << url;
|
kDebug() << "Opening Recent Document" << url;
|
||||||
new KRun(url, 0);
|
KToolInvocation::self()->startServiceForUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
QMimeData* RecentDocuments::mimeDataForMatch(const Plasma::QueryMatch &match)
|
QMimeData* RecentDocuments::mimeDataForMatch(const Plasma::QueryMatch &match)
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KRun>
|
#include <KToolInvocation>
|
||||||
#include <KService>
|
#include <KService>
|
||||||
#include <KServiceTypeTrader>
|
#include <KServiceTypeTrader>
|
||||||
#include <KUrl>
|
#include <KUrl>
|
||||||
|
@ -191,10 +191,7 @@ void ServiceRunner::match(Plasma::RunnerContext &context)
|
||||||
|
|
||||||
void ServiceRunner::run(const Plasma::QueryMatch &match)
|
void ServiceRunner::run(const Plasma::QueryMatch &match)
|
||||||
{
|
{
|
||||||
KService::Ptr service = KService::serviceByStorageId(match.data().toString());
|
KToolInvocation::self()->startServiceByStorageId(match.data().toString());
|
||||||
if (service) {
|
|
||||||
KRun::run(*service, KUrl::List(), nullptr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QMimeData * ServiceRunner::mimeDataForMatch(const Plasma::QueryMatch &match)
|
QMimeData * ServiceRunner::mimeDataForMatch(const Plasma::QueryMatch &match)
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KRun>
|
|
||||||
#include <KShell>
|
#include <KShell>
|
||||||
#include <KStandardDirs>
|
#include <KStandardDirs>
|
||||||
#include <KToolInvocation>
|
#include <KToolInvocation>
|
||||||
|
@ -66,7 +65,7 @@ void ShellRunner::run(const Plasma::QueryMatch &match)
|
||||||
if (interminal) {
|
if (interminal) {
|
||||||
KToolInvocation::self()->invokeTerminal(command);
|
KToolInvocation::self()->invokeTerminal(command);
|
||||||
} else {
|
} else {
|
||||||
KRun::runCommand(command, nullptr);
|
KToolInvocation::self()->startProgram(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -233,7 +233,7 @@ void SolidRunner::run(const Plasma::QueryMatch &match)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const QString actionexe = actioncommand.takeFirst();
|
const QString actionexe = actioncommand.takeFirst();
|
||||||
const int actionresult = KToolInvocation::self()->kdeinitExec(actionexe, actioncommand);
|
const int actionresult = KToolInvocation::self()->startProgram(actionexe, actioncommand);
|
||||||
if (actionresult != 0) {
|
if (actionresult != 0) {
|
||||||
kWarning() << "could not execute action for" << actionname << "in" << actionfilepath << actionresult;
|
kWarning() << "could not execute action for" << actionname << "in" << actionfilepath << actionresult;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1018,7 +1018,7 @@ void PlasmaApp::restoreClients()
|
||||||
}
|
}
|
||||||
QString program = restartcommand.takeFirst();
|
QString program = restartcommand.takeFirst();
|
||||||
kDebug() << "restoring client" << program << restartcommand;
|
kDebug() << "restoring client" << program << restartcommand;
|
||||||
KToolInvocation::self()->kdeinitExec(program, restartcommand);
|
KToolInvocation::self()->startProgram(program, restartcommand);
|
||||||
}
|
}
|
||||||
sessiongroup.deleteGroup();
|
sessiongroup.deleteGroup();
|
||||||
sessiongroup.sync();
|
sessiongroup.sync();
|
||||||
|
@ -1159,12 +1159,12 @@ void PlasmaApp::logout(int confirm, int sdtype)
|
||||||
|
|
||||||
void PlasmaApp::captureDesktop()
|
void PlasmaApp::captureDesktop()
|
||||||
{
|
{
|
||||||
KToolInvocation::self()->kdeinitExec("ksnapshot", QStringList() << "--fullscreen");
|
KToolInvocation::self()->startProgram("ksnapshot", QStringList() << "--fullscreen");
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlasmaApp::captureCurrentWindow()
|
void PlasmaApp::captureCurrentWindow()
|
||||||
{
|
{
|
||||||
KToolInvocation::self()->kdeinitExec("ksnapshot", QStringList() << "--current");
|
KToolInvocation::self()->startProgram("ksnapshot", QStringList() << "--current");
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlasmaApp::cleanup()
|
void PlasmaApp::cleanup()
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
#include <KStandardDirs>
|
#include <KStandardDirs>
|
||||||
#include <KImageIO>
|
#include <KImageIO>
|
||||||
#include <KIO/Job>
|
#include <KIO/Job>
|
||||||
#include <krun.h>
|
#include <KToolInvocation>
|
||||||
|
|
||||||
#include <Plasma/Theme>
|
#include <Plasma/Theme>
|
||||||
|
|
||||||
#include "backgroundlistmodel.h"
|
#include "backgroundlistmodel.h"
|
||||||
#include "backgrounddelegate.h"
|
#include "backgrounddelegate.h"
|
||||||
#include "removebuttonmanager.h"
|
#include "removebuttonmanager.h"
|
||||||
|
@ -751,9 +751,8 @@ void Image::openSlide()
|
||||||
}
|
}
|
||||||
|
|
||||||
// open in image viewer
|
// open in image viewer
|
||||||
KUrl filepath(m_wallpaperPackage->filePath("preferred"));
|
//kDebug() << "opening file " << m_wallpaperPackage->filePath("preferred");
|
||||||
//kDebug() << "opening file " << filepath.path();
|
KToolInvocation::self()->startServiceForUrl(m_wallpaperPackage->filePath("preferred"));
|
||||||
new KRun(filepath, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Image::renderWallpaper(const QString& image)
|
void Image::renderWallpaper(const QString& image)
|
||||||
|
|
|
@ -111,9 +111,9 @@ static void kExecuteAction(const KServiceAction &kserviceaction, const Solid::De
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const QString actionexe = actioncommand.takeFirst();
|
const QString actionexe = actioncommand.takeFirst();
|
||||||
const int actionresult = KToolInvocation::self()->kdeinitExec(actionexe, actioncommand);
|
const bool actionresult = KToolInvocation::self()->startProgram(actionexe, actioncommand);
|
||||||
if (actionresult != 0) {
|
if (!actionresult) {
|
||||||
kWarning() << "could not execute action for" << kserviceaction.name() << actionresult;
|
kWarning() << "could not execute action for" << kserviceaction.name();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,9 @@
|
||||||
|
|
||||||
#include "ExternalAppModule.h"
|
#include "ExternalAppModule.h"
|
||||||
|
|
||||||
#include <QtGui/QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
#include <KCModuleInfo>
|
#include <KCModuleInfo>
|
||||||
#include <KRun>
|
#include <KToolInvocation>
|
||||||
|
|
||||||
ExternalAppModule::ExternalAppModule(QWidget * parent, KCModuleInfo * module)
|
ExternalAppModule::ExternalAppModule(QWidget * parent, KCModuleInfo * module)
|
||||||
{
|
{
|
||||||
|
@ -51,7 +50,9 @@ void ExternalAppModule::showEvent(QShowEvent * event)
|
||||||
|
|
||||||
void ExternalAppModule::runExternal()
|
void ExternalAppModule::runExternal()
|
||||||
{
|
{
|
||||||
KRun::run( *(moduleInfo->service()), KUrl::List(), qApp->activeWindow() ); // Launch it!
|
KToolInvocation::self()->startServiceByStorageId(
|
||||||
|
moduleInfo->service()->entryPath(), QStringList(), qApp->activeWindow()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_ExternalAppModule.cpp"
|
#include "moc_ExternalAppModule.cpp"
|
||||||
|
|
Loading…
Add table
Reference in a new issue