V0.6 #852

Merged
Atheros1 merged 399 commits from v0.6 into master 2016-05-03 01:58:38 +02:00
Showing only changes of commit bf9bdaadc5 - Show all commits

View File

@ -89,7 +89,6 @@ class MyForm(QtGui.QMainWindow):
# the maximum frequency of message sounds in seconds # the maximum frequency of message sounds in seconds
maxSoundFrequencySec = 60 maxSoundFrequencySec = 60
str_broadcast_subscribers = '[Broadcast subscribers]'
str_chan = '[chan]' str_chan = '[chan]'
def init_file_menu(self): def init_file_menu(self):
@ -1161,7 +1160,7 @@ class MyForm(QtGui.QMainWindow):
for row in queryreturn: for row in queryreturn:
toAddress, read = row toAddress, read = row
if not read: if not read:
if toAddress == self.str_broadcast_subscribers: if toAddress == str_broadcast_subscribers:
if self.mmapp.has_source("Subscriptions"): if self.mmapp.has_source("Subscriptions"):
self.mmapp.remove_source("Subscriptions") self.mmapp.remove_source("Subscriptions")
else: else:
@ -1179,8 +1178,8 @@ class MyForm(QtGui.QMainWindow):
msgid, toAddress, read = row msgid, toAddress, read = row
try: try:
if toAddress == self.str_broadcast_subscribers: if toAddress == str_broadcast_subscribers:
toLabel = self.str_broadcast_subscribers toLabel = str_broadcast_subscribers
else: else:
toLabel = shared.config.get(toAddress, 'label') toLabel = shared.config.get(toAddress, 'label')
except: except:
@ -1189,7 +1188,7 @@ class MyForm(QtGui.QMainWindow):
toLabel = toAddress toLabel = toAddress
if not read: if not read:
if toLabel == self.str_broadcast_subscribers: if toLabel == str_broadcast_subscribers:
# increment the unread subscriptions # increment the unread subscriptions
unreadSubscriptions = unreadSubscriptions + 1 unreadSubscriptions = unreadSubscriptions + 1
else: else:
@ -1254,7 +1253,7 @@ class MyForm(QtGui.QMainWindow):
return return
# remember this item to that the messaging menu can find it # remember this item to that the messaging menu can find it
if toLabel == self.str_broadcast_subscribers: if toLabel == str_broadcast_subscribers:
self.newBroadcastItem = newItem self.newBroadcastItem = newItem
else: else:
self.newMessageItem = newItem self.newMessageItem = newItem
@ -2098,7 +2097,7 @@ class MyForm(QtGui.QMainWindow):
# this is a broadcast message, but we can use it to update the # this is a broadcast message, but we can use it to update the
# user interface when the POW is done generating. # user interface when the POW is done generating.
ackdata = OpenSSL.rand(32) ackdata = OpenSSL.rand(32)
toAddress = self.str_broadcast_subscribers toAddress = str_broadcast_subscribers
ripe = '' ripe = ''
t = ('', # msgid. We don't know what this will be until the POW is done. t = ('', # msgid. We don't know what this will be until the POW is done.
toAddress, toAddress,
@ -2119,7 +2118,7 @@ class MyForm(QtGui.QMainWindow):
sqlExecute( sqlExecute(
'''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', *t) '''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', *t)
toLabel = self.str_broadcast_subscribers toLabel = str_broadcast_subscribers
self.displayNewSentMessage( self.displayNewSentMessage(
toAddress, toLabel, fromAddress, subject, message, ackdata) toAddress, toLabel, fromAddress, subject, message, ackdata)
@ -2179,15 +2178,13 @@ class MyForm(QtGui.QMainWindow):
def rerenderComboBoxSendFromBroadcast(self): def rerenderComboBoxSendFromBroadcast(self):
self.ui.comboBoxSendFromBroadcast.clear() self.ui.comboBoxSendFromBroadcast.clear()
configSections = shared.config.sections() queryreturn = sqlQuery(
for addressInKeysFile in configSections: '''select label, address from subscriptions where enabled = 1'''
if addressInKeysFile != 'bitmessagesettings': )
isEnabled = shared.config.getboolean(
addressInKeysFile, 'enabled') # I realize that this is poor programming practice but I don't care. It's easier for others to read. for row in queryreturn:
isMaillinglist = shared.safeConfigGetBoolean(addressInKeysFile, 'mailinglist') label, address = row
if isEnabled and isMaillinglist: self.ui.comboBoxSendFromBroadcast.insertItem(0, avatarize(address), unicode(label, 'utf-8'), address)
self.ui.comboBoxSendFromBroadcast.insertItem(0, avatarize(addressInKeysFile), unicode(shared.config.get(
addressInKeysFile, 'label'), 'utf-8'), addressInKeysFile)
self.ui.comboBoxSendFromBroadcast.insertItem(0, '', '') self.ui.comboBoxSendFromBroadcast.insertItem(0, '', '')
if(self.ui.comboBoxSendFromBroadcast.count() == 2): if(self.ui.comboBoxSendFromBroadcast.count() == 2):
self.ui.comboBoxSendFromBroadcast.setCurrentIndex(1) self.ui.comboBoxSendFromBroadcast.setCurrentIndex(1)
@ -2863,9 +2860,19 @@ class MyForm(QtGui.QMainWindow):
for row in queryreturn: for row in queryreturn:
messageAtCurrentInboxRow, = row messageAtCurrentInboxRow, = row
acct.parseMessage(toAddressAtCurrentInboxRow, fromAddressAtCurrentInboxRow, str(tableWidget.item(currentInboxRow, 2).data(Qt.UserRole).toPyObject()), messageAtCurrentInboxRow) acct.parseMessage(toAddressAtCurrentInboxRow, fromAddressAtCurrentInboxRow, str(tableWidget.item(currentInboxRow, 2).data(Qt.UserRole).toPyObject()), messageAtCurrentInboxRow)
if toAddressAtCurrentInboxRow == self.str_broadcast_subscribers: widget = {
#TODO what does this if?.. 'subject': self.ui.lineEditSubject,
a = a 'from': self.ui.comboBoxSendFrom,
'message': self.ui.textEditMessage
}
if toAddressAtCurrentInboxRow == str_broadcast_subscribers:
widget = {
'subject': self.ui.lineEditSubjectBroadcast,
'from': self.ui.comboBoxSendFromBroadcast,
'message': self.ui.textEditMessageBroadcast
}
self.ui.tabWidgetSend.setCurrentIndex(1)
toAddressAtCurrentInboxRow = fromAddressAtCurrentInboxRow
elif not shared.config.has_section(toAddressAtCurrentInboxRow): elif not shared.config.has_section(toAddressAtCurrentInboxRow):
QtGui.QMessageBox.information(self, _translate("MainWindow", "Address is gone"), _translate( QtGui.QMessageBox.information(self, _translate("MainWindow", "Address is gone"), _translate(
"MainWindow", "Bitmessage cannot find your address %1. Perhaps you removed it?").arg(toAddressAtCurrentInboxRow), QMessageBox.Ok) "MainWindow", "Bitmessage cannot find your address %1. Perhaps you removed it?").arg(toAddressAtCurrentInboxRow), QMessageBox.Ok)
@ -2873,9 +2880,10 @@ class MyForm(QtGui.QMainWindow):
QtGui.QMessageBox.information(self, _translate("MainWindow", "Address disabled"), _translate( QtGui.QMessageBox.information(self, _translate("MainWindow", "Address disabled"), _translate(
"MainWindow", "Error: The address from which you are trying to send is disabled. You\'ll have to enable it on the \'Your Identities\' tab before using it."), QMessageBox.Ok) "MainWindow", "Error: The address from which you are trying to send is disabled. You\'ll have to enable it on the \'Your Identities\' tab before using it."), QMessageBox.Ok)
else: else:
self.setBroadcastEnablementDependingOnWhetherThisIsAChanAddress(toAddressAtCurrentInboxRow) #self.setBroadcastEnablementDependingOnWhetherThisIsAChanAddress(toAddressAtCurrentInboxRow)
self.ui.tabWidgetSend.setCurrentIndex(0)
self.ui.lineEditTo.setText(str(acct.fromLabel)) self.ui.lineEditTo.setText(str(acct.fromAddress))
# If the previous message was to a chan then we should send our reply to the chan rather than to the particular person who sent the message. # If the previous message was to a chan then we should send our reply to the chan rather than to the particular person who sent the message.
if shared.config.has_section(toAddressAtCurrentInboxRow): if shared.config.has_section(toAddressAtCurrentInboxRow):
@ -2883,20 +2891,19 @@ class MyForm(QtGui.QMainWindow):
print 'original sent to a chan. Setting the to address in the reply to the chan address.' print 'original sent to a chan. Setting the to address in the reply to the chan address.'
self.ui.lineEditTo.setText(str(toAddressAtCurrentInboxRow)) self.ui.lineEditTo.setText(str(toAddressAtCurrentInboxRow))
listOfAddressesInComboBoxSendFrom = [str(self.ui.comboBoxSendFrom.itemData(i).toPyObject()) for i in range(self.ui.comboBoxSendFrom.count())] listOfAddressesInComboBoxSendFrom = [str(widget['from'].itemData(i).toPyObject()) for i in range(widget['from'].count())]
if toAddressAtCurrentInboxRow in listOfAddressesInComboBoxSendFrom: if toAddressAtCurrentInboxRow in listOfAddressesInComboBoxSendFrom:
currentIndex = listOfAddressesInComboBoxSendFrom.index(toAddressAtCurrentInboxRow) currentIndex = listOfAddressesInComboBoxSendFrom.index(toAddressAtCurrentInboxRow)
self.ui.comboBoxSendFrom.setCurrentIndex(currentIndex) widget['from'].setCurrentIndex(currentIndex)
else: else:
self.ui.comboBoxSendFrom.setCurrentIndex(0) widget['from'].setCurrentIndex(0)
quotedText = self.quoted_text(unicode(messageAtCurrentInboxRow, 'utf-8')) quotedText = self.quoted_text(unicode(messageAtCurrentInboxRow, 'utf-8'))
self.ui.textEditMessage.setText(quotedText) widget['message'].setText(quotedText)
if acct.subject[0:3] in ['Re:', 'RE:']: if acct.subject[0:3] in ['Re:', 'RE:']:
self.ui.lineEditSubject.setText(acct.subject) widget['subject'].setText(acct.subject)
else: else:
self.ui.lineEditSubject.setText('Re: ' + acct.subject) widget['subject'].setText('Re: ' + acct.subject)
self.ui.tabWidgetSend.setCurrentIndex(0)
self.ui.tabWidget.setCurrentIndex(1) self.ui.tabWidget.setCurrentIndex(1)
def on_action_InboxAddSenderToAddressBook(self): def on_action_InboxAddSenderToAddressBook(self):