Sent search.

This commit is contained in:
Rainulf Pineda 2013-07-12 04:42:52 -04:00
parent 45cfead4d0
commit 997a8ff13a
3 changed files with 108 additions and 20 deletions

View File

@ -336,6 +336,10 @@ class MyForm(QtGui.QMainWindow):
QtCore.QObject.connect(self.ui.inboxSearchLineEdit, QtCore.SIGNAL( QtCore.QObject.connect(self.ui.inboxSearchLineEdit, QtCore.SIGNAL(
"returnPressed()"), self.inboxSearchLineEditPressed) "returnPressed()"), self.inboxSearchLineEditPressed)
# Initialize the sent search
QtCore.QObject.connect(self.ui.sentSearchLineEdit, QtCore.SIGNAL(
"returnPressed()"), self.sentSearchLineEditPressed)
# Initialize the Blacklist or Whitelist # Initialize the Blacklist or Whitelist
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black': if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
self.loadBlackWhiteList() self.loadBlackWhiteList()
@ -497,9 +501,29 @@ class MyForm(QtGui.QMainWindow):
# Load Sent items from database # Load Sent items from database
def loadSent(self, where="", what=""): 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 "%s"
ORDER BY lastactiontime
''' % (where, what)
while self.ui.tableWidgetSent.rowCount() > 0:
self.ui.tableWidgetSent.removeRow(0)
shared.sqlLock.acquire() shared.sqlLock.acquire()
shared.sqlSubmitQueue.put( shared.sqlSubmitQueue.put(sqlQuery)
'''SELECT toaddress, fromaddress, subject, message, status, ackdata, lastactiontime FROM sent where folder = 'sent' ORDER BY lastactiontime''')
shared.sqlSubmitQueue.put('') shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get() queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release() shared.sqlLock.release()
@ -610,12 +634,10 @@ class MyForm(QtGui.QMainWindow):
where = "fromaddress" where = "fromaddress"
elif where == "Subject": elif where == "Subject":
where = "subject" where = "subject"
elif where == "Received":
where = "received"
elif where == "Message": elif where == "Message":
where = "message" where = "message"
else: else:
where = "toaddress || fromaddress || subject || received || message" where = "toaddress || fromaddress || subject || message"
sqlQuery = ''' sqlQuery = '''
SELECT msgid, toaddress, fromaddress, subject, received, message, read SELECT msgid, toaddress, fromaddress, subject, received, message, read
@ -2548,6 +2570,13 @@ class MyForm(QtGui.QMainWindow):
self.ui.textEditInboxMessage.setPlainText(QString("")) self.ui.textEditInboxMessage.setPlainText(QString(""))
self.loadInbox(searchOption, searchKeyword) 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): def tableWidgetInboxItemClicked(self):
currentRow = self.ui.tableWidgetInbox.currentRow() currentRow = self.ui.tableWidgetInbox.currentRow()
if currentRow >= 0: if currentRow >= 0:

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'bitmessageui.ui' # Form implementation generated from reading ui file 'bitmessageui.ui'
# #
# Created: Fri Jul 12 04:16:52 2013 # Created: Fri Jul 12 04:40:47 2013
# by: PyQt4 UI code generator 4.10 # by: PyQt4 UI code generator 4.10
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -172,6 +172,21 @@ class Ui_MainWindow(object):
self.sent.setObjectName(_fromUtf8("sent")) self.sent.setObjectName(_fromUtf8("sent"))
self.verticalLayout = QtGui.QVBoxLayout(self.sent) self.verticalLayout = QtGui.QVBoxLayout(self.sent)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) 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 = QtGui.QTableWidget(self.sent)
self.tableWidgetSent.setDragDropMode(QtGui.QAbstractItemView.DragDrop) self.tableWidgetSent.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
self.tableWidgetSent.setAlternatingRowColors(True) self.tableWidgetSent.setAlternatingRowColors(True)
@ -407,7 +422,7 @@ class Ui_MainWindow(object):
self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1) self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1)
MainWindow.setCentralWidget(self.centralwidget) MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtGui.QMenuBar(MainWindow) self.menubar = QtGui.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 795, 20)) self.menubar.setGeometry(QtCore.QRect(0, 0, 795, 25))
self.menubar.setObjectName(_fromUtf8("menubar")) self.menubar.setObjectName(_fromUtf8("menubar"))
self.menuFile = QtGui.QMenu(self.menubar) self.menuFile = QtGui.QMenu(self.menubar)
self.menuFile.setObjectName(_fromUtf8("menuFile")) self.menuFile.setObjectName(_fromUtf8("menuFile"))
@ -504,7 +519,7 @@ class Ui_MainWindow(object):
self.textEditMessage.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" self.textEditMessage.setHtml(_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" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n" "p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n" "</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)) "<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))
self.label.setText(_translate("MainWindow", "To:", None)) self.label.setText(_translate("MainWindow", "To:", None))
self.label_2.setText(_translate("MainWindow", "From:", None)) self.label_2.setText(_translate("MainWindow", "From:", None))
@ -512,6 +527,11 @@ class Ui_MainWindow(object):
self.pushButtonSend.setText(_translate("MainWindow", "Send", 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.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.tabWidget.setTabText(self.tabWidget.indexOf(self.send), _translate("MainWindow", "Send", 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))
self.tableWidgetSent.setSortingEnabled(True) self.tableWidgetSent.setSortingEnabled(True)
item = self.tableWidgetSent.horizontalHeaderItem(0) item = self.tableWidgetSent.horizontalHeaderItem(0)
item.setText(_translate("MainWindow", "To", None)) item.setText(_translate("MainWindow", "To", None))

View File

@ -14,7 +14,7 @@
<string>Bitmessage</string> <string>Bitmessage</string>
</property> </property>
<property name="windowIcon"> <property name="windowIcon">
<iconset resource="bitmessage_icons.qrc"> <iconset>
<normaloff>:/newPrefix/images/can-icon-24px.png</normaloff>:/newPrefix/images/can-icon-24px.png</iconset> <normaloff>:/newPrefix/images/can-icon-24px.png</normaloff>:/newPrefix/images/can-icon-24px.png</iconset>
</property> </property>
<property name="tabShape"> <property name="tabShape">
@ -70,7 +70,7 @@
</property> </property>
<widget class="QWidget" name="inbox"> <widget class="QWidget" name="inbox">
<attribute name="icon"> <attribute name="icon">
<iconset resource="bitmessage_icons.qrc"> <iconset>
<normaloff>:/newPrefix/images/inbox.png</normaloff>:/newPrefix/images/inbox.png</iconset> <normaloff>:/newPrefix/images/inbox.png</normaloff>:/newPrefix/images/inbox.png</iconset>
</attribute> </attribute>
<attribute name="title"> <attribute name="title">
@ -193,7 +193,7 @@
</widget> </widget>
<widget class="QWidget" name="send"> <widget class="QWidget" name="send">
<attribute name="icon"> <attribute name="icon">
<iconset resource="bitmessage_icons.qrc"> <iconset>
<normaloff>:/newPrefix/images/send.png</normaloff>:/newPrefix/images/send.png</iconset> <normaloff>:/newPrefix/images/send.png</normaloff>:/newPrefix/images/send.png</iconset>
</attribute> </attribute>
<attribute name="title"> <attribute name="title">
@ -262,7 +262,7 @@
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-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';&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p style=&quot;-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';&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
@ -351,13 +351,52 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
<widget class="QWidget" name="sent"> <widget class="QWidget" name="sent">
<attribute name="icon"> <attribute name="icon">
<iconset resource="bitmessage_icons.qrc"> <iconset>
<normaloff>:/newPrefix/images/sent.png</normaloff>:/newPrefix/images/sent.png</iconset> <normaloff>:/newPrefix/images/sent.png</normaloff>:/newPrefix/images/sent.png</iconset>
</attribute> </attribute>
<attribute name="title"> <attribute name="title">
<string>Sent</string> <string>Sent</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="sentSearchLineEdit"/>
</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> <item>
<widget class="QTableWidget" name="tableWidgetSent"> <widget class="QTableWidget" name="tableWidgetSent">
<property name="dragDropMode"> <property name="dragDropMode">
@ -428,7 +467,7 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
<widget class="QWidget" name="youridentities"> <widget class="QWidget" name="youridentities">
<attribute name="icon"> <attribute name="icon">
<iconset resource="bitmessage_icons.qrc"> <iconset>
<normaloff>:/newPrefix/images/identities.png</normaloff>:/newPrefix/images/identities.png</iconset> <normaloff>:/newPrefix/images/identities.png</normaloff>:/newPrefix/images/identities.png</iconset>
</attribute> </attribute>
<attribute name="title"> <attribute name="title">
@ -528,7 +567,7 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
<widget class="QWidget" name="subscriptions"> <widget class="QWidget" name="subscriptions">
<attribute name="icon"> <attribute name="icon">
<iconset resource="bitmessage_icons.qrc"> <iconset>
<normaloff>:/newPrefix/images/subscriptions.png</normaloff>:/newPrefix/images/subscriptions.png</iconset> <normaloff>:/newPrefix/images/subscriptions.png</normaloff>:/newPrefix/images/subscriptions.png</iconset>
</attribute> </attribute>
<attribute name="title"> <attribute name="title">
@ -613,7 +652,7 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
<widget class="QWidget" name="addressbook"> <widget class="QWidget" name="addressbook">
<attribute name="icon"> <attribute name="icon">
<iconset resource="bitmessage_icons.qrc"> <iconset>
<normaloff>:/newPrefix/images/addressbook.png</normaloff>:/newPrefix/images/addressbook.png</iconset> <normaloff>:/newPrefix/images/addressbook.png</normaloff>:/newPrefix/images/addressbook.png</iconset>
</attribute> </attribute>
<attribute name="title"> <attribute name="title">
@ -695,7 +734,7 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
<widget class="QWidget" name="blackwhitelist"> <widget class="QWidget" name="blackwhitelist">
<attribute name="icon"> <attribute name="icon">
<iconset resource="bitmessage_icons.qrc"> <iconset>
<normaloff>:/newPrefix/images/blacklist.png</normaloff>:/newPrefix/images/blacklist.png</iconset> <normaloff>:/newPrefix/images/blacklist.png</normaloff>:/newPrefix/images/blacklist.png</iconset>
</attribute> </attribute>
<attribute name="title"> <attribute name="title">
@ -787,7 +826,7 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
<widget class="QWidget" name="networkstatus"> <widget class="QWidget" name="networkstatus">
<attribute name="icon"> <attribute name="icon">
<iconset resource="bitmessage_icons.qrc"> <iconset>
<normaloff>:/newPrefix/images/networkstatus.png</normaloff>:/newPrefix/images/networkstatus.png</iconset> <normaloff>:/newPrefix/images/networkstatus.png</normaloff>:/newPrefix/images/networkstatus.png</iconset>
</attribute> </attribute>
<attribute name="title"> <attribute name="title">
@ -806,7 +845,7 @@ p, li { white-space: pre-wrap; }
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="bitmessage_icons.qrc"> <iconset>
<normaloff>:/newPrefix/images/redicon.png</normaloff>:/newPrefix/images/redicon.png</iconset> <normaloff>:/newPrefix/images/redicon.png</normaloff>:/newPrefix/images/redicon.png</iconset>
</property> </property>
<property name="flat"> <property name="flat">
@ -973,7 +1012,7 @@ p, li { white-space: pre-wrap; }
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>795</width> <width>795</width>
<height>20</height> <height>25</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">