setAcceptDrops(true);
m_tabWidget = new DolphinTabWidget(this);
+ m_tabWidget->setObjectName("tabWidget");
connect(m_tabWidget, &DolphinTabWidget::activeViewChanged,
this, &DolphinMainWindow::activeViewChanged);
connect(m_tabWidget, &DolphinTabWidget::tabCountChanged,
void DolphinMainWindow::openInNewTab()
{
const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
- if (list.isEmpty()) {
- openNewTab(m_activeViewContainer->url());
- } else {
- foreach (const KFileItem& item, list) {
- const QUrl& url = DolphinView::openItemAsFolderUrl(item);
- if (!url.isEmpty()) {
- openNewTab(url);
- }
+ bool tabCreated = false;
+
+ foreach (const KFileItem& item, list) {
+ const QUrl& url = DolphinView::openItemAsFolderUrl(item);
+ if (!url.isEmpty()) {
+ openNewTab(url);
+ tabCreated = true;
}
}
+
+ // if no new tab has been created from the selection
+ // open the current directory in a new tab
+ if (!tabCreated) {
+ openNewTab(m_activeViewContainer->url());
+ }
}
void DolphinMainWindow::openInNewWindow()