tdesktop/Telegram/SourceFiles/history/history_location_manager.cpp

39 lines
1.1 KiB
C++
Raw Normal View History

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "history/history_location_manager.h"
#include "mainwidget.h"
#include "core/click_handler_types.h"
2017-04-13 08:27:10 +00:00
#include "lang/lang_keys.h"
#include "ui/image/image.h"
#include "data/data_file_origin.h"
2017-03-04 10:23:56 +00:00
#include "platform/platform_specific.h"
QString LocationClickHandler::copyToClipboardText() const {
return _text;
}
QString LocationClickHandler::copyToClipboardContextItemText() const {
2019-06-19 15:09:03 +00:00
return tr::lng_context_copy_link(tr::now);
}
void LocationClickHandler::onClick(ClickContext context) const {
2019-06-21 12:27:46 +00:00
if (!psLaunchMaps(_point)) {
UrlClickHandler::Open(_text);
}
}
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");
}