Skip to content
Permalink
Browse files

added confirm quit for android

  • Loading branch information
mbernasocchi committed Sep 8, 2013
1 parent d1ec3f4 commit e87f79d480d0c14679c9ae7ae032a27bc489b676
Showing with 33 additions and 0 deletions.
  1. +28 −0 src/app/qgisapp.cpp
  2. +5 −0 src/app/qgisapp.h
@@ -738,6 +738,10 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
// should come after fileNewBlank to ensure project is properly set up to receive any data source files
QgsApplication::setFileOpenEventReceiver( this );

#ifdef ANDROID
toggleFullScreen();
#endif

} // QgisApp ctor

QgisApp::QgisApp( )
@@ -8851,6 +8855,30 @@ bool QgisApp::addRasterLayers( QStringList const &theFileNameQStringList, bool g
//
///////////////////////////////////////////////////////////////////

#ifdef ANDROID
void QgisApp::keyReleaseEvent(QKeyEvent *event)
{
static bool accepted=true;
if (event->key()==Qt::Key_Close)
{
// do something useful here
int ret = QMessageBox::question(this, tr("Exit QGIS"),
tr("Do you really want to quit QGIS?"),
QMessageBox::Yes | QMessageBox::No);
switch(ret)
{
case QMessageBox::Yes:
this->close();
break;

case QMessageBox::No:
break;
}
event->setAccepted(accepted); // dont't close my Top Level Widget !
accepted=false;// close the app next time when the user press back button
}
}
#endif

void QgisApp::keyPressEvent( QKeyEvent * e )
{
@@ -622,6 +622,11 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
//! reimplements widget keyPress event so we can check if cancel was pressed
virtual void keyPressEvent( QKeyEvent * event );

#ifdef ANDROID
//! reimplements widget keyReleaseEvent event so we can check if back was pressed
virtual void keyReleaseEvent( QKeyEvent * event );
#endif

#ifdef Q_OS_WIN
//! reimplements context menu event
virtual void contextMenuEvent( QContextMenuEvent *event );

0 comments on commit e87f79d

Please sign in to comment.
You can’t perform that action at this time.