1 /* This file is part of the KDE project
2 Copyright (c) 2007 David Faure <faure@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #include "dolphinpart.h"
22 #include <KFileItemListProperties>
23 #include <konq_operations.h>
26 #include <KActionCollection>
27 #include <KConfigGroup>
29 #include <KGlobalSettings>
30 #include <KIconLoader>
32 #include <KMessageBox>
33 #include <KPluginFactory>
35 #include <KToggleAction>
36 #include <KIO/NetAccess>
37 #include <KToolInvocation>
38 #include <kauthorized.h>
39 #include <KNewFileMenu>
41 #include <KInputDialog>
42 #include <KProtocolInfo>
43 #include <kdeversion.h>
45 #if KDE_IS_VERSION(4, 9, 2)
46 #include "dolphinpart_ext.h"
49 #include "views/dolphinview.h"
50 #include "views/dolphinviewactionhandler.h"
51 #include "views/dolphinnewfilemenuobserver.h"
52 #include "views/dolphinremoteencoding.h"
53 #include "kitemviews/kfileitemmodel.h"
54 #include "kitemviews/private/kfileitemmodeldirlister.h"
56 #include <QActionGroup>
57 #include <QApplication>
61 K_PLUGIN_FACTORY(DolphinPartFactory
, registerPlugin
<DolphinPart
>();)
62 K_EXPORT_PLUGIN(DolphinPartFactory("dolphinpart", "dolphin"))
64 DolphinPart::DolphinPart(QWidget
* parentWidget
, QObject
* parent
, const QVariantList
& args
)
65 : KParts::ReadOnlyPart(parent
)
66 ,m_openTerminalAction(0)
69 setComponentData(DolphinPartFactory::componentData(), false);
70 m_extension
= new DolphinPartBrowserExtension(this);
72 // make sure that other apps using this part find Dolphin's view-file-columns icons
73 KIconLoader::global()->addAppDir("dolphin");
75 m_view
= new DolphinView(KUrl(), parentWidget
);
76 m_view
->setTabsForFilesEnabled(true);
79 connect(m_view
, SIGNAL(directoryLoadingCompleted()), this, SIGNAL(completed()));
80 connect(m_view
, SIGNAL(directoryLoadingProgress(int)), this, SLOT(updateProgress(int)));
81 connect(m_view
, SIGNAL(errorMessage(QString
)), this, SLOT(slotErrorMessage(QString
)));
83 setXMLFile("dolphinpart.rc");
85 connect(m_view
, SIGNAL(infoMessage(QString
)),
86 this, SLOT(slotMessage(QString
)));
87 connect(m_view
, SIGNAL(operationCompletedMessage(QString
)),
88 this, SLOT(slotMessage(QString
)));
89 connect(m_view
, SIGNAL(errorMessage(QString
)),
90 this, SLOT(slotErrorMessage(QString
)));
91 connect(m_view
, SIGNAL(itemActivated(KFileItem
)),
92 this, SLOT(slotItemActivated(KFileItem
)));
93 connect(m_view
, SIGNAL(itemsActivated(KFileItemList
)),
94 this, SLOT(slotItemsActivated(KFileItemList
)));
95 connect(m_view
, SIGNAL(tabRequested(KUrl
)),
96 this, SLOT(createNewWindow(KUrl
)));
97 connect(m_view
, SIGNAL(requestContextMenu(QPoint
,KFileItem
,KUrl
,QList
<QAction
*>)),
98 this, SLOT(slotOpenContextMenu(QPoint
,KFileItem
,KUrl
,QList
<QAction
*>)));
99 connect(m_view
, SIGNAL(selectionChanged(KFileItemList
)),
100 m_extension
, SIGNAL(selectionInfo(KFileItemList
)));
101 connect(m_view
, SIGNAL(selectionChanged(KFileItemList
)),
102 this, SLOT(slotSelectionChanged(KFileItemList
)));
103 connect(m_view
, SIGNAL(requestItemInfo(KFileItem
)),
104 this, SLOT(slotRequestItemInfo(KFileItem
)));
105 connect(m_view
, SIGNAL(modeChanged(DolphinView::Mode
,DolphinView::Mode
)),
106 this, SIGNAL(viewModeChanged())); // relay signal
107 connect(m_view
, SIGNAL(redirection(KUrl
,KUrl
)),
108 this, SLOT(slotDirectoryRedirection(KUrl
,KUrl
)));
110 // Watch for changes that should result in updates to the
112 connect(m_view
, SIGNAL(itemCountChanged()), this, SLOT(updateStatusBar()));
113 connect(m_view
, SIGNAL(selectionChanged(KFileItemList
)), this, SLOT(updateStatusBar()));
115 m_actionHandler
= new DolphinViewActionHandler(actionCollection(), this);
116 m_actionHandler
->setCurrentView(m_view
);
117 connect(m_actionHandler
, SIGNAL(createDirectory()), SLOT(createDirectory()));
119 m_remoteEncoding
= new DolphinRemoteEncoding(this, m_actionHandler
);
120 connect(this, SIGNAL(aboutToOpenURL()),
121 m_remoteEncoding
, SLOT(slotAboutToOpenUrl()));
123 QClipboard
* clipboard
= QApplication::clipboard();
124 connect(clipboard
, SIGNAL(dataChanged()),
125 this, SLOT(updatePasteAction()));
127 // Create file info and listing filter extensions.
128 // NOTE: Listing filter needs to be instantiated after the creation of the view.
129 new DolphinPartFileInfoExtension(this);
131 #if KDE_IS_VERSION(4, 9, 2)
132 new DolphinPartListingFilterExtension(this);
134 KDirLister
* lister
= m_view
->m_model
->m_dirLister
;
136 DolphinPartListingNotificationExtension
* notifyExt
= new DolphinPartListingNotificationExtension(this);
137 connect(lister
, SIGNAL(newItems(KFileItemList
)), notifyExt
, SLOT(slotNewItems(KFileItemList
)));
138 connect(lister
, SIGNAL(itemsDeleted(KFileItemList
)), notifyExt
, SLOT(slotItemsDeleted(KFileItemList
)));
140 kWarning() << "NULL KDirLister object! KParts::ListingNotificationExtension will NOT be supported";
145 m_actionHandler
->updateViewActions();
146 slotSelectionChanged(KFileItemList()); // initially disable selection-dependent actions
148 // TODO there was a "always open a new window" (when clicking on a directory) setting in konqueror
149 // (sort of spacial navigation)
151 loadPlugins(this, this, componentData());
154 DolphinPart::~DolphinPart()
156 DolphinNewFileMenuObserver::instance().detach(m_newFileMenu
);
159 void DolphinPart::createActions()
163 m_newFileMenu
= new KNewFileMenu(actionCollection(), "new_menu", this);
164 m_newFileMenu
->setParentWidget(widget());
165 DolphinNewFileMenuObserver::instance().attach(m_newFileMenu
);
166 connect(m_newFileMenu
->menu(), SIGNAL(aboutToShow()),
167 this, SLOT(updateNewMenu()));
169 KAction
*editMimeTypeAction
= actionCollection()->addAction( "editMimeType" );
170 editMimeTypeAction
->setText( i18nc("@action:inmenu Edit", "&Edit File Type..." ) );
171 connect(editMimeTypeAction
, SIGNAL(triggered()), SLOT(slotEditMimeType()));
173 KAction
* selectItemsMatching
= actionCollection()->addAction("select_items_matching");
174 selectItemsMatching
->setText(i18nc("@action:inmenu Edit", "Select Items Matching..."));
175 selectItemsMatching
->setShortcut(Qt::CTRL
| Qt::Key_S
);
176 connect(selectItemsMatching
, SIGNAL(triggered()), this, SLOT(slotSelectItemsMatchingPattern()));
178 KAction
* unselectItemsMatching
= actionCollection()->addAction("unselect_items_matching");
179 unselectItemsMatching
->setText(i18nc("@action:inmenu Edit", "Unselect Items Matching..."));
180 connect(unselectItemsMatching
, SIGNAL(triggered()), this, SLOT(slotUnselectItemsMatchingPattern()));
182 actionCollection()->addAction(KStandardAction::SelectAll
, "select_all", m_view
, SLOT(selectAll()));
184 KAction
* unselectAll
= actionCollection()->addAction("unselect_all");
185 unselectAll
->setText(i18nc("@action:inmenu Edit", "Unselect All"));
186 connect(unselectAll
, SIGNAL(triggered()), m_view
, SLOT(clearSelection()));
188 KAction
* invertSelection
= actionCollection()->addAction("invert_selection");
189 invertSelection
->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
190 invertSelection
->setShortcut(Qt::CTRL
| Qt::SHIFT
| Qt::Key_A
);
191 connect(invertSelection
, SIGNAL(triggered()), m_view
, SLOT(invertSelection()));
193 // View menu: all done by DolphinViewActionHandler
197 QActionGroup
* goActionGroup
= new QActionGroup(this);
198 connect(goActionGroup
, SIGNAL(triggered(QAction
*)),
199 this, SLOT(slotGoTriggered(QAction
*)));
201 createGoAction("go_applications", "start-here-kde",
202 i18nc("@action:inmenu Go", "App&lications"), QString("programs:/"),
204 createGoAction("go_network_folders", "folder-remote",
205 i18nc("@action:inmenu Go", "&Network Folders"), QString("remote:/"),
207 createGoAction("go_settings", "preferences-system",
208 i18nc("@action:inmenu Go", "Sett&ings"), QString("settings:/"),
210 createGoAction("go_trash", "user-trash",
211 i18nc("@action:inmenu Go", "Trash"), QString("trash:/"),
213 createGoAction("go_autostart", "",
214 i18nc("@action:inmenu Go", "Autostart"), KGlobalSettings::autostartPath(),
218 m_findFileAction
= actionCollection()->addAction("find_file");
219 m_findFileAction
->setText(i18nc("@action:inmenu Tools", "Find File..."));
220 m_findFileAction
->setShortcut(Qt::CTRL
| Qt::Key_F
);
221 m_findFileAction
->setIcon(KIcon("edit-find"));
222 connect(m_findFileAction
, SIGNAL(triggered()), this, SLOT(slotFindFile()));
224 if (KAuthorized::authorizeKAction("shell_access")) {
225 m_openTerminalAction
= actionCollection()->addAction("open_terminal");
226 m_openTerminalAction
->setIcon(KIcon("utilities-terminal"));
227 m_openTerminalAction
->setText(i18nc("@action:inmenu Tools", "Open &Terminal"));
228 connect(m_openTerminalAction
, SIGNAL(triggered()), SLOT(slotOpenTerminal()));
229 m_openTerminalAction
->setShortcut(Qt::Key_F4
);
233 void DolphinPart::createGoAction(const char* name
, const char* iconName
,
234 const QString
& text
, const QString
& url
,
235 QActionGroup
* actionGroup
)
237 KAction
* action
= actionCollection()->addAction(name
);
238 action
->setIcon(KIcon(iconName
));
239 action
->setText(text
);
240 action
->setData(url
);
241 action
->setActionGroup(actionGroup
);
244 void DolphinPart::slotGoTriggered(QAction
* action
)
246 const QString url
= action
->data().toString();
247 emit m_extension
->openUrlRequest(KUrl(url
));
250 void DolphinPart::slotSelectionChanged(const KFileItemList
& selection
)
252 const bool hasSelection
= !selection
.isEmpty();
254 QAction
* renameAction
= actionCollection()->action("rename");
255 QAction
* moveToTrashAction
= actionCollection()->action("move_to_trash");
256 QAction
* deleteAction
= actionCollection()->action("delete");
257 QAction
* editMimeTypeAction
= actionCollection()->action("editMimeType");
258 QAction
* propertiesAction
= actionCollection()->action("properties");
259 QAction
* deleteWithTrashShortcut
= actionCollection()->action("delete_shortcut"); // see DolphinViewActionHandler
262 stateChanged("has_no_selection");
264 emit m_extension
->enableAction("cut", false);
265 emit m_extension
->enableAction("copy", false);
266 deleteWithTrashShortcut
->setEnabled(false);
267 editMimeTypeAction
->setEnabled(false);
269 stateChanged("has_selection");
271 // TODO share this code with DolphinMainWindow::updateEditActions (and the desktop code)
273 KFileItemListProperties
capabilities(selection
);
274 const bool enableMoveToTrash
= capabilities
.isLocal() && capabilities
.supportsMoving();
276 renameAction
->setEnabled(capabilities
.supportsMoving());
277 moveToTrashAction
->setEnabled(enableMoveToTrash
);
278 deleteAction
->setEnabled(capabilities
.supportsDeleting());
279 deleteWithTrashShortcut
->setEnabled(capabilities
.supportsDeleting() && !enableMoveToTrash
);
280 editMimeTypeAction
->setEnabled(true);
281 propertiesAction
->setEnabled(true);
282 emit m_extension
->enableAction("cut", capabilities
.supportsMoving());
283 emit m_extension
->enableAction("copy", true);
287 void DolphinPart::updatePasteAction()
289 QPair
<bool, QString
> pasteInfo
= m_view
->pasteInfo();
290 emit m_extension
->enableAction( "paste", pasteInfo
.first
);
291 emit m_extension
->setActionText( "paste", pasteInfo
.second
);
294 KAboutData
* DolphinPart::createAboutData()
296 return new KAboutData("dolphinpart", "dolphin", ki18nc("@title", "Dolphin Part"), "0.1");
299 bool DolphinPart::openUrl(const KUrl
& url
)
301 bool reload
= arguments().reload();
302 // A bit of a workaround so that changing the namefilter works: force reload.
303 // Otherwise DolphinView wouldn't relist the URL, so nothing would happen.
304 if (m_nameFilter
!= m_view
->nameFilter())
306 if (m_view
->url() == url
&& !reload
) { // DolphinView won't do anything in that case, so don't emit started
309 setUrl(url
); // remember it at the KParts level
310 KUrl
visibleUrl(url
);
311 if (!m_nameFilter
.isEmpty()) {
312 visibleUrl
.addPath(m_nameFilter
);
314 QString prettyUrl
= visibleUrl
.pathOrUrl();
315 emit
setWindowCaption(prettyUrl
);
316 emit m_extension
->setLocationBarUrl(prettyUrl
);
317 emit
started(0); // get the wheel to spin
318 m_view
->setNameFilter(m_nameFilter
);
321 emit
aboutToOpenURL();
324 // Disable "Find File" and "Open Terminal" actions for non-file URLs,
325 // e.g. ftp, smb, etc. #279283
326 const bool isLocalUrl
= url
.isLocalFile();
327 m_findFileAction
->setEnabled(isLocalUrl
);
328 if (m_openTerminalAction
) {
329 m_openTerminalAction
->setEnabled(isLocalUrl
);
334 void DolphinPart::slotMessage(const QString
& msg
)
336 emit
setStatusBarText(msg
);
339 void DolphinPart::slotErrorMessage(const QString
& msg
)
343 //KMessageBox::error(m_view, msg);
346 void DolphinPart::slotRequestItemInfo(const KFileItem
& item
)
348 emit m_extension
->mouseOverInfo(item
);
352 ReadOnlyPart::setStatusBarText(item
.getStatusBarInfo());
356 void DolphinPart::slotItemActivated(const KFileItem
& item
)
358 KParts::OpenUrlArguments args
;
359 // Forget about the known mimetype if a target URL is used.
360 // Testcase: network:/ with a item (mimetype "inode/some-foo-service") pointing to a http URL (html)
361 if (item
.targetUrl() == item
.url()) {
362 args
.setMimeType(item
.mimetype());
365 // Ideally, konqueror should be changed to not require trustedSource for directory views,
366 // since the idea was not to need BrowserArguments for non-browser stuff...
367 KParts::BrowserArguments browserArgs
;
368 browserArgs
.trustedSource
= true;
369 emit m_extension
->openUrlRequest(item
.targetUrl(), args
, browserArgs
);
372 void DolphinPart::slotItemsActivated(const KFileItemList
& items
)
374 foreach (const KFileItem
& item
, items
) {
375 slotItemActivated(item
);
379 void DolphinPart::createNewWindow(const KUrl
& url
)
381 // TODO: Check issue N176832 for the missing QAIV signal; task 177399 - maybe this code
382 // should be moved into DolphinPart::slotItemActivated()
383 emit m_extension
->createNewWindow(url
);
386 void DolphinPart::slotOpenContextMenu(const QPoint
& pos
,
387 const KFileItem
& _item
,
389 const QList
<QAction
*>& customActions
)
391 KParts::BrowserExtension::PopupFlags popupFlags
= KParts::BrowserExtension::DefaultPopupItems
392 | KParts::BrowserExtension::ShowProperties
393 | KParts::BrowserExtension::ShowUrlOperations
;
395 KFileItem
item(_item
);
397 if (item
.isNull()) { // viewport context menu
398 popupFlags
|= KParts::BrowserExtension::ShowNavigationItems
| KParts::BrowserExtension::ShowUp
;
399 item
= m_view
->rootItem();
401 item
= KFileItem( S_IFDIR
, (mode_t
)-1, url() );
403 item
.setUrl(url()); // ensure we use the view url, not the canonical path (#213799)
406 // TODO: We should change the signature of the slots (and signals) for being able
407 // to tell for which items we want a popup.
409 if (m_view
->selectedItems().isEmpty()) {
412 items
= m_view
->selectedItems();
415 KFileItemListProperties
capabilities(items
);
417 KParts::BrowserExtension::ActionGroupMap actionGroups
;
418 QList
<QAction
*> editActions
;
419 editActions
+= m_view
->versionControlActions(m_view
->selectedItems());
420 editActions
+= customActions
;
422 if (!_item
.isNull()) { // only for context menu on one or more items
423 bool supportsDeleting
= capabilities
.supportsDeleting();
424 bool supportsMoving
= capabilities
.supportsMoving();
426 if (!supportsDeleting
) {
427 popupFlags
|= KParts::BrowserExtension::NoDeletion
;
430 if (supportsMoving
) {
431 editActions
.append(actionCollection()->action("rename"));
434 bool addTrash
= capabilities
.isLocal() && supportsMoving
;
436 if (supportsDeleting
) {
437 if ( !item
.isLocalFile() )
439 else if (QApplication::keyboardModifiers() & Qt::ShiftModifier
) {
444 KSharedConfig::Ptr globalConfig
= KSharedConfig::openConfig("kdeglobals", KConfig::IncludeGlobals
);
445 KConfigGroup
configGroup(globalConfig
, "KDE");
446 addDel
= configGroup
.readEntry("ShowDeleteCommand", false);
451 editActions
.append(actionCollection()->action("move_to_trash"));
453 editActions
.append(actionCollection()->action("delete"));
455 // Normally KonqPopupMenu only shows the "Create new" submenu in the current view
456 // since otherwise the created file would not be visible.
457 // But in treeview mode we should allow it.
458 if (m_view
->itemsExpandable())
459 popupFlags
|= KParts::BrowserExtension::ShowCreateDirectory
;
463 actionGroups
.insert("editactions", editActions
);
465 emit m_extension
->popupMenu(pos
,
467 KParts::OpenUrlArguments(),
468 KParts::BrowserArguments(),
473 void DolphinPart::slotDirectoryRedirection(const KUrl
& oldUrl
, const KUrl
& newUrl
)
475 //kDebug() << oldUrl << newUrl << "currentUrl=" << url();
476 if (oldUrl
.equals(url(), KUrl::CompareWithoutTrailingSlash
/* #207572 */)) {
477 KParts::ReadOnlyPart::setUrl(newUrl
);
478 const QString prettyUrl
= newUrl
.pathOrUrl();
479 emit m_extension
->setLocationBarUrl(prettyUrl
);
484 void DolphinPart::slotEditMimeType()
486 const KFileItemList items
= m_view
->selectedItems();
487 if (!items
.isEmpty()) {
488 KonqOperations::editMimeType(items
.first().mimetype(), m_view
);
492 void DolphinPart::slotSelectItemsMatchingPattern()
494 openSelectionDialog(i18nc("@title:window", "Select"),
495 i18n("Select all items matching this pattern:"),
499 void DolphinPart::slotUnselectItemsMatchingPattern()
501 openSelectionDialog(i18nc("@title:window", "Unselect"),
502 i18n("Unselect all items matching this pattern:"),
506 void DolphinPart::openSelectionDialog(const QString
& title
, const QString
& text
, bool selectItems
)
509 QString pattern
= KInputDialog::getText(title
, text
, "*", &okClicked
, m_view
);
511 if (okClicked
&& !pattern
.isEmpty()) {
512 QRegExp
patternRegExp(pattern
, Qt::CaseSensitive
, QRegExp::Wildcard
);
513 m_view
->selectItems(patternRegExp
, selectItems
);
517 void DolphinPart::setCurrentViewMode(const QString
& viewModeName
)
519 QAction
* action
= actionCollection()->action(viewModeName
);
524 QString
DolphinPart::currentViewMode() const
526 return m_actionHandler
->currentViewModeActionName();
529 void DolphinPart::setNameFilter(const QString
& nameFilter
)
531 // This is the "/home/dfaure/*.diff" kind of name filter (KDirLister::setNameFilter)
532 // which is unrelated to DolphinView::setNameFilter which is substring filtering in a proxy.
533 m_nameFilter
= nameFilter
;
534 // TODO save/restore name filter in saveState/restoreState like KonqDirPart did in kde3?
537 void DolphinPart::slotOpenTerminal()
539 QString
dir(QDir::homePath());
543 // If the given directory is not local, it can still be the URL of an
544 // ioslave using UDS_LOCAL_PATH which to be converted first.
545 u
= KIO::NetAccess::mostLocalUrl(u
, widget());
547 //If the URL is local after the above conversion, set the directory.
548 if (u
.isLocalFile()) {
549 dir
= u
.toLocalFile();
552 KToolInvocation::invokeTerminal(QString(), dir
);
555 void DolphinPart::slotFindFile()
557 KRun::run("kfind", url(), widget());
560 void DolphinPart::updateNewMenu()
562 // As requested by KNewFileMenu :
563 m_newFileMenu
->checkUpToDate();
564 m_newFileMenu
->setViewShowsHiddenFiles(m_view
->hiddenFilesShown());
565 // And set the files that the menu apply on :
566 m_newFileMenu
->setPopupFiles(url());
569 void DolphinPart::updateStatusBar()
571 emit
ReadOnlyPart::setStatusBarText(m_view
->statusBarText());
574 void DolphinPart::updateProgress(int percent
)
576 m_extension
->loadingProgress(percent
);
579 void DolphinPart::createDirectory()
581 m_newFileMenu
->setViewShowsHiddenFiles(m_view
->hiddenFilesShown());
582 m_newFileMenu
->setPopupFiles(url());
583 m_newFileMenu
->createDirectory();
586 void DolphinPart::setFilesToSelect(const KUrl::List
& files
)
588 if (files
.isEmpty()) {
592 m_view
->markUrlsAsSelected(files
);
593 m_view
->markUrlAsCurrent(files
.at(0));
598 void DolphinPartBrowserExtension::restoreState(QDataStream
&stream
)
600 KParts::BrowserExtension::restoreState(stream
);
601 m_part
->view()->restoreState(stream
);
604 void DolphinPartBrowserExtension::saveState(QDataStream
&stream
)
606 KParts::BrowserExtension::saveState(stream
);
607 m_part
->view()->saveState(stream
);
610 void DolphinPartBrowserExtension::cut()
612 m_part
->view()->cutSelectedItems();
615 void DolphinPartBrowserExtension::copy()
617 m_part
->view()->copySelectedItems();
620 void DolphinPartBrowserExtension::paste()
622 m_part
->view()->paste();
625 void DolphinPartBrowserExtension::pasteTo(const KUrl
&)
627 m_part
->view()->pasteIntoFolder();
630 void DolphinPartBrowserExtension::reparseConfiguration()
632 m_part
->view()->readSettings();
637 DolphinPartFileInfoExtension::DolphinPartFileInfoExtension(DolphinPart
* part
)
638 : KParts::FileInfoExtension(part
)
642 DolphinPart
* DolphinPartFileInfoExtension::part() const
644 return static_cast<DolphinPart
*>(parent());
647 bool DolphinPartFileInfoExtension::hasSelection() const
649 return part()->view()->selectedItemsCount() > 0;
652 KParts::FileInfoExtension::QueryModes
DolphinPartFileInfoExtension::supportedQueryModes() const
654 return (KParts::FileInfoExtension::AllItems
| KParts::FileInfoExtension::SelectedItems
);
657 KFileItemList
DolphinPartFileInfoExtension::queryFor(KParts::FileInfoExtension::QueryMode mode
) const
661 if (mode
== KParts::FileInfoExtension::None
)
664 if (!(supportedQueryModes() & mode
))
668 case KParts::FileInfoExtension::SelectedItems
:
670 return part()->view()->selectedItems();
672 case KParts::FileInfoExtension::AllItems
:
673 return part()->view()->items();
681 #include "dolphinpart.moc"