Diffstat (limited to 'noncore/settings/usermanager/groupdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/usermanager/groupdialog.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/noncore/settings/usermanager/groupdialog.cpp b/noncore/settings/usermanager/groupdialog.cpp index b595d31..76810be 100644 --- a/noncore/settings/usermanager/groupdialog.cpp +++ b/noncore/settings/usermanager/groupdialog.cpp | |||
@@ -1,65 +1,63 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
7 | * * | 7 | * * |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | 9 | ||
10 | #include "groupdialog.h" | 10 | #include "groupdialog.h" |
11 | 11 | ||
12 | #include <qlabel.h> | 12 | #include <qlabel.h> |
13 | #include <qlayout.h> | 13 | #include <qlayout.h> |
14 | #include <qmessagebox.h> | 14 | #include <qmessagebox.h> |
15 | 15 | ||
16 | #include <stdlib.h> | ||
17 | |||
18 | #include "passwd.h" | 16 | #include "passwd.h" |
19 | 17 | ||
20 | GroupDialog::GroupDialog(QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) { | 18 | GroupDialog::GroupDialog(QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) { |
21 | // GID | 19 | // GID |
22 | QLabel *gidLabel=new QLabel(this,"gid: "); | 20 | QLabel *gidLabel=new QLabel(this,"gid: "); |
23 | gidLabel->setText("GroupID: "); | 21 | gidLabel->setText("GroupID: "); |
24 | gidLineEdit=new QLineEdit(this,"gid: "); | 22 | gidLineEdit=new QLineEdit(this,"gid: "); |
25 | gidLineEdit->setEnabled(false); | 23 | gidLineEdit->setEnabled(false); |
26 | 24 | ||
27 | // Groupname | 25 | // Groupname |
28 | QLabel *groupnameLabel=new QLabel(this,"groupname"); | 26 | QLabel *groupnameLabel=new QLabel(this,"groupname"); |
29 | groupnameLabel->setText("Groupname: "); | 27 | groupnameLabel->setText("Groupname: "); |
30 | groupnameLineEdit=new QLineEdit(this,"groupname"); | 28 | groupnameLineEdit=new QLineEdit(this,"groupname"); |
31 | 29 | ||
32 | // Widget layout | 30 | // Widget layout |
33 | QVBoxLayout *layout=new QVBoxLayout(this); | 31 | QVBoxLayout *layout=new QVBoxLayout(this); |
34 | layout->setMargin(5); | 32 | layout->setMargin(5); |
35 | QHBoxLayout *hlayout=new QHBoxLayout(-1,"hlayout"); | 33 | QHBoxLayout *hlayout=new QHBoxLayout(-1,"hlayout"); |
36 | layout->addLayout(hlayout); | 34 | layout->addLayout(hlayout); |
37 | QVBoxLayout *vlayout1=new QVBoxLayout(-1,"vlayout1"); | 35 | QVBoxLayout *vlayout1=new QVBoxLayout(-1,"vlayout1"); |
38 | QVBoxLayout *vlayout2=new QVBoxLayout(-1,"vlayout2"); | 36 | QVBoxLayout *vlayout2=new QVBoxLayout(-1,"vlayout2"); |
39 | // First column, labels | 37 | // First column, labels |
40 | vlayout1->addWidget(gidLabel); | 38 | vlayout1->addWidget(gidLabel); |
41 | vlayout1->addWidget(groupnameLabel); | 39 | vlayout1->addWidget(groupnameLabel); |
42 | // Second column, data | 40 | // Second column, data |
43 | vlayout2->addWidget(gidLineEdit); | 41 | vlayout2->addWidget(gidLineEdit); |
44 | vlayout2->addWidget(groupnameLineEdit); | 42 | vlayout2->addWidget(groupnameLineEdit); |
45 | hlayout->addLayout(vlayout1); | 43 | hlayout->addLayout(vlayout1); |
46 | hlayout->addLayout(vlayout2); | 44 | hlayout->addLayout(vlayout2); |
47 | layout->addSpacing(5); | 45 | layout->addSpacing(5); |
48 | 46 | ||
49 | //showMaximized(); | 47 | //showMaximized(); |
50 | } | 48 | } |
51 | 49 | ||
52 | GroupDialog::~GroupDialog() { | 50 | GroupDialog::~GroupDialog() { |
53 | } | 51 | } |
54 | 52 | ||
55 | bool GroupDialog::addGroup(int gid) { | 53 | bool GroupDialog::addGroup(int gid) { |
56 | GroupDialog *addgroupDialog=new GroupDialog();// Make a groupinfo dialog. | 54 | GroupDialog *addgroupDialog=new GroupDialog();// Make a groupinfo dialog. |
57 | addgroupDialog->setCaption(tr("Add Group"));// Set the caption. | 55 | addgroupDialog->setCaption(tr("Add Group"));// Set the caption. |
58 | addgroupDialog->gidLineEdit->setText(QString::number(gid));// Set the next available gid. | 56 | addgroupDialog->gidLineEdit->setText(QString::number(gid));// Set the next available gid. |
59 | if(!(addgroupDialog->exec())) return false;// View the dialog, and only continue if 'ok' was pressed. | 57 | if(!(addgroupDialog->exec())) return false;// View the dialog, and only continue if 'ok' was pressed. |
60 | if(!(accounts->addGroup(addgroupDialog->groupnameLineEdit->text(),addgroupDialog->gidLineEdit->text().toInt()))) {// Try to add the group. | 58 | if(!(accounts->addGroup(addgroupDialog->groupnameLineEdit->text(),addgroupDialog->gidLineEdit->text().toInt()))) {// Try to add the group. |
61 | QMessageBox::information(0,"Ooops!","Something went wrong.\nUnable to add group."); | 59 | QMessageBox::information(0,"Ooops!","Something went wrong.\nUnable to add group."); |
62 | return false; | 60 | return false; |
63 | } | 61 | } |
64 | return true; | 62 | return true; |
65 | } | 63 | } |