added profile file

This commit is contained in:
arcan1s
2014-02-09 21:09:36 +04:00
parent da7f1488c8
commit 8d3a3d29d2
8 changed files with 250 additions and 624 deletions

View File

@ -23,6 +23,7 @@
#include "errorwindow.h"
#include "netctlinteract.h"
#include "netctlprofile.h"
#include "passwdwidget.h"
#include "wpasupinteract.h"
#include <cstdio>
@ -54,6 +55,7 @@ MainWindow::MainWindow(QWidget *parent)
wpaConfig.append(QString("users"));
netctlCommand = new Netctl(this, netctlPath, profileDir, sudoPath);
netctlProfile = new NetctlProfile(this, profileDir, sudoPath);
wpaCommand = new WpaSup(this, wpaConfig, sudoPath, ifaceDir, preferedInterface);
createActions();
@ -64,6 +66,7 @@ MainWindow::MainWindow(QWidget *parent)
MainWindow::~MainWindow()
{
delete netctlCommand;
delete netctlProfile;
delete wpaCommand;
delete ui;
}
@ -127,6 +130,8 @@ void MainWindow::updateTabs(const int tab)
{
if (tab == 0)
updateMainTab();
else if (tab == 1)
else if (tab == 2)
updateWifiTab();
}
@ -174,6 +179,12 @@ void MainWindow::updateMainTab()
}
void MainWindow::updateProfileTab()
{
}
void MainWindow::updateWifiTab()
{
wifiTabSetEnabled(checkExternalApps(QString("wpasup")));

View File

@ -26,6 +26,7 @@
class ErrorWindow;
class Netctl;
class NetctlProfile;
class PasswdWidget;
class WpaSup;
@ -41,6 +42,7 @@ public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
Netctl *netctlCommand;
NetctlProfile *netctlProfile;
WpaSup *wpaCommand;
enum wpaConfigIndex {
wpaCliPath = 0,
@ -58,6 +60,7 @@ public slots:
private slots:
void updateMainTab();
void updateProfileTab();
void updateWifiTab();
// main tab slots
void mainTabEnableProfile();

View File

@ -19,17 +19,20 @@
#define NETCTLINTERACT_H
#include <QDir>
#include <QWidget>
#include <QObject>
class MainWindow;
class Netctl : public QWidget
class Netctl : public QObject
{
Q_OBJECT
public:
Netctl(MainWindow *wid, QString netctlPath, QString profileDir, QString sudoPath);
explicit Netctl(MainWindow *wid = 0,
QString netctlPath = QString(""),
QString profileDir = QString(""),
QString sudoPath = QString(""));
~Netctl();
// general information
QList<QStringList> getProfileList();
@ -44,7 +47,6 @@ public slots:
bool enableProfile(QString profile);
bool restartProfile(QString profile);
bool startProfile(QString profile);
// bool createProfile(QStringList profileInfo);
private:
MainWindow *parent;

View File

@ -0,0 +1,35 @@
/***************************************************************************
* This file is part of netctl-plasmoid *
* *
* netctl-plasmoid 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 3 of the *
* License, or (at your option) any later version. *
* *
* netctl-plasmoid 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 netctl-plasmoid. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#include "netctlprofile.h"
#include "mainwindow.h"
NetctlProfile::NetctlProfile(MainWindow *wid, QString profileDir, QString sudoPath)
: parent(wid),
profileDirectory(new QDir(profileDir)),
sudoCommand(sudoPath)
{
}
NetctlProfile::~NetctlProfile()
{
delete profileDirectory;
}

View File

@ -0,0 +1,44 @@
/***************************************************************************
* This file is part of netctl-plasmoid *
* *
* netctl-plasmoid 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 3 of the *
* License, or (at your option) any later version. *
* *
* netctl-plasmoid 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 netctl-plasmoid. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef NETCTLPROFILE_H
#define NETCTLPROFILE_H
#include <QDir>
#include <QObject>
class MainWindow;
class NetctlProfile : public QObject
{
Q_OBJECT
public:
explicit NetctlProfile(MainWindow *wid = 0,
QString profileDir = QString(""),
QString sudoPath = QString(""));
~NetctlProfile();
private:
MainWindow *parent;
QDir *profileDirectory;
QString sudoCommand;
};
#endif /* NETCTLPROFILE_H */

View File

@ -19,17 +19,21 @@
#define WPASUPINTERACT_H
#include <QDir>
#include <QWidget>
#include <QObject>
class MainWindow;
class WpaSup : public QWidget
class WpaSup : public QObject
{
Q_OBJECT
public:
WpaSup(MainWindow *wid, QStringList wpaConfig, QString sudoPath, QString ifaceDir, QString preferedInterface);
explicit WpaSup(MainWindow *wid = 0,
QStringList wpaConfig = QStringList(),
QString sudoPath = QString(""),
QString ifaceDir = QString(""),
QString preferedInterface = QString(""));
~WpaSup();
// general information
QStringList getInterfaceList();