mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-19 16:31:21 +00:00
* fixed issue that when having a split view, that both views get the same color after OK or Apply has been pressed inside the Dolphin settings dialog
* prepare for toggling the view icon depending from the activation state svn path=/trunk/KDE/kdebase/apps/; revision=699311
This commit is contained in:
parent
2c9a509570
commit
c349180c08
|
@ -796,23 +796,31 @@ void DolphinMainWindow::showDateInfo()
|
|||
void DolphinMainWindow::toggleSplitView()
|
||||
{
|
||||
if (m_viewContainer[SecondaryView] == 0) {
|
||||
const int newWidth = (m_viewContainer[PrimaryView]->width() - m_splitter->handleWidth()) / 2;
|
||||
// create a secondary view
|
||||
const int newWidth = (m_viewContainer[PrimaryView]->width() - m_splitter->handleWidth()) / 2;
|
||||
|
||||
const DolphinView* view = m_viewContainer[PrimaryView]->view();
|
||||
m_viewContainer[SecondaryView] = new DolphinViewContainer(this,
|
||||
0,
|
||||
view->rootUrl());
|
||||
m_viewContainer[SecondaryView] = new DolphinViewContainer(this, 0, view->rootUrl());
|
||||
connectViewSignals(SecondaryView);
|
||||
m_splitter->addWidget(m_viewContainer[SecondaryView]);
|
||||
m_splitter->setSizes(QList<int>() << newWidth << newWidth);
|
||||
m_viewContainer[SecondaryView]->view()->reload();
|
||||
m_viewContainer[SecondaryView]->setActive(false);
|
||||
m_viewContainer[SecondaryView]->show();
|
||||
} else {
|
||||
} else if (m_activeViewContainer == m_viewContainer[PrimaryView]) {
|
||||
// remove secondary view
|
||||
m_viewContainer[SecondaryView]->close();
|
||||
m_viewContainer[SecondaryView]->deleteLater();
|
||||
m_viewContainer[SecondaryView] = 0;
|
||||
} else {
|
||||
// The secondary view is active, hence from a users point of view
|
||||
// the content of the secondary view should be moved to the primary view.
|
||||
// From an implementation point of view it is more efficient to close
|
||||
// the primary view and exchange the internal pointers afterwards.
|
||||
m_viewContainer[PrimaryView]->close();
|
||||
m_viewContainer[PrimaryView]->deleteLater();
|
||||
m_viewContainer[PrimaryView] = m_viewContainer[SecondaryView];
|
||||
m_viewContainer[SecondaryView] = 0;
|
||||
}
|
||||
|
||||
setActiveViewContainer(m_viewContainer[PrimaryView]);
|
||||
|
@ -1028,11 +1036,9 @@ void DolphinMainWindow::init()
|
|||
updatePasteAction();
|
||||
updateGoActions();
|
||||
|
||||
const bool split = generalSettings->splitView();
|
||||
if (split) {
|
||||
if (generalSettings->splitView()) {
|
||||
toggleSplitView();
|
||||
}
|
||||
updateSplitAction(split);
|
||||
updateViewActions();
|
||||
|
||||
if (firstRun) {
|
||||
|
@ -1267,7 +1273,7 @@ void DolphinMainWindow::setupActions()
|
|||
|
||||
QAction* split = actionCollection()->addAction("split_view");
|
||||
split->setShortcut(Qt::Key_F10);
|
||||
updateSplitAction(false);
|
||||
updateSplitAction();
|
||||
connect(split, SIGNAL(triggered()), this, SLOT(toggleSplitView()));
|
||||
|
||||
QAction* reload = actionCollection()->addAction("reload");
|
||||
|
@ -1507,7 +1513,7 @@ void DolphinMainWindow::updateViewActions()
|
|||
static_cast<KToggleAction*>(actionCollection()->action("show_hidden_files"));
|
||||
showHiddenFilesAction->setChecked(view->showHiddenFiles());
|
||||
|
||||
updateSplitAction(m_viewContainer[SecondaryView] != 0);
|
||||
updateSplitAction();
|
||||
|
||||
KToggleAction* editableLocactionAction =
|
||||
static_cast<KToggleAction*>(actionCollection()->action("editable_location"));
|
||||
|
@ -1580,12 +1586,17 @@ void DolphinMainWindow::connectViewSignals(int viewIndex)
|
|||
this, SLOT(slotHistoryChanged()));
|
||||
}
|
||||
|
||||
void DolphinMainWindow::updateSplitAction(bool isSplit)
|
||||
void DolphinMainWindow::updateSplitAction()
|
||||
{
|
||||
QAction* splitAction = actionCollection()->action("split_view");
|
||||
if (isSplit) {
|
||||
if (m_viewContainer[SecondaryView] != 0) {
|
||||
splitAction->setText(i18nc("@action:intoolbar Join views", "Join"));
|
||||
if (m_activeViewContainer == m_viewContainer[PrimaryView]) {
|
||||
splitAction->setIcon(KIcon("fileview-join"));
|
||||
} else {
|
||||
// TODO: replace by alternative icon as soon as it is available in Oxygen
|
||||
splitAction->setIcon(KIcon("fileview-join"));
|
||||
}
|
||||
} else {
|
||||
splitAction->setText(i18nc("@action:intoolbar Split view", "Split"));
|
||||
splitAction->setIcon(KIcon("fileview-split"));
|
||||
|
|
|
@ -457,11 +457,11 @@ private:
|
|||
|
||||
/**
|
||||
* Updates the text of the split action:
|
||||
* If \a isSplit is true, the text is set to "Split",
|
||||
* If two views are shown, the text is set to "Split",
|
||||
* otherwise the text is set to "Join". The icon
|
||||
* is updated to match with the text.
|
||||
* is updated to match with the text and the currently active view.
|
||||
*/
|
||||
void updateSplitAction(bool isSplit);
|
||||
void updateSplitAction();
|
||||
|
||||
private:
|
||||
/**
|
||||
|
|
|
@ -134,19 +134,7 @@ void DolphinView::setActive(bool active)
|
|||
|
||||
m_active = active;
|
||||
|
||||
QColor color = KColorScheme(KColorScheme::View).background();
|
||||
if (active) {
|
||||
emit urlChanged(url());
|
||||
emit selectionChanged(selectedItems());
|
||||
} else {
|
||||
color.setAlpha(0);
|
||||
}
|
||||
|
||||
QWidget* viewport = itemView()->viewport();
|
||||
QPalette palette;
|
||||
palette.setColor(viewport->backgroundRole(), color);
|
||||
viewport->setPalette(palette);
|
||||
|
||||
updateViewportColor();
|
||||
update();
|
||||
|
||||
if (active) {
|
||||
|
@ -438,6 +426,7 @@ void DolphinView::refresh()
|
|||
createView();
|
||||
applyViewProperties(m_controller->url());
|
||||
reload();
|
||||
updateViewportColor();
|
||||
}
|
||||
|
||||
void DolphinView::setUrl(const KUrl& url)
|
||||
|
@ -964,4 +953,20 @@ void DolphinView::applyCutItemEffect()
|
|||
}
|
||||
}
|
||||
|
||||
void DolphinView::updateViewportColor()
|
||||
{
|
||||
QColor color = KColorScheme(KColorScheme::View).background();
|
||||
if (m_active) {
|
||||
emit urlChanged(url());
|
||||
emit selectionChanged(selectedItems());
|
||||
} else {
|
||||
color.setAlpha(0);
|
||||
}
|
||||
|
||||
QWidget* viewport = itemView()->viewport();
|
||||
QPalette palette;
|
||||
palette.setColor(viewport->backgroundRole(), color);
|
||||
viewport->setPalette(palette);
|
||||
}
|
||||
|
||||
#include "dolphinview.moc"
|
||||
|
|
|
@ -517,6 +517,12 @@ private:
|
|||
/** Applies an item effect to all cut items. */
|
||||
void applyCutItemEffect();
|
||||
|
||||
/**
|
||||
* Updates the color of the viewport depending from the
|
||||
* activation state (see DolphinView::isActive()).
|
||||
*/
|
||||
void updateViewportColor();
|
||||
|
||||
/**
|
||||
* Returns true, if the ColumnView is activated. As the column view
|
||||
* requires some special handling for iterating through directories,
|
||||
|
|
Loading…
Reference in a new issue