File indexing completed on 2024-12-01 07:38:57
0001 /* This file is part of the KDE project 0002 0003 Copyright (C) 2006 Dario Massarin <nekkar@libero.it> 0004 0005 This program is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU General Public 0007 License as published by the Free Software Foundation; either 0008 version 2 of the License, or (at your option) any later version. 0009 */ 0010 0011 #ifndef TRANSFERSVIEW_H 0012 #define TRANSFERSVIEW_H 0013 0014 #include <QTreeView> 0015 0016 class QMenu; 0017 class TransferHandler; 0018 0019 class TransfersView : public QTreeView 0020 { 0021 Q_OBJECT 0022 0023 public: 0024 TransfersView(QWidget *parent = nullptr); 0025 ~TransfersView() override; 0026 0027 void setModel(QAbstractItemModel *model) override; 0028 0029 private: 0030 void dropEvent(QDropEvent *event) override; 0031 void rowsInserted(const QModelIndex &, int, int) override; 0032 0033 protected: 0034 void dragMoveEvent(QDragMoveEvent *event) override; 0035 void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) override; 0036 0037 public Q_SLOTS: 0038 void closeExpandableDetails(const QModelIndex &index = QModelIndex()); 0039 void closeExpandableDetails(const QModelIndex &parent, int rowStart, int rowEnd); 0040 void slotItemActivated(const QModelIndex &index); 0041 void slotItemCollapsed(const QModelIndex &index); 0042 0043 private Q_SLOTS: 0044 void toggleMainGroup(); // show or hide the first group header if there's only one download group 0045 void slotShowHeaderMenu(const QPoint &point); 0046 void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override; 0047 void slotHideSection(int logicalIndex); 0048 void slotSectionMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex); 0049 void slotSaveHeader(); 0050 void populateHeaderActions(); 0051 0052 private: 0053 QWidget *getDetailsWidgetForTransfer(TransferHandler *handler); 0054 0055 QList<QModelIndex> m_editingIndexes; 0056 QMenu *m_headerMenu = nullptr; 0057 }; 0058 0059 #endif