diff --git a/core/utilities/maintenance/maintenancetool.cpp b/core/utilities/maintenance/maintenancetool.cpp index bce2d2ac59..7f9bb555ca 100644 --- a/core/utilities/maintenance/maintenancetool.cpp +++ b/core/utilities/maintenance/maintenancetool.cpp @@ -1,112 +1,112 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2012-02-02 * Description : maintenance tool * * Copyright (C) 2012-2020 by Gilles Caulier * Copyright (C) 2012 by Andi Clemens * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; * either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * ============================================================ */ #include "maintenancetool.h" // Qt includes #include #include #include // KDE includes #include // Local includes #include "digikam_debug.h" #include "dnotificationwrapper.h" namespace Digikam { class Q_DECL_HIDDEN MaintenanceTool::Private { public: explicit Private() : notification(true) { } bool notification; QTime duration; }; MaintenanceTool::MaintenanceTool(const QString& id, ProgressItem* const parent) : ProgressItem(parent, id, QString(), QString(), true, true), d(new Private) { // --- NOTE: use dynamic binding as slotCancel() is a virtual method which can be re-implemented in derived classes. - connect(this, static_cast(&ProgressItem::progressItemCanceled), + connect(this, static_cast(&Digikam::ProgressItem::progressItemCanceled), this, &MaintenanceTool::slotCancel); } MaintenanceTool::~MaintenanceTool() { delete d; } void MaintenanceTool::setNotificationEnabled(bool b) { d->notification = b; } void MaintenanceTool::start() { // We delay start to be sure that eventloop connect signals and slots in top level. QTimer::singleShot(0, this, SLOT(slotStart())); } void MaintenanceTool::slotStart() { d->duration.start(); } void MaintenanceTool::slotDone() { QTime t = QTime::fromMSecsSinceStartOfDay(d->duration.elapsed()); if (d->notification) { // Pop-up a message to bring user when all is done. DNotificationWrapper(id(), i18n("Process is done.\nDuration: %1", t.toString()), qApp->activeWindow(), label()); } emit signalComplete(); setComplete(); } void MaintenanceTool::slotCancel() { setComplete(); emit signalCanceled(); } } // namespace Digikam