emailuis/nmailui/inc/nmattachmentlist.h
changeset 20 ecc8def7944a
parent 18 578830873419
child 44 c2d07d913565
equal deleted inserted replaced
18:578830873419 20:ecc8def7944a
    26 
    26 
    27 class NmAttachmentList : public QObject
    27 class NmAttachmentList : public QObject
    28 {
    28 {
    29     Q_OBJECT
    29     Q_OBJECT
    30 public:
    30 public:
    31     NmAttachmentList(NmAttachmentListWidget *listWidget);
    31     NmAttachmentList(NmAttachmentListWidget &listWidget);
    32     ~NmAttachmentList();
    32     ~NmAttachmentList();
    33     int insertAttachment(const QString &fullFileName,
    33     int insertAttachment(const QString &fullFileName,
    34                          const QString &fileSize,
    34                          const QString &fileSize,
    35                          const NmId &attachmentPartId);
    35                          const NmId &attachmentPartId);
    36     void setAttachmentPartId(const QString fullFileName, const NmId &attachmentPartId);
    36     void setAttachmentPartId(const QString fullFileName, const NmId &attachmentPartId);
    37     void setAttachmentSize(const NmId &attachmentPartId, const QString &size);
    37     void setAttachmentSize(const NmId &attachmentPartId, const QString &size);
    38     void removeAttachment(int arrayIndex);
    38     void removeAttachment(int arrayIndex);
    39     void removeAttachment(const QString &fullFileName);
    39     void removeAttachment(const QString &fullFileName);
    40     void removeAttachment(const NmId &attachmentPartId);
    40     void removeAttachment(const NmId &attachmentPartId);
    41     NmAttachmentListWidget *listWidget();
    41     NmAttachmentListWidget &listWidget();
    42     void clearList();
    42     void clearList();
    43     int count();
    43     int count();
    44     NmId nmIdByIndex(int listIndex);
    44     NmId nmIdByIndex(int listIndex);
    45     int indexByNmId(const NmId &id);
    45     int indexByNmId(const NmId &id);
       
    46     QString getFullFileNameByIndex(int arrayIndex);
    46 
    47 
    47 private:
    48 private:
    48     QString fullNameToDisplayName(const QString &fullName);
    49     QString fullNameToDisplayName(const QString &fullName);
    49     QString createSizeString(const QString &sizeInBytes);
       
    50     void updateLayout();
    50     void updateLayout();
    51     
    51     
    52 private slots:
    52 private slots:
    53     void delayedLayoutChangeInfo();
    53     void delayedLayoutChangeInfo();
    54 
    54 
    55 signals:
    55 signals:
    56     void attachmentListLayoutChanged();
    56     void attachmentListLayoutChanged();
    57     
    57     
    58 private:
    58 private:
    59     NmAttachmentListWidget *mListWidget; // Not owned
    59     NmAttachmentListWidget &mListWidget; // Not owned
    60     QStringList mFullFileName;
    60     QStringList mFullFileName;
    61     QStringList mDisplayFileName;
    61     QStringList mDisplayFileName;
    62     QStringList mFileSize;
    62     QStringList mFileSize;
    63     QList<NmId> mAttachmentPartId;
    63     QList<NmId> mAttachmentPartId;
    64 };
    64 };