Commit bb514f59 authored by Dennis Nienhüser's avatar Dennis Nienhüser

Revert "Do not open kwallet dialog on startup."

This reverts commit 0724cf1b.

Reverting as it contains changes to openstreetmap.dgml that are supposed
to be their own commit.
parent 0724cf1b
...@@ -39,15 +39,6 @@ ...@@ -39,15 +39,6 @@
<downloadPolicy usage="Browse" maximumConnections="20"/> <downloadPolicy usage="Browse" maximumConnections="20"/>
<downloadPolicy usage="Bulk" maximumConnections="2"/> <downloadPolicy usage="Bulk" maximumConnections="2"/>
</texture> </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"> <texture name="hillshading" expire="31536000">
<sourcedir format="PNG"> earth/hillshading </sourcedir> <sourcedir format="PNG"> earth/hillshading </sourcedir>
<tileSize width="256" height="256"/> <tileSize width="256" height="256"/>
...@@ -117,12 +108,6 @@ ...@@ -117,12 +108,6 @@
<value>false</value> <value>false</value>
<available>true</available> <available>true</available>
</property> </property>
</group>
<group name="Texture Layers">
<property name="humanitarian">
<value>false</value>
<available>true</available>
</property>
</group> </group>
</settings> </settings>
<legend> <legend>
...@@ -140,9 +125,6 @@ ...@@ -140,9 +125,6 @@
<section name="hillshading" checkable="true" connect="hillshading" spacing="12"> <section name="hillshading" checkable="true" connect="hillshading" spacing="12">
<heading>Hillshading</heading> <heading>Hillshading</heading>
</section> </section>
<section name="humanitarian" checkable="true" connect="humanitarian" spacing="12">
<heading>Humanitarian OSM Team</heading>
</section>
<section name="traffic" checkable="false" spacing="12"> <section name="traffic" checkable="false" spacing="12">
<heading>Transportation</heading> <heading>Transportation</heading>
<item name="motorway"> <item name="motorway">
......
...@@ -6,7 +6,7 @@ if(ECM_FOUND) ...@@ -6,7 +6,7 @@ if(ECM_FOUND)
include(KDECMakeSettings) include(KDECMakeSettings)
include(ECMInstallIcons) include(ECMInstallIcons)
endif() 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) if (NOT KF5_FOUND)
return() return()
...@@ -25,6 +25,7 @@ add_library(marble_part ${marblepart_SRCS}) ...@@ -25,6 +25,7 @@ add_library(marble_part ${marblepart_SRCS})
set_target_properties(marble_part PROPERTIES PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}") set_target_properties(marble_part PROPERTIES PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}")
target_link_libraries(marble_part marbleui ${MARBLEWIDGET} target_link_libraries(marble_part marbleui ${MARBLEWIDGET}
KF5::NewStuff KF5::NewStuff
KF5::Wallet
KF5::Parts KF5::Parts
KF5::CoreAddons KF5::CoreAddons
KF5::I18n KF5::I18n
...@@ -55,6 +56,7 @@ target_link_libraries ( ...@@ -55,6 +56,7 @@ target_link_libraries (
${MARBLEWIDGET} ${MARBLEWIDGET}
astro astro
KF5::NewStuff KF5::NewStuff
KF5::Wallet
KF5::Parts KF5::Parts
KF5::Crash KF5::Crash
KF5::CoreAddons KF5::CoreAddons
......
...@@ -338,5 +338,8 @@ ...@@ -338,5 +338,8 @@
<entry name="owncloudPassword" type="String"> <entry name="owncloudPassword" type="String">
<default></default> <default></default>
</entry> </entry>
<entry name="accessKWallet" type="Bool">
<default>true</default>
</entry>
</group> </group>
</kcfg> </kcfg>
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include <kstandardaction.h> #include <kstandardaction.h>
#include <ktoggleaction.h> #include <ktoggleaction.h>
#include <ktogglefullscreenaction.h> #include <ktogglefullscreenaction.h>
#include <KWallet/kwallet.h>
#include <kns3/knewstuffaction.h> #include <kns3/knewstuffaction.h>
#include <kns3/uploaddialog.h> #include <kns3/uploaddialog.h>
...@@ -129,6 +130,7 @@ MarblePart::MarblePart( QWidget *parentWidget, QObject *parent, const QVariantLi ...@@ -129,6 +130,7 @@ MarblePart::MarblePart( QWidget *parentWidget, QObject *parent, const QVariantLi
m_stopRecordingAction( 0 ), m_stopRecordingAction( 0 ),
m_recentFilesAction( 0 ), m_recentFilesAction( 0 ),
m_configDialog( 0 ), m_configDialog( 0 ),
m_wallet( 0 ),
m_position( i18n( NOT_AVAILABLE ) ), m_position( i18n( NOT_AVAILABLE ) ),
m_tileZoomLevel( i18n( NOT_AVAILABLE ) ), m_tileZoomLevel( i18n( NOT_AVAILABLE ) ),
m_positionLabel( 0 ), m_positionLabel( 0 ),
...@@ -434,6 +436,47 @@ void MarblePart::readSettings() ...@@ -434,6 +436,47 @@ void MarblePart::readSettings()
{ {
qDebug() << "Start: 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 // Set home position
m_controlView->marbleModel()->setHome( MarbleSettings::homeLongitude(), m_controlView->marbleModel()->setHome( MarbleSettings::homeLongitude(),
MarbleSettings::homeLatitude(), MarbleSettings::homeLatitude(),
...@@ -544,6 +587,17 @@ void MarblePart::readSettings() ...@@ -544,6 +587,17 @@ void MarblePart::readSettings()
m_controlView->setExternalMapEditor( m_externalEditorMapping[MarbleSettings::externalMapEditor()] ); 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* cloudSyncManager = m_controlView->cloudSyncManager();
cloudSyncManager->setOwncloudCredentials( MarbleSettings::owncloudServer(), cloudSyncManager->setOwncloudCredentials( MarbleSettings::owncloudServer(),
MarbleSettings::owncloudUsername(), MarbleSettings::owncloudUsername(),
...@@ -601,6 +655,17 @@ void MarblePart::writeSettings() ...@@ -601,6 +655,17 @@ void MarblePart::writeSettings()
MarbleSettings::setQuitLatitude( quitLat ); MarbleSettings::setQuitLatitude( quitLat );
MarbleSettings::setQuitRange( quitRange ); 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. // Get the 'home' values from the widget and store them in the settings.
qreal homeLon = 0; qreal homeLon = 0;
qreal homeLat = 0; qreal homeLat = 0;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "MarbleGlobal.h" #include "MarbleGlobal.h"
#include "cloudsync/CloudSyncManager.h" #include "cloudsync/CloudSyncManager.h"
#include <krecentfilesaction.h> #include <krecentfilesaction.h>
#include <KWallet/kwallet.h>
#include <QDomNode> #include <QDomNode>
#include "ui_MarbleCloudSyncSettingsWidget.h" #include "ui_MarbleCloudSyncSettingsWidget.h"
...@@ -247,6 +248,8 @@ class MarblePart: public KParts::ReadOnlyPart ...@@ -247,6 +248,8 @@ class MarblePart: public KParts::ReadOnlyPart
QHash<QString, int> m_pluginEnabled; QHash<QString, int> m_pluginEnabled;
KWallet::Wallet *m_wallet;
QString m_position; QString m_position;
QString m_clock; QString m_clock;
QString m_tileZoomLevel; QString m_tileZoomLevel;
......
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