Commit 86922e6c authored by Laurent Montel's avatar Laurent Montel 😁

Make sure that we reindex collection (test if it works)

parent c9d35508
......@@ -15,4 +15,4 @@ target_link_libraries(dbustest KF5::KIOCore KF5::I18n Qt5::DBus)
#####
set(searchdbustest_SRCS searchdbustest.cpp)
add_executable(searchdbustest ${searchdbustest_SRCS})
target_link_libraries(searchdbustest Qt5::DBus Qt5::Widgets)
target_link_libraries(searchdbustest Qt5::DBus Qt5::Widgets KF5::PimCommon)
......@@ -21,10 +21,32 @@
#include "searchdbustest.h"
#include <QApplication>
#include <QDBusInterface>
#include <QPushButton>
#include <QVBoxLayout>
#include <PimCommon/PimUtil>
#include <QDebug>
searchdbustest::searchdbustest(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *mainlayout = new QVBoxLayout(this);
QPushButton *button = new QPushButton(QStringLiteral("reindex collections"), this);
mainlayout->addWidget(button);
connect(button, &QPushButton::clicked, this, &searchdbustest::slotReindexCollections);
}
void searchdbustest::slotReindexCollections()
{
QDBusInterface interfaceBalooIndexer(PimCommon::Util::indexerServiceName(), QStringLiteral("/"), QStringLiteral("org.freedesktop.Akonadi.Indexer"));
if (interfaceBalooIndexer.isValid()) {
const QList<qlonglong> lst = {100,300};
qDebug() << "reindex "<< lst;
//qCDebug(KMAIL_LOG) << "Reindex collections :" << mCollectionsIndexed;
interfaceBalooIndexer.call(QStringLiteral("reindexCollections"), QVariant::fromValue(lst));
} else {
qDebug()<<" interface is not valid";
}
}
......
......@@ -28,6 +28,8 @@ class searchdbustest : public QWidget
public:
explicit searchdbustest(QWidget *parent = Q_NULLPTR);
~searchdbustest() = default;
private Q_SLOTS:
void slotReindexCollections();
};
#endif // SEARCHDBUSTEST_H
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