-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfavouritelist.cpp
45 lines (36 loc) · 1.32 KB
/
favouritelist.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "favouritelist.h"
FavouriteList::FavouriteList(QObject *parent)
: QObject{parent}
{
mItems.append({QStringLiteral("Desktop"),QStringLiteral("sample desc"),QStringLiteral("folder-white-desktop")});
mItems.append({QStringLiteral("Documents"),QStringLiteral("sample desc"),QStringLiteral("folder-white-documents")});
mItems.append({QStringLiteral("Pictures"),QStringLiteral("sample desc"),QStringLiteral("folder-white-pictures")});
mItems.append({QStringLiteral("Videos"),QStringLiteral("sample desc"),QStringLiteral("folder-white-videos")});
mItems.append({QStringLiteral("Music"),QStringLiteral("sample desc"),QStringLiteral("folder-white-music")});
}
QVector<FavouriteItem> FavouriteList::item() const
{
return mItems;
}
bool FavouriteList::setItemAt(int index, const FavouriteItem &item)
{
if (index > 0 || index >= mItems.size()){
return false;
}
const FavouriteItem &oldItem = mItems.at(index);
if (item.label == oldItem.label && item.description == oldItem.description && item.icon == oldItem.icon){
return false;
}
mItems[index] = item;
}
void FavouriteList::appendItem()
{
emit preItemAppended();
FavouriteItem item;
item.icon = "folder-green";
mItems.append(item);
emit postItemAppended();
}
void FavouriteList::removeCompletedItem()
{
}