diff options
Diffstat (limited to 'filesharing/simple/groupconfigdlg.cpp')
-rw-r--r-- | filesharing/simple/groupconfigdlg.cpp | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/filesharing/simple/groupconfigdlg.cpp b/filesharing/simple/groupconfigdlg.cpp index f313719d..470f024f 100644 --- a/filesharing/simple/groupconfigdlg.cpp +++ b/filesharing/simple/groupconfigdlg.cpp @@ -18,13 +18,13 @@ */ -#include <qradiobutton.h> -#include <qpushbutton.h> -#include <qgroupbox.h> -#include <qlabel.h> -#include <qcheckbox.h> -#include <qvbox.h> -#include <qhbox.h> +#include <tqradiobutton.h> +#include <tqpushbutton.h> +#include <tqgroupbox.h> +#include <tqlabel.h> +#include <tqcheckbox.h> +#include <tqvbox.h> +#include <tqhbox.h> #include <klocale.h> #include <kuser.h> @@ -40,16 +40,16 @@ #include "groupconfigdlg.h" -static QString groupListToString(const QValueList<KUserGroup> & list); -static QString prettyString(const KUser &user); -static QString fromPrettyString(const QString & s); -static void removeList(QValueList<KUser> & from, const QValueList<KUser> & that); -static bool userMod(const QString & user, const QValueList<KUserGroup> & groups); +static TQString groupListToString(const TQValueList<KUserGroup> & list); +static TQString prettyString(const KUser &user); +static TQString fromPrettyString(const TQString & s); +static void removeList(TQValueList<KUser> & from, const TQValueList<KUser> & that); +static bool userMod(const TQString & user, const TQValueList<KUserGroup> & groups); -GroupConfigDlg::GroupConfigDlg(QWidget * parent, - const QString & fileShareGroup, bool restricted, +GroupConfigDlg::GroupConfigDlg(TQWidget * parent, + const TQString & fileShareGroup, bool restricted, bool rootPassNeeded, bool simpleSharing) : KDialogBase(parent,"groupconfigdlg", true, i18n("Allowed Users"), Ok|Cancel, Ok, true) , @@ -81,12 +81,12 @@ void GroupConfigDlg::initGUI() { m_gui->groupUsersRadio->setChecked(m_restricted); m_gui->writeAccessChk->setChecked(!m_rootPassNeeded); - connect( m_gui->addBtn, SIGNAL(clicked()), - this, SLOT(slotAddUser())); - connect( m_gui->removeBtn, SIGNAL(clicked()), - this, SLOT(slotRemoveUser())); - connect( m_gui->otherGroupBtn, SIGNAL(clicked()), - this, SLOT(slotChangeGroup())); + connect( m_gui->addBtn, TQT_SIGNAL(clicked()), + this, TQT_SLOT(slotAddUser())); + connect( m_gui->removeBtn, TQT_SIGNAL(clicked()), + this, TQT_SLOT(slotRemoveUser())); + connect( m_gui->otherGroupBtn, TQT_SIGNAL(clicked()), + this, TQT_SLOT(slotChangeGroup())); if (m_simpleSharing) { // if simple sharing users never need the root password @@ -96,23 +96,23 @@ void GroupConfigDlg::initGUI() { void GroupConfigDlg::updateListBox() { m_gui->listBox->clear(); - QValueList<KUser>::iterator it; + TQValueList<KUser>::iterator it; for ( it = m_users.begin(); it != m_users.end(); ++it ) { m_gui->listBox->insertItem(prettyString(*it)); kdDebug(5009) << "GroupConfigDlg::updateListBox: " << (*it).loginName() << endl; } } -QString prettyString(const KUser &user) { +TQString prettyString(const KUser &user) { return user.fullName()+" ("+user.loginName()+")"; } -QString fromPrettyString(const QString & s) { +TQString fromPrettyString(const TQString & s) { // Jan Schaefer (jan) // i j int i = s.find('('); int j = s.find(')'); - QString loginName = s.mid(i+1,j-i-1); + TQString loginName = s.mid(i+1,j-i-1); return loginName; } @@ -121,7 +121,7 @@ bool GroupConfigDlg::restricted() { } void GroupConfigDlg::slotAddUser() { - QValueList<KUser> allUsers = KUser::allUsers(); + TQValueList<KUser> allUsers = KUser::allUsers(); removeList(allUsers,m_users); @@ -132,18 +132,18 @@ void GroupConfigDlg::slotAddUser() { return; } - QStringList stringList; + TQStringList stringList; - QValueList<KUser>::iterator it; + TQValueList<KUser>::iterator it; for ( it = allUsers.begin(); it != allUsers.end(); ++it ) { - QString s = (*it).fullName()+" ("+(*it).loginName()+")"; + TQString s = (*it).fullName()+" ("+(*it).loginName()+")"; stringList.append(s); } stringList.sort(); bool ok; - QString userName = KInputDialog::getItem( + TQString userName = KInputDialog::getItem( i18n("Select User"), i18n("Select a user:"), stringList, @@ -154,14 +154,14 @@ void GroupConfigDlg::slotAddUser() { if (!ok) return; - QString loginName = fromPrettyString(userName); + TQString loginName = fromPrettyString(userName); KUser user(loginName); m_users.append(KUser(loginName)); updateListBox(); } -void removeList(QValueList<KUser> & from, const QValueList<KUser> & that) { - QValueList<KUser>::ConstIterator it; +void removeList(TQValueList<KUser> & from, const TQValueList<KUser> & that) { + TQValueList<KUser>::ConstIterator it; for ( it = that.begin(); it != that.end(); ++it ) { from.remove(*it); } @@ -169,7 +169,7 @@ void removeList(QValueList<KUser> & from, const QValueList<KUser> & that) { } bool GroupConfigDlg::addUser(const KUser & user, const KUserGroup & group) { - QValueList<KUserGroup> groups = user.groups(); + TQValueList<KUserGroup> groups = user.groups(); groups.append(group); if (!userMod(user.loginName(),groups)) { KMessageBox::sorry(this,i18n("Could not add user '%1' to group '%2'") @@ -181,7 +181,7 @@ bool GroupConfigDlg::addUser(const KUser & user, const KUserGroup & group) { bool GroupConfigDlg::removeUser(const KUser & user, const KUserGroup & group) { - QValueList<KUserGroup> groups = user.groups(); + TQValueList<KUserGroup> groups = user.groups(); groups.remove(group); if (!userMod(user.loginName(),groups)) { KMessageBox::sorry(this,i18n("Could not remove user '%1' from group '%2'") @@ -203,12 +203,12 @@ void GroupConfigDlg::slotOk() { return; } - QValueList<KUser> addedUsers = m_users; + TQValueList<KUser> addedUsers = m_users; removeList(addedUsers,m_origUsers); - QValueList<KUser> removedUsers = m_origUsers; + TQValueList<KUser> removedUsers = m_origUsers; removeList(removedUsers,m_users); - QValueList<KUser>::ConstIterator it; + TQValueList<KUser>::ConstIterator it; for ( it = addedUsers.begin(); it != addedUsers.end(); ++it ) { addUser(*it, m_fileShareGroup); } @@ -221,27 +221,27 @@ void GroupConfigDlg::slotOk() { KDialogBase::slotOk(); } -bool userMod(const QString & user, const QValueList<KUserGroup> & groups) { +bool userMod(const TQString & user, const TQValueList<KUserGroup> & groups) { KProcess proc; proc << "usermod" << "-G" << groupListToString(groups) << user; return proc.start(KProcess::Block) && proc.normalExit(); } void GroupConfigDlg::slotRemoveUser() { - QListBoxItem* item = m_gui->listBox->selectedItem(); + TQListBoxItem* item = m_gui->listBox->selectedItem(); if (!item) return; - QString loginName = fromPrettyString(item->text()); + TQString loginName = fromPrettyString(item->text()); KUser user(loginName); m_users.remove(KUser(loginName)); updateListBox(); m_gui->removeBtn->setEnabled(false); } -QString groupListToString(const QValueList<KUserGroup> & list) { - QValueList<KUserGroup>::ConstIterator it; - QString result; +TQString groupListToString(const TQValueList<KUserGroup> & list) { + TQValueList<KUserGroup>::ConstIterator it; + TQString result; for ( it = list.begin(); it != list.end(); ++it ) { result+=(*it).name()+","; @@ -253,13 +253,13 @@ QString groupListToString(const QValueList<KUserGroup> & list) { } void GroupConfigDlg::slotChangeGroup() { - QValueList<KUserGroup> allGroups = KUserGroup::allGroups(); + TQValueList<KUserGroup> allGroups = KUserGroup::allGroups(); - QStringList stringList; + TQStringList stringList; - QValueList<KUserGroup>::iterator it; + TQValueList<KUserGroup>::iterator it; for ( it = allGroups.begin(); it != allGroups.end(); ++it ) { - QString s = (*it).name(); + TQString s = (*it).name(); stringList.append(s); } @@ -268,31 +268,31 @@ void GroupConfigDlg::slotChangeGroup() { KDialogBase* dlg = new KDialogBase(this,"groupconfigdlg", true, i18n("Allowed Users"), Ok|Cancel, Ok, true); - QVBox* vbox = dlg->makeVBoxMainWidget(); + TQVBox* vbox = dlg->makeVBoxMainWidget(); - QHBox* hbox = new QHBox(vbox); - QLabel* lbl = new QLabel(i18n("New file share group:"),hbox); + TQHBox* hbox = new TQHBox(vbox); + TQLabel* lbl = new TQLabel(i18n("New file share group:"),hbox); KComboBox* combo = new KComboBox(hbox); combo->insertStringList(stringList); combo->setEditable(true); combo->setCurrentText(m_fileShareGroup.name()); - QCheckBox* addChk = new QCheckBox( + TQCheckBox* addChk = new TQCheckBox( i18n("Add users from the old file share group to the new one"), vbox); - QCheckBox* removeUsersChk = new QCheckBox( + TQCheckBox* removeUsersChk = new TQCheckBox( i18n("Remove users from old file share group"), vbox); - QCheckBox* removeGroupChk = new QCheckBox( + TQCheckBox* removeGroupChk = new TQCheckBox( i18n("Delete the old file share group"), vbox); - if (dlg->exec() == QDialog::Accepted) { - QString groupName = combo->currentText(); + if (dlg->exec() == TQDialog::Accepted) { + TQString groupName = combo->currentText(); if (groupName != m_fileShareGroup.name()) { - QString oldGroup = m_fileShareGroup.name(); + TQString oldGroup = m_fileShareGroup.name(); if (allGroups.contains(KUserGroup(groupName))) setFileShareGroup(KUserGroup(groupName)); else { @@ -348,8 +348,8 @@ void GroupConfigDlg::setFileShareGroup(const KUserGroup & group) { } -bool GroupConfigDlg::addUsersToGroup(QValueList<KUser> users,const KUserGroup & group) { - QValueList<KUser>::ConstIterator it; +bool GroupConfigDlg::addUsersToGroup(TQValueList<KUser> users,const KUserGroup & group) { + TQValueList<KUser>::ConstIterator it; bool result = true; for ( it = users.begin(); it != users.end(); ++it ) { if (!addUser(*it, group)) @@ -358,16 +358,16 @@ bool GroupConfigDlg::addUsersToGroup(QValueList<KUser> users,const KUserGroup & return result; } -bool GroupConfigDlg::emptyGroup(const QString & s) { +bool GroupConfigDlg::emptyGroup(const TQString & s) { if (KMessageBox::No == KMessageBox::questionYesNo(this, - i18n("Do you really want to remove all users from group '%1'?").arg(s), QString::null, KStdGuiItem::del(), KStdGuiItem::cancel())) { + i18n("Do you really want to remove all users from group '%1'?").arg(s), TQString::null, KStdGuiItem::del(), KStdGuiItem::cancel())) { return false; } - QValueList<KUser> allUsers = KUser::allUsers(); + TQValueList<KUser> allUsers = KUser::allUsers(); bool result = true; KUserGroup group(s); - QValueList<KUser>::ConstIterator it; + TQValueList<KUser>::ConstIterator it; for ( it = allUsers.begin(); it != allUsers.end(); ++it ) { if (!removeUser(*it, group)) result = false; @@ -375,9 +375,9 @@ bool GroupConfigDlg::emptyGroup(const QString & s) { return result; } -bool GroupConfigDlg::deleteGroup(const QString & s) { +bool GroupConfigDlg::deleteGroup(const TQString & s) { if (KMessageBox::No == KMessageBox::questionYesNo(this, - i18n("Do you really want to delete group '%1'?").arg(s), QString::null, KStdGuiItem::del(), KStdGuiItem::cancel())) { + i18n("Do you really want to delete group '%1'?").arg(s), TQString::null, KStdGuiItem::del(), KStdGuiItem::cancel())) { return false; } @@ -391,14 +391,14 @@ bool GroupConfigDlg::deleteGroup(const QString & s) { return result; } -bool GroupConfigDlg::createFileShareGroup(const QString & s) { +bool GroupConfigDlg::createFileShareGroup(const TQString & s) { if (s.isEmpty()) { KMessageBox::sorry(this,i18n("Please choose a valid group.")); return false; } if (KMessageBox::No == KMessageBox::questionYesNo(this, - i18n("This group '%1' does not exist. Should it be created?").arg(s), QString::null, i18n("Create"), i18n("Do Not Create"))) + i18n("This group '%1' does not exist. Should it be created?").arg(s), TQString::null, i18n("Create"), i18n("Do Not Create"))) return false; //debug("CreateFileShareGroup: "+s); |