Commit d27e52b2 authored by Laurent Montel's avatar Laurent Montel 😁

Minor

parent f258bfb7
...@@ -112,11 +112,11 @@ void AutomaticAddContactsJob::slotFetchAllCollections(KJob *job) ...@@ -112,11 +112,11 @@ void AutomaticAddContactsJob::slotFetchAllCollections(KJob *job)
const int nbItemCollection(canCreateItemCollections.size()); const int nbItemCollection(canCreateItemCollections.size());
if (nbItemCollection == 0) { if (nbItemCollection == 0) {
if (KMessageBox::questionYesNo( if (KMessageBox::questionYesNo(
0, Q_NULLPTR,
i18nc("@info", i18nc("@info",
"You must create an address book before adding a contact. Do you want to create an address book?"), "You must create an address book before adding a contact. Do you want to create an address book?"),
i18nc("@title:window", "No Address Book Available")) == KMessageBox::Yes) { i18nc("@title:window", "No Address Book Available")) == KMessageBox::Yes) {
Akonadi::AgentTypeDialog dlg(0); Akonadi::AgentTypeDialog dlg(Q_NULLPTR);
dlg.setWindowTitle(i18n("Add Address Book")); dlg.setWindowTitle(i18n("Add Address Book"));
dlg.agentFilterProxyModel()->addMimeTypeFilter(KContacts::Addressee::mimeType()); dlg.agentFilterProxyModel()->addMimeTypeFilter(KContacts::Addressee::mimeType());
dlg.agentFilterProxyModel()->addMimeTypeFilter(KContacts::ContactGroup::mimeType()); dlg.agentFilterProxyModel()->addMimeTypeFilter(KContacts::ContactGroup::mimeType());
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
#include <KConfigGroup> #include <KConfigGroup>
#include <KSharedConfig> #include <KSharedConfig>
namespace {
QString configGroupName() { return QStringLiteral("Automatic Add Contacts %1"); }
}
AutomaticAddContactsTabWidget::AutomaticAddContactsTabWidget(QWidget *parent, QAbstractItemModel *model) AutomaticAddContactsTabWidget::AutomaticAddContactsTabWidget(QWidget *parent, QAbstractItemModel *model)
: QWidget(parent), : QWidget(parent),
mIdentity(0) mIdentity(0)
...@@ -76,7 +79,7 @@ void AutomaticAddContactsTabWidget::resetSettings() ...@@ -76,7 +79,7 @@ void AutomaticAddContactsTabWidget::resetSettings()
void AutomaticAddContactsTabWidget::loadSettings() void AutomaticAddContactsTabWidget::loadSettings()
{ {
KSharedConfig::Ptr config = KSharedConfig::openConfig(); KSharedConfig::Ptr config = KSharedConfig::openConfig();
KConfigGroup grp = config->group(QStringLiteral("Automatic Add Contacts %1").arg(mIdentity)); KConfigGroup grp = config->group(configGroupName().arg(mIdentity));
mEnabled->setChecked(grp.readEntry("Enabled", false)); mEnabled->setChecked(grp.readEntry("Enabled", false));
mCollectionCombobox->setDefaultCollection(Akonadi::Collection(grp.readEntry("Collection", -1))); mCollectionCombobox->setDefaultCollection(Akonadi::Collection(grp.readEntry("Collection", -1)));
} }
...@@ -89,7 +92,7 @@ void AutomaticAddContactsTabWidget::setIdentity(uint identity) ...@@ -89,7 +92,7 @@ void AutomaticAddContactsTabWidget::setIdentity(uint identity)
void AutomaticAddContactsTabWidget::saveSettings() void AutomaticAddContactsTabWidget::saveSettings()
{ {
KSharedConfig::Ptr config = KSharedConfig::openConfig(); KSharedConfig::Ptr config = KSharedConfig::openConfig();
KConfigGroup grp = config->group(QStringLiteral("Automatic Add Contacts %1").arg(mIdentity)); KConfigGroup grp = config->group(configGroupName().arg(mIdentity));
grp.writeEntry("Enabled", mEnabled->isChecked()); grp.writeEntry("Enabled", mEnabled->isChecked());
grp.writeEntry("Collection", mCollectionCombobox->currentCollection().id()); grp.writeEntry("Collection", mCollectionCombobox->currentCollection().id());
} }
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