Changeset View
Changeset View
Standalone View
Standalone View
sublime/container.cpp
Show First 20 Lines • Show All 159 Lines • ▼ Show 20 Line(s) | 158 | for (int i = 0; i < views.size(); ++i) { | |||
---|---|---|---|---|---|
160 | QString visibleEntryTitle; | 160 | QString visibleEntryTitle; | ||
161 | // if filename is not unique, prepend containing directory | 161 | // if filename is not unique, prepend containing directory | ||
162 | if ((i < views.size() - 1 && view->document()->title() == views.at(i + 1)->document()->title()) | 162 | if ((i < views.size() - 1 && view->document()->title() == views.at(i + 1)->document()->title()) | ||
163 | || (i > 0 && view->document()->title() == views.at(i - 1)->document()->title()) | 163 | || (i > 0 && view->document()->title() == views.at(i - 1)->document()->title()) | ||
164 | ) { | 164 | ) { | ||
165 | auto urlDoc = qobject_cast<Sublime::UrlDocument*>(view->document()); | 165 | auto urlDoc = qobject_cast<Sublime::UrlDocument*>(view->document()); | ||
166 | if (!urlDoc) { | 166 | if (!urlDoc) { | ||
167 | visibleEntryTitle = view->document()->title(); | 167 | visibleEntryTitle = view->document()->title(); | ||
168 | continue; | | |||
169 | } | 168 | } | ||
169 | else { | ||||
170 | auto url = urlDoc->url().toString(); | 170 | auto url = urlDoc->url().toString(); | ||
171 | int secondOffset = url.lastIndexOf('/'); | 171 | int secondOffset = url.lastIndexOf('/'); | ||
172 | secondOffset = url.lastIndexOf('/', secondOffset - 1); | 172 | secondOffset = url.lastIndexOf('/', secondOffset - 1); | ||
173 | visibleEntryTitle = url.right(url.length() - url.lastIndexOf('/', secondOffset) - 1); | 173 | visibleEntryTitle = url.right(url.length() - url.lastIndexOf('/', secondOffset) - 1); | ||
174 | } | ||||
174 | } else { | 175 | } else { | ||
175 | visibleEntryTitle = view->document()->title(); | 176 | visibleEntryTitle = view->document()->title(); | ||
176 | } | 177 | } | ||
177 | QAction* action = documentListMenu->addAction(visibleEntryTitle); | 178 | QAction* action = documentListMenu->addAction(visibleEntryTitle); | ||
178 | action->setData(QVariant::fromValue(view)); | 179 | action->setData(QVariant::fromValue(view)); | ||
179 | documentListActionForView[view] = action; | 180 | documentListActionForView[view] = action; | ||
180 | action->setIcon(view->document()->icon()); | 181 | action->setIcon(view->document()->icon()); | ||
181 | ///FIXME: push this code somehow into shell, such that we can access the project model for | 182 | ///FIXME: push this code somehow into shell, such that we can access the project model for | ||
▲ Show 20 Lines • Show All 486 Lines • Show Last 20 Lines |