]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphinpart.cpp
Use Nepomuk::Query::Query for global search queries, as it does not only return files...
[dolphin.git] / src / dolphinpart.cpp
1 /* This file is part of the KDE project
2 Copyright (c) 2007 David Faure <faure@kde.org>
3
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.
8
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.
13
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.
18 */
19
20 #include "dolphinpart.h"
21 #include "dolphinviewactionhandler.h"
22 #include "dolphinsortfilterproxymodel.h"
23 #include "dolphinview.h"
24 #include "dolphinmodel.h"
25 #include "dolphinnewmenuobserver.h"
26 #include "dolphinremoteencoding.h"
27
28 #include <kfileitemlistproperties.h>
29 #include <konq_operations.h>
30
31 #include <kaboutdata.h>
32 #include <kactioncollection.h>
33 #include <kconfiggroup.h>
34 #include <kdebug.h>
35 #include <kdirlister.h>
36 #include <kglobalsettings.h>
37 #include <kiconloader.h>
38 #include <klocale.h>
39 #include <kmessagebox.h>
40 #include <kpluginfactory.h>
41 #include <ktoggleaction.h>
42 #include <kio/netaccess.h>
43 #include <ktoolinvocation.h>
44 #include <kauthorized.h>
45 #include <knewfilemenu.h>
46 #include <kmenu.h>
47 #include <kinputdialog.h>
48
49 #include "settings/dolphinsettings.h"
50
51 #include <QActionGroup>
52 #include <QApplication>
53 #include <QClipboard>
54
55 K_PLUGIN_FACTORY(DolphinPartFactory, registerPlugin<DolphinPart>();)
56 K_EXPORT_PLUGIN(DolphinPartFactory("dolphinpart", "dolphin"))
57
58 DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantList& args)
59 : KParts::ReadOnlyPart(parent)
60 {
61 Q_UNUSED(args)
62 setComponentData(DolphinPartFactory::componentData(), false);
63 m_extension = new DolphinPartBrowserExtension(this);
64
65 // make sure that other apps using this part find Dolphin's view-file-columns icons
66 KIconLoader::global()->addAppDir("dolphin");
67
68 m_dirLister = new KDirLister;
69 m_dirLister->setAutoUpdate(true);
70 if (parentWidget) {
71 m_dirLister->setMainWindow(parentWidget->window());
72 }
73 m_dirLister->setDelayedMimeTypes(true);
74
75 connect(m_dirLister, SIGNAL(completed(KUrl)), this, SLOT(slotCompleted(KUrl)));
76 connect(m_dirLister, SIGNAL(canceled(KUrl)), this, SLOT(slotCanceled(KUrl)));
77 connect(m_dirLister, SIGNAL(percent(int)), this, SLOT(updateProgress(int)));
78
79 m_dolphinModel = new DolphinModel(this);
80 m_dolphinModel->setDirLister(m_dirLister);
81
82 m_proxyModel = new DolphinSortFilterProxyModel(this);
83 m_proxyModel->setSourceModel(m_dolphinModel);
84
85 m_view = new DolphinView(parentWidget, KUrl(), m_proxyModel);
86 m_view->setTabsForFilesEnabled(true);
87 setWidget(m_view);
88
89 setXMLFile("dolphinpart.rc");
90
91 connect(m_view, SIGNAL(infoMessage(QString)),
92 this, SLOT(slotMessage(QString)));
93 connect(m_view, SIGNAL(operationCompletedMessage(QString)),
94 this, SLOT(slotMessage(QString)));
95 connect(m_view, SIGNAL(errorMessage(QString)),
96 this, SLOT(slotErrorMessage(QString)));
97 connect(m_view, SIGNAL(itemTriggered(KFileItem)),
98 this, SLOT(slotItemTriggered(KFileItem)));
99 connect(m_view, SIGNAL(tabRequested(KUrl)),
100 this, SLOT(createNewWindow(KUrl)));
101 connect(m_view, SIGNAL(requestContextMenu(KFileItem,KUrl,QList<QAction*>)),
102 this, SLOT(slotOpenContextMenu(KFileItem,KUrl,QList<QAction*>)));
103 connect(m_view, SIGNAL(selectionChanged(KFileItemList)),
104 m_extension, SIGNAL(selectionInfo(KFileItemList)));
105 connect(m_view, SIGNAL(selectionChanged(KFileItemList)),
106 this, SLOT(slotSelectionChanged(KFileItemList)));
107 connect(m_view, SIGNAL(requestItemInfo(KFileItem)),
108 this, SLOT(slotRequestItemInfo(KFileItem)));
109 connect(m_view, SIGNAL(requestUrlChange(KUrl)),
110 this, SLOT(slotRequestUrlChange(KUrl)));
111 connect(m_view, SIGNAL(modeChanged()),
112 this, SIGNAL(viewModeChanged())); // relay signal
113 connect(m_view, SIGNAL(redirection(KUrl, KUrl)),
114 this, SLOT(slotRedirection(KUrl, KUrl)));
115
116 // Watch for changes that should result in updates to the
117 // status bar text.
118 connect(m_dirLister, SIGNAL(itemsDeleted(const KFileItemList&)),
119 this, SLOT(updateStatusBar()));
120 connect(m_dirLister, SIGNAL(clear()),
121 this, SLOT(updateStatusBar()));
122 connect(m_view, SIGNAL(selectionChanged(const KFileItemList)),
123 this, SLOT(updateStatusBar()));
124
125 m_actionHandler = new DolphinViewActionHandler(actionCollection(), this);
126 m_actionHandler->setCurrentView(m_view);
127 connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory()));
128
129 m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler);
130 connect(this, SIGNAL(aboutToOpenURL()),
131 m_remoteEncoding, SLOT(slotAboutToOpenUrl()));
132
133 QClipboard* clipboard = QApplication::clipboard();
134 connect(clipboard, SIGNAL(dataChanged()),
135 this, SLOT(updatePasteAction()));
136
137 createActions();
138 m_actionHandler->updateViewActions();
139 slotSelectionChanged(KFileItemList()); // initially disable selection-dependent actions
140
141 // TODO there was a "always open a new window" (when clicking on a directory) setting in konqueror
142 // (sort of spacial navigation)
143
144 loadPlugins(this, this, componentData());
145
146 }
147
148 DolphinPart::~DolphinPart()
149 {
150 DolphinSettings::instance().save();
151 DolphinNewMenuObserver::instance().detach(m_newMenu);
152 delete m_dirLister;
153 }
154
155 void DolphinPart::createActions()
156 {
157 // Edit menu
158
159 m_newMenu = new KNewFileMenu(actionCollection(), "new_menu", this);
160 m_newMenu->setParentWidget(widget());
161 DolphinNewMenuObserver::instance().attach(m_newMenu);
162 connect(m_newMenu->menu(), SIGNAL(aboutToShow()),
163 this, SLOT(updateNewMenu()));
164
165 KAction *editMimeTypeAction = actionCollection()->addAction( "editMimeType" );
166 editMimeTypeAction->setText( i18nc("@action:inmenu Edit", "&Edit File Type..." ) );
167 connect(editMimeTypeAction, SIGNAL(triggered()), SLOT(slotEditMimeType()));
168
169 KAction* selectItemsMatching = actionCollection()->addAction("select_items_matching");
170 selectItemsMatching->setText(i18nc("@action:inmenu Edit", "Select Items Matching..."));
171 selectItemsMatching->setShortcut(Qt::CTRL | Qt::Key_S);
172 connect(selectItemsMatching, SIGNAL(triggered()), this, SLOT(slotSelectItemsMatchingPattern()));
173
174 KAction* unselectItemsMatching = actionCollection()->addAction("unselect_items_matching");
175 unselectItemsMatching->setText(i18nc("@action:inmenu Edit", "Unselect Items Matching..."));
176 connect(unselectItemsMatching, SIGNAL(triggered()), this, SLOT(slotUnselectItemsMatchingPattern()));
177
178 actionCollection()->addAction(KStandardAction::SelectAll, "select_all", m_view, SLOT(selectAll()));
179
180 KAction* unselectAll = actionCollection()->addAction("unselect_all");
181 unselectAll->setText(i18nc("@action:inmenu Edit", "Unselect All"));
182 connect(unselectAll, SIGNAL(triggered()), m_view, SLOT(clearSelection()));
183
184 KAction* invertSelection = actionCollection()->addAction("invert_selection");
185 invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
186 invertSelection->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_A);
187 connect(invertSelection, SIGNAL(triggered()), m_view, SLOT(invertSelection()));
188
189 // View menu: all done by DolphinViewActionHandler
190
191 // Go menu
192
193 QActionGroup* goActionGroup = new QActionGroup(this);
194 connect(goActionGroup, SIGNAL(triggered(QAction*)),
195 this, SLOT(slotGoTriggered(QAction*)));
196
197 createGoAction("go_applications", "start-here-kde",
198 i18nc("@action:inmenu Go", "App&lications"), QString("programs:/"),
199 goActionGroup);
200 createGoAction("go_network_folders", "folder-remote",
201 i18nc("@action:inmenu Go", "&Network Folders"), QString("remote:/"),
202 goActionGroup);
203 createGoAction("go_settings", "preferences-system",
204 i18nc("@action:inmenu Go", "Sett&ings"), QString("settings:/"),
205 goActionGroup);
206 createGoAction("go_trash", "user-trash",
207 i18nc("@action:inmenu Go", "Trash"), QString("trash:/"),
208 goActionGroup);
209 createGoAction("go_autostart", "",
210 i18nc("@action:inmenu Go", "Autostart"), KGlobalSettings::autostartPath(),
211 goActionGroup);
212
213 // Tools menu
214 if (KAuthorized::authorizeKAction("shell_access")) {
215 KAction* action = actionCollection()->addAction("open_terminal");
216 action->setIcon(KIcon("utilities-terminal"));
217 action->setText(i18nc("@action:inmenu Tools", "Open &Terminal"));
218 connect(action, SIGNAL(triggered()), SLOT(slotOpenTerminal()));
219 action->setShortcut(Qt::Key_F4);
220 }
221
222 }
223
224 void DolphinPart::createGoAction(const char* name, const char* iconName,
225 const QString& text, const QString& url,
226 QActionGroup* actionGroup)
227 {
228 KAction* action = actionCollection()->addAction(name);
229 action->setIcon(KIcon(iconName));
230 action->setText(text);
231 action->setData(url);
232 action->setActionGroup(actionGroup);
233 }
234
235 void DolphinPart::slotGoTriggered(QAction* action)
236 {
237 const QString url = action->data().toString();
238 emit m_extension->openUrlRequest(KUrl(url));
239 }
240
241 void DolphinPart::slotSelectionChanged(const KFileItemList& selection)
242 {
243 const bool hasSelection = !selection.isEmpty();
244
245 QAction* renameAction = actionCollection()->action("rename");
246 QAction* moveToTrashAction = actionCollection()->action("move_to_trash");
247 QAction* deleteAction = actionCollection()->action("delete");
248 QAction* editMimeTypeAction = actionCollection()->action("editMimeType");
249 QAction* propertiesAction = actionCollection()->action("properties");
250 QAction* deleteWithTrashShortcut = actionCollection()->action("delete_shortcut"); // see DolphinViewActionHandler
251
252 if (!hasSelection) {
253 stateChanged("has_no_selection");
254
255 emit m_extension->enableAction("cut", false);
256 emit m_extension->enableAction("copy", false);
257 deleteWithTrashShortcut->setEnabled(false);
258 editMimeTypeAction->setEnabled(false);
259 } else {
260 stateChanged("has_selection");
261
262 // TODO share this code with DolphinMainWindow::updateEditActions (and the desktop code)
263 // in libkonq
264 KFileItemListProperties capabilities(selection);
265 const bool enableMoveToTrash = capabilities.isLocal() && capabilities.supportsMoving();
266
267 renameAction->setEnabled(capabilities.supportsMoving());
268 moveToTrashAction->setEnabled(enableMoveToTrash);
269 deleteAction->setEnabled(capabilities.supportsDeleting());
270 deleteWithTrashShortcut->setEnabled(capabilities.supportsDeleting() && !enableMoveToTrash);
271 editMimeTypeAction->setEnabled(true);
272 propertiesAction->setEnabled(true);
273 emit m_extension->enableAction("cut", capabilities.supportsMoving());
274 emit m_extension->enableAction("copy", true);
275 }
276 }
277
278 void DolphinPart::updatePasteAction()
279 {
280 QPair<bool, QString> pasteInfo = m_view->pasteInfo();
281 emit m_extension->enableAction( "paste", pasteInfo.first );
282 emit m_extension->setActionText( "paste", pasteInfo.second );
283 }
284
285 KAboutData* DolphinPart::createAboutData()
286 {
287 return new KAboutData("dolphinpart", "dolphin", ki18nc("@title", "Dolphin Part"), "0.1");
288 }
289
290 bool DolphinPart::openUrl(const KUrl& url)
291 {
292 bool reload = arguments().reload();
293 // A bit of a workaround so that changing the namefilter works: force reload.
294 // Otherwise DolphinView wouldn't relist the URL, so nothing would happen.
295 if (m_nameFilter != m_dirLister->nameFilter())
296 reload = true;
297 if (m_view->url() == url && !reload) { // DolphinView won't do anything in that case, so don't emit started
298 return true;
299 }
300 setUrl(url); // remember it at the KParts level
301 KUrl visibleUrl(url);
302 if (!m_nameFilter.isEmpty()) {
303 visibleUrl.addPath(m_nameFilter);
304 }
305 QString prettyUrl = visibleUrl.pathOrUrl();
306 emit setWindowCaption(prettyUrl);
307 emit m_extension->setLocationBarUrl(prettyUrl);
308 emit started(0); // get the wheel to spin
309 m_dirLister->setNameFilter(m_nameFilter);
310 m_view->setUrl(url);
311 updatePasteAction();
312 emit aboutToOpenURL();
313 if (reload)
314 m_view->reload();
315 return true;
316 }
317
318 void DolphinPart::slotCompleted(const KUrl& url)
319 {
320 Q_UNUSED(url)
321 emit completed();
322 }
323
324 void DolphinPart::slotCanceled(const KUrl& url)
325 {
326 slotCompleted(url);
327 }
328
329 void DolphinPart::slotMessage(const QString& msg)
330 {
331 emit setStatusBarText(msg);
332 }
333
334 void DolphinPart::slotErrorMessage(const QString& msg)
335 {
336 KMessageBox::error(m_view, msg);
337 }
338
339 void DolphinPart::slotRequestItemInfo(const KFileItem& item)
340 {
341 emit m_extension->mouseOverInfo(item);
342 if (item.isNull()) {
343 updateStatusBar();
344 } else {
345 ReadOnlyPart::setStatusBarText(item.getStatusBarInfo());
346 }
347 }
348
349 void DolphinPart::slotItemTriggered(const KFileItem& item)
350 {
351 KParts::OpenUrlArguments args;
352 args.setMimeType(item.mimetype());
353
354 // Ideally, konqueror should be changed to not require trustedSource for directory views,
355 // since the idea was not to need BrowserArguments for non-browser stuff...
356 KParts::BrowserArguments browserArgs;
357 browserArgs.trustedSource = true;
358 emit m_extension->openUrlRequest(item.targetUrl(), args, browserArgs);
359 }
360
361 void DolphinPart::createNewWindow(const KUrl& url)
362 {
363 // TODO: Check issue N176832 for the missing QAIV signal; task 177399 - maybe this code
364 // should be moved into DolphinPart::slotItemTriggered()
365 emit m_extension->createNewWindow(url);
366 }
367
368 void DolphinPart::slotOpenContextMenu(const KFileItem& _item,
369 const KUrl&,
370 const QList<QAction*>& customActions)
371 {
372 KParts::BrowserExtension::PopupFlags popupFlags = KParts::BrowserExtension::DefaultPopupItems
373 | KParts::BrowserExtension::ShowProperties
374 | KParts::BrowserExtension::ShowUrlOperations;
375
376 KFileItem item(_item);
377
378 if (item.isNull()) { // viewport context menu
379 popupFlags |= KParts::BrowserExtension::ShowNavigationItems | KParts::BrowserExtension::ShowUp;
380 item = m_dirLister->rootItem();
381 if (item.isNull())
382 item = KFileItem( S_IFDIR, (mode_t)-1, url() );
383 else
384 item.setUrl(url()); // ensure we use the view url, not the canonical path (#213799)
385 }
386
387 // TODO: We should change the signature of the slots (and signals) for being able
388 // to tell for which items we want a popup.
389 const KFileItemList items = (m_view->selectedItems().count() ? m_view->selectedItems()
390 : KFileItemList() << item);
391 KFileItemListProperties capabilities(items);
392
393 KParts::BrowserExtension::ActionGroupMap actionGroups;
394 QList<QAction *> editActions;
395 editActions += m_view->versionControlActions(m_view->selectedItems());
396 editActions += customActions;
397
398 if (!_item.isNull()) { // only for context menu on one or more items
399 bool supportsDeleting = capabilities.supportsDeleting();
400 bool supportsMoving = capabilities.supportsMoving();
401
402 if (!supportsDeleting) {
403 popupFlags |= KParts::BrowserExtension::NoDeletion;
404 }
405
406 if (supportsMoving) {
407 editActions.append(actionCollection()->action("rename"));
408 }
409
410 bool addTrash = capabilities.isLocal() && supportsMoving;
411 bool addDel = false;
412 if (supportsDeleting) {
413 if ( !item.isLocalFile() )
414 addDel = true;
415 else if (QApplication::keyboardModifiers() & Qt::ShiftModifier) {
416 addTrash = false;
417 addDel = true;
418 }
419 else {
420 KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::IncludeGlobals);
421 KConfigGroup configGroup(globalConfig, "KDE");
422 addDel = configGroup.readEntry("ShowDeleteCommand", false);
423 }
424 }
425
426 if (addTrash)
427 editActions.append(actionCollection()->action("move_to_trash"));
428 if (addDel)
429 editActions.append(actionCollection()->action("delete"));
430
431 // Normally KonqPopupMenu only shows the "Create new" submenu in the current view
432 // since otherwise the created file would not be visible.
433 // But in treeview mode we should allow it.
434 if (m_view->itemsExpandable())
435 popupFlags |= KParts::BrowserExtension::ShowCreateDirectory;
436
437 }
438
439 actionGroups.insert("editactions", editActions);
440
441 emit m_extension->popupMenu(QCursor::pos(),
442 items,
443 KParts::OpenUrlArguments(),
444 KParts::BrowserArguments(),
445 popupFlags,
446 actionGroups);
447 }
448
449 void DolphinPart::slotRedirection(const KUrl& oldUrl, const KUrl& newUrl)
450 {
451 //kDebug() << oldUrl << newUrl << "currentUrl=" << url();
452 if (oldUrl.equals(url(), KUrl::CompareWithoutTrailingSlash /* #207572 */)) {
453 KParts::ReadOnlyPart::setUrl(newUrl);
454 const QString prettyUrl = newUrl.pathOrUrl();
455 emit m_extension->setLocationBarUrl(prettyUrl);
456 }
457 }
458
459 void DolphinPart::slotRequestUrlChange(const KUrl& url)
460 {
461 if (m_view->url() != url) {
462 // If the view URL is not equal to 'url', then an inner URL change has
463 // been done (e. g. by activating an existing column in the column view).
464 openUrl(url);
465 emit m_extension->openUrlNotify();
466 }
467 }
468
469 ////
470
471 void DolphinPartBrowserExtension::restoreState(QDataStream &stream)
472 {
473 KParts::BrowserExtension::restoreState(stream);
474 m_part->view()->restoreState(stream);
475 }
476
477 void DolphinPartBrowserExtension::saveState(QDataStream &stream)
478 {
479 KParts::BrowserExtension::saveState(stream);
480 m_part->view()->saveState(stream);
481 }
482
483 void DolphinPartBrowserExtension::cut()
484 {
485 m_part->view()->cutSelectedItems();
486 }
487
488 void DolphinPartBrowserExtension::copy()
489 {
490 m_part->view()->copySelectedItems();
491 }
492
493 void DolphinPartBrowserExtension::paste()
494 {
495 m_part->view()->paste();
496 }
497
498 void DolphinPartBrowserExtension::pasteTo(const KUrl&)
499 {
500 m_part->view()->pasteIntoFolder();
501 }
502
503 void DolphinPartBrowserExtension::reparseConfiguration()
504 {
505 m_part->view()->refresh();
506 }
507
508 ////
509
510 void DolphinPart::slotEditMimeType()
511 {
512 const KFileItemList items = m_view->selectedItems();
513 if (!items.isEmpty()) {
514 KonqOperations::editMimeType(items.first().mimetype(), m_view);
515 }
516 }
517
518 void DolphinPart::slotSelectItemsMatchingPattern()
519 {
520 openSelectionDialog(i18nc("@title:window", "Select"),
521 i18n("Select all items matching this pattern:"),
522 QItemSelectionModel::Select);
523 }
524
525 void DolphinPart::slotUnselectItemsMatchingPattern()
526 {
527 openSelectionDialog(i18nc("@title:window", "Unselect"),
528 i18n("Unselect all items matching this pattern:"),
529 QItemSelectionModel::Deselect);
530 }
531
532 void DolphinPart::openSelectionDialog(const QString& title, const QString& text, QItemSelectionModel::SelectionFlags command)
533 {
534 bool okClicked;
535 QString pattern = KInputDialog::getText(title, text, "*", &okClicked, m_view);
536
537 if (okClicked && !pattern.isEmpty()) {
538 QRegExp patternRegExp(pattern, Qt::CaseSensitive, QRegExp::Wildcard);
539 QItemSelection matchingIndexes = childrenMatchingPattern(QModelIndex(), patternRegExp);
540 m_view->selectionModel()->select(matchingIndexes, command);
541 }
542 }
543
544 QItemSelection DolphinPart::childrenMatchingPattern(const QModelIndex& parent, const QRegExp& patternRegExp)
545 {
546 QItemSelection matchingIndexes;
547 int numRows = m_proxyModel->rowCount(parent);
548
549 for (int row = 0; row < numRows; row++) {
550 QModelIndex index = m_proxyModel->index(row, 0, parent);
551 QModelIndex sourceIndex = m_proxyModel->mapToSource(index);
552
553 if (sourceIndex.isValid() && patternRegExp.exactMatch(m_dolphinModel->data(sourceIndex).toString())) {
554 matchingIndexes += QItemSelectionRange(index);
555 }
556
557 if (m_proxyModel->hasChildren(index)) {
558 matchingIndexes += childrenMatchingPattern(index, patternRegExp);
559 }
560 }
561
562 return matchingIndexes;
563 }
564
565 void DolphinPart::setCurrentViewMode(const QString& viewModeName)
566 {
567 QAction* action = actionCollection()->action(viewModeName);
568 Q_ASSERT(action);
569 action->trigger();
570 }
571
572 QString DolphinPart::currentViewMode() const
573 {
574 return m_actionHandler->currentViewModeActionName();
575 }
576
577 void DolphinPart::setNameFilter(const QString& nameFilter)
578 {
579 // This is the "/home/dfaure/*.diff" kind of name filter (KDirLister::setNameFilter)
580 // which is unrelated to DolphinView::setNameFilter which is substring filtering in a proxy.
581 m_nameFilter = nameFilter;
582 // TODO save/restore name filter in saveState/restoreState like KonqDirPart did in kde3?
583 }
584
585 void DolphinPart::slotOpenTerminal()
586 {
587 QString dir(QDir::homePath());
588
589 KUrl u(url());
590
591 // If the given directory is not local, it can still be the URL of an
592 // ioslave using UDS_LOCAL_PATH which to be converted first.
593 u = KIO::NetAccess::mostLocalUrl(u, widget());
594
595 //If the URL is local after the above conversion, set the directory.
596 if (u.isLocalFile()) {
597 dir = u.toLocalFile();
598 }
599
600 KToolInvocation::invokeTerminal(QString(), dir);
601 }
602
603 void DolphinPart::updateNewMenu()
604 {
605 // As requested by KNewFileMenu :
606 m_newMenu->checkUpToDate();
607 m_newMenu->setViewShowsHiddenFiles(m_view->showHiddenFiles());
608 // And set the files that the menu apply on :
609 m_newMenu->setPopupFiles(url());
610 }
611
612 void DolphinPart::updateStatusBar()
613 {
614 emit ReadOnlyPart::setStatusBarText(m_view->statusBarText());
615 }
616
617 void DolphinPart::updateProgress(int percent)
618 {
619 m_extension->loadingProgress(percent);
620 }
621
622 void DolphinPart::createDirectory()
623 {
624 m_newMenu->setViewShowsHiddenFiles(m_view->showHiddenFiles());
625 m_newMenu->setPopupFiles(url());
626 m_newMenu->createDirectory();
627 }
628
629 void DolphinPart::setFilesToSelect(const KUrl::List& files)
630 {
631 m_view->markUrlsAsSelected(files);
632 }
633
634 #include "dolphinpart.moc"