summaryrefslogtreecommitdiff
path: root/noncore/settings/usermanager/usermanager.cpp
Unidiff
Diffstat (limited to 'noncore/settings/usermanager/usermanager.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/usermanager/usermanager.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/noncore/settings/usermanager/usermanager.cpp b/noncore/settings/usermanager/usermanager.cpp
index a1130d4..1d345ee 100644
--- a/noncore/settings/usermanager/usermanager.cpp
+++ b/noncore/settings/usermanager/usermanager.cpp
@@ -1,41 +1,44 @@
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 "usermanager.h" 10#include "usermanager.h"
11 11
12#include <qlayout.h> 12/* OPIE */
13#include <opie2/odebug.h>
14#include <qpe/resource.h>
15using namespace Opie::Core;
13 16
17/* QT */
18#include <qlayout.h>
14#include <qmessagebox.h> 19#include <qmessagebox.h>
15#include <qfile.h> 20#include <qfile.h>
16#include <qpe/resource.h>
17
18#include <qregexp.h> 21#include <qregexp.h>
19 22
20/** 23/**
21 * The mainwindow constructor. 24 * The mainwindow constructor.
22 * 25 *
23 * @param QWidget *parent 26 * @param QWidget *parent
24 * @param const char *name 27 * @param const char *name
25 * @ param WFlags fl 28 * @ param WFlags fl
26 * 29 *
27 */ 30 */
28UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) { 31UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) {
29 setCaption(tr("Opie User Manager")); 32 setCaption(tr("Opie User Manager"));
30 33
31 // Create an instance of the global object 'accounts'. This holds all user/group info, and functions to modify them. 34 // Create an instance of the global object 'accounts'. This holds all user/group info, and functions to modify them.
32 accounts=new Passwd(); 35 accounts=new Passwd();
33 accounts->open();// This actually loads the files /etc/passwd & /etc/group into memory. 36 accounts->open();// This actually loads the files /etc/passwd & /etc/group into memory.
34 37
35 // Create the toolbar. 38 // Create the toolbar.
36 QToolBar *toolbar = new QToolBar(this,"Toolbar"); 39 QToolBar *toolbar = new QToolBar(this,"Toolbar");
37 toolbar->setHorizontalStretchable(1); // Is there any other way to get the toolbar to stretch of the full screen!? 40 toolbar->setHorizontalStretchable(1); // Is there any other way to get the toolbar to stretch of the full screen!?
38 adduserToolButton = new QToolButton(Resource::loadPixmap("usermanager/adduser"),"Add User",0,this,SLOT(addUser()),toolbar,"Add User"); 41 adduserToolButton = new QToolButton(Resource::loadPixmap("usermanager/adduser"),"Add User",0,this,SLOT(addUser()),toolbar,"Add User");
39 edituserToolButton = new QToolButton(Resource::loadPixmap("usermanager/edituser"),"Edit User",0,this,SLOT(editUser()),toolbar,"Edit User"); 42 edituserToolButton = new QToolButton(Resource::loadPixmap("usermanager/edituser"),"Edit User",0,this,SLOT(editUser()),toolbar,"Edit User");
40 deleteuserToolButton = new QToolButton(Resource::loadPixmap("usermanager/deleteuser"),"Delete User",0,this,SLOT(delUser()),toolbar,"Delete User"); 43 deleteuserToolButton = new QToolButton(Resource::loadPixmap("usermanager/deleteuser"),"Delete User",0,this,SLOT(delUser()),toolbar,"Delete User");
41 QToolButton *userstext = new QToolButton(0,"User",0,0,0,toolbar,"User"); 44 QToolButton *userstext = new QToolButton(0,"User",0,0,0,toolbar,"User");
@@ -232,26 +235,26 @@ void UserConfig::editGroup() {
232 int gid; 235 int gid;
233 if(groupsListView->currentItem()) {// Any group selected? 236 if(groupsListView->currentItem()) {// Any group selected?
234 gid=groupsListView->currentItem()->text(0).toInt();// Get the GID from the listview. 237 gid=groupsListView->currentItem()->text(0).toInt();// Get the GID from the listview.
235 if(GroupDialog::editGroup(gid)) getGroups();// Bring up the edit group dialog. 238 if(GroupDialog::editGroup(gid)) getGroups();// Bring up the edit group dialog.
236 } else { 239 } else {
237 QMessageBox::information(this,"No selection","No group has been selected."); 240 QMessageBox::information(this,"No selection","No group has been selected.");
238 } 241 }
239} 242}
240 243
241void UserConfig::delGroup() { 244void UserConfig::delGroup() {
242 const char *groupname; 245 const char *groupname;
243 if(groupsListView->currentItem()) {// Any group selected? 246 if(groupsListView->currentItem()) {// Any group selected?
244 groupname=groupsListView->currentItem()->text(1);// Get the groupname from the listview. 247 groupname=groupsListView->currentItem()->text(1);// Get the groupname from the listview.
245 if(QMessageBox::warning(this,"Delete group","Are you sure you want to\ndelete the group \""+QString(groupname)+"\" ?","&No","&Yes",0,0,1)) { 248 if(QMessageBox::warning(this,"Delete group","Are you sure you want to\ndelete the group \""+QString(groupname)+"\" ?","&No","&Yes",0,0,1)) {
246 // If confirmed, try to delete the group. 249 // If confirmed, try to delete the group.
247 if(GroupDialog::delGroup(groupname)) getGroups(); // And also update the view afterwards if the user was deleted. 250 if(GroupDialog::delGroup(groupname)) getGroups(); // And also update the view afterwards if the user was deleted.
248 } 251 }
249 } else { 252 } else {
250 QMessageBox::information(this,"No selection","No group has been selected."); 253 QMessageBox::information(this,"No selection","No group has been selected.");
251 } 254 }
252} 255}
253 256
254void UserConfig::showUserMenu(QListViewItem *item) { 257void UserConfig::showUserMenu(QListViewItem *item) {
255 //userPopupMenu.exec(item->mapToGlobal(QPoint(0,0))); 258 //userPopupMenu.exec(item->mapToGlobal(QPoint(0,0)));
256 qWarning("Pressed!"); 259 owarn << "Pressed!" << oendl;
257} 260}