summaryrefslogtreecommitdiffstats
path: root/src/gvcore
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2024-02-21 00:11:00 +0300
committerMichele Calgaro <michele.calgaro@yahoo.it>2024-02-22 18:29:31 +0900
commitc42622ee638e6c422ec5b40e2eaee0fcfe2aceda (patch)
tree5c99bc7f223bff12a7ae81d1249350d600ed4a5a /src/gvcore
parent8f266257f363ae82590d6198f9adf654270b2a90 (diff)
downloadgwenview-c42622ee638e6c422ec5b40e2eaee0fcfe2aceda.tar.gz
gwenview-c42622ee638e6c422ec5b40e2eaee0fcfe2aceda.zip
Make metadata loading optional
See: https://mirror.git.trinitydesktop.org/gitea/TDE/gwenview/issues/17#issuecomment-44076 Signed-off-by: Alexander Golubev <fatzer2@gmail.com> (cherry picked from commit 13d26b59848dce276051f8f322bf82d291aa0c23)
Diffstat (limited to 'src/gvcore')
-rw-r--r--src/gvcore/filethumbnailviewitem.cpp4
-rw-r--r--src/gvcore/fileviewconfig.kcfg3
-rw-r--r--src/gvcore/fileviewcontroller.cpp9
-rw-r--r--src/gvcore/timeutils.cpp19
-rw-r--r--src/gvcore/timeutils.h3
5 files changed, 26 insertions, 12 deletions
diff --git a/src/gvcore/filethumbnailviewitem.cpp b/src/gvcore/filethumbnailviewitem.cpp
index be74115..899bffd 100644
--- a/src/gvcore/filethumbnailviewitem.cpp
+++ b/src/gvcore/filethumbnailviewitem.cpp
@@ -238,7 +238,7 @@ void FileThumbnailViewItem::updateLines() {
TQSize sz;
if (mImageSize.isValid()) {
sz=mImageSize;
- } else {
+ } else if (FileViewConfig::loadMetadata()) {
const KFileMetaInfo& info = mFileItem->metaInfo(/*autogen=*/false);
if (info.isValid()) {
sz = info.value("Dimensions").toSize();
@@ -247,7 +247,7 @@ void FileThumbnailViewItem::updateLines() {
if (sz.isValid()) {
TQString txt = TQString::number(sz.width())+"x"+TQString::number(sz.height());
mLines.append( new CroppedLine(this, txt) );
- } else if ( iconView()->itemTextPos()==TQIconView::Right) {
+ } else if (iconView()->itemTextPos()==TQIconView::Right) {
// add empty line for they would nicely alligned;
// for text at the bottom it doesn't look that nice
mLines.append( new CroppedLine(this, TQString()));
diff --git a/src/gvcore/fileviewconfig.kcfg b/src/gvcore/fileviewconfig.kcfg
index 9ec2ed6..489b48c 100644
--- a/src/gvcore/fileviewconfig.kcfg
+++ b/src/gvcore/fileviewconfig.kcfg
@@ -7,6 +7,9 @@
<entry name="showDirs" key="show dirs" type="Bool">
<default>true</default>
</entry>
+ <entry name="loadMetadata" key="load metadata" type="Bool">
+ <default>true</default>
+ </entry>
<entry name="showDotFiles" key="show dot files" type="Bool">
<default>false</default>
</entry>
diff --git a/src/gvcore/fileviewcontroller.cpp b/src/gvcore/fileviewcontroller.cpp
index 4da91b0..576f9c6 100644
--- a/src/gvcore/fileviewcontroller.cpp
+++ b/src/gvcore/fileviewcontroller.cpp
@@ -1053,7 +1053,9 @@ void FileViewController::dirListerNewItems(const KFileItemList& items) {
LOG("");
mThumbnailsNeedUpdate=true;
currentFileView()->addItemList(items);
- loadMetaInfo(items);
+ if (FileViewConfig::loadMetadata()) {
+ loadMetaInfo(items);
+ }
}
@@ -1063,7 +1065,10 @@ void FileViewController::dirListerRefreshItems(const KFileItemList& list) {
for (; *it!=0L; ++it) {
updateViewItem(*it);
}
- loadMetaInfo(list, true);
+
+ if (FileViewConfig::loadMetadata()) {
+ loadMetaInfo(list, true);
+ }
}
void FileViewController::updateViewItem(const KFileItem *item, bool metaDataOnly) {
diff --git a/src/gvcore/timeutils.cpp b/src/gvcore/timeutils.cpp
index c917232..75dd41f 100644
--- a/src/gvcore/timeutils.cpp
+++ b/src/gvcore/timeutils.cpp
@@ -25,17 +25,22 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <tdefilemetainfo.h>
#include <tdeglobal.h>
#include <tdelocale.h>
-
+
+// Local
+#include "fileviewconfig.h"
+
namespace Gwenview {
namespace TimeUtils {
time_t getTime(const KFileItem* item) {
- const KFileMetaInfo& info = item->metaInfo(/*autogen=*/false);
- if (info.isValid()) {
- TQVariant value = info.value("Date/time");
- TQDateTime dt = value.toDateTime();
- if (dt.isValid()) {
- return dt.toTime_t();
+
+ if (FileViewConfig::loadMetadata()) {
+ const KFileMetaInfo& info = item->metaInfo(/*autogen=*/false);
+ if (info.isValid()) {
+ TQDateTime dt = info.value("Date/time").toDateTime();
+ if (dt.isValid()) {
+ return dt.toTime_t();
+ }
}
}
return item->time(TDEIO::UDS_MODIFICATION_TIME);
diff --git a/src/gvcore/timeutils.h b/src/gvcore/timeutils.h
index 8570b36..53eb065 100644
--- a/src/gvcore/timeutils.h
+++ b/src/gvcore/timeutils.h
@@ -29,7 +29,8 @@ namespace Gwenview {
namespace TimeUtils {
/**
- * Returns the time of an item, using EXIF info if available and already loaded
+ * Returns the time of an item, using EXIF info if available, enabled and
+ * already loaded
*/
time_t getTime(const KFileItem*);