move the fax dialog from padmin to vcl

now we don't have to dlopen padmin to get it
so we can drop that complicated stuff and don't need
to be unx only

Change-Id: I0e585b05a4ecf2a1c8a3ac5275185d81ada518e5
This commit is contained in:
Caolán McNamara 2014-03-21 09:07:42 +00:00
parent 5c291a0287
commit b3a162ccec
11 changed files with 74 additions and 86 deletions

View File

@ -13,7 +13,6 @@ $(eval $(call gb_UIConfig_add_uifiles,spa,\
padmin/uiconfig/ui/printerdevicepage \
padmin/uiconfig/ui/printerpaperpage \
padmin/uiconfig/ui/printerpropertiesdialog \
padmin/uiconfig/ui/querydialog \
))
# vim: set noet sw=4 ts=4:

View File

@ -75,38 +75,4 @@ ResId padmin::PaResId( sal_uInt32 nId )
return ResId( nId, *pPaResMgr );
}
/*
* QueryString
*/
QueryString::QueryString(Window* pParent, OUString& rQuery, OUString& rRet)
: ModalDialog(pParent, "QueryDialog",
"spa/ui/querydialog.ui" )
, m_rReturnValue( rRet )
{
get(m_pOKButton, "ok");
get(m_pFixedText, "label");
get(m_pEdit, "entry");
m_pOKButton->SetClickHdl( LINK( this, QueryString, ClickBtnHdl ) );
m_pFixedText->SetText( rQuery );
m_pEdit->SetText( m_rReturnValue );
SetText( Application::GetDisplayName() );
}
QueryString::~QueryString()
{
}
IMPL_LINK( QueryString, ClickBtnHdl, Button*, pButton )
{
if (pButton == m_pOKButton)
{
m_rReturnValue = m_pEdit->GetText();
EndDialog( 1 );
}
else
EndDialog(0);
return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -38,24 +38,7 @@
namespace padmin
{
class QueryString : public ModalDialog
{
private:
OKButton* m_pOKButton;
FixedText* m_pFixedText;
Edit* m_pEdit;
OUString& m_rReturnValue;
DECL_LINK( ClickBtnHdl, Button* );
public:
QueryString(Window*, OUString &, OUString &);
// parent window, Query text, initial value
~QueryString();
};
ResId PaResId( sal_uInt32 nId );
} // namespace padmin
#endif

View File

@ -538,13 +538,6 @@ extern "C" {
return nRet;
}
int SPA_DLLPUBLIC Sal_queryFaxNumber( OUString& rNumber )
{
OUString aTmpString( PaResId( RID_TXT_QUERYFAXNUMBER ) );
QueryString aQuery( NULL, aTmpString, rNumber );
return aQuery.Execute();
}
bool SPA_DLLPUBLIC Sal_authenticateQuery( const OString& rServer, OString& rUserName, OString& rPassword )
{
bool bRet = false;

View File

@ -22,8 +22,6 @@
#define RID_RTS_RTSDIALOG_INVALID_TXT 4001
#define RID_TXT_QUERYFAXNUMBER 4007
#define RID_RTS_PWDIALOG 4008
#define RID_RTS_PWDIALOG_TXT 1
#define RID_RTS_PWDIALOG_USER_TXT 2

View File

@ -24,11 +24,6 @@ String RID_RTS_RTSDIALOG_INVALID_TXT
Text [ en-US ] = "<ignore>";
};
String RID_TXT_QUERYFAXNUMBER
{
Text [ en-US ] = "Please enter the fax number.";
};
ModalDialog RID_RTS_PWDIALOG
{
HelpID = "padmin:ModalDialog:RID_RTS_PWDIALOG";

View File

@ -14,6 +14,7 @@ $(eval $(call gb_UIConfig_add_uifiles,vcl,\
vcl/uiconfig/ui/errornoprinterdialog \
vcl/uiconfig/ui/printdialog \
vcl/uiconfig/ui/printprogressdialog \
vcl/uiconfig/ui/querydialog \
))
# vim: set noet sw=4 ts=4:

View File

@ -41,12 +41,16 @@
#include "osl/module.h"
#include "vcl/button.hxx"
#include "vcl/dialog.hxx"
#include "vcl/edit.hxx"
#include "vcl/fixed.hxx"
#include "vcl/svapp.hxx"
#include "vcl/print.hxx"
#include "vcl/pdfwriter.hxx"
#include "vcl/printerinfomanager.hxx"
#include "vcl/settings.hxx"
#include "svids.hrc"
#include "saldatabasic.hxx"
#include "generic/genprn.h"
#include "generic/geninst.h"
@ -73,8 +77,6 @@ extern "C"
{
typedef int(*setupFunction)(PrinterInfo&);
static setupFunction pSetupFunction = NULL;
typedef int(*faxFunction)(OUString&);
static faxFunction pFaxNrFunction = NULL;
}
static OUString getPdfDir( const PrinterInfo& rInfo )
@ -96,6 +98,61 @@ static OUString getPdfDir( const PrinterInfo& rInfo )
return aDir;
}
namespace
{
class QueryString : public ModalDialog
{
private:
OKButton* m_pOKButton;
FixedText* m_pFixedText;
Edit* m_pEdit;
OUString& m_rReturnValue;
DECL_LINK( ClickBtnHdl, Button* );
public:
// parent window, Query text, initial value
QueryString(Window*, OUString &, OUString &);
};
/*
* QueryString
*/
QueryString::QueryString(Window* pParent, OUString& rQuery, OUString& rRet)
: ModalDialog(pParent, "QueryDialog",
"vcl/ui/querydialog.ui" )
, m_rReturnValue( rRet )
{
get(m_pOKButton, "ok");
get(m_pFixedText, "label");
get(m_pEdit, "entry");
m_pOKButton->SetClickHdl(LINK(this, QueryString, ClickBtnHdl));
m_pFixedText->SetText(rQuery);
m_pEdit->SetText(m_rReturnValue);
SetText(Application::GetDisplayName());
}
IMPL_LINK( QueryString, ClickBtnHdl, Button*, pButton )
{
if (pButton == m_pOKButton)
{
m_rReturnValue = m_pEdit->GetText();
EndDialog( 1 );
}
else
EndDialog(0);
return 0;
}
int QueryFaxNumber(OUString& rNumber)
{
OUString aTmpString(VclResId(SV_PRINT_QUERYFAXNUMBER_TXT));
QueryString aQuery(NULL, aTmpString, rNumber);
return aQuery.Execute();
}
}
static void getPaLib()
{
#if defined( UNX ) && !( defined( MACOSX ) || defined( IOS ) || defined( ANDROID ) )
@ -110,10 +167,6 @@ static void getPaLib()
pSetupFunction = (setupFunction)osl_getAsciiFunctionSymbol( driverLib, "Sal_SetupPrinterDriver" );
if ( !pSetupFunction )
fprintf( stderr, "could not resolve Sal_SetupPrinterDriver\n" );
pFaxNrFunction = (faxFunction)osl_getAsciiFunctionSymbol( driverLib, "Sal_queryFaxNumber" );
if ( !pFaxNrFunction )
fprintf( stderr, "could not resolve Sal_queryFaxNumber\n" );
}
#endif
}
@ -308,12 +361,8 @@ static std::vector<OUString> getFaxNumbers()
{
std::vector<OUString> aFaxNumbers;
#if defined( UNX )
getPaLib();
if (pFaxNrFunction)
{
OUString aNewNr;
if( pFaxNrFunction( aNewNr ) )
if (QueryFaxNumber(aNewNr))
{
sal_Int32 nIndex = 0;
do
@ -323,8 +372,6 @@ static std::vector<OUString> getFaxNumbers()
}
while (nIndex >= 0);
}
}
#endif
return aFaxNumbers;
}

View File

@ -212,6 +212,7 @@
#define SV_PRINT_PRINTPREVIEW_TXT 10612
#define SV_PRINT_COLLATE_IMG 10613
#define SV_PRINT_NOCOLLATE_IMG 10614
#define SV_PRINT_QUERYFAXNUMBER_TXT 10615
#define SV_EDIT_WARNING_BOX 10650

View File

@ -105,4 +105,9 @@ Image SV_PRINT_NOCOLLATE_IMG
ImageBitmap = Bitmap { File = "ncollate.png" ; };
};
String SV_PRINT_QUERYFAXNUMBER_TXT
{
Text [ en-US ] = "Please enter the fax number.";
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */