[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kde-baseapps/KDE/4.10] plasma/applets/folderview: Don't accumulate 'Open with <File Manager>' actio
From: Eike Hein <hein () kde ! org>
Date: 2013-05-27 14:22:02
Message-ID: 20130527142202.77B3DA605B () git ! kde ! org
[Download RAW message or body]
Git commit ce159c94b63592a66d6d90db15fb80767a5b0bc8 by Eike Hein.
Committed on 27/05/2013 at 16:21.
Pushed by hein into branch 'KDE/4.10'.
Don't accumulate 'Open with <File Manager>' actions in the context menu.
M +17 -15 plasma/applets/folderview/folderview.cpp
M +1 -0 plasma/applets/folderview/folderview.h
http://commits.kde.org/kde-baseapps/ce159c94b63592a66d6d90db15fb80767a5b0bc8
diff --git a/plasma/applets/folderview/folderview.cpp b/plasma/applets/folderview/folderview.cpp
index e53ab49..7104516 100644
--- a/plasma/applets/folderview/folderview.cpp
+++ b/plasma/applets/folderview/folderview.cpp
@@ -321,7 +321,8 @@ FolderView::FolderView(QObject *parent, const QVariantList &args)
: Plasma::Containment(parent, args),
m_previewGenerator(0),
m_placesModel(0),
- m_itemActions(0),
+ m_itemActions(new KFileItemActions(this)),
+ m_openWithAction(0),
m_iconView(0),
m_listView(0),
m_label(0),
@@ -613,10 +614,6 @@ void FolderView::configChanged()
m_iconView->setIconPositionsData(m_iconView->iconPositionsData());
}
- // So the KFileItemActions will be recreated for the new URL.
- delete m_itemActions;
- m_itemActions = 0;
-
setUrl(m_url);
}
}
@@ -1686,18 +1683,23 @@ QList<QAction*> FolderView::contextualActions()
actions.append(m_actionCollection.action("refresh"));
- // Add an action for opening the folder in the preferred application.
- if (!m_itemActions) {
- // Create a new KFileItem to prevent the target URL in the root item
- // from being used. In this case we want the configured URL instead.
- KFileItem item(rootItem.mode(), rootItem.permissions(), m_url);
+ // Create a new KFileItem to prevent the target URL in the root item
+ // from being used. In this case we want the configured URL instead.
+ KFileItem item(rootItem.mode(), rootItem.permissions(), m_url);
+ KFileItemListProperties itemList(KFileItemList() << item);
+ m_itemActions->setItemListProperties(itemList);
+
+ // FIXME: The actions instanciated by KFileItemActions::preferredOpenWithAction()
+ // (see below) are eventually deleted in its constructor, but it would be better
+ // to find a way to not keep them around rather than just to hide them.
+ if (m_openWithAction) {
+ m_openWithAction->setVisible(false);
+ }
- KFileItemListProperties itemList(KFileItemList() << item);
+ // Add an action for opening the folder in the preferred application.
+ m_openWithAction = m_itemActions->preferredOpenWithAction(QString());
+ actions.append(m_openWithAction);
- m_itemActions = new KFileItemActions(this);
- m_itemActions->setItemListProperties(itemList);
- }
- actions.append(m_itemActions->preferredOpenWithAction(QString()));
if (m_url.protocol() == "trash") {
KConfig trashConfig("trashrc", KConfig::SimpleConfig);
m_actionCollection.action("empty_trash")->setEnabled(!trashConfig.group("Status")
diff --git a/plasma/applets/folderview/folderview.h b/plasma/applets/folderview/folderview.h
index 2ed2a9d..663a67e 100644
--- a/plasma/applets/folderview/folderview.h
+++ b/plasma/applets/folderview/folderview.h
@@ -183,6 +183,7 @@ private:
KDirModel *m_dirModel;
KFilePlacesModel *m_placesModel;
KFileItemActions *m_itemActions;
+ KAction *m_openWithAction;
IconView *m_iconView;
ListView *m_listView;
Label *m_label;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic