Changeset View
Changeset View
Standalone View
Standalone View
src/filewidgets/kurlnavigator.cpp
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | |||||
49 | #include <qmimedatabase.h> | 49 | #include <qmimedatabase.h> | ||
50 | #include <QMimeData> | 50 | #include <QMimeData> | ||
51 | #include <QHBoxLayout> | 51 | #include <QHBoxLayout> | ||
52 | 52 | | |||
53 | using namespace KDEPrivate; | 53 | using namespace KDEPrivate; | ||
54 | 54 | | |||
55 | struct LocationData { | 55 | struct LocationData { | ||
56 | QUrl url; | 56 | QUrl url; | ||
57 | #ifndef KIOFILEWIDGETS_NO_DEPRECATED | | |||
58 | QUrl rootUrl; // KDE5: remove after the deprecated methods have been removed | 57 | QUrl rootUrl; // KDE5: remove after the deprecated methods have been removed | ||
59 | QPoint pos; // KDE5: remove after the deprecated methods have been removed | 58 | QPoint pos; // KDE5: remove after the deprecated methods have been removed | ||
60 | #endif | | |||
61 | QByteArray state; | 59 | QByteArray state; | ||
62 | }; | 60 | }; | ||
63 | 61 | | |||
64 | class Q_DECL_HIDDEN KUrlNavigator::Private | 62 | class Q_DECL_HIDDEN KUrlNavigator::Private | ||
65 | { | 63 | { | ||
66 | public: | 64 | public: | ||
67 | Private(KUrlNavigator *q, KFilePlacesModel *placesModel); | 65 | Private(KUrlNavigator *q, KFilePlacesModel *placesModel); | ||
68 | 66 | | |||
▲ Show 20 Lines • Show All 1064 Lines • ▼ Show 20 Line(s) | |||||
1133 | { | 1131 | { | ||
1134 | if (isUrlEditable()) { | 1132 | if (isUrlEditable()) { | ||
1135 | d->m_pathBox->setFocus(); | 1133 | d->m_pathBox->setFocus(); | ||
1136 | } else { | 1134 | } else { | ||
1137 | QWidget::setFocus(); | 1135 | QWidget::setFocus(); | ||
1138 | } | 1136 | } | ||
1139 | } | 1137 | } | ||
1140 | 1138 | | |||
1141 | #ifndef KIOFILEWIDGETS_NO_DEPRECATED | | |||
1142 | void KUrlNavigator::setUrl(const QUrl &url) | 1139 | void KUrlNavigator::setUrl(const QUrl &url) | ||
1143 | { | 1140 | { | ||
1144 | // deprecated | 1141 | // deprecated | ||
1145 | setLocationUrl(url); | 1142 | setLocationUrl(url); | ||
1146 | } | 1143 | } | ||
1147 | #endif | | |||
1148 | 1144 | | |||
1149 | #ifndef KIOFILEWIDGETS_NO_DEPRECATED | | |||
1150 | void KUrlNavigator::saveRootUrl(const QUrl &url) | 1145 | void KUrlNavigator::saveRootUrl(const QUrl &url) | ||
1151 | { | 1146 | { | ||
1152 | // deprecated | 1147 | // deprecated | ||
1153 | d->m_history[d->m_historyIndex].rootUrl = url; | 1148 | d->m_history[d->m_historyIndex].rootUrl = url; | ||
1154 | } | 1149 | } | ||
1155 | #endif | | |||
1156 | 1150 | | |||
1157 | #ifndef KIOFILEWIDGETS_NO_DEPRECATED | | |||
1158 | void KUrlNavigator::savePosition(int x, int y) | 1151 | void KUrlNavigator::savePosition(int x, int y) | ||
1159 | { | 1152 | { | ||
1160 | // deprecated | 1153 | // deprecated | ||
1161 | d->m_history[d->m_historyIndex].pos = QPoint(x, y); | 1154 | d->m_history[d->m_historyIndex].pos = QPoint(x, y); | ||
1162 | } | 1155 | } | ||
1163 | #endif | | |||
1164 | 1156 | | |||
1165 | void KUrlNavigator::keyPressEvent(QKeyEvent *event) | 1157 | void KUrlNavigator::keyPressEvent(QKeyEvent *event) | ||
1166 | { | 1158 | { | ||
1167 | if (isUrlEditable() && (event->key() == Qt::Key_Escape)) { | 1159 | if (isUrlEditable() && (event->key() == Qt::Key_Escape)) { | ||
1168 | setUrlEditable(false); | 1160 | setUrlEditable(false); | ||
1169 | } else { | 1161 | } else { | ||
1170 | QWidget::keyPressEvent(event); | 1162 | QWidget::keyPressEvent(event); | ||
1171 | } | 1163 | } | ||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Line(s) | 1258 | { | |||
1267 | return d->m_customProtocols; | 1259 | return d->m_customProtocols; | ||
1268 | } | 1260 | } | ||
1269 | 1261 | | |||
1270 | QWidget *KUrlNavigator::dropWidget() const | 1262 | QWidget *KUrlNavigator::dropWidget() const | ||
1271 | { | 1263 | { | ||
1272 | return d->m_dropWidget; | 1264 | return d->m_dropWidget; | ||
1273 | } | 1265 | } | ||
1274 | 1266 | | |||
1275 | #ifndef KIOFILEWIDGETS_NO_DEPRECATED | | |||
1276 | const QUrl &KUrlNavigator::url() const | 1267 | const QUrl &KUrlNavigator::url() const | ||
1277 | { | 1268 | { | ||
1278 | // deprecated | 1269 | // deprecated | ||
1279 | 1270 | | |||
1280 | // Workaround required because of flawed interface ('const QUrl&' is returned | 1271 | // Workaround required because of flawed interface ('const QUrl&' is returned | ||
1281 | // instead of 'QUrl'): remember the URL to prevent a dangling pointer | 1272 | // instead of 'QUrl'): remember the URL to prevent a dangling pointer | ||
1282 | static QUrl url; | 1273 | static QUrl url; | ||
1283 | url = locationUrl(); | 1274 | url = locationUrl(); | ||
1284 | return url; | 1275 | return url; | ||
1285 | } | 1276 | } | ||
1286 | #endif | | |||
1287 | 1277 | | |||
1288 | #ifndef KIOFILEWIDGETS_NO_DEPRECATED | | |||
1289 | QUrl KUrlNavigator::url(int index) const | 1278 | QUrl KUrlNavigator::url(int index) const | ||
1290 | { | 1279 | { | ||
1291 | // deprecated | 1280 | // deprecated | ||
1292 | return d->buttonUrl(index); | 1281 | return d->buttonUrl(index); | ||
1293 | } | 1282 | } | ||
1294 | #endif | | |||
1295 | 1283 | | |||
1296 | #ifndef KIOFILEWIDGETS_NO_DEPRECATED | | |||
1297 | QUrl KUrlNavigator::historyUrl(int historyIndex) const | 1284 | QUrl KUrlNavigator::historyUrl(int historyIndex) const | ||
1298 | { | 1285 | { | ||
1299 | // deprecated | 1286 | // deprecated | ||
1300 | return locationUrl(historyIndex); | 1287 | return locationUrl(historyIndex); | ||
1301 | } | 1288 | } | ||
1302 | #endif | | |||
1303 | 1289 | | |||
1304 | #ifndef KIOFILEWIDGETS_NO_DEPRECATED | | |||
1305 | const QUrl &KUrlNavigator::savedRootUrl() const | 1290 | const QUrl &KUrlNavigator::savedRootUrl() const | ||
1306 | { | 1291 | { | ||
1307 | // deprecated | 1292 | // deprecated | ||
1308 | 1293 | | |||
1309 | // Workaround required because of flawed interface ('const QUrl&' is returned | 1294 | // Workaround required because of flawed interface ('const QUrl&' is returned | ||
1310 | // instead of 'QUrl'): remember the root URL to prevent a dangling pointer | 1295 | // instead of 'QUrl'): remember the root URL to prevent a dangling pointer | ||
1311 | static QUrl rootUrl; | 1296 | static QUrl rootUrl; | ||
1312 | rootUrl = d->m_history[d->m_historyIndex].rootUrl; | 1297 | rootUrl = d->m_history[d->m_historyIndex].rootUrl; | ||
1313 | return rootUrl; | 1298 | return rootUrl; | ||
1314 | } | 1299 | } | ||
1315 | #endif | | |||
1316 | 1300 | | |||
1317 | #ifndef KIOFILEWIDGETS_NO_DEPRECATED | | |||
1318 | QPoint KUrlNavigator::savedPosition() const | 1301 | QPoint KUrlNavigator::savedPosition() const | ||
1319 | { | 1302 | { | ||
1320 | // deprecated | 1303 | // deprecated | ||
1321 | return d->m_history[d->m_historyIndex].pos; | 1304 | return d->m_history[d->m_historyIndex].pos; | ||
1322 | } | 1305 | } | ||
1323 | #endif | | |||
1324 | 1306 | | |||
1325 | #ifndef KIOFILEWIDGETS_NO_DEPRECATED | | |||
1326 | void KUrlNavigator::setHomeUrl(const QString &homeUrl) | 1307 | void KUrlNavigator::setHomeUrl(const QString &homeUrl) | ||
1327 | { | 1308 | { | ||
1328 | // deprecated | 1309 | // deprecated | ||
1329 | setLocationUrl(QUrl::fromUserInput(homeUrl)); | 1310 | setLocationUrl(QUrl::fromUserInput(homeUrl)); | ||
1330 | } | 1311 | } | ||
1331 | #endif | | |||
1332 | 1312 | | |||
1333 | #include "moc_kurlnavigator.cpp" | 1313 | #include "moc_kurlnavigator.cpp" |