sambausershareplugin.h 2.32 KB
Newer Older
1
2
/*
  Copyright (c) 2004 Jan Schaefer <j_schaef@informatik.uni-kl.de>
3
  Copyright (c) 2011 Rodrigo Belem <rclbelem@gmail.com>
Nate Graham's avatar
Nate Graham committed
4
  Copyright (c) 2019 Nate Graham <nate@kde.org>
5
6
7
8
9
10
11
12
13
14
15
16
17

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
Dirk Mueller's avatar
Dirk Mueller committed
18
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19
20
21

*/

22
23
#ifndef SAMBAUSERSHAREPLUGIN_H
#define SAMBAUSERSHAREPLUGIN_H
24

25
26
#include <QVariant>
#include <QComboBox>
27
#include <QLabel>
28
29
#include <QProgressBar>
#include <QPushButton>
30
#ifdef SAMBA_INSTALL
31
32
#include <PackageKit/Daemon>
#include <PackageKit/Transaction>
33
#endif // SAMBA_INSTALL
34

35
#include <kpropertiesdialog.h>
Ranveer Aggarwal's avatar
Ranveer Aggarwal committed
36
#include <klocalizedstring.h>
37

38
#include "ui_sambausershareplugin.h"
39
40
41
42

class UserPermissionModel;

class SambaUserSharePlugin : public KPropertiesDialogPlugin
43
{
Rodrigo Belem's avatar
Rodrigo Belem committed
44
45
    Q_OBJECT

46
public:
47
48
    SambaUserSharePlugin(QObject *parent, const QList<QVariant> &args);
    virtual ~SambaUserSharePlugin();
49
    void applyChanges() override;
50

51
private:
52
    QString m_url;
53
54
55
    KSambaShareData shareData;
    UserPermissionModel *model;
    Ui::PropertiesPageGUI propertiesUi;
56
    QWidget *m_failedSambaWidgets;
57
58
    QWidget *m_installSambaWidgets;
    QWidget *m_shareWidgets;
59
    QLabel  *m_sambaStatusMessage;
60
61
    QProgressBar *m_installProgress;
    QPushButton *m_installSambaButton;
62
63
64
65
#ifdef SAMBA_INSTALL
    QWidget *m_justInstalledSambaWidgets;
    QPushButton *m_restartButton;
#endif // SAMBA_INSTALL
66
67
68

    void setupModel();
    void setupViews();
69
    QString getNewShareName() const;
Nate Graham's avatar
Nate Graham committed
70
71
72
73
74
75
    void load();
    void toggleShareStatus(bool checked);
    void checkShareName(const QString &name);
#ifdef SAMBA_INSTALL
    void installSamba();
    void packageFinished(PackageKit::Transaction::Exit status, uint runtime);
76
    void reboot();
Nate Graham's avatar
Nate Graham committed
77
78
#endif // SAMBA_INSTALL

79

80
81
};

82
#endif // SAMBAUSERSHAREPLUGIN_H