]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphinpart.cpp
Never ignore the view-properties if "Use common view properties for all folders"...
[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
22 #include <kfileitemlistproperties.h>
23 #include <konq_operations.h>
24
25 #include <kaboutdata.h>
26 #include <kactioncollection.h>
27 #include <kconfiggroup.h>
28 #include <kdebug.h>
29 #include <kglobalsettings.h>
30 #include <kiconloader.h>
31 #include <klocale.h>
32 #include <kmessagebox.h>
33 #include <kpluginfactory.h>
34 #include <ktoggleaction.h>
35 #include <kio/netaccess.h>
36 #include <ktoolinvocation.h>
37 #include <kauthorized.h>
38 #include <knewfilemenu.h>
39 #include <kmenu.h>
40 #include <kinputdialog.h>
41
42 #include "settings/dolphinsettings.h"
43 #include "views/dolphinview.h"
44 #include "views/dolphinviewactionhandler.h"
45 #include "views/dolphinsortfilterproxymodel.h"
46 #include "views/dolphinmodel.h"
47 #include "views/dolphinnewfilemenuobserver.h"
48 #include "views/dolphinremoteencoding.h"
49 #include "views/dolphindirlister.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 DolphinDirLister;
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 connect(m_dirLister, SIGNAL(errorMessage(QString)), this, SLOT(slotErrorMessage(QString)));
79
80 m_dolphinModel = new DolphinModel(this);
81 m_dolphinModel->setDirLister(m_dirLister);
82
83 m_proxyModel = new DolphinSortFilterProxyModel(this);
84 m_proxyModel->setSourceModel(m_dolphinModel);
85
86 m_view = new DolphinView(parentWidget, KUrl(), m_proxyModel);
87 m_view->setTabsForFilesEnabled(true);
88 setWidget(m_view);
89
90 setXMLFile("dolphinpart.rc");
91
92 connect(m_view, SIGNAL(infoMessage(QString)),
93 this, SLOT(slotMessage(QString)));
94 connect(m_view, SIGNAL(operationCompletedMessage(QString)),
95 this, SLOT(slotMessage(QString)));
96 connect(m_view, SIGNAL(errorMessage(QString)),
97 this, SLOT(slotErrorMessage(QString)));
98 connect(m_view, SIGNAL(itemTriggered(KFileItem)),
99 this, SLOT(slotItemTriggered(KFileItem)));
100 connect(m_view, SIGNAL(tabRequested(KUrl)),
101 this, SLOT(createNewWindow(KUrl)));
102 connect(m_view, SIGNAL(requestContextMenu(KFileItem,KUrl,QList<QAction*>)),
103 this, SLOT(slotOpenContextMenu(KFileItem,KUrl,QList<QAction*>)));
104 connect(m_view, SIGNAL(selectionChanged(KFileItemList)),
105 m_extension, SIGNAL(selectionInfo(KFileItemList)));
106 connect(m_view, SIGNAL(selectionChanged(KFileItemList)),
107 this, SLOT(slotSelectionChanged(KFileItemList)));
108 connect(m_view, SIGNAL(requestItemInfo(KFileItem)),
109 this, SLOT(slotRequestItemInfo(KFileItem)));
110 connect(m_view, SIGNAL(modeChanged()),
111 this, SIGNAL(viewModeChanged())); // relay signal
112 connect(m_view, SIGNAL(redirection(KUrl, KUrl)),
113 this, SLOT(slotRedirection(KUrl, KUrl)));
114
115 // Watch for changes that should result in updates to the
116 // status bar text.
117 connect(m_dirLister, SIGNAL(itemsDeleted(const KFileItemList&)),
118 this, SLOT(updateStatusBar()));
119 connect(m_dirLister, SIGNAL(clear()),
120 this, SLOT(updateStatusBar()));
121 connect(m_view, SIGNAL(selectionChanged(const KFileItemList)),
122 this, SLOT(updateStatusBar()));
123
124 m_actionHandler = new DolphinViewActionHandler(actionCollection(), this);
125 m_actionHandler->setCurrentView(m_view);
126 connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory()));
127
128 m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler);
129 connect(this, SIGNAL(aboutToOpenURL()),
130 m_remoteEncoding, SLOT(slotAboutToOpenUrl()));
131
132 QClipboard* clipboard = QApplication::clipboard();
133 connect(clipboard, SIGNAL(dataChanged()),
134 this, SLOT(updatePasteAction()));
135
136 createActions();
137 m_actionHandler->updateViewActions();
138 slotSelectionChanged(KFileItemList()); // initially disable selection-dependent actions
139
140 // TODO there was a "always open a new window" (when clicking on a directory) setting in konqueror
141 // (sort of spacial navigation)
142
143 loadPlugins(this, this, componentData());
144
145 }
146
147 DolphinPart::~DolphinPart()
148 {
149 DolphinSettings::instance().save();
150 DolphinNewFileMenuObserver::instance().detach(m_newFileMenu);
151 delete m_dirLister;
152 }
153
154 void DolphinPart::createActions()
155 {
156 // Edit menu
157
158 m_newFileMenu = new KNewFileMenu(actionCollection(), "new_menu", this);
159 m_newFileMenu->setParentWidget(widget());
160 DolphinNewFileMenuObserver::instance().attach(m_newFileMenu);
161 connect(m_newFileMenu->menu(), SIGNAL(aboutToShow()),
162 this, SLOT(updateNewMenu()));
163
164 KAction *editMimeTypeAction = actionCollection()->addAction( "editMimeType" );
165 editMimeTypeAction->setText( i18nc("@action:inmenu Edit", "&Edit File Type..." ) );
166 connect(editMimeTypeAction, SIGNAL(triggered()), SLOT(slotEditMimeType()));
167
168 KAction* selectItemsMatching = actionCollection()->addAction("select_items_matching");
169 selectItemsMatching->setText(i18nc("@action:inmenu Edit", "Select Items Matching..."));
170 selectItemsMatching->setShortcut(Qt::CTRL | Qt::Key_S);
171 connect(selectItemsMatching, SIGNAL(triggered()), this, SLOT(slotSelectItemsMatchingPattern()));
172
173 KAction* unselectItemsMatching = actionCollection()->addAction("unselect_items_matching");
174 unselectItemsMatching->setText(i18nc("@action:inmenu Edit", "Unselect Items Matching..."));
175 connect(unselectItemsMatching, SIGNAL(triggered()), this, SLOT(slotUnselectItemsMatchingPattern()));
176
177 actionCollection()->addAction(KStandardAction::SelectAll, "select_all", m_view, SLOT(selectAll()));
178
179 KAction* unselectAll = actionCollection()->addAction("unselect_all");
180 unselectAll->setText(i18nc("@action:inmenu Edit", "Unselect All"));
181 connect(unselectAll, SIGNAL(triggered()), m_view, SLOT(clearSelection()));
182
183 KAction* invertSelection = actionCollection()->addAction("invert_selection");
184 invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
185 invertSelection->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_A);
186 connect(invertSelection, SIGNAL(triggered()), m_view, SLOT(invertSelection()));
187
188 // View menu: all done by DolphinViewActionHandler
189
190 // Go menu
191
192 QActionGroup* goActionGroup = new QActionGroup(this);
193 connect(goActionGroup, SIGNAL(triggered(QAction*)),
194 this, SLOT(slotGoTriggered(QAction*)));
195
196 createGoAction("go_applications", "start-here-kde",
197 i18nc("@action:inmenu Go", "App&lications"), QString("programs:/"),
198 goActionGroup);
199 createGoAction("go_network_folders", "folder-remote",
200 i18nc("@action:inmenu Go", "&Network Folders"), QString("remote:/"),
201 goActionGroup);
202 createGoAction("go_settings", "preferences-system",
203 i18nc("@action:inmenu Go", "Sett&ings"), QString("settings:/"),
204 goActionGroup);
205 createGoAction("go_trash", "user-trash",
206 i18nc("@action:inmenu Go", "Trash"), QString("trash:/"),
207 goActionGroup);
208 createGoAction("go_autostart", "",
209 i18nc("@action:inmenu Go", "Autostart"), KGlobalSettings::autostartPath(),
210 goActionGroup);
211
212 // Tools menu
213 if (KAuthorized::authorizeKAction("shell_access")) {
214 KAction* action = actionCollection()->addAction("open_terminal");
215 action->setIcon(KIcon("utilities-terminal"));
216 action->setText(i18nc("@action:inmenu Tools", "Open &Terminal"));
217 connect(action, SIGNAL(triggered()), SLOT(slotOpenTerminal()));
218 action->setShortcut(Qt::Key_F4);
219 }
220
221 }
222
223 void DolphinPart::createGoAction(const char* name, const char* iconName,
224 const QString& text, const QString& url,
225 QActionGroup* actionGroup)
226 {
227 KAction* action = actionCollection()->addAction(name);
228 action->setIcon(KIcon(iconName));
229 action->setText(text);
230 action->setData(url);
231 action->setActionGroup(actionGroup);
232 }
233
234 void DolphinPart::slotGoTriggered(QAction* action)
235 {
236 const QString url = action->data().toString();
237 emit m_extension->openUrlRequest(KUrl(url));
238 }
239
240 void DolphinPart::slotSelectionChanged(const KFileItemList& selection)
241 {
242 const bool hasSelection = !selection.isEmpty();
243
244 QAction* renameAction = actionCollection()->action("rename");
245 QAction* moveToTrashAction = actionCollection()->action("move_to_trash");
246 QAction* deleteAction = actionCollection()->action("delete");
247 QAction* editMimeTypeAction = actionCollection()->action("editMimeType");
248 QAction* propertiesAction = actionCollection()->action("properties");
249 QAction* deleteWithTrashShortcut = actionCollection()->action("delete_shortcut"); // see DolphinViewActionHandler
250
251 if (!hasSelection) {
252 stateChanged("has_no_selection");
253
254 emit m_extension->enableAction("cut", false);
255 emit m_extension->enableAction("copy", false);
256 deleteWithTrashShortcut->setEnabled(false);
257 editMimeTypeAction->setEnabled(false);
258 } else {
259 stateChanged("has_selection");
260
261 // TODO share this code with DolphinMainWindow::updateEditActions (and the desktop code)
262 // in libkonq
263 KFileItemListProperties capabilities(selection);
264 const bool enableMoveToTrash = capabilities.isLocal() && capabilities.supportsMoving();
265
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);
274 }
275 }
276
277 void DolphinPart::updatePasteAction()
278 {
279 QPair<bool, QString> pasteInfo = m_view->pasteInfo();
280 emit m_extension->enableAction( "paste", pasteInfo.first );
281 emit m_extension->setActionText( "paste", pasteInfo.second );
282 }
283
284 KAboutData* DolphinPart::createAboutData()
285 {
286 return new KAboutData("dolphinpart", "dolphin", ki18nc("@title", "Dolphin Part"), "0.1");
287 }
288
289 bool DolphinPart::openUrl(const KUrl& url)
290 {
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_dirLister->nameFilter())
295 reload = true;
296 if (m_view->url() == url && !reload) { // DolphinView won't do anything in that case, so don't emit started
297 return true;
298 }
299 setUrl(url); // remember it at the KParts level
300 KUrl visibleUrl(url);
301 if (!m_nameFilter.isEmpty()) {
302 visibleUrl.addPath(m_nameFilter);
303 }
304 QString prettyUrl = visibleUrl.pathOrUrl();
305 emit setWindowCaption(prettyUrl);
306 emit m_extension->setLocationBarUrl(prettyUrl);
307 emit started(0); // get the wheel to spin
308 m_dirLister->setNameFilter(m_nameFilter);
309 m_view->setUrl(url);
310 updatePasteAction();
311 emit aboutToOpenURL();
312 if (reload)
313 m_view->reload();
314 return true;
315 }
316
317 void DolphinPart::slotCompleted(const KUrl& url)
318 {
319 Q_UNUSED(url)
320 emit completed();
321 }
322
323 void DolphinPart::slotCanceled(const KUrl& url)
324 {
325 slotCompleted(url);
326 }
327
328 void DolphinPart::slotMessage(const QString& msg)
329 {
330 emit setStatusBarText(msg);
331 }
332
333 void DolphinPart::slotErrorMessage(const QString& msg)
334 {
335 kDebug() << msg;
336 emit canceled(msg);
337 //KMessageBox::error(m_view, msg);
338 }
339
340 void DolphinPart::slotRequestItemInfo(const KFileItem& item)
341 {
342 emit m_extension->mouseOverInfo(item);
343 if (item.isNull()) {
344 updateStatusBar();
345 } else {
346 ReadOnlyPart::setStatusBarText(item.getStatusBarInfo());
347 }
348 }
349
350 void DolphinPart::slotItemTriggered(const KFileItem& item)
351 {
352 KParts::OpenUrlArguments args;
353 // Forget about the known mimetype if a target URL is used.
354 // Testcase: network:/ with a item (mimetype "inode/some-foo-service") pointing to a http URL (html)
355 if (item.targetUrl() == item.url()) {
356 args.setMimeType(item.mimetype());
357 }
358
359 // Ideally, konqueror should be changed to not require trustedSource for directory views,
360 // since the idea was not to need BrowserArguments for non-browser stuff...
361 KParts::BrowserArguments browserArgs;
362 browserArgs.trustedSource = true;
363 emit m_extension->openUrlRequest(item.targetUrl(), args, browserArgs);
364 }
365
366 void DolphinPart::createNewWindow(const KUrl& url)
367 {
368 // TODO: Check issue N176832 for the missing QAIV signal; task 177399 - maybe this code
369 // should be moved into DolphinPart::slotItemTriggered()
370 emit m_extension->createNewWindow(url);
371 }
372
373 void DolphinPart::slotOpenContextMenu(const KFileItem& _item,
374 const KUrl&,
375 const QList<QAction*>& customActions)
376 {
377 KParts::BrowserExtension::PopupFlags popupFlags = KParts::BrowserExtension::DefaultPopupItems
378 | KParts::BrowserExtension::ShowProperties
379 | KParts::BrowserExtension::ShowUrlOperations;
380
381 KFileItem item(_item);
382
383 if (item.isNull()) { // viewport context menu
384 popupFlags |= KParts::BrowserExtension::ShowNavigationItems | KParts::BrowserExtension::ShowUp;
385 item = m_dirLister->rootItem();
386 if (item.isNull())
387 item = KFileItem( S_IFDIR, (mode_t)-1, url() );
388 else
389 item.setUrl(url()); // ensure we use the view url, not the canonical path (#213799)
390 }
391
392 // TODO: We should change the signature of the slots (and signals) for being able
393 // to tell for which items we want a popup.
394 KFileItemList items;
395 if (m_view->selectedItems().isEmpty()) {
396 items.append(item);
397 } else {
398 items = m_view->selectedItems();
399 }
400
401 KFileItemListProperties capabilities(items);
402
403 KParts::BrowserExtension::ActionGroupMap actionGroups;
404 QList<QAction *> editActions;
405 editActions += m_view->versionControlActions(m_view->selectedItems());
406 editActions += customActions;
407
408 if (!_item.isNull()) { // only for context menu on one or more items
409 bool supportsDeleting = capabilities.supportsDeleting();
410 bool supportsMoving = capabilities.supportsMoving();
411
412 if (!supportsDeleting) {
413 popupFlags |= KParts::BrowserExtension::NoDeletion;
414 }
415
416 if (supportsMoving) {
417 editActions.append(actionCollection()->action("rename"));
418 }
419
420 bool addTrash = capabilities.isLocal() && supportsMoving;
421 bool addDel = false;
422 if (supportsDeleting) {
423 if ( !item.isLocalFile() )
424 addDel = true;
425 else if (QApplication::keyboardModifiers() & Qt::ShiftModifier) {
426 addTrash = false;
427 addDel = true;
428 }
429 else {
430 KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::IncludeGlobals);
431 KConfigGroup configGroup(globalConfig, "KDE");
432 addDel = configGroup.readEntry("ShowDeleteCommand", false);
433 }
434 }
435
436 if (addTrash)
437 editActions.append(actionCollection()->action("move_to_trash"));
438 if (addDel)
439 editActions.append(actionCollection()->action("delete"));
440
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;
446
447 }
448
449 actionGroups.insert("editactions", editActions);
450
451 emit m_extension->popupMenu(QCursor::pos(),
452 items,
453 KParts::OpenUrlArguments(),
454 KParts::BrowserArguments(),
455 popupFlags,
456 actionGroups);
457 }
458
459 void DolphinPart::slotRedirection(const KUrl& oldUrl, const KUrl& newUrl)
460 {
461 //kDebug() << oldUrl << newUrl << "currentUrl=" << url();
462 if (oldUrl.equals(url(), KUrl::CompareWithoutTrailingSlash /* #207572 */)) {
463 KParts::ReadOnlyPart::setUrl(newUrl);
464 const QString prettyUrl = newUrl.pathOrUrl();
465 emit m_extension->setLocationBarUrl(prettyUrl);
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_newFileMenu->checkUpToDate();
607 m_newFileMenu->setViewShowsHiddenFiles(m_view->showHiddenFiles());
608 // And set the files that the menu apply on :
609 m_newFileMenu->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_newFileMenu->setViewShowsHiddenFiles(m_view->showHiddenFiles());
625 m_newFileMenu->setPopupFiles(url());
626 m_newFileMenu->createDirectory();
627 }
628
629 void DolphinPart::setFilesToSelect(const KUrl::List& files)
630 {
631 m_view->markUrlsAsSelected(files);
632 }
633
634 #include "dolphinpart.moc"