#include "dolphintabbar.h"
#include "dolphintabpage.h"
#include "dolphinviewcontainer.h"
-#include "dolphin_generalsettings.h"
-#include "views/draganddrophelper.h"
#include <QApplication>
#include <KConfigGroup>
}
}
-void DolphinTabWidget::openDirectories(const QList<QUrl>& dirs)
+void DolphinTabWidget::openDirectories(const QList<QUrl>& dirs, bool splitView)
{
- const bool hasSplitView = GeneralSettings::splitView();
+ Q_ASSERT(dirs.size() > 0);
- // Open each directory inside a new tab. If the "split view" option has been enabled,
- // always show two directories within one tab.
QList<QUrl>::const_iterator it = dirs.constBegin();
while (it != dirs.constEnd()) {
const QUrl& primaryUrl = *(it++);
- if (hasSplitView && (it != dirs.constEnd())) {
+ if (splitView && (it != dirs.constEnd())) {
const QUrl& secondaryUrl = *(it++);
openNewTab(primaryUrl, secondaryUrl);
} else {
}
}
-void DolphinTabWidget::openFiles(const QList<QUrl>& files)
+void DolphinTabWidget::openFiles(const QList<QUrl>& files, bool splitView)
{
- if (files.isEmpty()) {
- return;
- }
+ Q_ASSERT(files.size() > 0);
// Get all distinct directories from 'files' and open a tab
// for each directory. If the "split view" option is enabled, two
}
const int oldTabCount = count();
- openDirectories(dirs);
+ openDirectories(dirs, splitView);
const int tabCount = count();
// Select the files. Although the files can be split between several
void DolphinTabWidget::tabDropEvent(int index, QDropEvent* event)
{
if (index >= 0) {
- const DolphinView* view = tabPageAt(index)->activeViewContainer()->view();
-
- QString error;
- DragAndDropHelper::dropUrls(view->rootItem(), view->url(), event, error);
- if (!error.isEmpty()) {
- currentTabPage()->activeViewContainer()->showMessage(error, DolphinViewContainer::Error);
- }
+ DolphinView* view = tabPageAt(index)->activeViewContainer()->view();
+ view->dropUrls(view->url(), event);
}
}
if (url == QUrl("file:///")) {
name = '/';
} else {
- name = url.fileName();
+ name = url.adjusted(QUrl::StripTrailingSlash).fileName();
if (name.isEmpty()) {
name = url.scheme();
} else {