Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
mobile Datovka
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
14
Issues
14
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Datovka projects
mobile Datovka
Commits
b9873a89
Commit
b9873a89
authored
Nov 15, 2018
by
Karel Slaný
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed some function from the Accounts interface.
parent
ccfa3c7c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
76 deletions
+72
-76
src/accounts.cpp
src/accounts.cpp
+70
-48
src/accounts.h
src/accounts.h
+2
-28
No files found.
src/accounts.cpp
View file @
b9873a89
...
...
@@ -470,6 +470,76 @@ bool boxMatchesUser(const QString &dbId, const QString &username)
return
dbId
==
GlobInstcs
::
accountDbPtr
->
dbId
(
username
);
}
/*!
* @brief Change file database name to new username.
*
* @param[in] oldUserName Original user name of account.
* @param[in] newUserName New user name identifying account.
* @param[in] storeToDisk True if database store to local storage.
* @param[out] errTxt Error description.
* @return True on success.
*/
static
bool
changeFileDbName
(
const
QString
&
oldUserName
,
const
QString
&
newUserName
,
bool
storeToDisk
,
QString
&
errTxt
)
{
debugFuncCall
();
FileDb
*
fDb
=
GlobInstcs
::
fileDbsPtr
->
accessFileDb
(
GlobInstcs
::
setPtr
->
dbsLocation
,
oldUserName
,
storeToDisk
);
if
(
Q_UNLIKELY
(
fDb
==
Q_NULLPTR
))
{
errTxt
=
Accounts
::
tr
(
"Cannot access file database for the user name '%1'."
)
.
arg
(
oldUserName
);
return
false
;
}
/* Rename file database */
QString
currentDbFileName
=
fDb
->
fileName
();
currentDbFileName
.
replace
(
oldUserName
,
newUserName
);
if
(
!
fDb
->
moveDb
(
currentDbFileName
))
{
errTxt
=
Accounts
::
tr
(
"Cannot change file database on the user name '%1'."
)
.
arg
(
newUserName
);
return
false
;
}
return
true
;
}
/*!
* @brief Change message database name to new user name.
*
* @param[in] oldUserName Original user name of account.
* @param[in] newUserName New user name identifying account.
* @param[in] storeToDisk True if database store to local storage.
* @param[out] errTxt Error description.
* @return True if success.
*/
static
bool
changeMessageDbName
(
const
QString
&
oldUserName
,
const
QString
&
newUserName
,
bool
storeToDisk
,
QString
&
errTxt
)
{
debugFuncCall
();
MessageDb
*
msgDb
=
GlobInstcs
::
messageDbsPtr
->
accessMessageDb
(
GlobInstcs
::
setPtr
->
dbsLocation
,
oldUserName
,
storeToDisk
);
if
(
Q_UNLIKELY
(
msgDb
==
Q_NULLPTR
))
{
errTxt
=
Accounts
::
tr
(
"Cannot access message database for user name '%1'."
)
.
arg
(
oldUserName
);
return
false
;
}
/* Rename message database */
QString
currentDbFileName
=
msgDb
->
fileName
();
currentDbFileName
.
replace
(
oldUserName
,
newUserName
);
if
(
!
msgDb
->
moveDb
(
currentDbFileName
))
{
errTxt
=
Accounts
::
tr
(
"Cannot change message database on the user name '%1'."
)
.
arg
(
newUserName
);
return
false
;
}
return
true
;
}
bool
Accounts
::
changeAccountUserName
(
const
QVariant
&
acntModelVariant
,
const
QString
&
acntName
,
const
QString
&
newUserName
,
bool
storeToDisk
,
const
QString
&
oldUserName
,
const
QString
&
newDbId
)
...
...
@@ -564,54 +634,6 @@ exit:
return
false
;
}
bool
Accounts
::
changeFileDbName
(
const
QString
&
oldUserName
,
const
QString
&
newUserName
,
bool
storeToDisk
,
QString
&
errTxt
)
{
debugFuncCall
();
FileDb
*
fDb
=
GlobInstcs
::
fileDbsPtr
->
accessFileDb
(
GlobInstcs
::
setPtr
->
dbsLocation
,
oldUserName
,
storeToDisk
);
if
(
Q_UNLIKELY
(
fDb
==
Q_NULLPTR
))
{
errTxt
=
tr
(
"Cannot access file database for the user name '%1'."
).
arg
(
oldUserName
);
return
false
;
}
/* Rename file database */
QString
currentDbFileName
=
fDb
->
fileName
();
currentDbFileName
.
replace
(
oldUserName
,
newUserName
);
if
(
!
fDb
->
moveDb
(
currentDbFileName
))
{
errTxt
=
tr
(
"Cannot change file database on the user name '%1'."
).
arg
(
newUserName
);
return
false
;
}
return
true
;
}
bool
Accounts
::
changeMessageDbName
(
const
QString
&
oldUserName
,
const
QString
&
newUserName
,
bool
storeToDisk
,
QString
&
errTxt
)
{
debugFuncCall
();
MessageDb
*
msgDb
=
GlobInstcs
::
messageDbsPtr
->
accessMessageDb
(
GlobInstcs
::
setPtr
->
dbsLocation
,
oldUserName
,
storeToDisk
);
if
(
Q_UNLIKELY
(
msgDb
==
Q_NULLPTR
))
{
errTxt
=
tr
(
"Cannot access message database for user name '%1'."
)
.
arg
(
oldUserName
);
return
false
;
}
/* Rename message database */
QString
currentDbFileName
=
msgDb
->
fileName
();
currentDbFileName
.
replace
(
oldUserName
,
newUserName
);
if
(
!
msgDb
->
moveDb
(
currentDbFileName
))
{
errTxt
=
tr
(
"Cannot change message database on the user name '%1'."
)
.
arg
(
newUserName
);
return
false
;
}
return
true
;
}
void
Accounts
::
deleteAccountFromModel
(
AccountListModel
*
accountModel
,
const
QString
&
userName
)
{
...
...
src/accounts.h
View file @
b9873a89
...
...
@@ -157,7 +157,7 @@ public:
* @param[in] acntName Account name.
* @param[in] newUserName New user name identifying account.
* @param[in] pwd Password.
* @param[in] isTestAccount True if account is
isds test enveiro
ment.
* @param[in] isTestAccount True if account is
ISDS test environ
ment.
* @param[in] rememberPwd True if remember password.
* @param[in] storeToDisk True if database store to local storage.
* @param[in] certPath Certificate path (can be null).
...
...
@@ -195,7 +195,7 @@ signals:
* @param[in] userName User name identifying account.
* @param[in] loginMetod User name identifying account.
* @param[in] pwd Password.
* @param[in] isTestAccount True if account is
isds test enveiro
ment.
* @param[in] isTestAccount True if account is
ISDS test environ
ment.
* @param[in] rememberPwd True if remember password.
* @param[in] storeToDisk True if database store to local storage.
* @param[in] certPath Certificate path (can be null).
...
...
@@ -212,32 +212,6 @@ signals:
void
removeIsdsCtx
(
QString
userName
);
private:
/*!
* @brief Change file database name to new username.
*
* @param[in] oldUserName Original user name of account.
* @param[in] newUserName New user name identifying account.
* @param[in] storeToDisk True if database store to local storage.
* @param[out] errTxt Error description.
* @return True on success.
*/
static
bool
changeFileDbName
(
const
QString
&
oldUserName
,
const
QString
&
newUserName
,
bool
storeToDisk
,
QString
&
errTxt
);
/*!
* @brief Change message database name to new user name.
*
* @param[in] oldUserName Original user name of account.
* @param[in] newUserName New user name identifying account.
* @param[in] storeToDisk True if database store to local storage.
* @param[out] errTxt Error description.
* @return True if success.
*/
static
bool
changeMessageDbName
(
const
QString
&
oldUserName
,
const
QString
&
newUserName
,
bool
storeToDisk
,
QString
&
errTxt
);
/*!
* @brief Delete account from model.
*
...
...
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