File indexing completed on 2024-04-21 15:42:57

0001 /***************************************************************************
0002     smb4ksharesmenu  -  Shares menu
0003                              -------------------
0004     begin                : Mon Sep 05 2011
0005     copyright            : (C) 2011-2019 by Alexander Reinholdt
0006     email                : alexander.reinholdt@kdemail.net
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *   This program is free software; you can redistribute it and/or modify  *
0011  *   it under the terms of the GNU General Public License as published by  *
0012  *   the Free Software Foundation; either version 2 of the License, or     *
0013  *   (at your option) any later version.                                   *
0014  *                                                                         *
0015  *   This program is distributed in the hope that it will be useful, but   *
0016  *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
0017  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
0018  *   General Public License for more details.                              *
0019  *                                                                         *
0020  *   You should have received a copy of the GNU General Public License     *
0021  *   along with this program; if not, write to the                         *
0022  *   Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston,*
0023  *   MA 02110-1335, USA                                                    *
0024  ***************************************************************************/
0025 
0026 #ifndef SMB4KSHARESMENU_H
0027 #define SMB4KSHARESMENU_H
0028 
0029 // application specific includes
0030 #include "core/smb4kglobal.h"
0031 
0032 // Qt includes
0033 #include <QAction>
0034 #include <QActionGroup>
0035 
0036 // KDE includes
0037 #include <KWidgetsAddons/KActionMenu>
0038 #include <KXmlGui/KActionCollection>
0039 
0040 // forward declarations
0041 class Smb4KShare;
0042 
0043 class Smb4KSharesMenu : public KActionMenu
0044 {
0045   Q_OBJECT
0046 
0047   public:
0048     /**
0049      * Constructor
0050      */
0051     explicit Smb4KSharesMenu(QWidget *parentWidget = 0, QObject *parent = 0);
0052 
0053     /**
0054      * Destructor
0055      */
0056     ~Smb4KSharesMenu();
0057 
0058     /**
0059      * Refresh the shares menu
0060      */
0061     void refreshMenu();
0062 
0063   protected slots:
0064     /**
0065      * This slot is connected to the Smb4KMounter::mountedSharesListChanged()
0066      * signal. It refreshes the menu.
0067      */
0068     void slotMountedSharesListChanged();
0069 
0070     /**
0071      * This slot unmounts all shares at once.
0072      */
0073     void slotUnmountAllShares();
0074 
0075     /**
0076      * This slot is called when an action is triggered.
0077      *
0078      * @param action        The action that was triggered
0079      */
0080     void slotShareAction(QAction *action);
0081 
0082   private:
0083     /**
0084      * Setup the menu
0085      */
0086     void setupMenu();
0087 
0088     /**
0089      * Parent widget
0090      */
0091     QWidget *m_parent_widget;
0092 
0093     /**
0094      * Share menus
0095      */
0096     QActionGroup *m_menus;
0097 
0098     /**
0099      * Share actions
0100      */
0101     QActionGroup *m_actions;
0102 };
0103 
0104 #endif