Convert QT to TQT in 'userconfig'

Add sip4-tqt and python-tqt modules to the Python search path
pull/2/head
Francois Andriot 10 years ago committed by Slávek Banko
parent b8699b346d
commit 605e19372c

@ -16,12 +16,23 @@
# #
###########################################################################
import sys
import os.path
# Trinity-specific paths
tqt_modules = []
for m_path in sys.path:
if os.path.exists(os.path.join(m_path, 'sip4_tqt')):
m_sip_dir = os.path.join(m_path, 'sip4_tqt')
tqt_modules.insert(0, m_sip_dir)
if os.path.exists(os.path.join(m_path, 'python_tqt')):
m_pyqt_dir = os.path.join(m_path, 'python_tqt')
tqt_modules.insert(0, m_pyqt_dir)
for m_path in tqt_modules:
sys.path.insert(0, m_path)
from qt import *
from tdeui import *
from tdecore import *
from tdefile import *
import sys
import os.path
import shutil
import unixauthdb
import locale
@ -37,15 +48,15 @@ isroot = os.getuid()==0
###########################################################################
def SptimeToQDate(sptime):
t = QDateTime()
t = TQDateTime()
t.setTime_t(0)
return t.addDays(sptime).date()
###########################################################################
def QDateToSptime(qdate):
x = QDateTime()
def TQDateToSptime(tqdate):
x = TQDateTime()
x.setTime_t(0)
return x.daysTo(QDateTime(qdate))
return x.daysTo(TQDateTime(tqdate))
###########################################################################
# Try translating this code to C++. I dare ya!
@ -68,8 +79,8 @@ class UserConfigApp(programbase):
self.setButtons(0)
self.aboutdata = MakeAboutData()
toplayout = QVBoxLayout( self, 0, KDialog.spacingHint() )
tabcontrol = QTabWidget(self)
toplayout = TQVBoxLayout( self, 0, KDialog.spacingHint() )
tabcontrol = TQTabWidget(self)
toplayout.addWidget(tabcontrol)
toplayout.setStretchFactor(tabcontrol,1)
@ -92,22 +103,22 @@ class UserConfigApp(programbase):
# --- User Tab ---
if standalone:
usershbox = self.addHBoxPage("Users")
vbox = QVBox(usershbox)
vbox = TQVBox(usershbox)
else:
vbox = QVBox(tabcontrol)
vbox = TQVBox(tabcontrol)
vbox.setMargin(KDialog.marginHint())
vbox.setSpacing(KDialog.spacingHint())
hb = QHBox(vbox)
hb = TQHBox(vbox)
hb.setSpacing(KDialog.spacingHint())
vbox.setStretchFactor(hb,0)
label = QLabel(hb)
label = TQLabel(hb)
label.setPixmap(UserIcon("hi32-user"))
hb.setStretchFactor(label,0)
label = QLabel(i18n("User Accounts:"),hb)
label = TQLabel(i18n("User Accounts:"),hb)
hb.setStretchFactor(label,1)
self.userlist = TDEListView(vbox)
@ -115,18 +126,18 @@ class UserConfigApp(programbase):
self.userlist.addColumn(i18n("Real Name"))
self.userlist.addColumn(i18n("UID"))
self.userlist.setAllColumnsShowFocus(True)
self.userlist.setSelectionMode(QListView.Single)
self.userlist.setSelectionMode(TQListView.Single)
self.connect(self.userlist, SIGNAL("selectionChanged(QListViewItem *)"), self.slotListClicked)
self.connect(self.userlist, SIGNAL("selectionChanged(TQListViewItem *)"), self.slotListClicked)
if isroot:
self.connect(self.userlist, SIGNAL("doubleClicked(QListViewItem *)"), self.slotModifyClicked)
self.connect(self.userlist, SIGNAL("contextMenu(TDEListView*,QListViewItem*,const QPoint&)"), self.slotUserContext)
self.connect(self.userlist, SIGNAL("doubleClicked(TQListViewItem *)"), self.slotModifyClicked)
self.connect(self.userlist, SIGNAL("contextMenu(TDEListView*,TQListViewItem*,const TQPoint&)"), self.slotUserContext)
self.showspecialcheckbox = QCheckBox(i18n("Show system accounts"),vbox)
self.showspecialcheckbox = TQCheckBox(i18n("Show system accounts"),vbox)
vbox.setStretchFactor(self.showspecialcheckbox,0)
self.connect(self.showspecialcheckbox,SIGNAL("toggled(bool)"), self.slotShowSystemToggled)
hbox = QHBox(vbox)
hbox = TQHBox(vbox)
hbox.setSpacing(KDialog.spacingHint())
vbox.setStretchFactor(hbox,0)
@ -143,43 +154,43 @@ class UserConfigApp(programbase):
hbox.setStretchFactor(self.deletebutton,1)
self.connect(self.deletebutton,SIGNAL("clicked()"),self.slotDeleteClicked)
detailsbox = QVGroupBox(i18n("Details"),vbox)
userinfovbox = QWidget(detailsbox)
detailsbox = TQVGroupBox(i18n("Details"),vbox)
userinfovbox = TQWidget(detailsbox)
infogrid = QGridLayout(userinfovbox,3,4)
infogrid = TQGridLayout(userinfovbox,3,4)
infogrid.setSpacing(KDialog.spacingHint())
label = QLabel(i18n("Login Name:"),userinfovbox)
label = TQLabel(i18n("Login Name:"),userinfovbox)
infogrid.addWidget(label,0,0)
self.loginnamelabel = KLineEdit("",userinfovbox)
self.loginnamelabel.setReadOnly(True)
infogrid.addWidget(self.loginnamelabel,0,1)
label = QLabel(i18n("Real Name:"),userinfovbox)
label = TQLabel(i18n("Real Name:"),userinfovbox)
infogrid.addWidget(label,0,2)
self.realnamelabel = KLineEdit("",userinfovbox)
self.realnamelabel.setReadOnly(True)
infogrid.addWidget(self.realnamelabel,0,3)
label = QLabel(i18n("UID:"),userinfovbox)
label = TQLabel(i18n("UID:"),userinfovbox)
infogrid.addWidget(label,1,0)
self.uidlabel = KLineEdit("",userinfovbox)
self.uidlabel.setReadOnly(True)
infogrid.addWidget(self.uidlabel,1,1)
label = QLabel(i18n("Status:"),userinfovbox)
label = TQLabel(i18n("Status:"),userinfovbox)
infogrid.addWidget(label,1,2)
self.statuslabel = KLineEdit("",userinfovbox)
self.statuslabel.setReadOnly(True)
infogrid.addWidget(self.statuslabel,1,3)
label = QLabel(i18n("Primary Group:"),userinfovbox)
label = TQLabel(i18n("Primary Group:"),userinfovbox)
infogrid.addWidget(label,2,0)
self.primarygrouplabel = KLineEdit("",userinfovbox)
self.primarygrouplabel.setReadOnly(True)
infogrid.addWidget(self.primarygrouplabel,2,1)
label = QLabel(i18n("Secondary Groups:"),userinfovbox)
label = TQLabel(i18n("Secondary Groups:"),userinfovbox)
infogrid.addWidget(label,2,2)
self.secondarygrouplabel = KLineEdit("",userinfovbox)
self.secondarygrouplabel.setReadOnly(True)
@ -191,45 +202,45 @@ class UserConfigApp(programbase):
#--- Groups Tab ---
if standalone:
groupsvbox = self.addVBoxPage(i18n("Groups"))
hb = QHBox(groupsvbox)
hb = TQHBox(groupsvbox)
else:
groupsvbox = QVBox(tabcontrol)
groupsvbox = TQVBox(tabcontrol)
groupsvbox.setMargin(KDialog.marginHint())
hb = QHBox(groupsvbox)
hb = TQHBox(groupsvbox)
topframe = QFrame(groupsvbox)
topframe = TQFrame(groupsvbox)
groupsvbox.setSpacing(KDialog.spacingHint())
hb.setSpacing(KDialog.spacingHint())
groupsvbox.setStretchFactor(hb,0)
label = QLabel(hb)
label = TQLabel(hb)
label.setPixmap(UserIcon("hi32-group"))
hb.setStretchFactor(label,0)
label = QLabel(i18n("Groups:"),hb)
label = TQLabel(i18n("Groups:"),hb)
hb.setStretchFactor(label,1)
groupsplitter = QSplitter(Qt.Vertical,groupsvbox)
groupsplitter = TQSplitter(TQt.Vertical,groupsvbox)
self.grouplist = TDEListView(groupsplitter)
self.grouplist.addColumn(i18n("Group Name"))
self.grouplist.addColumn(i18n("GID"))
self.grouplist.setAllColumnsShowFocus(True)
self.connect(self.grouplist, SIGNAL("selectionChanged(QListViewItem *)"), self.slotGroupListClicked)
self.connect(self.grouplist, SIGNAL("selectionChanged(TQListViewItem *)"), self.slotGroupListClicked)
if isroot:
self.connect(self.grouplist, SIGNAL("doubleClicked(QListViewItem *)"), self.slotModifyGroupClicked)
self.connect(self.grouplist, SIGNAL("contextMenu(TDEListView*,QListViewItem*,const QPoint&)"),
self.connect(self.grouplist, SIGNAL("doubleClicked(TQListViewItem *)"), self.slotModifyGroupClicked)
self.connect(self.grouplist, SIGNAL("contextMenu(TDEListView*,TQListViewItem*,const TQPoint&)"),
self.slotGroupContext)
groupbottomvbox = QVBox(groupsplitter)
groupbottomvbox.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding)
groupbottomvbox = TQVBox(groupsplitter)
groupbottomvbox.setSizePolicy(TQSizePolicy.Expanding,TQSizePolicy.Expanding)
self.showspecialgroupscheckbox = QCheckBox(i18n("Show system groups"),groupbottomvbox)
self.showspecialgroupscheckbox = TQCheckBox(i18n("Show system groups"),groupbottomvbox)
vbox.setStretchFactor(self.showspecialgroupscheckbox,0)
self.connect(self.showspecialgroupscheckbox,SIGNAL("toggled(bool)"), self.slotShowSystemGroupsToggled)
hbox = QHBox(groupbottomvbox)
hbox = TQHBox(groupbottomvbox)
hbox.setSpacing(KDialog.spacingHint())
groupsvbox.setStretchFactor(hbox,0)
@ -252,7 +263,7 @@ class UserConfigApp(programbase):
for widget in disablebuttons:
widget.setDisabled(True)
label = QLabel(i18n("Group Members:"),groupbottomvbox)
label = TQLabel(i18n("Group Members:"),groupbottomvbox)
groupsvbox.setStretchFactor(label,0)
self.groupmemberlist = TDEListView(groupbottomvbox)
@ -461,7 +472,7 @@ class UserConfigApp(programbase):
if userobj.isLocked():
lvi.setPixmap(0,UserIcon("hi16-encrypted"))
else:
lvi.setPixmap(0,QPixmap())
lvi.setPixmap(0,TQPixmap())
#######################################################################
def __selectUser(self,userid):
@ -505,7 +516,7 @@ class UserConfigApp(programbase):
for groupobj in groups:
gid = groupobj.getGID()
if self.showsystemgroups or not groupobj.isSystemGroup():
lvi = QListViewItem(self.grouplist,groupobj.getGroupname(),unicode(gid))
lvi = TQListViewItem(self.grouplist,groupobj.getGroupname(),unicode(gid))
self.groupidsToListItems[gid] = lvi
if self.selectedgroupid==gid:
firstselectedgroupid = gid
@ -528,7 +539,7 @@ class UserConfigApp(programbase):
self.groupmemberlist.clear()
for userobj in members:
if userobj!=None:
lvi = QListViewItem(self.groupmemberlist,userobj.getUsername(),userobj.getRealName(),unicode(userobj.getUID()))
lvi = TQListViewItem(self.groupmemberlist,userobj.getUsername(),userobj.getRealName(),unicode(userobj.getUID()))
if isroot:
self.deletegroupbutton.setDisabled(groupobj.getGID()==0)
@ -610,32 +621,32 @@ class UserEditDialog(KDialogBase):
self.updatingGUI = True
detailsvbox = self.addHBoxPage(i18n("Details"))
detailspace = QWidget(detailsvbox)
detailspace = TQWidget(detailsvbox)
infogrid = QGridLayout(detailspace,9,2)
infogrid = TQGridLayout(detailspace,9,2)
infogrid.setSpacing(self.spacingHint())
infogrid.setColStretch(0,0)
infogrid.setColStretch(1,1)
self.enabledradiogroup = QButtonGroup()
self.enabledradiogroup = TQButtonGroup()
self.enabledradiogroup.setRadioButtonExclusive(True)
hb = QHBox(detailspace)
hb = TQHBox(detailspace)
hb.setSpacing(self.spacingHint())
label = QLabel(hb)
label = TQLabel(hb)
label.setPixmap(UserIcon("hi32-identity"))
hb.setStretchFactor(label,0)
label = QLabel(i18n("Status:"),hb)
label = TQLabel(i18n("Status:"),hb)
hb.setStretchFactor(label,1)
infogrid.addMultiCellWidget(hb,0,1,0,0)
self.enabledradio = QRadioButton(i18n("Enabled"),detailspace)
self.enabledradio = TQRadioButton(i18n("Enabled"),detailspace)
infogrid.addWidget(self.enabledradio,0,1)
hbox = QHBox(detailspace)
hbox = TQHBox(detailspace)
hbox.setSpacing(self.spacingHint())
self.disabledradio = QRadioButton(i18n("Disabled"),hbox)
self.disabledradio = TQRadioButton(i18n("Disabled"),hbox)
hbox.setStretchFactor(self.disabledradio,0)
label = QLabel(hbox)
label = TQLabel(hbox)
label.setPixmap(UserIcon("hi16-encrypted"))
hbox.setStretchFactor(label,1)
infogrid.addWidget(hbox,1,1)
@ -643,46 +654,46 @@ class UserEditDialog(KDialogBase):
self.enabledradiogroup.insert(self.enabledradio,0)
self.enabledradiogroup.insert(self.disabledradio,1)
label = QLabel(i18n("Login Name:"),detailspace)
label = TQLabel(i18n("Login Name:"),detailspace)
infogrid.addWidget(label,2,0)
self.loginnameedit = KLineEdit("",detailspace)
self.loginnameedit.setValidator(LoginNameValidator(self.loginnameedit))
infogrid.addWidget(self.loginnameedit,2,1)
self.connect(self.loginnameedit, SIGNAL("textChanged(const QString &)"), self.slotLoginChanged)
self.connect(self.loginnameedit, SIGNAL("textChanged(const TQString &)"), self.slotLoginChanged)
label = QLabel(i18n("Real Name:"),detailspace)
label = TQLabel(i18n("Real Name:"),detailspace)
infogrid.addWidget(label,3,0)
self.realnameedit = KLineEdit("",detailspace)
self.realnameedit.setValidator(RealUserNameValidator(self.realnameedit))
infogrid.addWidget(self.realnameedit,3,1)
label = QLabel(i18n("User ID:"),detailspace)
label = TQLabel(i18n("User ID:"),detailspace)
infogrid.addWidget(label,4,0)
self.uidedit = KLineEdit("",detailspace)
self.uidedit.setValidator(QIntValidator(0,65535,detailspace))
self.uidedit.setValidator(TQIntValidator(0,65535,detailspace))
infogrid.addWidget(self.uidedit,4,1)
label = QLabel(i18n("Primary Group:"),detailspace)
label = TQLabel(i18n("Primary Group:"),detailspace)
infogrid.addWidget(label,5,0)
self.primarygroupedit = KComboBox(False,detailspace)
infogrid.addWidget(self.primarygroupedit,5,1)
label = QLabel(i18n("Home Directory:"),detailspace)
label = TQLabel(i18n("Home Directory:"),detailspace)
infogrid.addWidget(label,7,0)
hbox = QHBox(detailspace)
hbox = TQHBox(detailspace)
hbox.setSpacing(self.spacingHint())
self.homediredit = KLineEdit("",hbox)
hbox.setStretchFactor(self.homediredit,1)
self.connect(self.homediredit, SIGNAL("textChanged(const QString &)"), self.slotHomeDirChanged)
self.connect(self.homediredit, SIGNAL("textChanged(const TQString &)"), self.slotHomeDirChanged)
self.homedirbutton = KPushButton(i18n("Browse..."),hbox)
hbox.setStretchFactor(self.homedirbutton,0)
self.connect(self.homedirbutton,SIGNAL("clicked()"),self.slotBrowseHomeDirClicked)
infogrid.addWidget(hbox,7,1)
label = QLabel(i18n("Shell:"),detailspace)
label = TQLabel(i18n("Shell:"),detailspace)
infogrid.addWidget(label,8,0)
self.shelledit = KComboBox(True,detailspace)
@ -697,9 +708,9 @@ class UserEditDialog(KDialogBase):
groupsvbox = self.addHBoxPage(i18n("Privileges and groups"))
# Rudd-O now here we create the widget that will hold the group listing, and fill it with the groups.
self.privilegeslistview = QListView(groupsvbox)
self.privilegeslistview = TQListView(groupsvbox)
self.privilegeslistview.addColumn(i18n("Privilege"),-1)
self.groupslistview = QListView(groupsvbox)
self.groupslistview = TQListView(groupsvbox)
self.groupslistview.addColumn(i18n("Secondary group"),-1)
groupsvbox.setStretchFactor(self.privilegeslistview,3)
groupsvbox.setStretchFactor(self.groupslistview,2)
@ -707,20 +718,20 @@ class UserEditDialog(KDialogBase):
# Password and Security Tab.
passwordvbox = self.addVBoxPage(i18n("Password && Security"))
passwordspace = QWidget(passwordvbox)
passwordgrid = QGridLayout(passwordspace,8,3)
passwordspace = TQWidget(passwordvbox)
passwordgrid = TQGridLayout(passwordspace,8,3)
passwordgrid.setSpacing(self.spacingHint())
passwordgrid.setColStretch(0,0)
passwordgrid.setColStretch(1,0)
passwordgrid.setColStretch(2,1)
passwordvbox.setStretchFactor(passwordspace,0)
hb = QHBox(passwordspace)
hb = TQHBox(passwordspace)
hb.setSpacing(self.spacingHint())
label = QLabel(hb)
label = TQLabel(hb)
label.setPixmap(UserIcon("hi32-password"))
hb.setStretchFactor(label,0)
label = QLabel(i18n("Password:"),hb)
label = TQLabel(i18n("Password:"),hb)
hb.setStretchFactor(label,1)
passwordgrid.addWidget(hb,0,0)
@ -728,24 +739,24 @@ class UserEditDialog(KDialogBase):
passwordgrid.addWidget(self.passwordedit,0,1)
# Last Change
label = QLabel(i18n("Last changed:"),passwordspace)
label = TQLabel(i18n("Last changed:"),passwordspace)
passwordgrid.addWidget(label,1,0)
self.lastchangelabel = KLineEdit("",passwordspace)
self.lastchangelabel.setReadOnly(True)
passwordgrid.addWidget(self.lastchangelabel,1,1)
self.validradiogroup = QButtonGroup()
self.validradiogroup = TQButtonGroup()
self.validradiogroup.setRadioButtonExclusive(True)
# Valid until.
label = QLabel(i18n("Valid until:"),passwordspace)
label = TQLabel(i18n("Valid until:"),passwordspace)
passwordgrid.addWidget(label,2,0)
self.validalwaysradio = QRadioButton(i18n("Always"),passwordspace)
self.validalwaysradio = TQRadioButton(i18n("Always"),passwordspace)
passwordgrid.addWidget(self.validalwaysradio,2,1)
hbox = QHBox(passwordspace)
hbox = TQHBox(passwordspace)
hbox.setSpacing(self.spacingHint())
self.expireradio = QRadioButton(hbox)
self.expireradio = TQRadioButton(hbox)
hbox.setStretchFactor(self.expireradio,0)
self.expiredate = KDateWidget(hbox)
@ -757,30 +768,30 @@ class UserEditDialog(KDialogBase):
self.connect(self.validradiogroup,SIGNAL("clicked(int)"),self.slotValidUntilClicked)
# Password Aging & Expiration.
passwordaginggroup = QVGroupBox(i18n("Password Aging"),passwordvbox)
passwordaginggroup = TQVGroupBox(i18n("Password Aging"),passwordvbox)
passwordaginggroup.setInsideSpacing(self.spacingHint())
passwordvbox.setStretchFactor(passwordaginggroup,0)
passwordagingwidget = QWidget(passwordaginggroup)
passwordagingwidget = TQWidget(passwordaginggroup)
passwordaginggrid = QGridLayout(passwordagingwidget,4,3)
passwordaginggrid = TQGridLayout(passwordagingwidget,4,3)
passwordaginggrid.setSpacing(self.spacingHint())
# [*] Require new password after: [_____5 days]
self.forcepasswordchangecheckbox = QCheckBox(passwordagingwidget)
self.forcepasswordchangecheckbox = TQCheckBox(passwordagingwidget)
self.connect(self.forcepasswordchangecheckbox,SIGNAL("toggled(bool)"),self.slotForcePasswordChangeToggled)
passwordaginggrid.addWidget(self.forcepasswordchangecheckbox,0,0)
label = QLabel(i18n("Require new password after:"),passwordagingwidget)
label = TQLabel(i18n("Require new password after:"),passwordagingwidget)
passwordaginggrid.addWidget(label,0,1)
self.maximumpasswordedit = QSpinBox(passwordagingwidget)
self.maximumpasswordedit = TQSpinBox(passwordagingwidget)
self.maximumpasswordedit.setSuffix(i18n(" days"))
self.maximumpasswordedit.setMinValue(1)
self.maximumpasswordedit.setMaxValue(365*5)
passwordaginggrid.addWidget(self.maximumpasswordedit,0,2)
label = QLabel(i18n("Warn before password expires:"),passwordagingwidget)
label = TQLabel(i18n("Warn before password expires:"),passwordagingwidget)
passwordaginggrid.addWidget(label,1,1)
self.warningedit = QSpinBox(passwordagingwidget)
self.warningedit = TQSpinBox(passwordagingwidget)
self.warningedit.setPrefix(i18n("After "))
self.warningedit.setSuffix(i18n(" days"))
self.warningedit.setMinValue(0)
@ -788,9 +799,9 @@ class UserEditDialog(KDialogBase):
self.warningedit.setSpecialValueText(i18n("Never"))
passwordaginggrid.addWidget(self.warningedit,1,2)
label = QLabel(i18n("Disable account after password expires:"),passwordagingwidget)
label = TQLabel(i18n("Disable account after password expires:"),passwordagingwidget)
passwordaginggrid.addWidget(label,2,1)
self.disableexpireedit = QSpinBox(passwordagingwidget)
self.disableexpireedit = TQSpinBox(passwordagingwidget)
self.disableexpireedit.setPrefix(i18n("After "))
self.disableexpireedit.setSuffix(i18n(" days"))
self.disableexpireedit.setMinValue(0)
@ -798,17 +809,17 @@ class UserEditDialog(KDialogBase):
self.disableexpireedit.setSpecialValueText(i18n("Never"))
passwordaginggrid.addWidget(self.disableexpireedit,2,2)
self.enforcepasswordminagecheckbox = QCheckBox(passwordagingwidget)
self.enforcepasswordminagecheckbox = TQCheckBox(passwordagingwidget)
self.connect(self.enforcepasswordminagecheckbox,SIGNAL("toggled(bool)"),self.slotEnforePasswordAgeToggled)
passwordaginggrid.addWidget(self.enforcepasswordminagecheckbox,3,0)
label = QLabel(i18n("Enforce minimum password age:"),passwordagingwidget)
label = TQLabel(i18n("Enforce minimum password age:"),passwordagingwidget)
passwordaginggrid.addWidget(label,3,1)
self.minimumpasswordedit = QSpinBox(passwordagingwidget)
self.minimumpasswordedit = TQSpinBox(passwordagingwidget)
self.minimumpasswordedit.setSuffix(i18n(" days"))
passwordaginggrid.addWidget(self.minimumpasswordedit,3,2)
spacer = QWidget(passwordvbox)
spacer = TQWidget(passwordvbox)
passwordvbox.setStretchFactor(spacer,1)
self.homedirdialog = KDirSelectDialog("/",True,self,"Select Home Directory",True)
@ -834,7 +845,7 @@ class UserEditDialog(KDialogBase):
else:
name = unicode(group).encode(locale.getpreferredencoding())
wid = self.groupslistview
self.secondarygroupcheckboxes[group] = QCheckListItem(wid,name,QCheckListItem.CheckBox)
self.secondarygroupcheckboxes[group] = TQCheckListItem(wid,name,TQCheckListItem.CheckBox)
########################################################################
def showEditUser(self,userid):
@ -849,8 +860,8 @@ class UserEditDialog(KDialogBase):
# Rudd-O: now here we tick the appropriate group listing checkbox, and hide the currently active primary group of the user. We are repopulating because if the user to edit changes, we need to hide the user's secondary group. FIXME we should repopulate the groups privileges list when the primary group is changed in the other tab -- that is, on the change slot of the primary group drop down.
self._repopulateGroupsPrivileges(excludegroups=[self.userobj.getPrimaryGroup()])
for group,checkbox in self.secondarygroupcheckboxes.items():
if group in self.selectedgroups: checkbox.setState(QCheckListItem.On)
else: checkbox.setState(QCheckListItem.Off)
if group in self.selectedgroups: checkbox.setState(TQCheckListItem.On)
else: checkbox.setState(TQCheckListItem.Off)
self.originalgroups = self.selectedgroups[:]
self.selectedgroups.sort()
@ -858,7 +869,7 @@ class UserEditDialog(KDialogBase):
self.uidedit.setReadOnly(True)
self.updatingGUI = False
self.homedirectoryislinked = False
if self.exec_loop()==QDialog.Accepted:
if self.exec_loop()==TQDialog.Accepted:
self.__updateObjectFromGUI(self.userobj)
# Set the password.
if self.passwordedit.password()!="":
@ -896,8 +907,8 @@ class UserEditDialog(KDialogBase):
# Rudd-O FIXME: now here we tick the proper groups that should be allowed. Now it selects what userconfig selected before. FIXME consider adding a drop down that will select the appropriate profile Limited User, Advanced User or Administrator (and see if there is a config file where these profiles can be read). We are repopulating because if the user to edit changes, we need to hide the user's secondary group. FIXME we should repopulate the groups privileges list when the primary group is changed in the other tab -- that is, on the change slot of the primary group drop down.
self._repopulateGroupsPrivileges()
for group,checkbox in self.secondarygroupcheckboxes.items():
if group in self.selectedgroups: checkbox.setState(QCheckListItem.On)
else: checkbox.setState(QCheckListItem.Off)
if group in self.selectedgroups: checkbox.setState(TQCheckListItem.On)
else: checkbox.setState(TQCheckListItem.Off)
self.userobj.setHomeDirectory(homedir)
self.homediredit.setText(homedir)
@ -919,7 +930,7 @@ class UserEditDialog(KDialogBase):
self.updatingGUI = False
self.homedirectoryislinked = True
self.passwordedit.erase()
if self.exec_loop()==QDialog.Accepted:
if self.exec_loop()==TQDialog.Accepted:
self.__updateObjectFromGUI(self.userobj)
makehomedir = True
@ -1114,7 +1125,7 @@ class UserEditDialog(KDialogBase):
userobj.setExpirationDate(None)
else:
# Password will expire at...
userobj.setExpirationDate(QDateToSptime(self.expiredate.date()))
userobj.setExpirationDate(TQDateToSptime(self.expiredate.date()))
if self.forcepasswordchangecheckbox.isChecked():
userobj.setMaximumPasswordAge(self.maximumpasswordedit.value())
@ -1138,7 +1149,7 @@ class UserEditDialog(KDialogBase):
fileurl = KURL()
fileurl.setPath(self.homediredit.text())
self.homedirdialog.setCurrentURL(fileurl)
if self.homedirdialog.exec_loop()==QDialog.Accepted:
if self.homedirdialog.exec_loop()==TQDialog.Accepted:
self.homediredit.setText(self.homedirdialog.url().path())
self.homedirectoryislinked = False
@ -1194,27 +1205,27 @@ class UserEditDialog(KDialogBase):
###########################################################################
class LoginNameValidator(QValidator):
class LoginNameValidator(TQValidator):
def __init__(self,parent):
QValidator.__init__(self,parent)
TQValidator.__init__(self,parent)
#######################################################################
def validate(self,inputstr,pos):
instr = unicode(inputstr)
if len(instr)==0:
return (QValidator.Intermediate,pos)
return (TQValidator.Intermediate,pos)
for c in instr:
if ord(c)<0x20 or ord(c)>0x7f or c.isspace() or c==":" or c=="," or c==".":
return (QValidator.Invalid,pos)
return (TQValidator.Invalid,pos)
# Try to encode this string in the system encoding.
try:
instr.encode(locale.getpreferredencoding())
except UnicodeEncodeError:
# won't encode -> reject it.
return (QValidator.Invalid,pos)
return (TQValidator.Invalid,pos)
return (QValidator.Acceptable,pos)
return (TQValidator.Acceptable,pos)
#######################################################################
def fixup(self,inputstr):
@ -1230,25 +1241,25 @@ class LoginNameValidator(QValidator):
return newstr
###########################################################################
class RealUserNameValidator(QValidator):
class RealUserNameValidator(TQValidator):
def __init__(self,parent):
QValidator.__init__(self,parent)
TQValidator.__init__(self,parent)
#######################################################################
def validate(self,inputstr,pos):
instr = unicode(inputstr)
for c in instr:
if c==":":
return (QValidator.Invalid,pos)
return (TQValidator.Invalid,pos)
# Try to encode this string in the system encoding.
try:
instr.encode(locale.getpreferredencoding())
except UnicodeEncodeError:
# won't encode -> reject it.
return (QValidator.Invalid,pos)
return (TQValidator.Invalid,pos)
return (QValidator.Acceptable,pos)
return (TQValidator.Acceptable,pos)
#######################################################################
def fixup(self,inputstr):
@ -1259,21 +1270,21 @@ class ListPickerDialog(KDialogBase):
def __init__(self,parent,caption,leftlabel,rightlabel):
KDialogBase.__init__(self,parent,None,True,caption,KDialogBase.Ok|KDialogBase.Cancel, KDialogBase.Cancel)
self.tophbox = QHBox(self)
self.tophbox = TQHBox(self)
self.setMainWidget(self.tophbox)
self.tophbox.setSpacing(self.spacingHint())
# Available Groups
vbox = QVBox(self.tophbox)
vbox = TQVBox(self.tophbox)
self.tophbox.setStretchFactor(vbox,1)
label = QLabel(leftlabel,vbox)
label = TQLabel(leftlabel,vbox)
vbox.setStretchFactor(label,0)
self.availablelist = TDEListBox(vbox)
vbox.setStretchFactor(self.availablelist,1)
# ->, <- Buttons
vbox = QVBox(self.tophbox)
vbox = TQVBox(self.tophbox)
self.tophbox.setStretchFactor(vbox,0)
spacer = QWidget(vbox);
spacer = TQWidget(vbox);
vbox.setStretchFactor(spacer,1)
self.addbutton = KPushButton(i18n("Add ->"),vbox)
self.connect(self.addbutton,SIGNAL("clicked()"),self.slotAddClicked)
@ -1281,13 +1292,13 @@ class ListPickerDialog(KDialogBase):
self.removebutton = KPushButton(i18n("<- Remove"),vbox)
self.connect(self.removebutton,SIGNAL("clicked()"),self.slotRemoveClicked)
vbox.setStretchFactor(self.removebutton,0)
spacer = QWidget(vbox);
spacer = TQWidget(vbox);
vbox.setStretchFactor(spacer,1)
# Selected Groups
vbox = QVBox(self.tophbox)
vbox = TQVBox(self.tophbox)
self.tophbox.setStretchFactor(vbox,1)
label = QLabel(rightlabel,vbox)
label = TQLabel(rightlabel,vbox)
vbox.setStretchFactor(label,0)
self.selectedlist = TDEListBox(vbox)
vbox.setStretchFactor(self.selectedlist,1)
@ -1311,7 +1322,7 @@ class ListPickerDialog(KDialogBase):
self._selectFirstSelected()
self.removebutton.setDisabled(self.selectedlist.selectedItem()==None)
if self.exec_loop()==QDialog.Accepted:
if self.exec_loop()==TQDialog.Accepted:
newlist = []
for i in range(self.selectedlist.count()):
newlist.append(unicode(self.selectedlist.item(i).text()))
@ -1356,56 +1367,56 @@ class ListPickerDialog(KDialogBase):
###########################################################################
class UserDeleteDialog(KDialog):
def __init__(self,parent,admincontext):
KDialog.__init__(self,parent,"Delete user dialog",True,Qt.WType_Dialog)
KDialog.__init__(self,parent,"Delete user dialog",True,TQt.WType_Dialog)
self.setCaption(i18n("Delete User Account"))
self.admincontext = admincontext
self.updatingGUI = True
toplayout = QVBoxLayout(self)
toplayout = TQVBoxLayout(self)
toplayout.setSpacing(self.spacingHint())
toplayout.setMargin(self.marginHint())
contentbox = QHBox(self)
contentbox = TQHBox(self)
contentbox.setSpacing(self.spacingHint())
toplayout.addWidget(contentbox)
toplayout.setStretchFactor(contentbox,1)
label = QLabel(contentbox)
label = TQLabel(contentbox)
label.setPixmap(TDEGlobal.iconLoader().loadIcon("messagebox_warning", TDEIcon.NoGroup, TDEIcon.SizeMedium,
TDEIcon.DefaultState, None, True))
contentbox.setStretchFactor(label,0)
textbox = QVBox(contentbox)
textbox = TQVBox(contentbox)
textbox.setSpacing(self.spacingHint())
textbox.setMargin(self.marginHint())
self.usernamelabel = QLabel("",textbox)
self.usernamelabel = TQLabel("",textbox)
textbox.setStretchFactor(self.usernamelabel,0)
# Remove directory checkbox.
self.deletedirectorycheckbox = QCheckBox(i18n("Delete home directory ()"),textbox)
self.deletedirectorycheckbox = TQCheckBox(i18n("Delete home directory ()"),textbox)
textbox.setStretchFactor(self.deletedirectorycheckbox,0)
# Delete the User's private group.
self.deletegroupcheckbox = QCheckBox(i18n("Delete group ()"),textbox)
self.deletegroupcheckbox = TQCheckBox(i18n("Delete group ()"),textbox)
textbox.setStretchFactor(self.deletegroupcheckbox ,0)
# Buttons
buttonbox = QHBox(self)
buttonbox = TQHBox(self)
toplayout.addWidget(buttonbox)
buttonbox.setSpacing(self.spacingHint())
toplayout.setStretchFactor(buttonbox,0)
spacer = QWidget(buttonbox)
spacer = TQWidget(buttonbox)
buttonbox.setStretchFactor(spacer,1)
okbutton = QPushButton(i18n("OK"),buttonbox)
okbutton = TQPushButton(i18n("OK"),buttonbox)
buttonbox.setStretchFactor(okbutton,0)
self.connect(okbutton,SIGNAL("clicked()"),self.slotOkClicked)
cancelbutton = QPushButton(i18n("Cancel"),buttonbox)
cancelbutton = TQPushButton(i18n("Cancel"),buttonbox)
cancelbutton.setDefault(True)
buttonbox.setStretchFactor(cancelbutton,0)
self.connect(cancelbutton,SIGNAL("clicked()"),self.slotCancelClicked)
@ -1420,7 +1431,7 @@ class UserDeleteDialog(KDialog):
primarygroupname = primarygroupobj.getGroupname()
self.deletegroupcheckbox.setText(i18n("Delete group '%1' (%2)").arg(primarygroupname).arg(primarygroupobj.getGID()))
self.deletegroupcheckbox.setChecked(len(primarygroupobj.getUsers())==1)
if self.exec_loop()==QDialog.Accepted:
if self.exec_loop()==TQDialog.Accepted:
self.admincontext.removeUser(userobj)
if self.deletedirectorycheckbox.isChecked():
self.admincontext.removeHomeDirectory(userobj)
@ -1446,62 +1457,62 @@ class OverwriteHomeDirectoryDialog(KDialog):
OK_REPLACE = 2
def __init__(self,parent):
KDialog.__init__(self,parent,"Create home directory",True,Qt.WType_Dialog)
KDialog.__init__(self,parent,"Create home directory",True,TQt.WType_Dialog)
self.setCaption(i18n("Create home directory"))
self.updatingGUI = True
toplayout = QVBoxLayout(self)
toplayout = TQVBoxLayout(self)
toplayout.setSpacing(self.spacingHint())
toplayout.setMargin(self.marginHint())
contentbox = QHBox(self)
contentbox = TQHBox(self)
contentbox.setSpacing(self.spacingHint())
toplayout.addWidget(contentbox)
toplayout.setStretchFactor(contentbox,1)
label = QLabel(contentbox)
label = TQLabel(contentbox)
label.setPixmap(TDEGlobal.iconLoader().loadIcon("messagebox_warning", TDEIcon.NoGroup, TDEIcon.SizeMedium,
TDEIcon.DefaultState, None, True))
contentbox.setStretchFactor(label,0)
textbox = QVBox(contentbox)
textbox = TQVBox(contentbox)
textbox.setSpacing(self.spacingHint())
textbox.setMargin(self.marginHint())
# "%dir was selected as the home directory for %user. This directory already exists. Shall I:."
self.toplabel = QLabel("",textbox)
self.toplabel = TQLabel("",textbox)
textbox.setStretchFactor(self.toplabel,0)
self.radiogroup = QButtonGroup()
self.radiogroup = TQButtonGroup()
self.radiogroup.setRadioButtonExclusive(True)
# Use Existing home directory radio button.
self.usehomedirectoryradio = QRadioButton(i18n("Use the existing directory without changing it."),textbox)
self.usehomedirectoryradio = TQRadioButton(i18n("Use the existing directory without changing it."),textbox)
textbox.setStretchFactor(self.usehomedirectoryradio,0)
# Replace home directory radio button
self.replacehomedirectoryradio = QRadioButton(i18n("Delete the directory and replace it with a new home directory."),textbox)
self.replacehomedirectoryradio = TQRadioButton(i18n("Delete the directory and replace it with a new home directory."),textbox)
textbox.setStretchFactor(self.replacehomedirectoryradio ,0)
self.radiogroup.insert(self.usehomedirectoryradio,0)
self.radiogroup.insert(self.replacehomedirectoryradio,1)
# Buttons
buttonbox = QHBox(self)
buttonbox = TQHBox(self)
toplayout.addWidget(buttonbox)
buttonbox.setSpacing(self.spacingHint())
toplayout.setStretchFactor(buttonbox,0)
spacer = QWidget(buttonbox)
spacer = TQWidget(buttonbox)
buttonbox.setStretchFactor(spacer,1)
okbutton = QPushButton(i18n("OK"),buttonbox)
okbutton = TQPushButton(i18n("OK"),buttonbox)
buttonbox.setStretchFactor(okbutton,0)
self.connect(okbutton,SIGNAL("clicked()"),self.slotOkClicked)
cancelbutton = QPushButton(i18n("Cancel"),buttonbox)
cancelbutton = TQPushButton(i18n("Cancel"),buttonbox)
cancelbutton.setDefault(True)
buttonbox.setStretchFactor(cancelbutton,0)
self.connect(cancelbutton,SIGNAL("clicked()"),self.slotCancelClicked)
@ -1512,7 +1523,7 @@ class OverwriteHomeDirectoryDialog(KDialog):
.arg(userobj.getHomeDirectory()).arg(userobj.getUsername()) )
self.radiogroup.setButton(0)
if self.exec_loop()==QDialog.Accepted:
if self.exec_loop()==TQDialog.Accepted:
if self.radiogroup.selectedId()==0:
return OverwriteHomeDirectoryDialog.OK_KEEP
else:
@ -1534,47 +1545,47 @@ class GroupEditDialog(KDialogBase):
self.admincontext = admincontext
topvbox = QVBox(self)
topvbox = TQVBox(self)
topvbox.setSpacing(self.spacingHint())
self.setMainWidget(topvbox)
detailspace = QWidget(topvbox)
detailspace = TQWidget(topvbox)
# Info about the group.
editgrid = QGridLayout(detailspace,2,2)
editgrid = TQGridLayout(detailspace,2,2)
editgrid.setSpacing(self.spacingHint())
label = QLabel(i18n("Group Name:"),detailspace)
label = TQLabel(i18n("Group Name:"),detailspace)
editgrid.addWidget(label,0,0)
self.groupnamelabel = KLineEdit("",detailspace)
self.groupnamelabel.setReadOnly(True)
editgrid.addWidget(self.groupnamelabel,0,1)
label = QLabel(i18n("Group ID:"),detailspace)
label = TQLabel(i18n("Group ID:"),detailspace)
editgrid.addWidget(label,1,0)
self.groupidlabel = KLineEdit("",detailspace)
self.groupidlabel.setReadOnly(True)
editgrid.addWidget(self.groupidlabel,1,1)
# Available Groups
tophbox = QHBox(topvbox)
tophbox = TQHBox(topvbox)
tophbox.setSpacing(self.spacingHint())
hbox = tophbox
vbox = QVBox(hbox)
vbox = TQVBox(hbox)
vbox.setSpacing(self.spacingHint())
hbox.setStretchFactor(vbox,1)
label = QLabel(i18n("Available Accounts"),vbox)
label = TQLabel(i18n("Available Accounts"),vbox)
vbox.setStretchFactor(label,0)
self.availablelist = TDEListBox(vbox)
vbox.setStretchFactor(self.availablelist,1)
# ->, <- Buttons
vbox = QVBox(hbox)
vbox = TQVBox(hbox)
vbox.setSpacing(self.spacingHint())
hbox.setStretchFactor(vbox,0)
spacer = QWidget(vbox);
spacer = TQWidget(vbox);
vbox.setStretchFactor(spacer,1)
self.addbutton = KPushButton(i18n("Add ->"),vbox)
self.connect(self.addbutton,SIGNAL("clicked()"),self.slotAddClicked)
@ -1582,14 +1593,14 @@ class GroupEditDialog(KDialogBase):
self.removebutton = KPushButton(i18n("<- Remove"),vbox)
self.connect(self.removebutton,SIGNAL("clicked()"),self.slotRemoveClicked)
vbox.setStretchFactor(self.removebutton,0)
spacer = QWidget(vbox);
spacer = TQWidget(vbox);
vbox.setStretchFactor(spacer,1)
# Selected Groups
vbox = QVBox(hbox)
vbox = TQVBox(hbox)
vbox.setSpacing(self.spacingHint())
hbox.setStretchFactor(vbox,1)
label = QLabel(i18n("Selected Accounts"),vbox)
label = TQLabel(i18n("Selected Accounts"),vbox)
vbox.setStretchFactor(label,0)
self.selectedlist = TDEListBox(vbox)
vbox.setStretchFactor(self.selectedlist,1)
@ -1609,7 +1620,7 @@ class GroupEditDialog(KDialogBase):
self.__updateLists(availablemembers,originalmembers)
if self.exec_loop()==QDialog.Accepted:
if self.exec_loop()==TQDialog.Accepted:
newmembers = []
for i in range(self.selectedlist.count()):
newmembers.append(unicode(self.selectedlist.item(i).text()))
@ -1646,7 +1657,7 @@ class GroupEditDialog(KDialogBase):
self.__updateLists(availablemembers,[])
if self.exec_loop()==QDialog.Accepted:
if self.exec_loop()==TQDialog.Accepted:
self.groupobj.setGroupname(unicode(self.groupnamelabel.text()))
newgroupid = int(unicode(self.groupidlabel.text()))
self.groupobj.setGID(newgroupid)

Loading…
Cancel
Save