diff options
| author | Peter Penz <[email protected]> | 2007-01-25 19:37:19 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-01-25 19:37:19 +0000 |
| commit | fb0b2a777ba8064d4afc3e4e38a80d3505b49d0a (patch) | |
| tree | d736b7b7378b32a14b7e79f2aac6afeeab46c438 /src/dolphinmainwindow.cpp | |
| parent | 33fab30e5788ee9cda288f72a737a5369174415e (diff) | |
Use custom implementation of KonqUndoManager::UiInterface for Dolphin. This allows that error messages are shown inside the status bar of Dolphin (otherwise a modal error dialog containing an "OK" button would be opened).
svn path=/trunk/playground/utils/dolphin/; revision=627130
Diffstat (limited to 'src/dolphinmainwindow.cpp')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index cf224971e..203a85b38 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -54,7 +54,6 @@ #include <kmessagebox.h>
#include <knewmenu.h>
#include <konqmimedata.h>
-#include <konq_undo.h>
#include <kpropertiesdialog.h>
#include <kprotocolinfo.h>
#include <ktoggleaction.h>
@@ -82,9 +81,12 @@ DolphinMainWindow::DolphinMainWindow() : KonqUndoManager::incRef();
- connect(KonqUndoManager::self(), SIGNAL(undoAvailable(bool)),
+ KonqUndoManager* undoManager = KonqUndoManager::self();
+ undoManager->setUiInterface(new UndoUiInterface(this));
+
+ connect(undoManager, SIGNAL(undoAvailable(bool)),
this, SLOT(slotUndoAvailable(bool)));
- connect(KonqUndoManager::self(), SIGNAL(undoTextChanged(const QString&)),
+ connect(undoManager, SIGNAL(undoTextChanged(const QString&)),
this, SLOT(slotUndoTextChanged(const QString&)));
}
@@ -182,8 +184,7 @@ void DolphinMainWindow::dropUrls(const KUrl::List& urls, break;
case Qt::LinkAction:
- KonqOperations::copy(this, KonqOperations::LINK, urls, destination);
- m_undoOperations.append(KonqOperations::LINK);
+ linkUrls(urls, destination);
break;
default:
@@ -1244,6 +1245,12 @@ void DolphinMainWindow::moveUrls(const KUrl::List& source, const KUrl& dest) m_undoOperations.append(KonqOperations::MOVE);
}
+void DolphinMainWindow::linkUrls(const KUrl::List& source, const KUrl& dest)
+{
+ KonqOperations::copy(this, KonqOperations::LINK, source, dest);
+ m_undoOperations.append(KonqOperations::LINK);
+}
+
void DolphinMainWindow::clearStatusBar()
{
m_activeView->statusBar()->clear();
@@ -1273,4 +1280,41 @@ void DolphinMainWindow::connectViewSignals(int viewIndex) }
+DolphinMainWindow::UndoUiInterface::UndoUiInterface(DolphinMainWindow* mainWin) :
+ m_mainWin(mainWin)
+{
+ assert(m_mainWin != 0);
+}
+
+DolphinMainWindow::UndoUiInterface::~UndoUiInterface()
+{
+}
+
+void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job* job)
+{
+ DolphinStatusBar* statusBar = m_mainWin->activeView()->statusBar();
+ statusBar->setMessage(job->errorString(), DolphinStatusBar::Error);
+}
+
+bool DolphinMainWindow::UndoUiInterface::copiedFileWasModified(const KUrl& src,
+ const KUrl& dest,
+ time_t /*srcTime*/,
+ time_t destTime)
+{
+ // The following code has been taken from libkonq/konq_undo.cc
+ // Copyright (C) 2000 Simon Hausmann <[email protected]>
+ // Copyright (C) 2006 David Faure <[email protected]>
+ const QDateTime destDt = QDateTime::fromTime_t(destTime);
+ const QString timeStr = KGlobal::locale()->formatDateTime(destDt, true /* short */);
+ return KMessageBox::warningContinueCancel(
+ m_mainWin,
+ i18n( "The file %1 was copied from %2, but since then it has apparently been modified at %3.\n"
+ "Undoing the copy will delete the file, and all modifications will be lost.\n"
+ "Are you sure you want to delete %4?", dest.pathOrUrl(), src.pathOrUrl(), timeStr, dest.pathOrUrl()),
+ i18n( "Undo File Copy Confirmation" ),
+ KStandardGuiItem::cont(),
+ QString(),
+ KMessageBox::Notify | KMessageBox::Dangerous ) == KMessageBox::Continue;
+}
+
#include "dolphinmainwindow.moc"
|
