[qt] Upload changes menu item & save auth keys.

This commit is contained in:
Alex Zolotarev 2016-01-15 09:48:15 +03:00 committed by Sergey Yershov
parent 38d511067b
commit 577155473f
2 changed files with 17 additions and 0 deletions

View file

@ -49,6 +49,10 @@
namespace qt
{
// Defined in osm_auth_dialog.cpp.
extern char const * kTokenKeySetting;
extern char const * kTokenSecretSetting;
MainWindow::MainWindow() : m_locationService(CreateDesktopLocationService(*this))
{
// Always runs on the first desktop
@ -91,6 +95,7 @@ MainWindow::MainWindow() : m_locationService(CreateDesktopLocationService(*this)
helpMenu->addAction(tr("About"), this, SLOT(OnAbout()));
helpMenu->addAction(tr("Preferences"), this, SLOT(OnPreferences()));
helpMenu->addAction(tr("OpenStreetMap Login"), this, SLOT(OnLoginMenuItem()));
helpMenu->addAction(tr("Upload Edits"), this, SLOT(OnUploadEditsMenuItem()));
#else
{
// create items in the system menu
@ -371,6 +376,17 @@ void MainWindow::OnLoginMenuItem()
dlg.exec();
}
void MainWindow::OnUploadEditsMenuItem()
{
string key, secret;
Settings::Get(kTokenKeySetting, key);
Settings::Get(kTokenSecretSetting, secret);
if (key.empty() || secret.empty())
OnLoginMenuItem();
else
osm::Editor::Instance().UploadChanges(key, secret, {{"created_by", "MAPS.ME " OMIM_OS_NAME}});
}
void MainWindow::OnBeforeEngineCreation()
{
m_pDrawWidget->GetFramework().SetMyPositionModeListener([this](location::EMyPositionMode mode)

View file

@ -69,6 +69,7 @@ namespace qt
void OnMyPosition();
void OnSearchButtonClicked();
void OnLoginMenuItem();
void OnUploadEditsMenuItem();
void OnBeforeEngineCreation();
};