]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphinmainwindow.cpp
Use custom implementation of KonqUndoManager::UiInterface for Dolphin. This allows...
[dolphin.git] / src / dolphinmainwindow.cpp
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
3 * Copyright (C) 2006 by Stefan Monov <logixoul@gmail.com> *
4 * Copyright (C) 2006 by Cvetoslav Ludmiloff <ludmiloff@gmail.com> *
5 * *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20 ***************************************************************************/
21
22 #include "dolphinmainwindow.h"
23
24 #include <assert.h>
25
26 #include "dolphinapplication.h"
27 #include "dolphinsettings.h"
28 #include "dolphinsettingsdialog.h"
29 #include "dolphinstatusbar.h"
30 #include "dolphinapplication.h"
31 #include "urlnavigator.h"
32 #include "dolphinsettings.h"
33 #include "bookmarkssidebarpage.h"
34 #include "infosidebarpage.h"
35 #include "generalsettings.h"
36 #include "viewpropertiesdialog.h"
37 #include "viewproperties.h"
38
39 #include <kaction.h>
40 #include <kactioncollection.h>
41 #include <kbookmarkmanager.h>
42 #include <kconfig.h>
43 #include <kdesktopfile.h>
44 #include <kdeversion.h>
45 #include <kfiledialog.h>
46 #include <kglobal.h>
47 #include <kicon.h>
48 #include <kiconloader.h>
49 #include <kio/netaccess.h>
50 #include <kio/renamedialog.h>
51 #include <kinputdialog.h>
52 #include <klocale.h>
53 #include <kmenu.h>
54 #include <kmessagebox.h>
55 #include <knewmenu.h>
56 #include <konqmimedata.h>
57 #include <kpropertiesdialog.h>
58 #include <kprotocolinfo.h>
59 #include <ktoggleaction.h>
60 #include <krun.h>
61 #include <kshell.h>
62 #include <kstandarddirs.h>
63 #include <kstatusbar.h>
64 #include <kstandardaction.h>
65 #include <kurl.h>
66
67 #include <QCloseEvent>
68 #include <QClipboard>
69 #include <QSplitter>
70 #include <QDockWidget>
71
72 DolphinMainWindow::DolphinMainWindow() :
73 KMainWindow(0),
74 m_newMenu(0),
75 m_splitter(0),
76 m_activeView(0)
77 {
78 setObjectName("Dolphin");
79 m_view[PrimaryIdx] = 0;
80 m_view[SecondaryIdx] = 0;
81
82 KonqUndoManager::incRef();
83
84 KonqUndoManager* undoManager = KonqUndoManager::self();
85 undoManager->setUiInterface(new UndoUiInterface(this));
86
87 connect(undoManager, SIGNAL(undoAvailable(bool)),
88 this, SLOT(slotUndoAvailable(bool)));
89 connect(undoManager, SIGNAL(undoTextChanged(const QString&)),
90 this, SLOT(slotUndoTextChanged(const QString&)));
91 }
92
93 DolphinMainWindow::~DolphinMainWindow()
94 {
95 KonqUndoManager::decRef();
96 DolphinApplication::app()->removeMainWindow(this);
97 }
98
99 void DolphinMainWindow::setActiveView(DolphinView* view)
100 {
101 assert((view == m_view[PrimaryIdx]) || (view == m_view[SecondaryIdx]));
102 if (m_activeView == view) {
103 return;
104 }
105
106 m_activeView = view;
107
108 updateHistory();
109 updateEditActions();
110 updateViewActions();
111 updateGoActions();
112
113 setCaption(m_activeView->url().fileName());
114
115 emit activeViewChanged();
116 }
117
118 void DolphinMainWindow::dropUrls(const KUrl::List& urls,
119 const KUrl& destination)
120 {
121 Qt::DropAction action = Qt::CopyAction;
122
123 Qt::KeyboardModifiers modifier = QApplication::keyboardModifiers();
124 const bool shiftPressed = modifier & Qt::ShiftModifier;
125 const bool controlPressed = modifier & Qt::ControlModifier;
126 if (shiftPressed && controlPressed) {
127 // shortcut for 'Link Here' is used
128 action = Qt::LinkAction;
129 }
130 else if (shiftPressed) {
131 // shortcut for 'Move Here' is used
132 action = Qt::MoveAction;
133 }
134 else if (controlPressed) {
135 // shortcut for 'Copy Here' is used
136 action = Qt::CopyAction;
137 }
138 else {
139 // open a context menu which offers the following actions:
140 // - Move Here
141 // - Copy Here
142 // - Link Here
143 // - Cancel
144
145 KMenu popup(this);
146
147 QString seq = QKeySequence(Qt::ShiftModifier).toString();
148 seq.chop(1); // chop superfluous '+'
149 QAction* moveAction = popup.addAction(KIcon("goto"),
150 i18n("&Move Here") + "\t" + seq);
151
152 seq = QKeySequence(Qt::ControlModifier).toString();
153 seq.chop(1);
154 QAction* copyAction = popup.addAction(KIcon("editcopy"),
155 i18n("&Copy Here") + "\t" + seq);
156
157 seq = QKeySequence(Qt::ControlModifier + Qt::ShiftModifier).toString();
158 seq.chop(1);
159 QAction* linkAction = popup.addAction(KIcon("www"),
160 i18n("&Link Here") + "\t" + seq);
161
162 popup.addSeparator();
163 popup.addAction(KIcon("stop"), i18n("Cancel"));
164
165 QAction* activatedAction = popup.exec(QCursor::pos());
166 if (activatedAction == moveAction) {
167 action = Qt::MoveAction;
168 }
169 else if (activatedAction == copyAction) {
170 action = Qt::CopyAction;
171 }
172 else if (activatedAction == linkAction) {
173 action = Qt::LinkAction;
174 }
175 }
176
177 switch (action) {
178 case Qt::MoveAction:
179 moveUrls(urls, destination);
180 break;
181
182 case Qt::CopyAction:
183 copyUrls(urls, destination);
184 break;
185
186 case Qt::LinkAction:
187 linkUrls(urls, destination);
188 break;
189
190 default:
191 break;
192 }
193 }
194
195 void DolphinMainWindow::refreshViews()
196 {
197 const bool split = DolphinSettings::instance().generalSettings()->splitView();
198 const bool isPrimaryViewActive = (m_activeView == m_view[PrimaryIdx]);
199 KUrl url;
200 for (int i = PrimaryIdx; i <= SecondaryIdx; ++i) {
201 if (m_view[i] != 0) {
202 url = m_view[i]->url();
203
204 // delete view instance...
205 m_view[i]->close();
206 m_view[i]->deleteLater();
207 m_view[i] = 0;
208 }
209
210 if (split || (i == PrimaryIdx)) {
211 // ... and recreate it
212 ViewProperties props(url);
213 m_view[i] = new DolphinView(this,
214 m_splitter,
215 url,
216 props.viewMode(),
217 props.showHiddenFiles());
218 connectViewSignals(i);
219 m_view[i]->show();
220 }
221 }
222
223 m_activeView = isPrimaryViewActive ? m_view[PrimaryIdx] : m_view[SecondaryIdx];
224 assert(m_activeView != 0);
225
226 updateViewActions();
227 emit activeViewChanged();
228 }
229
230 void DolphinMainWindow::slotViewModeChanged()
231 {
232 updateViewActions();
233 }
234
235 void DolphinMainWindow::slotShowHiddenFilesChanged()
236 {
237 KToggleAction* showHiddenFilesAction =
238 static_cast<KToggleAction*>(actionCollection()->action("show_hidden_files"));
239 showHiddenFilesAction->setChecked(m_activeView->showHiddenFiles());
240 }
241
242 void DolphinMainWindow::slotSortingChanged(DolphinView::Sorting sorting)
243 {
244 QAction* action = 0;
245 switch (sorting) {
246 case DolphinView::SortByName:
247 action = actionCollection()->action("by_name");
248 break;
249 case DolphinView::SortBySize:
250 action = actionCollection()->action("by_size");
251 break;
252 case DolphinView::SortByDate:
253 action = actionCollection()->action("by_date");
254 break;
255 default:
256 break;
257 }
258
259 if (action != 0) {
260 KToggleAction* toggleAction = static_cast<KToggleAction*>(action);
261 toggleAction->setChecked(true);
262 }
263 }
264
265 void DolphinMainWindow::slotSortOrderChanged(Qt::SortOrder order)
266 {
267 KToggleAction* descending = static_cast<KToggleAction*>(actionCollection()->action("descending"));
268 const bool sortDescending = (order == Qt::Descending);
269 descending->setChecked(sortDescending);
270 }
271
272 void DolphinMainWindow::slotSelectionChanged()
273 {
274 updateEditActions();
275
276 assert(m_view[PrimaryIdx] != 0);
277 int selectedUrlsCount = m_view[PrimaryIdx]->selectedUrls().count();
278 if (m_view[SecondaryIdx] != 0) {
279 selectedUrlsCount += m_view[SecondaryIdx]->selectedUrls().count();
280 }
281
282 QAction* compareFilesAction = actionCollection()->action("compare_files");
283 compareFilesAction->setEnabled(selectedUrlsCount == 2);
284
285 m_activeView->updateStatusBar();
286
287 emit selectionChanged();
288 }
289
290 void DolphinMainWindow::slotHistoryChanged()
291 {
292 updateHistory();
293 }
294
295 void DolphinMainWindow::slotUrlChanged(const KUrl& url)
296 {
297 updateEditActions();
298 updateGoActions();
299 setCaption(url.fileName());
300 }
301
302 void DolphinMainWindow::updateFilterBarAction(bool show)
303 {
304 KToggleAction* showFilterBarAction =
305 static_cast<KToggleAction*>(actionCollection()->action("show_filter_bar"));
306 showFilterBarAction->setChecked(show);
307 }
308
309 void DolphinMainWindow::openNewMainWindow()
310 {
311 DolphinApplication::app()->createMainWindow()->show();
312 }
313
314 void DolphinMainWindow::closeEvent(QCloseEvent* event)
315 {
316 DolphinSettings& settings = DolphinSettings::instance();
317 GeneralSettings* generalSettings = settings.generalSettings();
318 generalSettings->setFirstRun(false);
319
320 settings.save();
321
322 // TODO: I assume there will be a generic way in KDE 4 to store the docks
323 // of the main window. In the meantime they are stored manually:
324 QString filename = KStandardDirs::locateLocal("data", KGlobal::instance()->instanceName());
325 filename.append("/panels_layout");
326 QFile file(filename);
327 if (file.open(QIODevice::WriteOnly)) {
328 QByteArray data = saveState();
329 file.write(data);
330 file.close();
331 }
332
333 KMainWindow::closeEvent(event);
334 }
335
336 void DolphinMainWindow::saveProperties(KConfig* config)
337 {
338 config->setGroup("Primary view");
339 config->writeEntry("Url", m_view[PrimaryIdx]->url().url());
340 config->writeEntry("Editable Url", m_view[PrimaryIdx]->isUrlEditable());
341 if (m_view[SecondaryIdx] != 0) {
342 config->setGroup("Secondary view");
343 config->writeEntry("Url", m_view[SecondaryIdx]->url().url());
344 config->writeEntry("Editable Url", m_view[SecondaryIdx]->isUrlEditable());
345 }
346 }
347
348 void DolphinMainWindow::readProperties(KConfig* config)
349 {
350 config->setGroup("Primary view");
351 m_view[PrimaryIdx]->setUrl(config->readEntry("Url"));
352 m_view[PrimaryIdx]->setUrlEditable(config->readEntry("Editable Url", false));
353 if (config->hasGroup("Secondary view")) {
354 config->setGroup("Secondary view");
355 if (m_view[SecondaryIdx] == 0) {
356 toggleSplitView();
357 }
358 m_view[SecondaryIdx]->setUrl(config->readEntry("Url"));
359 m_view[SecondaryIdx]->setUrlEditable(config->readEntry("Editable Url", false));
360 }
361 else if (m_view[SecondaryIdx] != 0) {
362 toggleSplitView();
363 }
364 }
365
366 void DolphinMainWindow::updateNewMenu()
367 {
368 m_newMenu->slotCheckUpToDate();
369 m_newMenu->setPopupFiles(activeView()->url());
370 }
371
372 void DolphinMainWindow::rename()
373 {
374 clearStatusBar();
375 m_activeView->renameSelectedItems();
376 }
377
378 void DolphinMainWindow::moveToTrash()
379 {
380 clearStatusBar();
381 const KUrl::List selectedUrls = m_activeView->selectedUrls();
382 KonqOperations::del(this, KonqOperations::TRASH, selectedUrls);
383 m_undoOperations.append(KonqOperations::TRASH);
384 }
385
386 void DolphinMainWindow::deleteItems()
387 {
388 clearStatusBar();
389
390 KUrl::List list = m_activeView->selectedUrls();
391 const uint itemCount = list.count();
392 assert(itemCount >= 1);
393
394 QString text;
395 if (itemCount > 1) {
396 text = i18n("Do you really want to delete the %1 selected items?",itemCount);
397 }
398 else {
399 const KUrl& url = list.first();
400 text = i18n("Do you really want to delete '%1'?",url.fileName());
401 }
402
403 const bool del = KMessageBox::warningContinueCancel(this,
404 text,
405 QString::null,
406 KGuiItem(i18n("Delete"), KIcon("editdelete"))
407 ) == KMessageBox::Continue;
408 if (del) {
409 KIO::Job* job = KIO::del(list);
410 connect(job, SIGNAL(result(KJob*)),
411 this, SLOT(slotHandleJobError(KJob*)));
412 connect(job, SIGNAL(result(KJob*)),
413 this, SLOT(slotDeleteFileFinished(KJob*)));
414 }
415 }
416
417 void DolphinMainWindow::properties()
418 {
419 const KFileItemList list = m_activeView->selectedItems();
420 new KPropertiesDialog(list, this);
421 }
422
423 void DolphinMainWindow::quit()
424 {
425 close();
426 }
427
428 void DolphinMainWindow::slotHandleJobError(KJob* job)
429 {
430 if (job->error() != 0) {
431 DolphinStatusBar* statusBar = m_activeView->statusBar();
432 statusBar->setMessage(job->errorString(),
433 DolphinStatusBar::Error);
434 }
435 }
436
437 void DolphinMainWindow::slotDeleteFileFinished(KJob* job)
438 {
439 if (job->error() == 0) {
440 DolphinStatusBar* statusBar = m_activeView->statusBar();
441 statusBar->setMessage(i18n("Delete operation completed."),
442 DolphinStatusBar::OperationCompleted);
443 }
444 }
445
446 void DolphinMainWindow::slotUndoAvailable(bool available)
447 {
448 QAction* undoAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::Undo));
449 if (undoAction != 0) {
450 undoAction->setEnabled(available);
451 }
452
453 if (available && (m_undoOperations.count() > 0)) {
454 const KonqOperations::Operation op = m_undoOperations.takeFirst();
455 DolphinStatusBar* statusBar = m_activeView->statusBar();
456 switch (op) {
457 case KonqOperations::COPY:
458 statusBar->setMessage(i18n("Copy operation completed."),
459 DolphinStatusBar::OperationCompleted);
460 break;
461 case KonqOperations::MOVE:
462 statusBar->setMessage(i18n("Move operation completed."),
463 DolphinStatusBar::OperationCompleted);
464 break;
465 case KonqOperations::LINK:
466 statusBar->setMessage(i18n("Link operation completed."),
467 DolphinStatusBar::OperationCompleted);
468 break;
469 case KonqOperations::TRASH:
470 statusBar->setMessage(i18n("Move to trash operation completed."),
471 DolphinStatusBar::OperationCompleted);
472 break;
473 default:
474 break;
475 }
476
477 }
478 }
479
480 void DolphinMainWindow::slotUndoTextChanged(const QString& text)
481 {
482 QAction* undoAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::Undo));
483 if (undoAction != 0) {
484 undoAction->setText(text);
485 }
486 }
487
488 void DolphinMainWindow::cut()
489 {
490 QMimeData* mimeData = new QMimeData();
491 const KUrl::List kdeUrls = m_activeView->selectedUrls();
492 const KUrl::List mostLocalUrls;
493 KonqMimeData::populateMimeData(mimeData, kdeUrls, mostLocalUrls, true);
494 QApplication::clipboard()->setMimeData(mimeData);
495 }
496
497 void DolphinMainWindow::copy()
498 {
499 QMimeData* mimeData = new QMimeData();
500 const KUrl::List kdeUrls = m_activeView->selectedUrls();
501 const KUrl::List mostLocalUrls;
502 KonqMimeData::populateMimeData(mimeData, kdeUrls, mostLocalUrls, false);
503
504 QApplication::clipboard()->setMimeData(mimeData);
505 }
506
507 void DolphinMainWindow::paste()
508 {
509 QClipboard* clipboard = QApplication::clipboard();
510 const QMimeData* mimeData = clipboard->mimeData();
511
512 clearStatusBar();
513
514 const KUrl::List sourceUrls = KUrl::List::fromMimeData(mimeData);
515
516 // per default the pasting is done into the current Url of the view
517 KUrl destUrl(m_activeView->url());
518
519 // check whether the pasting should be done into a selected directory
520 KUrl::List selectedUrls = m_activeView->selectedUrls();
521 if (selectedUrls.count() == 1) {
522 const KFileItem fileItem(S_IFDIR,
523 KFileItem::Unknown,
524 selectedUrls.first(),
525 true);
526 if (fileItem.isDir()) {
527 // only one item is selected which is a directory, hence paste
528 // into this directory
529 destUrl = selectedUrls.first();
530 }
531 }
532
533 if (KonqMimeData::decodeIsCutSelection(mimeData)) {
534 moveUrls(sourceUrls, destUrl);
535 clipboard->clear();
536 }
537 else {
538 copyUrls(sourceUrls, destUrl);
539 }
540 }
541
542 void DolphinMainWindow::updatePasteAction()
543 {
544 QAction* pasteAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::Paste));
545 if (pasteAction == 0) {
546 return;
547 }
548
549 QString text(i18n("Paste"));
550 QClipboard* clipboard = QApplication::clipboard();
551 const QMimeData* mimeData = clipboard->mimeData();
552
553 KUrl::List urls = KUrl::List::fromMimeData(mimeData);
554 if (!urls.isEmpty()) {
555 pasteAction->setEnabled(true);
556
557 const int count = urls.count();
558 if (count == 1) {
559 pasteAction->setText(i18n("Paste 1 File"));
560 }
561 else {
562 pasteAction->setText(i18n("Paste %1 Files").arg(count));
563 }
564 }
565 else {
566 pasteAction->setEnabled(false);
567 pasteAction->setText(i18n("Paste"));
568 }
569
570 if (pasteAction->isEnabled()) {
571 KUrl::List urls = m_activeView->selectedUrls();
572 const uint count = urls.count();
573 if (count > 1) {
574 // pasting should not be allowed when more than one file
575 // is selected
576 pasteAction->setEnabled(false);
577 }
578 else if (count == 1) {
579 // Only one file is selected. Pasting is only allowed if this
580 // file is a directory.
581 // TODO: this doesn't work with remote protocols; instead we need a
582 // m_activeView->selectedFileItems() to get the real KFileItems
583 const KFileItem fileItem(S_IFDIR,
584 KFileItem::Unknown,
585 urls.first(),
586 true);
587 pasteAction->setEnabled(fileItem.isDir());
588 }
589 }
590 }
591
592 void DolphinMainWindow::selectAll()
593 {
594 clearStatusBar();
595 m_activeView->selectAll();
596 }
597
598 void DolphinMainWindow::invertSelection()
599 {
600 clearStatusBar();
601 m_activeView->invertSelection();
602 }
603 void DolphinMainWindow::setIconsView()
604 {
605 m_activeView->setMode(DolphinView::IconsView);
606 }
607
608 void DolphinMainWindow::setDetailsView()
609 {
610 m_activeView->setMode(DolphinView::DetailsView);
611 }
612
613 void DolphinMainWindow::sortByName()
614 {
615 m_activeView->setSorting(DolphinView::SortByName);
616 }
617
618 void DolphinMainWindow::sortBySize()
619 {
620 m_activeView->setSorting(DolphinView::SortBySize);
621 }
622
623 void DolphinMainWindow::sortByDate()
624 {
625 m_activeView->setSorting(DolphinView::SortByDate);
626 }
627
628 void DolphinMainWindow::toggleSortOrder()
629 {
630 const Qt::SortOrder order = (m_activeView->sortOrder() == Qt::Ascending) ?
631 Qt::Descending :
632 Qt::Ascending;
633 m_activeView->setSortOrder(order);
634 }
635
636 void DolphinMainWindow::toggleSplitView()
637 {
638 if (m_view[SecondaryIdx] == 0) {
639 const int newWidth = (m_view[PrimaryIdx]->width() - m_splitter->handleWidth()) / 2;
640 // create a secondary view
641 m_view[SecondaryIdx] = new DolphinView(this,
642 0,
643 m_view[PrimaryIdx]->url(),
644 m_view[PrimaryIdx]->mode(),
645 m_view[PrimaryIdx]->showHiddenFiles());
646 connectViewSignals(SecondaryIdx);
647 m_splitter->addWidget(m_view[SecondaryIdx]);
648 m_splitter->setSizes(QList<int>() << newWidth << newWidth);
649 m_view[SecondaryIdx]->show();
650 }
651 else {
652 // remove secondary view
653 if (m_activeView == m_view[PrimaryIdx]) {
654 m_view[SecondaryIdx]->close();
655 m_view[SecondaryIdx]->deleteLater();
656 m_view[SecondaryIdx] = 0;
657 setActiveView(m_view[PrimaryIdx]);
658 }
659 else {
660 // The secondary view is active, hence from the users point of view
661 // the content of the secondary view should be moved to the primary view.
662 // From an implementation point of view it is more efficient to close
663 // the primary view and exchange the internal pointers afterwards.
664 m_view[PrimaryIdx]->close();
665 delete m_view[PrimaryIdx];
666 m_view[PrimaryIdx] = m_view[SecondaryIdx];
667 m_view[SecondaryIdx] = 0;
668 setActiveView(m_view[PrimaryIdx]);
669 }
670 }
671 }
672
673 void DolphinMainWindow::reloadView()
674 {
675 clearStatusBar();
676 m_activeView->reload();
677 }
678
679 void DolphinMainWindow::stopLoading()
680 {
681 }
682
683 void DolphinMainWindow::togglePreview()
684 {
685 clearStatusBar();
686
687 const KToggleAction* showPreviewAction =
688 static_cast<KToggleAction*>(actionCollection()->action("show_preview"));
689 const bool show = showPreviewAction->isChecked();
690 m_activeView->setShowPreview(show);
691 }
692
693 void DolphinMainWindow::toggleShowHiddenFiles()
694 {
695 clearStatusBar();
696
697 const KToggleAction* showHiddenFilesAction =
698 static_cast<KToggleAction*>(actionCollection()->action("show_hidden_files"));
699 const bool show = showHiddenFilesAction->isChecked();
700 m_activeView->setShowHiddenFiles(show);
701 }
702
703 void DolphinMainWindow::showFilterBar()
704 {
705 const KToggleAction* showFilterBarAction =
706 static_cast<KToggleAction*>(actionCollection()->action("show_filter_bar"));
707 const bool show = showFilterBarAction->isChecked();
708 m_activeView->showFilterBar(show);
709 }
710
711 void DolphinMainWindow::zoomIn()
712 {
713 m_activeView->zoomIn();
714 updateViewActions();
715 }
716
717 void DolphinMainWindow::zoomOut()
718 {
719 m_activeView->zoomOut();
720 updateViewActions();
721 }
722
723 void DolphinMainWindow::toggleEditLocation()
724 {
725 clearStatusBar();
726
727 KToggleAction* action = static_cast<KToggleAction*>(actionCollection()->action("editable_location"));
728
729 bool editOrBrowse = action->isChecked();
730 m_activeView->setUrlEditable(editOrBrowse);
731 }
732
733 void DolphinMainWindow::editLocation()
734 {
735 KToggleAction* action = static_cast<KToggleAction*>(actionCollection()->action("editable_location"));
736 action->setChecked(true);
737 m_activeView->setUrlEditable(true);
738 }
739
740 void DolphinMainWindow::adjustViewProperties()
741 {
742 clearStatusBar();
743 ViewPropertiesDialog dlg(m_activeView);
744 dlg.exec();
745 }
746
747 void DolphinMainWindow::goBack()
748 {
749 clearStatusBar();
750 m_activeView->goBack();
751 }
752
753 void DolphinMainWindow::goForward()
754 {
755 clearStatusBar();
756 m_activeView->goForward();
757 }
758
759 void DolphinMainWindow::goUp()
760 {
761 clearStatusBar();
762 m_activeView->goUp();
763 }
764
765 void DolphinMainWindow::goHome()
766 {
767 clearStatusBar();
768 m_activeView->goHome();
769 }
770
771 void DolphinMainWindow::openTerminal()
772 {
773 QString command("konsole --workdir \"");
774 command.append(m_activeView->url().path());
775 command.append('\"');
776
777 KRun::runCommand(command, "Konsole", "konsole");
778 }
779
780 void DolphinMainWindow::findFile()
781 {
782 KRun::run("kfind", m_activeView->url());
783 }
784
785 void DolphinMainWindow::compareFiles()
786 {
787 // The method is only invoked if exactly 2 files have
788 // been selected. The selected files may be:
789 // - both in the primary view
790 // - both in the secondary view
791 // - one in the primary view and the other in the secondary
792 // view
793 assert(m_view[PrimaryIdx] != 0);
794
795 KUrl urlA;
796 KUrl urlB;
797 KUrl::List urls = m_view[PrimaryIdx]->selectedUrls();
798
799 switch (urls.count()) {
800 case 0: {
801 assert(m_view[SecondaryIdx] != 0);
802 urls = m_view[SecondaryIdx]->selectedUrls();
803 assert(urls.count() == 2);
804 urlA = urls[0];
805 urlB = urls[1];
806 break;
807 }
808
809 case 1: {
810 urlA = urls[0];
811 assert(m_view[SecondaryIdx] != 0);
812 urls = m_view[SecondaryIdx]->selectedUrls();
813 assert(urls.count() == 1);
814 urlB = urls[0];
815 break;
816 }
817
818 case 2: {
819 urlA = urls[0];
820 urlB = urls[1];
821 break;
822 }
823
824 default: {
825 // may not happen: compareFiles may only get invoked if 2
826 // files are selected
827 assert(false);
828 }
829 }
830
831 QString command("kompare -c \"");
832 command.append(urlA.pathOrUrl());
833 command.append("\" \"");
834 command.append(urlB.pathOrUrl());
835 command.append('\"');
836 KRun::runCommand(command, "Kompare", "kompare");
837
838 }
839
840 void DolphinMainWindow::editSettings()
841 {
842 // TODO: make a static method for opening the settings dialog
843 DolphinSettingsDialog dlg(this);
844 dlg.exec();
845 }
846
847 void DolphinMainWindow::init()
848 {
849 // Check whether Dolphin runs the first time. If yes then
850 // a proper default window size is given at the end of DolphinMainWindow::init().
851 GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings();
852 const bool firstRun = generalSettings->firstRun();
853
854 setAcceptDrops(true);
855
856 m_splitter = new QSplitter(this);
857
858 DolphinSettings& settings = DolphinSettings::instance();
859
860 KBookmarkManager* manager = settings.bookmarkManager();
861 assert(manager != 0);
862 KBookmarkGroup root = manager->root();
863 if (root.first().isNull()) {
864 root.addBookmark(manager, i18n("Home"), settings.generalSettings()->homeUrl(), "folder_home");
865 root.addBookmark(manager, i18n("Storage Media"), KUrl("media:/"), "blockdevice");
866 root.addBookmark(manager, i18n("Network"), KUrl("remote:/"), "network_local");
867 root.addBookmark(manager, i18n("Root"), KUrl("/"), "folder_red");
868 root.addBookmark(manager, i18n("Trash"), KUrl("trash:/"), "trashcan_full");
869 }
870
871 setupActions();
872
873 const KUrl& homeUrl = root.first().url();
874 setCaption(homeUrl.fileName());
875 ViewProperties props(homeUrl);
876 m_view[PrimaryIdx] = new DolphinView(this,
877 m_splitter,
878 homeUrl,
879 props.viewMode(),
880 props.showHiddenFiles());
881 connectViewSignals(PrimaryIdx);
882 m_view[PrimaryIdx]->show();
883
884 m_activeView = m_view[PrimaryIdx];
885
886 setCentralWidget(m_splitter);
887 setupDockWidgets();
888
889 setupGUI(Keys|Save|Create|ToolBar);
890 createGUI();
891
892 stateChanged("new_file");
893 setAutoSaveSettings();
894
895 QClipboard* clipboard = QApplication::clipboard();
896 connect(clipboard, SIGNAL(dataChanged()),
897 this, SLOT(updatePasteAction()));
898 updatePasteAction();
899 updateGoActions();
900
901 loadSettings();
902
903 if (firstRun) {
904 // assure a proper default size if Dolphin runs the first time
905 resize(640, 480);
906 }
907 }
908
909 void DolphinMainWindow::loadSettings()
910 {
911 GeneralSettings* settings = DolphinSettings::instance().generalSettings();
912
913 KToggleAction* splitAction = static_cast<KToggleAction*>(actionCollection()->action("split_view"));
914 if (settings->splitView()) {
915 splitAction->setChecked(true);
916 toggleSplitView();
917 }
918
919 updateViewActions();
920
921 // TODO: I assume there will be a generic way in KDE 4 to restore the docks
922 // of the main window. In the meantime they are restored manually (see also
923 // DolphinMainWindow::closeEvent() for more details):
924 QString filename = KStandardDirs::locateLocal("data", KGlobal::instance()->instanceName());
925 filename.append("/panels_layout");
926 QFile file(filename);
927 if (file.open(QIODevice::ReadOnly)) {
928 QByteArray data = file.readAll();
929 restoreState(data);
930 file.close();
931 }
932 }
933
934 void DolphinMainWindow::setupActions()
935 {
936 // setup 'File' menu
937 m_newMenu = new KNewMenu(actionCollection(), this, "create_new");
938 KMenu* menu = m_newMenu->menu();
939 menu->setTitle(i18n("Create New..."));
940 menu->setIcon(SmallIcon("filenew"));
941 connect(menu, SIGNAL(aboutToShow()),
942 this, SLOT(updateNewMenu()));
943
944 QAction* action = actionCollection()->addAction("new_window");
945 action->setIcon(KIcon("window_new"));
946 action->setText(i18n("New &Window"));
947 connect(action, SIGNAL(triggered()), this, SLOT(openNewMainWindow()));
948
949 QAction* rename = actionCollection()->addAction("rename");
950 rename->setText(i18n("Rename"));
951 rename->setShortcut(Qt::Key_F2);
952 connect(rename, SIGNAL(triggered()), this, SLOT(rename()));
953
954 QAction* moveToTrash = actionCollection()->addAction("move_to_trash");
955 moveToTrash->setText(i18n("Move to Trash"));
956 moveToTrash->setIcon(KIcon("edittrash"));
957 moveToTrash->setShortcut(QKeySequence::Delete);
958 connect(moveToTrash, SIGNAL(triggered()), this, SLOT(moveToTrash()));
959
960 QAction* deleteAction = actionCollection()->addAction("delete");
961 deleteAction->setText(i18n("Delete"));
962 deleteAction->setShortcut(Qt::ALT | Qt::Key_Delete);
963 deleteAction->setIcon(KIcon("editdelete"));
964 connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteItems()));
965
966 QAction* properties = actionCollection()->addAction("properties");
967 properties->setText(i18n("Propert&ies"));
968 properties->setShortcut(Qt::Key_Alt | Qt::Key_Return);
969 connect(properties, SIGNAL(triggered()), this, SLOT(properties()));
970
971 KStandardAction::quit(this, SLOT(quit()), actionCollection());
972
973 // setup 'Edit' menu
974 KStandardAction::undo(KonqUndoManager::self(),
975 SLOT(undo()),
976 actionCollection());
977
978 KStandardAction::cut(this, SLOT(cut()), actionCollection());
979 KStandardAction::copy(this, SLOT(copy()), actionCollection());
980 KStandardAction::paste(this, SLOT(paste()), actionCollection());
981
982 QAction* selectAll = actionCollection()->addAction("select_all");
983 selectAll->setText(i18n("Select All"));
984 selectAll->setShortcut(Qt::CTRL + Qt::Key_A);
985 connect(selectAll, SIGNAL(triggered()), this, SLOT(selectAll()));
986
987 QAction* invertSelection = actionCollection()->addAction("invert_selection");
988 invertSelection->setText(i18n("Invert Selection"));
989 invertSelection->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_A);
990 connect(invertSelection, SIGNAL(triggered()), this, SLOT(invertSelection()));
991
992 // setup 'View' menu
993 KStandardAction::zoomIn(this,
994 SLOT(zoomIn()),
995 actionCollection());
996
997 KStandardAction::zoomOut(this,
998 SLOT(zoomOut()),
999 actionCollection());
1000
1001 KToggleAction* iconsView = actionCollection()->add<KToggleAction>("icons");
1002 iconsView->setText(i18n("Icons"));
1003 iconsView->setShortcut(Qt::CTRL | Qt::Key_1);
1004 iconsView->setIcon(KIcon("view_icon"));
1005 connect(iconsView, SIGNAL(triggered()), this, SLOT(setIconsView()));
1006
1007 KToggleAction* detailsView = actionCollection()->add<KToggleAction>("details");
1008 detailsView->setText(i18n("Details"));
1009 detailsView->setShortcut(Qt::CTRL | Qt::Key_2);
1010 detailsView->setIcon(KIcon("view_text"));
1011 connect(detailsView, SIGNAL(triggered()), this, SLOT(setDetailsView()));
1012
1013 QActionGroup* viewModeGroup = new QActionGroup(this);
1014 viewModeGroup->addAction(iconsView);
1015 viewModeGroup->addAction(detailsView);
1016
1017 KToggleAction* sortByName = actionCollection()->add<KToggleAction>("by_name");
1018 sortByName->setText(i18n("By Name"));
1019 connect(sortByName, SIGNAL(triggered()), this, SLOT(sortByName()));
1020
1021 KToggleAction* sortBySize = actionCollection()->add<KToggleAction>("by_size");
1022 sortBySize->setText(i18n("By Size"));
1023 connect(sortBySize, SIGNAL(triggered()), this, SLOT(sortBySize()));
1024
1025 KToggleAction* sortByDate = actionCollection()->add<KToggleAction>("by_date");
1026 sortByDate->setText(i18n("By Date"));
1027 connect(sortByDate, SIGNAL(triggered()), this, SLOT(sortByDate()));
1028
1029 QActionGroup* sortGroup = new QActionGroup(this);
1030 sortGroup->addAction(sortByName);
1031 sortGroup->addAction(sortBySize);
1032 sortGroup->addAction(sortByDate);
1033
1034 KToggleAction* sortDescending = actionCollection()->add<KToggleAction>("descending");
1035 sortDescending->setText(i18n("Descending"));
1036 connect(sortDescending, SIGNAL(triggered()), this, SLOT(toggleSortOrder()));
1037
1038 KToggleAction* showPreview = actionCollection()->add<KToggleAction>("show_preview");
1039 showPreview->setText(i18n("Show Preview"));
1040 connect(showPreview, SIGNAL(triggered()), this, SLOT(togglePreview()));
1041
1042 KToggleAction* showHiddenFiles = actionCollection()->add<KToggleAction>("show_hidden_files");
1043 showHiddenFiles->setText(i18n("Show Hidden Files"));
1044 //showHiddenFiles->setShortcut(Qt::ALT | Qt::Key_ KDE4-TODO: what Qt-Key represents '.'?
1045 connect(showHiddenFiles, SIGNAL(triggered()), this, SLOT(toggleShowHiddenFiles()));
1046
1047 KToggleAction* split = actionCollection()->add<KToggleAction>("split_view");
1048 split->setText(i18n("Split View"));
1049 split->setShortcut(Qt::Key_F10);
1050 split->setIcon(KIcon("view_left_right"));
1051 connect(split, SIGNAL(triggered()), this, SLOT(toggleSplitView()));
1052
1053 QAction* reload = actionCollection()->addAction("reload");
1054 reload->setText(i18n("Reload"));
1055 reload->setShortcut(Qt::Key_F5);
1056 reload->setIcon(KIcon("reload"));
1057 connect(reload, SIGNAL(triggered()), this, SLOT(reloadView()));
1058
1059 QAction* stop = actionCollection()->addAction("stop");
1060 stop->setText(i18n("Stop"));
1061 stop->setIcon(KIcon("stop"));
1062 connect(stop, SIGNAL(triggered()), this, SLOT(stopLoading()));
1063
1064 KToggleAction* showFullLocation = actionCollection()->add<KToggleAction>("editable_location");
1065 showFullLocation->setText(i18n("Show Full Location"));
1066 showFullLocation->setShortcut(Qt::CTRL | Qt::Key_L);
1067 connect(showFullLocation, SIGNAL(triggered()), this, SLOT(toggleEditLocation()));
1068
1069 KToggleAction* editLocation = actionCollection()->add<KToggleAction>("edit_location");
1070 editLocation->setText(i18n("Edit Location"));
1071 editLocation->setShortcut(Qt::Key_F6);
1072 connect(editLocation, SIGNAL(triggered()), this, SLOT(editLocation()));
1073
1074 QAction* adjustViewProps = actionCollection()->addAction("view_properties");
1075 adjustViewProps->setText(i18n("Adjust View Properties..."));
1076 connect(adjustViewProps, SIGNAL(triggered()), this, SLOT(adjustViewProperties()));
1077
1078 // setup 'Go' menu
1079 KStandardAction::back(this, SLOT(goBack()), actionCollection());
1080 KStandardAction::forward(this, SLOT(goForward()), actionCollection());
1081 KStandardAction::up(this, SLOT(goUp()), actionCollection());
1082 KStandardAction::home(this, SLOT(goHome()), actionCollection());
1083
1084 // setup 'Tools' menu
1085 QAction* openTerminal = actionCollection()->addAction("open_terminal");
1086 openTerminal->setText(i18n("Open Terminal"));
1087 openTerminal->setShortcut(Qt::Key_F4);
1088 openTerminal->setIcon(KIcon("konsole"));
1089 connect(openTerminal, SIGNAL(triggered()), this, SLOT(openTerminal()));
1090
1091 QAction* findFile = actionCollection()->addAction("find_file");
1092 findFile->setText(i18n("Find File..."));
1093 findFile->setShortcut(Qt::Key_F);
1094 findFile->setIcon(KIcon("filefind"));
1095 connect(findFile, SIGNAL(triggered()), this, SLOT(findFile()));
1096
1097 KToggleAction* showFilterBar = actionCollection()->add<KToggleAction>("show_filter_bar");
1098 showFilterBar->setText(i18n("Show Filter Bar"));
1099 showFilterBar->setShortcut(Qt::Key_Slash);
1100 connect(showFilterBar, SIGNAL(triggered()), this, SLOT(showFilterBar()));
1101
1102 QAction* compareFiles = actionCollection()->addAction("compare_files");
1103 compareFiles->setText(i18n("Compare Files"));
1104 compareFiles->setIcon(KIcon("kompare"));
1105 compareFiles->setEnabled(false);
1106 connect(compareFiles, SIGNAL(triggered()), this, SLOT(compareFiles()));
1107
1108 // setup 'Settings' menu
1109 KStandardAction::preferences(this, SLOT(editSettings()), actionCollection());
1110 }
1111
1112 void DolphinMainWindow::setupDockWidgets()
1113 {
1114 QDockWidget* shortcutsDock = new QDockWidget(i18n("Bookmarks"));
1115 shortcutsDock->setObjectName("bookmarksDock");
1116 shortcutsDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
1117 shortcutsDock->setWidget(new BookmarksSidebarPage(this));
1118
1119 shortcutsDock->toggleViewAction()->setText(i18n("Show Bookmarks Panel"));
1120 actionCollection()->addAction("show_bookmarks_panel", shortcutsDock->toggleViewAction());
1121
1122 addDockWidget(Qt::LeftDockWidgetArea, shortcutsDock);
1123
1124 QDockWidget* infoDock = new QDockWidget(i18n("Information"));
1125 infoDock->setObjectName("infoDock");
1126 infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
1127 infoDock->setWidget(new InfoSidebarPage(this));
1128
1129 infoDock->toggleViewAction()->setText(i18n("Show Information Panel"));
1130 actionCollection()->addAction("show_info_panel", infoDock->toggleViewAction());
1131
1132 addDockWidget(Qt::RightDockWidgetArea, infoDock);
1133 }
1134
1135 void DolphinMainWindow::updateHistory()
1136 {
1137 int index = 0;
1138 const QLinkedList<UrlNavigator::HistoryElem> list = m_activeView->urlHistory(index);
1139
1140 QAction* backAction = actionCollection()->action("go_back");
1141 if (backAction != 0) {
1142 backAction->setEnabled(index < static_cast<int>(list.count()) - 1);
1143 }
1144
1145 QAction* forwardAction = actionCollection()->action("go_forward");
1146 if (forwardAction != 0) {
1147 forwardAction->setEnabled(index > 0);
1148 }
1149 }
1150
1151 void DolphinMainWindow::updateEditActions()
1152 {
1153 const KFileItemList list = m_activeView->selectedItems();
1154 if (list.isEmpty()) {
1155 stateChanged("has_no_selection");
1156 }
1157 else {
1158 stateChanged("has_selection");
1159
1160 QAction* renameAction = actionCollection()->action("rename");
1161 if (renameAction != 0) {
1162 renameAction->setEnabled(list.count() >= 1);
1163 }
1164
1165 bool enableMoveToTrash = true;
1166
1167 KFileItemList::const_iterator it = list.begin();
1168 const KFileItemList::const_iterator end = list.end();
1169 while (it != end) {
1170 KFileItem* item = *it;
1171 const KUrl& url = item->url();
1172 // only enable the 'Move to Trash' action for local files
1173 if (!url.isLocalFile()) {
1174 enableMoveToTrash = false;
1175 }
1176 ++it;
1177 }
1178
1179 QAction* moveToTrashAction = actionCollection()->action("move_to_trash");
1180 moveToTrashAction->setEnabled(enableMoveToTrash);
1181 }
1182 updatePasteAction();
1183 }
1184
1185 void DolphinMainWindow::updateViewActions()
1186 {
1187 QAction* zoomInAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::ZoomIn));
1188 if (zoomInAction != 0) {
1189 zoomInAction->setEnabled(m_activeView->isZoomInPossible());
1190 }
1191
1192 QAction* zoomOutAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::ZoomOut));
1193 if (zoomOutAction != 0) {
1194 zoomOutAction->setEnabled(m_activeView->isZoomOutPossible());
1195 }
1196
1197 QAction* action = 0;
1198 switch (m_activeView->mode()) {
1199 case DolphinView::IconsView:
1200 action = actionCollection()->action("icons");
1201 break;
1202 case DolphinView::DetailsView:
1203 action = actionCollection()->action("details");
1204 break;
1205 default:
1206 break;
1207 }
1208
1209 if (action != 0) {
1210 KToggleAction* toggleAction = static_cast<KToggleAction*>(action);
1211 toggleAction->setChecked(true);
1212 }
1213
1214 slotSortingChanged(m_activeView->sorting());
1215 slotSortOrderChanged(m_activeView->sortOrder());
1216
1217 KToggleAction* showFilterBarAction =
1218 static_cast<KToggleAction*>(actionCollection()->action("show_filter_bar"));
1219 showFilterBarAction->setChecked(m_activeView->isFilterBarVisible());
1220
1221 KToggleAction* showHiddenFilesAction =
1222 static_cast<KToggleAction*>(actionCollection()->action("show_hidden_files"));
1223 showHiddenFilesAction->setChecked(m_activeView->showHiddenFiles());
1224
1225 KToggleAction* splitAction = static_cast<KToggleAction*>(actionCollection()->action("split_view"));
1226 splitAction->setChecked(m_view[SecondaryIdx] != 0);
1227 }
1228
1229 void DolphinMainWindow::updateGoActions()
1230 {
1231 QAction* goUpAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::Up));
1232 const KUrl& currentUrl = m_activeView->url();
1233 goUpAction->setEnabled(currentUrl.upUrl() != currentUrl);
1234 }
1235
1236 void DolphinMainWindow::copyUrls(const KUrl::List& source, const KUrl& dest)
1237 {
1238 KonqOperations::copy(this, KonqOperations::COPY, source, dest);
1239 m_undoOperations.append(KonqOperations::COPY);
1240 }
1241
1242 void DolphinMainWindow::moveUrls(const KUrl::List& source, const KUrl& dest)
1243 {
1244 KonqOperations::copy(this, KonqOperations::MOVE, source, dest);
1245 m_undoOperations.append(KonqOperations::MOVE);
1246 }
1247
1248 void DolphinMainWindow::linkUrls(const KUrl::List& source, const KUrl& dest)
1249 {
1250 KonqOperations::copy(this, KonqOperations::LINK, source, dest);
1251 m_undoOperations.append(KonqOperations::LINK);
1252 }
1253
1254 void DolphinMainWindow::clearStatusBar()
1255 {
1256 m_activeView->statusBar()->clear();
1257 }
1258
1259 void DolphinMainWindow::connectViewSignals(int viewIndex)
1260 {
1261 DolphinView* view = m_view[viewIndex];
1262 connect(view, SIGNAL(modeChanged()),
1263 this, SLOT(slotViewModeChanged()));
1264 connect(view, SIGNAL(showHiddenFilesChanged()),
1265 this, SLOT(slotShowHiddenFilesChanged()));
1266 connect(view, SIGNAL(sortingChanged(DolphinView::Sorting)),
1267 this, SLOT(slotSortingChanged(DolphinView::Sorting)));
1268 connect(view, SIGNAL(sortOrderChanged(Qt::SortOrder)),
1269 this, SLOT(slotSortOrderChanged(Qt::SortOrder)));
1270 connect(view, SIGNAL(selectionChanged()),
1271 this, SLOT(slotSelectionChanged()));
1272 connect(view, SIGNAL(showFilterBarChanged(bool)),
1273 this, SLOT(updateFilterBarAction(bool)));
1274
1275 const UrlNavigator* navigator = view->urlNavigator();
1276 connect(navigator, SIGNAL(urlChanged(const KUrl&)),
1277 this, SLOT(slotUrlChanged(const KUrl&)));
1278 connect(navigator, SIGNAL(historyChanged()),
1279 this, SLOT(slotHistoryChanged()));
1280
1281 }
1282
1283 DolphinMainWindow::UndoUiInterface::UndoUiInterface(DolphinMainWindow* mainWin) :
1284 m_mainWin(mainWin)
1285 {
1286 assert(m_mainWin != 0);
1287 }
1288
1289 DolphinMainWindow::UndoUiInterface::~UndoUiInterface()
1290 {
1291 }
1292
1293 void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job* job)
1294 {
1295 DolphinStatusBar* statusBar = m_mainWin->activeView()->statusBar();
1296 statusBar->setMessage(job->errorString(), DolphinStatusBar::Error);
1297 }
1298
1299 bool DolphinMainWindow::UndoUiInterface::copiedFileWasModified(const KUrl& src,
1300 const KUrl& dest,
1301 time_t /*srcTime*/,
1302 time_t destTime)
1303 {
1304 // The following code has been taken from libkonq/konq_undo.cc
1305 // Copyright (C) 2000 Simon Hausmann <hausmann@kde.org>
1306 // Copyright (C) 2006 David Faure <faure@kde.org>
1307 const QDateTime destDt = QDateTime::fromTime_t(destTime);
1308 const QString timeStr = KGlobal::locale()->formatDateTime(destDt, true /* short */);
1309 return KMessageBox::warningContinueCancel(
1310 m_mainWin,
1311 i18n( "The file %1 was copied from %2, but since then it has apparently been modified at %3.\n"
1312 "Undoing the copy will delete the file, and all modifications will be lost.\n"
1313 "Are you sure you want to delete %4?", dest.pathOrUrl(), src.pathOrUrl(), timeStr, dest.pathOrUrl()),
1314 i18n( "Undo File Copy Confirmation" ),
1315 KStandardGuiItem::cont(),
1316 QString(),
1317 KMessageBox::Notify | KMessageBox::Dangerous ) == KMessageBox::Continue;
1318 }
1319
1320 #include "dolphinmainwindow.moc"