-/***************************************************************************
- * Copyright (C) 2006-2010 by Peter Penz <peter.penz19@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: 2006-2010 Peter Penz <peter.penz19@gmail.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
#include "folderspanel.h"
#include "dolphin_folderspanelsettings.h"
#include "dolphin_generalsettings.h"
-#include "treeviewcontextmenu.h"
#include "foldersitemlistwidget.h"
+#include "global.h"
+#include "kitemviews/kfileitemlistview.h"
+#include "kitemviews/kfileitemmodel.h"
+#include "kitemviews/kitemlistcontainer.h"
+#include "kitemviews/kitemlistcontroller.h"
+#include "kitemviews/kitemlistselectionmanager.h"
+#include "treeviewcontextmenu.h"
+#include "views/draganddrophelper.h"
-#include <views/renamedialog.h>
-#include <kitemviews/kitemlistselectionmanager.h>
-#include <kitemviews/kfileitemlistview.h>
-#include <kitemviews/kfileitemlistwidget.h>
-#include <kitemviews/kitemlistcontainer.h>
-#include <kitemviews/kitemlistcontroller.h>
-#include <kitemviews/kfileitemmodel.h>
-
-#include <KFileItem>
#include <KJobWidgets>
#include <KJobUiDelegate>
#include <KIO/CopyJob>
#include <KIO/DropJob>
#include <KIO/FileUndoManager>
+#include <KIO/RenameFileDialog>
#include <QApplication>
#include <QBoxLayout>
-#include <QDropEvent>
#include <QGraphicsSceneDragDropEvent>
#include <QGraphicsView>
#include <QPropertyAnimation>
#include <QTimer>
-#include <views/draganddrophelper.h>
-
-#include "dolphindebug.h"
-#include "global.h"
-
FoldersPanel::FoldersPanel(QWidget* parent) :
Panel(parent),
m_updateCurrentItem(false),
const int index = m_model->index(item);
m_controller->view()->editRole(index, "text");
} else {
- RenameDialog* dialog = new RenameDialog(this, KFileItemList() << item);
- dialog->setAttribute(Qt::WA_DeleteOnClose);
- dialog->show();
- dialog->raise();
- dialog->activateWindow();
+ KIO::RenameFileDialog* dialog = new KIO::RenameFileDialog(KFileItemList({item}), this);
+ dialog->open();
}
}
bool FoldersPanel::urlChanged()
{
- if (!url().isValid() || url().scheme().contains(QStringLiteral("search"))) {
+ if (!url().isValid() || url().scheme().contains(QLatin1String("search"))) {
// Skip results shown by a search, as possible identical
// directory names are useless without parent-path information.
return false;
container->setEnabledFrame(false);
QVBoxLayout* layout = new QVBoxLayout(this);
- layout->setMargin(0);
+ layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(container);
}
void FoldersPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
{
- Q_UNUSED(pos);
-
const KFileItem fileItem = m_model->fileItem(index);
QPointer<TreeViewContextMenu> contextMenu = new TreeViewContextMenu(this, fileItem);
- contextMenu.data()->open();
+ contextMenu.data()->open(pos.toPoint());
if (contextMenu.data()) {
delete contextMenu.data();
}
void FoldersPanel::slotViewContextMenuRequested(const QPointF& pos)
{
- Q_UNUSED(pos);
-
QPointer<TreeViewContextMenu> contextMenu = new TreeViewContextMenu(this, KFileItem());
- contextMenu.data()->open();
+ contextMenu.data()->open(pos.toPoint());
if (contextMenu.data()) {
delete contextMenu.data();
}
if (role == "text") {
const KFileItem item = m_model->fileItem(index);
const QString newName = value.toString();
- if (!newName.isEmpty() && newName != item.text() && newName != QLatin1String(".") && newName != QLatin1String("..")) {
+ if (!newName.isEmpty() && newName != item.text() && newName != QLatin1Char('.') && newName != QLatin1String("..")) {
const QUrl oldUrl = item.url();
QUrl newUrl = oldUrl.adjusted(QUrl::RemoveFilename);
newUrl.setPath(newUrl.path() + KIO::encodeFileName(newName));