Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
fccc1afd
Commit
fccc1afd
authored
Oct 15, 2018
by
Clément Fauconnier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
several fixes on document mode (buttons' state update, no active document on trash)
parent
98fb3435
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
8 deletions
+19
-8
UBPersistenceManager.cpp
src/core/UBPersistenceManager.cpp
+1
-2
UBDocumentController.cpp
src/document/UBDocumentController.cpp
+18
-6
No files found.
src/core/UBPersistenceManager.cpp
View file @
fccc1afd
...
...
@@ -504,8 +504,6 @@ UBDocumentProxy* UBPersistenceManager::createDocumentFromDir(const QString& pDoc
doc
->
setUuid
(
QUuid
::
createUuid
());
doc
->
setPageCount
(
sceneCount
(
doc
));
UBMetadataDcSubsetAdaptor
::
persist
(
doc
);
for
(
int
i
=
0
;
i
<
doc
->
pageCount
();
i
++
)
{
UBSvgSubsetAdaptor
::
setSceneUuid
(
doc
,
i
,
QUuid
::
createUuid
());
...
...
@@ -519,6 +517,7 @@ UBDocumentProxy* UBPersistenceManager::createDocumentFromDir(const QString& pDoc
addDoc
=
true
;
}
if
(
addDoc
)
{
UBMetadataDcSubsetAdaptor
::
persist
(
doc
);
mDocumentTreeStructureModel
->
addDocument
(
doc
);
emit
proxyListChanged
();
emit
documentCreated
(
doc
);
...
...
src/document/UBDocumentController.cpp
View file @
fccc1afd
...
...
@@ -1292,12 +1292,13 @@ void UBDocumentTreeView::setSelectedAndExpanded(const QModelIndex &pIndex, bool
?
QItemSelectionModel
::
Select
:
QItemSelectionModel
::
Deselect
;
selectionModel
()
->
select
(
proxy
->
mapFromSource
(
indexCurrentDoc
),
QItemSelectionModel
::
Rows
|
sel
);
setCurrentIndex
(
pExpand
?
indexCurrentDoc
:
QModelIndex
());
selectionModel
()
->
select
(
proxy
->
mapFromSource
(
indexCurrentDoc
),
QItemSelectionModel
::
Rows
|
sel
);
while
(
indexCurrentDoc
.
parent
().
isValid
())
{
setExpanded
(
indexCurrentDoc
.
parent
(),
pExpand
);
indexCurrentDoc
=
indexCurrentDoc
.
parent
();
...
...
@@ -1808,6 +1809,8 @@ void UBDocumentController::TreeViewSelectionChanged(const QItemSelection &select
//if multi-selection
if
(
list
.
count
()
>
1
){
//selectOnlyTopLevelItems(mDocumentUI->documentTreeView->selectionModel()->selectedRows());
//check if the selection is in the same top-level folder
QModelIndex
sourceIndex1
=
mapIndexToSource
(
list
.
at
(
list
.
count
()
-
1
));
QModelIndex
sourceIndex2
=
mapIndexToSource
(
list
.
at
(
list
.
count
()
-
2
));
...
...
@@ -1868,7 +1871,6 @@ void UBDocumentController::TreeViewSelectionChanged(const QItemSelection &select
}
*/
}
}
void
UBDocumentController
::
itemSelectionChanged
(
LastSelectedElementType
newSelection
)
...
...
@@ -2330,8 +2332,10 @@ void UBDocumentController::moveIndexesToTrash(const QModelIndexList &list, UBDoc
UBDocumentProxy
*
proxy
=
docModel
->
proxyForIndex
(
sourceSibling
);
docModel
->
setCurrentDocument
(
proxy
);
setDocument
(
proxy
);
UBApplication
::
boardController
->
setActiveDocumentScene
(
proxy
,
0
,
true
);
docModel
->
setCurrentDocument
(
proxy
);
selectionModel
->
select
(
sibling
,
QItemSelectionModel
::
ClearAndSelect
);
...
...
@@ -2344,8 +2348,9 @@ void UBDocumentController::moveIndexesToTrash(const QModelIndexList &list, UBDoc
UBDocumentProxy
*
proxy
=
docModel
->
proxyForIndex
(
sourceSibling
);
docModel
->
setCurrentDocument
(
proxy
);
setDocument
(
proxy
);
UBApplication
::
boardController
->
setActiveDocumentScene
(
proxy
,
0
,
true
);
docModel
->
setCurrentDocument
(
proxy
);
selectionModel
->
select
(
sibling
,
QItemSelectionModel
::
ClearAndSelect
);
...
...
@@ -2572,7 +2577,6 @@ void UBDocumentController::importFile()
createdDocument
=
docManager
->
importFile
(
selectedFile
,
groupName
);
if
(
createdDocument
)
{
selectDocument
(
createdDocument
,
true
,
true
);
...
...
@@ -2704,10 +2708,18 @@ void UBDocumentController::pageSelectionChanged()
if
(
mIsClosing
)
return
;
UBDocumentTreeModel
*
docModel
=
UBPersistenceManager
::
persistenceManager
()
->
mDocumentTreeStructureModel
;
bool
pageSelected
=
mDocumentUI
->
thumbnailWidget
->
selectedItems
().
count
()
>
0
;
bool
docSelected
=
docModel
->
isDocument
(
firstSelectedTreeIndex
());
bool
folderSelected
=
docModel
->
isCatalog
(
firstSelectedTreeIndex
());
if
(
pageSelected
)
itemSelectionChanged
(
Page
);
else
if
(
docSelected
)
itemSelectionChanged
(
Document
);
else
if
(
folderSelected
)
itemSelectionChanged
(
Folder
);
else
itemSelectionChanged
(
None
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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