File indexing completed on 2025-01-05 03:54:11
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2010-12-06 0007 * Description : An item model based on a static list 0008 * 0009 * SPDX-FileCopyrightText: 2010-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #include "itemlistmodel.h" 0016 0017 // Local includes 0018 0019 #include "digikam_debug.h" 0020 #include "coredbaccess.h" 0021 #include "coredbchangesets.h" 0022 #include "coredbwatch.h" 0023 #include "iteminfo.h" 0024 #include "iteminfolist.h" 0025 0026 namespace Digikam 0027 { 0028 0029 ItemListModel::ItemListModel(QWidget* const parent) 0030 : ItemThumbnailModel(parent) 0031 { 0032 connect(CoreDbAccess::databaseWatch(), SIGNAL(collectionImageChange(CollectionImageChangeset)), 0033 this, SLOT(slotCollectionImageChange(CollectionImageChangeset))); 0034 } 0035 0036 ItemListModel::~ItemListModel() 0037 { 0038 } 0039 0040 void ItemListModel::slotCollectionImageChange(const CollectionImageChangeset& changeset) 0041 { 0042 if (isEmpty()) 0043 { 0044 return; 0045 } 0046 0047 switch (changeset.operation()) 0048 { 0049 case CollectionImageChangeset::Added: 0050 break; 0051 0052 case CollectionImageChangeset::Deleted: 0053 case CollectionImageChangeset::Removed: 0054 case CollectionImageChangeset::RemovedAll: 0055 removeItemInfos(ItemInfoList(changeset.ids())); 0056 break; 0057 0058 default: 0059 break; 0060 } 0061 } 0062 0063 } // namespace Digikam 0064 0065 #include "moc_itemlistmodel.cpp"