Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
PIM Messagelib
Commits
89410d44
Commit
89410d44
authored
Feb 20, 2017
by
Laurent Montel
Browse files
Split widget
parent
44a05d7d
Changes
5
Hide whitespace changes
Inline
Side-by-side
messagecomposer/src/CMakeLists.txt
View file @
89410d44
...
...
@@ -50,6 +50,7 @@ set( messagecomposer_recipient_src
recipient/kwindowpositioner.cpp
recipient/distributionlistdialog.cpp
recipient/recipientseditormanager.cpp
recipient/recipientspickerwidget.cpp
)
set
(
messagecomposer_imagescaling_src
...
...
messagecomposer/src/recipient/recipientspicker.cpp
View file @
89410d44
...
...
@@ -20,6 +20,7 @@
*/
#include
"recipientspicker.h"
#include
"recipientspickerwidget.h"
#include
"settings/messagecomposersettings.h"
#include
<Akonadi/Contact/EmailAddressSelectionWidget>
...
...
@@ -51,12 +52,8 @@ RecipientsPicker::RecipientsPicker(QWidget *parent)
QVBoxLayout
*
mainLayout
=
new
QVBoxLayout
(
this
);
mView
=
new
Akonadi
::
EmailAddressSelection
Widget
(
this
);
mView
=
new
RecipientsPicker
Widget
(
this
);
mainLayout
->
addWidget
(
mView
);
mView
->
view
()
->
setSelectionMode
(
QAbstractItemView
::
ExtendedSelection
);
mView
->
view
()
->
setAlternatingRowColors
(
true
);
mView
->
view
()
->
setSortingEnabled
(
true
);
mView
->
view
()
->
sortByColumn
(
0
,
Qt
::
AscendingOrder
);
mainLayout
->
setStretchFactor
(
mView
,
1
);
connect
(
mView
->
view
()
->
selectionModel
(),
&
QItemSelectionModel
::
selectionChanged
,
...
...
@@ -91,7 +88,7 @@ RecipientsPicker::RecipientsPicker(QWidget *parent)
connect
(
mUser2Button
,
&
QPushButton
::
clicked
,
this
,
&
RecipientsPicker
::
slotCcClicked
);
connect
(
mUser3Button
,
&
QPushButton
::
clicked
,
this
,
&
RecipientsPicker
::
slotToClicked
);
mView
->
searchLineEdit
()
->
setFocus
();
mView
->
emailAddressSelectionWidget
()
->
searchLineEdit
()
->
setFocus
();
readConfig
();
...
...
@@ -105,7 +102,7 @@ RecipientsPicker::~RecipientsPicker()
void
RecipientsPicker
::
slotSelectionChanged
()
{
const
bool
hasSelection
=
!
mView
->
selectedAddresses
().
isEmpty
();
const
bool
hasSelection
=
!
mView
->
emailAddressSelectionWidget
()
->
selectedAddresses
().
isEmpty
();
mUser1Button
->
setEnabled
(
hasSelection
);
mUser2Button
->
setEnabled
(
hasSelection
);
mUser3Button
->
setEnabled
(
hasSelection
);
...
...
@@ -148,7 +145,7 @@ void RecipientsPicker::pick(Recipient::Type type)
{
qCDebug
(
MESSAGECOMPOSER_LOG
)
<<
int
(
type
);
const
Akonadi
::
EmailAddressSelection
::
List
selections
=
mView
->
selectedAddresses
();
const
Akonadi
::
EmailAddressSelection
::
List
selections
=
mView
->
emailAddressSelectionWidget
()
->
selectedAddresses
();
const
int
count
=
selections
.
count
();
if
(
count
==
0
)
{
...
...
@@ -211,7 +208,7 @@ void RecipientsPicker::slotSearchLDAP()
connect
(
mLdapSearchDialog
,
&
KLDAP
::
LdapSearchDialog
::
contactsAdded
,
this
,
&
RecipientsPicker
::
ldapSearchResult
);
}
mLdapSearchDialog
->
setSearchText
(
mView
->
searchLineEdit
()
->
text
());
mLdapSearchDialog
->
setSearchText
(
mView
->
emailAddressSelectionWidget
()
->
searchLineEdit
()
->
text
());
mLdapSearchDialog
->
show
();
}
...
...
messagecomposer/src/recipient/recipientspicker.h
View file @
89410d44
...
...
@@ -39,7 +39,7 @@ class LdapSearchDialog;
namespace
MessageComposer
{
class
RecipientsPickerWidget
;
class
RecipientsPicker
:
public
QDialog
{
Q_OBJECT
...
...
@@ -73,7 +73,7 @@ protected Q_SLOTS:
void
slotSelectionChanged
();
private:
Akonadi
::
EmailAddressSelection
Widget
*
mView
;
MessageComposer
::
RecipientsPicker
Widget
*
mView
;
KLDAP
::
LdapSearchDialog
*
mLdapSearchDialog
;
...
...
messagecomposer/src/recipient/recipientspickerwidget.cpp
0 → 100644
View file @
89410d44
/*
Copyright (C) 2017 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
<QHBoxLayout>
#include
<QAbstractItemView>
#include
<QTreeView>
#include
<Akonadi/Contact/EmailAddressSelectionWidget>
using
namespace
MessageComposer
;
RecipientsPickerWidget
::
RecipientsPickerWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
QHBoxLayout
*
layout
=
new
QHBoxLayout
(
this
);
layout
->
setMargin
(
0
);
mView
=
new
Akonadi
::
EmailAddressSelectionWidget
(
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
;
}
messagecomposer/src/recipient/recipientspickerwidget.h
0 → 100644
View file @
89410d44
/*
Copyright (C) 2017 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
();
QTreeView
*
view
()
const
;
Akonadi
::
EmailAddressSelectionWidget
*
emailAddressSelectionWidget
()
const
;
private:
Akonadi
::
EmailAddressSelectionWidget
*
mView
;
};
}
#endif // RECIPIENTSPICKERWIDGET_H
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment