Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
Okular
Commits
db53b2f3
Commit
db53b2f3
authored
Nov 21, 2013
by
Albert Astals Cid
Browse files
Do not show the sidebar if it was hidden when defaulting to show the toc
BUGS: 327641
FIXED-IN: 4.11.95
parent
78fa3069
Changes
3
Hide whitespace changes
Inline
Side-by-side
part.cpp
View file @
db53b2f3
...
...
@@ -1307,9 +1307,7 @@ bool Part::openFile()
// if the 'OpenTOC' flag is set, open the TOC
if
(
m_document
->
metaData
(
"OpenTOC"
).
toBool
()
&&
m_sidebar
->
isItemEnabled
(
0
)
&&
!
m_sidebar
->
isCollapsed
()
)
{
const
bool
sidebarVisible
=
m_sidebar
->
isSidebarVisible
();
m_sidebar
->
setCurrentIndex
(
0
);
m_sidebar
->
setSidebarVisibility
(
sidebarVisible
);
m_sidebar
->
setCurrentIndex
(
0
,
Sidebar
::
DoNotUncollapseIfCollapsed
);
}
// if the 'StartFullScreen' flag is set, or the command line flag was
// specified, start presentation
...
...
@@ -1779,7 +1777,7 @@ void Part::enableTOC(bool enable)
// If present, show the TOC when a document is opened
if
(
enable
)
{
m_sidebar
->
setCurrentIndex
(
0
);
m_sidebar
->
setCurrentIndex
(
0
,
Sidebar
::
DoNotUncollapseIfCollapsed
);
}
}
...
...
ui/sidebar.cpp
View file @
db53b2f3
...
...
@@ -592,12 +592,12 @@ bool Sidebar::isItemEnabled( int index ) const
return
(
f
&
Qt
::
ItemIsEnabled
)
==
Qt
::
ItemIsEnabled
;
}
void
Sidebar
::
setCurrentIndex
(
int
index
)
void
Sidebar
::
setCurrentIndex
(
int
index
,
SetCurrentIndexBehaviour
b
)
{
if
(
index
<
0
||
index
>=
d
->
pages
.
count
()
||
!
isItemEnabled
(
index
)
)
return
;
itemClicked
(
d
->
pages
.
at
(
index
)
);
itemClicked
(
d
->
pages
.
at
(
index
)
,
b
);
QModelIndex
modelindex
=
d
->
list
->
model
()
->
index
(
index
,
0
);
d
->
list
->
setCurrentIndex
(
modelindex
);
d
->
list
->
selectionModel
()
->
select
(
modelindex
,
QItemSelectionModel
::
ClearAndSelect
);
...
...
@@ -644,6 +644,11 @@ bool Sidebar::isCollapsed() const
}
void
Sidebar
::
itemClicked
(
QListWidgetItem
*
item
)
{
itemClicked
(
item
,
UncollapseIfCollapsed
);
}
void
Sidebar
::
itemClicked
(
QListWidgetItem
*
item
,
SetCurrentIndexBehaviour
b
)
{
if
(
!
item
)
return
;
...
...
@@ -661,13 +666,16 @@ void Sidebar::itemClicked( QListWidgetItem *item )
}
else
{
setCollapsed
(
false
);
d
->
list
->
show
();
if
(
b
==
UncollapseIfCollapsed
)
{
setCollapsed
(
false
);
d
->
list
->
show
();
}
}
}
else
{
if
(
isCollapsed
()
)
if
(
isCollapsed
()
&&
b
==
UncollapseIfCollapsed
)
{
setCollapsed
(
false
);
d
->
list
->
show
();
...
...
ui/sidebar.h
View file @
db53b2f3
...
...
@@ -30,7 +30,9 @@ class Sidebar : public QWidget
void
setItemEnabled
(
int
index
,
bool
enabled
);
bool
isItemEnabled
(
int
index
)
const
;
void
setCurrentIndex
(
int
index
);
enum
SetCurrentIndexBehaviour
{
UncollapseIfCollapsed
,
DoNotUncollapseIfCollapsed
};
void
setCurrentIndex
(
int
index
,
SetCurrentIndexBehaviour
b
=
UncollapseIfCollapsed
);
int
currentIndex
()
const
;
void
setSidebarVisibility
(
bool
visible
);
...
...
@@ -48,6 +50,7 @@ class Sidebar : public QWidget
void
appearanceChanged
();
private:
void
itemClicked
(
QListWidgetItem
*
item
,
SetCurrentIndexBehaviour
b
);
void
saveSplitterSize
()
const
;
// private storage
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment