#include "dolphinremoteencoding.h"
#include <config-nepomuk.h>
+#ifdef HAVE_NEPOMUK
+#include "search/dolphinsearchoptionsconfigurator.h"
+#endif
#include "dolphinapplication.h"
#include "dolphinnewmenu.h"
m_activeViewContainer(0),
m_centralWidgetLayout(0),
m_searchBox(0),
+#ifdef HAVE_NEPOMUK
m_searchOptionsConfigurator(0),
+#endif
m_id(id),
m_tabIndex(0),
m_viewTab(),
void DolphinMainWindow::updateNewMenu()
{
+ m_newMenu->setViewShowsHiddenFiles(activeViewContainer()->view()->showHiddenFiles());
m_newMenu->slotCheckUpToDate();
m_newMenu->setPopupFiles(activeViewContainer()->url());
}
void DolphinMainWindow::createDirectory()
{
+ m_newMenu->setViewShowsHiddenFiles(activeViewContainer()->view()->showHiddenFiles());
m_newMenu->setPopupFiles(activeViewContainer()->url());
m_newMenu->createDirectory();
}
m_activeViewContainer->urlNavigator()->goUp();
}
+void DolphinMainWindow::goBack(Qt::MouseButtons buttons)
+{
+ // The default case (left button pressed) is handled in goBack().
+ if (buttons == Qt::MidButton) {
+ KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
+ openNewTab(urlNavigator->historyUrl(urlNavigator->historyIndex() + 1));
+ }
+}
+
+void DolphinMainWindow::goForward(Qt::MouseButtons buttons)
+{
+ // The default case (left button pressed) is handled in goForward().
+ if (buttons == Qt::MidButton) {
+ KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
+ openNewTab(urlNavigator->historyUrl(urlNavigator->historyIndex() - 1));
+ }
+}
+
+void DolphinMainWindow::goUp(Qt::MouseButtons buttons)
+{
+ // The default case (left button pressed) is handled in goUp().
+ if (buttons == Qt::MidButton) {
+ openNewTab(activeViewContainer()->url().upUrl());
+ }
+}
+
void DolphinMainWindow::goHome()
{
clearStatusBar();
canDecode = KUrl::List::canDecode(event->mimeData());
}
-void DolphinMainWindow::searchItems(const KUrl& url)
+void DolphinMainWindow::searchItems()
{
- m_activeViewContainer->setUrl(url);
+#ifdef HAVE_NEPOMUK
+ const KUrl nepomukSearchUrl = m_searchOptionsConfigurator->nepomukSearchUrl();
+ m_activeViewContainer->setUrl(nepomukSearchUrl);
+#endif
}
void DolphinMainWindow::slotTabMoved(int from, int to)
m_tabIndex = m_tabBar->currentIndex();
}
-void DolphinMainWindow::slotSearchBoxTextChanged(const QString& text)
+void DolphinMainWindow::showSearchOptions()
{
- m_searchOptionsConfigurator->setVisible(!text.isEmpty());
+#ifdef HAVE_NEPOMUK
+ m_searchOptionsConfigurator->show();
+#endif
}
void DolphinMainWindow::init()
connect(this, SIGNAL(urlChanged(const KUrl&)),
m_remoteEncoding, SLOT(slotAboutToOpenUrl()));
+#ifdef HAVE_NEPOMUK
m_searchOptionsConfigurator = new DolphinSearchOptionsConfigurator(this);
m_searchOptionsConfigurator->hide();
+ connect(m_searchOptionsConfigurator, SIGNAL(searchOptionsChanged()),
+ this, SLOT(searchItems()));
+ connect(this, SIGNAL(urlChanged(KUrl)), m_searchOptionsConfigurator, SLOT(setDirectory(KUrl)));
+#endif
m_tabBar = new KTabBar(this);
m_tabBar->setMovable(true);
m_centralWidgetLayout = new QVBoxLayout(centralWidget);
m_centralWidgetLayout->setSpacing(0);
m_centralWidgetLayout->setMargin(0);
+#ifdef HAVE_NEPOMUK
m_centralWidgetLayout->addWidget(m_searchOptionsConfigurator);
+#endif
m_centralWidgetLayout->addWidget(m_tabBar);
m_centralWidgetLayout->addWidget(m_viewTab[m_tabIndex].splitter, 1);
m_searchBox->setParent(toolBar("searchToolBar"));
m_searchBox->show();
- connect(m_searchBox, SIGNAL(textChanged(const QString&)),
- this, SLOT(slotSearchBoxTextChanged(const QString&)));
+ connect(m_searchBox, SIGNAL(requestSearchOptions()),
+ this, SLOT(showSearchOptions()));
+#ifdef HAVE_NEPOMUK
+ connect(m_searchBox, SIGNAL(searchTextChanged(QString)),
+ m_searchOptionsConfigurator, SLOT(setCustomSearchQuery(QString)));
+#endif
stateChanged("new_file");
// setup 'Go' menu
KAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection());
+ connect(backAction, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(goBack(Qt::MouseButtons)));
KShortcut backShortcut = backAction->shortcut();
backShortcut.setAlternate(Qt::Key_Backspace);
backAction->setShortcut(backShortcut);
m_recentTabsMenu->addSeparator();
m_recentTabsMenu->setEnabled(false);
- KStandardAction::forward(this, SLOT(goForward()), actionCollection());
- KStandardAction::up(this, SLOT(goUp()), actionCollection());
+ KAction* forwardAction = KStandardAction::forward(this, SLOT(goForward()), actionCollection());
+ connect(forwardAction, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(goForward(Qt::MouseButtons)));
+
+ KAction* upAction = KStandardAction::up(this, SLOT(goUp()), actionCollection());
+ connect(upAction, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(goUp(Qt::MouseButtons)));
+
KStandardAction::home(this, SLOT(goHome()), actionCollection());
// setup 'Tools' menu
// 'Search' toolbar
m_searchBox = new DolphinSearchBox(this);
- connect(m_searchBox, SIGNAL(search(KUrl)), this, SLOT(searchItems(KUrl)));
+ connect(m_searchBox, SIGNAL(search(QString)), this, SLOT(searchItems()));
KAction* search = new KAction(this);
actionCollection()->addAction("search_bar", search);
infoDock->setObjectName("infoDock");
infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
Panel* infoPanel = new InformationPanel(infoDock);
+ connect(infoPanel, SIGNAL(urlActivated(KUrl)), this, SLOT(handleUrl(KUrl)));
infoDock->setWidget(infoPanel);
QAction* infoAction = infoDock->toggleViewAction();
caption = url.protocol();
}
}
-
+
setCaption(caption);
}
+void DolphinMainWindow::handleUrl(const KUrl& url)
+{
+ if (KProtocolManager::supportsListing(url)) {
+ activeViewContainer()->setUrl(url);
+ }
+ else {
+ new KRun(url, this);
+ }
+}
+
QString DolphinMainWindow::squeezedText(const QString& text) const
{
const QFontMetrics fm = fontMetrics();