-/***************************************************************************
- * Copyright (C) 2014 by Emmanuel Pescosta <emmanuelpescosta099@gmail.com> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
- ***************************************************************************/
+/*
+ * SPDX-FileCopyrightText: 2014 Emmanuel Pescosta <emmanuelpescosta099@gmail.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
#include "dolphintabwidget.h"
currentTabPage()->restoreState(state);
}
+void DolphinTabWidget::copyToInactiveSplitView()
+{
+ const DolphinTabPage* tabPage = tabPageAt(currentIndex());
+ DolphinViewContainer* activeViewContainer = currentTabPage()->activeViewContainer();
+ if (!tabPage->splitViewEnabled() || activeViewContainer->view()->selectedItems().isEmpty()) {
+ return;
+ }
+
+ if (tabPage->primaryViewActive()) {
+ // copy from left panel to right
+ activeViewContainer->view()->copySelectedItems(activeViewContainer->view()->selectedItems(), tabPage->secondaryViewContainer()->url());
+ } else {
+ // copy from right panel to left
+ activeViewContainer->view()->copySelectedItems(activeViewContainer->view()->selectedItems(), tabPage->primaryViewContainer()->url());
+ }
+}
+
+void DolphinTabWidget::moveToInactiveSplitView()
+{
+ const DolphinTabPage* tabPage = tabPageAt(currentIndex());
+ DolphinViewContainer* activeViewContainer = currentTabPage()->activeViewContainer();
+ if (!tabPage->splitViewEnabled() || activeViewContainer->view()->selectedItems().isEmpty()) {
+ return;
+ }
+
+ if (tabPage->primaryViewActive()) {
+ // move from left panel to right
+ activeViewContainer->view()->moveSelectedItems(activeViewContainer->view()->selectedItems(), tabPage->secondaryViewContainer()->url());
+ } else {
+ // move from right panel to left
+ activeViewContainer->view()->moveSelectedItems(activeViewContainer->view()->selectedItems(), tabPage->primaryViewContainer()->url());
+ }
+}
+
void DolphinTabWidget::detachTab(int index)
{
Q_ASSERT(index >= 0);
const int index = indexOf(qobject_cast<QWidget*>(sender()));
if (index >= 0) {
tabBar()->setTabText(index, tabName(tabPageAt(index)));
+ tabBar()->setTabToolTip(index, url.path());
if (tabBar()->isVisible()) {
tabBar()->setTabIcon(index, QIcon::fromTheme(KIO::iconNameForUrl(url)));
} else {
if (count() > 1) {
// Resolve all pending tab icons
for (int i = 0; i < count(); ++i) {
+ const QUrl url = tabPageAt(i)->activeViewContainer()->url();
if (tabBar()->tabIcon(i).isNull()) {
- tabBar()->setTabIcon(i, QIcon::fromTheme(KIO::iconNameForUrl(tabPageAt(i)->activeViewContainer()->url())));
+ tabBar()->setTabIcon(i, QIcon::fromTheme(KIO::iconNameForUrl(url)));
+ }
+ if (tabBar()->tabToolTip(i).isEmpty()) {
+ tabBar()->setTabToolTip(index, url.path());
}
}