File indexing completed on 2024-04-21 04:57:18

0001 /* This file is part of the KDE project
0002 
0003    Copyright (C) 2008 Javier Goday <jgoday@gmail.com>
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 TRANSFERHISTORYCATEGORIZEDVIEW_H
0012 #define TRANSFERHISTORYCATEGORIZEDVIEW_H
0013 
0014 #include "ui/history/transferhistorycategorizeddelegate.h"
0015 
0016 #include <QModelIndex>
0017 #include <QWidget>
0018 
0019 class QDate;
0020 class QStandardItemModel;
0021 class KCategorizedView;
0022 class KCategoryDrawer;
0023 class KCategorizedSortFilterProxyModel;
0024 
0025 class TransferHistoryCategorizedView : public QWidget
0026 {
0027     Q_OBJECT
0028 public:
0029     TransferHistoryCategorizedView(QWidget *parent = nullptr);
0030     ~TransferHistoryCategorizedView() override;
0031 
0032     void addData(const QDate &date, const QString &url, const QString &dest, int size);
0033     QVariant data(const QModelIndex &index, TransferHistoryCategorizedDelegate::AlternativeRoles role) const;
0034 
0035 Q_SIGNALS:
0036     void deletedTransfer(const QString &url, const QModelIndex &index);
0037     void doubleClicked(const QModelIndex &);
0038 
0039 public Q_SLOTS:
0040     void clear();
0041     void setFilterRegExp(const QString &text);
0042     void setCategorizedDelegate(TransferHistoryCategorizedDelegate *m_delegate);
0043     void removeRow(int row, const QModelIndex &parent = QModelIndex());
0044 
0045 private Q_SLOTS:
0046     void update();
0047 
0048 private:
0049     QStandardItemModel *m_model;
0050     KCategorizedView *m_view;
0051     KCategoryDrawer *m_drawer;
0052     KCategorizedSortFilterProxyModel *m_proxyModel;
0053     TransferHistoryCategorizedDelegate *m_delegate;
0054 };
0055 #endif