summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <[email protected]>2016-04-02 08:38:02 +0200
committerDennis Nienhüser <[email protected]>2016-04-02 08:38:02 +0200
commitbb514f5917a513135d4f40d268b9c2c539aa8c85 (patch)
treee2496789bd95cbe39f6e19132e4d787bc36a85db
parent0724cf1b0cbc7b48d4b866b949b258940d782f63 (diff)
Revert "Do not open kwallet dialog on startup."
This reverts commit 0724cf1b0cbc7b48d4b866b949b258940d782f63. Reverting as it contains changes to openstreetmap.dgml that are supposed to be their own commit.
-rw-r--r--data/maps/earth/openstreetmap/openstreetmap.dgml18
-rw-r--r--src/apps/marble-kde/CMakeLists.txt4
-rw-r--r--src/apps/marble-kde/marble.kcfg3
-rw-r--r--src/apps/marble-kde/marble_part.cpp65
-rw-r--r--src/apps/marble-kde/marble_part.h3
5 files changed, 74 insertions, 19 deletions
diff --git a/data/maps/earth/openstreetmap/openstreetmap.dgml b/data/maps/earth/openstreetmap/openstreetmap.dgml
index a2ebe48..c3ebe94 100644
--- a/data/maps/earth/openstreetmap/openstreetmap.dgml
+++ b/data/maps/earth/openstreetmap/openstreetmap.dgml
@@ -39,15 +39,6 @@
<downloadPolicy usage="Browse" maximumConnections="20"/>
<downloadPolicy usage="Bulk" maximumConnections="2"/>
</texture>
- <texture name="humanitarian" expire="31536000">
- <sourcedir format="PNG"> earth/humanitarian </sourcedir>
- <tileSize width="256" height="256"/>
- <storageLayout levelZeroColumns="1" levelZeroRows="1" maximumTileLevel="17" mode="OpenStreetMap"/>
- <projection name="Mercator"/>
- <downloadUrl protocol="https" host="tile-a.openstreetmap.fr" path="/hot/"/>
- <downloadUrl protocol="https" host="tile-b.openstreetmap.fr" path="/hot/"/>
- <blending name="AlphaBlending"/>
- </texture>
<texture name="hillshading" expire="31536000">
<sourcedir format="PNG"> earth/hillshading </sourcedir>
<tileSize width="256" height="256"/>
@@ -117,12 +108,6 @@
<value>false</value>
<available>true</available>
</property>
- </group>
- <group name="Texture Layers">
- <property name="humanitarian">
- <value>false</value>
- <available>true</available>
- </property>
</group>
</settings>
<legend>
@@ -140,9 +125,6 @@
<section name="hillshading" checkable="true" connect="hillshading" spacing="12">
<heading>Hillshading</heading>
</section>
- <section name="humanitarian" checkable="true" connect="humanitarian" spacing="12">
- <heading>Humanitarian OSM Team</heading>
- </section>
<section name="traffic" checkable="false" spacing="12">
<heading>Transportation</heading>
<item name="motorway">
diff --git a/src/apps/marble-kde/CMakeLists.txt b/src/apps/marble-kde/CMakeLists.txt
index f12ef58..2841052 100644
--- a/src/apps/marble-kde/CMakeLists.txt
+++ b/src/apps/marble-kde/CMakeLists.txt
@@ -6,7 +6,7 @@ if(ECM_FOUND)
include(KDECMakeSettings)
include(ECMInstallIcons)
endif()
-macro_optional_find_package(KF5 QUIET COMPONENTS Crash NewStuff Parts CoreAddons I18n)
+macro_optional_find_package(KF5 QUIET COMPONENTS Crash Wallet NewStuff Parts CoreAddons I18n)
if (NOT KF5_FOUND)
return()
@@ -25,6 +25,7 @@ add_library(marble_part ${marblepart_SRCS})
set_target_properties(marble_part PROPERTIES PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}")
target_link_libraries(marble_part marbleui ${MARBLEWIDGET}
KF5::NewStuff
+ KF5::Wallet
KF5::Parts
KF5::CoreAddons
KF5::I18n
@@ -55,6 +56,7 @@ target_link_libraries (
${MARBLEWIDGET}
astro
KF5::NewStuff
+ KF5::Wallet
KF5::Parts
KF5::Crash
KF5::CoreAddons
diff --git a/src/apps/marble-kde/marble.kcfg b/src/apps/marble-kde/marble.kcfg
index 0afeb16..2044afd 100644
--- a/src/apps/marble-kde/marble.kcfg
+++ b/src/apps/marble-kde/marble.kcfg
@@ -338,5 +338,8 @@
<entry name="owncloudPassword" type="String">
<default></default>
</entry>
+ <entry name="accessKWallet" type="Bool">
+ <default>true</default>
+ </entry>
</group>
</kcfg>
diff --git a/src/apps/marble-kde/marble_part.cpp b/src/apps/marble-kde/marble_part.cpp
index 4f3f144..007c41d 100644
--- a/src/apps/marble-kde/marble_part.cpp
+++ b/src/apps/marble-kde/marble_part.cpp
@@ -46,6 +46,7 @@
#include <kstandardaction.h>
#include <ktoggleaction.h>
#include <ktogglefullscreenaction.h>
+#include <KWallet/kwallet.h>
#include <kns3/knewstuffaction.h>
#include <kns3/uploaddialog.h>
@@ -129,6 +130,7 @@ MarblePart::MarblePart( QWidget *parentWidget, QObject *parent, const QVariantLi
m_stopRecordingAction( 0 ),
m_recentFilesAction( 0 ),
m_configDialog( 0 ),
+ m_wallet( 0 ),
m_position( i18n( NOT_AVAILABLE ) ),
m_tileZoomLevel( i18n( NOT_AVAILABLE ) ),
m_positionLabel( 0 ),
@@ -434,6 +436,47 @@ void MarblePart::readSettings()
{
qDebug() << "Start: MarblePart::readSettings()";
+ // Open a wallet.
+ QString m_walletFolderName="Marble";
+ m_wallet = KWallet::Wallet::openWallet( KWallet::Wallet::NetworkWallet(), m_controlView->marbleWidget()->winId() );
+ if ( m_wallet == 0 ) {
+ if ( MarbleSettings::accessKWallet() ) {
+ QMessageBox::StandardButton const answer = QMessageBox::question(
+ m_controlView,
+ i18n( "Please allow access to KWallet." ),
+ i18n( "You haven't allowed Marble to use KWallet yet.\n"
+ "This is dangerous since Marble will store your password without encryption.\n"
+ "Are you sure?" ),
+ QMessageBox::Yes | QMessageBox::No );
+ if ( answer == QMessageBox::Yes ) {
+ // User wants to save his password in plain text.
+ MarbleSettings::setAccessKWallet( false );
+ }
+ else {
+ m_wallet = KWallet::Wallet::openWallet( KWallet::Wallet::NetworkWallet(), m_controlView->marbleWidget()->winId() );
+ if ( m_wallet == 0 ) {
+ // Show dialog and ask why user don't allowed.
+ // If user didn't see KWallet dialog it means that he deny forever.
+ // Show instructions how to disable the block.
+ QMessageBox::information( m_controlView,
+ i18n( "KWallet Access in Marble" ),
+ i18n( "You still don't allow Marble to use KWallet.\n"
+ "If you haven't seen the KWallet dialog asking to allow access, it means that you have disabled it.\n"
+ "If you would like to change this see System Information -> Account Details -> KDE Wallet -> Access Control.\n"
+ "Choose your wallet and allow Marble to use it." ) );
+ // User wants to save his passwords in plain text.
+ MarbleSettings::setAccessKWallet( false );
+ }
+ }
+ }
+ }
+ if ( m_wallet ) {
+ if ( !m_wallet->hasFolder( m_walletFolderName ) ) {
+ m_wallet->createFolder( m_walletFolderName );
+ }
+ m_wallet->setFolder( m_walletFolderName );
+ }
+
// Set home position
m_controlView->marbleModel()->setHome( MarbleSettings::homeLongitude(),
MarbleSettings::homeLatitude(),
@@ -544,6 +587,17 @@ void MarblePart::readSettings()
m_controlView->setExternalMapEditor( m_externalEditorMapping[MarbleSettings::externalMapEditor()] );
+ if ( m_wallet ) {
+ // Read settings from kwallet and store it in MarbleSettings for using in kconfigdialog.
+ QMap<QString, QString> owncloudAuth;
+ m_wallet->readMap( "OwncloudServer", owncloudAuth );
+ if ( owncloudAuth.contains( "Username" ) ) {
+ MarbleSettings::setOwncloudUsername( owncloudAuth[ "Username" ] );
+ }
+ if ( owncloudAuth.contains( "Password" ) ) {
+ MarbleSettings::setOwncloudPassword( owncloudAuth[ "Password" ] );
+ }
+ }
CloudSyncManager* cloudSyncManager = m_controlView->cloudSyncManager();
cloudSyncManager->setOwncloudCredentials( MarbleSettings::owncloudServer(),
MarbleSettings::owncloudUsername(),
@@ -601,6 +655,17 @@ void MarblePart::writeSettings()
MarbleSettings::setQuitLatitude( quitLat );
MarbleSettings::setQuitRange( quitRange );
+ if ( m_wallet ) {
+ // Write changes to kwallet...
+ QMap<QString, QString> owncloudAuth;
+ owncloudAuth.insert( "Username", MarbleSettings::owncloudUsername() );
+ owncloudAuth.insert( "Password", MarbleSettings::owncloudPassword() );
+ m_wallet->writeMap( "OwncloudServer",owncloudAuth );
+ // Remove username and password form config file (they were saved in kwallet).
+ MarbleSettings::setOwncloudUsername( QString() );
+ MarbleSettings::setOwncloudPassword( QString() );
+ }
+
// Get the 'home' values from the widget and store them in the settings.
qreal homeLon = 0;
qreal homeLat = 0;
diff --git a/src/apps/marble-kde/marble_part.h b/src/apps/marble-kde/marble_part.h
index ca9a910..714d228 100644
--- a/src/apps/marble-kde/marble_part.h
+++ b/src/apps/marble-kde/marble_part.h
@@ -20,6 +20,7 @@
#include "MarbleGlobal.h"
#include "cloudsync/CloudSyncManager.h"
#include <krecentfilesaction.h>
+#include <KWallet/kwallet.h>
#include <QDomNode>
#include "ui_MarbleCloudSyncSettingsWidget.h"
@@ -247,6 +248,8 @@ class MarblePart: public KParts::ReadOnlyPart
QHash<QString, int> m_pluginEnabled;
+ KWallet::Wallet *m_wallet;
+
QString m_position;
QString m_clock;
QString m_tileZoomLevel;