File indexing completed on 2024-10-13 12:14:58

0001 /*
0002     SPDX-FileCopyrightText: 2008, 2015 David Faure <faure@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef KFILECOPYTOMENU_P_H
0008 #define KFILECOPYTOMENU_P_H
0009 
0010 #include <KConfigGroup>
0011 #include <QActionGroup>
0012 #include <QMenu>
0013 #include <QUrl>
0014 
0015 class KFileCopyToMenuPrivate
0016 {
0017 public:
0018     KFileCopyToMenuPrivate(KFileCopyToMenu *qq, QWidget *parentWidget);
0019 
0020     KFileCopyToMenu *const q;
0021     QList<QUrl> m_urls;
0022     QWidget *m_parentWidget;
0023     bool m_readOnly;
0024     bool m_autoErrorHandling;
0025 };
0026 
0027 enum MenuType { Copy, Move };
0028 
0029 // The main menu, shown when opening "Copy To" or "Move To"
0030 // It contains Home Folder, Root Folder, Browse, and recent destinations
0031 class KFileCopyToMainMenu : public QMenu
0032 {
0033     Q_OBJECT
0034 public:
0035     KFileCopyToMainMenu(QMenu *parent, KFileCopyToMenuPrivate *d, MenuType menuType);
0036 
0037     QActionGroup &actionGroup()
0038     {
0039         return m_actionGroup; // used by submenus
0040     }
0041     MenuType menuType() const
0042     {
0043         return m_menuType; // used by submenus
0044     }
0045 
0046 private Q_SLOTS:
0047     void slotAboutToShow();
0048     void slotBrowse();
0049     void slotTriggered(QAction *action);
0050 
0051 private:
0052     void copyOrMoveTo(const QUrl &dest);
0053 
0054 private:
0055     MenuType m_menuType;
0056     QActionGroup m_actionGroup;
0057     KFileCopyToMenuPrivate *d; // this isn't our own d pointer, it's the one for the public class
0058     KConfigGroup m_recentDirsGroup;
0059 };
0060 
0061 // The menu that lists a directory
0062 class KFileCopyToDirectoryMenu : public QMenu
0063 {
0064     Q_OBJECT
0065 public:
0066     KFileCopyToDirectoryMenu(QMenu *parent, KFileCopyToMainMenu *mainMenu, const QString &path);
0067 
0068 private Q_SLOTS:
0069     void slotAboutToShow();
0070 
0071 private:
0072     KFileCopyToMainMenu *m_mainMenu;
0073     QString m_path;
0074 };
0075 
0076 #endif