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::UserInput) { // anyime the user has manually looked up an address we know we should clear the forward stack _forwardStack.clear(); emit goForwardPossible(false); } 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 if (_forwardStack.size() == 0) { emit goForwardPossible(true); } // when the user is going back, we move the current address to the forward stack // and do not but it into the back stack _forwardStack.push(currentAddress()); } else { // we're about to push to the back stack // if it's currently empty emit our signal to say that going forward is now possible if (_forwardStack.size() == 0) { emit goBackPossible(true); } // unless this was triggered from the result of a named path lookup, add the current address to the history _backStack.push(currentAddress()); } } }
void AddressManager::storeCurrentAddress() { QSettings settings; settings.beginGroup(ADDRESS_MANAGER_SETTINGS_GROUP); settings.setValue(SETTINGS_CURRENT_ADDRESS_KEY, currentAddress()); settings.endGroup(); }
void Bookmarks::bookmarkLocation() { bool ok = false; auto bookmarkName = OffscreenUi::getText(OffscreenUi::ICON_PLACEMARK, "Bookmark Location", "Name", QString(), &ok); if (!ok) { return; } bookmarkName = bookmarkName.trimmed().replace(QRegExp("(\r\n|[\r\n\t\v ])+"), " "); if (bookmarkName.length() == 0) { return; } auto addressManager = DependencyManager::get<AddressManager>(); QString bookmarkAddress = addressManager->currentAddress().toString(); Menu* menubar = Menu::getInstance(); if (contains(bookmarkName)) { auto offscreenUi = DependencyManager::get<OffscreenUi>(); auto duplicateBookmarkMessage = offscreenUi->createMessageBox(OffscreenUi::ICON_WARNING, "Duplicate Bookmark", "The bookmark name you entered already exists in your list.", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); duplicateBookmarkMessage->setProperty("informativeText", "Would you like to overwrite it?"); auto result = offscreenUi->waitForMessageBoxResult(duplicateBookmarkMessage); if (result != QMessageBox::Yes) { return; } removeLocationFromMenu(menubar, bookmarkName); } addLocationToMenu(menubar, bookmarkName, bookmarkAddress); insert(bookmarkName, bookmarkAddress); // Overwrites any item with the same bookmarkName. enableMenuItems(true); }
void AddressManager::storeCurrentAddress() { currentAddressHandle.set(currentAddress()); }
void AddressManager::copyAddress() { QApplication::clipboard()->setText(currentAddress().toString()); }
void AddressManager::storeCurrentAddress() { SettingHandles::currentAddress.set(currentAddress()); }