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
ca7e8e92
Commit
ca7e8e92
authored
9 years ago
by
Craig Watson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Quick fix: Ctrl-A no longer selects same document mutliple times
Also quick code clean-up in UBDocumentController
parent
19dd4d1f
master
bugfix
1.5.4z3
1.5.4z2
1.5.4z
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
10 deletions
+24
-10
UBDocumentController.cpp
src/document/UBDocumentController.cpp
+11
-10
UBDocumentTreeWidget.cpp
src/gui/UBDocumentTreeWidget.cpp
+11
-0
UBDocumentTreeWidget.h
src/gui/UBDocumentTreeWidget.h
+2
-0
No files found.
src/document/UBDocumentController.cpp
View file @
ca7e8e92
...
@@ -756,7 +756,7 @@ void UBDocumentController::deleteTreeItem(QTreeWidgetItem * item, bool showConfi
...
@@ -756,7 +756,7 @@ void UBDocumentController::deleteTreeItem(QTreeWidgetItem * item, bool showConfi
tr
(
"Are you sure you want to remove the document '%1'?"
).
arg
(
document
->
proxy
()
->
metaData
(
UBSettings
::
documentName
).
toString
())))
tr
(
"Are you sure you want to remove the document '%1'?"
).
arg
(
document
->
proxy
()
->
metaData
(
UBSettings
::
documentName
).
toString
())))
return
;
return
;
if
(
!
isDocumentInTrash
(
document
))
if
(
!
document
->
isInTrash
(
))
moveDocumentToTrash
(
dynamic_cast
<
UBDocumentGroupTreeItem
*>
(
document
->
parent
()),
document
);
moveDocumentToTrash
(
dynamic_cast
<
UBDocumentGroupTreeItem
*>
(
document
->
parent
()),
document
);
else
{
else
{
...
@@ -1157,11 +1157,6 @@ void UBDocumentController::pageSelectionChanged()
...
@@ -1157,11 +1157,6 @@ void UBDocumentController::pageSelectionChanged()
selectionChanged
();
selectionChanged
();
}
}
bool
UBDocumentController
::
isDocumentInTrash
(
UBDocumentProxyTreeItem
*
document
)
{
return
dynamic_cast
<
UBDocumentGroupTreeItem
*>
(
document
->
parent
())
->
isTrashFolder
();
}
bool
UBDocumentController
::
isCurrentSelectionInTrash
()
bool
UBDocumentController
::
isCurrentSelectionInTrash
()
{
{
bool
selectionIsInTrash
=
false
;
bool
selectionIsInTrash
=
false
;
...
@@ -1169,7 +1164,7 @@ bool UBDocumentController::isCurrentSelectionInTrash()
...
@@ -1169,7 +1164,7 @@ bool UBDocumentController::isCurrentSelectionInTrash()
// Find the first valid element; no need to check all of them
// Find the first valid element; no need to check all of them
UBDocumentProxyTreeItem
*
document
=
dynamic_cast
<
UBDocumentProxyTreeItem
*>
(
item
);
UBDocumentProxyTreeItem
*
document
=
dynamic_cast
<
UBDocumentProxyTreeItem
*>
(
item
);
if
(
document
)
{
if
(
document
)
{
selectionIsInTrash
=
isDocumentInTrash
(
document
);
selectionIsInTrash
=
document
->
isInTrash
(
);
break
;
break
;
}
}
}
}
...
@@ -1220,7 +1215,7 @@ void UBDocumentController::updateCurrentSelection()
...
@@ -1220,7 +1215,7 @@ void UBDocumentController::updateCurrentSelection()
UBDocumentProxyTreeItem
*
document
=
dynamic_cast
<
UBDocumentProxyTreeItem
*>
(
item
);
UBDocumentProxyTreeItem
*
document
=
dynamic_cast
<
UBDocumentProxyTreeItem
*>
(
item
);
if
(
document
)
{
if
(
document
)
{
// No mix between trashed and non-trashed items
// No mix between trashed and non-trashed items
if
(
isDocumentInTrash
(
document
)
!=
selectionIsInTrash
)
if
(
document
->
isInTrash
(
)
!=
selectionIsInTrash
)
addToSelection
=
false
;
addToSelection
=
false
;
}
}
...
@@ -1234,9 +1229,15 @@ void UBDocumentController::updateCurrentSelection()
...
@@ -1234,9 +1229,15 @@ void UBDocumentController::updateCurrentSelection()
if
(
selectionIsInTrash
)
if
(
selectionIsInTrash
)
addToSelection
=
false
;
addToSelection
=
false
;
}
}
if
(
!
folder
&&
!
document
)
addToSelection
=
false
;
if
(
addToSelection
)
if
(
addToSelection
)
{
if
(
!
mCurrentSelection
.
contains
(
item
))
{
// the .subtract() above doesn't seem to work all the time...
mCurrentSelection
.
append
(
item
);
mCurrentSelection
.
append
(
item
);
}
}
else
else
item
->
setSelected
(
false
);
item
->
setSelected
(
false
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/gui/UBDocumentTreeWidget.cpp
View file @
ca7e8e92
...
@@ -419,6 +419,17 @@ UBDocumentProxyTreeItem::UBDocumentProxyTreeItem(QTreeWidgetItem * parent, UBDoc
...
@@ -419,6 +419,17 @@ UBDocumentProxyTreeItem::UBDocumentProxyTreeItem(QTreeWidgetItem * parent, UBDoc
parent
->
insertChild
(
i
,
this
);
parent
->
insertChild
(
i
,
this
);
}
}
bool
UBDocumentProxyTreeItem
::
isInTrash
()
{
UBDocumentGroupTreeItem
*
parentFolder
=
dynamic_cast
<
UBDocumentGroupTreeItem
*>
(
this
->
parent
());
if
(
parentFolder
)
return
parentFolder
->
isTrashFolder
();
else
{
qWarning
()
<<
"UBDocumentProxyTreeItem::isInTrash: document has no parent folder. Assuming it is in trash."
;
return
true
;
}
}
UBDocumentGroupTreeItem
::
UBDocumentGroupTreeItem
(
QTreeWidgetItem
*
parent
,
bool
isEditable
)
UBDocumentGroupTreeItem
::
UBDocumentGroupTreeItem
(
QTreeWidgetItem
*
parent
,
bool
isEditable
)
:
QTreeWidgetItem
(
parent
)
:
QTreeWidgetItem
(
parent
)
...
...
This diff is collapsed.
Click to expand it.
src/gui/UBDocumentTreeWidget.h
View file @
ca7e8e92
...
@@ -77,6 +77,8 @@ class UBDocumentProxyTreeItem : public QTreeWidgetItem
...
@@ -77,6 +77,8 @@ class UBDocumentProxyTreeItem : public QTreeWidgetItem
return
mProxy
;
return
mProxy
;
}
}
bool
isInTrash
();
QPointer
<
UBDocumentProxy
>
mProxy
;
QPointer
<
UBDocumentProxy
>
mProxy
;
};
};
...
...
This diff is collapsed.
Click to expand it.
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