Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/krun.cpp
Show First 20 Lines • Show All 149 Lines • ▼ Show 20 Line(s) | 149 | if (!url.isLocalFile()) { | |||
---|---|---|---|---|---|
150 | return false; | 150 | return false; | ||
151 | } | 151 | } | ||
152 | 152 | | |||
153 | // While isExecutable performs similar check to this one, some users depend on | 153 | // While isExecutable performs similar check to this one, some users depend on | ||
154 | // this method not returning true for application/x-desktop | 154 | // this method not returning true for application/x-desktop | ||
155 | QMimeDatabase db; | 155 | QMimeDatabase db; | ||
156 | QMimeType mimeType = db.mimeTypeForName(mimetype); | 156 | QMimeType mimeType = db.mimeTypeForName(mimetype); | ||
157 | if (!mimeType.inherits(QStringLiteral("application/x-executable")) | 157 | if (!mimeType.inherits(QStringLiteral("application/x-executable")) | ||
158 | #ifdef Q_OS_WIN | | |||
159 | && !mimeType.inherits(QStringLiteral("application/x-ms-dos-executable")) | 158 | && !mimeType.inherits(QStringLiteral("application/x-ms-dos-executable")) | ||
160 | #endif | | |||
161 | && !mimeType.inherits(QStringLiteral("application/x-executable-script")) | 159 | && !mimeType.inherits(QStringLiteral("application/x-executable-script")) | ||
162 | && !mimeType.inherits(QStringLiteral("application/x-sharedlib"))) { | 160 | && !mimeType.inherits(QStringLiteral("application/x-sharedlib"))) { | ||
163 | return false; | 161 | return false; | ||
164 | } | 162 | } | ||
165 | 163 | | |||
166 | if (!hasExecuteBit(url.toLocalFile())) { | 164 | if (!hasExecuteBit(url.toLocalFile())) { | ||
167 | return false; | 165 | return false; | ||
168 | } | 166 | } | ||
▲ Show 20 Lines • Show All 936 Lines • ▼ Show 20 Line(s) | |||||
1105 | } | 1103 | } | ||
1106 | 1104 | | |||
1107 | void KRun::KRunPrivate::onDialogFinished(int result, bool isDontAskAgainSet) | 1105 | void KRun::KRunPrivate::onDialogFinished(int result, bool isDontAskAgainSet) | ||
1108 | { | 1106 | { | ||
1109 | if (result == ExecutableFileOpenDialog::Rejected) { | 1107 | if (result == ExecutableFileOpenDialog::Rejected) { | ||
1110 | m_bFinished = true; | 1108 | m_bFinished = true; | ||
1111 | m_bInit = false; | 1109 | m_bInit = false; | ||
1112 | startTimer(); | 1110 | startTimer(); | ||
1113 | return; | 1111 | return; | ||
dfaure: should this be in ifdef Q_OS_WIN?
On windows, *.exe is executed, not opened (with e.g. wine) | |||||
guoyunhe: Yes, I updated this part. | |||||
1114 | } | 1112 | } | ||
1115 | q->setRunExecutables(result == ExecutableFileOpenDialog::ExecuteFile); | 1113 | q->setRunExecutables(result == ExecutableFileOpenDialog::ExecuteFile); | ||
1116 | 1114 | | |||
1117 | if (isDontAskAgainSet) { | 1115 | if (isDontAskAgainSet) { | ||
1118 | QString output = result == ExecutableFileOpenDialog::OpenFile ? QStringLiteral("open") : QStringLiteral("execute"); | 1116 | QString output = result == ExecutableFileOpenDialog::OpenFile ? QStringLiteral("open") : QStringLiteral("execute"); | ||
1119 | KConfigGroup cfgGroup(KSharedConfig::openConfig(QStringLiteral("kiorc")), "Executable scripts"); | 1117 | KConfigGroup cfgGroup(KSharedConfig::openConfig(QStringLiteral("kiorc")), "Executable scripts"); | ||
1120 | cfgGroup.writeEntry("behaviourOnLaunch", output); | 1118 | cfgGroup.writeEntry("behaviourOnLaunch", output); | ||
1121 | } | 1119 | } | ||
▲ Show 20 Lines • Show All 675 Lines • Show Last 20 Lines |
should this be in ifdef Q_OS_WIN?
On windows, *.exe is executed, not opened (with e.g. wine)