1 /* This file is part of the KDE project
2 SPDX-FileCopyrightText: 2007 David Faure <faure@kde.org>
4 SPDX-License-Identifier: LGPL-2.0-or-later
7 #include "dolphinpart.h"
9 #include "dolphindebug.h"
10 #include "dolphinnewfilemenu.h"
11 #include "dolphinpart_ext.h"
12 #include "dolphinremoveaction.h"
13 #include "kitemviews/kfileitemmodel.h"
14 #include "kitemviews/private/kfileitemmodeldirlister.h"
15 #include "views/dolphinnewfilemenuobserver.h"
16 #include "views/dolphinremoteencoding.h"
17 #include "views/dolphinview.h"
18 #include "views/dolphinviewactionhandler.h"
21 #include <KActionCollection>
22 #include <KAuthorized>
23 #include <KConfigGroup>
24 #include <KDialogJobUiDelegate>
25 #include <KFileItemListProperties>
26 #include <KIconLoader>
27 #include <KJobWidgets>
28 #include <KLocalizedString>
29 #include <KMessageBox>
30 #include <KMimeTypeEditor>
31 #include <KNS3/KMoreToolsMenuFactory>
32 #include <KPluginFactory>
33 #include <KIO/CommandLauncherJob>
34 #include <KSharedConfig>
35 #include <KToolInvocation>
37 #include <QActionGroup>
38 #include <QApplication>
41 #include <QInputDialog>
44 #include <QRegularExpression>
45 #include <QStandardPaths>
46 #include <QTextDocument>
48 K_PLUGIN_FACTORY(DolphinPartFactory
, registerPlugin
<DolphinPart
>();)
50 DolphinPart::DolphinPart(QWidget
* parentWidget
, QObject
* parent
, const QVariantList
& args
)
51 : KParts::ReadOnlyPart(parent
)
52 ,m_openTerminalAction(nullptr)
53 ,m_removeAction(nullptr)
56 setComponentData(*createAboutData(), false);
57 m_extension
= new DolphinPartBrowserExtension(this);
59 // make sure that other apps using this part find Dolphin's view-file-columns icons
60 KIconLoader::global()->addAppDir(QStringLiteral("dolphin"));
62 m_view
= new DolphinView(QUrl(), parentWidget
);
63 m_view
->setTabsForFilesEnabled(true);
66 connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage
,
67 this, &DolphinPart::slotErrorMessage
);
69 connect(m_view
, &DolphinView::directoryLoadingCompleted
, this, QOverload
<>::of(&KParts::ReadOnlyPart::completed
));
70 connect(m_view
, &DolphinView::directoryLoadingCompleted
, this, &DolphinPart::updatePasteAction
);
71 connect(m_view
, &DolphinView::directoryLoadingProgress
, this, &DolphinPart::updateProgress
);
72 connect(m_view
, &DolphinView::errorMessage
, this, &DolphinPart::slotErrorMessage
);
74 setXMLFile(QStringLiteral("dolphinpart.rc"));
76 connect(m_view
, &DolphinView::infoMessage
,
77 this, &DolphinPart::slotMessage
);
78 connect(m_view
, &DolphinView::operationCompletedMessage
,
79 this, &DolphinPart::slotMessage
);
80 connect(m_view
, &DolphinView::errorMessage
,
81 this, &DolphinPart::slotErrorMessage
);
82 connect(m_view
, &DolphinView::itemActivated
,
83 this, &DolphinPart::slotItemActivated
);
84 connect(m_view
, &DolphinView::itemsActivated
,
85 this, &DolphinPart::slotItemsActivated
);
86 connect(m_view
, &DolphinView::tabRequested
,
87 this, &DolphinPart::createNewWindow
);
88 connect(m_view
, &DolphinView::requestContextMenu
,
89 this, &DolphinPart::slotOpenContextMenu
);
90 connect(m_view
, &DolphinView::selectionChanged
,
91 m_extension
, QOverload
<const KFileItemList
&>::of(&KParts::BrowserExtension::selectionInfo
));
92 connect(m_view
, &DolphinView::selectionChanged
,
93 this, &DolphinPart::slotSelectionChanged
);
94 connect(m_view
, &DolphinView::requestItemInfo
,
95 this, &DolphinPart::slotRequestItemInfo
);
96 connect(m_view
, &DolphinView::modeChanged
,
97 this, &DolphinPart::viewModeChanged
); // relay signal
98 connect(m_view
, &DolphinView::redirection
,
99 this, &DolphinPart::slotDirectoryRedirection
);
101 // Watch for changes that should result in updates to the
103 connect(m_view
, &DolphinView::itemCountChanged
, this, &DolphinPart::updateStatusBar
);
104 connect(m_view
, &DolphinView::selectionChanged
, this, &DolphinPart::updateStatusBar
);
106 m_actionHandler
= new DolphinViewActionHandler(actionCollection(), this);
107 m_actionHandler
->setCurrentView(m_view
);
108 connect(m_actionHandler
, &DolphinViewActionHandler::createDirectoryTriggered
, this, &DolphinPart::createDirectory
);
110 m_remoteEncoding
= new DolphinRemoteEncoding(this, m_actionHandler
);
111 connect(this, &DolphinPart::aboutToOpenURL
,
112 m_remoteEncoding
, &DolphinRemoteEncoding::slotAboutToOpenUrl
);
114 QClipboard
* clipboard
= QApplication::clipboard();
115 connect(clipboard
, &QClipboard::dataChanged
,
116 this, &DolphinPart::updatePasteAction
);
118 // Create file info and listing filter extensions.
119 // NOTE: Listing filter needs to be instantiated after the creation of the view.
120 new DolphinPartFileInfoExtension(this);
122 new DolphinPartListingFilterExtension(this);
124 KDirLister
* lister
= m_view
->m_model
->m_dirLister
;
126 DolphinPartListingNotificationExtension
* notifyExt
= new DolphinPartListingNotificationExtension(this);
127 connect(lister
, &KDirLister::newItems
, notifyExt
, &DolphinPartListingNotificationExtension::slotNewItems
);
128 connect(lister
, &KDirLister::itemsDeleted
, notifyExt
, &DolphinPartListingNotificationExtension::slotItemsDeleted
);
130 qCWarning(DolphinDebug
) << "NULL KDirLister object! KParts::ListingNotificationExtension will NOT be supported";
134 m_actionHandler
->updateViewActions();
135 slotSelectionChanged(KFileItemList()); // initially disable selection-dependent actions
137 // Listen to events from the app so we can update the remove key by
138 // checking for a Shift key press.
139 qApp
->installEventFilter(this);
141 // TODO there was a "always open a new window" (when clicking on a directory) setting in konqueror
142 // (sort of spacial navigation)
144 loadPlugins(this, this, componentData());
147 DolphinPart::~DolphinPart()
151 void DolphinPart::createActions()
155 m_newFileMenu
= new DolphinNewFileMenu(actionCollection(), this);
156 m_newFileMenu
->setParentWidget(widget());
157 connect(m_newFileMenu
->menu(), &QMenu::aboutToShow
,
158 this, &DolphinPart::updateNewMenu
);
160 QAction
*editMimeTypeAction
= actionCollection()->addAction( QStringLiteral("editMimeType") );
161 editMimeTypeAction
->setText( i18nc("@action:inmenu Edit", "&Edit File Type..." ) );
162 connect(editMimeTypeAction
, &QAction::triggered
, this, &DolphinPart::slotEditMimeType
);
164 QAction
* selectItemsMatching
= actionCollection()->addAction(QStringLiteral("select_items_matching"));
165 selectItemsMatching
->setText(i18nc("@action:inmenu Edit", "Select Items Matching..."));
166 actionCollection()->setDefaultShortcut(selectItemsMatching
, Qt::CTRL
+ Qt::Key_S
);
167 connect(selectItemsMatching
, &QAction::triggered
, this, &DolphinPart::slotSelectItemsMatchingPattern
);
169 QAction
* unselectItemsMatching
= actionCollection()->addAction(QStringLiteral("unselect_items_matching"));
170 unselectItemsMatching
->setText(i18nc("@action:inmenu Edit", "Unselect Items Matching..."));
171 connect(unselectItemsMatching
, &QAction::triggered
, this, &DolphinPart::slotUnselectItemsMatchingPattern
);
173 KStandardAction::selectAll(m_view
, &DolphinView::selectAll
, actionCollection());
175 QAction
* unselectAll
= actionCollection()->addAction(QStringLiteral("unselect_all"));
176 unselectAll
->setText(i18nc("@action:inmenu Edit", "Unselect All"));
177 connect(unselectAll
, &QAction::triggered
, m_view
, &DolphinView::clearSelection
);
179 QAction
* invertSelection
= actionCollection()->addAction(QStringLiteral("invert_selection"));
180 invertSelection
->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
181 actionCollection()->setDefaultShortcut(invertSelection
, Qt::CTRL
+ Qt::SHIFT
+ Qt::Key_A
);
182 connect(invertSelection
, &QAction::triggered
, m_view
, &DolphinView::invertSelection
);
184 // View menu: all done by DolphinViewActionHandler
188 QActionGroup
* goActionGroup
= new QActionGroup(this);
189 connect(goActionGroup
, &QActionGroup::triggered
,
190 this, &DolphinPart::slotGoTriggered
);
192 createGoAction("go_applications", "start-here-kde",
193 i18nc("@action:inmenu Go", "App&lications"), QStringLiteral("programs:/"),
195 createGoAction("go_network_folders", "folder-remote",
196 i18nc("@action:inmenu Go", "&Network Folders"), QStringLiteral("remote:/"),
198 createGoAction("go_settings", "preferences-system",
199 i18nc("@action:inmenu Go", "Sett&ings"), QStringLiteral("settings:/"),
201 createGoAction("go_trash", "user-trash",
202 i18nc("@action:inmenu Go", "Trash"), QStringLiteral("trash:/"),
204 createGoAction("go_autostart", "",
205 i18nc("@action:inmenu Go", "Autostart"), QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation
) + "/autostart",
209 m_findFileAction
= KStandardAction::find(this, &DolphinPart::slotFindFile
, actionCollection());
210 m_findFileAction
->setText(i18nc("@action:inmenu Tools", "Find File..."));
213 if (KAuthorized::authorize(QStringLiteral("shell_access"))) {
214 m_openTerminalAction
= actionCollection()->addAction(QStringLiteral("open_terminal"));
215 m_openTerminalAction
->setIcon(QIcon::fromTheme(QStringLiteral("dialog-scripts")));
216 m_openTerminalAction
->setText(i18nc("@action:inmenu Tools", "Open &Terminal"));
217 connect(m_openTerminalAction
, &QAction::triggered
, this, &DolphinPart::slotOpenTerminal
);
218 actionCollection()->setDefaultShortcut(m_openTerminalAction
, Qt::Key_F4
);
223 void DolphinPart::createGoAction(const char* name
, const char* iconName
,
224 const QString
& text
, const QString
& url
,
225 QActionGroup
* actionGroup
)
227 QAction
* action
= actionCollection()->addAction(name
);
228 action
->setIcon(QIcon::fromTheme(iconName
));
229 action
->setText(text
);
230 action
->setData(url
);
231 action
->setActionGroup(actionGroup
);
234 void DolphinPart::slotGoTriggered(QAction
* action
)
236 const QString url
= action
->data().toString();
237 emit m_extension
->openUrlRequest(QUrl(url
));
240 void DolphinPart::slotSelectionChanged(const KFileItemList
& selection
)
242 const bool hasSelection
= !selection
.isEmpty();
244 QAction
* renameAction
= actionCollection()->action(KStandardAction::name(KStandardAction::RenameFile
));
245 QAction
* moveToTrashAction
= actionCollection()->action(KStandardAction::name(KStandardAction::MoveToTrash
));
246 QAction
* deleteAction
= actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile
));
247 QAction
* editMimeTypeAction
= actionCollection()->action(QStringLiteral("editMimeType"));
248 QAction
* propertiesAction
= actionCollection()->action(QStringLiteral("properties"));
249 QAction
* deleteWithTrashShortcut
= actionCollection()->action(QStringLiteral("delete_shortcut")); // see DolphinViewActionHandler
252 stateChanged(QStringLiteral("has_no_selection"));
254 emit m_extension
->enableAction("cut", false);
255 emit m_extension
->enableAction("copy", false);
256 deleteWithTrashShortcut
->setEnabled(false);
257 editMimeTypeAction
->setEnabled(false);
259 stateChanged(QStringLiteral("has_selection"));
261 // TODO share this code with DolphinMainWindow::updateEditActions (and the desktop code)
263 KFileItemListProperties
capabilities(selection
);
264 const bool enableMoveToTrash
= capabilities
.isLocal() && capabilities
.supportsMoving();
266 renameAction
->setEnabled(capabilities
.supportsMoving());
267 moveToTrashAction
->setEnabled(enableMoveToTrash
);
268 deleteAction
->setEnabled(capabilities
.supportsDeleting());
269 deleteWithTrashShortcut
->setEnabled(capabilities
.supportsDeleting() && !enableMoveToTrash
);
270 editMimeTypeAction
->setEnabled(true);
271 propertiesAction
->setEnabled(true);
272 emit m_extension
->enableAction("cut", capabilities
.supportsMoving());
273 emit m_extension
->enableAction("copy", true);
277 void DolphinPart::updatePasteAction()
279 QPair
<bool, QString
> pasteInfo
= m_view
->pasteInfo();
280 emit m_extension
->enableAction( "paste", pasteInfo
.first
);
281 emit m_extension
->setActionText( "paste", pasteInfo
.second
);
284 KAboutData
* DolphinPart::createAboutData()
286 return new KAboutData(QStringLiteral("dolphinpart"), i18nc("@title", "Dolphin Part"), QStringLiteral("0.1"));
289 bool DolphinPart::openUrl(const QUrl
&url
)
291 bool reload
= arguments().reload();
292 // A bit of a workaround so that changing the namefilter works: force reload.
293 // Otherwise DolphinView wouldn't relist the URL, so nothing would happen.
294 if (m_nameFilter
!= m_view
->nameFilter())
296 if (m_view
->url() == url
&& !reload
) { // DolphinView won't do anything in that case, so don't emit started
299 setUrl(url
); // remember it at the KParts level
300 QUrl
visibleUrl(url
);
301 if (!m_nameFilter
.isEmpty()) {
302 visibleUrl
.setPath(visibleUrl
.path() + '/' + m_nameFilter
);
304 QString prettyUrl
= visibleUrl
.toDisplayString(QUrl::PreferLocalFile
);
305 emit
setWindowCaption(prettyUrl
);
306 emit m_extension
->setLocationBarUrl(prettyUrl
);
307 emit
started(nullptr); // get the wheel to spin
308 m_view
->setNameFilter(m_nameFilter
);
311 emit
aboutToOpenURL();
314 // Disable "Find File" and "Open Terminal" actions for non-file URLs,
315 // e.g. ftp, smb, etc. #279283
316 const bool isLocalUrl
= url
.isLocalFile();
317 m_findFileAction
->setEnabled(isLocalUrl
);
318 if (m_openTerminalAction
) {
319 m_openTerminalAction
->setEnabled(isLocalUrl
);
324 void DolphinPart::slotMessage(const QString
& msg
)
326 emit
setStatusBarText(msg
);
329 void DolphinPart::slotErrorMessage(const QString
& msg
)
331 qCDebug(DolphinDebug
) << msg
;
333 //KMessageBox::error(m_view, msg);
336 void DolphinPart::slotRequestItemInfo(const KFileItem
& item
)
338 emit m_extension
->mouseOverInfo(item
);
342 const QString escapedText
= Qt::convertFromPlainText(item
.getStatusBarInfo());
343 emit
ReadOnlyPart::setStatusBarText(QStringLiteral("<qt>%1</qt>").arg(escapedText
));
347 void DolphinPart::slotItemActivated(const KFileItem
& item
)
349 KParts::OpenUrlArguments args
;
350 // Forget about the known mimetype if a target URL is used.
351 // Testcase: network:/ with a item (mimetype "inode/some-foo-service") pointing to a http URL (html)
352 if (item
.targetUrl() == item
.url()) {
353 args
.setMimeType(item
.mimetype());
356 // Ideally, konqueror should be changed to not require trustedSource for directory views,
357 // since the idea was not to need BrowserArguments for non-browser stuff...
358 KParts::BrowserArguments browserArgs
;
359 browserArgs
.trustedSource
= true;
360 emit m_extension
->openUrlRequest(item
.targetUrl(), args
, browserArgs
);
363 void DolphinPart::slotItemsActivated(const KFileItemList
& items
)
365 foreach (const KFileItem
& item
, items
) {
366 slotItemActivated(item
);
370 void DolphinPart::createNewWindow(const QUrl
& url
)
372 // TODO: Check issue N176832 for the missing QAIV signal; task 177399 - maybe this code
373 // should be moved into DolphinPart::slotItemActivated()
374 emit m_extension
->createNewWindow(url
);
377 void DolphinPart::slotOpenContextMenu(const QPoint
& pos
,
378 const KFileItem
& _item
,
380 const QList
<QAction
*>& customActions
)
382 KParts::BrowserExtension::PopupFlags popupFlags
= KParts::BrowserExtension::DefaultPopupItems
383 | KParts::BrowserExtension::ShowProperties
384 | KParts::BrowserExtension::ShowUrlOperations
;
386 KFileItem
item(_item
);
388 if (item
.isNull()) { // viewport context menu
389 item
= m_view
->rootItem();
391 item
= KFileItem(url());
393 item
.setUrl(url()); // ensure we use the view url, not the canonical path (#213799)
396 // TODO: We should change the signature of the slots (and signals) for being able
397 // to tell for which items we want a popup.
399 if (m_view
->selectedItems().isEmpty()) {
402 items
= m_view
->selectedItems();
405 KFileItemListProperties
capabilities(items
);
407 KParts::BrowserExtension::ActionGroupMap actionGroups
;
408 QList
<QAction
*> editActions
;
409 editActions
+= m_view
->versionControlActions(m_view
->selectedItems());
410 editActions
+= customActions
;
412 if (!_item
.isNull()) { // only for context menu on one or more items
413 const bool supportsMoving
= capabilities
.supportsMoving();
415 if (capabilities
.supportsDeleting()) {
416 const bool showDeleteAction
= (KSharedConfig::openConfig()->group("KDE").readEntry("ShowDeleteCommand", false) ||
417 !item
.isLocalFile());
418 const bool showMoveToTrashAction
= capabilities
.isLocal() && supportsMoving
;
420 if (showDeleteAction
&& showMoveToTrashAction
) {
421 delete m_removeAction
;
422 m_removeAction
= nullptr;
423 editActions
.append(actionCollection()->action(KStandardAction::name(KStandardAction::MoveToTrash
)));
424 editActions
.append(actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile
)));
425 } else if (showDeleteAction
&& !showMoveToTrashAction
) {
426 editActions
.append(actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile
)));
429 m_removeAction
= new DolphinRemoveAction(this, actionCollection());
430 editActions
.append(m_removeAction
);
431 m_removeAction
->update();
434 popupFlags
|= KParts::BrowserExtension::NoDeletion
;
437 if (supportsMoving
) {
438 editActions
.append(actionCollection()->action(KStandardAction::name(KStandardAction::RenameFile
)));
441 // Normally KonqPopupMenu only shows the "Create new" submenu in the current view
442 // since otherwise the created file would not be visible.
443 // But in treeview mode we should allow it.
444 if (m_view
->itemsExpandable())
445 popupFlags
|= KParts::BrowserExtension::ShowCreateDirectory
;
449 actionGroups
.insert(QStringLiteral("editactions"), editActions
);
451 emit m_extension
->popupMenu(pos
,
453 KParts::OpenUrlArguments(),
454 KParts::BrowserArguments(),
459 void DolphinPart::slotDirectoryRedirection(const QUrl
&oldUrl
, const QUrl
&newUrl
)
461 qCDebug(DolphinDebug
) << oldUrl
<< newUrl
<< "currentUrl=" << url();
462 if (oldUrl
.matches(url(), QUrl::StripTrailingSlash
/* #207572 */)) {
463 KParts::ReadOnlyPart::setUrl(newUrl
);
464 const QString prettyUrl
= newUrl
.toDisplayString(QUrl::PreferLocalFile
);
465 emit m_extension
->setLocationBarUrl(prettyUrl
);
470 void DolphinPart::slotEditMimeType()
472 const KFileItemList items
= m_view
->selectedItems();
473 if (!items
.isEmpty()) {
474 KMimeTypeEditor::editMimeType(items
.first().mimetype(), m_view
);
478 void DolphinPart::slotSelectItemsMatchingPattern()
480 openSelectionDialog(i18nc("@title:window", "Select"),
481 i18n("Select all items matching this pattern:"),
485 void DolphinPart::slotUnselectItemsMatchingPattern()
487 openSelectionDialog(i18nc("@title:window", "Unselect"),
488 i18n("Unselect all items matching this pattern:"),
492 void DolphinPart::openSelectionDialog(const QString
& title
, const QString
& text
, bool selectItems
)
495 const QString pattern
= QInputDialog::getText(m_view
, title
, text
, QLineEdit::Normal
, QStringLiteral("*"), &okClicked
);
497 if (okClicked
&& !pattern
.isEmpty()) {
498 const QRegularExpression
patternRegExp(QRegularExpression::wildcardToRegularExpression(pattern
));
499 m_view
->selectItems(patternRegExp
, selectItems
);
503 void DolphinPart::setCurrentViewMode(const QString
& viewModeName
)
505 QAction
* action
= actionCollection()->action(viewModeName
);
510 QString
DolphinPart::currentViewMode() const
512 return m_actionHandler
->currentViewModeActionName();
515 void DolphinPart::setNameFilter(const QString
& nameFilter
)
517 // This is the "/home/dfaure/*.diff" kind of name filter (KDirLister::setNameFilter)
518 // which is unrelated to DolphinView::setNameFilter which is substring filtering in a proxy.
519 m_nameFilter
= nameFilter
;
520 // TODO save/restore name filter in saveState/restoreState like KonqDirPart did in kde3?
523 void DolphinPart::slotOpenTerminal()
525 KToolInvocation::invokeTerminal(QString(), KParts::ReadOnlyPart::localFilePath());
528 void DolphinPart::slotFindFile()
531 KMoreToolsMenuFactory("dolphin/search-tools").fillMenuFromGroupingNames(
532 &searchTools
, { "files-find" }, QUrl::fromLocalFile(KParts::ReadOnlyPart::localFilePath())
534 QList
<QAction
*> actions
= searchTools
.actions();
535 if (!(actions
.isEmpty())) {
536 actions
.first()->trigger();
538 KIO::CommandLauncherJob
*job
= new KIO::CommandLauncherJob(QStringLiteral("kfind"), {url().toString()}, this);
539 job
->setDesktopName(QStringLiteral("org.kde.kfind"));
540 job
->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled
, widget()));
545 void DolphinPart::updateNewMenu()
547 // As requested by KNewFileMenu :
548 m_newFileMenu
->checkUpToDate();
549 m_newFileMenu
->setViewShowsHiddenFiles(m_view
->hiddenFilesShown());
550 // And set the files that the menu apply on :
551 m_newFileMenu
->setPopupFiles(QList
<QUrl
>() << url());
554 void DolphinPart::updateStatusBar()
556 const QString escapedText
= Qt::convertFromPlainText(m_view
->statusBarText());
557 emit
ReadOnlyPart::setStatusBarText(QStringLiteral("<qt>%1</qt>").arg(escapedText
));
560 void DolphinPart::updateProgress(int percent
)
562 emit m_extension
->loadingProgress(percent
);
565 void DolphinPart::createDirectory()
567 m_newFileMenu
->setViewShowsHiddenFiles(m_view
->hiddenFilesShown());
568 m_newFileMenu
->setPopupFiles(QList
<QUrl
>() << url());
569 m_newFileMenu
->createDirectory();
572 void DolphinPart::setFilesToSelect(const QList
<QUrl
>& files
)
574 if (files
.isEmpty()) {
578 m_view
->markUrlsAsSelected(files
);
579 m_view
->markUrlAsCurrent(files
.at(0));
582 bool DolphinPart::eventFilter(QObject
* obj
, QEvent
* event
)
584 using ShiftState
= DolphinRemoveAction::ShiftState
;
585 const int type
= event
->type();
587 if ((type
== QEvent::KeyPress
|| type
== QEvent::KeyRelease
) && m_removeAction
) {
588 QMenu
* menu
= qobject_cast
<QMenu
*>(obj
);
589 if (menu
&& menu
->parent() == m_view
) {
590 QKeyEvent
* ev
= static_cast<QKeyEvent
*>(event
);
591 if (ev
->key() == Qt::Key_Shift
) {
592 m_removeAction
->update(type
== QEvent::KeyPress
? ShiftState::Pressed
: ShiftState::Released
);
597 return KParts::ReadOnlyPart::eventFilter(obj
, event
);
600 #include "dolphinpart.moc"