Skip to content

Commit 0401d62

Browse files
committed
#3118 add: setting to limit note file size in note list
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
1 parent fc62b62 commit 0401d62

File tree

7 files changed

+556
-467
lines changed

7 files changed

+556
-467
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# QOwnNotes Changelog
22

33
## 24.9.8
4+
- You can now set the **maximum note file size** in the *Panels settings* to prevent
5+
the loading of very large notes (for [3118](https://github.com/pbek/QOwnNotes/issues/3118))
6+
- Default is 1 MB
47
- The file size will now be shown in the note list tooltip
58
(for [3120](https://github.com/pbek/QOwnNotes/issues/3120))
69

src/dialogs/settingsdialog.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ SettingsDialog::SettingsDialog(int page, QWidget *parent)
233233
connect(ui->noteEditCentralWidgetCheckBox, SIGNAL(toggled(bool)), this, SLOT(needRestart()));
234234
connect(ui->noteFolderButtonsCheckBox, SIGNAL(toggled(bool)), this, SLOT(needRestart()));
235235
connect(ui->noteListPreviewCheckBox, SIGNAL(toggled(bool)), this, SLOT(needRestart()));
236+
connect(ui->maxNoteFileSizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(needRestart()));
236237
connect(ui->vimModeCheckBox, SIGNAL(toggled(bool)), this, SLOT(needRestart()));
237238
connect(ui->disableCursorBlinkingCheckBox, SIGNAL(toggled(bool)), this, SLOT(needRestart()));
238239
connect(ui->ignoreNoteSubFoldersLineEdit, SIGNAL(textChanged(QString)), this,
@@ -968,6 +969,8 @@ void SettingsDialog::storePanelSettings() {
968969
settings.setValue(QStringLiteral("taggingShowNotesRecursively"),
969970
ui->taggingShowNotesRecursivelyCheckBox->isChecked());
970971
settings.setValue(QStringLiteral("noteListPreview"), ui->noteListPreviewCheckBox->isChecked());
972+
settings.setValue(QStringLiteral("maxNoteFileSize"),
973+
ui->maxNoteFileSizeSpinBox->value() * 1024);
971974

972975
ui->tagsPanelSortAlphabeticalRadioButton->isChecked()
973976
? settings.setValue(QStringLiteral("tagsPanelSort"), SORT_ALPHABETICAL)
@@ -1495,6 +1498,7 @@ void SettingsDialog::readPanelSettings() {
14951498
ui->taggingShowNotesRecursivelyCheckBox->setChecked(
14961499
settings.value(QStringLiteral("taggingShowNotesRecursively")).toBool());
14971500
ui->noteListPreviewCheckBox->setChecked(Utils::Misc::isNoteListPreview());
1501+
ui->maxNoteFileSizeSpinBox->setValue(Utils::Misc::getMaximumNoteFileSize() / 1024);
14981502

14991503
if (settings.value(QStringLiteral("tagsPanelSort")).toInt() == SORT_ALPHABETICAL) {
15001504
ui->tagsPanelSortAlphabeticalRadioButton->setChecked(true);

src/dialogs/settingsdialog.ui

Lines changed: 93 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5795,59 +5795,111 @@ git config --global user.name &quot;Your name&quot;</string>
57955795
<string>Note list panel</string>
57965796
</property>
57975797
<layout class="QGridLayout" name="gridLayout_61">
5798+
<item row="0" column="1" colspan="2">
5799+
<widget class="QCheckBox" name="noteSubfoldersPanelShowNotesRecursivelyCheckBox">
5800+
<property name="text">
5801+
<string>Show all notes in a folder including their subfolders (only works if subfolders are turned on)</string>
5802+
</property>
5803+
</widget>
5804+
</item>
57985805
<item row="1" column="1" colspan="2">
57995806
<widget class="QCheckBox" name="taggingShowNotesRecursivelyCheckBox">
58005807
<property name="text">
58015808
<string>Show all notes of a tag including the notes of their children-tags</string>
58025809
</property>
58035810
</widget>
58045811
</item>
5805-
<item row="4" column="1">
5806-
<widget class="QGroupBox" name="notesPanelSortGroupBox">
5807-
<property name="title">
5808-
<string>Sort</string>
5812+
<item row="2" column="1" colspan="2">
5813+
<widget class="QCheckBox" name="noteListPreviewCheckBox">
5814+
<property name="text">
5815+
<string>Show notes in the note list with preview</string>
58095816
</property>
5810-
<layout class="QVBoxLayout" name="verticalLayout_16">
5817+
</widget>
5818+
</item>
5819+
<item row="3" column="1" colspan="2">
5820+
<widget class="QFrame" name="maxNoteFileSizeFrame">
5821+
<property name="minimumSize">
5822+
<size>
5823+
<width>0</width>
5824+
<height>0</height>
5825+
</size>
5826+
</property>
5827+
<property name="toolTip">
5828+
<string>Notes larger than this will not be shown in the note list</string>
5829+
</property>
5830+
<layout class="QHBoxLayout" name="horizontalLayout_16">
5831+
<property name="leftMargin">
5832+
<number>0</number>
5833+
</property>
5834+
<property name="topMargin">
5835+
<number>0</number>
5836+
</property>
5837+
<property name="rightMargin">
5838+
<number>0</number>
5839+
</property>
5840+
<property name="bottomMargin">
5841+
<number>0</number>
5842+
</property>
58115843
<item>
5812-
<widget class="QRadioButton" name="notesPanelSortAlphabeticalRadioButton">
5844+
<widget class="QLabel" name="maxNoteFileSizeLabel">
58135845
<property name="text">
5814-
<string>Alphabetical</string>
5846+
<string>Maximum note file size:</string>
58155847
</property>
58165848
</widget>
58175849
</item>
58185850
<item>
5819-
<widget class="QRadioButton" name="notesPanelSortByLastChangeRadioButton">
5820-
<property name="text">
5821-
<string>By last change</string>
5851+
<widget class="QSpinBox" name="maxNoteFileSizeSpinBox">
5852+
<property name="suffix">
5853+
<string notr="true"> KB</string>
5854+
</property>
5855+
<property name="minimum">
5856+
<number>1</number>
5857+
</property>
5858+
<property name="maximum">
5859+
<number>1000000</number>
58225860
</property>
58235861
</widget>
58245862
</item>
5863+
<item>
5864+
<spacer name="maxNoteFileSizeSpacer">
5865+
<property name="orientation">
5866+
<enum>Qt::Orientation::Horizontal</enum>
5867+
</property>
5868+
<property name="sizeHint" stdset="0">
5869+
<size>
5870+
<width>40</width>
5871+
<height>20</height>
5872+
</size>
5873+
</property>
5874+
</spacer>
5875+
</item>
58255876
</layout>
58265877
</widget>
58275878
</item>
5828-
<item row="3" column="1" colspan="2">
5829-
<widget class="QGroupBox" name="groupBox_39">
5830-
<property name="toolTip">
5831-
<string>Regular expressions of note files to ignore, separated by &quot;;&quot;</string>
5832-
</property>
5879+
<item row="5" column="1">
5880+
<widget class="QGroupBox" name="notesPanelSortGroupBox">
58335881
<property name="title">
5834-
<string>Ignored note files</string>
5882+
<string>Sort</string>
58355883
</property>
5836-
<layout class="QHBoxLayout" name="horizontalLayout_14">
5884+
<layout class="QVBoxLayout" name="verticalLayout_16">
58375885
<item>
5838-
<widget class="QLineEdit" name="ignoredNoteFilesLineEdit">
5839-
<property name="placeholderText">
5840-
<string>Regular expressions of note files to ignore, separated by &quot;;&quot;</string>
5886+
<widget class="QRadioButton" name="notesPanelSortAlphabeticalRadioButton">
5887+
<property name="text">
5888+
<string>Alphabetical</string>
58415889
</property>
5842-
<property name="clearButtonEnabled">
5843-
<bool>true</bool>
5890+
</widget>
5891+
</item>
5892+
<item>
5893+
<widget class="QRadioButton" name="notesPanelSortByLastChangeRadioButton">
5894+
<property name="text">
5895+
<string>By last change</string>
58445896
</property>
58455897
</widget>
58465898
</item>
58475899
</layout>
58485900
</widget>
58495901
</item>
5850-
<item row="4" column="2">
5902+
<item row="5" column="2">
58515903
<widget class="QGroupBox" name="notesPanelOrderGroupBox">
58525904
<property name="enabled">
58535905
<bool>true</bool>
@@ -5876,18 +5928,26 @@ git config --global user.name &quot;Your name&quot;</string>
58765928
</layout>
58775929
</widget>
58785930
</item>
5879-
<item row="0" column="1" colspan="2">
5880-
<widget class="QCheckBox" name="noteSubfoldersPanelShowNotesRecursivelyCheckBox">
5881-
<property name="text">
5882-
<string>Show all notes in a folder including their subfolders (only works if subfolders are turned on)</string>
5931+
<item row="4" column="1" colspan="2">
5932+
<widget class="QGroupBox" name="groupBox_39">
5933+
<property name="toolTip">
5934+
<string>Regular expressions of note files to ignore, separated by &quot;;&quot;</string>
58835935
</property>
5884-
</widget>
5885-
</item>
5886-
<item row="2" column="1" colspan="2">
5887-
<widget class="QCheckBox" name="noteListPreviewCheckBox">
5888-
<property name="text">
5889-
<string>Show notes in the note list with preview</string>
5936+
<property name="title">
5937+
<string>Ignored note files</string>
58905938
</property>
5939+
<layout class="QHBoxLayout" name="horizontalLayout_14">
5940+
<item>
5941+
<widget class="QLineEdit" name="ignoredNoteFilesLineEdit">
5942+
<property name="placeholderText">
5943+
<string>Regular expressions of note files to ignore, separated by &quot;;&quot;</string>
5944+
</property>
5945+
<property name="clearButtonEnabled">
5946+
<bool>true</bool>
5947+
</property>
5948+
</widget>
5949+
</item>
5950+
</layout>
58915951
</widget>
58925952
</item>
58935953
</layout>

0 commit comments

Comments
 (0)