Skip to content

Commit 997a8ff

Browse files
committed
Sent search.
1 parent 45cfead commit 997a8ff

3 files changed

Lines changed: 108 additions & 20 deletions

File tree

src/bitmessageqt/__init__.py

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ def __init__(self, parent=None):
336336
QtCore.QObject.connect(self.ui.inboxSearchLineEdit, QtCore.SIGNAL(
337337
"returnPressed()"), self.inboxSearchLineEditPressed)
338338

339+
# Initialize the sent search
340+
QtCore.QObject.connect(self.ui.sentSearchLineEdit, QtCore.SIGNAL(
341+
"returnPressed()"), self.sentSearchLineEditPressed)
342+
339343
# Initialize the Blacklist or Whitelist
340344
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
341345
self.loadBlackWhiteList()
@@ -497,9 +501,29 @@ def appIndicatorAddressBook(self):
497501

498502
# Load Sent items from database
499503
def loadSent(self, where="", what=""):
504+
what = "%" + what + "%"
505+
if where == "To":
506+
where = "toaddress"
507+
elif where == "From":
508+
where = "fromaddress"
509+
elif where == "Subject":
510+
where = "subject"
511+
elif where == "Message":
512+
where = "message"
513+
else:
514+
where = "toaddress || fromaddress || subject || message"
515+
516+
sqlQuery = '''
517+
SELECT toaddress, fromaddress, subject, message, status, ackdata, lastactiontime
518+
FROM sent WHERE folder="sent" AND %s LIKE "%s"
519+
ORDER BY lastactiontime
520+
''' % (where, what)
521+
522+
while self.ui.tableWidgetSent.rowCount() > 0:
523+
self.ui.tableWidgetSent.removeRow(0)
524+
500525
shared.sqlLock.acquire()
501-
shared.sqlSubmitQueue.put(
502-
'''SELECT toaddress, fromaddress, subject, message, status, ackdata, lastactiontime FROM sent where folder = 'sent' ORDER BY lastactiontime''')
526+
shared.sqlSubmitQueue.put(sqlQuery)
503527
shared.sqlSubmitQueue.put('')
504528
queryreturn = shared.sqlReturnQueue.get()
505529
shared.sqlLock.release()
@@ -610,12 +634,10 @@ def loadInbox(self, where="", what=""):
610634
where = "fromaddress"
611635
elif where == "Subject":
612636
where = "subject"
613-
elif where == "Received":
614-
where = "received"
615637
elif where == "Message":
616638
where = "message"
617639
else:
618-
where = "toaddress || fromaddress || subject || received || message"
640+
where = "toaddress || fromaddress || subject || message"
619641

