X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/87d2df39b5721bed0abeae563eca8f383887be77..9801eddcdc065300a97a3b35dfafe2399a29f729:/src/dolphinmainwindow.cpp diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 5623ba161..cdb3f3cbc 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -19,9 +19,10 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***************************************************************************/ -#include #include "dolphinmainwindow.h" +#include + #include "dolphinapplication.h" #include "dolphinnewmenu.h" #include "dolphinsettings.h" @@ -68,10 +69,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include DolphinMainWindow::DolphinMainWindow(int id) : KXmlGuiWindow(0), @@ -206,38 +207,19 @@ void DolphinMainWindow::rename(const KUrl& oldUrl, const KUrl& newUrl) void DolphinMainWindow::refreshViews() { - const bool split = DolphinSettings::instance().generalSettings()->splitView(); - const bool isPrimaryViewActive = (m_activeView == m_view[PrimaryIdx]); - KUrl url; - for (int i = PrimaryIdx; i <= SecondaryIdx; ++i) { - if (m_view[i] != 0) { - url = m_view[i]->url(); - - // delete view instance... - m_view[i]->close(); - m_view[i]->deleteLater(); - m_view[i] = 0; - } + Q_ASSERT(m_view[PrimaryIdx] != 0); - if (split || (i == PrimaryIdx)) { - // ... and recreate it - ViewProperties props(url); - m_view[i] = new DolphinView(this, - m_splitter, - url, - props.viewMode(), - props.showHiddenFiles()); - connectViewSignals(i); - m_view[i]->reload(); - m_view[i]->show(); - } - } + // remember the current active view, as because of + // the refreshing the active view might change to + // the secondary view + DolphinView* activeView = m_activeView; - m_activeView = isPrimaryViewActive ? m_view[PrimaryIdx] : m_view[SecondaryIdx]; - Q_ASSERT(m_activeView != 0); + m_view[PrimaryIdx]->refresh(); + if (m_view[SecondaryIdx] != 0) { + m_view[SecondaryIdx]->refresh(); + } - updateViewActions(); - emit activeViewChanged(); + setActiveView(activeView); } void DolphinMainWindow::changeUrl(const KUrl& url) @@ -372,6 +354,11 @@ void DolphinMainWindow::slotSelectionChanged(const KFileItemList& selection) emit selectionChanged(selection); } +void DolphinMainWindow::slotRequestItemInfo(const KUrl& url) +{ + emit requestItemInfo(url); +} + void DolphinMainWindow::slotHistoryChanged() { updateHistory(); @@ -471,7 +458,9 @@ void DolphinMainWindow::deleteItems() void DolphinMainWindow::properties() { const KFileItemList list = m_activeView->selectedItems(); - new KPropertiesDialog(list, this); + KPropertiesDialog* dlg = new KPropertiesDialog(list, this); + dlg->exec(); + delete dlg; } void DolphinMainWindow::quit() @@ -755,7 +744,7 @@ void DolphinMainWindow::toggleSplitView() // create a secondary view m_view[SecondaryIdx] = new DolphinView(this, 0, - m_view[PrimaryIdx]->url(), + m_view[PrimaryIdx]->rootUrl(), m_view[PrimaryIdx]->mode(), m_view[PrimaryIdx]->showHiddenFiles()); connectViewSignals(SecondaryIdx); @@ -769,7 +758,6 @@ void DolphinMainWindow::toggleSplitView() m_view[SecondaryIdx]->close(); m_view[SecondaryIdx]->deleteLater(); m_view[SecondaryIdx] = 0; - setActiveView(m_view[PrimaryIdx]); } else { // The secondary view is active, hence from the users point of view // the content of the secondary view should be moved to the primary view. @@ -779,9 +767,9 @@ void DolphinMainWindow::toggleSplitView() delete m_view[PrimaryIdx]; m_view[PrimaryIdx] = m_view[SecondaryIdx]; m_view[SecondaryIdx] = 0; - setActiveView(m_view[PrimaryIdx]); } } + setActiveView(m_view[PrimaryIdx]); emit activeViewChanged(); } @@ -882,7 +870,7 @@ void DolphinMainWindow::goHome() void DolphinMainWindow::findFile() { - KRun::run("kfind", m_activeView->url()); + KRun::run("kfind", m_activeView->url(), this); } void DolphinMainWindow::compareFiles() @@ -936,7 +924,7 @@ void DolphinMainWindow::compareFiles() command.append("\" \""); command.append(urlB.pathOrUrl()); command.append('\"'); - KRun::runCommand(command, "Kompare", "kompare"); + KRun::runCommand(command, "Kompare", "kompare", this); } @@ -1153,7 +1141,7 @@ void DolphinMainWindow::setupActions() connect(sortDescending, SIGNAL(triggered()), this, SLOT(toggleSortOrder())); KToggleAction* sortCategorized = actionCollection()->add("categorized"); - sortCategorized->setText(i18n("Categorized")); + sortCategorized->setText(i18n("Show in Groups")); connect(sortCategorized, SIGNAL(triggered()), this, SLOT(toggleSortCategorization())); KToggleAction* clearInfo = actionCollection()->add("clear_info"); @@ -1267,6 +1255,8 @@ void DolphinMainWindow::setupDockWidgets() infoWidget, SLOT(setUrl(KUrl))); connect(this, SIGNAL(selectionChanged(KFileItemList)), infoWidget, SLOT(setSelection(KFileItemList))); + connect(this, SIGNAL(requestItemInfo(KUrl)), + infoWidget, SLOT(requestDelayedItemInfo(KUrl))); // setup "Tree View" QDockWidget* treeViewDock = new QDockWidget(i18n("Folders")); @@ -1481,6 +1471,8 @@ void DolphinMainWindow::connectViewSignals(int viewIndex) this, SLOT(slotAdditionalInfoChanged(KFileItemDelegate::AdditionalInformation))); connect(view, SIGNAL(selectionChanged(KFileItemList)), this, SLOT(slotSelectionChanged(KFileItemList))); + connect(view, SIGNAL(requestItemInfo(KUrl)), + this, SLOT(slotRequestItemInfo(KUrl))); connect(view, SIGNAL(showFilterBarChanged(bool)), this, SLOT(updateFilterBarAction(bool))); connect(view, SIGNAL(urlChanged(KUrl)),