summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2015-10-20 07:19:08 +0200
committerMontel Laurent <[email protected]>2015-10-20 07:19:08 +0200
commit796984dfafab2e2b38ae21b1200eb7e566b5c33f (patch)
tree8c2a9286b7bbf37d7135b7eaf933667e710718bf
parent0e8563a98d7b92122fffbf1bccbc1700124e144c (diff)
Move to private class
-rw-r--r--libkdepim/src/ldap/addhostdialog.cpp50
-rw-r--r--libkdepim/src/ldap/addhostdialog.h2
-rw-r--r--libkdepim/src/ldap/ldapclientsearch.h1
3 files changed, 31 insertions, 22 deletions
diff --git a/libkdepim/src/ldap/addhostdialog.cpp b/libkdepim/src/ldap/addhostdialog.cpp
index 1c8844f..0e2a3c3 100644
--- a/libkdepim/src/ldap/addhostdialog.cpp
+++ b/libkdepim/src/ldap/addhostdialog.cpp
@@ -36,20 +36,46 @@ using namespace KLDAP;
class KLDAP::AddHostDialogPrivate
{
public:
- AddHostDialogPrivate()
+ AddHostDialogPrivate(AddHostDialog *qq)
: mCfg(Q_NULLPTR),
mServer(Q_NULLPTR),
- mOkButton(Q_NULLPTR)
+ mOkButton(Q_NULLPTR),
+ q(qq)
{
}
+ ~AddHostDialogPrivate()
+ {
+ writeConfig();
+ }
+
+ void readConfig();
+ void writeConfig();
KLDAP::LdapConfigWidget *mCfg;
KLDAP::LdapServer *mServer;
QPushButton *mOkButton;
+ AddHostDialog *q;
};
+void AddHostDialogPrivate::readConfig()
+{
+ KConfigGroup group(KSharedConfig::openConfig(), "AddHostDialog");
+ const QSize size = group.readEntry("Size", QSize(600, 400));
+ if (size.isValid()) {
+ q->resize(size);
+ }
+}
+
+void AddHostDialogPrivate::writeConfig()
+{
+ KConfigGroup group(KSharedConfig::openConfig(), "AddHostDialog");
+ group.writeEntry("Size", q->size());
+ group.sync();
+}
+
+
AddHostDialog::AddHostDialog(KLDAP::LdapServer *server, QWidget *parent)
: QDialog(parent),
- d(new KLDAP::AddHostDialogPrivate)
+ d(new KLDAP::AddHostDialogPrivate(this))
{
setWindowTitle(i18n("Add Host"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
@@ -126,12 +152,11 @@ AddHostDialog::AddHostDialog(KLDAP::LdapServer *server, QWidget *parent)
connect(d->mCfg, &KLDAP::LdapConfigWidget::hostNameChanged, this, &AddHostDialog::slotHostEditChanged);
connect(d->mOkButton, &QPushButton::clicked, this, &AddHostDialog::slotOk);
d->mOkButton->setEnabled(!d->mServer->host().isEmpty());
- readConfig();
+ d->readConfig();
}
AddHostDialog::~AddHostDialog()
{
- writeConfig();
delete d;
}
@@ -140,21 +165,6 @@ void AddHostDialog::slotHostEditChanged(const QString &text)
d->mOkButton->setEnabled(!text.isEmpty());
}
-void AddHostDialog::readConfig()
-{
- KConfigGroup group(KSharedConfig::openConfig(), "AddHostDialog");
- const QSize size = group.readEntry("Size", QSize(600, 400));
- if (size.isValid()) {
- resize(size);
- }
-}
-
-void AddHostDialog::writeConfig()
-{
- KConfigGroup group(KSharedConfig::openConfig(), "AddHostDialog");
- group.writeEntry("Size", size());
- group.sync();
-}
void AddHostDialog::slotOk()
{
diff --git a/libkdepim/src/ldap/addhostdialog.h b/libkdepim/src/ldap/addhostdialog.h
index e50ecdf..d4e9c08 100644
--- a/libkdepim/src/ldap/addhostdialog.h
+++ b/libkdepim/src/ldap/addhostdialog.h
@@ -45,8 +45,6 @@ private Q_SLOTS:
void slotOk();
private:
- void writeConfig();
- void readConfig();
AddHostDialogPrivate *const d;
};
diff --git a/libkdepim/src/ldap/ldapclientsearch.h b/libkdepim/src/ldap/ldapclientsearch.h
index ccd52ef..7a43e3e 100644
--- a/libkdepim/src/ldap/ldapclientsearch.h
+++ b/libkdepim/src/ldap/ldapclientsearch.h
@@ -181,5 +181,6 @@ private:
};
}
+Q_DECLARE_TYPEINFO(KLDAP::LdapResult, Q_MOVABLE_TYPE);
#endif // LDAPCLIENTSEARCH_H