File indexing completed on 2025-01-19 07:43:01
0001 /* This file is part of the KDE project 0002 0003 Based in the kcategorizeditemsviewdelegate from kdebase/workspace/libs/plasma/appletbrowser by Ivan Cukic 0004 Copyright (C) 2008 Javier Goday <jgoday@gmail.com> 0005 0006 This program is free software; you can redistribute it and/or 0007 modify it under the terms of the GNU General Public 0008 License as published by the Free Software Foundation; either 0009 version 2 of the License, or (at your option) any later version. 0010 */ 0011 #ifndef TRANSFERHISTORYITEMDELEGATE_H 0012 #define TRANSFERHISTORYITEMDELEGATE_H 0013 0014 #include <QStyledItemDelegate> 0015 0016 #define ICON_SIZE 40 0017 #define PADDING 5 0018 0019 class QAction; 0020 class QModelIndex; 0021 0022 class TransferHistoryItemDelegate : public QStyledItemDelegate 0023 { 0024 Q_OBJECT 0025 public: 0026 TransferHistoryItemDelegate(QWidget *parent); 0027 ~TransferHistoryItemDelegate() override; 0028 0029 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; 0030 QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override; 0031 bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override; 0032 0033 Q_SIGNALS: 0034 void deletedTransfer(const QString &url, const QModelIndex &index); 0035 0036 private Q_SLOTS: 0037 void slotOpenFile(); 0038 void slotDownload(); 0039 void slotDeleteTransfer(); 0040 0041 private: 0042 QWidget *m_view; 0043 QAction *m_actionDelete_Selected; 0044 QAction *m_actionDownload; 0045 QAction *m_openFile; 0046 0047 QModelIndex m_selectedIndex; 0048 }; 0049 #endif