File indexing completed on 2025-01-19 03:50:38
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2017-11-02 0007 * Description : Implementation of grouping specific functions for views 0008 * 0009 * SPDX-FileCopyrightText: 2017 by Simon Frei <freisim93 at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #include "groupingviewimplementation.h" 0016 0017 // Qt includes 0018 0019 #include <QMimeData> 0020 0021 // Local includes 0022 0023 #include "iteminfolist.h" 0024 0025 namespace Digikam 0026 { 0027 0028 bool GroupingViewImplementation::needGroupResolving(ApplicationSettings::OperationType type, const ItemInfoList& infos) const 0029 { 0030 ApplicationSettings::ApplyToEntireGroup applyAll = ApplicationSettings::instance()->getGroupingOperateOnAll(type); 0031 0032 if (applyAll == ApplicationSettings::No) 0033 { 0034 return false; 0035 } 0036 0037 Q_FOREACH (const ItemInfo& info, infos) 0038 { 0039 if (hasHiddenGroupedImages(info)) 0040 { 0041 if (applyAll == ApplicationSettings::Yes) 0042 { 0043 return true; 0044 } 0045 0046 return ApplicationSettings::instance()->askGroupingOperateOnAll(type); 0047 } 0048 } 0049 0050 return false; 0051 } 0052 0053 ItemInfoList GroupingViewImplementation::resolveGrouping(const ItemInfoList& infos) const 0054 { 0055 ItemInfoList outInfos; 0056 0057 Q_FOREACH (const ItemInfo& info, infos) 0058 { 0059 outInfos << info; 0060 0061 if (hasHiddenGroupedImages(info)) 0062 { 0063 outInfos << info.groupedImages(); 0064 } 0065 } 0066 0067 return outInfos; 0068 } 0069 0070 ItemInfoList GroupingViewImplementation::getHiddenGroupedInfos(const ItemInfoList& infos) const 0071 { 0072 ItemInfoList outInfos; 0073 0074 Q_FOREACH (const ItemInfo& info, infos) 0075 { 0076 if (hasHiddenGroupedImages(info)) 0077 { 0078 outInfos << info.groupedImages(); 0079 } 0080 } 0081 0082 return outInfos; 0083 } 0084 0085 } // namespace Digikam