summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--padmin/UIConfig_spa.mk1
-rw-r--r--padmin/source/prtsetup.cxx52
-rw-r--r--vcl/UIConfig_vcl.mk1
-rw-r--r--vcl/uiconfig/ui/cupspassworddialog.ui (renamed from padmin/uiconfig/ui/cupspassworddialog.ui)0
-rw-r--r--vcl/unx/generic/printer/cupsmgr.cxx92
5 files changed, 69 insertions, 77 deletions
diff --git a/padmin/UIConfig_spa.mk b/padmin/UIConfig_spa.mk
index 242b30523646..565f0cc57536 100644
--- a/padmin/UIConfig_spa.mk
+++ b/padmin/UIConfig_spa.mk
@@ -10,7 +10,6 @@
$(eval $(call gb_UIConfig_UIConfig,spa))
$(eval $(call gb_UIConfig_add_uifiles,spa,\
- padmin/uiconfig/ui/cupspassworddialog \
padmin/uiconfig/ui/printerdevicepage \
padmin/uiconfig/ui/printerpaperpage \
padmin/uiconfig/ui/printerpropertiesdialog \
diff --git a/padmin/source/prtsetup.cxx b/padmin/source/prtsetup.cxx
index 38494d55fe96..938e00b32356 100644
--- a/padmin/source/prtsetup.cxx
+++ b/padmin/source/prtsetup.cxx
@@ -472,43 +472,6 @@ void RTSDevicePage::FillValueBox( const PPDKey* pKey )
m_pPPDValueBox->SelectEntryPos( m_pPPDValueBox->GetEntryPos( (void*)pValue ) );
}
-class RTSPWDialog : public ModalDialog
-{
- FixedText* m_pText;
- Edit* m_pUserEdit;
- Edit* m_pPassEdit;
-
-public:
- RTSPWDialog(const OString& rServer, const OString& rUserName, Window* pParent);
-
- OString getUserName() const;
- OString getPassword() const;
-};
-
-RTSPWDialog::RTSPWDialog( const OString& rServer, const OString& rUserName, Window* pParent )
- : ModalDialog(pParent, "CUPSPasswordDialog",
- "spa/ui/cupspassworddialog.ui")
-{
- get(m_pText, "text");
- get(m_pUserEdit, "user");
- get(m_pPassEdit, "pass");
-
- OUString aText(m_pText->GetText());
- aText = aText.replaceFirst("%s", OStringToOUString(rServer, osl_getThreadTextEncoding()));
- m_pText->SetText(aText);
- m_pUserEdit->SetText( OStringToOUString(rUserName, osl_getThreadTextEncoding()));
-}
-
-OString RTSPWDialog::getUserName() const
-{
- return OUStringToOString( m_pUserEdit->GetText(), osl_getThreadTextEncoding() );
-}
-
-OString RTSPWDialog::getPassword() const
-{
- return OUStringToOString( m_pPassEdit->GetText(), osl_getThreadTextEncoding() );
-}
-
extern "C" {
int SPA_DLLPUBLIC Sal_SetupPrinterDriver( ::psp::PrinterInfo& rJobData )
@@ -524,21 +487,6 @@ extern "C" {
return nRet;
}
-
- bool SPA_DLLPUBLIC Sal_authenticateQuery( const OString& rServer, OString& rUserName, OString& rPassword )
- {
- bool bRet = false;
-
- RTSPWDialog aDialog( rServer, rUserName, NULL );
- if( aDialog.Execute() )
- {
- rUserName = aDialog.getUserName();
- rPassword = aDialog.getPassword();
- bRet = true;
- }
- return bRet;
- }
-
} // extern "C"
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/UIConfig_vcl.mk b/vcl/UIConfig_vcl.mk
index bdc028e3137d..f2937b531e49 100644
--- a/vcl/UIConfig_vcl.mk
+++ b/vcl/UIConfig_vcl.mk
@@ -10,6 +10,7 @@
$(eval $(call gb_UIConfig_UIConfig,vcl))
$(eval $(call gb_UIConfig_add_uifiles,vcl,\
+ vcl/uiconfig/ui/cupspassworddialog \
vcl/uiconfig/ui/errornocontentdialog \
vcl/uiconfig/ui/errornoprinterdialog \
vcl/uiconfig/ui/printdialog \
diff --git a/padmin/uiconfig/ui/cupspassworddialog.ui b/vcl/uiconfig/ui/cupspassworddialog.ui
index 81f80e8d3665..81f80e8d3665 100644
--- a/padmin/uiconfig/ui/cupspassworddialog.ui
+++ b/vcl/uiconfig/ui/cupspassworddialog.ui
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx
index 9c7af07c020e..b9e5af03bb19 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -35,6 +35,10 @@
#include <officecfg/Office/Common.hxx>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+
#include <algorithm>
using namespace psp;
@@ -827,36 +831,76 @@ bool CUPSManager::writePrinterConfig()
return PrinterInfoManager::writePrinterConfig();
}
-const char* CUPSManager::authenticateUser( const char* /*pIn*/ )
+namespace
{
- const char* pRet = NULL;
- oslModule pLib = osl_loadModuleAscii( _XSALSET_LIBNAME, SAL_LOADMODULE_LAZY );
- if( pLib )
+ class RTSPWDialog : public ModalDialog
{
- OUString aSym( "Sal_authenticateQuery" );
- bool (*getpw)( const OString& rServer, OString& rUser, OString& rPw) =
- (bool(*)(const OString&,OString&,OString&))osl_getFunctionSymbol( pLib, aSym.pData );
- if( getpw )
- {
- osl::MutexGuard aGuard( m_aCUPSMutex );
+ FixedText* m_pText;
+ Edit* m_pUserEdit;
+ Edit* m_pPassEdit;
- OString aUser = cupsUser();
- OString aServer = cupsServer();
- OString aPassword;
- if( getpw( aServer, aUser, aPassword ) )
- {
- m_aPassword = aPassword;
- m_aUser = aUser;
- cupsSetUser( m_aUser.getStr() );
- pRet = m_aPassword.getStr();
- }
+ public:
+ RTSPWDialog(const OString& rServer, const OString& rUserName, Window* pParent);
+
+ OString getUserName() const;
+ OString getPassword() const;
+ };
+
+ RTSPWDialog::RTSPWDialog( const OString& rServer, const OString& rUserName, Window* pParent )
+ : ModalDialog(pParent, "CUPSPasswordDialog",
+ "vcl/ui/cupspassworddialog.ui")
+ {
+ get(m_pText, "text");
+ get(m_pUserEdit, "user");
+ get(m_pPassEdit, "pass");
+
+ OUString aText(m_pText->GetText());
+ aText = aText.replaceFirst("%s", OStringToOUString(rServer, osl_getThreadTextEncoding()));
+ m_pText->SetText(aText);
+ m_pUserEdit->SetText( OStringToOUString(rUserName, osl_getThreadTextEncoding()));
+ }
+
+ OString RTSPWDialog::getUserName() const
+ {
+ return OUStringToOString( m_pUserEdit->GetText(), osl_getThreadTextEncoding() );
+ }
+
+ OString RTSPWDialog::getPassword() const
+ {
+ return OUStringToOString( m_pPassEdit->GetText(), osl_getThreadTextEncoding() );
+ }
+
+ bool AuthenticateQuery(const OString& rServer, OString& rUserName, OString& rPassword)
+ {
+ bool bRet = false;
+
+ RTSPWDialog aDialog(rServer, rUserName, NULL);
+ if (aDialog.Execute())
+ {
+ rUserName = aDialog.getUserName();
+ rPassword = aDialog.getPassword();
+ bRet = true;
}
- osl_unloadModule( pLib );
+
+ return bRet;
}
- else
+}
+
+const char* CUPSManager::authenticateUser( const char* /*pIn*/ )
+{
+ const char* pRet = NULL;
+
+ osl::MutexGuard aGuard( m_aCUPSMutex );
+
+ OString aUser = cupsUser();
+ OString aServer = cupsServer();
+ OString aPassword;
+ if (AuthenticateQuery(aServer, aUser, aPassword))
{
- SAL_WARN("vcl.unx.print",
- "loading of module " << _XSALSET_LIBNAME << " failed\n");
+ m_aPassword = aPassword;
+ m_aUser = aUser;
+ cupsSetUser( m_aUser.getStr() );
+ pRet = m_aPassword.getStr();
}
return pRet;