]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/settings/viewpropsprogressinfo.cpp
make use of initializer lists
[dolphin.git] / src / settings / viewpropsprogressinfo.cpp
index 2be0258efdda0ea201510d45087812b0de29c937..9ce3d2de491dbb26f6c211535d893c9015da6199 100644 (file)
 #include <QLabel>
 #include <QProgressBar>
 #include <QTimer>
-#include <QBoxLayout>
+#include <QVBoxLayout>
 
-#include <KLocale>
+#include <KLocalizedString>
 #include <KIO/JobClasses>
 
 #include <views/viewproperties.h>
 
 ViewPropsProgressInfo::ViewPropsProgressInfo(QWidget* parent,
-                                             const KUrl& dir,
+                                             const QUrl& dir,
                                              const ViewProperties& viewProps) :
     KDialog(parent),
     m_dir(dir),
@@ -75,18 +75,18 @@ ViewPropsProgressInfo::ViewPropsProgressInfo(QWidget* parent,
     // allows to give a progress indication for the user when applying the view
     // properties later.
     m_dirSizeJob = KIO::directorySize(dir);
-    connect(m_dirSizeJob, SIGNAL(result(KJob*)),
-            this, SLOT(applyViewProperties()));
+    connect(m_dirSizeJob, &KIO::DirectorySizeJob::result,
+            this, &ViewPropsProgressInfo::applyViewProperties);
 
     // The directory size job cannot emit any progress signal, as it is not aware
     // about the total number of directories. Therefor a timer is triggered, which
     // periodically updates the current directory count.
     m_timer = new QTimer(this);
-    connect(m_timer, SIGNAL(timeout()),
-            this, SLOT(updateProgress()));
+    connect(m_timer, &QTimer::timeout,
+            this, &ViewPropsProgressInfo::updateProgress);
     m_timer->start(300);
 
-    connect(this, SIGNAL(cancelClicked()), this, SLOT(cancelApplying()));
+    connect(this, &ViewPropsProgressInfo::cancelClicked, this, &ViewPropsProgressInfo::cancelApplying);
 }
 
 ViewPropsProgressInfo::~ViewPropsProgressInfo()
@@ -104,12 +104,12 @@ void ViewPropsProgressInfo::closeEvent(QCloseEvent* event)
 
 void ViewPropsProgressInfo::updateProgress()
 {
-    if (m_dirSizeJob != 0) {
+    if (m_dirSizeJob) {
         const int subdirs = m_dirSizeJob->totalSubdirs();
         m_label->setText(i18nc("@info:progress", "Counting folders: %1", subdirs));
     }
 
-    if (m_applyViewPropsJob != 0) {
+    if (m_applyViewPropsJob) {
         const int progress = m_applyViewPropsJob->progress();
         m_progressBar->setValue(progress);
     }
@@ -128,21 +128,20 @@ void ViewPropsProgressInfo::applyViewProperties()
     m_dirSizeJob = 0;
 
     m_applyViewPropsJob = new ApplyViewPropsJob(m_dir, *m_viewProps);
-    connect(m_applyViewPropsJob, SIGNAL(result(KJob*)),
-            this, SLOT(close()));
+    connect(m_applyViewPropsJob, &ApplyViewPropsJob::result,
+            this, &ViewPropsProgressInfo::close);
 }
 
 void ViewPropsProgressInfo::cancelApplying()
 {
-    if (m_dirSizeJob != 0) {
+    if (m_dirSizeJob) {
         m_dirSizeJob->kill();
         m_dirSizeJob = 0;
     }
 
-    if (m_applyViewPropsJob != 0) {
+    if (m_applyViewPropsJob) {
         m_applyViewPropsJob->kill();
         m_applyViewPropsJob = 0;
     }
 }
 
-#include "viewpropsprogressinfo.moc"