commit
c93977cd29
|
@ -90,7 +90,8 @@ class Inbox(Screen):
|
||||||
super(Inbox, self).__init__(*args, **kwargs)
|
super(Inbox, self).__init__(*args, **kwargs)
|
||||||
Clock.schedule_once(self.init_ui, 0)
|
Clock.schedule_once(self.init_ui, 0)
|
||||||
|
|
||||||
def set_defaultAddress(self):
|
@staticmethod
|
||||||
|
def set_defaultAddress():
|
||||||
"""This method set default address"""
|
"""This method set default address"""
|
||||||
if state.association == '':
|
if state.association == '':
|
||||||
if BMConfigParser().addresses():
|
if BMConfigParser().addresses():
|
||||||
|
@ -140,10 +141,18 @@ class Inbox(Screen):
|
||||||
valign='top')
|
valign='top')
|
||||||
self.ids.ml.add_widget(content)
|
self.ids.ml.add_widget(content)
|
||||||
|
|
||||||
|
# pylint: disable=too-many-arguments
|
||||||
def inboxDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
def inboxDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
||||||
"""This method used for retrieving inbox data"""
|
"""This method used for retrieving inbox data"""
|
||||||
self.queryreturn = kivy_helper_search.search_sql(
|
self.queryreturn = kivy_helper_search.search_sql(
|
||||||
xAddress, self.account, "inbox", where, what, False, start_indx, end_indx)
|
xAddress,
|
||||||
|
self.account,
|
||||||
|
"inbox",
|
||||||
|
where,
|
||||||
|
what,
|
||||||
|
False,
|
||||||
|
start_indx,
|
||||||
|
end_indx)
|
||||||
|
|
||||||
def set_mdList(self, data):
|
def set_mdList(self, data):
|
||||||
"""This method is used to create the mdList"""
|
"""This method is used to create the mdList"""
|
||||||
|
@ -402,7 +411,8 @@ class MyAddress(Screen):
|
||||||
# if filter(lambda x: (state.searcing_text).lower() in x, [
|
# if filter(lambda x: (state.searcing_text).lower() in x, [
|
||||||
# BMConfigParser().get(
|
# BMConfigParser().get(
|
||||||
# address, 'label').lower(), address.lower()]):
|
# address, 'label').lower(), address.lower()]):
|
||||||
if [x for x in [BMConfigParser().get(address, 'label').lower(), address.lower()]]:
|
if [x for x in [BMConfigParser().get(
|
||||||
|
address, 'label').lower(), address.lower()]]:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -829,7 +839,8 @@ class Random(Screen):
|
||||||
self.manager.current = 'myaddress'
|
self.manager.current = 'myaddress'
|
||||||
Clock.schedule_once(self.address_created_callback, 6)
|
Clock.schedule_once(self.address_created_callback, 6)
|
||||||
|
|
||||||
def address_created_callback(self, dt=0):
|
@staticmethod
|
||||||
|
def address_created_callback(dt=0):
|
||||||
"""New address created"""
|
"""New address created"""
|
||||||
state.kivyapp.root.ids.sc10.children[1].active = False
|
state.kivyapp.root.ids.sc10.children[1].active = False
|
||||||
state.kivyapp.root.ids.sc10.ids.ml.clear_widgets()
|
state.kivyapp.root.ids.sc10.ids.ml.clear_widgets()
|
||||||
|
@ -915,10 +926,18 @@ class Sent(Screen):
|
||||||
valign='top')
|
valign='top')
|
||||||
self.ids.ml.add_widget(content)
|
self.ids.ml.add_widget(content)
|
||||||
|
|
||||||
|
# pylint: disable=too-many-arguments
|
||||||
def sentDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
def sentDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
||||||
"""This method is used to retrieving data from sent table"""
|
"""This method is used to retrieving data from sent table"""
|
||||||
self.queryreturn = kivy_helper_search.search_sql(
|
self.queryreturn = kivy_helper_search.search_sql(
|
||||||
xAddress, self.account, "sent", where, what, False, start_indx, end_indx)
|
xAddress,
|
||||||
|
self.account,
|
||||||
|
"sent",
|
||||||
|
where,
|
||||||
|
what,
|
||||||
|
False,
|
||||||
|
start_indx,
|
||||||
|
end_indx)
|
||||||
|
|
||||||
def set_mdlist(self, data, set_index=0):
|
def set_mdlist(self, data, set_index=0):
|
||||||
"""This method is used to create the mdList"""
|
"""This method is used to create the mdList"""
|
||||||
|
@ -959,14 +978,13 @@ class Sent(Screen):
|
||||||
|
|
||||||
def update_sent_messagelist(self):
|
def update_sent_messagelist(self):
|
||||||
"""This method is used to update screen when new mail is sent"""
|
"""This method is used to update screen when new mail is sent"""
|
||||||
|
self.account = state.association
|
||||||
if len(self.ids.ml.children) < 3:
|
if len(self.ids.ml.children) < 3:
|
||||||
self.account = state.association
|
|
||||||
self.ids.ml.clear_widgets()
|
self.ids.ml.clear_widgets()
|
||||||
self.loadSent()
|
self.loadSent()
|
||||||
total_sent = int(state.sent_count) + 1
|
total_sent = int(state.sent_count) + 1
|
||||||
self.set_sentCount(total_sent)
|
self.set_sentCount(total_sent)
|
||||||
else:
|
else:
|
||||||
account = state.association
|
|
||||||
data = []
|
data = []
|
||||||
self.sentDataQuery('fromaddress', '', '', 0, 1)
|
self.sentDataQuery('fromaddress', '', '', 0, 1)
|
||||||
total_sent = int(state.sent_count) + 1
|
total_sent = int(state.sent_count) + 1
|
||||||
|
@ -1111,11 +1129,18 @@ class Trash(Screen):
|
||||||
self.ids.ml.add_widget(content)
|
self.ids.ml.add_widget(content)
|
||||||
|
|
||||||
def trashDataQuery(self, start_indx, end_indx):
|
def trashDataQuery(self, start_indx, end_indx):
|
||||||
|
"""Trash message query"""
|
||||||
self.trash_messages = sqlQuery(
|
self.trash_messages = sqlQuery(
|
||||||
"SELECT toaddress, fromaddress, subject, message, folder ||',' || 'sent' as folder, ackdata As id, DATE(lastactiontime)"
|
"SELECT toaddress, fromaddress, subject, message,"
|
||||||
" As actionTime FROM sent WHERE folder = 'trash' and fromaddress = '{0}' UNION"
|
" folder ||',' || 'sent' as folder, ackdata As"
|
||||||
" SELECT toaddress, fromaddress, subject, message, folder ||',' || 'inbox' as folder, msgid As id, DATE(received) As"
|
" id, DATE(lastactiontime) As actionTime FROM sent"
|
||||||
" actionTime FROM inbox WHERE folder = 'trash' and toaddress = '{0}' ORDER BY actionTime DESC limit {1}, {2}".format(state.association, start_indx, end_indx))
|
" WHERE folder = 'trash' and fromaddress = '{0}' UNION"
|
||||||
|
" SELECT toaddress, fromaddress, subject, message,"
|
||||||
|
" folder ||',' || 'inbox' as folder, msgid As id,"
|
||||||
|
" DATE(received) As actionTime FROM inbox"
|
||||||
|
" WHERE folder = 'trash' and toaddress = '{0}'"
|
||||||
|
" ORDER BY actionTime DESC limit {1}, {2}".format(
|
||||||
|
state.association, start_indx, end_indx))
|
||||||
|
|
||||||
def set_mdList(self):
|
def set_mdList(self):
|
||||||
"""This method is used to create the mdlist"""
|
"""This method is used to create the mdlist"""
|
||||||
|
@ -1148,7 +1173,7 @@ class Trash(Screen):
|
||||||
carousel.index = 1
|
carousel.index = 1
|
||||||
self.ids.ml.add_widget(carousel)
|
self.ids.ml.add_widget(carousel)
|
||||||
self.has_refreshed = True if total_trash_msg != len(
|
self.has_refreshed = True if total_trash_msg != len(
|
||||||
self.ids.ml.children) else False
|
self.ids.ml.children) else False
|
||||||
|
|
||||||
def check_scroll_y(self, instance, somethingelse):
|
def check_scroll_y(self, instance, somethingelse):
|
||||||
"""Load data on scroll"""
|
"""Load data on scroll"""
|
||||||
|
@ -1220,6 +1245,7 @@ class Page(Screen):
|
||||||
|
|
||||||
class Create(Screen):
|
class Create(Screen):
|
||||||
"""Creates the screen widgets"""
|
"""Creates the screen widgets"""
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
"""Getting Labels and address from addressbook"""
|
"""Getting Labels and address from addressbook"""
|
||||||
super(Create, self).__init__(**kwargs)
|
super(Create, self).__init__(**kwargs)
|
||||||
|
@ -1514,23 +1540,28 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
|
||||||
state.detailPageType = ''
|
state.detailPageType = ''
|
||||||
state.in_composer = False
|
state.in_composer = False
|
||||||
|
|
||||||
def get_inbox_count(self):
|
@staticmethod
|
||||||
|
def get_inbox_count():
|
||||||
|
"""Getting inbox count"""
|
||||||
state.inbox_count = str(
|
state.inbox_count = str(
|
||||||
sqlQuery(
|
sqlQuery(
|
||||||
"SELECT COUNT(*) FROM inbox WHERE toaddress = '{}' and"
|
"SELECT COUNT(*) FROM inbox WHERE toaddress = '{}' and"
|
||||||
" folder = 'inbox' ;".format(state.association))[0][0])
|
" folder = 'inbox' ;".format(state.association))[0][0])
|
||||||
|
|
||||||
def get_sent_count(self):
|
@staticmethod
|
||||||
|
def get_sent_count():
|
||||||
|
"""Getting sent count"""
|
||||||
state.sent_count = str(
|
state.sent_count = str(
|
||||||
sqlQuery(
|
sqlQuery(
|
||||||
"SELECT COUNT(*) FROM sent WHERE fromaddress = '{}' and"
|
"SELECT COUNT(*) FROM sent WHERE fromaddress = '{}' and"
|
||||||
" folder = 'sent' ;".format(state.association))[0][0])
|
" folder = 'sent' ;".format(state.association))[0][0])
|
||||||
|
|
||||||
def set_message_count(self):
|
def set_message_count(self):
|
||||||
|
"""Setting message count"""
|
||||||
try:
|
try:
|
||||||
msg_counter_objs = (
|
msg_counter_objs = (
|
||||||
self.root_window.children[0].children[2].children[0].ids)
|
self.root_window.children[0].children[2].children[0].ids)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
msg_counter_objs = (
|
msg_counter_objs = (
|
||||||
self.root_window.children[2].children[2].children[0].ids)
|
self.root_window.children[2].children[2].children[0].ids)
|
||||||
self.get_inbox_count()
|
self.get_inbox_count()
|
||||||
|
@ -2121,10 +2152,18 @@ class Draft(Screen):
|
||||||
valign='top')
|
valign='top')
|
||||||
self.ids.ml.add_widget(content)
|
self.ids.ml.add_widget(content)
|
||||||
|
|
||||||
|
# pylint: disable=too-many-arguments
|
||||||
def draftDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
def draftDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
||||||
"""This methosd is for retrieving draft messages"""
|
"""This methosd is for retrieving draft messages"""
|
||||||
self.queryreturn = kivy_helper_search.search_sql(
|
self.queryreturn = kivy_helper_search.search_sql(
|
||||||
xAddress, self.account, "draft", where, what, False, start_indx, end_indx)
|
xAddress,
|
||||||
|
self.account,
|
||||||
|
"draft",
|
||||||
|
where,
|
||||||
|
what,
|
||||||
|
False,
|
||||||
|
start_indx,
|
||||||
|
end_indx)
|
||||||
|
|
||||||
def set_mdList(self):
|
def set_mdList(self):
|
||||||
"""This method is used to create mdlist"""
|
"""This method is used to create mdlist"""
|
||||||
|
@ -2296,7 +2335,8 @@ class Allmails(Screen):
|
||||||
if self.all_mails:
|
if self.all_mails:
|
||||||
state.kivyapp.get_inbox_count()
|
state.kivyapp.get_inbox_count()
|
||||||
state.kivyapp.get_sent_count()
|
state.kivyapp.get_sent_count()
|
||||||
state.all_count = str(int(state.sent_count) + int(state.inbox_count))
|
state.all_count = str(
|
||||||
|
int(state.sent_count) + int(state.inbox_count))
|
||||||
state.kivyapp.root.children[2].children[
|
state.kivyapp.root.children[2].children[
|
||||||
0].ids.allmail_cnt.badge_text = state.all_count
|
0].ids.allmail_cnt.badge_text = state.all_count
|
||||||
self.set_mdlist()
|
self.set_mdlist()
|
||||||
|
@ -2313,13 +2353,16 @@ class Allmails(Screen):
|
||||||
self.ids.ml.add_widget(content)
|
self.ids.ml.add_widget(content)
|
||||||
|
|
||||||
def allMessageQuery(self, start_indx, end_indx):
|
def allMessageQuery(self, start_indx, end_indx):
|
||||||
"""This method is used for retrieving data from inbox or sent both tables"""
|
"""Retrieving data from inbox or sent both tables"""
|
||||||
self.all_mails = sqlQuery(
|
self.all_mails = sqlQuery(
|
||||||
"SELECT toaddress, fromaddress, subject, message, folder, ackdata"
|
"SELECT toaddress, fromaddress, subject, message, folder, ackdata"
|
||||||
" As id, DATE(lastactiontime) As actionTime FROM sent WHERE"
|
" As id, DATE(lastactiontime) As actionTime FROM sent WHERE"
|
||||||
" folder = 'sent' and fromaddress = '{0}' UNION SELECT toaddress, fromaddress, subject,"
|
" folder = 'sent' and fromaddress = '{0}'"
|
||||||
" message, folder, msgid As id, DATE(received) As actionTime"
|
" UNION SELECT toaddress, fromaddress, subject, message, folder,"
|
||||||
" FROM inbox WHERE folder = 'inbox' and toaddress = '{0}' ORDER BY actionTime DESC limit {1}, {2}".format(self.account, start_indx, end_indx))
|
" msgid As id, DATE(received) As actionTime FROM inbox"
|
||||||
|
" WHERE folder = 'inbox' and toaddress = '{0}'"
|
||||||
|
" ORDER BY actionTime DESC limit {1}, {2}".format(
|
||||||
|
self.account, start_indx, end_indx))
|
||||||
|
|
||||||
def set_mdlist(self):
|
def set_mdlist(self):
|
||||||
"""This method is used to create mdList for allmaills"""
|
"""This method is used to create mdList for allmaills"""
|
||||||
|
|
Reference in New Issue
Block a user