Commit 5d18d92b authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to QVector

parent 312f294b
cmake_minimum_required(VERSION 3.5)
set(PIM_VERSION "5.13.53")
set(PIM_VERSION "5.13.54")
if (POLICY CMP0053)
cmake_policy(SET CMP0053 NEW)
......
......@@ -583,7 +583,7 @@ QString MessageItem::accessibleText(const Theme *theme, int columnIndex)
return rowsTexts.join(QLatin1Char(' '));
}
void MessageItem::subTreeToList(QList< MessageItem * > &list)
void MessageItem::subTreeToList(QVector< MessageItem * > &list)
{
list.append(this);
const auto childList = childItems();
......
......@@ -183,7 +183,7 @@ public:
* Appends the whole subtree originating at this item
* to the specified list. This item is included!
*/
void subTreeToList(QList< MessageItem * > &list);
void subTreeToList(QVector<MessageItem *> &list);
//
// Colors and fonts shared by all message items.
......
......@@ -4559,8 +4559,8 @@ Qt::ItemFlags Model::flags(const QModelIndex &index) const
QMimeData *MessageList::Core::Model::mimeData(const QModelIndexList &indexes) const
{
QList< MessageItem * > msgs;
for (const QModelIndex &idx : qAsConst(indexes)) {
QVector< MessageItem * > msgs;
for (const QModelIndex &idx : indexes) {
if (idx.isValid()) {
Item *item = static_cast<Item *>(idx.internalPointer());
if (item->type() == MessageList::Core::Item::Message) {
......@@ -4594,7 +4594,7 @@ MessageItem *Model::messageItemByStorageRow(int row) const
return static_cast< MessageItem * >(idx);
}
MessageItemSetReference Model::createPersistentSet(const QList<MessageItem *> &items)
MessageItemSetReference Model::createPersistentSet(const QVector<MessageItem *> &items)
{
if (!d->mPersistentSetManager) {
d->mPersistentSetManager = new MessageItemSetManager();
......@@ -4608,7 +4608,7 @@ MessageItemSetReference Model::createPersistentSet(const QList<MessageItem *> &i
return ref;
}
QList< MessageItem * > Model::persistentSetCurrentMessageItemList(MessageItemSetReference ref)
QList<MessageItem *> Model::persistentSetCurrentMessageItemList(MessageItemSetReference ref)
{
if (d->mPersistentSetManager) {
return d->mPersistentSetManager->messageItems(ref);
......
......@@ -24,6 +24,7 @@
#include <QAbstractItemModel>
#include <QList>
#include <QHash>
#include <QVector>
#include <QMultiHash>
#include <core/enums.h>
......@@ -176,7 +177,7 @@ public:
* while manipulating the view) so be sure to call deletePersistentSet()
* when you no longer need it.
*/
Q_REQUIRED_RESULT MessageItemSetReference createPersistentSet(const QList< MessageItem * > &items);
Q_REQUIRED_RESULT MessageItemSetReference createPersistentSet(const QVector< MessageItem * > &items);
/**
* Returns the list of MessageItems that are still existing in the
......@@ -185,7 +186,7 @@ public:
* but may contain less (even 0) if these MessageItem object were removed
* from the view for some reason.
*/
Q_REQUIRED_RESULT QList< MessageItem * > persistentSetCurrentMessageItemList(MessageItemSetReference ref);
Q_REQUIRED_RESULT QList<MessageItem *> persistentSetCurrentMessageItemList(MessageItemSetReference ref);
/**
* Deletes the persistent set pointed by the specified reference.
......
......@@ -22,7 +22,7 @@
#define MESSAGELIST_CORE_STORAGEMODELBASE_H
#include <QAbstractItemModel>
#include <QVector>
namespace Akonadi {
class MessageStatus;
}
......@@ -116,7 +116,7 @@ public:
* The implementation-specific mime data for this list of items.
* Called when the user initiates a drag from the messagelist.
*/
virtual QMimeData *mimeData(const QList< MessageItem * > &) const = 0;
virtual QMimeData *mimeData(const QVector< MessageItem * > &) const = 0;
using QAbstractItemModel::mimeData;
};
} // namespace Core
......
......@@ -890,9 +890,9 @@ bool View::selectionEmpty() const
return selectionModel()->selectedRows().isEmpty();
}
QList< MessageItem * > View::selectionAsMessageItemList(bool includeCollapsedChildren) const
QVector< MessageItem * > View::selectionAsMessageItemList(bool includeCollapsedChildren) const
{
QList< MessageItem * > selectedMessages;
QVector< MessageItem * > selectedMessages;
QModelIndexList lSelected = selectionModel()->selectedRows();
if (lSelected.isEmpty()) {
......@@ -933,9 +933,9 @@ QList< MessageItem * > View::selectionAsMessageItemList(bool includeCollapsedChi
return selectedMessages;
}
QList<MessageItem *> View::currentThreadAsMessageItemList() const
QVector<MessageItem *> View::currentThreadAsMessageItemList() const
{
QList<MessageItem *> currentThread;
QVector<MessageItem *> currentThread;
MessageItem *msg = currentMessageItem();
if (!msg) {
......@@ -1087,10 +1087,10 @@ void View::setAllGroupsExpanded(bool expand)
}
}
void View::selectMessageItems(const QList< MessageItem * > &list)
void View::selectMessageItems(const QVector< MessageItem * > &list)
{
QItemSelection selection;
for (const auto mi : qAsConst(list)) {
for (const auto mi : list) {
Q_ASSERT(mi);
QModelIndex idx = d->mModel->index(mi, 0);
Q_ASSERT(idx.isValid());
......@@ -1663,7 +1663,7 @@ void View::modelFinishedLoading()
// nothing here for now :)
}
MessageItemSetReference View::createPersistentSet(const QList< MessageItem * > &items)
MessageItemSetReference View::createPersistentSet(const QVector<MessageItem *> &items)
{
return d->mModel->createPersistentSet(items);
}
......
......@@ -24,6 +24,7 @@
#include <QTreeView>
#include <QList>
#include <QPoint>
#include <QVector>
#include <messagelist/enums.h>
#include <messagelist/quicksearchline.h>
......@@ -158,7 +159,7 @@ public:
* to the main even loop. Don't store it for any longer. If you need to reference
* this set of messages at a later stage then take a look at createPersistentSet().
*/
QList< MessageItem * > selectionAsMessageItemList(bool includeCollapsedChildren = true) const;
QVector<MessageItem *> selectionAsMessageItemList(bool includeCollapsedChildren = true) const;
/**
* Returns the MessageItems bound to the current StorageModel that
......@@ -170,7 +171,7 @@ public:
* to the main even loop. Don't store it for any longer. If you need to reference
* this set of messages at a later stage then take a look at createPersistentSet().
*/
QList< MessageItem * > currentThreadAsMessageItemList() const;
QVector< MessageItem * > currentThreadAsMessageItemList() const;
/**
* Fast function that determines if the selection is empty
......@@ -181,7 +182,7 @@ public:
* Selects the specified MessageItems. The current selection is NOT removed.
* Use clearSelection() for that purpose.
*/
void selectMessageItems(const QList< MessageItem * > &list);
void selectMessageItems(const QVector<MessageItem *> &list);
/**
* Creates a persistent set for the specified MessageItems and
......@@ -193,7 +194,7 @@ public:
* while manipulating the view) so be sure to call deletePersistentSet()
* when you no longer need it.
*/
MessageItemSetReference createPersistentSet(const QList< MessageItem * > &items);
MessageItemSetReference createPersistentSet(const QVector< MessageItem * > &items);
/**
* Returns the list of MessageItems that are still existing in the
......
......@@ -1038,7 +1038,7 @@ void Widget::viewSelectionChanged()
{
}
void Widget::viewMessageListContextPopupRequest(const QList< MessageItem * > &, const QPoint &)
void Widget::viewMessageListContextPopupRequest(const QVector< MessageItem * > &, const QPoint &)
{
}
......
......@@ -182,7 +182,7 @@ protected:
/**
* This is called by View when a message is right clicked.
*/
virtual void viewMessageListContextPopupRequest(const QList< MessageItem * > &selectedItems, const QPoint &globalPos);
virtual void viewMessageListContextPopupRequest(const QVector<MessageItem *> &selectedItems, const QPoint &globalPos);
/**
* This is called by View when a group header is right clicked.
......
......@@ -884,11 +884,11 @@ KMime::Message::Ptr Pane::currentMessage() const
return w->currentMessage();
}
QList<KMime::Message::Ptr > Pane::selectionAsMessageList(bool includeCollapsedChildren) const
QVector<KMime::Message::Ptr > Pane::selectionAsMessageList(bool includeCollapsedChildren) const
{
Widget *w = static_cast<Widget *>(currentWidget());
if (w == nullptr) {
return QList<KMime::Message::Ptr>();
return QVector<KMime::Message::Ptr>();
}
return w->selectionAsMessageList(includeCollapsedChildren);
}
......
......@@ -23,6 +23,7 @@
#include <messagelist/view.h>
#include <QHash>
#include <QTabWidget>
#include <QVector>
#include <kmime/kmime_message.h>
#include <collection.h>
......@@ -100,7 +101,7 @@ public:
* to the main even loop. Don't store it for any longer. If you need to reference
* this set of messages at a later stage then take a look at createPersistentSet().
*/
Q_REQUIRED_RESULT QList<KMime::Message::Ptr > selectionAsMessageList(bool includeCollapsedChildren = true) const;
Q_REQUIRED_RESULT QVector<KMime::Message::Ptr> selectionAsMessageList(bool includeCollapsedChildren = true) const;
/**
* Returns the currently selected Items (bound to current StorageModel).
......
......@@ -404,7 +404,7 @@ int StorageModel::rowCount(const QModelIndex &parent) const
return 0; // this model is flat.
}
QMimeData *StorageModel::mimeData(const QList< MessageList::Core::MessageItem * > &items) const
QMimeData *StorageModel::mimeData(const QVector< MessageList::Core::MessageItem * > &items) const
{
QMimeData *data = new QMimeData();
QList<QUrl> urls;
......
......@@ -24,7 +24,7 @@
#include <collection.h>
#include <item.h>
#include <QVector>
#include <kmime/kmime_message.h>
class QAbstractItemModel;
......@@ -72,7 +72,7 @@ public:
Q_REQUIRED_RESULT QModelIndex parent(const QModelIndex &index) const override;
Q_REQUIRED_RESULT int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QMimeData *mimeData(const QList< MessageList::Core::MessageItem * > &) const override;
QMimeData *mimeData(const QVector< MessageList::Core::MessageItem * > &) const override;
using MessageList::Core::StorageModel::mimeData;
Q_REQUIRED_RESULT Akonadi::Item itemForRow(int row) const;
......
......@@ -306,7 +306,7 @@ void Widget::viewSelectionChanged()
}
}
void Widget::viewMessageListContextPopupRequest(const QList< MessageList::Core::MessageItem * > &selectedItems, const QPoint &globalPos)
void Widget::viewMessageListContextPopupRequest(const QVector< MessageList::Core::MessageItem * > &selectedItems, const QPoint &globalPos)
{
Q_UNUSED(selectedItems);
......@@ -468,7 +468,7 @@ void Widget::viewStartDragRequest()
return; // no folder here
}
const QList<Core::MessageItem *> selection = view()->selectionAsMessageItemList();
const QVector<Core::MessageItem *> selection = view()->selectionAsMessageItemList();
if (selection.isEmpty()) {
return;
}
......@@ -525,7 +525,7 @@ void Widget::viewStartDragRequest()
Item::List Widget::Private::selectionAsItems() const
{
Item::List res;
const QList<Core::MessageItem *> selection = q->view()->selectionAsMessageItemList();
const QVector<Core::MessageItem *> selection = q->view()->selectionAsMessageItemList();
res.reserve(selection.count());
for (Core::MessageItem *mi : qAsConst(selection)) {
......@@ -569,10 +569,10 @@ KMime::Message::Ptr Widget::currentMessage() const
return d->messageForRow(mi->currentModelIndexRow());
}
QList<KMime::Message::Ptr > Widget::selectionAsMessageList(bool includeCollapsedChildren) const
QVector<KMime::Message::Ptr > Widget::selectionAsMessageList(bool includeCollapsedChildren) const
{
QList<KMime::Message::Ptr> lstMiPtr;
const QList<Core::MessageItem *> lstMi = view()->selectionAsMessageItemList(includeCollapsedChildren);
QVector<KMime::Message::Ptr> lstMiPtr;
const QVector<Core::MessageItem *> lstMi = view()->selectionAsMessageItemList(includeCollapsedChildren);
if (lstMi.isEmpty()) {
return lstMiPtr;
}
......@@ -586,7 +586,7 @@ QList<KMime::Message::Ptr > Widget::selectionAsMessageList(bool includeCollapsed
Akonadi::Item::List Widget::selectionAsMessageItemList(bool includeCollapsedChildren) const
{
Akonadi::Item::List lstMiPtr;
const QList<Core::MessageItem *> lstMi = view()->selectionAsMessageItemList(includeCollapsedChildren);
const QVector<Core::MessageItem *> lstMi = view()->selectionAsMessageItemList(includeCollapsedChildren);
if (lstMi.isEmpty()) {
return lstMiPtr;
}
......@@ -600,7 +600,7 @@ Akonadi::Item::List Widget::selectionAsMessageItemList(bool includeCollapsedChil
QVector<qlonglong> Widget::selectionAsMessageItemListId(bool includeCollapsedChildren) const
{
QVector<qlonglong> lstMiPtr;
const QList<Core::MessageItem *> lstMi = view()->selectionAsMessageItemList(includeCollapsedChildren);
const QVector<Core::MessageItem *> lstMi = view()->selectionAsMessageItemList(includeCollapsedChildren);
if (lstMi.isEmpty()) {
return lstMiPtr;
}
......@@ -614,7 +614,7 @@ QVector<qlonglong> Widget::selectionAsMessageItemListId(bool includeCollapsedChi
QVector<Akonadi::Item::Id> Widget::selectionAsListMessageId(bool includeCollapsedChildren) const
{
QVector<qlonglong> lstMiPtr;
const QList<Core::MessageItem *> lstMi = view()->selectionAsMessageItemList(includeCollapsedChildren);
const QVector<Core::MessageItem *> lstMi = view()->selectionAsMessageItemList(includeCollapsedChildren);
if (lstMi.isEmpty()) {
return lstMiPtr;
}
......@@ -628,7 +628,7 @@ QVector<Akonadi::Item::Id> Widget::selectionAsListMessageId(bool includeCollapse
Akonadi::Item::List Widget::currentThreadAsMessageList() const
{
Akonadi::Item::List lstMiPtr;
const QList<Core::MessageItem *> lstMi = view()->currentThreadAsMessageItemList();
const QVector<Core::MessageItem *> lstMi = view()->currentThreadAsMessageItemList();
if (lstMi.isEmpty()) {
return lstMiPtr;
}
......@@ -674,7 +674,7 @@ bool Widget::getSelectionStats(
selectedItems.clear();
selectedVisibleItems.clear();
const QList< Core::MessageItem * > selected = view()->selectionAsMessageItemList(includeCollapsedChildren);
const QVector< Core::MessageItem * > selected = view()->selectionAsMessageItemList(includeCollapsedChildren);
Core::MessageItem *topmost = nullptr;
......@@ -725,7 +725,7 @@ Akonadi::Item::List Widget::itemListFromPersistentSet(MessageList::Core::Message
MessageList::Core::MessageItemSetReference Widget::selectionAsPersistentSet(bool includeCollapsedChildren) const
{
QList<Core::MessageItem *> lstMi = view()->selectionAsMessageItemList(includeCollapsedChildren);
QVector<Core::MessageItem *> lstMi = view()->selectionAsMessageItemList(includeCollapsedChildren);
if (lstMi.isEmpty()) {
return -1;
}
......@@ -734,7 +734,7 @@ MessageList::Core::MessageItemSetReference Widget::selectionAsPersistentSet(bool
MessageList::Core::MessageItemSetReference Widget::currentThreadAsPersistentSet() const
{
QList<Core::MessageItem *> lstMi = view()->currentThreadAsMessageItemList();
QVector<Core::MessageItem *> lstMi = view()->currentThreadAsMessageItemList();
if (lstMi.isEmpty()) {
return -1;
}
......
......@@ -28,7 +28,7 @@
#include <AkonadiCore/Item>
#include <messagelist_export.h>
#include <QVector>
class KXMLGUIClient;
class QWidget;
......@@ -207,7 +207,7 @@ public:
* to the main even loop. Don't store it for any longer. If you need to reference
* this set of messages at a later stage then take a look at createPersistentSet().
*/
Q_REQUIRED_RESULT QList<KMime::Message::Ptr > selectionAsMessageList(bool includeCollapsedChildren = true) const;
Q_REQUIRED_RESULT QVector<KMime::Message::Ptr> selectionAsMessageList(bool includeCollapsedChildren = true) const;
/**
* Returns the currently selected Items (bound to current StorageModel).
......@@ -338,7 +338,7 @@ protected:
/**
* Reimplemented from MessageList::Core::Widget
*/
void viewMessageListContextPopupRequest(const QList< MessageList::Core::MessageItem * > &selectedItems, const QPoint &globalPos) override;
void viewMessageListContextPopupRequest(const QVector<Core::MessageItem *> &selectedItems, const QPoint &globalPos) override;
/**
* Reimplemented from MessageList::Core::Widget
......
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