]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
Make the code that removes items from KFileItemModel more robust
[dolphin.git] / src / dolphinmainwindow.cpp
index 5cc608fd490e4d547cb613665977f2ba68f5f4ab..4128cdffad89d2ed80922077954cd6a30d49cd9e 100644 (file)
@@ -35,6 +35,7 @@
 #include "views/dolphinremoteencoding.h"
 #include "views/draganddrophelper.h"
 #include "views/viewproperties.h"
+#include "views/dolphinnewfilemenuobserver.h"
 
 #ifndef Q_OS_WIN
 #include "panels/terminal/terminalpanel.h"
@@ -126,6 +127,9 @@ DolphinMainWindow::DolphinMainWindow() :
     ViewTab& viewTab = m_viewTab[m_tabIndex];
     viewTab.wasActive = true; // The first opened tab is automatically active
 
+    connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(errorMessage(QString)),
+            this, SLOT(showErrorMessage(QString)));
+
     KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self();
     undoManager->setUiInterface(new UndoUiInterface());
 
@@ -1297,8 +1301,6 @@ void DolphinMainWindow::openContextMenu(const QPoint& pos,
 {
     QWeakPointer<DolphinContextMenu> contextMenu = new DolphinContextMenu(this, pos, item, url);
     contextMenu.data()->setCustomActions(customActions);
-    connect(contextMenu.data(), SIGNAL(errorMessage(QString)),
-            this, SLOT(showErrorMessage(QString)));
     const DolphinContextMenu::Command command = contextMenu.data()->open();
 
     switch (command) {
@@ -1491,8 +1493,6 @@ void DolphinMainWindow::setupActions()
     m_newFileMenu->setDelayed(false);
     connect(menu, SIGNAL(aboutToShow()),
             this, SLOT(updateNewMenu()));
-    connect(m_newFileMenu, SIGNAL(errorMessage(QString)),
-            this, SLOT(showErrorMessage(QString)));
 
     KAction* newWindow = actionCollection()->addAction("new_window");
     newWindow->setIcon(KIcon("window-new"));