Commit 5f6f2142 authored by Karel Slaný's avatar Karel Slaný

Scan for Android intents only on start and when state changes to active.

parent 75862772
......@@ -355,8 +355,8 @@ int main(int argc, char *argv[])
}
#if defined(Q_OS_ANDROID)
IntentNotification intentNotification(isds);
connect(&app, SIGNAL(applicationStateChanged(Qt::ApplicationState)),
&intentNotification, SLOT(scanIntentsForFiles()));
QObject::connect(&app, SIGNAL(applicationStateChanged(Qt::ApplicationState)),
&intentNotification, SLOT(scanIntentsForFiles(Qt::ApplicationState)));
#endif /* defined(Q_OS_ANDROID) */
/* Run app main event loop */
......
......@@ -24,9 +24,11 @@
#include <QAndroidJniObject>
#include <QtAndroidExtras>
IntentNotification::IntentNotification(QObject *parent)
#include "src/os_android.h"
IntentNotification::IntentNotification(IsdsWrapper &iw, QObject *parent)
: QObject(parent),
m_iw(IsdsWrapper &iw)
m_iw(iw)
{
}
......@@ -59,15 +61,20 @@ QStringList IntentNotification::getIntentArguments(void)
return QStringList(path.toString());
}
void IntentNotification::scanIntentsForFiles(void)
void IntentNotification::scanIntentsForFiles(Qt::ApplicationState newState)
{
/* Run only when application is newly activated. */
if (newState != Qt::ApplicationActive) {
return;
}
QStringList fileList(getIntentArguments());
if (fileList.isEmpty()) {
return;
}
emit isds.showErrorMessageBox(QObject::tr("Requested opening ZFO"),
emit m_iw.showErrorMessageBox(QObject::tr("Requested opening ZFO"),
"These files should be opened from IntentNotification:",
cmdLineFileNames.join(", "), false);
fileList.join(", "), false);
}
......@@ -62,8 +62,10 @@ public:
public slots:
/*!
* @brief Scans intent and process the obtained files.
*
* @param[in] newState New application state.
*/
void scanIntentsForFiles(void);
void scanIntentsForFiles(Qt::ApplicationState newState);
private:
IsdsWrapper &m_iw; /*!< ISDS wrapper object. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment