add - viewing messages with attachmets.
This commit is contained in:
parent
0227fbe8e7
commit
bdf6741016
|
@ -2168,7 +2168,7 @@ class MyForm(QtGui.QMainWindow):
|
||||||
content += "<tr><td>"+self.attachArray[i]['filename']+"</td><td><a href='"+str(i)+"'>Download</a></td></tr>"
|
content += "<tr><td>"+self.attachArray[i]['filename']+"</td><td><a href='"+str(i)+"'>Download</a></td></tr>"
|
||||||
|
|
||||||
content +="</table>"
|
content +="</table>"
|
||||||
print content
|
|
||||||
self.ui.textEditInboxMessage.setHtml(QtCore.QString(content))
|
self.ui.textEditInboxMessage.setHtml(QtCore.QString(content))
|
||||||
|
|
||||||
|
|
||||||
|
@ -2665,25 +2665,16 @@ class MyForm(QtGui.QMainWindow):
|
||||||
self.ui.textEditInboxMessage.setPlainText(QString(""))
|
self.ui.textEditInboxMessage.setPlainText(QString(""))
|
||||||
self.loadSent(searchOption, searchKeyword)
|
self.loadSent(searchOption, searchKeyword)
|
||||||
|
|
||||||
def tableWidgetInboxItemClicked(self):
|
|
||||||
self.attachArray=[]
|
|
||||||
currentRow = self.ui.tableWidgetInbox.currentRow()
|
|
||||||
attachs=False
|
|
||||||
|
|
||||||
if currentRow >= 0:
|
def findAttach(self, messagee):
|
||||||
fromAddress = str(self.ui.tableWidgetInbox.item(
|
|
||||||
currentRow, 1).data(Qt.UserRole).toPyObject())
|
|
||||||
# If we have received this message from either a broadcast address
|
|
||||||
# or from someone in our address book, display as HTML
|
|
||||||
|
|
||||||
mess=str(self.ui.tableWidgetInbox.item(currentRow, 2).data(Qt.UserRole).toPyObject().toUtf8() )
|
mess_list=messagee.split("\r")
|
||||||
|
|
||||||
mess_list=mess.split("\r")
|
|
||||||
attachHtml=''
|
attachHtml=''
|
||||||
attachArray=[]
|
self.attachArray=[]
|
||||||
licznik=0
|
licznik=0
|
||||||
zal=False
|
zal=False
|
||||||
dane=''
|
dane=''
|
||||||
|
attachs=False
|
||||||
|
|
||||||
for i in range( len(mess_list) ):
|
for i in range( len(mess_list) ):
|
||||||
content=mess_list[i].split(':')
|
content=mess_list[i].split(':')
|
||||||
|
@ -2701,12 +2692,16 @@ class MyForm(QtGui.QMainWindow):
|
||||||
print "encoding : "+value[0]
|
print "encoding : "+value[0]
|
||||||
self.attachArray[licznik-1]['encode']=value[0]
|
self.attachArray[licznik-1]['encode']=value[0]
|
||||||
|
|
||||||
|
|
||||||
if(content[0].find('Content-Disposition')>-1 and zal==True):
|
if(content[0].find('Content-Disposition')>-1 and zal==True):
|
||||||
print "filename : "+value[0]
|
print "filename : "+value[0]
|
||||||
self.attachArray[licznik-1]['filename']=value[1].split('=')[-1]
|
self.attachArray[licznik-1]['filename']=value[1].split('=')[-1]
|
||||||
|
|
||||||
if(mess_list[i]=="\n" and zal == True):
|
print mess_list[i]
|
||||||
|
|
||||||
|
if(mess_list[i]=='\n' and zal == True):
|
||||||
print "jest zal"+str(i)
|
print "jest zal"+str(i)
|
||||||
|
|
||||||
for s in range( i+1,len(mess_list) ):
|
for s in range( i+1,len(mess_list) ):
|
||||||
print "jest spraw"+str(i)
|
print "jest spraw"+str(i)
|
||||||
|
|
||||||
|
@ -2719,7 +2714,26 @@ class MyForm(QtGui.QMainWindow):
|
||||||
zal=False
|
zal=False
|
||||||
break
|
break
|
||||||
|
|
||||||
if(attachs==True):
|
if(attachs):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def tableWidgetInboxItemClicked(self):
|
||||||
|
self.attachArray=[]
|
||||||
|
currentRow = self.ui.tableWidgetInbox.currentRow()
|
||||||
|
|
||||||
|
|
||||||
|
if currentRow >= 0:
|
||||||
|
fromAddress = str(self.ui.tableWidgetInbox.item(
|
||||||
|
currentRow, 1).data(Qt.UserRole).toPyObject())
|
||||||
|
# If we have received this message from either a broadcast address
|
||||||
|
# or from someone in our address book, display as HTML
|
||||||
|
|
||||||
|
mess=str(self.ui.tableWidgetInbox.item(currentRow, 2).data(Qt.UserRole).toPyObject().toUtf8() )
|
||||||
|
|
||||||
|
if(self.findAttach(mess) ):
|
||||||
self.on_action_InboxMessageForceHtml()
|
self.on_action_InboxMessageForceHtml()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -2761,8 +2775,24 @@ class MyForm(QtGui.QMainWindow):
|
||||||
def tableWidgetSentItemClicked(self):
|
def tableWidgetSentItemClicked(self):
|
||||||
currentRow = self.ui.tableWidgetSent.currentRow()
|
currentRow = self.ui.tableWidgetSent.currentRow()
|
||||||
if currentRow >= 0:
|
if currentRow >= 0:
|
||||||
self.ui.textEditSentMessage.setPlainText(self.ui.tableWidgetSent.item(
|
mess=self.ui.tableWidgetSent.item(currentRow, 2).data(Qt.UserRole).toPyObject()
|
||||||
currentRow, 2).data(Qt.UserRole).toPyObject())
|
content=''
|
||||||
|
if(self.findAttach( str(mess) ) ):
|
||||||
|
for i in range(len(self.attachArray) ):
|
||||||
|
if(i==0):
|
||||||
|
content += "<br>".join(self.attachArray[i]['data'])+"<br>"
|
||||||
|
|
||||||
|
content += "<table><tr><th style='color:black'>Attachments</th></tr>"
|
||||||
|
|
||||||
|
content += "<tr><td>"+self.attachArray[i]['filename']+"</td><td><a href='"+str(i)+"'>Download</a></td></tr>"
|
||||||
|
|
||||||
|
content +="</table>"
|
||||||
|
|
||||||
|
self.ui.textEditSentMessage.setHtml(content)
|
||||||
|
|
||||||
|
else:
|
||||||
|
self.ui.textEditSentMessage.setPlainText(mess)
|
||||||
|
|
||||||
|
|
||||||
def tableWidgetYourIdentitiesItemChanged(self):
|
def tableWidgetYourIdentitiesItemChanged(self):
|
||||||
currentRow = self.ui.tableWidgetYourIdentities.currentRow()
|
currentRow = self.ui.tableWidgetYourIdentities.currentRow()
|
||||||
|
|
Reference in New Issue
Block a user