/***************************************************************************
- * Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) and *
- * Cvetoslav Ludmiloff *
+ * Copyright (C) 2006-2010 by Peter Penz <peter.penz19@gmail.com> *
+ * Copyright (C) 2006 by Cvetoslav Ludmiloff *
* *
* 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 *
#include "treeviewcontextmenu.h"
-#include "dolphin_folderspanelsettings.h"
-
#include <kfileitem.h>
#include <kiconloader.h>
#include <kio/deletejob.h>
#include <kmenu.h>
#include <konqmimedata.h>
-#include <konq_fileitemcapabilities.h>
+#include <kfileitemlistproperties.h>
#include <konq_operations.h>
#include <klocale.h>
#include <kpropertiesdialog.h>
#include "folderspanel.h"
-#include <QtGui/QApplication>
-#include <QtGui/QClipboard>
+#include <QApplication>
+#include <QClipboard>
+#include <QPointer>
TreeViewContextMenu::TreeViewContextMenu(FoldersPanel* parent,
const KFileItem& fileInfo) :
KMenu* popup = new KMenu(m_parent);
if (!m_fileInfo.isNull()) {
- KonqFileItemCapabilities capabilities(KFileItemList() << m_fileInfo);
+ KFileItemListProperties capabilities(KFileItemList() << m_fileInfo);
// insert 'Cut', 'Copy' and 'Paste'
QAction* cutAction = new QAction(KIcon("edit-cut"), i18nc("@action:inmenu", "Cut"), this);
// insert 'Rename'
QAction* renameAction = new QAction(i18nc("@action:inmenu", "Rename..."), this);
renameAction->setEnabled(capabilities.supportsMoving());
+ renameAction->setIcon(KIcon("edit-rename"));
connect(renameAction, SIGNAL(triggered()), this, SLOT(rename()));
popup->addAction(renameAction);
KConfigGroup configGroup(globalConfig, "KDE");
bool showDeleteCommand = configGroup.readEntry("ShowDeleteCommand", false);
- const KUrl& url = m_fileInfo.url();
+ const KUrl url = m_fileInfo.url();
if (url.isLocalFile()) {
QAction* moveToTrashAction = new QAction(KIcon("user-trash"),
- i18nc("@action:inmenu", "Move To Trash"), this);
+ i18nc("@action:inmenu", "Move to Trash"), this);
const bool enableMoveToTrash = capabilities.isLocal() && capabilities.supportsMoving();
moveToTrashAction->setEnabled(enableMoveToTrash);
connect(moveToTrashAction, SIGNAL(triggered()), this, SLOT(moveToTrash()));
// insert 'Properties' entry
QAction* propertiesAction = new QAction(i18nc("@action:inmenu", "Properties"), this);
+ propertiesAction->setIcon(KIcon("document-properties"));
connect(propertiesAction, SIGNAL(triggered()), this, SLOT(showProperties()));
popup->addAction(propertiesAction);
QAction* showHiddenFilesAction = new QAction(i18nc("@action:inmenu", "Show Hidden Files"), this);
showHiddenFilesAction->setCheckable(true);
- showHiddenFilesAction->setChecked(FoldersPanelSettings::showHiddenFiles());
+ showHiddenFilesAction->setChecked(m_parent->showHiddenFiles());
popup->addAction(showHiddenFilesAction);
-
connect(showHiddenFilesAction, SIGNAL(toggled(bool)), this, SLOT(setShowHiddenFiles(bool)));
+ QAction* autoScrollingAction = new QAction(i18nc("@action:inmenu", "Automatic Scrolling"), this);
+ autoScrollingAction->setCheckable(true);
+ autoScrollingAction->setChecked(m_parent->autoScrolling());
+ popup->addAction(autoScrollingAction);
+ connect(autoScrollingAction, SIGNAL(toggled(bool)), this, SLOT(setAutoScrolling(bool)));
+
+
popup->exec(QCursor::pos());
popup->deleteLater();
}
void TreeViewContextMenu::showProperties()
{
- KPropertiesDialog dialog(m_fileInfo.url(), m_parent);
- dialog.exec();
+ QPointer<KPropertiesDialog> dialog = new KPropertiesDialog(m_fileInfo.url(), m_parent);
+ dialog->exec();
+ delete dialog;
}
void TreeViewContextMenu::setShowHiddenFiles(bool show)
m_parent->setShowHiddenFiles(show);
}
+void TreeViewContextMenu::setAutoScrolling(bool enable)
+{
+ m_parent->setAutoScrolling(enable);
+}
+
#include "treeviewcontextmenu.moc"