Commit 6f797102 authored by Aurélien Gâteau's avatar Aurélien Gâteau
Browse files

Added config option to disable history.

svn path=/trunk/KDE/kdegraphics/gwenview/; revision=959685
parent f82696eb
......@@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Qt
// KDE
#include <kglobalsettings.h>
// Local
#include "ui_generalconfigpage.h"
......@@ -93,6 +94,7 @@ ConfigDialog::ConfigDialog(QWidget* parent)
widget = setupPage(d->mPerformanceConfigPage);
pageItem = addPage(widget, i18n("Performance"));
pageItem->setIcon(KIcon("preferences-system-performance"));
d->mPerformanceConfigPage.cacheHelpLabel->setFont(KGlobalSettings::smallestReadableFont());
}
......
......@@ -110,6 +110,9 @@ GvCore::GvCore(QWidget* parent, SortedDirModel* dirModel)
d->mDirModel = dirModel;
d->mRecentFoldersModel = 0;
d->mRecentUrlsModel = 0;
connect(GwenviewConfig::self(), SIGNAL(configChanged()),
SLOT(slotConfigChanged()));
}
......@@ -140,12 +143,18 @@ AbstractSemanticInfoBackEnd* GvCore::semanticInfoBackEnd() const {
void GvCore::addUrlToRecentFolders(const KUrl& url) {
if (!GwenviewConfig::historyEnabled()) {
return;
}
recentFoldersModel();
d->mRecentFoldersModel->addUrl(url);
}
void GvCore::addUrlToRecentUrls(const KUrl& url) {
if (!GwenviewConfig::historyEnabled()) {
return;
}
recentUrlsModel();
d->mRecentUrlsModel->addUrl(url);
}
......@@ -342,4 +351,16 @@ bool GvCore::ensureDocumentIsEditable(const KUrl& url) {
}
static void clearModel(QAbstractItemModel* model) {
model->removeRows(0, model->rowCount());
}
void GvCore::slotConfigChanged() {
if (!GwenviewConfig::historyEnabled()) {
clearModel(recentFoldersModel());
clearModel(recentUrlsModel());
}
}
} // namespace
......@@ -66,6 +66,8 @@ public Q_SLOTS:
void rotateRight(const KUrl&);
void setRating(const KUrl&, int);
private Q_SLOTS:
void slotConfigChanged();
private:
GvCorePrivate* const d;
......
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PerformanceConfigPage</class>
<widget class="QWidget" name="PerformanceConfigPage" >
<property name="geometry" >
<widget class="QWidget" name="PerformanceConfigPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<width>482</width>
<height>300</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<widget class="QCheckBox" name="kcfg_DeleteThumbnailCacheOnExit" >
<property name="text" >
<string>Delete thumbnail cache folder on exit</string>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Cache:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="kcfg_DeleteThumbnailCacheOnExit">
<property name="text">
<string>Delete thumbnail cache folder on exit</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QLabel" name="cacheHelpLabel">
<property name="text">
<string>Enable this option if you do not have a lot of disk space.
Be careful: this will delete the folder named &lt;filename>.thumbnails&lt;/filename> in your home folder, deleting all thumbnails previously generated by Gwenview and other applications.</string>
Be careful: this will delete the folder named &lt;filename&gt;.thumbnails&lt;/filename&gt; in your home folder, deleting all thumbnails previously generated by Gwenview and other applications.</string>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer" >
<property name="orientation" >
<item row="2" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>History:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="kcfg_HistoryEnabled">
<property name="text">
<string>Remember folders and URLs</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>151</height>
......
......@@ -93,6 +93,11 @@ struct StartPagePrivate : public Ui_StartPage{
mTagTitleLabel->hide();
#endif
}
void updateHistoryTab() {
mHistoryWidget->setVisible(GwenviewConfig::historyEnabled());
mHistoryDisabledLabel->setVisible(!GwenviewConfig::historyEnabled());
}
};
static void initViewPalette(QAbstractItemView* view, const QColor& fgColor) {
......@@ -146,6 +151,10 @@ StartPage::StartPage(QWidget* parent, GvCore* gvCore)
SLOT(showRecentFoldersViewContextMenu(const QPoint&)));
d->setupSearchUi(gvCore->semanticInfoBackEnd());
d->updateHistoryTab();
connect(GwenviewConfig::self(), SIGNAL(configChanged()),
SLOT(slotConfigChanged()));
}
......@@ -216,11 +225,13 @@ void StartPage::slotListViewClicked(const QModelIndex& index) {
void StartPage::showEvent(QShowEvent* event) {
if (!d->mRecentFoldersView->model()) {
d->mRecentFoldersView->setModel(d->mGvCore->recentFoldersModel());
}
if (!d->mRecentUrlsView->model()) {
d->mRecentUrlsView->setModel(d->mGvCore->recentUrlsModel());
if (GwenviewConfig::historyEnabled()) {
if (!d->mRecentFoldersView->model()) {
d->mRecentFoldersView->setModel(d->mGvCore->recentFoldersModel());
}
if (!d->mRecentUrlsView->model()) {
d->mRecentUrlsView->setModel(d->mGvCore->recentUrlsModel());
}
}
QFrame::showEvent(event);
}
......@@ -269,4 +280,9 @@ void StartPage::showRecentFoldersViewContextMenu(const QPoint& pos) {
}
void StartPage::slotConfigChanged() {
d->updateHistoryTab();
}
} // namespace
......@@ -58,6 +58,7 @@ private Q_SLOTS:
void slotListViewClicked(const QModelIndex& index);
void showRecentFoldersViewContextMenu(const QPoint& pos);
void slotTagViewClicked(const QModelIndex& index);
void slotConfigChanged();
private:
StartPagePrivate* const d;
......
......@@ -129,85 +129,104 @@
<attribute name="title">
<string>History</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Recent Folders</string>
</property>
<property name="title" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="mHistoryDisabledLabel">
<property name="text">
<string>Recent URLs</string>
<string>History has been disabled.</string>
</property>
<property name="title" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QListView" name="mRecentFoldersView">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>12</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="QListView" name="mRecentUrlsView">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<item>
<widget class="QWidget" name="mHistoryWidget" native="true">
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Recent Folders</string>
</property>
<property name="title" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Recent URLs</string>
</property>
<property name="title" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QListView" name="mRecentFoldersView">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>12</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="QListView" name="mRecentUrlsView">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
......
......@@ -20,6 +20,10 @@
<default>#666666</default>
</entry>
<entry name="HistoryEnabled" type="Bool">
<default>true</default>
</entry>
<entry name="PercentageOfMemoryUsageWarning" type="Double">
<default>0.5</default>
<whatsthis>The percentage of memory used by Gwenview before it
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment