X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/4fcb5662a784b8490c989cfda84e5ee649334418..40c71d5ce0f6978ce48eb67fd73ed211bab4e887:/src/dolphinmainwindow.cpp diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 71e2b2c36..aca4d15b6 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -37,11 +37,11 @@ #include "panels/information/informationpanel.h" #include "search/dolphinsearchbox.h" #include "search/dolphinsearchinformation.h" -#include "settings/dolphinsettings.h" #include "settings/dolphinsettingsdialog.h" #include "statusbar/dolphinstatusbar.h" #include "views/dolphinviewactionhandler.h" #include "views/dolphinremoteencoding.h" +#include "views/draganddrophelper.h" #include "views/viewproperties.h" #ifndef Q_OS_WIN @@ -88,6 +88,8 @@ #include #include +#include "views/dolphinplacesmodel.h" + #include #include #include @@ -101,18 +103,6 @@ namespace { 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 @@ -137,12 +127,15 @@ DolphinMainWindow::DolphinMainWindow() : 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) { + 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): @@ -151,6 +144,8 @@ DolphinMainWindow::DolphinMainWindow() : setObjectName("Dolphin#"); m_viewTab.append(ViewTab()); + ViewTab& viewTab = m_viewTab[m_tabIndex]; + viewTab.wasActive = true; // The first opened tab is automatically active KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self(); undoManager->setUiInterface(new UndoUiInterface()); @@ -163,8 +158,6 @@ DolphinMainWindow::DolphinMainWindow() : this, SLOT(clearStatusBar())); connect(undoManager, SIGNAL(jobRecordingFinished(CommandType)), this, SLOT(showCommand(CommandType))); - connect(DolphinSettings::instance().placesModel(), SIGNAL(errorMessage(QString)), - this, SLOT(showErrorMessage(QString))); GeneralSettings* generalSettings = GeneralSettings::self(); const bool firstRun = (generalSettings->version() < 200); @@ -174,8 +167,8 @@ DolphinMainWindow::DolphinMainWindow() : setAcceptDrops(true); - m_viewTab[m_tabIndex].splitter = new QSplitter(this); - m_viewTab[m_tabIndex].splitter->setChildrenCollapsible(false); + viewTab.splitter = new QSplitter(this); + viewTab.splitter->setChildrenCollapsible(false); setupActions(); @@ -185,9 +178,9 @@ DolphinMainWindow::DolphinMainWindow() : connect(m_actionHandler, SIGNAL(actionBeingHandled()), SLOT(clearStatusBar())); connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory())); - m_viewTab[m_tabIndex].primaryView = createViewContainer(homeUrl, m_viewTab[m_tabIndex].splitter); + viewTab.primaryView = createViewContainer(homeUrl, viewTab.splitter); - m_activeViewContainer = m_viewTab[m_tabIndex].primaryView; + m_activeViewContainer = viewTab.primaryView; connectViewSignals(m_activeViewContainer); DolphinView* view = m_activeViewContainer->view(); m_activeViewContainer->show(); @@ -224,7 +217,7 @@ DolphinMainWindow::DolphinMainWindow() : m_centralWidgetLayout->setSpacing(0); m_centralWidgetLayout->setMargin(0); m_centralWidgetLayout->addWidget(m_tabBar); - m_centralWidgetLayout->addWidget(m_viewTab[m_tabIndex].splitter, 1); + m_centralWidgetLayout->addWidget(viewTab.splitter, 1); setCentralWidget(centralWidget); setupDockWidgets(); @@ -257,7 +250,7 @@ DolphinMainWindow::DolphinMainWindow() : QAction* showMenuBarAction = actionCollection()->action(KStandardAction::name(KStandardAction::ShowMenubar)); showMenuBarAction->setChecked(showMenu); // workaround for bug #171080 if (!showMenu) { - createToolBarMenuButton(); + createControlButton(); } } @@ -278,8 +271,7 @@ void DolphinMainWindow::openDirectories(const QList& dirs) const int oldOpenTabsCount = m_viewTab.count(); - const GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings(); - const bool hasSplitView = generalSettings->splitView(); + const bool hasSplitView = GeneralSettings::splitView(); // Open each directory inside a new tab. If the "split view" option has been enabled, // always show two directories within one tab. @@ -506,13 +498,12 @@ void DolphinMainWindow::openNewTab(const KUrl& url) actionCollection()->action("close_tab")->setEnabled(true); - // provide a split view, if the startup settings are set this way - const GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings(); - if (generalSettings->splitView()) { - const int tabIndex = m_viewTab.count() - 1; - createSecondaryView(tabIndex); - m_viewTab[tabIndex].secondaryView->setActive(true); - m_viewTab[tabIndex].isPrimaryViewActive = false; + // Provide a split view, if the startup settings are set this way + if (GeneralSettings::splitView()) { + const int newTabIndex = m_viewTab.count() - 1; + createSecondaryView(newTabIndex); + m_viewTab[newTabIndex].secondaryView->setActive(true); + m_viewTab[newTabIndex].isPrimaryViewActive = false; } if (focusWidget) { @@ -524,25 +515,21 @@ void DolphinMainWindow::openNewTab(const KUrl& url) void DolphinMainWindow::activateNextTab() { - if ((m_viewTab.count() == 1) || (m_tabBar->count() < 2)) { - return; + if (m_viewTab.count() >= 2) { + const int tabIndex = (m_tabBar->currentIndex() + 1) % m_tabBar->count(); + m_tabBar->setCurrentIndex(tabIndex); } - - const int tabIndex = (m_tabBar->currentIndex() + 1) % m_tabBar->count(); - m_tabBar->setCurrentIndex(tabIndex); } void DolphinMainWindow::activatePrevTab() { - if ((m_viewTab.count() == 1) || (m_tabBar->count() < 2)) { - return; - } - - int tabIndex = m_tabBar->currentIndex() - 1; - if (tabIndex == -1) { - tabIndex = m_tabBar->count() - 1; + if (m_viewTab.count() >= 2) { + int tabIndex = m_tabBar->currentIndex() - 1; + if (tabIndex == -1) { + tabIndex = m_tabBar->count() - 1; + } + m_tabBar->setCurrentIndex(tabIndex); } - m_tabBar->setCurrentIndex(tabIndex); } void DolphinMainWindow::openInNewTab() @@ -596,8 +583,6 @@ void DolphinMainWindow::showEvent(QShowEvent* event) void DolphinMainWindow::closeEvent(QCloseEvent* event) { - GeneralSettings* generalSettings = GeneralSettings::self(); - // Find out if Dolphin is closed directly by the user or // by the session manager because the session is closed bool closedByUser = true; @@ -606,7 +591,7 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event) closedByUser = false; } - if ((m_viewTab.count() > 1) && generalSettings->confirmClosingMultipleTabs() && closedByUser) { + if (m_viewTab.count() > 1 && GeneralSettings::confirmClosingMultipleTabs() && closedByUser) { // Ask the user if he really wants to quit and close all tabs. // Open a confirmation dialog with 3 buttons: // KDialog::Yes -> Quit @@ -632,7 +617,7 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event) KMessageBox::Notify); if (doNotAskAgainCheckboxResult) { - generalSettings->setConfirmClosingMultipleTabs(false); + GeneralSettings::setConfirmClosingMultipleTabs(false); } switch (result) { @@ -648,8 +633,8 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event) } } - generalSettings->setVersion(CurrentDolphinVersion); - generalSettings->writeConfig(); + GeneralSettings::setVersion(CurrentDolphinVersion); + GeneralSettings::self()->writeConfig(); if (m_searchDockIsTemporaryVisible) { QDockWidget* searchDock = findChild("searchDock"); @@ -948,9 +933,7 @@ void DolphinMainWindow::replaceLocation() void DolphinMainWindow::togglePanelLockState() { - GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings(); - - const bool newLockState = !generalSettings->lockPanels(); + const bool newLockState = !GeneralSettings::lockPanels(); foreach (QObject* child, children()) { DolphinDockWidget* dock = qobject_cast(child); if (dock) { @@ -958,7 +941,7 @@ void DolphinMainWindow::togglePanelLockState() } } - generalSettings->setLockPanels(newLockState); + GeneralSettings::setLockPanels(newLockState); } void DolphinMainWindow::slotPlacesPanelVisibilityChanged(bool visible) @@ -1029,6 +1012,14 @@ void DolphinMainWindow::goUp(Qt::MouseButtons buttons) } } +void DolphinMainWindow::goHome(Qt::MouseButtons buttons) +{ + // The default case (left button pressed) is handled in goHome(). + if (buttons == Qt::MidButton) { + openNewTab(GeneralSettings::self()->homeUrl()); + } +} + void DolphinMainWindow::compareFiles() { // The method is only invoked if exactly 2 files have @@ -1089,9 +1080,9 @@ void DolphinMainWindow::toggleShowMenuBar() const bool visible = menuBar()->isVisible(); menuBar()->setVisible(!visible); if (visible) { - createToolBarMenuButton(); + createControlButton(); } else { - deleteToolBarMenuButton(); + deleteControlButton(); } } @@ -1114,7 +1105,10 @@ void DolphinMainWindow::openTerminal() void DolphinMainWindow::editSettings() { if (!m_settingsDialog) { - const KUrl url = activeViewContainer()->url(); + DolphinViewContainer* container = activeViewContainer(); + container->view()->writeSettings(); + + const KUrl url = container->url(); DolphinSettingsDialog* settingsDialog = new DolphinSettingsDialog(url, this); connect(settingsDialog, SIGNAL(settingsChanged()), this, SLOT(refreshViews())); settingsDialog->setAttribute(Qt::WA_DeleteOnClose); @@ -1155,6 +1149,18 @@ void DolphinMainWindow::setActiveTab(int index) } viewTab.splitter->show(); + if (!viewTab.wasActive) { + viewTab.wasActive = true; + + // If the tab has not been activated yet the size of the KItemListView is + // undefined and results in an unwanted animation. To prevent this a + // reloading of the directory gets triggered. + viewTab.primaryView->view()->reload(); + if (viewTab.secondaryView) { + viewTab.secondaryView->view()->reload(); + } + } + setActiveViewContainer(viewTab.isPrimaryViewActive ? viewTab.primaryView : viewTab.secondaryView); } @@ -1312,9 +1318,9 @@ void DolphinMainWindow::tabDropEvent(int tab, QDropEvent* event) const KUrl::List urls = KUrl::List::fromMimeData(event->mimeData()); if (!urls.isEmpty() && tab != -1) { const ViewTab& viewTab = m_viewTab[tab]; - const KUrl destPath = viewTab.isPrimaryViewActive ? viewTab.primaryView->url() : viewTab.secondaryView->url(); - Q_UNUSED(destPath); - //DragAndDropHelper::instance().dropUrls(KFileItem(), destPath, event, m_tabBar); + const DolphinView* view = viewTab.isPrimaryViewActive ? viewTab.primaryView->view() + : viewTab.secondaryView->view(); + DragAndDropHelper::dropUrls(view->rootItem(), view->url(), event); } } @@ -1396,7 +1402,7 @@ void DolphinMainWindow::openContextMenu(const QPoint& pos, delete contextMenu.data(); } -void DolphinMainWindow::updateToolBarMenu() +void DolphinMainWindow::updateControlMenu() { KMenu* menu = qobject_cast(sender()); Q_ASSERT(menu); @@ -1405,8 +1411,6 @@ void DolphinMainWindow::updateToolBarMenu() // by connecting to the aboutToHide() signal from the parent-menu. menu->clear(); - const GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings(); - KActionCollection* ac = actionCollection(); // Add "Edit" actions @@ -1420,7 +1424,7 @@ void DolphinMainWindow::updateToolBarMenu() } // Add "View" actions - if (!generalSettings->showZoomSlider()) { + if (!GeneralSettings::showZoomSlider()) { addActionToMenu(ac->action(KStandardAction::name(KStandardAction::ZoomIn)), menu); addActionToMenu(ac->action(KStandardAction::name(KStandardAction::ZoomOut)), menu); menu->addSeparator(); @@ -1497,29 +1501,16 @@ void DolphinMainWindow::updateToolBarMenu() void DolphinMainWindow::updateToolBar() { if (!menuBar()->isVisible()) { - createToolBarMenuButton(); + createControlButton(); } } -void DolphinMainWindow::slotToolBarSpacerDeleted() -{ - m_toolBarSpacer = 0; - m_updateToolBarTimer->start(); -} - -void DolphinMainWindow::slotToolBarMenuButtonDeleted() +void DolphinMainWindow::slotControlButtonDeleted() { - m_openToolBarMenuButton = 0; + m_controlButton = 0; m_updateToolBarTimer->start(); } -void DolphinMainWindow::slotToolBarIconSizeChanged(const QSize& iconSize) -{ - if (m_openToolBarMenuButton) { - m_openToolBarMenuButton->setIconSize(iconSize); - } -} - void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer* viewContainer) { Q_ASSERT(viewContainer); @@ -1685,7 +1676,8 @@ void DolphinMainWindow::setupActions() 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()); + KAction* homeAction = KStandardAction::home(this, SLOT(goHome()), actionCollection()); + connect(homeAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goHome(Qt::MouseButtons))); // setup 'Tools' menu KAction* showFilterBar = actionCollection()->addAction("show_filter_bar"); @@ -1707,7 +1699,9 @@ void DolphinMainWindow::setupActions() connect(openTerminal, SIGNAL(triggered()), this, SLOT(openTerminal())); // setup 'Settings' menu - KStandardAction::showMenubar(this, SLOT(toggleShowMenuBar()), actionCollection()); + KToggleAction* showMenuBar = KStandardAction::showMenubar(0, 0, actionCollection()); + connect(showMenuBar, SIGNAL(triggered(bool)), // Fixes #286822 + this, SLOT(toggleShowMenuBar()), Qt::QueuedConnection); KStandardAction::preferences(this, SLOT(editSettings()), actionCollection()); // not in menu actions @@ -1743,7 +1737,7 @@ void DolphinMainWindow::setupActions() void DolphinMainWindow::setupDockWidgets() { - const bool lock = DolphinSettings::instance().generalSettings()->lockPanels(); + const bool lock = GeneralSettings::lockPanels(); KDualAction* lockLayoutAction = actionCollection()->add("lock_panels"); lockLayoutAction->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels")); @@ -1832,7 +1826,7 @@ void DolphinMainWindow::setupDockWidgets() searchPanel, SLOT(setUrl(KUrl))); #endif - if (DolphinSettings::instance().generalSettings()->version() < 200) { + if (GeneralSettings::version() < 200) { infoDock->hide(); foldersDock->hide(); #ifndef Q_OS_WIN @@ -1856,7 +1850,7 @@ void DolphinMainWindow::setupDockWidgets() placesActions.append(separator); placesActions.append(lockLayoutAction); placesPanel->addActions(placesActions); - placesPanel->setModel(DolphinSettings::instance().placesModel()); + placesPanel->setModel(DolphinPlacesModel::instance()); placesPanel->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); placesDock->setWidget(placesPanel); @@ -1875,14 +1869,15 @@ void DolphinMainWindow::setupDockWidgets() KActionMenu* panelsMenu = new KActionMenu(i18nc("@action:inmenu View", "Panels"), this); actionCollection()->addAction("panels", panelsMenu); panelsMenu->setDelayed(false); - panelsMenu->addAction(placesAction); - panelsMenu->addAction(infoAction); - panelsMenu->addAction(foldersAction); + const KActionCollection* ac = actionCollection(); + panelsMenu->addAction(ac->action("show_places_panel")); + panelsMenu->addAction(ac->action("show_information_panel")); + panelsMenu->addAction(ac->action("show_folders_panel")); #ifndef Q_OS_WIN - panelsMenu->addAction(terminalAction); + panelsMenu->addAction(ac->action("show_terminal_panel")); #endif #ifdef HAVE_NEPOMUK - panelsMenu->addAction(searchAction); + panelsMenu->addAction(ac->action("show_search_panel")); #endif panelsMenu->addSeparator(); panelsMenu->addAction(lockLayoutAction); @@ -1936,48 +1931,43 @@ void DolphinMainWindow::updateGoActions() 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; @@ -2048,19 +2038,18 @@ void DolphinMainWindow::refreshViews() const int tabCount = m_viewTab.count(); for (int i = 0; i < tabCount; ++i) { - m_viewTab[i].primaryView->refresh(); + m_viewTab[i].primaryView->readSettings(); if (m_viewTab[i].secondaryView) { - m_viewTab[i].secondaryView->refresh(); + m_viewTab[i].secondaryView->readSettings(); } } setActiveViewContainer(activeViewContainer); - const GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings(); - if (generalSettings->modifiedStartupSettings()) { + 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 bool splitView = GeneralSettings::splitView(); const ViewTab& activeTab = m_viewTab[m_tabIndex]; const bool toggle = ( splitView && !activeTab.secondaryView) || (!splitView && activeTab.secondaryView); @@ -2099,10 +2088,14 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container) this, SLOT(openNewTab(KUrl))); connect(view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList)), this, SLOT(openContextMenu(QPoint,KFileItem,KUrl,QList))); - 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())); + connect(view, SIGNAL(goForwardRequested()), + this, SLOT(goForward())); const KUrlNavigator* navigator = container->urlNavigator(); connect(navigator, SIGNAL(urlChanged(KUrl)), @@ -2168,16 +2161,20 @@ bool DolphinMainWindow::isKompareInstalled() const void DolphinMainWindow::createSecondaryView(int tabIndex) { - QSplitter* splitter = m_viewTab[tabIndex].splitter; - const int newWidth = (m_viewTab[tabIndex].primaryView->width() - splitter->handleWidth()) / 2; + ViewTab& viewTab = m_viewTab[tabIndex]; - const DolphinView* view = m_viewTab[tabIndex].primaryView->view(); - m_viewTab[tabIndex].secondaryView = createViewContainer(view->url(), 0); - splitter->addWidget(m_viewTab[tabIndex].secondaryView); + QSplitter* splitter = viewTab.splitter; + const int newWidth = (viewTab.primaryView->width() - splitter->handleWidth()) / 2; + + const DolphinView* view = viewTab.primaryView->view(); + viewTab.secondaryView = createViewContainer(view->url(), 0); + splitter->addWidget(viewTab.secondaryView); splitter->setSizes(QList() << newWidth << newWidth); - connectViewSignals(m_viewTab[tabIndex].secondaryView); - m_viewTab[tabIndex].secondaryView->setActive(false); - m_viewTab[tabIndex].secondaryView->show(); + + connectViewSignals(viewTab.secondaryView); + viewTab.secondaryView->setActive(false); + viewTab.secondaryView->resize(newWidth, viewTab.primaryView->height()); + viewTab.secondaryView->show(); } QString DolphinMainWindow::tabProperty(const QString& property, int tabIndex) const @@ -2213,12 +2210,14 @@ void DolphinMainWindow::createPanelAction(const KIcon& icon, const QString& actionName) { KAction* panelAction = actionCollection()->addAction(actionName); + panelAction->setCheckable(true); + panelAction->setChecked(dockAction->isChecked()); panelAction->setText(dockAction->text()); panelAction->setIcon(icon); panelAction->setShortcut(shortcut); - dockAction->setIcon(icon); connect(panelAction, SIGNAL(triggered()), dockAction, SLOT(trigger())); + connect(dockAction, SIGNAL(toggled(bool)), panelAction, SLOT(setChecked(bool))); } DolphinMainWindow::UndoUiInterface::UndoUiInterface() : @@ -2241,47 +2240,4 @@ void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job* 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"