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>
44 #include "views/dolphinview.h"
45 #include "views/dolphinviewactionhandler.h"
46 #include "views/dolphinnewfilemenuobserver.h"
47 #include "views/dolphinremoteencoding.h"
49 #include <QActionGroup>
50 #include <QApplication>
54 K_PLUGIN_FACTORY(DolphinPartFactory
, registerPlugin
<DolphinPart
>();)
55 K_EXPORT_PLUGIN(DolphinPartFactory("dolphinpart", "dolphin"))
57 DolphinPart::DolphinPart(QWidget
* parentWidget
, QObject
* parent
, const QVariantList
& args
)
58 : KParts::ReadOnlyPart(parent
)
59 ,m_openTerminalAction(0)
62 setComponentData(DolphinPartFactory::componentData(), false);
63 m_extension
= new DolphinPartBrowserExtension(this);
65 // make sure that other apps using this part find Dolphin's view-file-columns icons
66 KIconLoader::global()->addAppDir("dolphin");
68 m_view
= new DolphinView(KUrl(), parentWidget
);
69 m_view
->setTabsForFilesEnabled(true);
72 connect(m_view
, SIGNAL(directoryLoadingCompleted()), this, SIGNAL(completed()));
73 connect(m_view
, SIGNAL(directoryLoadingProgress(int)), this, SLOT(updateProgress(int)));
74 connect(m_view
, SIGNAL(errorMessage(QString
)), this, SLOT(slotErrorMessage(QString
)));
76 setXMLFile("dolphinpart.rc");
78 connect(m_view
, SIGNAL(infoMessage(QString
)),
79 this, SLOT(slotMessage(QString
)));
80 connect(m_view
, SIGNAL(operationCompletedMessage(QString
)),
81 this, SLOT(slotMessage(QString
)));
82 connect(m_view
, SIGNAL(errorMessage(QString
)),
83 this, SLOT(slotErrorMessage(QString
)));
84 connect(m_view
, SIGNAL(itemActivated(KFileItem
)),
85 this, SLOT(slotItemActivated(KFileItem
)));
86 connect(m_view
, SIGNAL(tabRequested(KUrl
)),
87 this, SLOT(createNewWindow(KUrl
)));
88 connect(m_view
, SIGNAL(requestContextMenu(QPoint
,KFileItem
,KUrl
,QList
<QAction
*>)),
89 this, SLOT(slotOpenContextMenu(QPoint
,KFileItem
,KUrl
,QList
<QAction
*>)));
90 connect(m_view
, SIGNAL(selectionChanged(KFileItemList
)),
91 m_extension
, SIGNAL(selectionInfo(KFileItemList
)));
92 connect(m_view
, SIGNAL(selectionChanged(KFileItemList
)),
93 this, SLOT(slotSelectionChanged(KFileItemList
)));
94 connect(m_view
, SIGNAL(requestItemInfo(KFileItem
)),
95 this, SLOT(slotRequestItemInfo(KFileItem
)));
96 connect(m_view
, SIGNAL(modeChanged(DolphinView::Mode
,DolphinView::Mode
)),
97 this, SIGNAL(viewModeChanged())); // relay signal
98 connect(m_view
, SIGNAL(redirection(KUrl
,KUrl
)),
99 this, SLOT(slotDirectoryRedirection(KUrl
,KUrl
)));
101 // Watch for changes that should result in updates to the
103 connect(m_view
, SIGNAL(itemCountChanged()), this, SLOT(updateStatusBar()));
104 connect(m_view
, SIGNAL(selectionChanged(KFileItemList
)), this, SLOT(updateStatusBar()));
106 m_actionHandler
= new DolphinViewActionHandler(actionCollection(), this);
107 m_actionHandler
->setCurrentView(m_view
);
108 connect(m_actionHandler
, SIGNAL(createDirectory()), SLOT(createDirectory()));
110 m_remoteEncoding
= new DolphinRemoteEncoding(this, m_actionHandler
);
111 connect(this, SIGNAL(aboutToOpenURL()),
112 m_remoteEncoding
, SLOT(slotAboutToOpenUrl()));
114 QClipboard
* clipboard
= QApplication::clipboard();
115 connect(clipboard
, SIGNAL(dataChanged()),
116 this, SLOT(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);
121 new DolphinPartListingFilterExtension(this);
124 m_actionHandler
->updateViewActions();
125 slotSelectionChanged(KFileItemList()); // initially disable selection-dependent actions
127 // TODO there was a "always open a new window" (when clicking on a directory) setting in konqueror
128 // (sort of spacial navigation)
130 loadPlugins(this, this, componentData());
134 DolphinPart::~DolphinPart()
136 DolphinNewFileMenuObserver::instance().detach(m_newFileMenu
);
139 void DolphinPart::createActions()
143 m_newFileMenu
= new KNewFileMenu(actionCollection(), "new_menu", this);
144 m_newFileMenu
->setParentWidget(widget());
145 DolphinNewFileMenuObserver::instance().attach(m_newFileMenu
);
146 connect(m_newFileMenu
->menu(), SIGNAL(aboutToShow()),
147 this, SLOT(updateNewMenu()));
149 KAction
*editMimeTypeAction
= actionCollection()->addAction( "editMimeType" );
150 editMimeTypeAction
->setText( i18nc("@action:inmenu Edit", "&Edit File Type..." ) );
151 connect(editMimeTypeAction
, SIGNAL(triggered()), SLOT(slotEditMimeType()));
153 KAction
* selectItemsMatching
= actionCollection()->addAction("select_items_matching");
154 selectItemsMatching
->setText(i18nc("@action:inmenu Edit", "Select Items Matching..."));
155 selectItemsMatching
->setShortcut(Qt::CTRL
| Qt::Key_S
);
156 connect(selectItemsMatching
, SIGNAL(triggered()), this, SLOT(slotSelectItemsMatchingPattern()));
158 KAction
* unselectItemsMatching
= actionCollection()->addAction("unselect_items_matching");
159 unselectItemsMatching
->setText(i18nc("@action:inmenu Edit", "Unselect Items Matching..."));
160 connect(unselectItemsMatching
, SIGNAL(triggered()), this, SLOT(slotUnselectItemsMatchingPattern()));
162 actionCollection()->addAction(KStandardAction::SelectAll
, "select_all", m_view
, SLOT(selectAll()));
164 KAction
* unselectAll
= actionCollection()->addAction("unselect_all");
165 unselectAll
->setText(i18nc("@action:inmenu Edit", "Unselect All"));
166 connect(unselectAll
, SIGNAL(triggered()), m_view
, SLOT(clearSelection()));
168 KAction
* invertSelection
= actionCollection()->addAction("invert_selection");
169 invertSelection
->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
170 invertSelection
->setShortcut(Qt::CTRL
| Qt::SHIFT
| Qt::Key_A
);
171 connect(invertSelection
, SIGNAL(triggered()), m_view
, SLOT(invertSelection()));
173 // View menu: all done by DolphinViewActionHandler
177 QActionGroup
* goActionGroup
= new QActionGroup(this);
178 connect(goActionGroup
, SIGNAL(triggered(QAction
*)),
179 this, SLOT(slotGoTriggered(QAction
*)));
181 createGoAction("go_applications", "start-here-kde",
182 i18nc("@action:inmenu Go", "App&lications"), QString("programs:/"),
184 createGoAction("go_network_folders", "folder-remote",
185 i18nc("@action:inmenu Go", "&Network Folders"), QString("remote:/"),
187 createGoAction("go_settings", "preferences-system",
188 i18nc("@action:inmenu Go", "Sett&ings"), QString("settings:/"),
190 createGoAction("go_trash", "user-trash",
191 i18nc("@action:inmenu Go", "Trash"), QString("trash:/"),
193 createGoAction("go_autostart", "",
194 i18nc("@action:inmenu Go", "Autostart"), KGlobalSettings::autostartPath(),
198 m_findFileAction
= actionCollection()->addAction("find_file");
199 m_findFileAction
->setText(i18nc("@action:inmenu Tools", "Find File..."));
200 m_findFileAction
->setShortcut(Qt::CTRL
| Qt::Key_F
);
201 m_findFileAction
->setIcon(KIcon("edit-find"));
202 connect(m_findFileAction
, SIGNAL(triggered()), this, SLOT(slotFindFile()));
204 if (KAuthorized::authorizeKAction("shell_access")) {
205 m_openTerminalAction
= actionCollection()->addAction("open_terminal");
206 m_openTerminalAction
->setIcon(KIcon("utilities-terminal"));
207 m_openTerminalAction
->setText(i18nc("@action:inmenu Tools", "Open &Terminal"));
208 connect(m_openTerminalAction
, SIGNAL(triggered()), SLOT(slotOpenTerminal()));
209 m_openTerminalAction
->setShortcut(Qt::Key_F4
);
213 void DolphinPart::createGoAction(const char* name
, const char* iconName
,
214 const QString
& text
, const QString
& url
,
215 QActionGroup
* actionGroup
)
217 KAction
* action
= actionCollection()->addAction(name
);
218 action
->setIcon(KIcon(iconName
));
219 action
->setText(text
);
220 action
->setData(url
);
221 action
->setActionGroup(actionGroup
);
224 void DolphinPart::slotGoTriggered(QAction
* action
)
226 const QString url
= action
->data().toString();
227 emit m_extension
->openUrlRequest(KUrl(url
));
230 void DolphinPart::slotSelectionChanged(const KFileItemList
& selection
)
232 const bool hasSelection
= !selection
.isEmpty();
234 QAction
* renameAction
= actionCollection()->action("rename");
235 QAction
* moveToTrashAction
= actionCollection()->action("move_to_trash");
236 QAction
* deleteAction
= actionCollection()->action("delete");
237 QAction
* editMimeTypeAction
= actionCollection()->action("editMimeType");
238 QAction
* propertiesAction
= actionCollection()->action("properties");
239 QAction
* deleteWithTrashShortcut
= actionCollection()->action("delete_shortcut"); // see DolphinViewActionHandler
242 stateChanged("has_no_selection");
244 emit m_extension
->enableAction("cut", false);
245 emit m_extension
->enableAction("copy", false);
246 deleteWithTrashShortcut
->setEnabled(false);
247 editMimeTypeAction
->setEnabled(false);
249 stateChanged("has_selection");
251 // TODO share this code with DolphinMainWindow::updateEditActions (and the desktop code)
253 KFileItemListProperties
capabilities(selection
);
254 const bool enableMoveToTrash
= capabilities
.isLocal() && capabilities
.supportsMoving();
256 renameAction
->setEnabled(capabilities
.supportsMoving());
257 moveToTrashAction
->setEnabled(enableMoveToTrash
);
258 deleteAction
->setEnabled(capabilities
.supportsDeleting());
259 deleteWithTrashShortcut
->setEnabled(capabilities
.supportsDeleting() && !enableMoveToTrash
);
260 editMimeTypeAction
->setEnabled(true);
261 propertiesAction
->setEnabled(true);
262 emit m_extension
->enableAction("cut", capabilities
.supportsMoving());
263 emit m_extension
->enableAction("copy", true);
267 void DolphinPart::updatePasteAction()
269 QPair
<bool, QString
> pasteInfo
= m_view
->pasteInfo();
270 emit m_extension
->enableAction( "paste", pasteInfo
.first
);
271 emit m_extension
->setActionText( "paste", pasteInfo
.second
);
274 KAboutData
* DolphinPart::createAboutData()
276 return new KAboutData("dolphinpart", "dolphin", ki18nc("@title", "Dolphin Part"), "0.1");
279 bool DolphinPart::openUrl(const KUrl
& url
)
281 bool reload
= arguments().reload();
282 // A bit of a workaround so that changing the namefilter works: force reload.
283 // Otherwise DolphinView wouldn't relist the URL, so nothing would happen.
284 if (m_nameFilter
!= m_view
->nameFilter())
286 if (m_view
->url() == url
&& !reload
) { // DolphinView won't do anything in that case, so don't emit started
289 setUrl(url
); // remember it at the KParts level
290 KUrl
visibleUrl(url
);
291 if (!m_nameFilter
.isEmpty()) {
292 visibleUrl
.addPath(m_nameFilter
);
294 QString prettyUrl
= visibleUrl
.pathOrUrl();
295 emit
setWindowCaption(prettyUrl
);
296 emit m_extension
->setLocationBarUrl(prettyUrl
);
297 emit
started(0); // get the wheel to spin
298 m_view
->setNameFilter(m_nameFilter
);
301 emit
aboutToOpenURL();
304 // Disable "Find File" and "Open Terminal" actions for non-file URLs,
305 // e.g. ftp, smb, etc. #279283
306 const bool isLocalUrl
= url
.isLocalFile();
307 m_findFileAction
->setEnabled(isLocalUrl
);
308 if (m_openTerminalAction
) {
309 m_openTerminalAction
->setEnabled(isLocalUrl
);
314 void DolphinPart::slotMessage(const QString
& msg
)
316 emit
setStatusBarText(msg
);
319 void DolphinPart::slotErrorMessage(const QString
& msg
)
323 //KMessageBox::error(m_view, msg);
326 void DolphinPart::slotRequestItemInfo(const KFileItem
& item
)
328 emit m_extension
->mouseOverInfo(item
);
332 ReadOnlyPart::setStatusBarText(item
.getStatusBarInfo());
336 void DolphinPart::slotItemActivated(const KFileItem
& item
)
338 KParts::OpenUrlArguments args
;
339 // Forget about the known mimetype if a target URL is used.
340 // Testcase: network:/ with a item (mimetype "inode/some-foo-service") pointing to a http URL (html)
341 if (item
.targetUrl() == item
.url()) {
342 args
.setMimeType(item
.mimetype());
345 // Ideally, konqueror should be changed to not require trustedSource for directory views,
346 // since the idea was not to need BrowserArguments for non-browser stuff...
347 KParts::BrowserArguments browserArgs
;
348 browserArgs
.trustedSource
= true;
349 emit m_extension
->openUrlRequest(item
.targetUrl(), args
, browserArgs
);
352 void DolphinPart::createNewWindow(const KUrl
& url
)
354 // TODO: Check issue N176832 for the missing QAIV signal; task 177399 - maybe this code
355 // should be moved into DolphinPart::slotItemActivated()
356 emit m_extension
->createNewWindow(url
);
359 void DolphinPart::slotOpenContextMenu(const QPoint
& pos
,
360 const KFileItem
& _item
,
362 const QList
<QAction
*>& customActions
)
364 KParts::BrowserExtension::PopupFlags popupFlags
= KParts::BrowserExtension::DefaultPopupItems
365 | KParts::BrowserExtension::ShowProperties
366 | KParts::BrowserExtension::ShowUrlOperations
;
368 KFileItem
item(_item
);
370 if (item
.isNull()) { // viewport context menu
371 popupFlags
|= KParts::BrowserExtension::ShowNavigationItems
| KParts::BrowserExtension::ShowUp
;
372 item
= m_view
->rootItem();
374 item
= KFileItem( S_IFDIR
, (mode_t
)-1, url() );
376 item
.setUrl(url()); // ensure we use the view url, not the canonical path (#213799)
379 // TODO: We should change the signature of the slots (and signals) for being able
380 // to tell for which items we want a popup.
382 if (m_view
->selectedItems().isEmpty()) {
385 items
= m_view
->selectedItems();
388 KFileItemListProperties
capabilities(items
);
390 KParts::BrowserExtension::ActionGroupMap actionGroups
;
391 QList
<QAction
*> editActions
;
392 editActions
+= m_view
->versionControlActions(m_view
->selectedItems());
393 editActions
+= customActions
;
395 if (!_item
.isNull()) { // only for context menu on one or more items
396 bool supportsDeleting
= capabilities
.supportsDeleting();
397 bool supportsMoving
= capabilities
.supportsMoving();
399 if (!supportsDeleting
) {
400 popupFlags
|= KParts::BrowserExtension::NoDeletion
;
403 if (supportsMoving
) {
404 editActions
.append(actionCollection()->action("rename"));
407 bool addTrash
= capabilities
.isLocal() && supportsMoving
;
409 if (supportsDeleting
) {
410 if ( !item
.isLocalFile() )
412 else if (QApplication::keyboardModifiers() & Qt::ShiftModifier
) {
417 KSharedConfig::Ptr globalConfig
= KSharedConfig::openConfig("kdeglobals", KConfig::IncludeGlobals
);
418 KConfigGroup
configGroup(globalConfig
, "KDE");
419 addDel
= configGroup
.readEntry("ShowDeleteCommand", false);
424 editActions
.append(actionCollection()->action("move_to_trash"));
426 editActions
.append(actionCollection()->action("delete"));
428 // Normally KonqPopupMenu only shows the "Create new" submenu in the current view
429 // since otherwise the created file would not be visible.
430 // But in treeview mode we should allow it.
431 if (m_view
->itemsExpandable())
432 popupFlags
|= KParts::BrowserExtension::ShowCreateDirectory
;
436 actionGroups
.insert("editactions", editActions
);
438 emit m_extension
->popupMenu(pos
,
440 KParts::OpenUrlArguments(),
441 KParts::BrowserArguments(),
446 void DolphinPart::slotDirectoryRedirection(const KUrl
& oldUrl
, const KUrl
& newUrl
)
448 //kDebug() << oldUrl << newUrl << "currentUrl=" << url();
449 if (oldUrl
.equals(url(), KUrl::CompareWithoutTrailingSlash
/* #207572 */)) {
450 KParts::ReadOnlyPart::setUrl(newUrl
);
451 const QString prettyUrl
= newUrl
.pathOrUrl();
452 emit m_extension
->setLocationBarUrl(prettyUrl
);
457 void DolphinPart::slotEditMimeType()
459 const KFileItemList items
= m_view
->selectedItems();
460 if (!items
.isEmpty()) {
461 KonqOperations::editMimeType(items
.first().mimetype(), m_view
);
465 void DolphinPart::slotSelectItemsMatchingPattern()
467 openSelectionDialog(i18nc("@title:window", "Select"),
468 i18n("Select all items matching this pattern:"),
472 void DolphinPart::slotUnselectItemsMatchingPattern()
474 openSelectionDialog(i18nc("@title:window", "Unselect"),
475 i18n("Unselect all items matching this pattern:"),
479 void DolphinPart::openSelectionDialog(const QString
& title
, const QString
& text
, bool selectItems
)
482 QString pattern
= KInputDialog::getText(title
, text
, "*", &okClicked
, m_view
);
484 if (okClicked
&& !pattern
.isEmpty()) {
485 QRegExp
patternRegExp(pattern
, Qt::CaseSensitive
, QRegExp::Wildcard
);
486 m_view
->selectItems(patternRegExp
, selectItems
);
490 void DolphinPart::setCurrentViewMode(const QString
& viewModeName
)
492 QAction
* action
= actionCollection()->action(viewModeName
);
497 QString
DolphinPart::currentViewMode() const
499 return m_actionHandler
->currentViewModeActionName();
502 void DolphinPart::setNameFilter(const QString
& nameFilter
)
504 // This is the "/home/dfaure/*.diff" kind of name filter (KDirLister::setNameFilter)
505 // which is unrelated to DolphinView::setNameFilter which is substring filtering in a proxy.
506 m_nameFilter
= nameFilter
;
507 // TODO save/restore name filter in saveState/restoreState like KonqDirPart did in kde3?
510 void DolphinPart::slotOpenTerminal()
512 QString
dir(QDir::homePath());
516 // If the given directory is not local, it can still be the URL of an
517 // ioslave using UDS_LOCAL_PATH which to be converted first.
518 u
= KIO::NetAccess::mostLocalUrl(u
, widget());
520 //If the URL is local after the above conversion, set the directory.
521 if (u
.isLocalFile()) {
522 dir
= u
.toLocalFile();
525 KToolInvocation::invokeTerminal(QString(), dir
);
528 void DolphinPart::slotFindFile()
530 KRun::run("kfind", url(), widget());
533 void DolphinPart::updateNewMenu()
535 // As requested by KNewFileMenu :
536 m_newFileMenu
->checkUpToDate();
537 m_newFileMenu
->setViewShowsHiddenFiles(m_view
->hiddenFilesShown());
538 // And set the files that the menu apply on :
539 m_newFileMenu
->setPopupFiles(url());
542 void DolphinPart::updateStatusBar()
544 emit
ReadOnlyPart::setStatusBarText(m_view
->statusBarText());
547 void DolphinPart::updateProgress(int percent
)
549 m_extension
->loadingProgress(percent
);
552 void DolphinPart::createDirectory()
554 m_newFileMenu
->setViewShowsHiddenFiles(m_view
->hiddenFilesShown());
555 m_newFileMenu
->setPopupFiles(url());
556 m_newFileMenu
->createDirectory();
559 void DolphinPart::setFilesToSelect(const KUrl::List
& files
)
561 if (files
.isEmpty()) {
565 m_view
->markUrlsAsSelected(files
);
566 m_view
->markUrlAsCurrent(files
.at(0));
571 void DolphinPartBrowserExtension::restoreState(QDataStream
&stream
)
573 KParts::BrowserExtension::restoreState(stream
);
574 m_part
->view()->restoreState(stream
);
577 void DolphinPartBrowserExtension::saveState(QDataStream
&stream
)
579 KParts::BrowserExtension::saveState(stream
);
580 m_part
->view()->saveState(stream
);
583 void DolphinPartBrowserExtension::cut()
585 m_part
->view()->cutSelectedItems();
588 void DolphinPartBrowserExtension::copy()
590 m_part
->view()->copySelectedItems();
593 void DolphinPartBrowserExtension::paste()
595 m_part
->view()->paste();
598 void DolphinPartBrowserExtension::pasteTo(const KUrl
&)
600 m_part
->view()->pasteIntoFolder();
603 void DolphinPartBrowserExtension::reparseConfiguration()
605 m_part
->view()->readSettings();
610 DolphinPartFileInfoExtension::DolphinPartFileInfoExtension(DolphinPart
* part
)
611 : KParts::FileInfoExtension(part
)
615 DolphinPart
* DolphinPartFileInfoExtension::part() const
617 return static_cast<DolphinPart
*>(parent());
620 bool DolphinPartFileInfoExtension::hasSelection() const
622 return part()->view()->selectedItemsCount() > 0;
625 KParts::FileInfoExtension::QueryModes
DolphinPartFileInfoExtension::supportedQueryModes() const
627 return (KParts::FileInfoExtension::AllItems
| KParts::FileInfoExtension::SelectedItems
);
630 KFileItemList
DolphinPartFileInfoExtension::queryFor(KParts::FileInfoExtension::QueryMode mode
) const
634 if (mode
== KParts::FileInfoExtension::None
)
637 if (!(supportedQueryModes() & mode
))
641 case KParts::FileInfoExtension::SelectedItems
:
643 return part()->view()->selectedItems();
645 case KParts::FileInfoExtension::AllItems
:
646 return part()->view()->items();
654 DolphinPartListingFilterExtension::DolphinPartListingFilterExtension (DolphinPart
* part
)
655 : KParts::ListingFilterExtension(part
)
660 KParts::ListingFilterExtension::FilterModes
DolphinPartListingFilterExtension::supportedFilterModes() const
662 return (KParts::ListingFilterExtension::MimeType
|
663 KParts::ListingFilterExtension::SubString
|
664 KParts::ListingFilterExtension::WildCard
);
667 bool DolphinPartListingFilterExtension::supportsMultipleFilters (KParts::ListingFilterExtension::FilterMode mode
) const
669 if (mode
== KParts::ListingFilterExtension::MimeType
)
675 QVariant
DolphinPartListingFilterExtension::filter (KParts::ListingFilterExtension::FilterMode mode
) const
680 case KParts::ListingFilterExtension::MimeType
:
681 result
= m_part
->view()->mimeTypeFilters();
683 case KParts::ListingFilterExtension::SubString
:
684 case KParts::ListingFilterExtension::WildCard
:
685 result
= m_part
->view()->nameFilter();
694 void DolphinPartListingFilterExtension::setFilter (KParts::ListingFilterExtension::FilterMode mode
, const QVariant
& filter
)
697 case KParts::ListingFilterExtension::MimeType
:
698 m_part
->view()->setMimeTypeFilters(filter
.toStringList());
700 case KParts::ListingFilterExtension::SubString
:
701 case KParts::ListingFilterExtension::WildCard
:
702 m_part
->view()->setNameFilter(filter
.toString());
709 #include "dolphinpart.moc"