diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 8f3042a0..92209bbe 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -336,6 +336,10 @@ class MyForm(QtGui.QMainWindow): 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() @@ -497,9 +501,29 @@ class MyForm(QtGui.QMainWindow): # 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 "%s" + ORDER BY lastactiontime + ''' % (where, what) + + while self.ui.tableWidgetSent.rowCount() > 0: + self.ui.tableWidgetSent.removeRow(0) + 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(sqlQuery) shared.sqlSubmitQueue.put('') queryreturn = shared.sqlReturnQueue.get() shared.sqlLock.release() @@ -610,12 +634,10 @@ class MyForm(QtGui.QMainWindow): where = "fromaddress" elif where == "Subject": where = "subject" - elif where == "Received": - where = "received" elif where == "Message": where = "message" else: - where = "toaddress || fromaddress || subject || received || message" + where = "toaddress || fromaddress || subject || message" sqlQuery = ''' SELECT msgid, toaddress, fromaddress, subject, received, message, read @@ -2548,6 +2570,13 @@ class MyForm(QtGui.QMainWindow): 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: diff --git a/src/bitmessageqt/bitmessageui.py b/src/bitmessageqt/bitmessageui.py index ff23fa82..62466503 100644 --- a/src/bitmessageqt/bitmessageui.py +++ b/src/bitmessageqt/bitmessageui.py @@ -2,7 +2,7 @@ # 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 # # WARNING! All changes made in this file will be lost! @@ -172,6 +172,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) @@ -407,7 +422,7 @@ class Ui_MainWindow(object): self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) 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.menuFile = QtGui.QMenu(self.menubar) self.menuFile.setObjectName(_fromUtf8("menuFile")) @@ -504,7 +519,7 @@ class Ui_MainWindow(object): self.textEditMessage.setHtml(_translate("MainWindow", "\n" "\n" +"\n" "


", None)) self.label.setText(_translate("MainWindow", "To:", 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.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.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) item = self.tableWidgetSent.horizontalHeaderItem(0) item.setText(_translate("MainWindow", "To", None)) diff --git a/src/bitmessageqt/bitmessageui.ui b/src/bitmessageqt/bitmessageui.ui index 2be3385d..46ebd06a 100644 --- a/src/bitmessageqt/bitmessageui.ui +++ b/src/bitmessageqt/bitmessageui.ui @@ -14,7 +14,7 @@ Bitmessage - + :/newPrefix/images/can-icon-24px.png:/newPrefix/images/can-icon-24px.png @@ -70,7 +70,7 @@ - + :/newPrefix/images/inbox.png:/newPrefix/images/inbox.png @@ -193,7 +193,7 @@ - + :/newPrefix/images/send.png:/newPrefix/images/send.png @@ -262,7 +262,7 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;"> <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> @@ -351,13 +351,52 @@ p, li { white-space: pre-wrap; } - + :/newPrefix/images/sent.png:/newPrefix/images/sent.png Sent + + + + 0 + + + + + + + + + All + + + + + To + + + + + From + + + + + Subject + + + + + Message + + + + + + @@ -428,7 +467,7 @@ p, li { white-space: pre-wrap; } - + :/newPrefix/images/identities.png:/newPrefix/images/identities.png @@ -528,7 +567,7 @@ p, li { white-space: pre-wrap; } - + :/newPrefix/images/subscriptions.png:/newPrefix/images/subscriptions.png @@ -613,7 +652,7 @@ p, li { white-space: pre-wrap; } - + :/newPrefix/images/addressbook.png:/newPrefix/images/addressbook.png @@ -695,7 +734,7 @@ p, li { white-space: pre-wrap; } - + :/newPrefix/images/blacklist.png:/newPrefix/images/blacklist.png @@ -787,7 +826,7 @@ p, li { white-space: pre-wrap; } - + :/newPrefix/images/networkstatus.png:/newPrefix/images/networkstatus.png @@ -806,7 +845,7 @@ p, li { white-space: pre-wrap; } - + :/newPrefix/images/redicon.png:/newPrefix/images/redicon.png @@ -973,7 +1012,7 @@ p, li { white-space: pre-wrap; } 0 0 795 - 20 + 25