components: Remove splash screen close button support, due to crashing problems

This commit is contained in:
Devin Lin 2023-02-14 23:07:38 -08:00
parent 81c5dfc31f
commit f913039b63
3 changed files with 1 additions and 62 deletions

View file

@ -27,7 +27,6 @@
ShellUtil::ShellUtil(QObject *parent)
: QObject{parent}
, m_localeConfig{KSharedConfig::openConfig(QStringLiteral("kdeglobals"), KConfig::SimpleConfig)}
, m_launchingApp{nullptr}
{
m_localeConfigWatcher = KConfigWatcher::create(m_localeConfig);
@ -100,35 +99,4 @@ void ShellUtil::launchApp(const QString &storageId)
auto job = new KIO::ApplicationLauncherJob(service, this);
job->setUiDelegate(new KNotificationJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled));
job->start();
setLaunchingApp(job);
}
bool ShellUtil::isLaunchingApp()
{
return m_launchingApp != nullptr;
}
void ShellUtil::setLaunchingApp(KIO::ApplicationLauncherJob *launcherJob)
{
m_launchingAppPids = {};
m_launchingApp = launcherJob; // do not assume that the pointer is valid, KJobs destroy themselves
connect(launcherJob, &KIO::ApplicationLauncherJob::result, this, [this](auto *job) {
m_launchingAppPids = m_launchingApp->pids();
});
Q_EMIT isLaunchingAppChanged();
}
void ShellUtil::cancelLaunchingApp()
{
for (auto pid : m_launchingAppPids) {
QProcess::execute("kill", {QString::number(pid)});
}
clearLaunchingApp();
}
void ShellUtil::clearLaunchingApp()
{
m_launchingApp = nullptr;
Q_EMIT isLaunchingAppChanged();
}

View file

@ -23,7 +23,6 @@ class ShellUtil : public QObject
{
Q_OBJECT
Q_PROPERTY(bool isSystem24HourFormat READ isSystem24HourFormat NOTIFY isSystem24HourFormatChanged)
Q_PROPERTY(bool isLaunchingApp READ isLaunchingApp NOTIFY isLaunchingAppChanged)
public:
ShellUtil(QObject *parent = nullptr);
@ -64,33 +63,10 @@ public:
*/
Q_INVOKABLE bool isSystem24HourFormat();
/**
* Whether an application is being launched.
*/
Q_INVOKABLE bool isLaunchingApp();
/**
* Cancels an application launch by running `kill pid` for every associated pid of the launching app.
*/
Q_INVOKABLE void cancelLaunchingApp();
/**
* Clears the currently stored launching app.
*
* This should be called if the application window finally shows.
*/
Q_INVOKABLE void clearLaunchingApp();
Q_SIGNALS:
void isSystem24HourFormatChanged();
void isLaunchingAppChanged();
private:
void setLaunchingApp(KIO::ApplicationLauncherJob *launcherJob);
KConfigWatcher::Ptr m_localeConfigWatcher;
KSharedConfig::Ptr m_localeConfig;
KIO::ApplicationLauncherJob *m_launchingApp;
QVector<qint64> m_launchingAppPids;
};

View file

@ -83,7 +83,7 @@ MobileShell.NavigationPanel {
rightAction: MobileShell.NavigationPanelAction {
id: closeAppAction
enabled: Keyboards.KWinVirtualKeyboard.visible || root.taskSwitcher.visible || MobileShell.WindowUtil.hasCloseableActiveWindow || MobileShell.ShellUtil.isLaunchingApp
enabled: Keyboards.KWinVirtualKeyboard.visible || root.taskSwitcher.visible || MobileShell.WindowUtil.hasCloseableActiveWindow
iconSource: Keyboards.KWinVirtualKeyboard.visible ? "go-down-symbolic" : "mobile-close-app"
// mobile-close-app (from plasma-frameworks) seems to have less margins than icons from breeze-icons
iconSizeFactor: Keyboards.KWinVirtualKeyboard.visible ? 1 : 0.75
@ -103,11 +103,6 @@ MobileShell.NavigationPanel {
root.taskSwitcher.tasksModel.requestClose(root.taskSwitcher.tasksModel.activeTask);
}
MobileShellState.Shell.closeAppLaunchAnimation();
} else if (MobileShell.ShellUtil.isLaunchingApp) {
// cancel the launching of the app
MobileShellState.Shell.closeAppLaunchAnimation();
MobileShell.ShellUtil.cancelLaunchingApp();
}
}
}