Commit b893c7f8 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use new api

parent 8b802c84
......@@ -35,7 +35,7 @@ set(LIBKDEPIM_LIB_VERSION "5.12.40")
set(LIBKLEO_LIB_VERSION "5.12.40")
set(PIMCOMMON_LIB_VERSION "5.12.40")
set(GPGME_LIB_VERSION "1.11.1")
set(AKONADI_CONTACT_VERSION "5.12.40")
set(AKONADI_CONTACT_VERSION "5.12.41")
if (${MIMETREEPARSER_ONLY_BUILD})
set(ECM_VERSION "5.26.0")
......
......@@ -54,8 +54,6 @@ set( messagecomposer_recipient_src
recipient/recipientseditorsidewidget.cpp
recipient/kwindowpositioner.cpp
recipient/distributionlistdialog.cpp
recipient/recipientseditormanager.cpp
recipient/recipientspickerwidget.cpp
)
set( messagecomposer_imagescaling_src
......
/*
Copyright (C) 2017-2019 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "recipientseditormanager.h"
#include <Akonadi/Contact/EmailAddressSelectionModel>
#include <Akonadi/Contact/ContactsTreeModel>
using namespace MessageComposer;
RecipientsEditorManager::RecipientsEditorManager(QObject *parent)
: QObject(parent)
{
}
RecipientsEditorManager::~RecipientsEditorManager()
{
}
RecipientsEditorManager *RecipientsEditorManager::self()
{
static RecipientsEditorManager s_self;
return &s_self;
}
Akonadi::EmailAddressSelectionModel *RecipientsEditorManager::model()
{
if (!mModel) {
mModel = new Akonadi::EmailAddressSelectionModel(this);
}
return mModel;
}
/*
Copyright (C) 2017-2019 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef RECIPIENTSEDITORMANAGER_H
#define RECIPIENTSEDITORMANAGER_H
#include <QObject>
#include "messagecomposer_export.h"
namespace Akonadi {
class EmailAddressSelectionModel;
}
namespace MessageComposer {
class MESSAGECOMPOSER_EXPORT RecipientsEditorManager : public QObject
{
Q_OBJECT
public:
explicit RecipientsEditorManager(QObject *parent = nullptr);
~RecipientsEditorManager();
static RecipientsEditorManager *self();
Q_REQUIRED_RESULT Akonadi::EmailAddressSelectionModel *model();
private:
Akonadi::EmailAddressSelectionModel *mModel = nullptr;
};
}
#endif // RECIPIENTSEDITORMANAGER_H
......@@ -20,10 +20,10 @@
*/
#include "recipientspicker.h"
#include "recipientspickerwidget.h"
#include "settings/messagecomposersettings.h"
#include <Akonadi/Contact/EmailAddressSelectionWidget>
#include <Akonadi/Contact/RecipientsPickerWidget>
#include <kcontacts/contactgroup.h>
#include <Libkdepim/LdapSearchDialog>
......@@ -52,7 +52,7 @@ RecipientsPicker::RecipientsPicker(QWidget *parent)
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mView = new RecipientsPickerWidget(this);
mView = new Akonadi::RecipientsPickerWidget(false, this);
mainLayout->addWidget(mView);
mainLayout->setStretchFactor(mView, 1);
......
......@@ -32,8 +32,11 @@ namespace KLDAP {
class LdapSearchDialog;
}
namespace MessageComposer {
namespace Akonadi {
class RecipientsPickerWidget;
}
namespace MessageComposer {
class RecipientsPicker : public QDialog
{
Q_OBJECT
......@@ -68,7 +71,7 @@ protected Q_SLOTS:
void slotSelectionChanged();
private:
MessageComposer::RecipientsPickerWidget *mView = nullptr;
Akonadi::RecipientsPickerWidget *mView = nullptr;
KLDAP::LdapSearchDialog *mLdapSearchDialog = nullptr;
......
/*
Copyright (C) 2017-2019 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "recipientspickerwidget.h"
#include "recipientseditormanager.h"
#include <QHBoxLayout>
#include <QAbstractItemView>
#include <QTreeView>
#include <Akonadi/Contact/EmailAddressSelectionWidget>
#include <Akonadi/Contact/EmailAddressSelectionModel>
#include <Akonadi/Contact/ContactsTreeModel>
using namespace MessageComposer;
RecipientsPickerWidget::RecipientsPickerWidget(QWidget *parent)
: QWidget(parent)
{
QHBoxLayout *layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
mView = new Akonadi::EmailAddressSelectionWidget(false, MessageComposer::RecipientsEditorManager::self()->model()->model(), this);
layout->addWidget(mView);
mView->view()->setSelectionMode(QAbstractItemView::ExtendedSelection);
mView->view()->setAlternatingRowColors(true);
mView->view()->setSortingEnabled(true);
mView->view()->sortByColumn(0, Qt::AscendingOrder);
}
RecipientsPickerWidget::~RecipientsPickerWidget()
{
}
QTreeView *RecipientsPickerWidget::view() const
{
return mView->view();
}
Akonadi::EmailAddressSelectionWidget *RecipientsPickerWidget::emailAddressSelectionWidget() const
{
return mView;
}
/*
Copyright (C) 2017-2019 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef RECIPIENTSPICKERWIDGET_H
#define RECIPIENTSPICKERWIDGET_H
#include <QWidget>
class QTreeView;
namespace Akonadi {
class EmailAddressSelectionWidget;
}
namespace MessageComposer {
class RecipientsPickerWidget : public QWidget
{
Q_OBJECT
public:
explicit RecipientsPickerWidget(QWidget *parent = nullptr);
~RecipientsPickerWidget();
Q_REQUIRED_RESULT QTreeView *view() const;
Q_REQUIRED_RESULT Akonadi::EmailAddressSelectionWidget *emailAddressSelectionWidget() const;
private:
Akonadi::EmailAddressSelectionWidget *mView = nullptr;
};
}
#endif // RECIPIENTSPICKERWIDGET_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