#include "panels/folders/folderspanel.h"
#include "panels/places/placespanel.h"
#include "panels/information/informationpanel.h"
+#include "search/dolphinsearchbox.h"
#include "search/dolphinsearchinformation.h"
#include "settings/dolphinsettings.h"
#include "settings/dolphinsettingsdialog.h"
}
}
-void DolphinMainWindow::refreshViews()
-{
- Q_ASSERT(m_viewTab[m_tabIndex].primaryView);
-
- // remember the current active view, as because of
- // the refreshing the active view might change to
- // the secondary view
- DolphinViewContainer* activeViewContainer = m_activeViewContainer;
-
- const int tabCount = m_viewTab.count();
- for (int i = 0; i < tabCount; ++i) {
- m_viewTab[i].primaryView->refresh();
- if (m_viewTab[i].secondaryView) {
- m_viewTab[i].secondaryView->refresh();
- }
- }
-
- setActiveViewContainer(activeViewContainer);
-
- const GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings();
- if (generalSettings->modifiedStartupSettings()) {
- // The startup settings have been changed by the user (see bug #254947).
- // Synchronize the split-view setting with the active view:
- const bool splitView = generalSettings->splitView();
- const ViewTab& activeTab = m_viewTab[m_tabIndex];
- const bool toggle = ( splitView && !activeTab.secondaryView)
- || (!splitView && activeTab.secondaryView);
- if (toggle) {
- toggleSplitView();
- }
- }
-}
-
void DolphinMainWindow::pasteIntoFolder()
{
m_activeViewContainer->view()->pasteIntoFolder();
m_activeViewContainer->setSearchModeEnabled(true);
}
+void DolphinMainWindow::slotSearchLocationChanged()
+{
+#ifdef HAVE_NEPOMUK
+ QDockWidget* searchDock = findChild<QDockWidget*>("searchDock");
+ if (!searchDock) {
+ return;
+ }
+
+ SearchPanel* searchPanel = qobject_cast<SearchPanel*>(searchDock->widget());
+ if (searchPanel) {
+ searchPanel->setSearchLocation(SearchSettings::location() == QLatin1String("FromHere")
+ ? SearchPanel::FromCurrentDir
+ : SearchPanel::Everywhere);
+ }
+#endif
+}
+
void DolphinMainWindow::updatePasteAction()
{
QAction* pasteAction = actionCollection()->action(KStandardAction::name(KStandardAction::Paste));
if (!m_settingsDialog) {
const KUrl url = activeViewContainer()->url();
DolphinSettingsDialog* settingsDialog = new DolphinSettingsDialog(url, this);
- connect(settingsDialog, SIGNAL(settingsChanged()), this, SLOT(reloadView()));
+ connect(settingsDialog, SIGNAL(settingsChanged()), this, SLOT(refreshViews()));
settingsDialog->setAttribute(Qt::WA_DeleteOnClose);
settingsDialog->show();
m_settingsDialog = settingsDialog;
void DolphinMainWindow::slotSearchModeChanged(bool enabled)
{
#ifdef HAVE_NEPOMUK
- const KUrl url = m_activeViewContainer->url();
const DolphinSearchInformation& searchInfo = DolphinSearchInformation::instance();
- if (!searchInfo.isIndexingEnabled() || !searchInfo.isPathIndexed(url)) {
+ if (!searchInfo.isIndexingEnabled()) {
return;
}
}
SearchPanel* searchPanel = qobject_cast<SearchPanel*>(searchDock->widget());
- if (searchPanel) {
- // Per default any search-operation triggered by the Search Panel is done
- // "Everywhere".
- SearchPanel::SearchMode searchMode = SearchPanel::Everywhere;
-
- if (enabled && (SearchSettings::location() == QLatin1String("FromHere"))) {
- // Only if the search-mode is enabled it is visible for the user whether
- // a searching is done "Everywhere" or "From Here" (= current directory).
- searchMode = SearchPanel::FromCurrentDir;
+ if (!searchPanel) {
+ return;
+ }
+
+ if (enabled) {
+ SearchPanel::SearchLocation searchLocation = SearchPanel::Everywhere;
+ const KUrl url = m_activeViewContainer->url();
+ const bool isSearchUrl = (url.protocol() == QLatin1String("nepomuksearch"));
+ if ((SearchSettings::location() == QLatin1String("FromHere") && !isSearchUrl)) {
+ searchLocation = SearchPanel::FromCurrentDir;
}
- searchPanel->setSearchMode(searchMode);
+ searchPanel->setSearchLocation(searchLocation);
+ } else {
+ searchPanel->setSearchLocation(SearchPanel::Everywhere);
}
#else
Q_UNUSED(enabled);
connect(menu, SIGNAL(aboutToHide()), helpMenu, SLOT(deleteLater()));
helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::HelpContents)));
helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::WhatsThis)));
+ helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::ReportBug)));
+ helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::SwitchApplicationLanguage)));
helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::AboutApp)));
helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::AboutKDE)));
menu->addMenu(helpMenu);
terminalDock->setWidget(terminalPanel);
connect(terminalPanel, SIGNAL(hideTerminalPanel()), terminalDock, SLOT(hide()));
+ connect(terminalDock, SIGNAL(visibilityChanged(bool)),
+ terminalPanel, SLOT(dockVisibilityChanged()));
QAction* terminalAction = terminalDock->toggleViewAction();
terminalAction->setShortcut(Qt::Key_F4);
KAcceleratorManager::manage(tabsMenu);
}
+void DolphinMainWindow::refreshViews()
+{
+ Q_ASSERT(m_viewTab[m_tabIndex].primaryView);
+
+ // remember the current active view, as because of
+ // the refreshing the active view might change to
+ // the secondary view
+ DolphinViewContainer* activeViewContainer = m_activeViewContainer;
+
+ const int tabCount = m_viewTab.count();
+ for (int i = 0; i < tabCount; ++i) {
+ m_viewTab[i].primaryView->refresh();
+ if (m_viewTab[i].secondaryView) {
+ m_viewTab[i].secondaryView->refresh();
+ }
+ }
+
+ setActiveViewContainer(activeViewContainer);
+
+ const GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings();
+ if (generalSettings->modifiedStartupSettings()) {
+ // The startup settings have been changed by the user (see bug #254947).
+ // Synchronize the split-view setting with the active view:
+ const bool splitView = generalSettings->splitView();
+ const ViewTab& activeTab = m_viewTab[m_tabIndex];
+ const bool toggle = ( splitView && !activeTab.secondaryView)
+ || (!splitView && activeTab.secondaryView);
+ if (toggle) {
+ toggleSplitView();
+ }
+ }
+}
+
void DolphinMainWindow::clearStatusBar()
{
m_activeViewContainer->statusBar()->clear();
connect(container, SIGNAL(searchModeChanged(bool)),
this, SLOT(slotSearchModeChanged(bool)));
+ const DolphinSearchBox* searchBox = container->searchBox();
+ connect(searchBox, SIGNAL(searchLocationChanged(SearchLocation)),
+ this, SLOT(slotSearchLocationChanged()));
+
DolphinView* view = container->view();
connect(view, SIGNAL(selectionChanged(KFileItemList)),
this, SLOT(slotSelectionChanged(KFileItemList)));
// Assure that the menu is not shown outside the screen boundaries and
// that it does not overlap with the parent button.
const QRect screen = QApplication::desktop()->screenGeometry(QCursor::pos());
- if (pos.x() < 0) {
- pos.rx() = 0;
- } else if (pos.x() + width() >= screen.width()) {
- pos.rx() = screen.width() - width();
+ if (pos.x() < screen.x()) {
+ pos.rx() = screen.x();
+ } else if (pos.x() + width() > screen.x() + screen.width()) {
+ pos.rx() = screen.x() + screen.width() - width();
}
- if (pos.y() < 0) {
- pos.ry() = 0;
- } else if (pos.y() + height() >= screen.height()) {
+ if (pos.y() < screen.y()) {
+ pos.ry() = screen.y();
+ } else if (pos.y() + height() > screen.y() + screen.height()) {
pos.ry() = button->mapToGlobal(QPoint(0, 0)).y() - height();
}