+
+int DolphinTabWidget::getIndexByUrl(const QUrl& url) const
+{
+ for (int i = 0; i < count(); i++) {
+ // Conversion to display string is necessary to deal with the '~' alias.
+ // i.e. to acknowledge that ~/ is equivalent to /home/user/
+ const QUrl tabUrl = tabPageAt(i)->activeViewContainer()->url();
+ if (url == tabUrl ||
+ url.toDisplayString(QUrl::StripTrailingSlash) == tabUrl.toDisplayString(QUrl::StripTrailingSlash)) {
+ return i;
+ }
+ }
+ return -1;
+}