More changes: sort in messagelist, "All Accounts" in treeWidget, some actions
This commit is contained in:
parent
8e99226fee
commit
3a589e5344
|
@ -731,16 +731,6 @@ class MainWindow(Window):
|
|||
tableWidget.horizontalHeaderItem(3).setText(_translate("MainWindow", "Sent", None))
|
||||
tableWidget.setUpdatesEnabled(True)
|
||||
|
||||
def switchMessagelist(
|
||||
self, view, account,
|
||||
folder='inbox', search_option=None, search_line=None
|
||||
):
|
||||
model = view.model()
|
||||
update = {'folder': folder}
|
||||
if account:
|
||||
update['toaddress'] = account
|
||||
model.updateFilter(update)
|
||||
|
||||
# Load messages from database file
|
||||
def loadMessagelist(self, tableWidget, account, folder="inbox", where="", what="", unreadOnly = False):
|
||||
if folder == 'sent':
|
||||
|
@ -2867,7 +2857,7 @@ class MainWindow(Window):
|
|||
self.treeWidgetChans
|
||||
]
|
||||
if currentIndex >= 2 and currentIndex - 2 < len(treeWidgetList):
|
||||
return treeWidgetList[currentIndex]
|
||||
return treeWidgetList[currentIndex - 2]
|
||||
|
||||
def getAccountTreeWidget(self, account):
|
||||
if account.type == AccountMixin.CHAN:
|
||||
|
@ -2913,7 +2903,7 @@ class MainWindow(Window):
|
|||
self.textEditInboxMessageChans,
|
||||
]
|
||||
if currentIndex >= 2 and currentIndex - 2 < len(messagelistList):
|
||||
return messagelistList[currentIndex]
|
||||
return messagelistList[currentIndex - 2]
|
||||
|
||||
def getAccountTextedit(self, account):
|
||||
try:
|
||||
|
@ -2935,9 +2925,9 @@ class MainWindow(Window):
|
|||
]
|
||||
if currentIndex >= 2 and currentIndex - 2 < len(messagelistList):
|
||||
if retObj:
|
||||
return messagelistList[currentIndex]
|
||||
return messagelistList[currentIndex - 2]
|
||||
else:
|
||||
return messagelistList[currentIndex].text().toUtf8().data()
|
||||
return messagelistList[currentIndex - 2].text().toUtf8().data()
|
||||
|
||||
def getCurrentSearchOption(self, currentIndex=None):
|
||||
if currentIndex is None:
|
||||
|
@ -2947,7 +2937,7 @@ class MainWindow(Window):
|
|||
self.inboxSearchOptionChans,
|
||||
]
|
||||
if currentIndex >= 2 and currentIndex - 2 < len(messagelistList):
|
||||
return messagelistList[currentIndex].currentText().toUtf8().data()
|
||||
return messagelistList[currentIndex - 2].currentText().toUtf8().data()
|
||||
|
||||
# Group of functions for the Your Identities dialog box
|
||||
def getCurrentItem(self, treeWidget=None):
|
||||
|
@ -3348,15 +3338,13 @@ class MainWindow(Window):
|
|||
messageTextedit = self.getCurrentMessageTextedit()
|
||||
if messageTextedit:
|
||||
messageTextedit.setPlainText(QtCore.QString(""))
|
||||
messagelist = self.getCurrentMessagelist() or self.messagelistInbox
|
||||
messagelist = self.getCurrentMessagelist()
|
||||
if not messagelist:
|
||||
return
|
||||
# ??
|
||||
account = self.getCurrentAccount()
|
||||
folder = self.getCurrentFolder()
|
||||
treeWidget = self.getCurrentTreeWidget()
|
||||
if isinstance(messagelist, QtGui.QTableView):
|
||||
self.switchMessagelist(
|
||||
messagelist, account, folder, searchOption, searchLine)
|
||||
return
|
||||
# refresh count indicator
|
||||
self.propagateUnreadCount(account.address if hasattr(account, 'address') else None, folder, treeWidget, 0)
|
||||
self.loadMessagelist(messagelist, account, folder, searchOption, searchLine)
|
||||
|
@ -3442,12 +3430,6 @@ class MainWindow(Window):
|
|||
messageTextedit.setTextColor(QtGui.QColor())
|
||||
messageTextedit.setContent(message)
|
||||
|
||||
# def messagelistSelect(self, msg):
|
||||
# messageTextedit = self.getCurrentMessageTextedit()
|
||||
# if not messageTextedit:
|
||||
# return
|
||||
# messageTextedit.setContent(msg)
|
||||
|
||||
def tableWidgetAddressBookItemChanged(self, item):
|
||||
if item.type == AccountMixin.CHAN:
|
||||
self.rerenderComboBoxSendFrom()
|
||||
|
|
|
@ -41,7 +41,6 @@ class Window(settingsmixin.SMainWindow):
|
|||
|
||||
# Hide all menu action containers
|
||||
for toolbar in (
|
||||
self.inboxContextMenuToolbar,
|
||||
self.addressContextMenuToolbarYourIdentities,
|
||||
self.addressContextMenuToolbar,
|
||||
self.addressBookContextMenuToolbar,
|
||||
|
|
|
@ -993,68 +993,6 @@ p, li { white-space: pre-wrap; }
|
|||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="inboxContextMenuToolbar">
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<action name="actionReply">
|
||||
<property name="text">
|
||||
<string>Reply to sender</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionReplyChan">
|
||||
<property name="text">
|
||||
<string>Reply to channel</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAddSenderToAddressBook">
|
||||
<property name="text">
|
||||
<string>Add sender to your Address Book</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAddSenderToBlackList">
|
||||
<property name="text">
|
||||
<string>Add sender to your Blacklist</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTrashInboxMessage">
|
||||
<property name="text">
|
||||
<string>Move to Trash</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionUndeleteTrashedMessage">
|
||||
<property name="text">
|
||||
<string>Undelete</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionForceHtml">
|
||||
<property name="text">
|
||||
<string>View HTML code as formatted text</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveMessageAs">
|
||||
<property name="text">
|
||||
<string>Save message as...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMarkUnread">
|
||||
<property name="text">
|
||||
<string>Mark Unread</string>
|
||||
</property>
|
||||
</action>
|
||||
<addaction name="actionReply"/>
|
||||
<addaction name="actionReplyChan"/>
|
||||
<addaction name="actionAddSenderToAddressBook"/>
|
||||
<addaction name="actionAddSenderToBlackList"/>
|
||||
<addaction name="actionTrashInboxMessage"/>
|
||||
<addaction name="actionUndeleteTrashedMessage"/>
|
||||
<addaction name="actionForceHtml"/>
|
||||
<addaction name="actionSaveMessageAs"/>
|
||||
<addaction name="actionMarkUnread"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="addressContextMenuToolbarYourIdentities">
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
|
@ -1713,38 +1651,6 @@ p, li { white-space: pre-wrap; }
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>tableWidgetInboxSubscriptions</sender>
|
||||
<signal>customContextMenuRequested(QPoint)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>on_context_menuInbox()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>tableWidgetInboxChans</sender>
|
||||
<signal>customContextMenuRequested(QPoint)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>on_context_menuInbox()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>tableWidgetAddressBook</sender>
|
||||
<signal>customContextMenuRequested(QPoint)</signal>
|
||||
|
@ -1793,150 +1699,6 @@ p, li { white-space: pre-wrap; }
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionReply</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>on_action_InboxReply</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionReplyChan</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>on_action_InboxReplyChan</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionAddSenderToAddressBook</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>on_action_InboxAddSenderToAddressBook</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionAddSenderToBlackList</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>on_action_InboxAddSenderToBlackList</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionTrashInboxMessage</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>on_action_InboxTrash</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionUndeleteTrashedMessage</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>on_action_TrashUndelete</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionForceHtml</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>on_action_InboxMessageForceHtml</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionSaveMessageAs</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>on_action_InboxSaveMessageAs</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionMarkUnread</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>on_action_InboxMarkUnread</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionNew</sender>
|
||||
<signal>triggered()</signal>
|
||||
|
|
|
@ -5,6 +5,8 @@ from PyQt4 import QtCore, QtGui
|
|||
import account
|
||||
import foldertree
|
||||
import l10n
|
||||
import queues
|
||||
import settingsmixin
|
||||
import widgets
|
||||
from bmconfigparser import BMConfigParser
|
||||
from debug import logger
|
||||
|
@ -100,7 +102,7 @@ class InboxTableModel(QtCore.QAbstractTableModel):
|
|||
self.filter = InboxFilter(folder='*', fields=self.fields)
|
||||
self.fields = ','.join(self.fields)
|
||||
self.query = 'SELECT %%s FROM %s ' % self.table
|
||||
self.sort = ' ORDER BY received DESC'
|
||||
self.order = ' ORDER BY received DESC'
|
||||
self.column_count = len(self.header)
|
||||
|
||||
def columnCount(self, parent=QtCore.QModelIndex()):
|
||||
|
@ -118,7 +120,7 @@ class InboxTableModel(QtCore.QAbstractTableModel):
|
|||
font = QtGui.QFont()
|
||||
font.setBold(
|
||||
not sqlQuery(
|
||||
'%s %s %s' % (self.query, self.filter, self.sort) % 'read'
|
||||
'%s %s %s' % (self.query, self.filter, self.order) % 'read'
|
||||
)[index.row()][0]
|
||||
)
|
||||
return font
|
||||
|
@ -135,7 +137,7 @@ class InboxTableModel(QtCore.QAbstractTableModel):
|
|||
column = self.attributes[index.column() - len(self.header)]
|
||||
|
||||
result = sqlQuery(
|
||||
'%s %s %s' % (self.query, self.filter, self.sort) % column
|
||||
'%s %s %s' % (self.query, self.filter, self.order) % column
|
||||
)[index.row()][0]
|
||||
|
||||
try:
|
||||
|
@ -151,6 +153,15 @@ class InboxTableModel(QtCore.QAbstractTableModel):
|
|||
if role == QtCore.Qt.DisplayRole:
|
||||
return self.header[column]['label']
|
||||
|
||||
def sort(self, column, order):
|
||||
current_order = self.order
|
||||
self.order = ' ORDER BY %s %s' % (
|
||||
self.header[column]['field'],
|
||||
'ASC' if order == QtCore.Qt.AscendingOrder else 'DESC'
|
||||
)
|
||||
if self.order != current_order:
|
||||
self.emit(QtCore.SIGNAL("layoutChanged()"))
|
||||
|
||||
def setRead(self, row, read=True):
|
||||
msgid = self.data(self.createIndex(row, 3))
|
||||
sqlExecute('UPDATE inbox SET read = ? WHERE msgid = ?', read, msgid)
|
||||
|
@ -169,16 +180,24 @@ class InboxTableModel(QtCore.QAbstractTableModel):
|
|||
self.emit(QtCore.SIGNAL("layoutChanged()"))
|
||||
|
||||
|
||||
class InboxMessagelist(QtGui.QTableView):
|
||||
class InboxMessagelist(settingsmixin.STableView):
|
||||
def __init__(self, parent=None):
|
||||
super(InboxMessagelist, self).__init__(parent)
|
||||
self.setModel(InboxTableModel())
|
||||
self.horizontalHeader().setSortIndicator(2, QtCore.Qt.DescendingOrder)
|
||||
self.loadSettings()
|
||||
|
||||
def contextMenuEvent(self, event):
|
||||
# model = self.model()
|
||||
|
||||
self.menu.exec_(event.globalPos())
|
||||
|
||||
def currentChanged(self, cur_id, prev_id):
|
||||
row = cur_id.row()
|
||||
logger.warning('currentChanged, row: %r', row)
|
||||
if row and row == prev_id.row():
|
||||
logger.warning('returning because row <= 0')
|
||||
return
|
||||
# what if folder changed?
|
||||
self.model().setRead(row)
|
||||
msg = self.model().getMessage(row)
|
||||
self.emit(QtCore.SIGNAL("messageSelected(QString)"), msg)
|
||||
|
@ -194,12 +213,92 @@ class InboxMessagelist(QtGui.QTableView):
|
|||
if cur_folder.address:
|
||||
update['toaddress'] = cur_folder.address
|
||||
self.model().updateFilter(update)
|
||||
|
||||
self.selectRow(0)
|
||||
|
||||
def init_context(self, control):
|
||||
self.menu = QtGui.QMenu(self)
|
||||
self.menu.addAction(control.actionForceHtml)
|
||||
self.menu.addAction(control.actionMarkUnread)
|
||||
self.menu.addSeparator()
|
||||
if control.AccountType == foldertree.AccountMixin.CHAN:
|
||||
self.menu.addAction(control.actionReplyChan)
|
||||
self.menu.addAction(control.actionReply)
|
||||
self.menu.addAction(control.actionAddSenderToAddressbook)
|
||||
self.menu.addAction(control.actionClipboard)
|
||||
self.menu.addSeparator()
|
||||
self.menu.addAction(control.actionAddSenderToBlacklist)
|
||||
self.menu.addSeparator()
|
||||
self.menu.addAction(control.actionSaveMessageAs)
|
||||
|
||||
# Menu action handlers
|
||||
def on_actionReply(self, reply_type=None):
|
||||
pass
|
||||
|
||||
def on_actionReplyChan(self):
|
||||
pass
|
||||
|
||||
def on_actionAddSenderToAddressbook(self):
|
||||
current = self.selectionModel().currentIndex()
|
||||
model = self.model()
|
||||
logger.warning(
|
||||
'Address at current row: %s',
|
||||
model.data(model.createIndex(current.row(), 0)))
|
||||
|
||||
def on_actionAddSenderToBlacklist(self):
|
||||
pass
|
||||
|
||||
def on_actionTrash(self):
|
||||
selection = self.selectedIndexes()
|
||||
model = self.model()
|
||||
for i in selection:
|
||||
logger.warning(
|
||||
'Should trash %s', model.data(model.createIndex(i.row(), 3)))
|
||||
|
||||
def on_actionTrashUndelete(self):
|
||||
pass
|
||||
|
||||
def on_actionForceHtml(self):
|
||||
pass
|
||||
|
||||
def on_actionSaveMessageAs(self):
|
||||
model = self.model()
|
||||
current = self.selectionModel().currentIndex()
|
||||
defaultFilename = ''.join(
|
||||
c for c in model.data(model.createIndex(current.row(), 1))
|
||||
if c.isalnum()
|
||||
) + '.txt'
|
||||
filename = QtGui.QFileDialog.getSaveFileName(
|
||||
self, _translate("MainWindow", "Save As..."), defaultFilename,
|
||||
"Text files (*.txt);;All files (*.*)")
|
||||
if filename == '':
|
||||
return
|
||||
try:
|
||||
with open(filename, 'w') as output:
|
||||
output.write(model.getMessage(current.row()))
|
||||
except Exception:
|
||||
logger.exception('Message not saved', exc_info=True)
|
||||
queues.UISignalQueue.put((
|
||||
'updateStatusBar',
|
||||
_translate("MainWindow", "Write error.")
|
||||
))
|
||||
|
||||
def on_actionMarkUnread(self):
|
||||
for i in self.selectedIndexes():
|
||||
if i.column():
|
||||
break
|
||||
self.model().setRead(i.row(), False)
|
||||
|
||||
def on_actionClipboard(self):
|
||||
current = self.selectionModel().currentIndex()
|
||||
clipboard = QtGui.QApplication.clipboard()
|
||||
clipboard.setText(self.model().data(current))
|
||||
|
||||
|
||||
class TreeWidgetIdentities(QtGui.QTreeWidget):
|
||||
def __init__(self, parent):
|
||||
super(TreeWidgetIdentities, self).__init__(parent)
|
||||
self.account_type = None
|
||||
folders = ('inbox', 'new', 'sent', 'trash')
|
||||
accounts = account.getSortedAccounts() + account.getSortedSubscriptions().keys()
|
||||
top = foldertree.Ui_AddressWidget(self, 0, None, 0, True)
|
||||
|
@ -214,6 +313,7 @@ class TreeWidgetIdentities(QtGui.QTreeWidget):
|
|||
self.header().setSortIndicator(0, QtCore.Qt.AscendingOrder)
|
||||
|
||||
def filterAccountType(self, account_type):
|
||||
self.account_type = account_type
|
||||
header = self.headerItem()
|
||||
if account_type == foldertree.AccountMixin.CHAN:
|
||||
header.setText(0, _translate("MainWindow", "Chans"))
|
||||
|
@ -223,9 +323,17 @@ class TreeWidgetIdentities(QtGui.QTreeWidget):
|
|||
header.setIcon(0, QtGui.QIcon(":/newPrefix/images/subscriptions.png"))
|
||||
for i in xrange(self.topLevelItemCount()):
|
||||
item = self.topLevelItem(i)
|
||||
if not item.type and account_type in (
|
||||
foldertree.AccountMixin.ALL,
|
||||
foldertree.AccountMixin.NORMAL
|
||||
):
|
||||
continue
|
||||
if item.type != account_type:
|
||||
self.setItemHidden(item, True)
|
||||
|
||||
def add(self):
|
||||
logger.warning('Should add an item of type %s', self.account_type)
|
||||
|
||||
|
||||
class MessagelistControl(QtGui.QWidget):
|
||||
@QtCore.pyqtProperty(int)
|
||||
|
@ -252,4 +360,15 @@ class MessagelistControl(QtGui.QWidget):
|
|||
self.verticalSplitter.setCollapsible(2, False)
|
||||
self.verticalSplitter.handle(1).setEnabled(False)
|
||||
|
||||
if self.AccountType == foldertree.AccountMixin.CHAN:
|
||||
button_label = _translate("MainWindow", "Add Chan")
|
||||
elif self.AccountType == foldertree.AccountMixin.SUBSCRIPTION:
|
||||
button_label = _translate("MainWindow", "Add new Subscription")
|
||||
else:
|
||||
button_label = _translate("MainWindow", "New Identity")
|
||||
self.buttonAdd.setText(button_label)
|
||||
|
||||
self.treeWidget.filterAccountType(self.AccountType)
|
||||
|
||||
self.inboxContextMenuToolbar.setVisible(False)
|
||||
self.messagelistInbox.init_context(self)
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonNew">
|
||||
<widget class="QPushButton" name="buttonAdd">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
|
@ -68,7 +68,7 @@
|
|||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">New</string>
|
||||
<string notr="true">Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -119,9 +119,6 @@
|
|||
</layout>
|
||||
</widget>
|
||||
<widget class="InboxMessagelist" name="messagelistInbox">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
|
@ -153,7 +150,7 @@
|
|||
<number>27</number>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
|
@ -188,6 +185,74 @@
|
|||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QToolBar" name="inboxContextMenuToolbar">
|
||||
<attribute name="visibility">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<action name="actionReply">
|
||||
<property name="text">
|
||||
<string>Reply to sender</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionReplyChan">
|
||||
<property name="text">
|
||||
<string>Reply to channel</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAddSenderToAddressbook">
|
||||
<property name="text">
|
||||
<string>Add sender to your Addressbook</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAddSenderToBlacklist">
|
||||
<property name="text">
|
||||
<string>Add sender to your Blacklist</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTrash">
|
||||
<property name="text">
|
||||
<string>Move to Trash</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTrashUndelete">
|
||||
<property name="text">
|
||||
<string>Undelete</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionForceHtml">
|
||||
<property name="text">
|
||||
<string>View HTML code as formatted text</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveMessageAs">
|
||||
<property name="text">
|
||||
<string>Save message as...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMarkUnread">
|
||||
<property name="text">
|
||||
<string>Mark Unread</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionClipboard">
|
||||
<property name="text">
|
||||
<string notr="true">Copy to clipboard</string>
|
||||
</property>
|
||||
</action>
|
||||
<addaction name="actionReply"/>
|
||||
<addaction name="actionReplyChan"/>
|
||||
<addaction name="actionAddSenderToAddressbook"/>
|
||||
<addaction name="actionAddSenderToBlacklist"/>
|
||||
<addaction name="actionTrash"/>
|
||||
<addaction name="actionTrashUndelete"/>
|
||||
<addaction name="actionForceHtml"/>
|
||||
<addaction name="actionSaveMessageAs"/>
|
||||
<addaction name="actionMarkUnread"/>
|
||||
<addaction name="actionClipboard"/>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
@ -221,85 +286,29 @@
|
|||
<include location="bitmessage_icons.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<!-- <connection> -->
|
||||
<!-- <sender>messagelistInbox</sender> -->
|
||||
<!-- <signal>customContextMenuRequested(QPoint)</signal> -->
|
||||
<!-- <receiver>MainWindow</receiver> -->
|
||||
<!-- <slot>on_context_menuInbox()</slot> -->
|
||||
<!-- <hints> -->
|
||||
<!-- <hint type="sourcelabel"> -->
|
||||
<!-- <x>656</x> -->
|
||||
<!-- <y>366</y> -->
|
||||
<!-- </hint> -->
|
||||
<!-- <hint type="destinationlabel"> -->
|
||||
<!-- <x>442</x> -->
|
||||
<!-- <y>289</y> -->
|
||||
<!-- </hint> -->
|
||||
<!-- </hints> -->
|
||||
<!-- </connection> -->
|
||||
<!-- <connection> -->
|
||||
<!-- <sender>pushButtonNewAddress</sender> -->
|
||||
<!-- <signal>clicked()</signal> -->
|
||||
<!-- <receiver>MainWindow</receiver> -->
|
||||
<!-- <slot>click_NewAddressDialog</slot> -->
|
||||
<!-- <hints> -->
|
||||
<!-- <hint type="sourcelabel"> -->
|
||||
<!-- <x>20</x> -->
|
||||
<!-- <y>20</y> -->
|
||||
<!-- </hint> -->
|
||||
<!-- <hint type="destinationlabel"> -->
|
||||
<!-- <x>20</x> -->
|
||||
<!-- <y>20</y> -->
|
||||
<!-- </hint> -->
|
||||
<!-- </hints> -->
|
||||
<!-- </connection> -->
|
||||
<connection>
|
||||
<sender>buttonAdd</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>treeWidget</receiver>
|
||||
<slot>add</slot>
|
||||
</connection>
|
||||
<!-- <connection> -->
|
||||
<!-- <sender>treeWidgetYourIdentities</sender> -->
|
||||
<!-- <signal>customContextMenuRequested(QPoint)</signal> -->
|
||||
<!-- <receiver>MainWindow</receiver> -->
|
||||
<!-- <slot>on_context_menuYourIdentities()</slot> -->
|
||||
<!-- <hints> -->
|
||||
<!-- <hint type="sourcelabel"> -->
|
||||
<!-- <x>20</x> -->
|
||||
<!-- <y>20</y> -->
|
||||
<!-- </hint> -->
|
||||
<!-- <hint type="destinationlabel"> -->
|
||||
<!-- <x>20</x> -->
|
||||
<!-- <y>20</y> -->
|
||||
<!-- </hint> -->
|
||||
<!-- </hints> -->
|
||||
<!-- </connection> -->
|
||||
<!-- <connection> -->
|
||||
<!-- <sender>inboxSearchLineEdit</sender> -->
|
||||
<!-- <signal>returnPressed()</signal> -->
|
||||
<!-- <receiver>MainWindow</receiver> -->
|
||||
<!-- <slot>inboxSearchLineEditReturnPressed</slot> -->
|
||||
<!-- <hints> -->
|
||||
<!-- <hint type="sourcelabel"> -->
|
||||
<!-- <x>20</x> -->
|
||||
<!-- <y>20</y> -->
|
||||
<!-- </hint> -->
|
||||
<!-- <hint type="destinationlabel"> -->
|
||||
<!-- <x>20</x> -->
|
||||
<!-- <y>20</y> -->
|
||||
<!-- </hint> -->
|
||||
<!-- </hints> -->
|
||||
<!-- </connection> -->
|
||||
<!-- <connection> -->
|
||||
<!-- <sender>inboxSearchLineEdit</sender> -->
|
||||
<!-- <signal>textChanged(QString)</signal> -->
|
||||
<!-- <receiver>MainWindow</receiver> -->
|
||||
<!-- <slot>inboxSearchLineEditUpdated</slot> -->
|
||||
<!-- <hints> -->
|
||||
<!-- <hint type="sourcelabel"> -->
|
||||
<!-- <x>20</x> -->
|
||||
<!-- <y>20</y> -->
|
||||
<!-- </hint> -->
|
||||
<!-- <hint type="destinationlabel"> -->
|
||||
<!-- <x>20</x> -->
|
||||
<!-- <y>20</y> -->
|
||||
<!-- </hint> -->
|
||||
<!-- </hints> -->
|
||||
<!-- </connection> -->
|
||||
<connection>
|
||||
<sender>treeWidget</sender>
|
||||
|
@ -307,22 +316,6 @@
|
|||
<receiver>messagelistInbox</receiver>
|
||||
<slot>folderChanged</slot>
|
||||
</connection>
|
||||
<!-- <connection> -->
|
||||
<!-- <sender>treeWidgetYourIdentities</sender> -->
|
||||
<!-- <signal>itemChanged(QTreeWidgetItem*,int)</signal> -->
|
||||
<!-- <receiver>MainWindow</receiver> -->
|
||||
<!-- <slot>treeWidgetItemChanged</slot> -->
|
||||
<!-- <hints> -->
|
||||
<!-- <hint type="sourcelabel"> -->
|
||||
<!-- <x>20</x> -->
|
||||
<!-- <y>20</y> -->
|
||||
<!-- </hint> -->
|
||||
<!-- <hint type="destinationlabel"> -->
|
||||
<!-- <x>20</x> -->
|
||||
<!-- <y>20</y> -->
|
||||
<!-- </hint> -->
|
||||
<!-- </hints> -->
|
||||
<!-- </connection> -->
|
||||
<connection>
|
||||
<sender>messagelistInbox</sender>
|
||||
<signal>messageSelected(QString)</signal>
|
||||
|
@ -339,5 +332,65 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionReply</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>messagelistInbox</receiver>
|
||||
<slot>on_actionReply</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionReplyChan</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>messagelistInbox</receiver>
|
||||
<slot>on_actionReplyChan</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionAddSenderToAddressbook</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>messagelistInbox</receiver>
|
||||
<slot>on_actionAddSenderToAddressbook</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionAddSenderToBlacklist</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>messagelistInbox</receiver>
|
||||
<slot>on_actionAddSenderToBlacklist</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionTrash</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>messagelistInbox</receiver>
|
||||
<slot>on_actionTrash</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionTrashUndelete</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>messagelistInbox</receiver>
|
||||
<slot>on_actionTrashUndelete</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionForceHtml</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>messagelistInbox</receiver>
|
||||
<slot>on_actionForceHtml</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionSaveMessageAs</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>messagelistInbox</receiver>
|
||||
<slot>on_actionSaveMessageAs</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionMarkUnread</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>messagelistInbox</receiver>
|
||||
<slot>on_actionMarkUnread</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionClipboard</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>messagelistInbox</receiver>
|
||||
<slot>on_actionClipboard</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
|
|
@ -10,6 +10,14 @@ from PyQt4 import QtCore, QtGui
|
|||
|
||||
class SettingsMixin(object):
|
||||
"""Mixin for adding geometry and state saving between restarts."""
|
||||
# def __init__(self, *args):
|
||||
# super(SettingsMixin, self).__init__(*args)
|
||||
# self.loadSettings()
|
||||
|
||||
# def __del__(self):
|
||||
# self.saveSettings()
|
||||
# super(SettingsMixin, self).__del__()
|
||||
|
||||
def warnIfNoObjectName(self):
|
||||
"""
|
||||
Handle objects which don't have a name. Currently it ignores them. Objects without a name can't have their
|
||||
|
@ -81,6 +89,18 @@ class STableWidget(QtGui.QTableWidget, SettingsMixin):
|
|||
self.writeState(self.horizontalHeader())
|
||||
|
||||
|
||||
class STableView(QtGui.QTableView, SettingsMixin):
|
||||
"""Table widget with Settings functionality"""
|
||||
# pylint: disable=too-many-ancestors
|
||||
def loadSettings(self):
|
||||
"""Load table settings."""
|
||||
self.readState(self.horizontalHeader())
|
||||
|
||||
def saveSettings(self):
|
||||
"""Save table settings."""
|
||||
self.writeState(self.horizontalHeader())
|
||||
|
||||
|
||||
class SSplitter(QtGui.QSplitter, SettingsMixin):
|
||||
"""Splitter with Settings functionality."""
|
||||
def loadSettings(self):
|
||||
|
|
Reference in New Issue
Block a user