LeechCraft
0.6.70-19424-g027e980fd1
Modular cross-platform feature rich live environment.
Toggle main menu visibility
Loading...
Searching...
No Matches
tagsfoldersproxymodel.cpp
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#include "
tagsfoldersproxymodel.h
"
10
#include <
util/sll/qtutil.h
>
11
#include <
interfaces/structures.h
>
12
#include <
interfaces/core/itagsmanager.h
>
13
#include "
emitters/tagsmanager.h
"
14
15
namespace
LC::Util
16
{
17
namespace
18
{
19
FlatToFoldersProxyModel::Config
MakeConfig (
const
ITagsManager& tm)
20
{
21
return
22
{
23
.KeysOf_ = [&tm] (
const
QModelIndex& index)
24
{
25
return
tm.
GetTags
(index.data (+
CustomDataRoles::Tags
).value<QList<TagId>> ());
26
},
27
.UnkeyedLabel_ = TagsFoldersProxyModel::tr (
"untagged"
),
28
.DropFormat_ =
"x-leechcraft/tag"
_qs,
29
};
30
}
31
}
32
33
TagsFoldersProxyModel::TagsFoldersProxyModel
(
const
ITagsManager
& tm, QObject *
parent
)
34
:
FlatToFoldersProxyModel
{ MakeConfig (tm),
parent
}
35
{
36
connect (&tm.
GetEmitter
(),
37
&
Emitters::TagsManager::nameReplaced
,
38
this
,
39
&
FlatToFoldersProxyModel::ReplaceKey
);
40
}
41
}
ITagsManager
Tags manager's interface.
Definition
itagsmanager.h:91
ITagsManager::GetTags
virtual QStringList GetTags(const LC::TagId &id) const =0
Returns the tags denoted by the given id.
ITagsManager::GetEmitter
const LC::Util::Emitters::TagsManager & GetEmitter() const
Returns the emitter of this manager's signals.
Definition
itagsmanager.h:99
LC::Util::Emitters::TagsManager::nameReplaced
void nameReplaced(const QString &old, const QStringList &newNames)
Emitted after the name old was replaced with newNames on every tag that had it.
LC::Util::FlatToFoldersProxyModel::ReplaceKey
void ReplaceKey(const QString &old, const QStringList &newKeys)
Updates the folders after the key old was replaced with newKeys on every row that had it,...
Definition
flattofoldersproxymodel.cpp:413
LC::Util::FlatToFoldersProxyModel::FlatToFoldersProxyModel
FlatToFoldersProxyModel(Config, QObject *=nullptr)
Definition
flattofoldersproxymodel.cpp:72
LC::Util::FlatToFoldersProxyModel::parent
QModelIndex parent(const QModelIndex &) const override
Definition
flattofoldersproxymodel.cpp:153
LC::Util::TagsFoldersProxyModel::TagsFoldersProxyModel
TagsFoldersProxyModel(const ITagsManager &, QObject *=nullptr)
Definition
tagsfoldersproxymodel.cpp:33
itagsmanager.h
LC::Util
Definition
icoreproxy.h:34
LC::CustomDataRoles::Tags
@ Tags
Definition
structures.h:178
qtutil.h
LC::Util::FlatToFoldersProxyModel::Config
Definition
flattofoldersproxymodel.h:50
structures.h
tagsfoldersproxymodel.h
tagsmanager.h
src
util
tags
tagsfoldersproxymodel.cpp
Generated by
1.18.0