Commit 508db42a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add userfeedback page

parent a4f605ff
......@@ -9,10 +9,15 @@ add_test(NAME synchronizeresourcedialogtest COMMAND synchronizeresourcedialogtes
ecm_mark_as_test(synchronizeresourcedialogtest)
target_link_libraries(synchronizeresourcedialogtest Qt5::Test Qt5::Widgets KF5::I18n KF5::ItemViews KF5::ConfigCore)
add_executable( pimdataexporterconfiguredialogtest pimdataexporterconfiguredialogtest.cpp ../dialog/pimdataexporterconfiguredialog.cpp ../widgets/pimdataexporterconfigurewidget.cpp ${pimdataexporter_kcfg_SRCS})
add_test(NAME pimdataexporterconfiguredialogtest COMMAND pimdataexporterconfiguredialogtest)
ecm_mark_as_test(pimdataexporterconfiguredialogtest)
target_link_libraries(pimdataexporterconfiguredialogtest Qt5::Test Qt5::Widgets KF5::I18n KF5::ItemViews KF5::ConfigCore KF5::ConfigGui KF5::WidgetsAddons)
set(pimdataexporter_userfeedback_LIB)
if (TARGET KUserFeedbackWidgets)
set(pimdataexporter_userfeedback_LIB KUserFeedbackWidgets)
endif()
#add_executable( pimdataexporterconfiguredialogtest pimdataexporterconfiguredialogtest.cpp ../dialog/pimdataexporterconfiguredialog.cpp ../widgets/pimdataexporterconfigurewidget.cpp ${pimdataexporter_kcfg_SRCS})
#add_test(NAME pimdataexporterconfiguredialogtest COMMAND pimdataexporterconfiguredialogtest)
#ecm_mark_as_test(pimdataexporterconfiguredialogtest)
#target_link_libraries(pimdataexporterconfiguredialogtest ${pimdataexporter_userfeedback_LIB} Qt5::Test Qt5::Widgets KF5::I18n KF5::ItemViews KF5::ConfigCore KF5::ConfigGui KF5::WidgetsAddons)
add_executable( pimdataexporterconfigurewidgettest pimdataexporterconfigurewidgettest.cpp ../widgets/pimdataexporterconfigurewidget.cpp ${pimdataexporter_kcfg_SRCS})
......
......@@ -25,6 +25,14 @@
#include <kpagewidgetmodel.h>
#include "../widgets/pimdataexporterconfigurewidget.h"
#ifdef WITH_KUSERFEEDBACK
#include <KUserFeedback/Provider>
#include <KUserFeedback/FeedbackConfigWidget>
#include "userfeedback/userfeedbackmanager.h"
#include <KConfigGroup>
#include <KSharedConfig>
#endif
PimDataExporterConfigureDialog::PimDataExporterConfigureDialog(QWidget *parent)
: KPageDialog(parent)
{
......@@ -44,15 +52,33 @@ PimDataExporterConfigureDialog::PimDataExporterConfigureDialog(QWidget *parent)
generalPageWidgetPage->setIcon(QIcon::fromTheme(QStringLiteral("network-workgroup")));
addPage(generalPageWidgetPage);
#ifdef WITH_KUSERFEEDBACK
QWidget *userFeedBackWidget = new QWidget;
userFeedBackWidget->setObjectName(QStringLiteral("userFeedBackWidget"));
mUserFeedbackWidget = new KUserFeedback::FeedbackConfigWidget(this);
QHBoxLayout *userFeedBackLayout = new QHBoxLayout(userFeedBackWidget);
userFeedBackLayout->setContentsMargins(0, 0, 0, 0);
userFeedBackLayout->addWidget(mUserFeedbackWidget);
mUserFeedbackWidget->setFeedbackProvider(UserFeedBackManager::self()->userFeedbackProvider());
KPageWidgetItem *userFeedBackPageWidgetPage = new KPageWidgetItem(userFeedBackWidget, i18n("User Feedback"));
addPage(userFeedBackPageWidgetPage);
#endif
buttonBox()->setStandardButtons(QDialogButtonBox::Ok| QDialogButtonBox::Cancel);
connect(buttonBox(), &QDialogButtonBox::accepted, this, &PimDataExporterConfigureDialog::accept);
connect(buttonBox(), &QDialogButtonBox::rejected, this, &PimDataExporterConfigureDialog::reject);
readConfig();
}
PimDataExporterConfigureDialog::~PimDataExporterConfigureDialog()
{
writeConfig();
}
void PimDataExporterConfigureDialog::slotAccepted()
......@@ -60,3 +86,19 @@ void PimDataExporterConfigureDialog::slotAccepted()
mConfigureWidget->save();
accept();
}
void PimDataExporterConfigureDialog::readConfig()
{
KConfigGroup group(KSharedConfig::openConfig(), "PimDataExporterConfigureDialog");
const QSize size = group.readEntry("Size", QSize(600, 400));
if (size.isValid()) {
resize(size);
}
}
void PimDataExporterConfigureDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openConfig(), "PimDataExporterConfigureDialog");
group.writeEntry("Size", size());
group.sync();
}
......@@ -22,6 +22,11 @@
#include <KPageDialog>
#include <QDialog>
#ifdef WITH_KUSERFEEDBACK
namespace KUserFeedback {
class FeedbackConfigWidget;
}
#endif
class PimDataExporterConfigureWidget;
class PimDataExporterConfigureDialog : public KPageDialog
{
......@@ -32,8 +37,13 @@ public:
private:
void slotAccepted();
void readConfig();
void writeConfig();
PimDataExporterConfigureWidget *mConfigureWidget = nullptr;
#ifdef WITH_KUSERFEEDBACK
KUserFeedback::FeedbackConfigWidget *mUserFeedbackWidget = nullptr;
#endif
};
#endif // PIMDATAEXPORTERCONFIGUREDIALOG_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