[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [akonadi-next/develop] akonadish/syntax_modules: Print disk usage as part of the stat command
From: Christian Mollekopf <chrigi_1 () fastmail ! fm>
Date: 2015-12-27 12:09:56
Message-ID: E1aDA96-00068m-M4 () scm ! kde ! org
[Download RAW message or body]
Git commit 930a98094b1e3a607ddb59b63b6063fbeae643ce by Christian Mollekopf.
Committed on 27/12/2015 at 12:04.
Pushed by cmollekopf into branch 'develop'.
Print disk usage as part of the stat command
M +9 -0 akonadish/syntax_modules/akonadi_stat.cpp
http://commits.kde.org/akonadi-next/930a98094b1e3a607ddb59b63b6063fbeae643ce
diff --git a/akonadish/syntax_modules/akonadi_stat.cpp \
b/akonadish/syntax_modules/akonadi_stat.cpp index 149ccbd..0ea65dd 100644
--- a/akonadish/syntax_modules/akonadi_stat.cpp
+++ b/akonadish/syntax_modules/akonadi_stat.cpp
@@ -20,6 +20,7 @@
#include <QDebug>
#include <QObject> // tr()
#include <QTimer>
+#include <QDir>
#include "common/resource.h"
#include "common/storage.h"
@@ -52,6 +53,14 @@ void statResources(const QStringList &resources, const State \
&state) state.printLine(QObject::tr("Size [kb]: %1").arg(size), 1);
total += size;
}
+ int diskUsage = 0;
+
+ QDir dir(Akonadi2::storageLocation());
+ for (const auto &folder : dir.entryList(QStringList() << resource + "*")) {
+ diskUsage += Akonadi2::Storage(Akonadi2::storageLocation(), folder, \
Akonadi2::Storage::ReadOnly).diskUsage(); + }
+ auto size = diskUsage / 1024;
+ state.printLine(QObject::tr("Disk usage [kb]: %1").arg(size), 1);
}
state.printLine(QObject::tr("Total [kb]: %1").arg(total));
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic