Fix AddressManager not always storing history when it should

This commit is contained in:
Ryan Huffman 2016-05-04 15:46:26 -07:00
parent fde1f0740c
commit f213a059fb
2 changed files with 11 additions and 9 deletions

View file

@ -310,7 +310,7 @@ void AddressManager::goToAddressFromObject(const QVariantMap& dataObject, const
if (!returnedPath.isEmpty()) {
if (shouldFaceViewpoint) {
// try to parse this returned path as a viewpoint, that's the only thing it could be for now
if (!handleViewpoint(returnedPath, shouldFaceViewpoint)) {
if (!handleViewpoint(returnedPath, shouldFaceViewpoint, trigger)) {
qCDebug(networking) << "Received a location path that was could not be handled as a viewpoint -"
<< returnedPath;
}
@ -446,7 +446,7 @@ bool AddressManager::handleDomainID(const QString& host) {
}
void AddressManager::handlePath(const QString& path, LookupTrigger trigger, bool wasPathOnly) {
if (!handleViewpoint(path, false, wasPathOnly)) {
if (!handleViewpoint(path, false, trigger, wasPathOnly)) {
qCDebug(networking) << "User entered path could not be handled as a viewpoint - " << path <<
"- wll attempt to ask domain-server to resolve.";
@ -463,7 +463,7 @@ void AddressManager::handlePath(const QString& path, LookupTrigger trigger, bool
}
}
bool AddressManager::handleViewpoint(const QString& viewpointString, bool shouldFace,
bool AddressManager::handleViewpoint(const QString& viewpointString, bool shouldFace, LookupTrigger trigger,
bool definitelyPathOnly, const QString& pathString) {
const QString FLOAT_REGEX_STRING = "([-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?)";
const QString SPACED_COMMA_REGEX_STRING = "\\s*,\\s*";
@ -491,8 +491,9 @@ bool AddressManager::handleViewpoint(const QString& viewpointString, bool should
// before moving to a new host thanks to the information in the same lookup URL.
if (definitelyPathOnly || (!pathString.isEmpty() && pathString != _newHostLookupPath)) {
addCurrentAddressToHistory(LookupTrigger::UserInput);
if (definitelyPathOnly || (!pathString.isEmpty() && pathString != _newHostLookupPath)
|| trigger == Back || trigger == Forward) {
addCurrentAddressToHistory(trigger);
}
if (!isNaN(newPosition.x) && !isNaN(newPosition.y) && !isNaN(newPosition.z)) {
@ -599,7 +600,7 @@ void AddressManager::copyPath() {
void AddressManager::addCurrentAddressToHistory(LookupTrigger trigger) {
// if we're cold starting and this is called for the first address (from settings) we don't do anything
if (trigger != LookupTrigger::StartupFromSettings) {
if (trigger != LookupTrigger::StartupFromSettings && trigger != LookupTrigger::DomainPathResponse) {
if (trigger == LookupTrigger::Back) {
// we're about to push to the forward stack
// if it's currently empty emit our signal to say that going forward is now possible

View file

@ -46,7 +46,8 @@ public:
UserInput,
Back,
Forward,
StartupFromSettings
StartupFromSettings,
DomainPathResponse
};
bool isConnected();
@ -77,7 +78,7 @@ public slots:
// we currently expect this to be called from NodeList once handleLookupString has been called with a path
bool goToViewpointForPath(const QString& viewpointString, const QString& pathString)
{ return handleViewpoint(viewpointString, false, false, pathString); }
{ return handleViewpoint(viewpointString, false, DomainPathResponse, false, pathString); }
void goBack();
void goForward();
@ -125,7 +126,7 @@ private:
bool handleNetworkAddress(const QString& lookupString, LookupTrigger trigger);
void handlePath(const QString& path, LookupTrigger trigger, bool wasPathOnly = false);
bool handleViewpoint(const QString& viewpointString, bool shouldFace = false,
bool handleViewpoint(const QString& viewpointString, bool shouldFace, LookupTrigger trigger,
bool definitelyPathOnly = false, const QString& pathString = QString());
bool handleUsername(const QString& lookupString);
bool handleDomainID(const QString& host);