┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinmainwindow.cpp
diff options
context:
space:
mode:
authorDavid Faure <[email protected]>2008-04-20 22:07:44 +0000
committerDavid Faure <[email protected]>2008-04-20 22:07:44 +0000
commitd1aaeab617d4e0372e5e93b6865d3b63ceb1d596 (patch)
tree8f0b67b77eb4d59df40e570d9cea8402fa2cf29b /src/dolphinmainwindow.cpp
parente8b4072c34eee268c6592bc1e5c3d29dcb25a953 (diff)
Fix bug with the UndoUiInterface usage: if more than one mainwindow was used, the statusbar of the wrong window could be used for displaying error messages from the undo manager.
svn path=/trunk/KDE/kdebase/apps/; revision=799250
Diffstat (limited to 'src/dolphinmainwindow.cpp')
-rw-r--r--src/dolphinmainwindow.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 4b648e988..f551232a7 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -102,10 +102,8 @@ DolphinMainWindow::DolphinMainWindow(int id) :
new MainWindowAdaptor(this);
QDBusConnection::sessionBus().registerObject(QString("/dolphin/MainWindow%1").arg(m_id), this);
- KonqFileUndoManager::incRef();
-
KonqFileUndoManager* undoManager = KonqFileUndoManager::self();
- undoManager->setUiInterface(new UndoUiInterface(this));
+ undoManager->setUiInterface(new UndoUiInterface());
connect(undoManager, SIGNAL(undoAvailable(bool)),
this, SLOT(slotUndoAvailable(bool)));
@@ -117,7 +115,6 @@ DolphinMainWindow::DolphinMainWindow(int id) :
DolphinMainWindow::~DolphinMainWindow()
{
- KonqFileUndoManager::decRef();
DolphinApplication::app()->removeMainWindow(this);
}
@@ -437,6 +434,7 @@ void DolphinMainWindow::slotUndoTextChanged(const QString& text)
void DolphinMainWindow::undo()
{
clearStatusBar();
+ KonqFileUndoManager::self()->uiInterface()->setParentWidget(this);
KonqFileUndoManager::self()->undo();
}
@@ -1188,11 +1186,9 @@ QString DolphinMainWindow::tabName(const KUrl& url) const
return url.equals(KUrl("file:///")) ? "/" : url.fileName();
}
-DolphinMainWindow::UndoUiInterface::UndoUiInterface(DolphinMainWindow* mainWin) :
- KonqFileUndoManager::UiInterface(mainWin),
- m_mainWin(mainWin)
+DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
+ KonqFileUndoManager::UiInterface()
{
- Q_ASSERT(m_mainWin != 0);
}
DolphinMainWindow::UndoUiInterface::~UndoUiInterface()
@@ -1201,8 +1197,13 @@ DolphinMainWindow::UndoUiInterface::~UndoUiInterface()
void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job* job)
{
- DolphinStatusBar* statusBar = m_mainWin->activeViewContainer()->statusBar();
- statusBar->setMessage(job->errorString(), DolphinStatusBar::Error);
+ DolphinMainWindow* mainWin= qobject_cast<DolphinMainWindow *>(parentWidget());
+ if (mainWin) {
+ DolphinStatusBar* statusBar = mainWin->activeViewContainer()->statusBar();
+ statusBar->setMessage(job->errorString(), DolphinStatusBar::Error);
+ } else {
+ KonqFileUndoManager::UiInterface::jobError(job);
+ }
}
#include "dolphinmainwindow.moc"