Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
mobile Datovka
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Packages
Packages
Container Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Datovka projects
mobile Datovka
Commits
5c2331af
Commit
5c2331af
authored
Mar 13, 2017
by
Karel Slaný
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stub for opening ZFO files from command line.
parent
97a42643
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
137 additions
and
18 deletions
+137
-18
mobile-datovka.pro
mobile-datovka.pro
+2
-0
qml/pages/PageZfoMessageDetail.qml
qml/pages/PageZfoMessageDetail.qml
+3
-1
src/files.h
src/files.h
+5
-4
src/main.cpp
src/main.cpp
+8
-4
src/os_android.cpp
src/os_android.cpp
+6
-5
src/os_android.h
src/os_android.h
+4
-4
src/qml_interaction/interaction_zfo_file.cpp
src/qml_interaction/interaction_zfo_file.cpp
+51
-0
src/qml_interaction/interaction_zfo_file.h
src/qml_interaction/interaction_zfo_file.h
+58
-0
No files found.
mobile-datovka.pro
View file @
5c2331af
...
...
@@ -94,6 +94,7 @@ SOURCES += \
src/models/accountmodel.cpp \
src/models/filemodel.cpp \
src/models/messagemodel.cpp \
src/qml_interaction/interaction_zfo_file.cpp \
src/settings.cpp \
src/sqlite/account_db.cpp \
src/sqlite/dbs.cpp \
...
...
@@ -123,6 +124,7 @@ HEADERS += \
src/models/accountmodel.h \
src/models/filemodel.h \
src/models/messagemodel.h \
src/qml_interaction/interaction_zfo_file.h \
src/settings.h \
src/sqlite/account_db.h \
src/sqlite/dbs.h \
...
...
qml/pages/PageZfoMessageDetail.qml
View file @
5c2331af
...
...
@@ -61,7 +61,9 @@ Component {
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
statusBar
.
visible
=
false
if
(
typeof
(
statusBar
)
!=
"
undefined
"
)
{
statusBar
.
visible
=
false
}
files
.
clearFileModelZfo
()
pageView
.
pop
(
StackView
.
Immediate
)
}
...
...
src/files.h
View file @
5c2331af
...
...
@@ -118,11 +118,12 @@ public:
bool
deleteAttachmentsFromDb
(
const
QString
&
userName
,
qint64
msgId
);
/*!
* @brief Open ZFO file from path.
*
* @param[in] filePath File path with file name.
* @return true if success.
* @brief Open ZFO file from path.
*
* @param[in] filePath File path with file name.
* @return true if success.
*/
Q_INVOKABLE
bool
openZfoFileFromStorage
(
const
QString
&
filePath
);
class
File
{
...
...
src/main.cpp
View file @
5c2331af
...
...
@@ -41,6 +41,7 @@
#if defined(Q_OS_ANDROID)
#include "src/os_android.h"
#endif
/* defined(Q_OS_ANDROID) */
#include "src/qml_interaction/interaction_zfo_file.h"
#include "src/settings.h"
#include "src/sqlite/db_tables.h"
#include "src/sqlite/account_db.h"
...
...
@@ -244,6 +245,8 @@ int main(int argc, char *argv[])
/* Register types into QML. */
Messages
::
declareQML
();
InteractionZfoFile
interactionZfoFile
;
/* register classes in QML */
ctx
->
setContextProperty
(
"isds"
,
&
isds
);
ctx
->
setContextProperty
(
"messages"
,
&
messages
);
...
...
@@ -251,6 +254,7 @@ int main(int argc, char *argv[])
ctx
->
setContextProperty
(
"files"
,
&
files
);
ctx
->
setContextProperty
(
"settings"
,
&
settings
);
ctx
->
setContextProperty
(
"locker"
,
&
locker
);
ctx
->
setContextProperty
(
"interactionZfoFile"
,
&
interactionZfoFile
);
/* register and set models in QML */
ctx
->
setContextProperty
(
globAccountsModelPtr
->
objectName
(),
...
...
@@ -349,12 +353,12 @@ int main(int argc, char *argv[])
* TODO -- Modify the app to display the content.
*/
if
(
!
cmdLineFileNames
.
isEmpty
())
{
emit
isds
.
showErrorMessageBox
(
QObject
::
tr
(
"Requested opening ZFO"
),
"These files should be opened:"
,
cmdLineFileNames
.
join
(
", "
),
false
);
foreach
(
const
QString
&
filePath
,
cmdLineFileNames
)
{
interactionZfoFile
.
openZfoFile
(
filePath
);
}
}
#if defined(Q_OS_ANDROID)
IntentNotification
intentNotification
(
i
sds
);
IntentNotification
intentNotification
(
i
nteractionZfoFile
);
QObject
::
connect
(
&
app
,
SIGNAL
(
applicationStateChanged
(
Qt
::
ApplicationState
)),
&
intentNotification
,
SLOT
(
scanIntentsForFiles
(
Qt
::
ApplicationState
)));
#endif
/* defined(Q_OS_ANDROID) */
...
...
src/os_android.cpp
View file @
5c2331af
...
...
@@ -26,9 +26,10 @@
#include "src/os_android.h"
IntentNotification
::
IntentNotification
(
IsdsWrapper
&
iw
,
QObject
*
parent
)
IntentNotification
::
IntentNotification
(
InteractionZfoFile
&
inter
,
QObject
*
parent
)
:
QObject
(
parent
),
m_i
w
(
iw
)
m_i
nter
(
inter
)
{
}
...
...
@@ -74,7 +75,7 @@ void IntentNotification::scanIntentsForFiles(Qt::ApplicationState newState)
return
;
}
emit
m_iw
.
showErrorMessageBox
(
QObject
::
tr
(
"Requested opening ZFO"
),
"These files should be opened from IntentNotification:"
,
fileList
.
join
(
", "
),
false
);
foreach
(
const
QString
&
filePath
,
fileList
)
{
m_inter
.
openZfoFile
(
filePath
);
}
}
src/os_android.h
View file @
5c2331af
...
...
@@ -26,7 +26,7 @@
#include <QObject>
#include "src/
net/isds_wrapper.h"
/* Experimental use, generates error dialogue. */
#include "src/
qml_interaction/interaction_zfo_file.h"
/*!
* @brief Wraps Android intent retrieval.
...
...
@@ -45,10 +45,10 @@ public:
/*!
* @brief Constructor.
*
* @param[in] i
w Isds
object.
* @param[in] i
nter ZFO file interaction
object.
* @param[in] parent Parent object.
*/
explicit
IntentNotification
(
I
sdsWrapper
&
iw
,
explicit
IntentNotification
(
I
nteractionZfoFile
&
inter
,
QObject
*
parent
=
Q_NULLPTR
);
/*!
...
...
@@ -68,7 +68,7 @@ public slots:
void
scanIntentsForFiles
(
Qt
::
ApplicationState
newState
);
private:
I
sdsWrapper
&
m_iw
;
/*!< ISDS wrapper
object. */
I
nteractionZfoFile
&
m_inter
;
/*!< QML interaction
object. */
};
#endif
/* _OS_ANDROID_H_ */
src/qml_interaction/interaction_zfo_file.cpp
0 → 100644
View file @
5c2331af
/*
* Copyright (C) 2014-2017 CZ.NIC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations including
* the two.
*/
#include <QFileInfo>
#include "src/qml_interaction/interaction_zfo_file.h"
InteractionZfoFile
::
InteractionZfoFile
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
bool
InteractionZfoFile
::
openZfoFile
(
const
QString
&
filePath
)
{
if
(
filePath
.
isEmpty
())
{
return
false
;
}
{
QFileInfo
fileInfo
(
filePath
);
if
(
!
fileInfo
.
isFile
()
||
!
fileInfo
.
isReadable
())
{
return
false
;
}
}
/* TODO */
emit
displayZfoFileContent
(
filePath
);
return
true
;
}
src/qml_interaction/interaction_zfo_file.h
0 → 100644
View file @
5c2331af
/*
* Copyright (C) 2014-2017 CZ.NIC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations including
* the two.
*/
#include <QObject>
/*!
* @brief Class encapsulates interaction with QML related to ZFO files.
*/
class
InteractionZfoFile
:
public
QObject
{
Q_OBJECT
public:
/*!
* @brief Constructor.
*
* @Param[in] parent Patent object.
*/
InteractionZfoFile
(
QObject
*
parent
=
Q_NULLPTR
);
/*!
* @brief Check ZFO file, prepares model and causes QML to display.
*
* @note Emits displayZfoFileContent().
*
* @param[in] filePath Path to ZFO file.
* @return False when an error occurs, true else.
*/
bool
openZfoFile
(
const
QString
&
filePath
);
signals:
/*!
* @brief This signal is emitted whenever a message from a ZFO file
* should be emitted.
*
* @param[in] filePath Path to ZFO file.
*/
void
displayZfoFileContent
(
QString
filePath
);
};
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