[PC-BSD Commits] r4598 - pcbsd/trunk/pcbsdusermanager
svn at pcbsd.org
svn at pcbsd.org
Tue Oct 6 23:23:42 PDT 2009
Author: kris
Date: 2009-10-06 23:23:42 -0700 (Tue, 06 Oct 2009)
New Revision: 4598
Added:
pcbsd/trunk/pcbsdusermanager/main.cpp
pcbsd/trunk/pcbsdusermanager/pcbsdusermanager.ui
pcbsd/trunk/pcbsdusermanager/pcusermanager.desktop
Removed:
pcbsd/trunk/pcbsdusermanager/notroot.cpp
pcbsd/trunk/pcbsdusermanager/notroot.h
pcbsd/trunk/pcbsdusermanager/notroot.ui
pcbsd/trunk/pcbsdusermanager/pcbsdusermanager.desktop
Modified:
pcbsd/trunk/pcbsdusermanager/AUTHORS
pcbsd/trunk/pcbsdusermanager/pcbsdusermanager.cpp
pcbsd/trunk/pcbsdusermanager/pcbsdusermanager.h
pcbsd/trunk/pcbsdusermanager/pcbsdusermanager.pro
pcbsd/trunk/pcbsdusermanager/usermanagerback.cpp
Log:
Updated the pcbsdusermanager, now it runs standalone, no longer in kcmshell, which lets us be more
flexible. Still needs some porting work to QT 4.5 native
Modified: pcbsd/trunk/pcbsdusermanager/AUTHORS
===================================================================
--- pcbsd/trunk/pcbsdusermanager/AUTHORS 2009-10-07 06:16:57 UTC (rev 4597)
+++ pcbsd/trunk/pcbsdusermanager/AUTHORS 2009-10-07 06:23:42 UTC (rev 4598)
@@ -1 +1,2 @@
Tim McCormick <tim at pcbsd.org>
+Kris Moore <kris at pcbsd.org>
Modified: pcbsd/trunk/pcbsdusermanager/pcbsdusermanager.cpp
===================================================================
--- pcbsd/trunk/pcbsdusermanager/pcbsdusermanager.cpp 2009-10-07 06:16:57 UTC (rev 4597)
+++ pcbsd/trunk/pcbsdusermanager/pcbsdusermanager.cpp 2009-10-07 06:23:42 UTC (rev 4598)
@@ -22,56 +22,45 @@
* OTHER DEALINGS IN THE SOFTWARE. *
***************************************************************************/
-#include <klocale.h>
-#include <kglobal.h>
-#include <kgenericfactory.h>
-
#include <qlayout.h>
#include <qtranslator.h>
#include <qtextcodec.h>
-
#include "pcbsdusermanager.h"
-#include "notroot.h"
-K_PLUGIN_FACTORY(PUManagerFactory,
- registerPlugin<PCBSDUserManager>();
- )
-K_EXPORT_PLUGIN(PUManagerFactory("pcbsdusermanager"))
-
-PCBSDUserManager::PCBSDUserManager(QWidget *parent, const QVariantList &lst)
- : KCModule(PUManagerFactory::componentData(), parent, lst)
+void PCBSDUserManager::setupUMDialogs()
{
QTranslator translator( 0 );
translator.load( QString("pcbsdusermanager_") + QTextCodec::locale(), "/PCBSD/LANGS/" );
qApp->installTranslator( &translator );
-
- back = new UserManagerBackend();
+ layout = new QGridLayout(widgetUserContainer);
+
//Init GUI
- setButtons(KCModule::Apply);
- QGridLayout *layout = new QGridLayout(this);
- layout->setAutoAdd(true);
- advancedGui = new mainDlgCode();
- advancedGui->programInit(back);
- simpleGui = new SimpleDlgCode();
- simpleGui->programInit(back);
- load();
- if (getuid() == 0) //Check for root
+ if (getuid() == 0) //Check for root
{
- simpleGui->reparent(this, QPoint());
-
- connect(advancedGui, SIGNAL(changed( bool )), this, SLOT(configChanged()));
- connect(simpleGui, SIGNAL(advancedView()), this, SLOT(switchToAdvanced()));
- connect(advancedGui, SIGNAL(simpleView()), this, SLOT(switchToSimple()));
- connect(simpleGui, SIGNAL(changed()), this, SLOT(configChanged()));
+ // Setup our buttons
+ pushSave->setEnabled(false);
+ connect(pushClose, SIGNAL(clicked()), this, SLOT(slotClose()));
+ connect(pushSave, SIGNAL(clicked()), this, SLOT(slotSave()));
+
+ back = new UserManagerBackend();
+ advancedGui = new mainDlgCode();
+ advancedGui->programInit(back);
+ simpleGui = new SimpleDlgCode();
+ simpleGui->programInit(back);
+ layout->addWidget(simpleGui);
+
+ connect(advancedGui, SIGNAL(changed( bool )), this, SLOT(configChanged()));
+ connect(simpleGui, SIGNAL(changed()), this, SLOT(configChanged()));
+ connect(simpleGui, SIGNAL(advancedView()), this, SLOT(switchToAdvanced()));
+ connect(advancedGui, SIGNAL(simpleView()), this, SLOT(switchToSimple()));
}
else
{
- notRootGui = new NotRoot();
- notRootGui->programInit();
- notRootGui->reparent(this, QPoint());
+ qDebug("Error, needs to be run as root");
+ exit(1);
}
};
@@ -80,40 +69,36 @@
{
}
-
-void PCBSDUserManager::load()
+void PCBSDUserManager::switchToAdvanced()
{
-
+ simpleGui->setParent(0);
+ layout->addWidget(advancedGui);
+ advancedGui->setParent(widgetUserContainer);
+ advancedGui->show();
}
-
-void PCBSDUserManager::save()
+void PCBSDUserManager::switchToSimple()
{
- if (back->commit()) { emit changed(false); }
+ advancedGui->setParent(0);
+ simpleGui->setParent(widgetUserContainer);
+ layout->addWidget(simpleGui);
+ simpleGui->show();
}
-
-int PCBSDUserManager::buttons()
-{
- return KCModule::Apply;
-}
-
-
void PCBSDUserManager::configChanged()
{
- emit changed(true);
+ pushSave->setEnabled(true);
}
-void PCBSDUserManager::switchToAdvanced()
+void PCBSDUserManager::slotSave()
{
- simpleGui->reparent(0, QPoint());
- advancedGui->reparent(this, QPoint());
- advancedGui->show();
+ if (back->commit())
+ {
+ pushSave->setEnabled(false);
+ }
}
-void PCBSDUserManager::switchToSimple()
+void PCBSDUserManager::slotClose()
{
- advancedGui->reparent(0, QPoint());
- simpleGui->reparent(this, QPoint());
- simpleGui->show();
+ close();
}
Modified: pcbsd/trunk/pcbsdusermanager/pcbsdusermanager.h
===================================================================
--- pcbsd/trunk/pcbsdusermanager/pcbsdusermanager.h 2009-10-07 06:16:57 UTC (rev 4597)
+++ pcbsd/trunk/pcbsdusermanager/pcbsdusermanager.h 2009-10-07 06:23:42 UTC (rev 4598)
@@ -1,6 +1,7 @@
/***************************************************************************
- * Copyright (C) 2007 by Tim McCormick *
- * tim at pcbsd.org *
+ * Copyright (C) 2007 by Tim McCormick *
+ * Modified 2009 by Kris Moore *
+ * kris at pcbsd.org *
* *
* Permission is hereby granted, free of charge, to any person obtaining *
* a copy of this software and associated documentation files (the *
@@ -26,40 +27,41 @@
#ifndef _PCBSDUSERMANAGER_H_
#define _PCBSDUSERMANAGER_H_
-#include <kcmodule.h>
-#include <kaboutdata.h>
+#include <QDialog>
#include "maindlgcode.h"
#include "usermanagerback.h"
#include "simpledlgcode.h"
-#include "notroot.h"
-class KConfigDialogManager;
+#include "ui_pcbsdusermanager.h"
-class PCBSDUserManager: public KCModule
+class PCBSDUserManager: public QDialog, private Ui::PCBSDUserManager
{
Q_OBJECT
public:
- PCBSDUserManager( QWidget *parent=0, const QVariantList& = QVariantList() );
+ PCBSDUserManager() : QDialog()
+ {
+ setupUi(this);
+ setupUMDialogs();
+ }
+
~PCBSDUserManager();
+ void setupUMDialogs();
- virtual void load();
- virtual void save();
- virtual int buttons();
- virtual const KAboutData *aboutData()const
- { return myAboutData; };
-
public slots:
- void configChanged();
void switchToAdvanced();
void switchToSimple();
+private slots:
+ void configChanged();
+ void slotSave();
+ void slotClose();
+
private:
- KAboutData *myAboutData;
mainDlgCode *advancedGui;
UserManagerBackend *back;
SimpleDlgCode *simpleGui;
- NotRoot *notRootGui;
+ QGridLayout *layout;
};
#endif
Modified: pcbsd/trunk/pcbsdusermanager/pcbsdusermanager.pro
===================================================================
--- pcbsd/trunk/pcbsdusermanager/pcbsdusermanager.pro 2009-10-07 06:16:57 UTC (rev 4597)
+++ pcbsd/trunk/pcbsdusermanager/pcbsdusermanager.pro 2009-10-07 06:23:42 UTC (rev 4598)
@@ -1,13 +1,11 @@
-TEMPLATE = lib
+TEMPLATE = app
LANGUAGE = C++
-CONFIG += dll
+CONFIG += qt warn_on release
-
LIBS += -L/usr/local/kde4/lib -lkdecore -lkio -lkdeui -Ikdelibs -lcrypt
-SOURCES += notroot.cpp \
- group.cpp \
+SOURCES += group.cpp \
pcbsdusermanager.cpp \
simpledlgcode.cpp \
usermanagerback.cpp \
@@ -15,10 +13,10 @@
maindlgcode.cpp \
simpleaddcode.cpp \
user.cpp \
+ main.cpp \
adddlgcode.cpp
-HEADERS += notroot.h \
- group.h \
+HEADERS += group.h \
pcbsdusermanager.h \
simpledlgcode.h \
usermanagerback.h \
@@ -30,28 +28,24 @@
FORMS = SimpleDlg.ui \
changepassdialog.ui \
- notroot.ui \
adduser.ui \
mainDlg.ui \
+ pcbsdusermanager.ui \
simpleadddlg.ui
RESOURCES += pcbsdusermanager.qrc
INCLUDEPATH += /usr/local/kde4/include /usr/local/include/qt4
-TARGET = /usr/local/kde4/lib/kde4/kcm_pcbsdusermanager
+TARGET = /usr/local/kde4/bin/pcUserManager
TRANSLATIONS = pcbsdusermanager_en.ts
desktop.path=/usr/local/kde4/share/applications/kde4/
-desktop.files=kcm_pcbsdusermanager.desktop
+desktop.files=pcusermanager.desktop
-kcm.path=/usr/local/kde4/lib/kde4/
-kcm.files=kcm_pcbsdusermanager.la
-kcm.extra=cp -f libkcm_pcbsdusermanager.so.1.0.0 /usr/local/kde4/lib/kde4/kcm_pcbsdusermanager.so
+INSTALLS += desktop
-INSTALLS += desktop kcm
-
QMAKE_LIBDIR = /usr/local/kde4/lib /usr/local/lib/qt4 /usr/local/lib
QT += qt3support
Modified: pcbsd/trunk/pcbsdusermanager/usermanagerback.cpp
===================================================================
--- pcbsd/trunk/pcbsdusermanager/usermanagerback.cpp 2009-10-07 06:16:57 UTC (rev 4597)
+++ pcbsd/trunk/pcbsdusermanager/usermanagerback.cpp 2009-10-07 06:23:42 UTC (rev 4598)
@@ -66,7 +66,7 @@
while ( !stream.atEnd() ) {
line = stream.readLine();
- if ((line.find("#") != 0) && (! line.isEmpty())) { //Make sure it isn't a comment or blank
+ if ((line.indexOf("#") != 0) && (! line.isEmpty())) { //Make sure it isn't a comment or blank
QString username = line.section(":",0,0);
int uid = line.section(":",2,2).toInt();
int gid = line.section(":",3,3).toInt();
@@ -100,7 +100,7 @@
while ( !stream.atEnd() ) {
line = stream.readLine();
- if ((line.find("#") != 0) && (! line.isEmpty())) { //Make sure it isn't a comment or blank
+ if ((line.indexOf("#") != 0) && (! line.isEmpty())) { //Make sure it isn't a comment or blank
result.append(line);
}
}
@@ -142,7 +142,7 @@
while ( !stream.atEnd() ) {
line = stream.readLine();
- if ((line.find("#") != 0) && (! line.isEmpty())) { //Make sure it isn't a comment or blank
+ if ((line.indexOf("#") != 0) && (! line.isEmpty())) { //Make sure it isn't a comment or blank
QString groupname = line.section(":",0,0);
int gid = line.section(":",2,2).toInt();
QString memberString = line.section(":",3,3);
More information about the Commits
mailing list