┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/dolphinmainwindow.cpp97
-rw-r--r--src/dolphinmainwindow.h24
-rw-r--r--src/dolphinrecenttabsmenu.cpp16
-rw-r--r--src/dolphinrecenttabsmenu.h2
-rw-r--r--src/dolphintabbar.cpp174
-rw-r--r--src/dolphintabbar.h65
-rw-r--r--src/dolphinui.rc1
-rw-r--r--src/panels/places/placesitemmodel.cpp10
9 files changed, 315 insertions, 75 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 518c8b7d2..7b0210aef 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -171,6 +171,7 @@ set(dolphin_SRCS
dolphinmainwindow.cpp
dolphinviewcontainer.cpp
dolphincontextmenu.cpp
+ dolphintabbar.cpp
dolphinrecenttabsmenu.cpp
dolphintabpage.cpp
filterbar/filterbar.cpp
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index db4ad0765..d321d3b4a 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -26,6 +26,7 @@
#include "dolphincontextmenu.h"
#include "dolphinnewfilemenu.h"
#include "dolphinrecenttabsmenu.h"
+#include "dolphintabbar.h"
#include "dolphinviewcontainer.h"
#include "dolphintabpage.h"
#include "panels/folders/folderspanel.h"
@@ -75,7 +76,6 @@
#include <KStandardDirs>
#include <kstatusbar.h>
#include <KStandardAction>
-#include <ktabbar.h>
#include <KToggleAction>
#include <KUrlNavigator>
#include <KUrl>
@@ -144,25 +144,19 @@ DolphinMainWindow::DolphinMainWindow() :
connect(this, SIGNAL(urlChanged(KUrl)),
m_remoteEncoding, SLOT(slotAboutToOpenUrl()));
- m_tabBar = new KTabBar(this);
- m_tabBar->setMovable(true);
- m_tabBar->setTabsClosable(true);
+ m_tabBar = new DolphinTabBar(this);
connect(m_tabBar, SIGNAL(currentChanged(int)),
this, SLOT(setActiveTab(int)));
connect(m_tabBar, SIGNAL(tabCloseRequested(int)),
this, SLOT(closeTab(int)));
- connect(m_tabBar, SIGNAL(contextMenu(int,QPoint)),
- this, SLOT(openTabContextMenu(int,QPoint)));
- connect(m_tabBar, SIGNAL(newTabRequest()),
- this, SLOT(openNewTab()));
- connect(m_tabBar, SIGNAL(testCanDecode(const QDragMoveEvent*,bool&)),
- this, SLOT(slotTestCanDecode(const QDragMoveEvent*,bool&)));
- connect(m_tabBar, SIGNAL(mouseMiddleClick(int)),
- this, SLOT(closeTab(int)));
+ connect(m_tabBar, SIGNAL(openNewActivatedTab(int)),
+ this, SLOT(openNewActivatedTab(int)));
connect(m_tabBar, SIGNAL(tabMoved(int,int)),
this, SLOT(slotTabMoved(int,int)));
- connect(m_tabBar, SIGNAL(receivedDropEvent(int,QDropEvent*)),
+ connect(m_tabBar, SIGNAL(tabDropEvent(int,QDropEvent*)),
this, SLOT(tabDropEvent(int,QDropEvent*)));
+ connect(m_tabBar, SIGNAL(tabDetachRequested(int)),
+ this, SLOT(detachTab(int)));
m_tabBar->blockSignals(true); // signals get unblocked after at least 2 tabs are open
m_tabBar->hide();
@@ -443,6 +437,13 @@ void DolphinMainWindow::openNewActivatedTab(const KUrl& primaryUrl, const KUrl&
setActiveTab(m_viewTab.count() - 1);
}
+void DolphinMainWindow::openNewActivatedTab(int index)
+{
+ Q_ASSERT(index >= 0);
+ const DolphinTabPage* tabPage = m_viewTab.at(index);
+ openNewActivatedTab(tabPage->activeViewContainer()->url());
+}
+
void DolphinMainWindow::activateNextTab()
{
if (m_viewTab.count() >= 2) {
@@ -982,50 +983,23 @@ void DolphinMainWindow::closeTab(int index)
}
}
-void DolphinMainWindow::openTabContextMenu(int index, const QPoint& pos)
+void DolphinMainWindow::detachTab(int index)
{
- KMenu menu(this);
-
- QAction* newTabAction = menu.addAction(KIcon("tab-new"), i18nc("@action:inmenu", "New Tab"));
- newTabAction->setShortcut(actionCollection()->action("new_tab")->shortcut());
-
- QAction* detachTabAction = menu.addAction(KIcon("tab-detach"), i18nc("@action:inmenu", "Detach Tab"));
-
- QAction* closeOtherTabsAction = menu.addAction(KIcon("tab-close-other"), i18nc("@action:inmenu", "Close Other Tabs"));
-
- QAction* closeTabAction = menu.addAction(KIcon("tab-close"), i18nc("@action:inmenu", "Close Tab"));
- closeTabAction->setShortcut(actionCollection()->action("close_tab")->shortcut());
- QAction* selectedAction = menu.exec(pos);
- if (selectedAction == newTabAction) {
- const KUrl url = m_viewTab.at(index)->activeViewContainer()->url();
- openNewTab(url);
- m_tabBar->setCurrentIndex(m_viewTab.count() - 1);
- } else if (selectedAction == detachTabAction) {
- const QString separator(QLatin1Char(' '));
- QString command = QLatin1String("dolphin");
+ Q_ASSERT(index >= 0);
- const DolphinTabPage* tabPage = m_viewTab.at(index);
+ const QString separator(QLatin1Char(' '));
+ QString command = QLatin1String("dolphin");
- command += separator + tabPage->primaryViewContainer()->url().url();
- if (tabPage->splitViewEnabled()) {
- command += separator + tabPage->secondaryViewContainer()->url().url();
- command += separator + QLatin1String("-split");
- }
+ const DolphinTabPage* tabPage = m_viewTab.at(index);
+ command += separator + tabPage->primaryViewContainer()->url().url();
+ if (tabPage->splitViewEnabled()) {
+ command += separator + tabPage->secondaryViewContainer()->url().url();
+ command += separator + QLatin1String("-split");
+ }
- KRun::runCommand(command, this);
+ KRun::runCommand(command, this);
- closeTab(index);
- } else if (selectedAction == closeOtherTabsAction) {
- const int count = m_tabBar->count();
- for (int i = 0; i < index; ++i) {
- closeTab(0);
- }
- for (int i = index + 1; i < count; ++i) {
- closeTab(1);
- }
- } else if (selectedAction == closeTabAction) {
- closeTab(index);
- }
+ closeTab(index);
}
void DolphinMainWindow::slotTabMoved(int from, int to)
@@ -1034,11 +1008,6 @@ void DolphinMainWindow::slotTabMoved(int from, int to)
m_tabIndex = m_tabBar->currentIndex();
}
-void DolphinMainWindow::slotTestCanDecode(const QDragMoveEvent* event, bool& canDecode)
-{
- canDecode = KUrl::List::canDecode(event->mimeData());
-}
-
void DolphinMainWindow::handleUrl(const KUrl& url)
{
delete m_lastHandleUrlStatJob;
@@ -1251,6 +1220,11 @@ void DolphinMainWindow::activeViewChanged()
setActiveViewContainer(tabPage->activeViewContainer());
}
+void DolphinMainWindow::closedTabsCountChanged(unsigned int count)
+{
+ actionCollection()->action("undo_close_tab")->setEnabled(count > 0);
+}
+
void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer* viewContainer)
{
Q_ASSERT(viewContainer);
@@ -1381,6 +1355,15 @@ void DolphinMainWindow::setupActions()
recentTabsMenu, SLOT(rememberClosedTab(KUrl,KUrl)));
connect(recentTabsMenu, SIGNAL(restoreClosedTab(KUrl,KUrl)),
this, SLOT(openNewActivatedTab(KUrl,KUrl)));
+ connect(recentTabsMenu, SIGNAL(closedTabsCountChanged(uint)),
+ this, SLOT(closedTabsCountChanged(uint)));
+
+ KAction* undoCloseTab = actionCollection()->addAction("undo_close_tab");
+ undoCloseTab->setText(i18nc("@action:inmenu File", "Undo close tab"));
+ undoCloseTab->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_T);
+ undoCloseTab->setIcon(KIcon("edit-undo"));
+ undoCloseTab->setEnabled(false);
+ connect(undoCloseTab, SIGNAL(triggered()), recentTabsMenu, SLOT(undoCloseTab()));
KAction* forwardAction = KStandardAction::forward(this, SLOT(goForward()), actionCollection());
connect(forwardAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goForward(Qt::MouseButtons)));
diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h
index 7c3bff47f..6f37f42ee 100644
--- a/src/dolphinmainwindow.h
+++ b/src/dolphinmainwindow.h
@@ -38,6 +38,7 @@ typedef KIO::FileUndoManager::CommandType CommandType;
class DolphinViewActionHandler;
class DolphinApplication;
class DolphinSettingsDialog;
+class DolphinTabBar;
class DolphinViewContainer;
class DolphinRemoteEncoding;
class DolphinTabPage;
@@ -46,7 +47,6 @@ class KFileItem;
class KFileItemList;
class KJob;
class KNewFileMenu;
-class KTabBar;
class KUrl;
class QSplitter;
class QToolButton;
@@ -358,6 +358,12 @@ private slots:
*/
void openNewActivatedTab(const KUrl& primaryUrl, const KUrl& secondaryUrl = KUrl());
+ /**
+ * Opens a new tab showing the url from tab at the given \a index and
+ * activates the tab.
+ */
+ void openNewActivatedTab(int index);
+
void activateNextTab();
void activatePrevTab();
@@ -393,10 +399,10 @@ private slots:
void closeTab(int index);
/**
- * Opens a context menu for the tab with the index \a index
- * on the position \a pos.
+ * Opens the tab with the index \a index in a new Dolphin instance and closes
+ * this tab.
*/
- void openTabContextMenu(int index, const QPoint& pos);
+ void detachTab(int index);
/**
* Is connected to the QTabBar signal tabMoved(int from, int to).
@@ -406,12 +412,6 @@ private slots:
void slotTabMoved(int from, int to);
/**
- * Is connected to the KTabBar signal testCanDecode() and adjusts
- * the output parameter \a accept.
- */
- void slotTestCanDecode(const QDragMoveEvent* event, bool& accept);
-
- /**
* If the URL can be listed, open it in the current view, otherwise
* run it through KRun.
*/
@@ -468,6 +468,8 @@ private slots:
void activeViewChanged();
+ void closedTabsCountChanged(unsigned int count);
+
private:
/**
* Activates the given view, which means that
@@ -549,7 +551,7 @@ private:
};
KNewFileMenu* m_newFileMenu;
- KTabBar* m_tabBar;
+ DolphinTabBar* m_tabBar;
DolphinViewContainer* m_activeViewContainer;
QVBoxLayout* m_centralWidgetLayout;
int m_id;
diff --git a/src/dolphinrecenttabsmenu.cpp b/src/dolphinrecenttabsmenu.cpp
index a39f9945b..2335f1bf4 100644
--- a/src/dolphinrecenttabsmenu.cpp
+++ b/src/dolphinrecenttabsmenu.cpp
@@ -60,7 +60,7 @@ void DolphinRecentTabsMenu::rememberClosedTab(const KUrl& primaryUrl, const KUrl
} else {
insertAction(menu()->actions().at(2), action);
}
-
+ emit closedTabsCountChanged(menu()->actions().size() - 2);
// Assure that only up to 6 closed tabs are shown in the menu.
// 8 because of clear action + separator + 6 closed tabs
if (menu()->actions().size() > 8) {
@@ -70,6 +70,12 @@ void DolphinRecentTabsMenu::rememberClosedTab(const KUrl& primaryUrl, const KUrl
KAcceleratorManager::manage(menu());
}
+void DolphinRecentTabsMenu::undoCloseTab()
+{
+ Q_ASSERT(menu()->actions().size() > 2);
+ handleAction(menu()->actions().at(2));
+}
+
void DolphinRecentTabsMenu::handleAction(QAction* action)
{
if (action == m_clearListAction) {
@@ -80,14 +86,16 @@ void DolphinRecentTabsMenu::handleAction(QAction* action)
for (int i = 2; i < count; ++i) {
removeAction(actions.at(i));
}
+ emit closedTabsCountChanged(0);
} else {
const KUrl::List urls = action->data().value<KUrl::List>();
- if (urls.count() == 2) {
- emit restoreClosedTab(urls.first(), urls.last());
- }
removeAction(action);
delete action;
action = 0;
+ if (urls.count() == 2) {
+ emit restoreClosedTab(urls.first(), urls.last());
+ }
+ emit closedTabsCountChanged(menu()->actions().size() - 2);
}
if (menu()->actions().count() <= 2) {
diff --git a/src/dolphinrecenttabsmenu.h b/src/dolphinrecenttabsmenu.h
index 34d41530b..b5acc735e 100644
--- a/src/dolphinrecenttabsmenu.h
+++ b/src/dolphinrecenttabsmenu.h
@@ -35,9 +35,11 @@ public:
public slots:
void rememberClosedTab(const KUrl& primaryUrl, const KUrl& secondaryUrl);
+ void undoCloseTab();
signals:
void restoreClosedTab(const KUrl& primaryUrl, const KUrl& secondaryUrl);
+ void closedTabsCountChanged(unsigned int count);
private slots:
void handleAction(QAction* action);
diff --git a/src/dolphintabbar.cpp b/src/dolphintabbar.cpp
new file mode 100644
index 000000000..78bd5edcb
--- /dev/null
+++ b/src/dolphintabbar.cpp
@@ -0,0 +1,174 @@
+/***************************************************************************
+ * Copyright (C) 2014 by Emmanuel Pescosta <[email protected]> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include "dolphintabbar.h"
+
+#include <QTimer>
+#include <QDragEnterEvent>
+#include <KLocalizedString>
+#include <KMenu>
+#include <KIcon>
+#include <KUrl>
+
+DolphinTabBar::DolphinTabBar(QWidget* parent) :
+ QTabBar(parent),
+ m_autoActivationIndex(-1)
+{
+ setAcceptDrops(true);
+ setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
+ setMovable(true);
+ setTabsClosable(true);
+
+ m_autoActivationTimer = new QTimer(this);
+ m_autoActivationTimer->setSingleShot(true);
+ m_autoActivationTimer->setInterval(800);
+ connect(m_autoActivationTimer, SIGNAL(timeout()),
+ this, SLOT(slotAutoActivationTimeout()));
+}
+
+void DolphinTabBar::dragEnterEvent(QDragEnterEvent* event)
+{
+ const QMimeData* mimeData = event->mimeData();
+ const int index = tabAt(event->pos());
+
+ if (KUrl::List::canDecode(mimeData)) {
+ event->acceptProposedAction();
+ updateAutoActivationTimer(index);
+ }
+
+ QTabBar::dragEnterEvent(event);
+}
+
+void DolphinTabBar::dragLeaveEvent(QDragLeaveEvent* event)
+{
+ updateAutoActivationTimer(-1);
+
+ QTabBar::dragLeaveEvent(event);
+}
+
+void DolphinTabBar::dragMoveEvent(QDragMoveEvent* event)
+{
+ const QMimeData* mimeData = event->mimeData();
+ const int index = tabAt(event->pos());
+
+ if (KUrl::List::canDecode(mimeData)) {
+ updateAutoActivationTimer(index);
+ }
+
+ QTabBar::dragMoveEvent(event);
+}
+
+void DolphinTabBar::dropEvent(QDropEvent* event)
+{
+ // Disable the auto activation timer
+ updateAutoActivationTimer(-1);
+
+ const QMimeData* mimeData = event->mimeData();
+ const int index = tabAt(event->pos());
+
+ if (index >= 0 && KUrl::List::canDecode(mimeData)) {
+ emit tabDropEvent(index, event);
+ }
+
+ QTabBar::dropEvent(event);
+}
+
+void DolphinTabBar::mousePressEvent(QMouseEvent* event)
+{
+ const int index = tabAt(event->pos());
+
+ if (index >= 0 && event->button() == Qt::MiddleButton) {
+ // Mouse middle click on a tab closes this tab.
+ emit tabCloseRequested(index);
+ return;
+ }
+
+ QTabBar::mousePressEvent(event);
+}
+
+void DolphinTabBar::mouseDoubleClickEvent(QMouseEvent* event)
+{
+ const int index = tabAt(event->pos());
+
+ if (index < 0) {
+ // Double click on the empty tabbar area opens a new activated tab
+ // with the url from the current tab.
+ emit openNewActivatedTab(currentIndex());
+ return;
+ }
+
+ QTabBar::mouseDoubleClickEvent(event);
+}
+
+void DolphinTabBar::contextMenuEvent(QContextMenuEvent* event)
+{
+ const int index = tabAt(event->pos());
+
+ if (index >= 0) {
+ // Tab context menu
+ KMenu menu(this);
+
+ QAction* newTabAction = menu.addAction(KIcon("tab-new"), i18nc("@action:inmenu", "New Tab"));
+ QAction* detachTabAction = menu.addAction(KIcon("tab-detach"), i18nc("@action:inmenu", "Detach Tab"));
+ QAction* closeOtherTabsAction = menu.addAction(KIcon("tab-close-other"), i18nc("@action:inmenu", "Close Other Tabs"));
+ QAction* closeTabAction = menu.addAction(KIcon("tab-close"), i18nc("@action:inmenu", "Close Tab"));
+
+ QAction* selectedAction = menu.exec(event->globalPos());
+ if (selectedAction == newTabAction) {
+ emit openNewActivatedTab(index);
+ } else if (selectedAction == detachTabAction) {
+ emit tabDetachRequested(index);
+ } else if (selectedAction == closeOtherTabsAction) {
+ const int tabCount = count();
+ for (int i = 0; i < index; i++) {
+ emit tabCloseRequested(0);
+ }
+ for (int i = index + 1; i < tabCount; i++) {
+ emit tabCloseRequested(1);
+ }
+ } else if (selectedAction == closeTabAction) {
+ emit tabCloseRequested(index);
+ }
+
+ return;
+ }
+
+ QTabBar::contextMenuEvent(event);
+}
+
+void DolphinTabBar::slotAutoActivationTimeout()
+{
+ if (m_autoActivationIndex >= 0) {
+ setCurrentIndex(m_autoActivationIndex);
+ updateAutoActivationTimer(-1);
+ }
+}
+
+void DolphinTabBar::updateAutoActivationTimer(const int index)
+{
+ if (m_autoActivationIndex != index) {
+ m_autoActivationIndex = index;
+
+ if (m_autoActivationIndex < 0) {
+ m_autoActivationTimer->stop();
+ } else {
+ m_autoActivationTimer->start();
+ }
+ }
+}
diff --git a/src/dolphintabbar.h b/src/dolphintabbar.h
new file mode 100644
index 000000000..d2b2e9e57
--- /dev/null
+++ b/src/dolphintabbar.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+ * Copyright (C) 2014 by Emmanuel Pescosta <[email protected]> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef DOLPHIN_TAB_BAR_H
+#define DOLPHIN_TAB_BAR_H
+
+#include <QTabBar>
+
+class DolphinTabBar : public QTabBar
+{
+ Q_OBJECT
+
+public:
+ explicit DolphinTabBar(QWidget* parent);
+
+signals:
+ void openNewActivatedTab(int index);
+ void tabDropEvent(int index, QDropEvent* event);
+ void tabDetachRequested(int index);
+
+protected:
+ virtual void dragEnterEvent(QDragEnterEvent* event);
+ virtual void dragLeaveEvent(QDragLeaveEvent* event);
+ virtual void dragMoveEvent(QDragMoveEvent* event);
+ virtual void dropEvent(QDropEvent* event);
+ virtual void mousePressEvent(QMouseEvent* event);
+ virtual void mouseDoubleClickEvent(QMouseEvent* event);
+
+ /**
+ * Opens a context menu for the tab on the \a event position.
+ */
+ virtual void contextMenuEvent(QContextMenuEvent* event);
+
+private slots:
+ void slotAutoActivationTimeout();
+
+private:
+ /**
+ * If \a index is a valid index (>= 0), store the index and start the timer
+ * (if the interval >= 0 ms). If the index is not valid (< 0), stop the timer.
+ */
+ void updateAutoActivationTimer(const int index);
+
+private:
+ QTimer* m_autoActivationTimer;
+ int m_autoActivationIndex;
+};
+
+#endif // DOLPHIN_TAB_BAR_H
diff --git a/src/dolphinui.rc b/src/dolphinui.rc
index 52826bb43..f197af402 100644
--- a/src/dolphinui.rc
+++ b/src/dolphinui.rc
@@ -6,6 +6,7 @@
<Action name="new_window" />
<Action name="new_tab" />
<Action name="close_tab" />
+ <Action name="undo_close_tab" />
<Separator/>
<Action name="rename" />
<Action name="move_to_trash" />
diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp
index 1f05e07f9..dc2b95c36 100644
--- a/src/panels/places/placesitemmodel.cpp
+++ b/src/panels/places/placesitemmodel.cpp
@@ -313,7 +313,8 @@ void PlacesItemModel::requestEject(int index)
Solid::OpticalDrive* drive = item->device().parent().as<Solid::OpticalDrive>();
if (drive) {
connect(drive, SIGNAL(ejectDone(Solid::ErrorType,QVariant,QString)),
- this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant)));
+ this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant)),
+ Qt::UniqueConnection);
drive->eject();
} else {
const QString label = item->text();
@@ -330,7 +331,8 @@ void PlacesItemModel::requestTeardown(int index)
Solid::StorageAccess* access = item->device().as<Solid::StorageAccess>();
if (access) {
connect(access, SIGNAL(teardownDone(Solid::ErrorType,QVariant,QString)),
- this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant)));
+ this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant)),
+ Qt::UniqueConnection);
access->teardown();
}
}
@@ -359,7 +361,8 @@ void PlacesItemModel::requestStorageSetup(int index)
m_storageSetupInProgress[access] = index;
connect(access, SIGNAL(setupDone(Solid::ErrorType,QVariant,QString)),
- this, SLOT(slotStorageSetupDone(Solid::ErrorType,QVariant,QString)));
+ this, SLOT(slotStorageSetupDone(Solid::ErrorType,QVariant,QString)),
+ Qt::UniqueConnection);
access->setup();
}
@@ -598,6 +601,7 @@ void PlacesItemModel::slotStorageSetupDone(Solid::ErrorType error,
{
Q_UNUSED(udi);
+ Q_ASSERT(!m_storageSetupInProgress.isEmpty());
const int index = m_storageSetupInProgress.take(sender());
const PlacesItem* item = placesItem(index);
if (!item) {