File indexing completed on 2024-04-14 04:52:14

0001 /* This file is part of the KDE project
0002 
0003    Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org>
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 KGET_LINKVIEW_H
0012 #define KGET_LINKVIEW_H
0013 
0014 #include "../../core/basedialog.h"
0015 
0016 #include "ui_importlinkdialog.h"
0017 
0018 class QAction;
0019 class QModelIndex;
0020 class LinkImporter;
0021 class KGetSortFilterProxyModel;
0022 
0023 class KGetLinkView : public KGetSaveSizeDialog
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     KGetLinkView(QWidget *parent = nullptr);
0029     ~KGetLinkView() override;
0030 
0031     // void setLinks( QList<LinkItem*>& links );
0032     void setLinks(const QStringList &links);
0033     void setPageUrl(const QString &url);
0034     void importUrl(const QString &url = QString());
0035 
0036 Q_SIGNALS:
0037     void leechUrls(const QList<QUrl> &urls);
0038 
0039 private Q_SLOTS:
0040     void slotMimeTypeChanged(int index);
0041     void slotFilterModeChanged(int index);
0042     void slotFilterColumn(QAction *);
0043     void slotStartLeech();
0044     void selectionChanged();
0045     void setTextFilter(const QString &text = QString());
0046     void checkAll();
0047     void uncheckAll();
0048     void uncheckItem(const QModelIndex &index);
0049     void slotCheckSelected();
0050     void slotInvertSelection();
0051     void updateSelectionButtons();
0052     void contextMenuDisplayed(QMenu *menu);
0053     void wildcardPatternToggled(bool enabled);
0054 
0055     // import links slots
0056     void slotStartImport();
0057     void slotImportProgress(int progress);
0058     void slotImportFinished();
0059     void updateImportButtonStatus(const QString &text);
0060 
0061 private:
0062     void checkClipboard();
0063     void showLinks(const QStringList &links, bool urlRequestVisible);
0064 
0065 private:
0066     enum PatternSyntax { Wildcard = 0, RegExp };
0067     Ui::ImportLinkDialog ui;
0068     KGetSortFilterProxyModel *m_proxyModel;
0069     QStringList m_links;
0070     LinkImporter *m_linkImporter;
0071     QMenu *m_patternSyntaxMenu;
0072     QAction *m_nameAction;
0073     QAction *m_urlAction;
0074     QPushButton *m_downloadButton;
0075 };
0076 
0077 #endif // KGET_LINKVIEW_H