X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/6dddb2e81c6b7f3cfc2a7e9d26fab407f7bc85e6..862ceee323ad3b474ce9de11eefbddd99c528fac:/src/dolphinviewcontainer.cpp diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index a2a899bea..f70c5bb45 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -83,14 +83,15 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow, m_topLayout->setSpacing(0); m_topLayout->setMargin(0); - connect(m_mainWindow, SIGNAL(activeViewChanged()), - this, SLOT(updateActivationState())); - QClipboard* clipboard = QApplication::clipboard(); connect(clipboard, SIGNAL(dataChanged()), this, SLOT(updateCutItems())); m_urlNavigator = new KUrlNavigator(DolphinSettings::instance().placesModel(), url, this); + connect(m_urlNavigator, SIGNAL(urlsDropped(const KUrl::List&, const KUrl&)), + m_mainWindow, SLOT(dropUrls(const KUrl::List&, const KUrl&))); + connect(m_urlNavigator, SIGNAL(activated()), + this, SLOT(activate())); const GeneralSettings* settings = DolphinSettings::instance().generalSettings(); m_urlNavigator->setUrlEditable(settings->editableUrl()); @@ -117,10 +118,6 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow, this, SLOT(updateStatusBar())); connect(m_dirLister, SIGNAL(completed()), this, SLOT(updateItemCount())); - connect(m_dirLister, SIGNAL(completed()), - this, SLOT(updateCutItems())); - connect(m_dirLister, SIGNAL(newItems(const KFileItemList&)), - this, SLOT(generatePreviews(const KFileItemList&))); connect(m_dirLister, SIGNAL(infoMessage(const QString&)), this, SLOT(showInfoMessage(const QString&))); connect(m_dirLister, SIGNAL(errorMessage(const QString&)), @@ -138,6 +135,8 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow, this, SLOT(openContextMenu(KFileItem*, const KUrl&))); connect(m_view, SIGNAL(urlsDropped(const KUrl::List&, const KUrl&)), m_mainWindow, SLOT(dropUrls(const KUrl::List&, const KUrl&))); + connect(m_view, SIGNAL(contentsMoved(int, int)), + this, SLOT(saveContentsPos(int, int))); connect(m_view, SIGNAL(requestItemInfo(const KUrl&)), this, SLOT(showItemInfo(const KUrl&))); connect(m_view, SIGNAL(errorMessage(const QString&)), @@ -334,7 +333,7 @@ void DolphinViewContainer::updateItemCount() updateStatusBar(); - QTimer::singleShot(0, this, SLOT(restoreContentsPos())); + QTimer::singleShot(100, this, SLOT(restoreContentsPos())); } void DolphinViewContainer::showItemInfo(const KUrl& url) @@ -477,4 +476,22 @@ void DolphinViewContainer::openContextMenu(KFileItem* item, contextMenu.open(); } +void DolphinViewContainer::saveContentsPos(int x, int y) +{ + m_urlNavigator->savePosition(x, y); +} + +void DolphinViewContainer::restoreContentsPos() +{ + if (!url().isEmpty()) { + const QPoint pos = m_urlNavigator->savedPosition(); + m_view->setContentsPosition(pos.x(), pos.y()); + } +} + +void DolphinViewContainer::activate() +{ + setActive(true); +} + #include "dolphinviewcontainer.moc"