Showing the changes to interface/src/Menu.cpp (1 of 2 files). Show all
Unified · Split
| @@ -927,42 +927,46 @@ void Menu::goTo() { · 926 unmodified lines | ||
| 927 | 927 | int dialogReturn = gotoDialog.exec(); |
| 928 | 928 | if (dialogReturn == QDialog::Accepted && !gotoDialog.textValue().isEmpty()) { |
| 929 | 929 | QString desiredDestination = gotoDialog.textValue(); |
| 930 | + if (!goToURL(desiredDestination)) {; | |
| 931 | + goTo(desiredDestination); | |
| 932 | + } | |
| 933 | + } | |
| 934 | + sendFakeEnterEvent(); | |
| 935 | +} | |
| 930 | 936 | |
| 931 | − if (desiredDestination.startsWith(CUSTOM_URL_SCHEME + "//")) { | |
| 932 | − QStringList urlParts = desiredDestination.remove(0, CUSTOM_URL_SCHEME.length() + 2).split('/', QString::SkipEmptyParts); | |
| 937 | +bool Menu::goToURL(QString location) { | |
| 938 | + if (location.startsWith(CUSTOM_URL_SCHEME + "//")) { | |
| 939 | + QStringList urlParts = location.remove(0, CUSTOM_URL_SCHEME.length() + 2).split('/', QString::SkipEmptyParts); | |
| 933 | 940 | |
| 934 | − if (urlParts.count() > 1) { | |
| 935 | − // if url has 2 or more parts, the first one is domain name | |
| 936 | − QString domain = urlParts[0]; | |
| 941 | + if (urlParts.count() > 1) { | |
| 942 | + // if url has 2 or more parts, the first one is domain name | |
| 943 | + QString domain = urlParts[0]; | |
| 937 | 944 | |
| 938 | − // second part is either a destination coordinate or | |
| 939 | − // a place name | |
| 940 | − QString destination = urlParts[1]; | |
| 945 | + // second part is either a destination coordinate or | |
| 946 | + // a place name | |
| 947 | + QString destination = urlParts[1]; | |
| 941 | 948 | |
| 942 | − // any third part is an avatar orientation. | |
| 943 | − QString orientation = urlParts.count() > 2 ? urlParts[2] : QString(); | |
| 949 | + // any third part is an avatar orientation. | |
| 950 | + QString orientation = urlParts.count() > 2 ? urlParts[2] : QString(); | |
| 944 | 951 | |
| 945 | − goToDomain(domain); | |
| 946 | − | |
| 947 | − // goto either @user, #place, or x-xx,y-yy,z-zz | |
| 948 | − // style co-ordinate. | |
| 949 | − goTo(destination); | |
| 952 | + goToDomain(domain); | |
| 950 | 953 | |
| 951 | − if (!orientation.isEmpty()) { | |
| 952 | − // location orientation | |
| 953 | − goToOrientation(orientation); | |
| 954 | − } | |
| 955 | − } else if (urlParts.count() == 1) { | |
| 956 | − // location coordinates or place name | |
| 957 | − QString destination = urlParts[0]; | |
| 958 | − goTo(destination); | |
| 959 | − } | |
| 954 | + // goto either @user, #place, or x-xx,y-yy,z-zz | |
| 955 | + // style co-ordinate. | |
| 956 | + goTo(destination); | |
| 960 | 957 | |
| 961 | − } else { | |
| 962 | − goToUser(gotoDialog.textValue()); | |
| 958 | + if (!orientation.isEmpty()) { | |
| 959 | + // location orientation | |
| 960 | + goToOrientation(orientation); | |
| 961 | + } | |
| 962 | + } else if (urlParts.count() == 1) { | |
| 963 | + // location coordinates or place name | |
| 964 | + QString destination = urlParts[0]; | |
| 965 | + goTo(destination); | |
| 963 | 966 | } |
| 967 | + return true; | |
| 964 | 968 | } |
| 965 | − sendFakeEnterEvent(); | |
| 969 | + return false; | |
| 966 | 970 | } |
| 967 | 971 | |
| 968 | 972 | void Menu::goToUser(const QString& user) { |