Commit be6d3d96f941af9ba478d50bdb924f6cd0e5620a
- Diff rendering mode:
- inline
- side by side
src/settings.cpp
(10 / 2)
|   | |||
| 157 | 157 | expireHistory->setCurrentIndex(idx); | |
| 158 | 158 | settings.endGroup(); | |
| 159 | 159 | ||
| 160 | settings.beginGroup(QLatin1String("urlloading")); | ||
| 161 | bool search = settings.value(QLatin1String("searchEngineFallback"), false).toBool(); | ||
| 162 | searchEngineFallback->setChecked(search); | ||
| 163 | settings.endGroup(); | ||
| 164 | |||
| 160 | 165 | settings.beginGroup(QLatin1String("downloadmanager")); | |
| 161 | 166 | bool alwaysPromptForFileName = settings.value(QLatin1String("alwaysPromptForFileName"), false).toBool(); | |
| 162 | if (alwaysPromptForFileName) | ||
| 163 | downloadAsk->setChecked(true); | ||
| 167 | downloadAsk->setChecked(alwaysPromptForFileName); | ||
| 164 | 168 | QString downloadDirectory = settings.value(QLatin1String("downloadDirectory"), downloadsLocation->text()).toString(); | |
| 165 | 169 | downloadsLocation->setText(downloadDirectory); | |
| 166 | 170 | settings.endGroup(); | |
| … | … | ||
| 283 | 283 | case 6: idx = -2; break; | |
| 284 | 284 | } | |
| 285 | 285 | settings.setValue(QLatin1String("historyLimit"), idx); | |
| 286 | settings.endGroup(); | ||
| 287 | |||
| 288 | settings.beginGroup(QLatin1String("urlloading")); | ||
| 289 | settings.setValue(QLatin1String("searchEngineFallback"), searchEngineFallback->isChecked()); | ||
| 286 | 290 | settings.endGroup(); | |
| 287 | 291 | ||
| 288 | 292 | // Appearance |
src/settings.ui
(10 / 0)
|   | |||
| 149 | 149 | </item> | |
| 150 | 150 | </widget> | |
| 151 | 151 | </item> | |
| 152 | <item row="4" column="0" colspan="3"> | ||
| 153 | <widget class="QCheckBox" name="searchEngineFallback"> | ||
| 154 | <property name="text"> | ||
| 155 | <string>Use the default search engine as fallback when the URL given by the user is invalid</string> | ||
| 156 | </property> | ||
| 157 | <property name="checked"> | ||
| 158 | <bool>false</bool> | ||
| 159 | </property> | ||
| 160 | </widget> | ||
| 161 | </item> | ||
| 152 | 162 | <item row="5" column="0" colspan="3"> | |
| 153 | 163 | <widget class="QGroupBox" name="groupBox_2"> | |
| 154 | 164 | <property name="title"> |
src/tabwidget.cpp
(19 / 6)
|   | |||
| 70 | 70 | #include "browsermainwindow.h" | |
| 71 | 71 | #include "history.h" | |
| 72 | 72 | #include "historymanager.h" | |
| 73 | #include "tabbar.h" | ||
| 74 | 73 | #include "locationbar.h" | |
| 74 | #include "opensearchengine.h" | ||
| 75 | #include "opensearchmanager.h" | ||
| 76 | #include "tabbar.h" | ||
| 75 | 77 | #include "toolbarsearch.h" | |
| 76 | 78 | #include "webactionmapper.h" | |
| 77 | 79 | #include "webpage.h" | |
| … | … | ||
| 926 | 926 | QUrl TabWidget::guessUrlFromString(const QString &string) | |
| 927 | 927 | { | |
| 928 | 928 | QUrl url = WebView::guessUrlFromString(string); | |
| 929 | if (url.isValid()) | ||
| 929 | |||
| 930 | // QUrl::isValid() is too much tolerant. | ||
| 931 | // We actually want to check if the url conforms to the RFC, which QUrl::isValid() doesn't state. | ||
| 932 | if (!url.scheme().isEmpty() && !url.host().isEmpty()) | ||
| 930 | 933 | return url; | |
| 931 | 934 | ||
| 932 | // In the future we could do more fancy things such as automatically searching | ||
| 933 | // on the current search engine, looking through our history or something else. | ||
| 934 | QString urlString = QLatin1String("http://") + string; | ||
| 935 | return QUrl::fromEncoded(urlString.toUtf8(), QUrl::TolerantMode); | ||
| 935 | QSettings settings; | ||
| 936 | settings.beginGroup(QLatin1String("urlloading")); | ||
| 937 | bool search = settings.value(QLatin1String("searchEngineFallback"), false).toBool(); | ||
| 938 | |||
| 939 | if (search) { | ||
| 940 | url = ToolbarSearch::openSearchManager()->currentEngine()->searchUrl(string.trimmed()); | ||
| 941 | } else { | ||
| 942 | QString urlString = QLatin1String("http://") + string.trimmed(); | ||
| 943 | url = QUrl::fromEncoded(urlString.toUtf8(), QUrl::TolerantMode); | ||
| 944 | } | ||
| 945 | |||
| 946 | return url; | ||
| 936 | 947 | } | |
| 937 | 948 | ||
| 938 | 949 | /* |