620642
sqlQuery = '''
621643
SELECT msgid, toaddress, fromaddress, subject, received, message, read
@@ -2548,6 +2570,13 @@ def inboxSearchLineEditPressed(self):
25482570
self.ui.textEditInboxMessage.setPlainText(QString(""))
25492571
self.loadInbox(searchOption, searchKeyword)
25502572

2573+
def sentSearchLineEditPressed(self):
2574+
searchKeyword = self.ui.sentSearchLineEdit.text().toUtf8().data()
2575+
searchOption = self.ui.sentSearchOptionCB.currentText().toUtf8().data()
2576+
self.ui.sentSearchLineEdit.setText(QString(""))
2577+
self.ui.textEditInboxMessage.setPlainText(QString(""))
2578+
self.loadSent(searchOption, searchKeyword)
2579+
25512580
def tableWidgetInboxItemClicked(self):
25522581
currentRow = self.ui.tableWidgetInbox.currentRow()
25532582
if currentRow >= 0:

src/bitmessageqt/bitmessageui.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Form implementation generated from reading ui file 'bitmessageui.ui'
44
#
5-
# Created: Fri Jul 12 04:16:52 2013
5+
# Created: Fri Jul 12 04:40:47 2013
66
# by: PyQt4 UI code generator 4.10
77
#
88
# WARNING! All changes made in this file will be lost!
@@ -172,6 +172,21 @@ def setupUi(self, MainWindow):
172172
self.sent.setObjectName(_fromUtf8("sent"))
173173
self.verticalLayout = QtGui.QVBoxLayout(self.sent)
174174
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
175+
self.horizontalLayout = QtGui.QHBoxLayout()
176+
self.horizontalLayout.setContentsMargins(-1, 0, -1, -1)
177+
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
178+
self.sentSearchLineEdit = QtGui.QLineEdit(self.sent)
179+
self.sentSearchLineEdit.setObjectName(_fromUtf8("sentSearchLineEdit"))
180+
self.horizontalLayout.addWidget(self.sentSearchLineEdit)
181+
self.sentSearchOptionCB = QtGui.QComboBox(self.sent)
182+
self.sentSearchOptionCB.setObjectName(_fromUtf8("sentSearchOptionCB"))
183+
self.sentSearchOptionCB.addItem(_fromUtf8(""))
184+
self.sentSearchOptionCB.addItem(_fromUtf8(""))
185+
self.sentSearchOptionCB.addItem(_fromUtf8(""))
186+
self.sentSearchOptionCB.addItem(_fromUtf8(""))
187+
self.sentSearchOptionCB.addItem(_fromUtf8(""))
188+
self.horizontalLayout.addWidget(self.sentSearchOptionCB)
189+
self.verticalLayout.addLayout(self.horizontalLayout)
175190
self.tableWidgetSent = QtGui.QTableWidget(self.sent)
176191
self.tableWidgetSent.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
177192
self.tableWidgetSent.setAlternatingRowColors(True)
@@ -407,7 +422,7 @@ def setupUi(self, MainWindow):
407422
self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1)
408423
MainWindow.setCentralWidget(self.centralwidget)
409424
self.menubar = QtGui.QMenuBar(MainWindow)
410-
self.menubar.setGeometry(QtCore.QRect(0, 0, 795, 20))
425+
self.menubar.setGeometry(QtCore.QRect(0, 0, 795, 25))
411426
self.menubar.setObjectName(_fromUtf8("menubar"))
412427
self.menuFile = QtGui.QMenu(self.menubar)
413428
self.menuFile.setObjectName(_fromUtf8("menuFile"))
@@ -504,14 +519,19 @@ def retranslateUi(self, MainWindow):
504519
self.textEditMessage.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
505520
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
506521
"p, li { white-space: pre-wrap; }\n"
507-
"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
522+
"</style></head><body style=\" font-family:\'Sans\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
508523
"<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))
509524
self.label.setText(_translate("MainWindow", "To:", None))
510525
self.label_2.setText(_translate("MainWindow", "From:", None))
511526
self.radioButtonBroadcast.setText(_translate("MainWindow", "Broadcast to everyone who is subscribed to your address", None))
512527
self.pushButtonSend.setText(_translate("MainWindow", "Send", None))
513528
self.labelSendBroadcastWarning.setText(_translate("MainWindow", "Be aware that broadcasts are only encrypted with your address. Anyone who knows your address can read them.", None))
514529
self.tabWidget.setTabText(self.tabWidget.indexOf(self.send), _translate("MainWindow", "Send", None))
530+
self.sentSearchOptionCB.setItemText(0, _translate("MainWindow", "All", None))
531+
self.sentSearchOptionCB.setItemText(1, _translate("MainWindow", "To", None))
532+
self.sentSearchOptionCB.setItemText(2, _translate("MainWindow", "From", None))
533+
self.sentSearchOptionCB.setItemText(3, _translate("MainWindow", "Subject", None))
534+
self.sentSearchOptionCB.setItemText(4, _translate("MainWindow", "Message", None))
515535
self.tableWidgetSent.setSortingEnabled(True)
516536
item = self.tableWidgetSent.horizontalHeaderItem(0)
517537
item.setText(_translate("MainWindow", "To", None))

src/bitmessageqt/bitmessageui.ui

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<string>Bitmessage</string>
1515
</property>
1616
<property name="windowIcon">
17-
<iconset resource="bitmessage_icons.qrc">
17+
<iconset>
1818
<normaloff>:/newPrefix/images/can-icon-24px.png</normaloff>:/newPrefix/images/can-icon-24px.png</iconset>
1919
</property>
2020
<property name="tabShape">
@@ -70,7 +70,7 @@
7070
</property>
7171
<widget class="QWidget" name="inbox">
7272
<attribute name="icon">
73-
<iconset resource="bitmessage_icons.qrc">
73+
<iconset>
7474
<normaloff>:/newPrefix/images/inbox.png</normaloff>:/newPrefix/images/inbox.png</iconset>
7575
</attribute>
7676
<attribute name="title">
@@ -193,7 +193,7 @@
193193
</widget>
194194
<widget class="QWidget" name="send">
195195
<attribute name="icon">
196-
<iconset resource="bitmessage_icons.qrc">
196+
<iconset>
197197
<normaloff>:/newPrefix/images/send.png</normaloff>:/newPrefix/images/send.png</iconset>
198198
</attribute>
199199
<attribute name="title">
@@ -262,7 +262,7 @@
262262
<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;
263263
&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;
264264
p, li { white-space: pre-wrap; }
265-
&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;
265+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
266266
&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>
267267
</property>
268268
</widget>
@@ -351,13 +351,52 @@ p, li { white-space: pre-wrap; }
351351
</widget>
352352
<widget class="QWidget" name="sent">
353353
<attribute name="icon">
354-
<iconset resource="bitmessage_icons.qrc">
354+
<iconset>
355355
<normaloff>:/newPrefix/images/sent.png</normaloff>:/newPrefix/images/sent.png</iconset>
356356
</attribute>
357357
<attribute name="title">
358358
<string>Sent</string>
359359
</attribute>
360360
<layout class="QVBoxLayout" name="verticalLayout">
361+
<item>
362+
<layout class="QHBoxLayout" name="horizontalLayout">
363+
<property name="topMargin">
364+
<number>0</number>
365+
</property>
366+
<item>
367+
<widget class="QLineEdit" name="sentSearchLineEdit"/>
368+
</item>
369+
<item>
370+
<widget class="QComboBox" name="sentSearchOptionCB">
371+
<item>
372+
<property name="text">
373+
<string>All</string>
374+
</property>
375+
</item>
376+
<item>
377+
<property name="text">
378+
<string>To</string>
379+
</property>
380+
</item>
381+
<item>
382+
<property name="text">
383+
<string>From</string>
384+
</property>
385+
</item>
386+
<item>
387+
<property name="text">
388+
<string>Subject</string>
389+
</property>
390+
</item>
391+
<item>
392+
<property name="text">
393+
<string>Message</string>
394+
</property>
395+
</item>
396+
</widget>
397+
</item>
398+
</layout>
399+
</item>
361400
<item>
362401
<widget class="QTableWidget" name="tableWidgetSent">
363402
<property name="dragDropMode">
@@ -428,7 +467,7 @@ p, li { white-space: pre-wrap; }
428467
</widget>
429468
<widget class="QWidget" name="youridentities">
430469
<attribute name="icon">
431-
<iconset resource="bitmessage_icons.qrc">
470+
<iconset>
432471
<normaloff>:/newPrefix/images/identities.png</normaloff>:/newPrefix/images/identities.png</iconset>
433472
</attribute>
434473
<attribute name="title">
@@ -528,7 +567,7 @@ p, li { white-space: pre-wrap; }
528567
</widget>
529568
<widget class="QWidget" name="subscriptions">
530569
<attribute name="icon">
531-
<iconset resource="bitmessage_icons.qrc">
570+
<iconset>
532571
<normaloff>:/newPrefix/images/subscriptions.png</normaloff>:/newPrefix/images/subscriptions.png</iconset>
533572
</attribute>
534573
<attribute name="title">
@@ -613,7 +652,7 @@ p, li { white-space: pre-wrap; }
613652
</widget>
614653
<widget class="QWidget" name="addressbook">
615654
<attribute name="icon">
616-
<iconset resource="bitmessage_icons.qrc">
655+
<iconset>
617656
<normaloff>:/newPrefix/images/addressbook.png</normaloff>:/newPrefix/images/addressbook.png</iconset>
618657
</attribute>
619658
<attribute name="title">
@@ -695,7 +734,7 @@ p, li { white-space: pre-wrap; }
695734
</widget>
696735
<widget class="QWidget" name="blackwhitelist">
697736
<attribute name="icon">
698-
<iconset resource="bitmessage_icons.qrc">
737+
<iconset>
699738
<normaloff>:/newPrefix/images/blacklist.png</normaloff>:/newPrefix/images/blacklist.png</iconset>
700739
</attribute>
701740
<attribute name="title">
@@ -787,7 +826,7 @@ p, li { white-space: pre-wrap; }
787826
</widget>
788827
<widget class="QWidget" name="networkstatus">
789828
<attribute name="icon">
790-
<iconset resource="bitmessage_icons.qrc">
829+
<iconset>
791830
<normaloff>:/newPrefix/images/networkstatus.png</normaloff>:/newPrefix/images/networkstatus.png</iconset>
792831
</attribute>
793832
<attribute name="title">
@@ -806,7 +845,7 @@ p, li { white-space: pre-wrap; }
806845
<string/>
807846
</property>
808847
<property name="icon">
809-
<iconset resource="bitmessage_icons.qrc">
848+
<iconset>
810849
<normaloff>:/newPrefix/images/redicon.png</normaloff>:/newPrefix/images/redicon.png</iconset>
811850
</property>
812851
<property name="flat">
@@ -973,7 +1012,7 @@ p, li { white-space: pre-wrap; }
9731012
<x>0</x>
9741013
<y>0</y>
9751014
<width>795</width>
976-
<height>20</height>
1015+
<height>25</height>
9771016
</rect>
9781017
</property>
9791018
<widget class="QMenu" name="menuFile">

0 commit comments

Comments
 (0)