X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/0c8ef2977e2285676fb4c2ee1fdcb1e641c1acd7..39fcc8945051365ae240e0bf92fcb3403d77caed:/src/dolphinmainwindow.cpp diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index e28e540d1..fe34c306f 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -98,6 +98,8 @@ DolphinMainWindow::DolphinMainWindow() : m_updateToolBarTimer(0), m_lastHandleUrlStatJob(0) { + Q_INIT_RESOURCE(dolphin); + setObjectName(QStringLiteral("Dolphin#")); connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage, @@ -124,6 +126,7 @@ DolphinMainWindow::DolphinMainWindow() : setAcceptDrops(true); m_tabWidget = new DolphinTabWidget(this); + m_tabWidget->setObjectName("tabWidget"); connect(m_tabWidget, &DolphinTabWidget::activeViewChanged, this, &DolphinMainWindow::activeViewChanged); connect(m_tabWidget, &DolphinTabWidget::tabCountChanged, @@ -306,16 +309,21 @@ void DolphinMainWindow::openNewTab(const QUrl& url) 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() @@ -1311,7 +1319,7 @@ void DolphinMainWindow::updateEditActions() KActionCollection* col = actionCollection(); QAction* renameAction = col->action(QStringLiteral("rename")); - QAction* moveToTrashAction = col->action(QStringLiteral("move_to_trash")); + QAction* moveToTrashAction = col->action(KStandardAction::name(KStandardAction::MoveToTrash)); QAction* deleteAction = col->action(KStandardAction::name(KStandardAction::DeleteFile)); QAction* cutAction = col->action(KStandardAction::name(KStandardAction::Cut)); QAction* deleteWithTrashShortcut = col->action(QStringLiteral("delete_shortcut")); // see DolphinViewActionHandler