fix: relink to autostart when dekstopFile has been changed
Signed-off-by: ComixHe <heyuming@deepin.org>
This commit is contained in:
@ -386,9 +386,14 @@ void ApplicationManager1Service::updateApplication(const QSharedPointer<Applicat
|
||||
|
||||
if (destApp->m_entry != newEntry) {
|
||||
destApp->resetEntry(newEntry);
|
||||
destApp->m_desktopSource = std::move(desktopFile);
|
||||
destApp->detachAllInstance();
|
||||
}
|
||||
|
||||
if (destApp->m_desktopSource != desktopFile and destApp->isAutoStart()) {
|
||||
destApp->setAutoStart(false);
|
||||
destApp->m_desktopSource = std::move(desktopFile);
|
||||
destApp->setAutoStart(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ApplicationManager1Service::ReloadApplications()
|
||||
|
@ -421,12 +421,12 @@ qulonglong ApplicationService::lastLaunchedTime() const noexcept
|
||||
return m_lastLaunch;
|
||||
}
|
||||
|
||||
bool ApplicationService::autostartCheck(const QString &linkPath) noexcept
|
||||
bool ApplicationService::autostartCheck(const QString &linkPath) const noexcept
|
||||
{
|
||||
QFileInfo info{linkPath};
|
||||
|
||||
if (info.exists()) {
|
||||
if (info.isSymbolicLink()) {
|
||||
if (info.isSymbolicLink() and info.symLinkTarget() == m_desktopSource.sourcePath()) {
|
||||
return true;
|
||||
}
|
||||
qWarning() << "same name desktop file exists:" << linkPath << "but this may not created by AM.";
|
||||
|
@ -146,7 +146,7 @@ private:
|
||||
const QLocale &locale = getUserLocale()) const noexcept;
|
||||
void updateAfterLaunch(bool isLaunch) noexcept;
|
||||
static bool shouldBeShown(const std::unique_ptr<DesktopEntry> &entry) noexcept;
|
||||
static bool autostartCheck(const QString &linkPath) noexcept;
|
||||
[[nodiscard]] bool autostartCheck(const QString &linkPath) const noexcept;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user