summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-02 20:27:06 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-02 20:27:06 (GMT)
commita0ada1fecc4cc60f83ead4c0134609c716654ec9 (patch)
tree679a9a6c14b494639d0818cd3e2da31676d9b1a5
parent8e07e4bb83c560ca6c39e73c93075eb79111c0e1 (diff)
Use an unique qnetworkconfigurationmanager
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/ksieveui/CMakeLists.txt1
-rw-r--r--src/ksieveui/sievenetworkmanager.cpp13
-rw-r--r--src/ksieveui/sievenetworkmanager.h16
-rw-r--r--src/ksieveui/widgets/managesievewidget.cpp14
5 files changed, 33 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fe09cb8..7689941 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
-set(PIM_VERSION "5.3.45")
+set(PIM_VERSION "5.3.46")
set(LIBKSIEVE_LIB_VERSION ${PIM_VERSION})
set(QT_REQUIRED_VERSION "5.6.0")
set(KMIME_LIB_VERSION "5.3.40")
diff --git a/src/ksieveui/CMakeLists.txt b/src/ksieveui/CMakeLists.txt
index 3de79d6..d87e886 100644
--- a/src/ksieveui/CMakeLists.txt
+++ b/src/ksieveui/CMakeLists.txt
@@ -245,6 +245,7 @@ target_include_directories(KF5KSieveUi PUBLIC "$<BUILD_INTERFACE:${libksieve_SOU
ecm_generate_headers(ksieveui_CamelCase_HEADERS
HEADER_NAMES
ManageSieveScriptsDialog
+ SieveNetworkManager
REQUIRED_HEADERS ksieveui_HEADERS
PREFIX KSieveUi
)
diff --git a/src/ksieveui/sievenetworkmanager.cpp b/src/ksieveui/sievenetworkmanager.cpp
index b1c3d92..a0c2045 100644
--- a/src/ksieveui/sievenetworkmanager.cpp
+++ b/src/ksieveui/sievenetworkmanager.cpp
@@ -16,17 +16,28 @@
*/
#include "sievenetworkmanager.h"
+#include <QNetworkConfigurationManager>
+using namespace KSieveUi;
Q_GLOBAL_STATIC(SieveNetworkManager, s_pSieveNetworkManagerSelf)
SieveNetworkManager::SieveNetworkManager(QObject *parent)
: QObject(parent)
{
-
+ mNetworkConfigureManager = new QNetworkConfigurationManager();
}
+SieveNetworkManager::~SieveNetworkManager()
+{
+ delete mNetworkConfigureManager;
+}
SieveNetworkManager *SieveNetworkManager::self()
{
return s_pSieveNetworkManagerSelf();
}
+
+QNetworkConfigurationManager *SieveNetworkManager::networkConfigureManager() const
+{
+ return mNetworkConfigureManager;
+}
diff --git a/src/ksieveui/sievenetworkmanager.h b/src/ksieveui/sievenetworkmanager.h
index 664f70f..5392826 100644
--- a/src/ksieveui/sievenetworkmanager.h
+++ b/src/ksieveui/sievenetworkmanager.h
@@ -19,13 +19,23 @@
#define SIEVENETWORKMANAGER_H
#include <QObject>
-
-class SieveNetworkManager : public QObject
+#include "ksieveui_export.h"
+class QNetworkConfigurationManager;
+namespace KSieveUi
+{
+class KSIEVEUI_EXPORT SieveNetworkManager : public QObject
{
Q_OBJECT
public:
- SieveNetworkManager(QObject *parent = Q_NULLPTR);
+ explicit SieveNetworkManager(QObject *parent = Q_NULLPTR);
+ ~SieveNetworkManager();
static SieveNetworkManager *self();
+
+ QNetworkConfigurationManager *networkConfigureManager() const;
+
+private:
+ QNetworkConfigurationManager *mNetworkConfigureManager;
};
+}
#endif // SIEVENETWORKMANAGER_H
diff --git a/src/ksieveui/widgets/managesievewidget.cpp b/src/ksieveui/widgets/managesievewidget.cpp
index c69354c..3d3589a 100644
--- a/src/ksieveui/widgets/managesievewidget.cpp
+++ b/src/ksieveui/widgets/managesievewidget.cpp
@@ -19,6 +19,8 @@
#include "managesievetreeview.h"
#include "widgets/sievetreewidgetitem.h"
#include "managescriptsjob/renamescriptjob.h"
+#include "libksieve_debug.h"
+#include "sievenetworkmanager.h"
#include <kmanagesieve/sievejob.h>
#include <managescriptsjob/parseuserscriptjob.h>
@@ -33,9 +35,8 @@
#include <QHBoxLayout>
#include <QMenu>
#include <QTimer>
-#include "libksieve_debug.h"
-#include <QNetworkConfigurationManager>
#include <QMetaType>
+#include <QNetworkConfigurationManager>
//#define USE_RENAME_SIEVE_METHOD 1
using namespace KSieveUi;
Q_DECLARE_METATYPE(QTreeWidgetItem *)
@@ -45,7 +46,6 @@ class KSieveUi::ManageSieveWidgetPrivate
public:
ManageSieveWidgetPrivate()
: mTreeView(Q_NULLPTR),
- mNetworkConfigurationManager(Q_NULLPTR),
mClearAll(false),
mBlockSignal(false)
@@ -54,13 +54,11 @@ public:
}
~ManageSieveWidgetPrivate()
{
- delete mNetworkConfigurationManager;
}
// Maps top-level items to their child which has the radio button selection
QMap<QTreeWidgetItem *, QTreeWidgetItem *> mSelectedItems;
ManageSieveTreeView *mTreeView;
- QNetworkConfigurationManager *mNetworkConfigurationManager;
bool mClearAll : 1;
bool mBlockSignal : 1;
};
@@ -80,8 +78,7 @@ ManageSieveWidget::ManageSieveWidget(QWidget *parent)
connect(d->mTreeView, &ManageSieveTreeView::itemSelectionChanged, this, &ManageSieveWidget::slotUpdateButtons);
connect(d->mTreeView, &ManageSieveTreeView::itemChanged, this, &ManageSieveWidget::slotItemChanged);
- d->mNetworkConfigurationManager = new QNetworkConfigurationManager();
- connect(d->mNetworkConfigurationManager, &QNetworkConfigurationManager::onlineStateChanged, this, &ManageSieveWidget::slotSystemNetworkOnlineStateChanged);
+ connect(KSieveUi::SieveNetworkManager::self()->networkConfigureManager(), &QNetworkConfigurationManager::onlineStateChanged, this, &ManageSieveWidget::slotSystemNetworkOnlineStateChanged);
lay->addWidget(d->mTreeView);
setLayout(lay);
@@ -96,7 +93,7 @@ ManageSieveWidget::~ManageSieveWidget()
void ManageSieveWidget::slotCheckNetworkStatus()
{
- slotSystemNetworkOnlineStateChanged(d->mNetworkConfigurationManager->isOnline());
+ slotSystemNetworkOnlineStateChanged(KSieveUi::SieveNetworkManager::self()->networkConfigureManager()->isOnline());
}
void ManageSieveWidget::slotSystemNetworkOnlineStateChanged(bool state)
@@ -415,6 +412,7 @@ void ManageSieveWidget::slotRenameFinished(const QUrl &oldUrl, const QUrl &newUr
void ManageSieveWidget::slotRenameResult(KManageSieve::SieveJob *job, bool success)
{
+ Q_UNUSED(job);
qCDebug(LIBKSIEVE_LOG) << " void ManageSieveWidget::slotRenameResult(KManageSieve::SieveJob *job, bool success)" << success;
slotRefresh();
}