Conflicts:
	src/bitmessageqt/bitmessageui.py

poprawki z pybitmessage
This commit is contained in:
bartekn80 2013-07-14 13:31:51 +02:00
commit 1ebfba5168
11 changed files with 464 additions and 244 deletions

0
Makefile Executable file → Normal file
View File

0
debian.sh Executable file → Normal file
View File

0
debian/rules vendored Executable file → Normal file
View File

0
osx.sh Executable file → Normal file
View File

View File

@ -14,7 +14,7 @@ try:
from gevent import monkey
monkey.patch_all()
except ImportError as ex:
print "cannot find gevent"
print "Not using the gevent module as it was not found. No need to worry."
import signal # Used to capture a Ctrl-C keypress so that Bitmessage can shutdown gracefully.
# The next 3 are used for the API

View File

@ -313,205 +313,10 @@ class MyForm(QtGui.QMainWindow):
addressInKeysFile)
# Load inbox from messages database file
font = QFont()
font.setBold(True)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(
'''SELECT msgid, toaddress, fromaddress, subject, received, message, read FROM inbox where folder='inbox' ORDER BY received''')
shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn:
msgid, toAddress, fromAddress, subject, received, message, read = row
subject = shared.fixPotentiallyInvalidUTF8Data(subject)
message = shared.fixPotentiallyInvalidUTF8Data(message)
try:
if toAddress == self.str_broadcast_subscribers:
toLabel = self.str_broadcast_subscribers
else:
toLabel = shared.config.get(toAddress, 'label')
except:
toLabel = ''
if toLabel == '':
toLabel = toAddress
fromLabel = ''
t = (fromAddress,)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(
'''select label from addressbook where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []:
for row in queryreturn:
fromLabel, = row
if fromLabel == '': # If this address wasn't in our address book...
t = (fromAddress,)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(
'''select label from subscriptions where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []:
for row in queryreturn:
fromLabel, = row
self.ui.tableWidgetInbox.insertRow(0)
newItem = QtGui.QTableWidgetItem(unicode(toLabel, 'utf-8'))
newItem.setToolTip(unicode(toLabel, 'utf-8'))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not read:
newItem.setFont(font)
newItem.setData(Qt.UserRole, str(toAddress))
if shared.safeConfigGetBoolean(toAddress, 'mailinglist'):
newItem.setTextColor(QtGui.QColor(137, 04, 177))
self.ui.tableWidgetInbox.setItem(0, 0, newItem)
if fromLabel == '':
newItem = QtGui.QTableWidgetItem(
unicode(fromAddress, 'utf-8'))
newItem.setToolTip(unicode(fromAddress, 'utf-8'))
else:
newItem = QtGui.QTableWidgetItem(unicode(fromLabel, 'utf-8'))
newItem.setToolTip(unicode(fromLabel, 'utf-8'))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not read:
newItem.setFont(font)
newItem.setData(Qt.UserRole, str(fromAddress))
self.ui.tableWidgetInbox.setItem(0, 1, newItem)
newItem = QtGui.QTableWidgetItem(unicode(subject, 'utf-8'))
newItem.setToolTip(unicode(subject, 'utf-8'))
newItem.setData(Qt.UserRole, unicode(message, 'utf-8)'))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not read:
newItem.setFont(font)
self.ui.tableWidgetInbox.setItem(0, 2, newItem)
newItem = myTableWidgetItem(unicode(strftime(shared.config.get(
'bitmessagesettings', 'timeformat'), localtime(int(received))), 'utf-8'))
newItem.setToolTip(unicode(strftime(shared.config.get(
'bitmessagesettings', 'timeformat'), localtime(int(received))), 'utf-8'))
newItem.setData(Qt.UserRole, QByteArray(msgid))
newItem.setData(33, int(received))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not read:
newItem.setFont(font)
self.ui.tableWidgetInbox.setItem(0, 3, newItem)
self.ui.tableWidgetInbox.sortItems(3, Qt.DescendingOrder)
self.ui.tableWidgetInbox.keyPressEvent = self.tableWidgetInboxKeyPressEvent
self.loadInbox()
# Load Sent items from database
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(
'''SELECT toaddress, fromaddress, subject, message, status, ackdata, lastactiontime FROM sent where folder = 'sent' ORDER BY lastactiontime''')
shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn:
toAddress, fromAddress, subject, message, status, ackdata, lastactiontime = row
subject = shared.fixPotentiallyInvalidUTF8Data(subject)
message = shared.fixPotentiallyInvalidUTF8Data(message)
try:
fromLabel = shared.config.get(fromAddress, 'label')
except:
fromLabel = ''
if fromLabel == '':
fromLabel = fromAddress
toLabel = ''
t = (toAddress,)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(
'''select label from addressbook where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []:
for row in queryreturn:
toLabel, = row
self.ui.tableWidgetSent.insertRow(0)
if toLabel == '':
newItem = QtGui.QTableWidgetItem(unicode(toAddress, 'utf-8'))
newItem.setToolTip(unicode(toAddress, 'utf-8'))
else:
newItem = QtGui.QTableWidgetItem(unicode(toLabel, 'utf-8'))
newItem.setToolTip(unicode(toLabel, 'utf-8'))
newItem.setData(Qt.UserRole, str(toAddress))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetSent.setItem(0, 0, newItem)
if fromLabel == '':
newItem = QtGui.QTableWidgetItem(
unicode(fromAddress, 'utf-8'))
newItem.setToolTip(unicode(fromAddress, 'utf-8'))
else:
newItem = QtGui.QTableWidgetItem(unicode(fromLabel, 'utf-8'))
newItem.setToolTip(unicode(fromLabel, 'utf-8'))
newItem.setData(Qt.UserRole, str(fromAddress))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetSent.setItem(0, 1, newItem)
newItem = QtGui.QTableWidgetItem(unicode(subject, 'utf-8'))
newItem.setToolTip(unicode(subject, 'utf-8'))
newItem.setData(Qt.UserRole, unicode(message, 'utf-8)'))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetSent.setItem(0, 2, newItem)
if status == 'awaitingpubkey':
statusText = _translate(
"MainWindow", "Waiting on their encryption key. Will request it again soon.")
elif status == 'doingpowforpubkey':
statusText = _translate(
"MainWindow", "Encryption key request queued.")
elif status == 'msgqueued':
statusText = _translate(
"MainWindow", "Queued.")
elif status == 'msgsent':
statusText = _translate("MainWindow", "Message sent. Waiting on acknowledgement. Sent at %1").arg(
unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)),'utf-8'))
elif status == 'doingmsgpow':
statusText = _translate(
"MainWindow", "Need to do work to send message. Work is queued.")
elif status == 'ackreceived':
statusText = _translate("MainWindow", "Acknowledgement of the message received %1").arg(
unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)),'utf-8'))
elif status == 'broadcastqueued':
statusText = _translate(
"MainWindow", "Broadcast queued.")
elif status == 'broadcastsent':
statusText = _translate("MainWindow", "Broadcast on %1").arg(unicode(strftime(
shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)),'utf-8'))
elif status == 'toodifficult':
statusText = _translate("MainWindow", "Problem: The work demanded by the recipient is more difficult than you are willing to do. %1").arg(
unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)),'utf-8'))
elif status == 'badkey':
statusText = _translate("MainWindow", "Problem: The recipient\'s encryption key is no good. Could not encrypt message. %1").arg(
unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)),'utf-8'))
elif status == 'forcepow':
statusText = _translate(
"MainWindow", "Forced difficulty override. Send should start soon.")
else:
statusText = _translate("MainWindow", "Unknown status: %1 %2").arg(status).arg(unicode(
strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)),'utf-8'))
newItem = myTableWidgetItem(statusText)
newItem.setToolTip(statusText)
newItem.setData(Qt.UserRole, QByteArray(ackdata))
newItem.setData(33, int(lastactiontime))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetSent.setItem(0, 3, newItem)
self.ui.tableWidgetSent.sortItems(3, Qt.DescendingOrder)
self.ui.tableWidgetSent.keyPressEvent = self.tableWidgetSentKeyPressEvent
self.loadSent()
# Initialize the address book
shared.sqlLock.acquire()
@ -532,6 +337,14 @@ class MyForm(QtGui.QMainWindow):
# Initialize the Subscriptions
self.rerenderSubscriptions()
# Initialize the inbox search
QtCore.QObject.connect(self.ui.inboxSearchLineEdit, QtCore.SIGNAL(
"returnPressed()"), self.inboxSearchLineEditPressed)
# Initialize the sent search
QtCore.QObject.connect(self.ui.sentSearchLineEdit, QtCore.SIGNAL(
"returnPressed()"), self.sentSearchLineEditPressed)
# Initialize the Blacklist or Whitelist
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
self.loadBlackWhiteList()
@ -736,6 +549,251 @@ class MyForm(QtGui.QMainWindow):
self.appIndicatorShow()
self.ui.tabWidget.setCurrentIndex(5)
# Load Sent items from database
def loadSent(self, where="", what=""):
what = "%" + what + "%"
if where == "To":
where = "toaddress"
elif where == "From":
where = "fromaddress"
elif where == "Subject":
where = "subject"
elif where == "Message":
where = "message"
else:
where = "toaddress || fromaddress || subject || message"
sqlQuery = '''
SELECT toaddress, fromaddress, subject, message, status, ackdata, lastactiontime
FROM sent WHERE folder="sent" AND %s LIKE ?
ORDER BY lastactiontime
''' % (where,)
while self.ui.tableWidgetSent.rowCount() > 0:
self.ui.tableWidgetSent.removeRow(0)
t = (what,)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(sqlQuery)
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn:
toAddress, fromAddress, subject, message, status, ackdata, lastactiontime = row
subject = shared.fixPotentiallyInvalidUTF8Data(subject)
message = shared.fixPotentiallyInvalidUTF8Data(message)
try:
fromLabel = shared.config.get(fromAddress, 'label')
except:
fromLabel = ''
if fromLabel == '':
fromLabel = fromAddress
toLabel = ''
t = (toAddress,)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(
'''select label from addressbook where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []:
for row in queryreturn:
toLabel, = row
self.ui.tableWidgetSent.insertRow(0)
if toLabel == '':
newItem = QtGui.QTableWidgetItem(unicode(toAddress, 'utf-8'))
newItem.setToolTip(unicode(toAddress, 'utf-8'))
else:
newItem = QtGui.QTableWidgetItem(unicode(toLabel, 'utf-8'))
newItem.setToolTip(unicode(toLabel, 'utf-8'))
newItem.setData(Qt.UserRole, str(toAddress))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetSent.setItem(0, 0, newItem)
if fromLabel == '':
newItem = QtGui.QTableWidgetItem(
unicode(fromAddress, 'utf-8'))
newItem.setToolTip(unicode(fromAddress, 'utf-8'))
else:
newItem = QtGui.QTableWidgetItem(unicode(fromLabel, 'utf-8'))
newItem.setToolTip(unicode(fromLabel, 'utf-8'))
newItem.setData(Qt.UserRole, str(fromAddress))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetSent.setItem(0, 1, newItem)
newItem = QtGui.QTableWidgetItem(unicode(subject, 'utf-8'))
newItem.setToolTip(unicode(subject, 'utf-8'))
newItem.setData(Qt.UserRole, unicode(message, 'utf-8)'))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetSent.setItem(0, 2, newItem)
if status == 'awaitingpubkey':
statusText = _translate(
"MainWindow", "Waiting on their encryption key. Will request it again soon.")
elif status == 'doingpowforpubkey':
statusText = _translate(
"MainWindow", "Encryption key request queued.")
elif status == 'msgqueued':
statusText = _translate(
"MainWindow", "Queued.")
elif status == 'msgsent':
statusText = _translate("MainWindow", "Message sent. Waiting on acknowledgement. Sent at %1").arg(
unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)),'utf-8'))
elif status == 'doingmsgpow':
statusText = _translate(
"MainWindow", "Need to do work to send message. Work is queued.")
elif status == 'ackreceived':
statusText = _translate("MainWindow", "Acknowledgement of the message received %1").arg(
unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)),'utf-8'))
elif status == 'broadcastqueued':
statusText = _translate(
"MainWindow", "Broadcast queued.")
elif status == 'broadcastsent':
statusText = _translate("MainWindow", "Broadcast on %1").arg(unicode(strftime(
shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)),'utf-8'))
elif status == 'toodifficult':
statusText = _translate("MainWindow", "Problem: The work demanded by the recipient is more difficult than you are willing to do. %1").arg(
unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)),'utf-8'))
elif status == 'badkey':
statusText = _translate("MainWindow", "Problem: The recipient\'s encryption key is no good. Could not encrypt message. %1").arg(
unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)),'utf-8'))
elif status == 'forcepow':
statusText = _translate(
"MainWindow", "Forced difficulty override. Send should start soon.")
else:
statusText = _translate("MainWindow", "Unknown status: %1 %2").arg(status).arg(unicode(
strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)),'utf-8'))
newItem = myTableWidgetItem(statusText)
newItem.setToolTip(statusText)
newItem.setData(Qt.UserRole, QByteArray(ackdata))
newItem.setData(33, int(lastactiontime))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetSent.setItem(0, 3, newItem)
self.ui.tableWidgetSent.sortItems(3, Qt.DescendingOrder)
self.ui.tableWidgetSent.keyPressEvent = self.tableWidgetSentKeyPressEvent
# Load inbox from messages database file
def loadInbox(self, where="", what=""):
what = "%" + what + "%"
if where == "To":
where = "toaddress"
elif where == "From":
where = "fromaddress"
elif where == "Subject":
where = "subject"
elif where == "Message":
where = "message"
else:
where = "toaddress || fromaddress || subject || message"
sqlQuery = '''
SELECT msgid, toaddress, fromaddress, subject, received, message, read
FROM inbox WHERE folder="inbox" AND %s LIKE ?
ORDER BY received
''' % (where,)
while self.ui.tableWidgetInbox.rowCount() > 0:
self.ui.tableWidgetInbox.removeRow(0)
font = QFont()
font.setBold(True)
t = (what,)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(sqlQuery)
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn:
msgid, toAddress, fromAddress, subject, received, message, read = row
subject = shared.fixPotentiallyInvalidUTF8Data(subject)
message = shared.fixPotentiallyInvalidUTF8Data(message)
try:
if toAddress == self.str_broadcast_subscribers:
toLabel = self.str_broadcast_subscribers
else:
toLabel = shared.config.get(toAddress, 'label')
except:
toLabel = ''
if toLabel == '':
toLabel = toAddress
fromLabel = ''
t = (fromAddress,)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(
'''select label from addressbook where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []:
for row in queryreturn:
fromLabel, = row
if fromLabel == '': # If this address wasn't in our address book...
t = (fromAddress,)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(
'''select label from subscriptions where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []:
for row in queryreturn:
fromLabel, = row
self.ui.tableWidgetInbox.insertRow(0)
newItem = QtGui.QTableWidgetItem(unicode(toLabel, 'utf-8'))
newItem.setToolTip(unicode(toLabel, 'utf-8'))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not read:
newItem.setFont(font)
newItem.setData(Qt.UserRole, str(toAddress))
if shared.safeConfigGetBoolean(toAddress, 'mailinglist'):
newItem.setTextColor(QtGui.QColor(137, 04, 177))
self.ui.tableWidgetInbox.setItem(0, 0, newItem)
if fromLabel == '':
newItem = QtGui.QTableWidgetItem(
unicode(fromAddress, 'utf-8'))
newItem.setToolTip(unicode(fromAddress, 'utf-8'))
else:
newItem = QtGui.QTableWidgetItem(unicode(fromLabel, 'utf-8'))
newItem.setToolTip(unicode(fromLabel, 'utf-8'))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not read:
newItem.setFont(font)
newItem.setData(Qt.UserRole, str(fromAddress))
self.ui.tableWidgetInbox.setItem(0, 1, newItem)
newItem = QtGui.QTableWidgetItem(unicode(subject, 'utf-8'))
newItem.setToolTip(unicode(subject, 'utf-8'))
newItem.setData(Qt.UserRole, unicode(message, 'utf-8)'))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not read:
newItem.setFont(font)
self.ui.tableWidgetInbox.setItem(0, 2, newItem)
newItem = myTableWidgetItem(unicode(strftime(shared.config.get(
'bitmessagesettings', 'timeformat'), localtime(int(received))), 'utf-8'))
newItem.setToolTip(unicode(strftime(shared.config.get(
'bitmessagesettings', 'timeformat'), localtime(int(received))), 'utf-8'))
newItem.setData(Qt.UserRole, QByteArray(msgid))
newItem.setData(33, int(received))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not read:
newItem.setFont(font)
self.ui.tableWidgetInbox.setItem(0, 3, newItem)
self.ui.tableWidgetInbox.sortItems(3, Qt.DescendingOrder)
self.ui.tableWidgetInbox.keyPressEvent = self.tableWidgetInboxKeyPressEvent
# create application indicator
def appIndicatorInit(self, app):
self.tray = QSystemTrayIcon(QtGui.QIcon(
@ -2563,6 +2621,20 @@ class MyForm(QtGui.QMainWindow):
self.popMenuSent.addAction(self.actionForceSend)
self.popMenuSent.exec_(self.ui.tableWidgetSent.mapToGlobal(point))
def inboxSearchLineEditPressed(self):
searchKeyword = self.ui.inboxSearchLineEdit.text().toUtf8().data()
searchOption = self.ui.inboxSearchOptionCB.currentText().toUtf8().data()
self.ui.inboxSearchLineEdit.setText(QString(""))
self.ui.textEditInboxMessage.setPlainText(QString(""))
self.loadInbox(searchOption, searchKeyword)
def sentSearchLineEditPressed(self):
searchKeyword = self.ui.sentSearchLineEdit.text().toUtf8().data()
searchOption = self.ui.sentSearchOptionCB.currentText().toUtf8().data()
self.ui.sentSearchLineEdit.setText(QString(""))
self.ui.textEditInboxMessage.setPlainText(QString(""))
self.loadSent(searchOption, searchKeyword)
def tableWidgetInboxItemClicked(self):
currentRow = self.ui.tableWidgetInbox.currentRow()
if currentRow >= 0:

View File

@ -1,20 +1,20 @@
<RCC>
<qresource prefix="newPrefix">
<file>images/can-icon-24px-yellow.png</file>
<file>images/can-icon-24px-red.png</file>
<file>images/can-icon-24px-green.png</file>
<file>images/can-icon-24px.png</file>
<file>images/can-icon-16px.png</file>
<file>images/greenicon.png</file>
<file>images/redicon.png</file>
<file>images/yellowicon.png</file>
<file>images/addressbook.png</file>
<file>images/blacklist.png</file>
<file>images/identities.png</file>
<file>images/networkstatus.png</file>
<file>images/sent.png</file>
<file>images/subscriptions.png</file>
<file>images/send.png</file>
<file>images/inbox.png</file>
<file>../images/can-icon-24px-yellow.png</file>
<file>../images/can-icon-24px-red.png</file>
<file>../images/can-icon-24px-green.png</file>
<file>../images/can-icon-24px.png</file>
<file>../images/can-icon-16px.png</file>
<file>../images/greenicon.png</file>
<file>../images/redicon.png</file>
<file>../images/yellowicon.png</file>
<file>../images/addressbook.png</file>
<file>../images/blacklist.png</file>
<file>../images/identities.png</file>
<file>../images/networkstatus.png</file>
<file>../images/sent.png</file>
<file>../images/subscriptions.png</file>
<file>../images/send.png</file>
<file>../images/inbox.png</file>
</qresource>
</RCC>

View File

@ -2,8 +2,13 @@
# Form implementation generated from reading ui file 'bitmessageui.ui'
#
<<<<<<< HEAD
# Created: Fri Jul 12 22:39:30 2013
# by: PyQt4 UI code generator 4.9.3
=======
# Created: Sat Jul 13 20:23:44 2013
# by: PyQt4 UI code generator 4.10.2
>>>>>>> d93d92336438bc165839c4089cfaa80c519db730
#
# WARNING! All changes made in this file will be lost!
@ -45,6 +50,21 @@ class Ui_MainWindow(object):
self.inbox.setObjectName(_fromUtf8("inbox"))
self.verticalLayout_2 = QtGui.QVBoxLayout(self.inbox)
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
self.horizontalLayoutSearch = QtGui.QHBoxLayout()
self.horizontalLayoutSearch.setContentsMargins(-1, 0, -1, -1)
self.horizontalLayoutSearch.setObjectName(_fromUtf8("horizontalLayoutSearch"))
self.inboxSearchLineEdit = QtGui.QLineEdit(self.inbox)
self.inboxSearchLineEdit.setObjectName(_fromUtf8("inboxSearchLineEdit"))
self.horizontalLayoutSearch.addWidget(self.inboxSearchLineEdit)
self.inboxSearchOptionCB = QtGui.QComboBox(self.inbox)
self.inboxSearchOptionCB.setObjectName(_fromUtf8("inboxSearchOptionCB"))
self.inboxSearchOptionCB.addItem(_fromUtf8(""))
self.inboxSearchOptionCB.addItem(_fromUtf8(""))
self.inboxSearchOptionCB.addItem(_fromUtf8(""))
self.inboxSearchOptionCB.addItem(_fromUtf8(""))
self.inboxSearchOptionCB.addItem(_fromUtf8(""))
self.horizontalLayoutSearch.addWidget(self.inboxSearchOptionCB)
self.verticalLayout_2.addLayout(self.horizontalLayoutSearch)
self.tableWidgetInbox = QtGui.QTableWidget(self.inbox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
@ -166,6 +186,21 @@ class Ui_MainWindow(object):
self.sent.setObjectName(_fromUtf8("sent"))
self.verticalLayout = QtGui.QVBoxLayout(self.sent)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setContentsMargins(-1, 0, -1, -1)
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.sentSearchLineEdit = QtGui.QLineEdit(self.sent)
self.sentSearchLineEdit.setObjectName(_fromUtf8("sentSearchLineEdit"))
self.horizontalLayout.addWidget(self.sentSearchLineEdit)
self.sentSearchOptionCB = QtGui.QComboBox(self.sent)
self.sentSearchOptionCB.setObjectName(_fromUtf8("sentSearchOptionCB"))
self.sentSearchOptionCB.addItem(_fromUtf8(""))
self.sentSearchOptionCB.addItem(_fromUtf8(""))
self.sentSearchOptionCB.addItem(_fromUtf8(""))
self.sentSearchOptionCB.addItem(_fromUtf8(""))
self.sentSearchOptionCB.addItem(_fromUtf8(""))
self.horizontalLayout.addWidget(self.sentSearchOptionCB)
self.verticalLayout.addLayout(self.horizontalLayout)
self.tableWidgetSent = QtGui.QTableWidget(self.sent)
self.tableWidgetSent.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
self.tableWidgetSent.setAlternatingRowColors(True)
@ -475,7 +510,17 @@ class Ui_MainWindow(object):
MainWindow.setTabOrder(self.tableWidgetConnectionCount, self.pushButtonStatusIcon)
def retranslateUi(self, MainWindow):
<<<<<<< HEAD
MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Bitmessage", None, QtGui.QApplication.UnicodeUTF8))
=======
MainWindow.setWindowTitle(_translate("MainWindow", "Bitmessage", None))
self.inboxSearchLineEdit.setPlaceholderText(_translate("MainWindow", "Search", None))
self.inboxSearchOptionCB.setItemText(0, _translate("MainWindow", "All", None))
self.inboxSearchOptionCB.setItemText(1, _translate("MainWindow", "To", None))
self.inboxSearchOptionCB.setItemText(2, _translate("MainWindow", "From", None))
self.inboxSearchOptionCB.setItemText(3, _translate("MainWindow", "Subject", None))
self.inboxSearchOptionCB.setItemText(4, _translate("MainWindow", "Message", None))
>>>>>>> d93d92336438bc165839c4089cfaa80c519db730
self.tableWidgetInbox.setSortingEnabled(True)
item = self.tableWidgetInbox.horizontalHeaderItem(0)
item.setText(QtGui.QApplication.translate("MainWindow", "To", None, QtGui.QApplication.UnicodeUTF8))
@ -492,6 +537,7 @@ class Ui_MainWindow(object):
self.textEditMessage.setHtml(QtGui.QApplication.translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
<<<<<<< HEAD
"</style></head><body style=\" font-family:\'Sans\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'MS Shell Dlg 2\';\"><br /></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
self.radioButtonBroadcast.setText(QtGui.QApplication.translate("MainWindow", "Broadcast to everyone who is subscribed to your address", None, QtGui.QApplication.UnicodeUTF8))
@ -503,6 +549,22 @@ class Ui_MainWindow(object):
self.DelAttach.setText(QtGui.QApplication.translate("MainWindow", "Delete attach", None, QtGui.QApplication.UnicodeUTF8))
self.AddAttach.setText(QtGui.QApplication.translate("MainWindow", "Add attach", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.send), QtGui.QApplication.translate("MainWindow", "Send", None, QtGui.QApplication.UnicodeUTF8))
=======
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>", None))
self.label.setText(_translate("MainWindow", "To:", None))
self.label_2.setText(_translate("MainWindow", "From:", None))
self.radioButtonBroadcast.setText(_translate("MainWindow", "Broadcast to everyone who is subscribed to your address", None))
self.pushButtonSend.setText(_translate("MainWindow", "Send", None))
self.labelSendBroadcastWarning.setText(_translate("MainWindow", "Be aware that broadcasts are only encrypted with your address. Anyone who knows your address can read them.", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.send), _translate("MainWindow", "Send", None))
self.sentSearchLineEdit.setPlaceholderText(_translate("MainWindow", "Search", None))
self.sentSearchOptionCB.setItemText(0, _translate("MainWindow", "All", None))
self.sentSearchOptionCB.setItemText(1, _translate("MainWindow", "To", None))
self.sentSearchOptionCB.setItemText(2, _translate("MainWindow", "From", None))
self.sentSearchOptionCB.setItemText(3, _translate("MainWindow", "Subject", None))
self.sentSearchOptionCB.setItemText(4, _translate("MainWindow", "Message", None))
>>>>>>> d93d92336438bc165839c4089cfaa80c519db730
self.tableWidgetSent.setSortingEnabled(True)
item = self.tableWidgetSent.horizontalHeaderItem(0)
item.setText(QtGui.QApplication.translate("MainWindow", "To", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -68,6 +68,49 @@
<string>Inbox</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayoutSearch">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="inboxSearchLineEdit">
<property name="placeholderText">
<string>Search</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="inboxSearchOptionCB">
<item>
<property name="text">
<string>All</string>
</property>
</item>
<item>
<property name="text">
<string>To</string>
</property>
</item>
<item>
<property name="text">
<string>From</string>
</property>
</item>
<item>
<property name="text">
<string>Subject</string>
</property>
</item>
<item>
<property name="text">
<string>Message</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTableWidget" name="tableWidgetInbox">
<property name="sizePolicy">
@ -329,6 +372,49 @@ p, li { white-space: pre-wrap; }
<string>Sent</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="sentSearchLineEdit">
<property name="placeholderText">
<string>Search</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="sentSearchOptionCB">
<item>
<property name="text">
<string>All</string>
</property>
</item>
<item>
<property name="text">
<string>To</string>
</property>
</item>
<item>
<property name="text">
<string>From</string>
</property>
</item>
<item>
<property name="text">
<string>Subject</string>
</property>
</item>
<item>
<property name="text">
<string>Message</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTableWidget" name="tableWidgetSent">
<property name="dragDropMode">

View File

@ -48,12 +48,15 @@ logging.config.dictConfig({
'loggers': {
'console_only': {
'handlers': ['console'],
'propagate' : 0
},
'file_only': {
'handlers': ['file'],
'propagate' : 0
},
'both': {
'handlers': ['console', 'file'],
'propagate' : 0
},
},
'root': {

View File

@ -21,6 +21,7 @@ import socket
import random
import highlevelcrypto
import shared
from debug import logger
config = ConfigParser.SafeConfigParser()
myECCryptorObjects = {}
@ -118,7 +119,8 @@ def lookupAppdataFolder():
if "HOME" in environ:
dataFolder = path.join(os.environ["HOME"], "Library/Application Support/", APPNAME) + '/'
else:
print 'Could not find home folder, please report this message and your OS X version to the BitMessage Github.'
logger.critical('Could not find home folder, please report this message and your '
'OS X version to the BitMessage Github.')
sys.exit()
elif 'win32' in sys.platform or 'win64' in sys.platform:
@ -129,12 +131,13 @@ def lookupAppdataFolder():
dataFolder = path.join(environ["XDG_CONFIG_HOME"], APPNAME)
except KeyError:
dataFolder = path.join(environ["HOME"], ".config", APPNAME)
# Migrate existing data to the proper location if this is an existing install
try:
print "Moving data folder to ~/.config/%s" % APPNAME
logger.info("Moving data folder to %s" % (dataFolder))
move(path.join(environ["HOME"], ".%s" % APPNAME), dataFolder)
dataFolder = dataFolder + '/'
except IOError:
pass
dataFolder = dataFolder + '/'
return dataFolder
@ -200,9 +203,7 @@ def decodeWalletImportFormat(WIFstring):
def reloadMyAddressHashes():
printLock.acquire()
print 'reloading keys from keys.dat file'
printLock.release()
logger.debug('reloading keys from keys.dat file')
myECCryptorObjects.clear()
myAddressesByHash.clear()
#myPrivateKeys.clear()
@ -221,9 +222,7 @@ def reloadMyAddressHashes():
sys.stderr.write('Error in reloadMyAddressHashes: Can\'t handle address versions other than 2 or 3.\n')
def reloadBroadcastSendersForWhichImWatching():
printLock.acquire()
print 'reloading subscriptions...'
printLock.release()
logger.debug('reloading subscriptions...')
broadcastSendersForWhichImWatching.clear()
MyECSubscriptionCryptorObjects.clear()
sqlLock.acquire()
@ -246,46 +245,44 @@ def doCleanShutdown():
knownNodesLock.acquire()
UISignalQueue.put(('updateStatusBar','Saving the knownNodes list of peers to disk...'))
output = open(appdata + 'knownnodes.dat', 'wb')
print 'finished opening knownnodes.dat. Now pickle.dump'
logger.info('finished opening knownnodes.dat. Now pickle.dump')
pickle.dump(knownNodes, output)
print 'Completed pickle.dump. Closing output...'
logger.info('Completed pickle.dump. Closing output...')
output.close()
knownNodesLock.release()
printLock.acquire()
print 'Finished closing knownnodes.dat output file.'
printLock.release()
logger.info('Finished closing knownnodes.dat output file.')
UISignalQueue.put(('updateStatusBar','Done saving the knownNodes list of peers to disk.'))
broadcastToSendDataQueues((0, 'shutdown', 'all'))
printLock.acquire()
print 'Flushing inventory in memory out to disk...'
printLock.release()
UISignalQueue.put(('updateStatusBar','Flushing inventory in memory out to disk. This should normally only take a second...'))
logger.info('Flushing inventory in memory out to disk...')
UISignalQueue.put((
'updateStatusBar',
'Flushing inventory in memory out to disk. This should normally only take a second...'))
flushInventory()
#This one last useless query will guarantee that the previous flush committed before we close the program.
# This one last useless query will guarantee that the previous flush committed before we close
# the program.
sqlLock.acquire()
sqlSubmitQueue.put('SELECT address FROM subscriptions')
sqlSubmitQueue.put('')
sqlReturnQueue.get()
sqlSubmitQueue.put('exit')
sqlLock.release()
printLock.acquire()
print 'Finished flushing inventory.'
printLock.release()
time.sleep(.25) #Wait long enough to guarantee that any running proof of work worker threads will check the shutdown variable and exit. If the main thread closes before they do then they won't stop.
logger.info('Finished flushing inventory.')
# Wait long enough to guarantee that any running proof of work worker threads will check the
# shutdown variable and exit. If the main thread closes before they do then they won't stop.
time.sleep(.25)
if safeConfigGetBoolean('bitmessagesettings','daemon'):
printLock.acquire()
print 'Done.'
printLock.release()
logger.info('Clean shutdown complete.')
os._exit(0)
#When you want to command a sendDataThread to do something, like shutdown or send some data, this function puts your data into the queues for each of the sendDataThreads. The sendDataThreads are responsible for putting their queue into (and out of) the sendDataQueues list.
# When you want to command a sendDataThread to do something, like shutdown or send some data, this
# function puts your data into the queues for each of the sendDataThreads. The sendDataThreads are
# responsible for putting their queue into (and out of) the sendDataQueues list.
def broadcastToSendDataQueues(data):
#print 'running broadcastToSendDataQueues'
# logger.debug('running broadcastToSendDataQueues')
for q in sendDataQueues:
q.put((data))