| 2400 | } |
| 2401 | |
| 2402 | void |
| 2403 | FavoriteView::selectUrl(const QUrl &url) |
| 2404 | { |
| 2405 | disconnect( selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), |
| 2406 | this, SLOT(clicked(QModelIndex)) ); |
| 2407 | |
| 2408 | selectionModel()->clear(); |
| 2409 | |
| 2410 | QString urlPath = url.toLocalFile(); |
| 2411 | // On windows url.path() will return something starting with a / |
| 2412 | #ifdef __NATRON_WIN32__ |
| 2413 | if ( urlPath.startsWith( QLatin1Char('/') ) ) { |
| 2414 | urlPath.remove(0, 1); |
| 2415 | } |
| 2416 | #endif |
| 2417 | |
| 2418 | for (int i = 0; i < model()->rowCount(); ++i) { |
| 2419 | QString otherUrlPath = model()->index(i, 0).data(UrlModel::UrlRole).toUrl().toLocalFile(); |
| 2420 | // On windows url.path() will return something starting with a / |
| 2421 | #ifdef __NATRON_WIN32__ |
| 2422 | if ( otherUrlPath.startsWith( QLatin1Char('/') ) ) { |
| 2423 | otherUrlPath.remove(0, 1); |
| 2424 | } |
| 2425 | #endif |
| 2426 | |
| 2427 | if (otherUrlPath == urlPath) { |
| 2428 | selectionModel()->select(model()->index(i, 0), QItemSelectionModel::Select); |
| 2429 | break; |
| 2430 | } |
| 2431 | } |
| 2432 | |
| 2433 | connect( selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), |
| 2434 | this, SLOT(clicked(QModelIndex)) ); |
| 2435 | } |
| 2436 | |
| 2437 | void |
| 2438 | FavoriteView::removeEntry() |