|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Class for handling the attachment list |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef NMATTACHMENTLIST_H |
|
19 #define NMATTACHMENTLIST_H |
|
20 |
|
21 #include <QObject> |
|
22 #include <QStringList> |
|
23 |
|
24 class NmAttachmentListWidget; |
|
25 class NmId; |
|
26 |
|
27 class NmAttachmentList : public QObject |
|
28 { |
|
29 Q_OBJECT |
|
30 public: |
|
31 NmAttachmentList(NmAttachmentListWidget *listWidget); |
|
32 ~NmAttachmentList(); |
|
33 int insertAttachment(const QString &fullFileName, |
|
34 const QString &fileSize, |
|
35 const NmId &attachmentPartId); |
|
36 void setAttachmentPartId(const QString fullFileName, const NmId &attachmentPartId); |
|
37 void setAttachmentSize(const NmId &attachmentPartId, const QString &size); |
|
38 void removeAttachment(int arrayIndex); |
|
39 void removeAttachment(const QString &fullFileName); |
|
40 void removeAttachment(const NmId &attachmentPartId); |
|
41 NmAttachmentListWidget *listWidget(); |
|
42 void clearList(); |
|
43 int count(); |
|
44 NmId nmIdByIndex(int listIndex); |
|
45 int indexByNmId(const NmId &id); |
|
46 |
|
47 private: |
|
48 QString fullNameToDisplayName(const QString &fullName); |
|
49 QString createSizeString(const QString &sizeInBytes); |
|
50 void updateLayout(); |
|
51 |
|
52 private slots: |
|
53 void delayedLayoutChangeInfo(); |
|
54 |
|
55 signals: |
|
56 void attachmentListLayoutChanged(); |
|
57 |
|
58 private: |
|
59 NmAttachmentListWidget *mListWidget; // Not owned |
|
60 QStringList mFullFileName; |
|
61 QStringList mDisplayFileName; |
|
62 QStringList mFileSize; |
|
63 QList<NmId> mAttachmentPartId; |
|
64 }; |
|
65 |
|
66 #endif // NMATTACHMENTLIST_H |