2016-09-27 13:37:18 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-09-27 13:37:18 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-09-27 13:37:18 +00:00
|
|
|
*/
|
|
|
|
#include "history/history_location_manager.h"
|
|
|
|
|
|
|
|
#include "mainwidget.h"
|
2020-10-28 21:29:48 +00:00
|
|
|
#include "core/click_handler_types.h"
|
2017-04-13 08:27:10 +00:00
|
|
|
#include "lang/lang_keys.h"
|
2018-10-23 09:44:42 +00:00
|
|
|
#include "ui/image/image.h"
|
2019-01-04 11:09:48 +00:00
|
|
|
#include "data/data_file_origin.h"
|
2017-03-04 10:23:56 +00:00
|
|
|
#include "platform/platform_specific.h"
|
2016-09-27 13:37:18 +00:00
|
|
|
|
2018-01-25 10:10:52 +00:00
|
|
|
QString LocationClickHandler::copyToClipboardText() const {
|
|
|
|
return _text;
|
|
|
|
}
|
|
|
|
|
2016-09-27 13:37:18 +00:00
|
|
|
QString LocationClickHandler::copyToClipboardContextItemText() const {
|
2019-06-19 15:09:03 +00:00
|
|
|
return tr::lng_context_copy_link(tr::now);
|
2016-09-27 13:37:18 +00:00
|
|
|
}
|
|
|
|
|
2018-07-09 18:13:48 +00:00
|
|
|
void LocationClickHandler::onClick(ClickContext context) const {
|
2019-06-21 12:27:46 +00:00
|
|
|
if (!psLaunchMaps(_point)) {
|
2020-10-28 21:29:48 +00:00
|
|
|
UrlClickHandler::Open(_text);
|
2016-09-27 13:37:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void LocationClickHandler::setup() {
|
2019-06-21 12:27:46 +00:00
|
|
|
_text = Url(_point);
|
2019-06-14 16:04:45 +00:00
|
|
|
}
|
|
|
|
|
2019-06-21 12:27:46 +00:00
|
|
|
QString LocationClickHandler::Url(const Data::LocationPoint &point) {
|
|
|
|
const auto latlon = point.latAsString() + ',' + point.lonAsString();
|
2019-06-14 16:04:45 +00:00
|
|
|
return qsl("https://maps.google.com/maps?q=") + latlon + qsl("&ll=") + latlon + qsl("&z=16");
|
2016-09-27 13:37:18 +00:00
|
|
|
}
|