File indexing completed on 2024-05-05 04:51:45

0001 /*
0002     SPDX-FileCopyrightText: 2009-2010 Michal Malek <michalm@jabster.pl>
0003     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef K3B_DATA_VIEW_IMPL_H
0009 #define K3B_DATA_VIEW_IMPL_H
0010 
0011 #include <QAbstractItemModel>
0012 #include <QObject>
0013 #include <QUrl>
0014 
0015 class KActionCollection;
0016 class QAction;
0017 class QSortFilterProxyModel;
0018 class QTreeView;
0019 
0020 namespace K3b {
0021     class ViewColumnAdjuster;
0022     class DataDoc;
0023     class DataItem;
0024     class DataProjectModel;
0025     class DirItem;
0026     class View;
0027 
0028     /**
0029      * This class was created to share code and behaviour between \ref K3b::DataView and \ref K3b::MixedView.
0030      */
0031     class DataViewImpl : public QObject
0032     {
0033         Q_OBJECT
0034 
0035     public:
0036         DataViewImpl( View* view, DataDoc* doc, KActionCollection* actionCollection );
0037 
0038         void addUrls( const QModelIndex& parent, const QList<QUrl>& urls );
0039 
0040         DataProjectModel* model() const { return m_model; }
0041         QTreeView* view() const { return m_fileView; }
0042 
0043     signals:
0044         void setCurrentRoot( const QModelIndex& index );
0045 
0046     public Q_SLOTS:
0047         void slotCurrentRootChanged( const QModelIndex& newRoot );
0048 
0049     private Q_SLOTS:
0050         void slotNewDir();
0051         void slotRemove();
0052         void slotRename();
0053         void slotProperties();
0054         void slotOpen();
0055         void slotSelectionChanged();
0056         void slotItemActivated( const QModelIndex& index );
0057         void slotEnterPressed();
0058         void slotImportSession();
0059         void slotClearImportedSession();
0060         void slotEditBootImages();
0061         void slotImportedSessionChanged( int importedSession );
0062         void slotAddUrlsRequested( QList<QUrl> urls, K3b::DirItem* targetDir );
0063         void slotMoveItemsRequested( QList<K3b::DataItem*> items, K3b::DirItem* targetDir );
0064 
0065     private:
0066         View* m_view;
0067         DataDoc* m_doc;
0068         DataProjectModel* m_model;
0069         QSortFilterProxyModel* m_sortModel;
0070         QTreeView* m_fileView;
0071         ViewColumnAdjuster* m_columnAdjuster;
0072 
0073         QAction* m_actionParentDir;
0074         QAction* m_actionRemove;
0075         QAction* m_actionRename;
0076         QAction* m_actionNewDir;
0077         QAction* m_actionProperties;
0078         QAction* m_actionOpen;
0079         QAction* m_actionImportSession;
0080         QAction* m_actionClearSession;
0081         QAction* m_actionEditBootImages;
0082     };
0083 
0084 } // namespace K3b
0085 
0086 #endif