#include "dolphinmainwindow.h"
-#include <config-nepomuk.h>
-
#include "dolphinapplication.h"
#include "dolphindockwidget.h"
#include "dolphincontextmenu.h"
#include "dolphinnewfilemenu.h"
#include "dolphinviewcontainer.h"
-#ifdef HAVE_NEPOMUK
- #include "panels/search/searchpanel.h"
- #include <Nepomuk/ResourceManager>
-#endif
#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/dolphinsettingsdialog.h"
#include "statusbar/dolphinstatusbar.h"
#include "views/dolphinviewactionhandler.h"
#endif
#include "dolphin_generalsettings.h"
-#include "dolphin_searchsettings.h"
#include <KAcceleratorManager>
#include <KAction>
#include <kdeversion.h>
#include <kdualaction.h>
#include <KFileDialog>
-#include <KFilePlacesModel>
#include <KGlobal>
#include <KLineEdit>
#include <KToolBar>
#include <KIcon>
#include <KIconLoader>
#include <KIO/NetAccess>
+#include <KIO/JobUiDelegate>
#include <KInputDialog>
#include <KLocale>
#include <KProtocolManager>
#include <KUrlComboBox>
#include <KToolInvocation>
-#include "views/dolphinplacesmodel.h"
-
#include <QDesktopWidget>
#include <QDBusMessage>
#include <QKeyEvent>
const int CurrentDolphinVersion = 200;
};
-/*
- * Menu shown when pressing the configure-button in the toolbar.
- */
-class ToolBarMenu : public KMenu
-{
-public:
- ToolBarMenu(QWidget* parent);
- virtual ~ToolBarMenu();
-protected:
- virtual void showEvent(QShowEvent* event);
-};
-
/*
* Remembers the tab configuration if a tab has been closed.
* Each closed tab can be restored by the menu
m_actionHandler(0),
m_remoteEncoding(0),
m_settingsDialog(),
- m_toolBarSpacer(0),
- m_openToolBarMenuButton(0),
+ m_controlButton(0),
m_updateToolBarTimer(0),
- m_lastHandleUrlStatJob(0),
- m_searchDockIsTemporaryVisible(false)
+ m_lastHandleUrlStatJob(0)
{
- DolphinPlacesModel::setModel(new KFilePlacesModel(this));
- connect(DolphinPlacesModel::instance(), SIGNAL(errorMessage(QString)),
- this, SLOT(showErrorMessage(QString)));
-
- // Workaround for a X11-issue in combination with KModifierInfo
- // (see DolphinContextMenu::initializeModifierKeyInfo() for
- // more information):
- DolphinContextMenu::initializeModifierKeyInfo();
-
setObjectName("Dolphin#");
m_viewTab.append(ViewTab());
QAction* showMenuBarAction = actionCollection()->action(KStandardAction::name(KStandardAction::ShowMenubar));
showMenuBarAction->setChecked(showMenu); // workaround for bug #171080
if (!showMenu) {
- createToolBarMenuButton();
+ createControlButton();
}
}
DolphinStatusBar* statusBar = m_activeViewContainer->statusBar();
switch (command) {
case KIO::FileUndoManager::Copy:
- statusBar->setMessage(i18nc("@info:status", "Successfully copied."),
- DolphinStatusBar::OperationCompleted);
+ statusBar->setText(i18nc("@info:status", "Successfully copied."));
break;
case KIO::FileUndoManager::Move:
- statusBar->setMessage(i18nc("@info:status", "Successfully moved."),
- DolphinStatusBar::OperationCompleted);
+ statusBar->setText(i18nc("@info:status", "Successfully moved."));
break;
case KIO::FileUndoManager::Link:
- statusBar->setMessage(i18nc("@info:status", "Successfully linked."),
- DolphinStatusBar::OperationCompleted);
+ statusBar->setText(i18nc("@info:status", "Successfully linked."));
break;
case KIO::FileUndoManager::Trash:
- statusBar->setMessage(i18nc("@info:status", "Successfully moved to trash."),
- DolphinStatusBar::OperationCompleted);
+ statusBar->setText(i18nc("@info:status", "Successfully moved to trash."));
break;
case KIO::FileUndoManager::Rename:
- statusBar->setMessage(i18nc("@info:status", "Successfully renamed."),
- DolphinStatusBar::OperationCompleted);
+ statusBar->setText(i18nc("@info:status", "Successfully renamed."));
break;
case KIO::FileUndoManager::Mkdir:
- statusBar->setMessage(i18nc("@info:status", "Created folder."),
- DolphinStatusBar::OperationCompleted);
+ statusBar->setText(i18nc("@info:status", "Created folder."));
break;
default:
}
}
+void DolphinMainWindow::slotTerminalDirectoryChanged(const KUrl& url)
+{
+ m_activeViewContainer->setAutoGrabFocus(false);
+ changeUrl(url);
+ m_activeViewContainer->setAutoGrabFocus(true);
+}
+
void DolphinMainWindow::slotEditableStateChanged(bool editable)
{
KToggleAction* editableLocationAction =
void DolphinMainWindow::openNewMainWindow()
{
- KRun::run("dolphin", KUrl::List(), this);
+ KRun::run("dolphin %u", KUrl::List(), this);
}
void DolphinMainWindow::openNewTab()
}
}
+void DolphinMainWindow::openNewActivatedTab(const KUrl& url)
+{
+ openNewTab(url);
+ m_tabBar->setCurrentIndex(m_viewTab.count() - 1);
+}
+
void DolphinMainWindow::activateNextTab()
{
if (m_viewTab.count() >= 2) {
void DolphinMainWindow::openInNewTab()
{
- const KFileItemList list = m_activeViewContainer->view()->selectedItems();
+ const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
if (list.isEmpty()) {
openNewTab(m_activeViewContainer->url());
- } else if ((list.count() == 1) && list[0].isDir()) {
- openNewTab(list[0].url());
+ } else {
+ foreach (const KFileItem& item, list) {
+ const KUrl& url = DolphinView::openItemAsFolderUrl(item);
+ if (!url.isEmpty()) {
+ openNewTab(url);
+ }
+ }
}
}
const KFileItemList list = m_activeViewContainer->view()->selectedItems();
if (list.isEmpty()) {
newWindowUrl = m_activeViewContainer->url();
- } else if ((list.count() == 1) && list[0].isDir()) {
- newWindowUrl = list[0].url();
+ } else if (list.count() == 1) {
+ const KFileItem& item = list.first();
+ newWindowUrl = DolphinView::openItemAsFolderUrl(item);
}
if (!newWindowUrl.isEmpty()) {
- KRun::run("dolphin", KUrl::List() << newWindowUrl, this);
+ KRun::run("dolphin %u", KUrl::List() << newWindowUrl, this);
}
}
break;
case KDialog::No:
// Close only the current tab
- closeTab();
+ closeTab();
default:
event->ignore();
return;
GeneralSettings::setVersion(CurrentDolphinVersion);
GeneralSettings::self()->writeConfig();
- if (m_searchDockIsTemporaryVisible) {
- QDockWidget* searchDock = findChild<QDockWidget*>("searchDock");
- if (searchDock) {
- searchDock->hide();
- }
- m_searchDockIsTemporaryVisible = false;
- }
-
KXmlGuiWindow::closeEvent(event);
}
// openNewTab() needs to be called only tabCount - 1 times
if (i != tabCount - 1) {
- openNewTab();
+ openNewTab();
}
}
void DolphinMainWindow::showErrorMessage(const QString& message)
{
- if (!message.isEmpty()) {
- DolphinStatusBar* statusBar = m_activeViewContainer->statusBar();
- statusBar->setMessage(message, DolphinStatusBar::Error);
- }
+ m_activeViewContainer->showMessage(message, DolphinViewContainer::Error);
}
void DolphinMainWindow::slotUndoAvailable(bool available)
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));
const bool visible = menuBar()->isVisible();
menuBar()->setVisible(!visible);
if (visible) {
- createToolBarMenuButton();
+ createControlButton();
} else {
- deleteToolBarMenuButton();
+ deleteControlButton();
}
}
m_tabIndex = m_tabBar->currentIndex();
}
-void DolphinMainWindow::handlePlacesClick(const KUrl& url, Qt::MouseButtons buttons)
-{
- if (buttons & Qt::MidButton) {
- openNewTab(url);
- m_tabBar->setCurrentIndex(m_viewTab.count() - 1);
- } else {
- changeUrl(url);
- }
-}
-
void DolphinMainWindow::slotTestCanDecode(const QDragMoveEvent* event, bool& canDecode)
{
canDecode = KUrl::List::canDecode(event->mimeData());
} else if (KProtocolManager::supportsListing(url)) {
// stat the URL to see if it is a dir or not
m_lastHandleUrlStatJob = KIO::stat(url, KIO::HideProgressInfo);
+ if (m_lastHandleUrlStatJob->ui()) {
+ m_lastHandleUrlStatJob->ui()->setWindow(this);
+ }
connect(m_lastHandleUrlStatJob, SIGNAL(result(KJob*)),
this, SLOT(slotHandleUrlStatFinished(KJob*)));
} else {
- new KRun(url, this);
+ new KRun(url, this); // Automatically deletes itself after being finished
}
}
if (entry.isDir()) {
activeViewContainer()->setUrl(url);
} else {
- new KRun(url, this);
+ new KRun(url, this); // Automatically deletes itself after being finished
}
}
const ViewTab& viewTab = m_viewTab[tab];
const DolphinView* view = viewTab.isPrimaryViewActive ? viewTab.primaryView->view()
: viewTab.secondaryView->view();
- DragAndDropHelper::dropUrls(view->rootItem(), view->url(), event);
+ QString error;
+ DragAndDropHelper::dropUrls(view->rootItem(), view->url(), event, error);
+ if (!error.isEmpty()) {
+ activeViewContainer()->showMessage(error, DolphinViewContainer::Error);
+ }
}
}
newFileMenu()->setEnabled(isFolderWritable);
}
-void DolphinMainWindow::slotSearchModeChanged(bool enabled)
-{
-#ifdef HAVE_NEPOMUK
- const DolphinSearchInformation& searchInfo = DolphinSearchInformation::instance();
- if (!searchInfo.isIndexingEnabled()) {
- return;
- }
-
- QDockWidget* searchDock = findChild<QDockWidget*>("searchDock");
- if (!searchDock) {
- return;
- }
-
- if (enabled) {
- if (!searchDock->isVisible()) {
- m_searchDockIsTemporaryVisible = true;
- }
- searchDock->show();
- } else {
- if (searchDock->isVisible() && m_searchDockIsTemporaryVisible) {
- searchDock->hide();
- }
- m_searchDockIsTemporaryVisible = false;
- }
-
- SearchPanel* searchPanel = qobject_cast<SearchPanel*>(searchDock->widget());
- 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->setSearchLocation(searchLocation);
- } else {
- searchPanel->setSearchLocation(SearchPanel::Everywhere);
- }
-#else
- Q_UNUSED(enabled);
-#endif
-}
-
void DolphinMainWindow::openContextMenu(const QPoint& pos,
const KFileItem& item,
const KUrl& url,
switch (command) {
case DolphinContextMenu::OpenParentFolderInNewWindow: {
- KRun::run("dolphin", KUrl::List() << item.url().upUrl(), this);
+ KRun::run("dolphin %u", KUrl::List() << item.url().upUrl(), this);
break;
}
delete contextMenu.data();
}
-void DolphinMainWindow::updateToolBarMenu()
+void DolphinMainWindow::updateControlMenu()
{
KMenu* menu = qobject_cast<KMenu*>(sender());
Q_ASSERT(menu);
void DolphinMainWindow::updateToolBar()
{
if (!menuBar()->isVisible()) {
- createToolBarMenuButton();
+ createControlButton();
}
}
-void DolphinMainWindow::slotToolBarSpacerDeleted()
+void DolphinMainWindow::slotControlButtonDeleted()
{
- m_toolBarSpacer = 0;
+ m_controlButton = 0;
m_updateToolBarTimer->start();
}
-void DolphinMainWindow::slotToolBarMenuButtonDeleted()
+void DolphinMainWindow::slotPanelErrorMessage(const QString& error)
{
- m_openToolBarMenuButton = 0;
- m_updateToolBarTimer->start();
-}
-
-void DolphinMainWindow::slotToolBarIconSizeChanged(const QSize& iconSize)
-{
- if (m_openToolBarMenuButton) {
- m_openToolBarMenuButton->setIconSize(iconSize);
- }
+ activeViewContainer()->showMessage(error, DolphinViewContainer::Error);
}
void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer* viewContainer)
KMenu* menu = m_newFileMenu->menu();
menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
menu->setIcon(KIcon("document-new"));
+ m_newFileMenu->setDelayed(false);
connect(menu, SIGNAL(aboutToShow()),
this, SLOT(updateNewMenu()));
KToggleAction* editableLocation = actionCollection()->add<KToggleAction>("editable_location");
editableLocation->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location"));
- editableLocation->setShortcut(Qt::CTRL | Qt::Key_L);
+ editableLocation->setShortcut(Qt::Key_F6);
connect(editableLocation, SIGNAL(triggered()), this, SLOT(toggleEditLocation()));
KAction* replaceLocation = actionCollection()->addAction("replace_location");
replaceLocation->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location"));
- replaceLocation->setShortcut(Qt::Key_F6);
+ replaceLocation->setShortcut(Qt::CTRL | Qt::Key_L);
connect(replaceLocation, SIGNAL(triggered()), this, SLOT(replaceLocation()));
// setup 'Go' menu
m_recentTabsMenu = new KActionMenu(i18n("Recently Closed Tabs"), this);
m_recentTabsMenu->setIcon(KIcon("edit-undo"));
+ m_recentTabsMenu->setDelayed(false);
actionCollection()->addAction("closed_tabs", m_recentTabsMenu);
connect(m_recentTabsMenu->menu(), SIGNAL(triggered(QAction*)),
this, SLOT(restoreClosedTab(QAction*)));
openInNewTab->setIcon(KIcon("tab-new"));
connect(openInNewTab, SIGNAL(triggered()), this, SLOT(openInNewTab()));
+ KAction* openInNewTabs = actionCollection()->addAction("open_in_new_tabs");
+ openInNewTabs->setText(i18nc("@action:inmenu", "Open in New Tabs"));
+ openInNewTabs->setIcon(KIcon("tab-new"));
+ connect(openInNewTabs, SIGNAL(triggered()), this, SLOT(openInNewTab()));
+
KAction* openInNewWindow = actionCollection()->addAction("open_in_new_window");
openInNewWindow->setText(i18nc("@action:inmenu", "Open in New Window"));
openInNewWindow->setIcon(KIcon("window-new"));
addDockWidget(Qt::LeftDockWidgetArea, foldersDock);
connect(this, SIGNAL(urlChanged(KUrl)),
foldersPanel, SLOT(setUrl(KUrl)));
- connect(foldersPanel, SIGNAL(changeUrl(KUrl,Qt::MouseButtons)),
- this, SLOT(handlePlacesClick(KUrl,Qt::MouseButtons)));
+ connect(foldersPanel, SIGNAL(folderActivated(KUrl)),
+ this, SLOT(changeUrl(KUrl)));
+ connect(foldersPanel, SIGNAL(folderMiddleClicked(KUrl)),
+ this, SLOT(openNewTab(KUrl)));
+ connect(foldersPanel, SIGNAL(errorMessage(QString)),
+ this, SLOT(slotPanelErrorMessage(QString)));
// Setup "Terminal"
#ifndef Q_OS_WIN
terminalDock->setWidget(terminalPanel);
connect(terminalPanel, SIGNAL(hideTerminalPanel()), terminalDock, SLOT(hide()));
+ connect(terminalPanel, SIGNAL(changeUrl(KUrl)), this, SLOT(slotTerminalDirectoryChanged(KUrl)));
connect(terminalDock, SIGNAL(visibilityChanged(bool)),
terminalPanel, SLOT(dockVisibilityChanged()));
terminalPanel, SLOT(setUrl(KUrl)));
#endif
- // Setup "Search"
-#ifdef HAVE_NEPOMUK
- DolphinDockWidget* searchDock = new DolphinDockWidget(i18nc("@title:window", "Search"));
- searchDock->setLocked(lock);
- searchDock->setObjectName("searchDock");
- searchDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
- Panel* searchPanel = new SearchPanel(searchDock);
- searchPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
- connect(searchPanel, SIGNAL(urlActivated(KUrl)), this, SLOT(handleUrl(KUrl)));
- searchDock->setWidget(searchPanel);
-
- QAction* searchAction = searchDock->toggleViewAction();
- createPanelAction(KIcon("system-search"), Qt::Key_F12, searchAction, "show_search_panel");
- addDockWidget(Qt::RightDockWidgetArea, searchDock);
- connect(this, SIGNAL(urlChanged(KUrl)),
- searchPanel, SLOT(setUrl(KUrl)));
-#endif
-
if (GeneralSettings::version() < 200) {
infoDock->hide();
foldersDock->hide();
#ifndef Q_OS_WIN
terminalDock->hide();
-#endif
-#ifdef HAVE_NEPOMUK
- searchDock->hide();
#endif
}
placesDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
PlacesPanel* placesPanel = new PlacesPanel(placesDock);
- QAction* separator = new QAction(placesPanel);
- separator->setSeparator(true);
- QList<QAction*> placesActions;
- placesActions.append(separator);
- placesActions.append(lockLayoutAction);
- placesPanel->addActions(placesActions);
- placesPanel->setModel(DolphinPlacesModel::instance());
- placesPanel->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ placesPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
placesDock->setWidget(placesPanel);
QAction* placesAction = placesDock->toggleViewAction();
createPanelAction(KIcon("bookmarks"), Qt::Key_F9, placesAction, "show_places_panel");
addDockWidget(Qt::LeftDockWidgetArea, placesDock);
- connect(placesPanel, SIGNAL(urlChanged(KUrl,Qt::MouseButtons)),
- this, SLOT(handlePlacesClick(KUrl,Qt::MouseButtons)));
+ connect(placesPanel, SIGNAL(placeActivated(KUrl)),
+ this, SLOT(changeUrl(KUrl)));
+ connect(placesPanel, SIGNAL(placeMiddleClicked(KUrl)),
+ this, SLOT(openNewTab(KUrl)));
+ connect(placesPanel, SIGNAL(errorMessage(QString)),
+ this, SLOT(slotPanelErrorMessage(QString)));
connect(this, SIGNAL(urlChanged(KUrl)),
placesPanel, SLOT(setUrl(KUrl)));
connect(placesDock, SIGNAL(visibilityChanged(bool)),
this, SLOT(slotPlacesPanelVisibilityChanged(bool)));
+ connect(this, SIGNAL(settingsChanged()),
+ placesPanel, SLOT(readSettings()));
// Add actions into the "Panels" menu
KActionMenu* panelsMenu = new KActionMenu(i18nc("@action:inmenu View", "Panels"), this);
panelsMenu->addAction(ac->action("show_folders_panel"));
#ifndef Q_OS_WIN
panelsMenu->addAction(ac->action("show_terminal_panel"));
-#endif
-#ifdef HAVE_NEPOMUK
- panelsMenu->addAction(ac->action("show_search_panel"));
#endif
panelsMenu->addSeparator();
panelsMenu->addAction(lockLayoutAction);
goUpAction->setEnabled(currentUrl.upUrl() != currentUrl);
}
-void DolphinMainWindow::createToolBarMenuButton()
+void DolphinMainWindow::createControlButton()
{
- if (m_toolBarSpacer && m_openToolBarMenuButton) {
+ if (m_controlButton) {
return;
}
- Q_ASSERT(!m_toolBarSpacer);
- Q_ASSERT(!m_openToolBarMenuButton);
+ Q_ASSERT(!m_controlButton);
- m_toolBarSpacer = new QWidget(this);
- m_toolBarSpacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+ m_controlButton = new QToolButton(this);
+ m_controlButton->setIcon(KIcon("applications-system"));
+ m_controlButton->setText(i18nc("@action", "Control"));
+ m_controlButton->setPopupMode(QToolButton::InstantPopup);
+ m_controlButton->setToolButtonStyle(toolBar()->toolButtonStyle());
- m_openToolBarMenuButton = new QToolButton(this);
- m_openToolBarMenuButton->setIcon(KIcon("configure"));
- m_openToolBarMenuButton->setPopupMode(QToolButton::InstantPopup);
- m_openToolBarMenuButton->setToolTip(i18nc("@info:tooltip", "Configure and control Dolphin"));
+ KMenu* controlMenu = new KMenu(m_controlButton);
+ connect(controlMenu, SIGNAL(aboutToShow()), this, SLOT(updateControlMenu()));
- KMenu* toolBarMenu = new ToolBarMenu(m_openToolBarMenuButton);
- connect(toolBarMenu, SIGNAL(aboutToShow()), this, SLOT(updateToolBarMenu()));
+ m_controlButton->setMenu(controlMenu);
- m_openToolBarMenuButton->setMenu(toolBarMenu);
-
- toolBar()->addWidget(m_toolBarSpacer);
- toolBar()->addWidget(m_openToolBarMenuButton);
- connect(toolBar(), SIGNAL(iconSizeChanged(QSize)), this, SLOT(slotToolBarIconSizeChanged(QSize)));
+ toolBar()->addWidget(m_controlButton);
+ connect(toolBar(), SIGNAL(iconSizeChanged(QSize)),
+ m_controlButton, SLOT(setIconSize(QSize)));
+ connect(toolBar(), SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)),
+ m_controlButton, SLOT(setToolButtonStyle(Qt::ToolButtonStyle)));
// The added widgets are owned by the toolbar and may get deleted when e.g. the toolbar
// gets edited. In this case we must add them again. The adding is done asynchronously by
// m_updateToolBarTimer.
- connect(m_toolBarSpacer, SIGNAL(destroyed()), this, SLOT(slotToolBarSpacerDeleted()));
- connect(m_openToolBarMenuButton, SIGNAL(destroyed()), this, SLOT(slotToolBarMenuButtonDeleted()));
+ connect(m_controlButton, SIGNAL(destroyed()), this, SLOT(slotControlButtonDeleted()));
m_updateToolBarTimer = new QTimer(this);
m_updateToolBarTimer->setInterval(500);
connect(m_updateToolBarTimer, SIGNAL(timeout()), this, SLOT(updateToolBar()));
}
-void DolphinMainWindow::deleteToolBarMenuButton()
+void DolphinMainWindow::deleteControlButton()
{
- delete m_toolBarSpacer;
- m_toolBarSpacer = 0;
-
- delete m_openToolBarMenuButton;
- m_openToolBarMenuButton = 0;
+ delete m_controlButton;
+ m_controlButton = 0;
delete m_updateToolBarTimer;
m_updateToolBarTimer = 0;
toggleSplitView();
}
}
+
+ emit settingsChanged();
}
void DolphinMainWindow::clearStatusBar()
{
- m_activeViewContainer->statusBar()->clear();
+ m_activeViewContainer->statusBar()->resetToDefaultText();
}
void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
this, SLOT(updateFilterBarAction(bool)));
connect(container, SIGNAL(writeStateChanged(bool)),
this, SLOT(slotWriteStateChanged(bool)));
- 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(openNewTab(KUrl)));
connect(view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)),
this, SLOT(openContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)));
- connect(view, SIGNAL(startedPathLoading(KUrl)),
+ connect(view, SIGNAL(directoryLoadingStarted()),
this, SLOT(enableStopAction()));
- connect(view, SIGNAL(finishedPathLoading(KUrl)),
+ connect(view, SIGNAL(directoryLoadingCompleted()),
this, SLOT(disableStopAction()));
connect(view, SIGNAL(goBackRequested()),
this, SLOT(goBack()));
const int newWidth = (viewTab.primaryView->width() - splitter->handleWidth()) / 2;
const DolphinView* view = viewTab.primaryView->view();
- viewTab.secondaryView = createViewContainer(view->url(), 0);
+ // The final parent of the new view container will be set by adding it
+ // to the splitter. However, we must make sure that the DolphinMainWindow
+ // is a parent of the view container already when it is constructed
+ // because this enables the container's KFileItemModel to assign its
+ // dir lister to the right main window. The dir lister can then cache
+ // authentication data.
+ viewTab.secondaryView = createViewContainer(view->url(), this);
splitter->addWidget(viewTab.secondaryView);
splitter->setSizes(QList<int>() << newWidth << newWidth);
{
DolphinMainWindow* mainWin= qobject_cast<DolphinMainWindow *>(parentWidget());
if (mainWin) {
- DolphinStatusBar* statusBar = mainWin->activeViewContainer()->statusBar();
- statusBar->setMessage(job->errorString(), DolphinStatusBar::Error);
+ DolphinViewContainer* container = mainWin->activeViewContainer();
+ container->showMessage(job->errorString(), DolphinViewContainer::Error);
} else {
KIO::FileUndoManager::UiInterface::jobError(job);
}
}
-ToolBarMenu::ToolBarMenu(QWidget* parent) :
- KMenu(parent)
-{
-}
-
-ToolBarMenu::~ToolBarMenu()
-{
-}
-
-void ToolBarMenu::showEvent(QShowEvent* event)
-{
- KMenu::showEvent(event);
-
- // Adjust the position of the menu to be shown within the
- // Dolphin window to reduce the cases that sub-menus might overlap
- // the right screen border.
- QPoint pos;
- QWidget* button = parentWidget();
- if (layoutDirection() == Qt::RightToLeft) {
- pos = button->mapToGlobal(QPoint(0, button->height()));
- } else {
- pos = button->mapToGlobal(QPoint(button->width(), button->height()));
- pos.rx() -= width();
- }
-
- // 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() < 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() < screen.y()) {
- pos.ry() = screen.y();
- } else if (pos.y() + height() > screen.y() + screen.height()) {
- pos.ry() = button->mapToGlobal(QPoint(0, 0)).y() - height();
- }
-
- move(pos);
-}
-
#include "dolphinmainwindow.moc"