Example #1
0
	def editPassword(self, item):
		row = self.passwordTable.row(item)
		group = self.pwMap.groups[self.selectedGroup]
		try:
			decrypted = self.cachedOrDecrypt(row)
		except CallException:
			return
		
		dialog = AddPasswordDialog()
		entry = group.entry(row)
		dialog.keyEdit.setText(s2q(entry[0]))
		dialog.pwEdit1.setText(s2q(decrypted))
		dialog.pwEdit2.setText(s2q(decrypted))
		
		if not dialog.exec_():
			return
		
		item = QtGui.QTableWidgetItem(dialog.key())
		pwItem = QtGui.QTableWidgetItem("*****")
		self.passwordTable.setItem(row, self.KEY_IDX, item)
		self.passwordTable.setItem(row, self.PASSWORD_IDX, pwItem)
		
		plainPw = q2s(dialog.pw1())
		encPw = self.pwMap.encryptPassword(plainPw, self.selectedGroup)
		bkupPw = self.pwMap.backupKey.encryptPassword(plainPw)
		group.updateEntry(row, q2s(dialog.key()), encPw, bkupPw)
		
		self.cachePassword(row, plainPw)
		self.setModified(True)
Example #2
0
	def createPassword(self):
		"""Slot to create key-value password entry.
		"""
		if self.selectedGroup is None:
			return
		group = self.pwMap.groups[self.selectedGroup]
		dialog = AddPasswordDialog()
		if not dialog.exec_():
			return
		
		rowCount = self.passwordTable.rowCount()
		self.passwordTable.setRowCount(rowCount+1)
		item = QtGui.QTableWidgetItem(dialog.key())
		pwItem = QtGui.QTableWidgetItem("*****")
		self.passwordTable.setItem(rowCount, self.KEY_IDX, item)
		self.passwordTable.setItem(rowCount, self.PASSWORD_IDX, pwItem)
		
		plainPw = q2s(dialog.pw1())
		encPw = self.pwMap.encryptPassword(plainPw, self.selectedGroup)
		bkupPw = self.pwMap.backupKey.encryptPassword(plainPw)
		group.addEntry(q2s(dialog.key()), encPw, bkupPw)
		
		self.cachePassword(rowCount, plainPw)
		
		self.passwordTable.resizeRowsToContents()
		self.setModified(True)
Example #3
0
 def createPassword(self):
     """
     Slot to create key-value password entry.
     """
     if self.selectedGroup is None:
         return
     group = self.pwMap.groups[self.selectedGroup]
     dialog = AddPasswordDialog()
     if not dialog.exec_():
         return
     rowCount = self.passwordTable.rowCount()
     self.passwordTable.setRowCount(rowCount + 1)
     item = QtGui.QTableWidgetItem(dialog.key())
     pwItem = QtGui.QTableWidgetItem("*****")
     self.passwordTable.setItem(rowCount, self.KEY_IDX, item)
     self.passwordTable.setItem(rowCount, self.PASSWORD_IDX, pwItem)
     plainPw = q2s(dialog.pw1())
     encPw = self.pwMap.encryptPassword(plainPw, self.selectedGroup)
     bkupPw = self.pwMap.backupKey.encryptPassword(plainPw)
     group.addEntry(q2s(dialog.key()), encPw, bkupPw)
     self.cachePassword(rowCount, plainPw)
     self.passwordTable.resizeRowsToContents()
     self.setModified(True)
Example #4
0
 def editPassword(self, item):
     row = self.passwordTable.row(item)
     group = self.pwMap.groups[self.selectedGroup]
     try:
         decrypted = self.cachedOrDecrypt(row)
     except CallException:
         return
     dialog = AddPasswordDialog()
     entry = group.entry(row)
     dialog.keyEdit.setText(s2q(entry[0]))
     dialog.pwEdit1.setText(s2q(decrypted))
     dialog.pwEdit2.setText(s2q(decrypted))
     if not dialog.exec_():
         return
     item = QtGui.QTableWidgetItem(dialog.key())
     pwItem = QtGui.QTableWidgetItem("*****")
     self.passwordTable.setItem(row, self.KEY_IDX, item)
     self.passwordTable.setItem(row, self.PASSWORD_IDX, pwItem)
     plainPw = q2s(dialog.pw1())
     encPw = self.pwMap.encryptPassword(plainPw, self.selectedGroup)
     bkupPw = self.pwMap.backupKey.encryptPassword(plainPw)
     group.updateEntry(row, q2s(dialog.key()), encPw, bkupPw)
     self.cachePassword(row, plainPw)
     self.setModified(True)