summaryrefslogtreecommitdiffstats
path: root/swext/mediawiki/src/com/sun/star/wiki/Settings.java
diff options
context:
space:
mode:
authorMikhail Voitenko <mav@openoffice.org>2008-02-11 09:31:30 +0000
committerMikhail Voitenko <mav@openoffice.org>2008-02-11 09:31:30 +0000
commitdd58971fa01923051208ffc6c0ce8a4569933bf4 (patch)
tree3afbbd81633cecdc1ba84f82bc77a137f7f2f4c7 /swext/mediawiki/src/com/sun/star/wiki/Settings.java
parentchange user and password handling (diff)
downloadcore-dd58971fa01923051208ffc6c0ce8a4569933bf4.tar.gz
core-dd58971fa01923051208ffc6c0ce8a4569933bf4.zip
store the user name
Diffstat (limited to 'swext/mediawiki/src/com/sun/star/wiki/Settings.java')
-rw-r--r--swext/mediawiki/src/com/sun/star/wiki/Settings.java39
1 files changed, 28 insertions, 11 deletions
diff --git a/swext/mediawiki/src/com/sun/star/wiki/Settings.java b/swext/mediawiki/src/com/sun/star/wiki/Settings.java
index 3181dd658842..8fc2d410efc2 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/Settings.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/Settings.java
@@ -4,9 +4,9 @@
*
* $RCSfile: Settings.java,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: mav $ $Date: 2008-02-11 08:35:34 $
+ * last change: $Author: mav $ $Date: 2008-02-11 10:31:29 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -35,11 +35,12 @@
package com.sun.star.wiki;
+import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XNameAccess;
import com.sun.star.container.XNameContainer;
import com.sun.star.container.XNameReplace;
import com.sun.star.lang.XSingleServiceFactory;
-import com.sun.star.task.UrlRecord;
+import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import com.sun.star.util.XChangesBatch;
@@ -228,7 +229,12 @@ public class Settings
{
Object oNewConnection = xConnectionFactory.createInstance();
Hashtable ht = ( Hashtable ) m_WikiConnections.get( i );
- xContainer.insertByName( (String)ht.get( "Url" ), oNewConnection );
+ XNameReplace xNewConn = ( XNameReplace ) UnoRuntime.queryInterface( XNameReplace.class, oNewConnection );
+
+ if ( xNewConn != null )
+ xNewConn.replaceByName( "UserName", ht.get( "Username" ) );
+
+ xContainer.insertByName( (String)ht.get( "Url" ), xNewConn );
}
// commit changes
XChangesBatch xBatch = ( XChangesBatch ) UnoRuntime.queryInterface( XChangesBatch.class, xContainer );
@@ -291,15 +297,26 @@ public class Settings
ht.put( "Username", "" );
ht.put( "Password", "" );
- //TODO/LATER: how to handle more than one user?
- // for now use the first one
- UrlRecord aRecord = Helper.GetUsersForURL( m_xContext, allCons[i] );
- if ( aRecord != null && aRecord.UserList != null && aRecord.UserList.length > 0 )
+ try
{
- ht.put( "Username", aRecord.UserList[0] );
- if ( aRecord.UserList[0].Passwords != null && aRecord.UserList[0].Passwords.length > 0 )
- ht.put( "Password", aRecord.UserList[0].Passwords[0] );
+ XPropertySet xProps = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xConnectionList.getByName( allCons[i] ) );
+ if ( xProps != null )
+ {
+ String aUsername = AnyConverter.toString( xProps.getPropertyValue( "UserName" ) );
+ if ( aUsername != null && aUsername.length() > 0 )
+ {
+ ht.put( "Username", aUsername );
+ String[] pPasswords = Helper.GetPasswordsForURLAndUser( m_xContext, allCons[i], aUsername );
+ if ( pPasswords != null && pPasswords.length > 0 )
+ ht.put( "Password", pPasswords[0] );
+ }
+ }
}
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+
addWikiCon( ht );
}