File indexing completed on 2024-04-14 05:40:40

0001 /*************************************************************************************
0002  *  Copyright (C) 2012 by Alejandro Fiestas Olivares <afiestas@kde.org>              *
0003  *                                                                                   *
0004  *  This program is free software; you can redistribute it and/or                    *
0005  *  modify it under the terms of the GNU General Public License                      *
0006  *  as published by the Free Software Foundation; either version 2                   *
0007  *  of the License, or (at your option) any later version.                           *
0008  *                                                                                   *
0009  *  This program is distributed in the hope that it will be useful,                  *
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of                   *
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                    *
0012  *  GNU General Public License for more details.                                     *
0013  *                                                                                   *
0014  *  You should have received a copy of the GNU General Public License                *
0015  *  along with this program; if not, write to the Free Software                      *
0016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA   *
0017  *************************************************************************************/
0018 
0019 #ifndef sambamount_H
0020 #define sambamount_H
0021 
0022 #include <kcmodule.h>
0023 #include <KConfigGroup>
0024 #include <KIO/AuthInfo>
0025 
0026 class QStackedLayout;
0027 class QListWidgetItem;
0028 class OrgKdeKPasswdServerInterface;
0029 namespace Ui {
0030     class KCMSambaMount;
0031 }
0032 
0033 class SambaMount : public KCModule
0034 {
0035 Q_OBJECT
0036 public:
0037     SambaMount(QWidget *parent, const QVariantList&);
0038     virtual ~SambaMount();
0039 
0040     void save() override;
0041 
0042 private Q_SLOTS:
0043     void initSambaMounts();
0044     void currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
0045     void mountCreated(KConfigGroup group);
0046     void mountEditted(KConfigGroup group);
0047 
0048     void addBtnClicked();
0049     void rmBtnClicked();
0050 
0051 private:
0052     void addMount(KConfigGroup group);
0053     KConfigGroup mounts();
0054 
0055     bool mountSamba(KConfigGroup group);
0056     bool umountSamba(const QString &name);
0057     bool executeJob(KAuth::ExecuteJob* reply);
0058 
0059     bool m_selectNew = false;
0060     QListWidgetItem *m_newMountItem;
0061     Ui::KCMSambaMount *m_ui;
0062     QStackedLayout *m_layout;
0063     OrgKdeKPasswdServerInterface* m_interface;
0064 };
0065 
0066 #endif // sambamount_h