Skip to content

Commit

Permalink
#3118 add: setting to limit note file size in note list
Browse files Browse the repository at this point in the history
Signed-off-by: Patrizio Bekerle <[email protected]>
  • Loading branch information
pbek committed Sep 28, 2024
1 parent fc62b62 commit 0401d62
Show file tree
Hide file tree
Showing 7 changed files with 556 additions and 467 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# QOwnNotes Changelog

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

Expand Down
4 changes: 4 additions & 0 deletions src/dialogs/settingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ SettingsDialog::SettingsDialog(int page, QWidget *parent)
connect(ui->noteEditCentralWidgetCheckBox, SIGNAL(toggled(bool)), this, SLOT(needRestart()));
connect(ui->noteFolderButtonsCheckBox, SIGNAL(toggled(bool)), this, SLOT(needRestart()));
connect(ui->noteListPreviewCheckBox, SIGNAL(toggled(bool)), this, SLOT(needRestart()));
connect(ui->maxNoteFileSizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(needRestart()));
connect(ui->vimModeCheckBox, SIGNAL(toggled(bool)), this, SLOT(needRestart()));
connect(ui->disableCursorBlinkingCheckBox, SIGNAL(toggled(bool)), this, SLOT(needRestart()));
connect(ui->ignoreNoteSubFoldersLineEdit, SIGNAL(textChanged(QString)), this,
Expand Down Expand Up @@ -968,6 +969,8 @@ void SettingsDialog::storePanelSettings() {
settings.setValue(QStringLiteral("taggingShowNotesRecursively"),
ui->taggingShowNotesRecursivelyCheckBox->isChecked());
settings.setValue(QStringLiteral("noteListPreview"), ui->noteListPreviewCheckBox->isChecked());
settings.setValue(QStringLiteral("maxNoteFileSize"),
ui->maxNoteFileSizeSpinBox->value() * 1024);

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

if (settings.value(QStringLiteral("tagsPanelSort")).toInt() == SORT_ALPHABETICAL) {
ui->tagsPanelSortAlphabeticalRadioButton->setChecked(true);
Expand Down
126 changes: 93 additions & 33 deletions src/dialogs/settingsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -5795,59 +5795,111 @@ git config --global user.name &quot;Your name&quot;</string>
<string>Note list panel</string>
</property>
<layout class="QGridLayout" name="gridLayout_61">
<item row="0" column="1" colspan="2">
<widget class="QCheckBox" name="noteSubfoldersPanelShowNotesRecursivelyCheckBox">
<property name="text">
<string>Show all notes in a folder including their subfolders (only works if subfolders are turned on)</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QCheckBox" name="taggingShowNotesRecursivelyCheckBox">
<property name="text">
<string>Show all notes of a tag including the notes of their children-tags</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QGroupBox" name="notesPanelSortGroupBox">
<property name="title">
<string>Sort</string>
<item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="noteListPreviewCheckBox">
<property name="text">
<string>Show notes in the note list with preview</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QFrame" name="maxNoteFileSizeFrame">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Notes larger than this will not be shown in the note list</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_16">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QRadioButton" name="notesPanelSortAlphabeticalRadioButton">
<widget class="QLabel" name="maxNoteFileSizeLabel">
<property name="text">
<string>Alphabetical</string>
<string>Maximum note file size:</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="notesPanelSortByLastChangeRadioButton">
<property name="text">
<string>By last change</string>
<widget class="QSpinBox" name="maxNoteFileSizeSpinBox">
<property name="suffix">
<string notr="true"> KB</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000000</number>
</property>
</widget>
</item>
<item>
<spacer name="maxNoteFileSizeSpacer">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QGroupBox" name="groupBox_39">
<property name="toolTip">
<string>Regular expressions of note files to ignore, separated by &quot;;&quot;</string>
</property>
<item row="5" column="1">
<widget class="QGroupBox" name="notesPanelSortGroupBox">
<property name="title">
<string>Ignored note files</string>
<string>Sort</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_14">
<layout class="QVBoxLayout" name="verticalLayout_16">
<item>
<widget class="QLineEdit" name="ignoredNoteFilesLineEdit">
<property name="placeholderText">
<string>Regular expressions of note files to ignore, separated by &quot;;&quot;</string>
<widget class="QRadioButton" name="notesPanelSortAlphabeticalRadioButton">
<property name="text">
<string>Alphabetical</string>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</widget>
</item>
<item>
<widget class="QRadioButton" name="notesPanelSortByLastChangeRadioButton">
<property name="text">
<string>By last change</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="2">
<item row="5" column="2">
<widget class="QGroupBox" name="notesPanelOrderGroupBox">
<property name="enabled">
<bool>true</bool>
Expand Down Expand Up @@ -5876,18 +5928,26 @@ git config --global user.name &quot;Your name&quot;</string>
</layout>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QCheckBox" name="noteSubfoldersPanelShowNotesRecursivelyCheckBox">
<property name="text">
<string>Show all notes in a folder including their subfolders (only works if subfolders are turned on)</string>
<item row="4" column="1" colspan="2">
<widget class="QGroupBox" name="groupBox_39">
<property name="toolTip">
<string>Regular expressions of note files to ignore, separated by &quot;;&quot;</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="noteListPreviewCheckBox">
<property name="text">
<string>Show notes in the note list with preview</string>
<property name="title">
<string>Ignored note files</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_14">
<item>
<widget class="QLineEdit" name="ignoredNoteFilesLineEdit">
<property name="placeholderText">
<string>Regular expressions of note files to ignore, separated by &quot;;&quot;</string>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
Expand Down
Loading

0 comments on commit 0401d62

Please sign in to comment.