Provide old version to Platform::NewVersionLaunched
This commit is contained in:
		
							parent
							
								
									e20840b4d4
								
							
						
					
					
						commit
						5fc7caeec9
					
				
					 8 changed files with 27 additions and 33 deletions
				
			
		|  | @ -233,9 +233,9 @@ void Application::run() { | |||
| 
 | ||||
| 	refreshGlobalProxy(); // Depends on app settings being read.
 | ||||
| 
 | ||||
| 	if (Local::oldSettingsVersion() < AppVersion) { | ||||
| 	if (const auto old = Local::oldSettingsVersion(); old < AppVersion) { | ||||
| 		RegisterUrlScheme(); | ||||
| 		psNewVersion(); | ||||
| 		Platform::NewVersionLaunched(old); | ||||
| 	} | ||||
| 
 | ||||
| 	if (cAutoStart() && !Platform::AutostartSupported()) { | ||||
|  |  | |||
|  | @ -622,6 +622,22 @@ bool OpenSystemSettings(SystemSettingsType type) { | |||
| 	return true; | ||||
| } | ||||
| 
 | ||||
| void NewVersionLaunched(int oldVersion) { | ||||
| 	InstallLauncher(); | ||||
| 	if (oldVersion > 0 | ||||
| 		&& oldVersion <= 4000002 | ||||
| 		&& qEnvironmentVariableIsSet("WAYLAND_DISPLAY") | ||||
| 		&& DesktopEnvironment::IsGnome() | ||||
| 		&& !QFile::exists(cWorkingDir() + qsl("tdata/nowayland"))) { | ||||
| 		QFile f(cWorkingDir() + qsl("tdata/nowayland")); | ||||
| 		if (f.open(QIODevice::WriteOnly)) { | ||||
| 			f.write("1"); | ||||
| 			f.close(); | ||||
| 			Core::Restart(); // restart with X backend
 | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| namespace ThirdParty { | ||||
| 
 | ||||
| void start() { | ||||
|  | @ -642,22 +658,6 @@ void finish() { | |||
| 
 | ||||
| } // namespace Platform
 | ||||
| 
 | ||||
| void psNewVersion() { | ||||
| 	Platform::InstallLauncher(); | ||||
| 	if (Local::oldSettingsVersion() > 0 | ||||
| 		&& Local::oldSettingsVersion() <= 4000002 | ||||
| 		&& qEnvironmentVariableIsSet("WAYLAND_DISPLAY") | ||||
| 		&& DesktopEnvironment::IsGnome() | ||||
| 		&& !QFile::exists(cWorkingDir() + qsl("tdata/nowayland"))) { | ||||
| 		QFile f(cWorkingDir() + qsl("tdata/nowayland")); | ||||
| 		if (f.open(QIODevice::WriteOnly)) { | ||||
| 			f.write("1"); | ||||
| 			f.close(); | ||||
| 			Core::Restart(); // restart with X backend
 | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void psSendToMenu(bool send, bool silent) { | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -48,8 +48,6 @@ void psSendToMenu(bool send, bool silent = false); | |||
| int psCleanup(); | ||||
| int psFixPrevious(); | ||||
| 
 | ||||
| void psNewVersion(); | ||||
| 
 | ||||
| inline QByteArray psDownloadPathBookmark(const QString &path) { | ||||
| 	return QByteArray(); | ||||
| } | ||||
|  |  | |||
|  | @ -58,8 +58,6 @@ void psSendToMenu(bool send, bool silent = false); | |||
| int psCleanup(); | ||||
| int psFixPrevious(); | ||||
| 
 | ||||
| void psNewVersion(); | ||||
| 
 | ||||
| void psDownloadPathEnableAccess(); | ||||
| QByteArray psDownloadPathBookmark(const QString &path); | ||||
| QByteArray psPathBookmark(const QString &path); | ||||
|  |  | |||
|  | @ -191,11 +191,11 @@ bool AutostartSkip() { | |||
| 	return !cAutoStart(); | ||||
| } | ||||
| 
 | ||||
| } // namespace Platform | ||||
| 
 | ||||
| void psNewVersion() { | ||||
| void NewVersionLaunched(int oldVersion) { | ||||
| } | ||||
| 
 | ||||
| } // namespace Platform | ||||
| 
 | ||||
| void psSendToMenu(bool send, bool silent) { | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -41,6 +41,7 @@ void AutostartToggle(bool enabled, Fn<void(bool)> done = nullptr); | |||
| bool TrayIconSupported(); | ||||
| bool SkipTaskbarSupported(); | ||||
| void WriteCrashDumpDetails(); | ||||
| void NewVersionLaunched(int oldVersion); | ||||
| 
 | ||||
| [[nodiscard]] std::optional<bool> IsDarkMode(); | ||||
| [[nodiscard]] inline bool IsDarkModeSupported() { | ||||
|  |  | |||
|  | @ -567,14 +567,11 @@ bool OpenSystemSettings(SystemSettingsType type) { | |||
| 	return true; | ||||
| } | ||||
| 
 | ||||
| } // namespace Platform
 | ||||
| 
 | ||||
| void psNewVersion() { | ||||
| 	if (Local::oldSettingsVersion() < 8051) { | ||||
| void NewVersionLaunched(int oldVersion) { | ||||
| 	if (oldVersion < 8051) { | ||||
| 		AppUserModelId::checkPinned(); | ||||
| 	} | ||||
| 	if (Local::oldSettingsVersion() > 0 | ||||
| 		&& Local::oldSettingsVersion() < 2008012) { | ||||
| 	if (oldVersion > 0 && oldVersion < 2008012) { | ||||
| 		// Reset icons cache, because we've changed the application icon.
 | ||||
| 		if (Dlls::SHChangeNotify) { | ||||
| 			Dlls::SHChangeNotify( | ||||
|  | @ -586,6 +583,8 @@ void psNewVersion() { | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| } // namespace Platform
 | ||||
| 
 | ||||
| void psSendToMenu(bool send, bool silent) { | ||||
| 	ManageAppLink(send, silent, CSIDL_SENDTO, L"-sendpath", L"Telegram send to link.\nYou can disable send to menu item in Telegram settings."); | ||||
| } | ||||
|  |  | |||
|  | @ -48,8 +48,6 @@ void psSendToMenu(bool send, bool silent = false); | |||
| int psCleanup(); | ||||
| int psFixPrevious(); | ||||
| 
 | ||||
| void psNewVersion(); | ||||
| 
 | ||||
| inline QByteArray psDownloadPathBookmark(const QString &path) { | ||||
| 	return QByteArray(); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Ilya Fedin
						Ilya Fedin