@ -54,9 +54,24 @@ try:
except AttributeError :
print ' QtGui.QApplication.UnicodeUTF8 error: ' , err
FIELD_COLUMNS = {
' To ' : ' toaddress ' ,
' From ' : ' fromaddress ' ,
' Subject ' : ' subject ' ,
' Message ' : ' message, '
}
SELECT_INBOX_QUERY = '''
SELECT msgid , toaddress , fromaddress , subject , received , read
FROM inbox WHERE folder = " inbox " AND % s LIKE ?
ORDER BY received
'''
def _translate ( context , text ) :
return QtGui . QApplication . translate ( context , text )
def identiconize ( address ) :
size = 48
@ -176,63 +191,22 @@ class MyForm(QtGui.QMainWindow):
str_broadcast_subscribers = ' [Broadcast subscribers] '
str_chan = ' [chan] '
def __init__ ( self , parent = None ) :
QtGui . QWidget . __init__ ( self , parent )
self . ui = Ui_MainWindow ( )
self . ui . setupUi ( self )
# Ask the user if we may delete their old version 1 addresses if they
# have any.
configSections = shared . config . sections ( )
for addressInKeysFile in configSections :
if addressInKeysFile != ' bitmessagesettings ' :
status , addressVersionNumber , streamNumber , hash = decodeAddress (
addressInKeysFile )
if addressVersionNumber == 1 :
displayMsg = _translate (
" MainWindow " , " One of your addresses, % 1, is an old version 1 address. Version 1 addresses are no longer supported. "
+ " May we delete it now? " ) . arg ( addressInKeysFile )
reply = QtGui . QMessageBox . question (
self , ' Message ' , displayMsg , QtGui . QMessageBox . Yes , QtGui . QMessageBox . No )
if reply == QtGui . QMessageBox . Yes :
shared . config . remove_section ( addressInKeysFile )
with open ( shared . appdata + ' keys.dat ' , ' wb ' ) as configfile :
shared . config . write ( configfile )
# Configure Bitmessage to start on startup (or remove the
# configuration) based on the setting in the keys.dat file
if ' win32 ' in sys . platform or ' win64 ' in sys . platform :
# Auto-startup for Windows
RUN_PATH = " HKEY_CURRENT_USER \\ Software \\ Microsoft \\ Windows \\ CurrentVersion \\ Run "
self . settings = QSettings ( RUN_PATH , QSettings . NativeFormat )
self . settings . remove (
" PyBitmessage " ) # In case the user moves the program and the registry entry is no longer valid, this will delete the old registry entry.
if shared . config . getboolean ( ' bitmessagesettings ' , ' startonlogon ' ) :
self . settings . setValue ( " PyBitmessage " , sys . argv [ 0 ] )
elif ' darwin ' in sys . platform :
# startup for mac
pass
elif ' linux ' in sys . platform :
# startup for linux
pass
self . ui . labelSendBroadcastWarning . setVisible ( False )
self . timer = QtCore . QTimer ( )
self . timer . start ( 2000 ) # milliseconds
QtCore . QObject . connect ( self . timer , QtCore . SIGNAL ( " timeout() " ) , self . runEveryTwoSeconds )
# FILE MENU and other buttons
def init_file_menu ( self ) :
QtCore . QObject . connect ( self . ui . actionExit , QtCore . SIGNAL (
" triggered() " ) , self . quit )
QtCore . QObject . connect ( self . ui . actionManageKeys , QtCore . SIGNAL (
" triggered() " ) , self . click_actionManageKeys )
QtCore . QObject . connect ( self . ui . actionDeleteAllTrashedMessages , QtCore . SIGNAL (
" triggered() " ) , self . click_actionDeleteAllTrashedMessages )
QtCore . QObject . connect ( self . ui . actionRegenerateDeterministicAddresses , QtCore . SIGNAL (
" triggered() " ) , self . click_actionRegenerateDeterministicAddresses )
QtCore . QObject . connect ( self . ui . actionDeleteAllTrashedMessages ,
QtCore . SIGNAL (
" triggered() " ) ,
self . click_actionDeleteAllTrashedMessages )
QtCore . QObject . connect ( self . ui . actionRegenerateDeterministicAddresses ,
QtCore . SIGNAL (
" triggered() " ) ,
self . click_actionRegenerateDeterministicAddresses )
QtCore . QObject . connect ( self . ui . actionJoinChan , QtCore . SIGNAL (
" triggered() " ) , self . click_actionJoinChan ) # also used for creating chans.
" triggered() " ) ,
self . click_actionJoinChan ) # also used for creating chans.
QtCore . QObject . connect ( self . ui . pushButtonNewAddress , QtCore . SIGNAL (
" clicked() " ) , self . click_NewAddressDialog )
QtCore . QObject . connect ( self . ui . comboBoxSendFrom , QtCore . SIGNAL (
@ -245,8 +219,10 @@ class MyForm(QtGui.QMainWindow):
" clicked() " ) , self . click_pushButtonAddBlacklist )
QtCore . QObject . connect ( self . ui . pushButtonSend , QtCore . SIGNAL (
" clicked() " ) , self . click_pushButtonSend )
QtCore . QObject . connect ( self . ui . pushButtonLoadFromAddressBook , QtCore . SIGNAL (
" clicked() " ) , self . click_pushButtonLoadFromAddressBook )
QtCore . QObject . connect ( self . ui . pushButtonLoadFromAddressBook ,
QtCore . SIGNAL (
" clicked() " ) ,
self . click_pushButtonLoadFromAddressBook )
QtCore . QObject . connect ( self . ui . pushButtonFetchNamecoinID , QtCore . SIGNAL (
" clicked() " ) , self . click_pushButtonFetchNamecoinID )
QtCore . QObject . connect ( self . ui . radioButtonBlacklist , QtCore . SIGNAL (
@ -262,25 +238,35 @@ class MyForm(QtGui.QMainWindow):
QtCore . QObject . connect ( self . ui . actionHelp , QtCore . SIGNAL (
" triggered() " ) , self . click_actionHelp )
def init_inbox_popup_menu ( self ) :
# Popup menu for the Inbox tab
self . ui . inboxContextMenuToolbar = QtGui . QToolBar ( )
# Actions
# Actions
self . actionReply = self . ui . inboxContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Reply " ) , self . on_action_InboxReply )
self . actionAddSenderToAddressBook = self . ui . inboxContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Add sender to your Address Book " ) , self . on_action_InboxAddSenderToAddressBook )
self . actionAddSenderToAddressBook = self . ui . inboxContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Add sender to your Address Book " ) ,
self . on_action_InboxAddSenderToAddressBook )
self . actionTrashInboxMessage = self . ui . inboxContextMenuToolbar . addAction (
_translate ( " MainWindow " , " Move to Trash " ) , self . on_action_InboxTrash )
self . actionForceHtml = self . ui . inboxContextMenuToolbar . addAction ( _translate (
" MainWindow " , " View HTML code as formatted text " ) , self . on_action_InboxMessageForceHtml )
self . actionSaveMessageAs = self . ui . inboxContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Save message as... " ) , self . on_action_InboxSaveMessageAs )
self . actionMarkUnread = self . ui . inboxContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Mark Unread " ) , self . on_action_InboxMarkUnread )
_translate ( " MainWindow " , " Move to Trash " ) ,
self . on_action_InboxTrash )
self . actionForceHtml = self . ui . inboxContextMenuToolbar . addAction (
_translate (
" MainWindow " , " View HTML code as formatted text " ) ,
self . on_action_InboxMessageForceHtml )
self . actionSaveMessageAs = self . ui . inboxContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Save message as... " ) ,
self . on_action_InboxSaveMessageAs )
self . actionMarkUnread = self . ui . inboxContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Mark Unread " ) , self . on_action_InboxMarkUnread )
self . ui . tableWidgetInbox . setContextMenuPolicy (
QtCore . Qt . CustomContextMenu )
self . connect ( self . ui . tableWidgetInbox , QtCore . SIGNAL (
' customContextMenuRequested(const QPoint&) ' ) , self . on_context_menuInbox )
' customContextMenuRequested(const QPoint&) ' ) ,
self . on_context_menuInbox )
self . popMenuInbox = QtGui . QMenu ( self )
self . popMenuInbox . addAction ( self . actionForceHtml )
self . popMenuInbox . addAction ( self . actionMarkUnread )
@ -288,28 +274,38 @@ class MyForm(QtGui.QMainWindow):
self . popMenuInbox . addAction ( self . actionReply )
self . popMenuInbox . addAction ( self . actionAddSenderToAddressBook )
self . popMenuInbox . addSeparator ( )
self . popMenuInbox . addAction ( self . actionSaveMessageAs )
self . popMenuInbox . addAction ( self . actionTrashInboxMessage )
self . popMenuInbox . addAction ( self . actionSaveMessageAs )
self . popMenuInbox . addAction ( self . actionTrashInboxMessage )
def init_identities_popup_menu ( self ) :
# Popup menu for the Your Identities tab
self . ui . addressContextMenuToolbar = QtGui . QToolBar ( )
# Actions
# Actions
self . actionNew = self . ui . addressContextMenuToolbar . addAction ( _translate (
" MainWindow " , " New " ) , self . on_action_YourIdentitiesNew )
self . actionEnable = self . ui . addressContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Enable " ) , self . on_action_YourIdentitiesEnable )
self . actionDisable = self . ui . addressContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Disable " ) , self . on_action_YourIdentitiesDisable )
self . actionSetAvatar = self . ui . addressContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Set avatar... " ) , self . on_action_YourIdentitiesSetAvatar )
self . actionClipboard = self . ui . addressContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Copy address to clipboard " ) , self . on_action_YourIdentitiesClipboard )
self . actionSpecialAddressBehavior = self . ui . addressContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Special address behavior... " ) , self . on_action_SpecialAddressBehaviorDialog )
self . actionEnable = self . ui . addressContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Enable " ) , self . on_action_YourIdentitiesEnable )
self . actionDisable = self . ui . addressContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Disable " ) , self . on_action_YourIdentitiesDisable )
self . actionSetAvatar = self . ui . addressContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Set avatar... " ) ,
self . on_action_YourIdentitiesSetAvatar )
self . actionClipboard = self . ui . addressContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Copy address to clipboard " ) ,
self . on_action_YourIdentitiesClipboard )
self . actionSpecialAddressBehavior = self . ui . addressContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Special address behavior... " ) ,
self . on_action_SpecialAddressBehaviorDialog )
self . ui . tableWidgetYourIdentities . setContextMenuPolicy (
QtCore . Qt . CustomContextMenu )
self . connect ( self . ui . tableWidgetYourIdentities , QtCore . SIGNAL (
' customContextMenuRequested(const QPoint&) ' ) , self . on_context_menuYourIdentities )
' customContextMenuRequested(const QPoint&) ' ) ,
self . on_context_menuYourIdentities )
self . popMenu = QtGui . QMenu ( self )
self . popMenu . addAction ( self . actionNew )
self . popMenu . addSeparator ( )
@ -320,25 +316,37 @@ class MyForm(QtGui.QMainWindow):
self . popMenu . addAction ( self . actionSetAvatar )
self . popMenu . addAction ( self . actionSpecialAddressBehavior )
def init_addressbook_popup_menu ( self ) :
# Popup menu for the Address Book page
self . ui . addressBookContextMenuToolbar = QtGui . QToolBar ( )
# Actions
self . actionAddressBookSend = self . ui . addressBookContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Send message to this address " ) , self . on_action_AddressBookSend )
self . actionAddressBookClipboard = self . ui . addressBookContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Copy address to clipboard " ) , self . on_action_AddressBookClipboard )
self . actionAddressBookSubscribe = self . ui . addressBookContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Subscribe to this address " ) , self . on_action_AddressBookSubscribe )
self . actionAddressBookSetAvatar = self . ui . addressBookContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Set avatar... " ) , self . on_action_AddressBookSetAvatar )
self . actionAddressBookNew = self . ui . addressBookContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Add New Address " ) , self . on_action_AddressBookNew )
self . actionAddressBookDelete = self . ui . addressBookContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Delete " ) , self . on_action_AddressBookDelete )
# Actions
self . actionAddressBookSend = self . ui . addressBookContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Send message to this address " ) ,
self . on_action_AddressBookSend )
self . actionAddressBookClipboard = self . ui . addressBookContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Copy address to clipboard " ) ,
self . on_action_AddressBookClipboard )
self . actionAddressBookSubscribe = self . ui . addressBookContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Subscribe to this address " ) ,
self . on_action_AddressBookSubscribe )
self . actionAddressBookSetAvatar = self . ui . addressBookContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Set avatar... " ) ,
self . on_action_AddressBookSetAvatar )
self . actionAddressBookNew = self . ui . addressBookContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Add New Address " ) , self . on_action_AddressBookNew )
self . actionAddressBookDelete = self . ui . addressBookContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Delete " ) , self . on_action_AddressBookDelete )
self . ui . tableWidgetAddressBook . setContextMenuPolicy (
QtCore . Qt . CustomContextMenu )
self . connect ( self . ui . tableWidgetAddressBook , QtCore . SIGNAL (
' customContextMenuRequested(const QPoint&) ' ) , self . on_context_menuAddressBook )
' customContextMenuRequested(const QPoint&) ' ) ,
self . on_context_menuAddressBook )
self . popMenuAddressBook = QtGui . QMenu ( self )
self . popMenuAddressBook . addAction ( self . actionAddressBookSend )
self . popMenuAddressBook . addAction ( self . actionAddressBookClipboard )
@ -348,25 +356,32 @@ class MyForm(QtGui.QMainWindow):
self . popMenuAddressBook . addAction ( self . actionAddressBookNew )
self . popMenuAddressBook . addAction ( self . actionAddressBookDelete )
def init_subscriptions_popup_menu ( self ) :
# Popup menu for the Subscriptions page
self . ui . subscriptionsContextMenuToolbar = QtGui . QToolBar ( )
# Actions
# Actions
self . actionsubscriptionsNew = self . ui . subscriptionsContextMenuToolbar . addAction (
_translate ( " MainWindow " , " New " ) , self . on_action_SubscriptionsNew )
self . actionsubscriptionsDelete = self . ui . subscriptionsContextMenuToolbar . addAction (
_translate ( " MainWindow " , " Delete " ) , self . on_action_SubscriptionsDelete )
_translate ( " MainWindow " , " Delete " ) ,
self . on_action_SubscriptionsDelete )
self . actionsubscriptionsClipboard = self . ui . subscriptionsContextMenuToolbar . addAction (
_translate ( " MainWindow " , " Copy address to clipboard " ) , self . on_action_SubscriptionsClipboard )
_translate ( " MainWindow " , " Copy address to clipboard " ) ,
self . on_action_SubscriptionsClipboard )
self . actionsubscriptionsEnable = self . ui . subscriptionsContextMenuToolbar . addAction (
_translate ( " MainWindow " , " Enable " ) , self . on_action_SubscriptionsEnable )
_translate ( " MainWindow " , " Enable " ) ,
self . on_action_SubscriptionsEnable )
self . actionsubscriptionsDisable = self . ui . subscriptionsContextMenuToolbar . addAction (
_translate ( " MainWindow " , " Disable " ) , self . on_action_SubscriptionsDisable )
_translate ( " MainWindow " , " Disable " ) ,
self . on_action_SubscriptionsDisable )
self . actionsubscriptionsSetAvatar = self . ui . subscriptionsContextMenuToolbar . addAction (
_translate ( " MainWindow " , " Set avatar... " ) , self . on_action_SubscriptionsSetAvatar )
_translate ( " MainWindow " , " Set avatar... " ) ,
self . on_action_SubscriptionsSetAvatar )
self . ui . tableWidgetSubscriptions . setContextMenuPolicy (
QtCore . Qt . CustomContextMenu )
self . connect ( self . ui . tableWidgetSubscriptions , QtCore . SIGNAL (
' customContextMenuRequested(const QPoint&) ' ) , self . on_context_menuSubscriptions )
' customContextMenuRequested(const QPoint&) ' ) ,
self . on_context_menuSubscriptions )
self . popMenuSubscriptions = QtGui . QMenu ( self )
self . popMenuSubscriptions . addAction ( self . actionsubscriptionsNew )
self . popMenuSubscriptions . addAction ( self . actionsubscriptionsDelete )
@ -377,42 +392,58 @@ class MyForm(QtGui.QMainWindow):
self . popMenuSubscriptions . addSeparator ( )
self . popMenuSubscriptions . addAction ( self . actionsubscriptionsClipboard )
def init_sent_popup_menu ( self ) :
# Popup menu for the Sent page
self . ui . sentContextMenuToolbar = QtGui . QToolBar ( )
# Actions
self . actionTrashSentMessage = self . ui . sentContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Move to Trash " ) , self . on_action_SentTrash )
self . actionSentClipboard = self . ui . sentContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Copy destination address to clipboard " ) , self . on_action_SentClipboard )
self . actionForceSend = self . ui . sentContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Force send " ) , self . on_action_ForceSend )
# Actions
self . actionTrashSentMessage = self . ui . sentContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Move to Trash " ) , self . on_action_SentTrash )
self . actionSentClipboard = self . ui . sentContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Copy destination address to clipboard " ) ,
self . on_action_SentClipboard )
self . actionForceSend = self . ui . sentContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Force send " ) , self . on_action_ForceSend )
self . ui . tableWidgetSent . setContextMenuPolicy (
QtCore . Qt . CustomContextMenu )
self . connect ( self . ui . tableWidgetSent , QtCore . SIGNAL (
' customContextMenuRequested(const QPoint&) ' ) , self . on_context_menuSent )
' customContextMenuRequested(const QPoint&) ' ) ,
self . on_context_menuSent )
# self.popMenuSent = QtGui.QMenu( self )
# self.popMenuSent.addAction( self.actionSentClipboard )
# self.popMenuSent.addAction( self.actionTrashSentMessage )
def init_blacklist_popup_menu ( self ) :
# Popup menu for the Blacklist page
self . ui . blacklistContextMenuToolbar = QtGui . QToolBar ( )
# Actions
self . actionBlacklistNew = self . ui . blacklistContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Add new entry " ) , self . on_action_BlacklistNew )
self . actionBlacklistDelete = self . ui . blacklistContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Delete " ) , self . on_action_BlacklistDelete )
self . actionBlacklistClipboard = self . ui . blacklistContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Copy address to clipboard " ) , self . on_action_BlacklistClipboard )
self . actionBlacklistEnable = self . ui . blacklistContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Enable " ) , self . on_action_BlacklistEnable )
self . actionBlacklistDisable = self . ui . blacklistContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Disable " ) , self . on_action_BlacklistDisable )
self . actionBlacklistSetAvatar = self . ui . blacklistContextMenuToolbar . addAction ( _translate (
" MainWindow " , " Set avatar... " ) , self . on_action_BlacklistSetAvatar )
# Actions
self . actionBlacklistNew = self . ui . blacklistContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Add new entry " ) , self . on_action_BlacklistNew )
self . actionBlacklistDelete = self . ui . blacklistContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Delete " ) , self . on_action_BlacklistDelete )
self . actionBlacklistClipboard = self . ui . blacklistContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Copy address to clipboard " ) ,
self . on_action_BlacklistClipboard )
self . actionBlacklistEnable = self . ui . blacklistContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Enable " ) , self . on_action_BlacklistEnable )
self . actionBlacklistDisable = self . ui . blacklistContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Disable " ) , self . on_action_BlacklistDisable )
self . actionBlacklistSetAvatar = self . ui . blacklistContextMenuToolbar . addAction (
_translate (
" MainWindow " , " Set avatar... " ) ,
self . on_action_BlacklistSetAvatar )
self . ui . tableWidgetBlacklist . setContextMenuPolicy (
QtCore . Qt . CustomContextMenu )
self . connect ( self . ui . tableWidgetBlacklist , QtCore . SIGNAL (
' customContextMenuRequested(const QPoint&) ' ) , self . on_context_menuBlacklist )
' customContextMenuRequested(const QPoint&) ' ) ,
self . on_context_menuBlacklist )
self . popMenuBlacklist = QtGui . QMenu ( self )
# self.popMenuBlacklist.addAction( self.actionBlacklistNew )
self . popMenuBlacklist . addAction ( self . actionBlacklistDelete )
@ -423,6 +454,60 @@ class MyForm(QtGui.QMainWindow):
self . popMenuBlacklist . addAction ( self . actionBlacklistDisable )
self . popMenuBlacklist . addAction ( self . actionBlacklistSetAvatar )
def __init__ ( self , parent = None ) :
QtGui . QWidget . __init__ ( self , parent )
self . ui = Ui_MainWindow ( )
self . ui . setupUi ( self )
# Ask the user if we may delete their old version 1 addresses if they
# have any.
configSections = shared . config . sections ( )
for addressInKeysFile in configSections :
if addressInKeysFile != ' bitmessagesettings ' :
status , addressVersionNumber , streamNumber , hash = decodeAddress (
addressInKeysFile )
if addressVersionNumber == 1 :
displayMsg = _translate (
" MainWindow " , " One of your addresses, % 1, is an old version 1 address. Version 1 addresses are no longer supported. "
+ " May we delete it now? " ) . arg ( addressInKeysFile )
reply = QtGui . QMessageBox . question (
self , ' Message ' , displayMsg , QtGui . QMessageBox . Yes , QtGui . QMessageBox . No )
if reply == QtGui . QMessageBox . Yes :
shared . config . remove_section ( addressInKeysFile )
with open ( shared . appdata + ' keys.dat ' , ' wb ' ) as configfile :
shared . config . write ( configfile )
# Configure Bitmessage to start on startup (or remove the
# configuration) based on the setting in the keys.dat file
if ' win32 ' in sys . platform or ' win64 ' in sys . platform :
# Auto-startup for Windows
RUN_PATH = " HKEY_CURRENT_USER \\ Software \\ Microsoft \\ Windows \\ CurrentVersion \\ Run "
self . settings = QSettings ( RUN_PATH , QSettings . NativeFormat )
self . settings . remove (
" PyBitmessage " ) # In case the user moves the program and the registry entry is no longer valid, this will delete the old registry entry.
if shared . config . getboolean ( ' bitmessagesettings ' , ' startonlogon ' ) :
self . settings . setValue ( " PyBitmessage " , sys . argv [ 0 ] )
elif ' darwin ' in sys . platform :
# startup for mac
pass
elif ' linux ' in sys . platform :
# startup for linux
pass
self . ui . labelSendBroadcastWarning . setVisible ( False )
self . timer = QtCore . QTimer ( )
self . timer . start ( 2000 ) # milliseconds
QtCore . QObject . connect ( self . timer , QtCore . SIGNAL ( " timeout() " ) , self . runEveryTwoSeconds )
self . init_file_menu ( )
self . init_inbox_popup_menu ( )
self . init_identities_popup_menu ( )
self . init_addressbook_popup_menu ( )
self . init_subscriptions_popup_menu ( )
self . init_sent_popup_menu ( )
self . init_blacklist_popup_menu ( )
# Initialize the user's list of addresses on the 'Your Identities' tab.
configSections = shared . config . sections ( )
for addressInKeysFile in configSections :
@ -799,22 +884,12 @@ class MyForm(QtGui.QMainWindow):
# 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 "
if where in FIELD_COLUMNS :
where = FIELD_COLUMNS [ where ]
else :
where = " toaddress || fromaddress || subject || message "
sqlStatement = '''
SELECT msgid , toaddress , fromaddress , subject , received , read
FROM inbox WHERE folder = " inbox " AND % s LIKE ?
ORDER BY received
''' % (where,)
sqlStatement = SELECT_INBOX_QUERY % ( where , )
while self . ui . tableWidgetInbox . rowCount ( ) > 0 :
self . ui . tableWidgetInbox . removeRow ( 0 )
@ -858,52 +933,52 @@ class MyForm(QtGui.QMainWindow):
# message row
self . ui . tableWidgetInbox . insertRow ( 0 )
# to
newI tem = QtGui . QTableWidgetItem ( unicode ( toLabel , ' utf-8 ' ) )
newI tem. setToolTip ( unicode ( toLabel , ' utf-8 ' ) )
newI tem. setFlags (
to_i tem = QtGui . QTableWidgetItem ( unicode ( toLabel , ' utf-8 ' ) )
to_i tem. setToolTip ( unicode ( toLabel , ' utf-8 ' ) )
to_i tem. setFlags (
QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled )
if not read :
newI tem. setFont ( font )
newI tem. setData ( Qt . UserRole , str ( toAddress ) )
to_i tem. setFont ( font )
to_i tem. setData ( Qt . UserRole , str ( toAddress ) )
if shared . safeConfigGetBoolean ( toAddress , ' mailinglist ' ) :
newI tem. setTextColor ( QtGui . QColor ( 137 , 04 , 177 ) ) # magenta
to_i tem. setTextColor ( QtGui . QColor ( 137 , 04 , 177 ) ) # magenta
if shared . safeConfigGetBoolean ( str ( toAddress ) , ' chan ' ) :
newI tem. setTextColor ( QtGui . QColor ( 216 , 119 , 0 ) ) # orange
newI tem. setIcon ( avatarize ( toAddress ) )
self . ui . tableWidgetInbox . setItem ( 0 , 0 , newI tem)
to_i tem. setTextColor ( QtGui . QColor ( 216 , 119 , 0 ) ) # orange
to_i tem. setIcon ( avatarize ( toAddress ) )
self . ui . tableWidgetInbox . setItem ( 0 , 0 , to_i tem)
# from
newI tem = QtGui . QTableWidgetItem ( unicode ( fromLabel , ' utf-8 ' ) )
newI tem. setToolTip ( unicode ( fromLabel , ' utf-8 ' ) )
newI tem. setFlags (
from_i tem = QtGui . QTableWidgetItem ( unicode ( fromLabel , ' utf-8 ' ) )
from_i tem. setToolTip ( unicode ( fromLabel , ' utf-8 ' ) )
from_i tem. setFlags (
QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled )
if not read :
newI tem. setFont ( font )
newI tem. setData ( Qt . UserRole , str ( fromAddress ) )
from_i tem. setFont ( font )
from_i tem. setData ( Qt . UserRole , str ( fromAddress ) )
if shared . safeConfigGetBoolean ( str ( fromAddress ) , ' chan ' ) :
newI tem. setTextColor ( QtGui . QColor ( 216 , 119 , 0 ) ) # orange
newI tem. setIcon ( avatarize ( fromAddress ) )
self . ui . tableWidgetInbox . setItem ( 0 , 1 , newI tem)
from_i tem. setTextColor ( QtGui . QColor ( 216 , 119 , 0 ) ) # orange
from_i tem. setIcon ( avatarize ( fromAddress ) )
self . ui . tableWidgetInbox . setItem ( 0 , 1 , from_i tem)
# subject
newItem = QtGui . QTableWidgetItem ( unicode ( subject , ' utf-8 ' ) )
newItem . setToolTip ( unicode ( subject , ' utf-8 ' ) )
#newItem.setData(Qt.UserRole, unicode(message, 'utf-8)')) # No longer hold the message in the table (and thus in memory); we'll use a SQL query when we need to display it.
newItem . setFlags (
subject_item = QtGui . QTableWidgetItem ( unicode ( subject , ' utf-8 ' ) )
subject_item . setToolTip ( unicode ( subject , ' utf-8 ' ) )
subject_item . setFlags (
QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled )
if not read :
newI tem. setFont ( font )
self . ui . tableWidgetInbox . setItem ( 0 , 2 , newI tem)
subject_i tem. setFont ( font )
self . ui . tableWidgetInbox . setItem ( 0 , 2 , subject_i tem)
# time received
newI tem = myTableWidgetItem ( unicode ( strftime ( shared . config . get (
time_i tem = myTableWidgetItem ( unicode ( strftime ( shared . config . get (
' bitmessagesettings ' , ' timeformat ' ) , localtime ( int ( received ) ) ) , ' utf-8 ' ) )
newI tem. setToolTip ( unicode ( strftime ( shared . config . get (
time_i tem. setToolTip ( unicode ( strftime ( shared . config . get (
' bitmessagesettings ' , ' timeformat ' ) , localtime ( int ( received ) ) ) , ' utf-8 ' ) )
newI tem. setData ( Qt . UserRole , QByteArray ( msgid ) )
newI tem. setData ( 33 , int ( received ) )
newI tem. setFlags (
time_i tem. setData ( Qt . UserRole , QByteArray ( msgid ) )
time_i tem. setData ( 33 , int ( received ) )
time_i tem. setFlags (
QtCore . Qt . ItemIsSelectable | QtCore . Qt . ItemIsEnabled )
if not read :
newItem . setFont ( font )
self . ui . tableWidgetInbox . setItem ( 0 , 3 , newItem )
time_item . setFont ( font )
self . ui . tableWidgetInbox . setItem ( 0 , 3 , time_item )
self . ui . tableWidgetInbox . sortItems ( 3 , Qt . DescendingOrder )
self . ui . tableWidgetInbox . keyPressEvent = self . tableWidgetInboxKeyPressEvent