Skip to content

Commit 4a8bcc9

Browse files
committedJan 22, 2015
Make offline editing warnings use message bar and more verbose
1 parent 75b6c32 commit 4a8bcc9

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed
 

‎src/core/qgsofflineediting.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ void QgsOfflineEditing::copyVectorLayer( QgsVectorLayer* layer, sqlite3* db, con
425425
}
426426
else
427427
{
428-
showWarning( tr( "Unknown data type %1" ).arg( type ) );
428+
showWarning( tr( "%1: Unknown data type %2. Not using type affinity for thie field." ).arg( fields[idx].name() ).arg( QVariant::typeToName( type ) ) );
429429
}
430430

431431
sql += delim + QString( "'%1' %2" ).arg( fields[idx].name() ).arg( dataType );
@@ -817,7 +817,7 @@ QMap<int, int> QgsOfflineEditing::attributeLookup( QgsVectorLayer* offlineLayer,
817817

818818
void QgsOfflineEditing::showWarning( const QString& message )
819819
{
820-
QMessageBox::warning( NULL, tr( "Offline Editing Plugin" ), message );
820+
emit warning( tr( "Offline Editing Plugin" ), message );
821821
}
822822

823823
sqlite3* QgsOfflineEditing::openLoggingDb()

‎src/core/qgsofflineediting.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ class CORE_EXPORT QgsOfflineEditing : public QObject
8585
/** emit a signal that processing of all layers has finished */
8686
void progressStopped();
8787

88+
/**
89+
* Emitted when a warning needs to be displayed.
90+
*
91+
* @param message A descriptive message for the warning
92+
*/
93+
void warning( const QString& title, const QString& message );
94+
8895
private:
8996
void initializeSpatialMetadata( sqlite3 *sqlite_handle );
9097
bool createSpatialiteDB( const QString& offlineDbPath );

‎src/plugins/offline_editing/offline_editing_plugin.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <qgisgui.h>
2525
#include <qgsmaplayerregistry.h>
2626
#include <qgsproject.h>
27+
#include <qgsmessagebar.h>
2728

2829
#include <QAction>
2930

@@ -81,6 +82,7 @@ void QgsOfflineEditingPlugin::initGui()
8182
connect( mOfflineEditing, SIGNAL( progressModeSet( QgsOfflineEditing::ProgressMode, int ) ), this, SLOT( setProgressMode( QgsOfflineEditing::ProgressMode, int ) ) );
8283
connect( mOfflineEditing, SIGNAL( progressUpdated( int ) ), this, SLOT( updateProgress( int ) ) );
8384
connect( mOfflineEditing, SIGNAL( progressStopped() ), this, SLOT( hideProgress() ) );
85+
connect( mOfflineEditing, SIGNAL( warning( QString, QString ) ), mQGisIface->messageBar(), SLOT( pushWarning( QString, QString ) ) );
8486

8587
connect( mQGisIface->mainWindow(), SIGNAL( projectRead() ), this, SLOT( updateActions() ) );
8688
connect( mQGisIface->mainWindow(), SIGNAL( newProject() ), this, SLOT( updateActions() ) );
@@ -204,7 +206,6 @@ void QgsOfflineEditingPlugin::hideProgress()
204206
mProgressDialog->hide();
205207
}
206208

207-
208209
/**
209210
* Required extern functions needed for every plugin
210211
* These functions can be called prior to creating an instance

0 commit comments

Comments
 (0)
Please sign in to comment.