Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Datovka projects
mobile Datovka
Commits
814f9df2
Commit
814f9df2
authored
May 11, 2017
by
Karel Slaný
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved setLastUpdateToNow() to GlobalSettingsQmlWrapper.
parent
a55ccb8f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
49 additions
and
19 deletions
+49
-19
qml/pages/PageAccountList.qml
qml/pages/PageAccountList.qml
+9
-3
qml/pages/PageMessageList.qml
qml/pages/PageMessageList.qml
+4
-1
src/net/isds_wrapper.cpp
src/net/isds_wrapper.cpp
+13
-9
src/net/isds_wrapper.h
src/net/isds_wrapper.h
+5
-2
src/settings.cpp
src/settings.cpp
+2
-2
src/settings.h
src/settings.h
+5
-2
src/setwrapper.cpp
src/setwrapper.cpp
+5
-0
src/setwrapper.h
src/setwrapper.h
+6
-0
No files found.
qml/pages/PageAccountList.qml
View file @
814f9df2
...
...
@@ -92,8 +92,11 @@ Component {
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
statusBarText
.
text
=
""
isds
.
syncAllAccounts
(
accountListModel
)
statusBarText
.
text
=
""
if
(
isds
.
syncAllAccounts
(
accountListModel
))
{
settings
.
setLastUpdateToNow
()
settings
.
saveAllSettings
()
}
}
}
}
...
...
@@ -240,7 +243,10 @@ Component {
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
isds
.
syncOneAccount
(
accountListModel
,
rUserName
)
if
(
isds
.
syncOneAccount
(
accountListModel
,
rUserName
))
{
settings
.
setLastUpdateToNow
()
settings
.
saveAllSettings
()
}
}
}
}
...
...
qml/pages/PageMessageList.qml
View file @
814f9df2
...
...
@@ -203,7 +203,10 @@ Component {
if
(
downloadStart
)
{
downloadStart
=
false
if
(
msgType
==
MessageType
.
TYPE_RECEIVED
)
{
isds
.
syncSingleAccountReceived
(
accountListModel
,
messageModel
,
userName
)
if
(
isds
.
syncSingleAccountReceived
(
accountListModel
,
messageModel
,
userName
))
{
settings
.
setLastUpdateToNow
()
settings
.
saveAllSettings
()
}
}
else
if
(
msgType
==
MessageType
.
TYPE_SENT
)
{
isds
.
syncSingleAccountSent
(
accountListModel
,
messageModel
,
userName
)
}
...
...
src/net/isds_wrapper.cpp
View file @
814f9df2
...
...
@@ -39,25 +39,34 @@ IsdsWrapper::~IsdsWrapper(void)
{
}
void
IsdsWrapper
::
syncAllAccounts
(
const
QVariant
&
acntModelVariant
)
bool
IsdsWrapper
::
syncAllAccounts
(
const
QVariant
&
acntModelVariant
)
{
qDebug
(
"%s()"
,
__func__
);
bool
ret
=
false
;
QList
<
QString
>
userNameList
=
AccountListModel
::
globAccounts
.
keys
();
foreach
(
const
QString
userName
,
userNameList
)
{
syncOneAccount
(
acntModelVariant
,
userName
);
if
(
syncOneAccount
(
acntModelVariant
,
userName
))
{
ret
=
true
;
}
}
return
ret
;
}
void
IsdsWrapper
::
syncOneAccount
(
const
QVariant
&
acntModelVariant
,
bool
IsdsWrapper
::
syncOneAccount
(
const
QVariant
&
acntModelVariant
,
const
QString
&
userName
)
{
qDebug
(
"%s()"
,
__func__
);
if
(
syncSingleAccountSent
(
acntModelVariant
,
QVariant
(),
userName
))
{
/* Download received only when sent successfully downloaded. */
syncSingleAccountReceived
(
acntModelVariant
,
QVariant
(),
userName
);
return
syncSingleAccountReceived
(
acntModelVariant
,
QVariant
(),
userName
);
}
return
false
;
}
bool
IsdsWrapper
::
syncSingleAccountReceived
(
const
QVariant
&
acntModelVariant
,
...
...
@@ -94,9 +103,6 @@ bool IsdsWrapper::syncSingleAccountReceived(const QVariant &acntModelVariant,
false
,
true
);
}
globSet
.
setLastUpdateToNow
();
GlobalSettingsQmlWrapper
::
saveAllSettings
();
if
(
globSet
.
downloadCompleteMsgs
)
{
MessageListModel
*
messageModel
=
MessageListModel
::
fromVariant
(
msgModelVariant
);
...
...
@@ -162,8 +168,6 @@ bool IsdsWrapper::syncSingleAccountSent(const QVariant &acntModelVariant,
false
,
true
);
}
/* Don't store last update time when downloading sent messages. */
if
(
globSet
.
downloadCompleteMsgs
)
{
MessageListModel
*
messageModel
=
MessageListModel
::
fromVariant
(
msgModelVariant
);
...
...
src/net/isds_wrapper.h
View file @
814f9df2
...
...
@@ -47,9 +47,11 @@ public:
*
* @param[in,out] acntModelVariant QVariant holding account model
* to be altered.
* @return True if at least one account has been successfully
* synchronised.
*/
Q_INVOKABLE
void
syncAllAccounts
(
const
QVariant
&
acntModelVariant
);
bool
syncAllAccounts
(
const
QVariant
&
acntModelVariant
);
/*!
* @brief Download message list of one account.
...
...
@@ -57,9 +59,10 @@ public:
* @param[in,out] acntModelVariant QVariant holding account model
* to be altered.
* @param[in] userName Account username string.
* @return True on success.
*/
Q_INVOKABLE
void
syncOneAccount
(
const
QVariant
&
acntModelVariant
,
bool
syncOneAccount
(
const
QVariant
&
acntModelVariant
,
const
QString
&
userName
);
/*!
...
...
src/settings.cpp
View file @
814f9df2
...
...
@@ -170,9 +170,9 @@ void Settings::setLastUpdate(const QString &str)
}
}
void
Settings
::
setLastUpdateToNow
(
void
)
QString
Settings
::
nowStr
(
void
)
{
m_lastUpdate
=
QDateTime
::
currentDateTime
().
toString
(
Qt
::
ISODate
);
return
QDateTime
::
currentDateTime
().
toString
(
Qt
::
ISODate
);
}
QString
Settings
::
lastUpdateStr
(
void
)
const
...
...
src/settings.h
View file @
814f9df2
...
...
@@ -95,9 +95,12 @@ public:
void
setLastUpdate
(
const
QString
&
str
);
/*!
* @brief Set last update time to current time.
* @brief Return current time as a string.
*
* @return Current time as stored by this structure.
*/
void
setLastUpdateToNow
(
void
);
static
QString
nowStr
(
void
);
/*!
* @brief Returns last update time string.
...
...
src/setwrapper.cpp
View file @
814f9df2
...
...
@@ -291,6 +291,11 @@ void GlobalSettingsQmlWrapper::setInactivityInterval(int secs)
globSet
.
pinInactTimeoutInSecs
=
(
secs
>
0
)
?
secs
:
0
;
}
void
GlobalSettingsQmlWrapper
::
setLastUpdateToNow
(
void
)
{
globSet
.
setLastUpdate
(
Settings
::
nowStr
());
}
void
GlobalSettingsQmlWrapper
::
saveAllSettings
(
void
)
{
QSettings
settings
(
Settings
::
settingsPath
(),
QSettings
::
IniFormat
);
...
...
src/setwrapper.h
View file @
814f9df2
...
...
@@ -154,6 +154,12 @@ public:
Q_INVOKABLE
void
setInactivityInterval
(
int
secs
);
/*!
* @brief Set last update time to current time.
*/
Q_INVOKABLE
static
void
setLastUpdateToNow
(
void
);
/*!
* @brief Gathers all settings and stores them into configuration file.
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment