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
05d672a8
Commit
05d672a8
authored
Dec 03, 2019
by
Clément Fauconnier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added two options to periodically delete old documents in trash
parent
e3bfd85b
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
162 additions
and
16 deletions
+162
-16
OpenBoard.config
resources/etc/OpenBoard.config
+2
-0
preferences.ui
resources/forms/preferences.ui
+45
-15
UBApplication.cpp
src/core/UBApplication.cpp
+6
-0
UBPreferencesController.cpp
src/core/UBPreferencesController.cpp
+11
-0
UBSettings.cpp
src/core/UBSettings.cpp
+2
-0
UBSettings.h
src/core/UBSettings.h
+3
-0
UBDocumentController.cpp
src/document/UBDocumentController.cpp
+88
-1
UBDocumentController.h
src/document/UBDocumentController.h
+5
-0
No files found.
resources/etc/OpenBoard.config
View file @
05d672a8
...
@@ -93,6 +93,8 @@ SortOrder=0
...
@@ -93,6 +93,8 @@ SortOrder=0
SplitterLeftSize
=
200
SplitterLeftSize
=
200
SplitterRightSize
=
800
SplitterRightSize
=
800
ShowDateColumnOnAlphabeticalSort
=
false
ShowDateColumnOnAlphabeticalSort
=
false
emptyTrashForOlderDocuments
=
true
emptyTrashDaysValue
=
30
[
IntranetPodcast
]
[
IntranetPodcast
]
Author
=
Author
=
...
...
resources/forms/preferences.ui
View file @
05d672a8
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<x>
0
</x>
<x>
0
</x>
<y>
0
</y>
<y>
0
</y>
<width>
825
</width>
<width>
825
</width>
<height>
7
48
</height>
<height>
7
67
</height>
</rect>
</rect>
</property>
</property>
<property
name=
"windowTitle"
>
<property
name=
"windowTitle"
>
...
@@ -552,7 +552,7 @@
...
@@ -552,7 +552,7 @@
<string>
Documents Mode
</string>
<string>
Documents Mode
</string>
</property>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout_19"
>
<layout
class=
"QGridLayout"
name=
"gridLayout_19"
>
<item
row=
"0"
column=
"
0
"
>
<item
row=
"0"
column=
"
1
"
>
<layout
class=
"QGridLayout"
name=
"gridLayout_18"
>
<layout
class=
"QGridLayout"
name=
"gridLayout_18"
>
<item
row=
"0"
column=
"1"
>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QCheckBox"
name=
"showDateColumnOnAlphabeticalSort"
>
<widget
class=
"QCheckBox"
name=
"showDateColumnOnAlphabeticalSort"
>
...
@@ -567,7 +567,26 @@
...
@@ -567,7 +567,26 @@
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"0"
column=
"0"
>
<item
row=
"3"
column=
"1"
>
<widget
class=
"QCheckBox"
name=
"emptyTrashForOlderDocuments"
>
<property
name=
"text"
>
<string>
Empty trash for documents older than
</string>
</property>
</widget>
</item>
<item
row=
"3"
column=
"2"
>
<widget
class=
"QSpinBox"
name=
"emptyTrashDaysValue"
/>
</item>
<item
row=
"3"
column=
"3"
>
<widget
class=
"QLabel"
name=
"emptyTrashDaysLabel"
>
<property
name=
"text"
>
<string>
days
</string>
</property>
</widget>
</item>
</layout>
</item>
<item
row=
"0"
column=
"0"
rowspan=
"2"
>
<spacer
name=
"horizontalSpacer_9"
>
<spacer
name=
"horizontalSpacer_9"
>
<property
name=
"orientation"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
<enum>
Qt::Horizontal
</enum>
...
@@ -583,7 +602,18 @@
...
@@ -583,7 +602,18 @@
</property>
</property>
</spacer>
</spacer>
</item>
</item>
</layout>
<item
row=
"0"
column=
"2"
>
<spacer
name=
"horizontalSpacer_10"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
</item>
</layout>
</layout>
</widget>
</widget>
...
...
src/core/UBApplication.cpp
View file @
05d672a8
...
@@ -451,6 +451,12 @@ void UBApplication::closeEvent(QCloseEvent *event)
...
@@ -451,6 +451,12 @@ void UBApplication::closeEvent(QCloseEvent *event)
void
UBApplication
::
closing
()
void
UBApplication
::
closing
()
{
{
if
(
UBSettings
::
settings
()
->
emptyTrashForOlderDocuments
->
get
().
toBool
())
{
UBDocumentTreeModel
*
docModel
=
UBPersistenceManager
::
persistenceManager
()
->
mDocumentTreeStructureModel
;
documentController
->
deleteDocumentsInFolderOlderThan
(
docModel
->
trashIndex
(),
UBSettings
::
settings
()
->
emptyTrashDaysValue
->
get
().
toInt
());
documentController
->
deleteEmptyFolders
(
docModel
->
trashIndex
());
}
if
(
boardController
)
if
(
boardController
)
boardController
->
closing
();
boardController
->
closing
();
...
...
src/core/UBPreferencesController.cpp
View file @
05d672a8
...
@@ -138,8 +138,12 @@ void UBPreferencesController::wire()
...
@@ -138,8 +138,12 @@ void UBPreferencesController::wire()
connect
(
mPreferencesUI
->
useSystemOSKCheckBox
,
SIGNAL
(
clicked
(
bool
)),
settings
->
useSystemOnScreenKeyboard
,
SLOT
(
setBool
(
bool
)));
connect
(
mPreferencesUI
->
useSystemOSKCheckBox
,
SIGNAL
(
clicked
(
bool
)),
settings
->
useSystemOnScreenKeyboard
,
SLOT
(
setBool
(
bool
)));
connect
(
mPreferencesUI
->
useSystemOSKCheckBox
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
systemOSKCheckBoxToggled
(
bool
)));
connect
(
mPreferencesUI
->
useSystemOSKCheckBox
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
systemOSKCheckBoxToggled
(
bool
)));
// Documents Mode preferences
connect
(
mPreferencesUI
->
showDateColumnOnAlphabeticalSort
,
SIGNAL
(
clicked
(
bool
)),
settings
->
showDateColumnOnAlphabeticalSort
,
SLOT
(
setBool
(
bool
)));
connect
(
mPreferencesUI
->
showDateColumnOnAlphabeticalSort
,
SIGNAL
(
clicked
(
bool
)),
settings
->
showDateColumnOnAlphabeticalSort
,
SLOT
(
setBool
(
bool
)));
connect
(
mPreferencesUI
->
showDateColumnOnAlphabeticalSort
,
SIGNAL
(
clicked
(
bool
)),
UBApplication
::
documentController
,
SLOT
(
refreshDateColumns
()));
connect
(
mPreferencesUI
->
showDateColumnOnAlphabeticalSort
,
SIGNAL
(
clicked
(
bool
)),
UBApplication
::
documentController
,
SLOT
(
refreshDateColumns
()));
connect
(
mPreferencesUI
->
emptyTrashForOlderDocuments
,
SIGNAL
(
clicked
(
bool
)),
settings
->
emptyTrashForOlderDocuments
,
SLOT
(
setBool
(
bool
)));
connect
(
mPreferencesUI
->
emptyTrashDaysValue
,
SIGNAL
(
valueChanged
(
int
)),
settings
->
emptyTrashDaysValue
,
SLOT
(
setInt
(
int
)));
connect
(
mPreferencesUI
->
keyboardPaletteKeyButtonSize
,
SIGNAL
(
currentIndexChanged
(
const
QString
&
)),
settings
->
boardKeyboardPaletteKeyBtnSize
,
SLOT
(
setString
(
const
QString
&
)));
connect
(
mPreferencesUI
->
keyboardPaletteKeyButtonSize
,
SIGNAL
(
currentIndexChanged
(
const
QString
&
)),
settings
->
boardKeyboardPaletteKeyBtnSize
,
SLOT
(
setString
(
const
QString
&
)));
connect
(
mPreferencesUI
->
startModeComboBox
,
SIGNAL
(
currentIndexChanged
(
int
)),
settings
->
appStartMode
,
SLOT
(
setInt
(
int
)));
connect
(
mPreferencesUI
->
startModeComboBox
,
SIGNAL
(
currentIndexChanged
(
int
)),
settings
->
appStartMode
,
SLOT
(
setInt
(
int
)));
...
@@ -279,6 +283,8 @@ void UBPreferencesController::init()
...
@@ -279,6 +283,8 @@ void UBPreferencesController::init()
this
->
systemOSKCheckBoxToggled
(
mPreferencesUI
->
useSystemOSKCheckBox
->
isChecked
());
this
->
systemOSKCheckBoxToggled
(
mPreferencesUI
->
useSystemOSKCheckBox
->
isChecked
());
mPreferencesUI
->
showDateColumnOnAlphabeticalSort
->
setChecked
(
settings
->
showDateColumnOnAlphabeticalSort
->
get
().
toBool
());
mPreferencesUI
->
showDateColumnOnAlphabeticalSort
->
setChecked
(
settings
->
showDateColumnOnAlphabeticalSort
->
get
().
toBool
());
mPreferencesUI
->
emptyTrashForOlderDocuments
->
setChecked
(
settings
->
emptyTrashForOlderDocuments
->
get
().
toBool
());
mPreferencesUI
->
emptyTrashDaysValue
->
setValue
(
settings
->
emptyTrashDaysValue
->
get
().
toInt
());
mPreferencesUI
->
startModeComboBox
->
setCurrentIndex
(
settings
->
appStartMode
->
get
().
toInt
());
mPreferencesUI
->
startModeComboBox
->
setCurrentIndex
(
settings
->
appStartMode
->
get
().
toInt
());
...
@@ -344,8 +350,13 @@ void UBPreferencesController::defaultSettings()
...
@@ -344,8 +350,13 @@ void UBPreferencesController::defaultSettings()
mPreferencesUI
->
startModeComboBox
->
setCurrentIndex
(
0
);
mPreferencesUI
->
startModeComboBox
->
setCurrentIndex
(
0
);
mPreferencesUI
->
useSystemOSKCheckBox
->
setChecked
(
settings
->
useSystemOnScreenKeyboard
->
reset
().
toBool
());
mPreferencesUI
->
useSystemOSKCheckBox
->
setChecked
(
settings
->
useSystemOnScreenKeyboard
->
reset
().
toBool
());
mPreferencesUI
->
showDateColumnOnAlphabeticalSort
->
setChecked
(
settings
->
showDateColumnOnAlphabeticalSort
->
reset
().
toBool
());
mPreferencesUI
->
showDateColumnOnAlphabeticalSort
->
setChecked
(
settings
->
showDateColumnOnAlphabeticalSort
->
reset
().
toBool
());
UBApplication
::
documentController
->
refreshDateColumns
();
UBApplication
::
documentController
->
refreshDateColumns
();
mPreferencesUI
->
emptyTrashForOlderDocuments
->
setChecked
(
settings
->
emptyTrashForOlderDocuments
->
reset
().
toBool
());
mPreferencesUI
->
emptyTrashDaysValue
->
setValue
(
settings
->
emptyTrashDaysValue
->
reset
().
toInt
());
}
}
else
if
(
mPreferencesUI
->
mainTabWidget
->
currentWidget
()
==
mPreferencesUI
->
penTab
)
else
if
(
mPreferencesUI
->
mainTabWidget
->
currentWidget
()
==
mPreferencesUI
->
penTab
)
{
{
...
...
src/core/UBSettings.cpp
View file @
05d672a8
...
@@ -459,6 +459,8 @@ void UBSettings::init()
...
@@ -459,6 +459,8 @@ void UBSettings::init()
useSystemOnScreenKeyboard
=
new
UBSetting
(
this
,
"App"
,
"UseSystemOnScreenKeyboard"
,
true
);
useSystemOnScreenKeyboard
=
new
UBSetting
(
this
,
"App"
,
"UseSystemOnScreenKeyboard"
,
true
);
showDateColumnOnAlphabeticalSort
=
new
UBSetting
(
this
,
"Document"
,
"ShowDateColumnOnAlphabeticalSort"
,
false
);
showDateColumnOnAlphabeticalSort
=
new
UBSetting
(
this
,
"Document"
,
"ShowDateColumnOnAlphabeticalSort"
,
false
);
emptyTrashForOlderDocuments
=
new
UBSetting
(
this
,
"Document"
,
"emptyTrashForOlderDocuments"
,
true
);
emptyTrashDaysValue
=
new
UBSetting
(
this
,
"Document"
,
"emptyTrashDaysValue"
,
30
);
cleanNonPersistentSettings
();
cleanNonPersistentSettings
();
checkNewSettings
();
checkNewSettings
();
...
...
src/core/UBSettings.h
View file @
05d672a8
...
@@ -415,6 +415,9 @@ class UBSettings : public QObject
...
@@ -415,6 +415,9 @@ class UBSettings : public QObject
UBSetting
*
showDateColumnOnAlphabeticalSort
;
UBSetting
*
showDateColumnOnAlphabeticalSort
;
UBSetting
*
emptyTrashForOlderDocuments
;
UBSetting
*
emptyTrashDaysValue
;
UBSetting
*
magnifierDrawingMode
;
UBSetting
*
magnifierDrawingMode
;
UBSetting
*
autoSaveInterval
;
UBSetting
*
autoSaveInterval
;
...
...
src/document/UBDocumentController.cpp
View file @
05d672a8
...
@@ -762,6 +762,31 @@ bool UBDocumentTreeModel::removeRows(int row, int count, const QModelIndex &pare
...
@@ -762,6 +762,31 @@ bool UBDocumentTreeModel::removeRows(int row, int count, const QModelIndex &pare
return
true
;
return
true
;
}
}
bool
UBDocumentTreeModel
::
containsDocuments
(
const
QModelIndex
&
index
)
{
for
(
int
i
=
0
;
i
<
rowCount
(
index
);
i
++
)
{
QModelIndex
child
=
this
->
index
(
i
,
0
,
index
);
if
(
isCatalog
(
child
))
{
if
(
containsDocuments
(
child
))
{
return
true
;
}
}
else
if
(
isDocument
(
child
))
{
return
true
;
}
else
{
qDebug
()
<<
"Who the hell are you ?"
;
}
}
return
false
;
}
QModelIndex
UBDocumentTreeModel
::
indexForNode
(
UBDocumentTreeNode
*
pNode
)
const
QModelIndex
UBDocumentTreeModel
::
indexForNode
(
UBDocumentTreeNode
*
pNode
)
const
{
{
if
(
pNode
==
0
)
{
if
(
pNode
==
0
)
{
...
@@ -2054,7 +2079,6 @@ void UBDocumentController::setupViews()
...
@@ -2054,7 +2079,6 @@ void UBDocumentController::setupViews()
}
}
}
}
//N/C - NNE - 20140403
void
UBDocumentController
::
refreshDateColumns
()
void
UBDocumentController
::
refreshDateColumns
()
{
{
if
(
UBSettings
::
settings
()
->
documentSortKind
->
get
().
toInt
()
==
UBDocumentController
::
Alphabetical
)
if
(
UBSettings
::
settings
()
->
documentSortKind
->
get
().
toInt
()
==
UBDocumentController
::
Alphabetical
)
...
@@ -2602,6 +2626,69 @@ void UBDocumentController::moveToTrash(QModelIndex &index, UBDocumentTreeModel*
...
@@ -2602,6 +2626,69 @@ void UBDocumentController::moveToTrash(QModelIndex &index, UBDocumentTreeModel*
}
}
//issue 1629 - NNE - 20131212 : END
//issue 1629 - NNE - 20131212 : END
void
UBDocumentController
::
deleteDocumentsInFolderOlderThan
(
const
QModelIndex
&
index
,
const
int
days
)
{
UBDocumentTreeModel
*
docModel
=
UBPersistenceManager
::
persistenceManager
()
->
mDocumentTreeStructureModel
;
QModelIndexList
list
;
for
(
int
i
=
0
;
i
<
docModel
->
rowCount
(
index
);
i
++
)
{
list
<<
docModel
->
index
(
i
,
0
,
index
);
}
foreach
(
QModelIndex
child
,
list
)
{
UBDocumentProxy
*
documentProxy
=
docModel
->
proxyForIndex
(
child
);
if
(
documentProxy
)
{
if
(
documentProxy
->
lastUpdate
()
<
QDateTime
::
currentDateTime
().
addDays
(
-
days
))
{
deleteIndexAndAssociatedData
(
child
);
}
}
else
{
if
(
docModel
->
isCatalog
(
child
))
{
deleteDocumentsInFolderOlderThan
(
child
,
days
);
}
}
}
}
void
UBDocumentController
::
deleteEmptyFolders
(
const
QModelIndex
&
index
)
{
UBDocumentTreeModel
*
docModel
=
UBPersistenceManager
::
persistenceManager
()
->
mDocumentTreeStructureModel
;
QModelIndexList
list
;
for
(
int
i
=
0
;
i
<
docModel
->
rowCount
(
index
);
i
++
)
{
list
<<
docModel
->
index
(
i
,
0
,
index
);
}
if
(
list
.
length
()
>
0
)
{
foreach
(
QModelIndex
child
,
list
)
{
if
(
docModel
->
isCatalog
(
child
))
{
if
(
!
docModel
->
containsDocuments
(
child
))
{
deleteIndexAndAssociatedData
(
child
);
}
}
}
}
else
{
if
(
docModel
->
isCatalog
(
index
))
{
deleteIndexAndAssociatedData
(
index
);
}
}
}
void
UBDocumentController
::
emptyFolder
(
const
QModelIndex
&
index
,
DeletionType
pDeletionType
)
void
UBDocumentController
::
emptyFolder
(
const
QModelIndex
&
index
,
DeletionType
pDeletionType
)
{
{
// Issue NC - CFA - 20131029 : ajout d'une popup de confirmation pour la suppression definitive
// Issue NC - CFA - 20131029 : ajout d'une popup de confirmation pour la suppression definitive
...
...
src/document/UBDocumentController.h
View file @
05d672a8
...
@@ -187,6 +187,8 @@ public:
...
@@ -187,6 +187,8 @@ public:
bool
dropMimeData
(
const
QMimeData
*
data
,
Qt
::
DropAction
action
,
int
row
,
int
column
,
const
QModelIndex
&
parent
);
bool
dropMimeData
(
const
QMimeData
*
data
,
Qt
::
DropAction
action
,
int
row
,
int
column
,
const
QModelIndex
&
parent
);
bool
removeRows
(
int
row
,
int
count
,
const
QModelIndex
&
parent
);
bool
removeRows
(
int
row
,
int
count
,
const
QModelIndex
&
parent
);
bool
containsDocuments
(
const
QModelIndex
&
index
);
QModelIndex
indexForNode
(
UBDocumentTreeNode
*
pNode
)
const
;
QModelIndex
indexForNode
(
UBDocumentTreeNode
*
pNode
)
const
;
QPersistentModelIndex
persistentIndexForNode
(
UBDocumentTreeNode
*
pNode
);
QPersistentModelIndex
persistentIndexForNode
(
UBDocumentTreeNode
*
pNode
);
// bool insertRow(int row, const QModelIndex &parent);
// bool insertRow(int row, const QModelIndex &parent);
...
@@ -414,6 +416,9 @@ class UBDocumentController : public UBDocumentContainer
...
@@ -414,6 +416,9 @@ class UBDocumentController : public UBDocumentContainer
*/
*/
void
moveToTrash
(
QModelIndex
&
index
,
UBDocumentTreeModel
*
docModel
);
void
moveToTrash
(
QModelIndex
&
index
,
UBDocumentTreeModel
*
docModel
);
void
deleteDocumentsInFolderOlderThan
(
const
QModelIndex
&
index
,
const
int
days
);
void
deleteEmptyFolders
(
const
QModelIndex
&
index
);
QModelIndex
mapIndexToSource
(
const
QModelIndex
&
index
);
QModelIndex
mapIndexToSource
(
const
QModelIndex
&
index
);
QModelIndexList
mapIndexesToSource
(
const
QModelIndexList
&
indexes
);
QModelIndexList
mapIndexesToSource
(
const
QModelIndexList
&
indexes
);
...
...
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