]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/folders/treeviewcontextmenu.cpp
Set icons for the rename- and properties-action of the Folders Panels context-menu.
[dolphin.git] / src / panels / folders / treeviewcontextmenu.cpp
index c63772a389e4603fab7d0183a59bdfd3ae816e2d..de93e096c1d5b59eea2258987b61185b67ba8bd3 100644 (file)
@@ -1,6 +1,6 @@
 /***************************************************************************
- *   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) :
@@ -54,7 +53,7 @@ void TreeViewContextMenu::open()
     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);
@@ -78,6 +77,7 @@ void TreeViewContextMenu::open()
         // 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);
 
@@ -86,10 +86,10 @@ void TreeViewContextMenu::open()
         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()));
@@ -109,6 +109,7 @@ void TreeViewContextMenu::open()
 
         // 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);
 
@@ -117,11 +118,17 @@ void TreeViewContextMenu::open()
 
     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();
 }
@@ -182,8 +189,9 @@ void TreeViewContextMenu::deleteItem()
 
 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)
@@ -191,4 +199,9 @@ void TreeViewContextMenu::setShowHiddenFiles(bool show)
     m_parent->setShowHiddenFiles(show);
 }
 
+void TreeViewContextMenu::setAutoScrolling(bool enable)
+{
+    m_parent->setAutoScrolling(enable);
+}
+
 #include "treeviewcontextmenu.moc"