Commit 5bf47a87 authored by Laurent Montel's avatar Laurent Montel 😁

Readd button to reindex collection

parent 5ee56038
......@@ -95,10 +95,30 @@ void CollectionMaintenancePage::init(const Akonadi::Collection &col)
mLastIndexed = new QLabel(i18n("Still not indexed."));
indexingLayout->addWidget(mLastIndexed);
mReindexCollection = new QPushButton(i18n("Reindex current Collection"), this);
connect(mReindexCollection, &QPushButton::clicked, this, &CollectionMaintenancePage::slotReindexCollection);
mReindexCollection->setObjectName(QStringLiteral("reindexbutton"));
indexingLayout->addWidget(mReindexCollection);
topLayout->addWidget(indexingGroup);
topLayout->addStretch(100);
}
void CollectionMaintenancePage::slotReindexCollection()
{
if (mCurrentCollection.isValid()) {
//Don't allow to reindex twice.
mReindexCollection->setEnabled(false);
QDBusInterface interfaceBalooIndexer(QStringLiteral("org.freedesktop.Akonadi.Agent.akonadi_indexing_agent"), QStringLiteral("/"));
if (interfaceBalooIndexer.isValid()) {
interfaceBalooIndexer.call(QStringLiteral("reindexCollection"), QList<QVariant>() << (qlonglong)mCurrentCollection.id());
} else {
qCWarning(KMAIL_LOG) << "indexer interface not valid";
}
}
}
void CollectionMaintenancePage::load(const Collection &col)
{
init(col);
......
......@@ -24,6 +24,7 @@
class QCheckBox;
class QLabel;
class QPushButton;
namespace Akonadi
{
class CollectionStatistics;
......@@ -45,6 +46,7 @@ private Q_SLOTS:
void updateCollectionStatistic(Akonadi::Collection::Id, const Akonadi::CollectionStatistics &);
void onIndexedItemsReceived(qint64 num);
void slotReindexCollection();
private:
void updateLabel(qint64 nbMail, qint64 nbUnreadMail, qint64 size);
......@@ -56,6 +58,7 @@ private:
QLabel *mCollectionUnread;
QCheckBox *mIndexingEnabled;
QLabel *mLastIndexed;
QPushButton *mReindexCollection;
};
AKONADI_COLLECTION_PROPERTIES_PAGE_FACTORY(CollectionMaintenancePageFactory, CollectionMaintenancePage)
......
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