#include "treeviewcontextmenu.h"
#include <kiconloader.h>
+#include <kio/deletejob.h>
#include <kmenu.h>
#include <konqmimedata.h>
#include <konq_operations.h>
#include <QClipboard>
TreeViewContextMenu::TreeViewContextMenu(QWidget* parent,
- KFileItem* fileInfo) :
- m_parent(parent),
- m_fileInfo(fileInfo)
-{
-}
+ KFileItem* fileInfo) :
+ m_parent(parent),
+ m_fileInfo(fileInfo)
+{}
TreeViewContextMenu::~TreeViewContextMenu()
-{
-}
+{}
void TreeViewContextMenu::open()
{
popup->addSeparator();
// insert 'Rename'
- QAction* renameAction = new QAction(i18n("Rename"), this);
+ QAction* renameAction = new QAction(i18n("Rename..."), this);
connect(renameAction, SIGNAL(triggered()), this, SLOT(rename()));
popup->addAction(renameAction);
QAction* moveToTrashAction = new QAction(KIcon("edit-trash"), i18n("Move To Trash"), this);
connect(moveToTrashAction, SIGNAL(triggered()), this, SLOT(moveToTrash()));
popup->addAction(moveToTrashAction);
- }
- else {
+ } else {
showDeleteCommand = true;
}
popup->addSeparator();
- // insert 'Properties...' entry
- QAction* propertiesAction = new QAction(i18n("Properties..."), this);
+ // insert 'Properties' entry
+ QAction* propertiesAction = new QAction(i18n("Properties"), this);
connect(this, SIGNAL(triggered()), this, SLOT(showProperties()));
popup->addAction(propertiesAction);
if (KonqMimeData::decodeIsCutSelection(mimeData)) {
KonqOperations::copy(m_parent, KonqOperations::MOVE, source, dest);
clipboard->clear();
- }
- else {
+ } else {
KonqOperations::copy(m_parent, KonqOperations::COPY, source, dest);
}
}
if (dialog.exec() == QDialog::Accepted) {
const QString& newName = dialog.newName();
if (!newName.isEmpty()) {
- KUrl newUrl = oldUrl.upUrl();
- newUrl.addPath(newName);
+ KUrl newUrl = oldUrl;
+ newUrl.setFileName(newName);
KonqOperations::rename(m_parent, oldUrl, newUrl);
}
}
void TreeViewContextMenu::deleteItem()
{
- KonqOperations::askDeleteConfirmation(m_fileInfo->url(),
- KonqOperations::DEL,
- KonqOperations::FORCE_CONFIRMATION,
- m_parent);
+ KonqOperations::del(m_parent, KonqOperations::DEL, m_fileInfo->url());
}
void TreeViewContextMenu::showProperties()