Kaydet (Commit) cff219f7 authored tarafından Daniel's avatar Daniel Kaydeden (comit) Daniel Silva

Reinserts storeToSettings and readToSettings in print dialog

Change-Id: I094439a677f8c30c45688fc879140177e3681559
Reviewed-on: https://gerrit.libreoffice.org/58814
Tested-by: Jenkins
Reviewed-by: 's avatarDaniel Silva <danielfaleirosilva@gmail.com>
üst b368e404
...@@ -228,6 +228,8 @@ namespace vcl ...@@ -228,6 +228,8 @@ namespace vcl
void preparePreview( bool i_bPrintChanged = true, bool i_bMayUseCache = false ); void preparePreview( bool i_bPrintChanged = true, bool i_bMayUseCache = false );
void setupPaperSidesBox(); void setupPaperSidesBox();
void storeToSettings();
void readFromSettings();
void setPreviewText(); void setPreviewText();
void updatePrinterText(); void updatePrinterText();
void checkControlDependencies(); void checkControlDependencies();
......
...@@ -666,6 +666,9 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo ...@@ -666,6 +666,9 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo
// hide layout frame if unwanted // hide layout frame if unwanted
mpPageLayoutFrame->Show( mbShowLayoutFrame ); mpPageLayoutFrame->Show( mbShowLayoutFrame );
// restore settings from last run
readFromSettings();
// setup click hdl // setup click hdl
mpOKButton->SetClickHdl(LINK(this, PrintDialog, ClickHdl)); mpOKButton->SetClickHdl(LINK(this, PrintDialog, ClickHdl));
mpCancelButton->SetClickHdl(LINK(this, PrintDialog, ClickHdl)); mpCancelButton->SetClickHdl(LINK(this, PrintDialog, ClickHdl));
...@@ -773,6 +776,106 @@ void PrintDialog::setupPaperSidesBox() ...@@ -773,6 +776,106 @@ void PrintDialog::setupPaperSidesBox()
} }
} }
void PrintDialog::storeToSettings()
{
SettingsConfigItem* pItem = SettingsConfigItem::get();
pItem->setValue( "PrintDialog",
"LastPrinter",
isPrintToFile() ? Printer::GetDefaultPrinterName()
: mpPrinters->GetSelectedEntry() );
pItem->setValue( "PrintDialog",
"LastPage",
mpTabCtrl->GetPageText( mpTabCtrl->GetCurPageId() ) );
pItem->setValue( "PrintDialog",
"WindowState",
OStringToOUString( GetWindowState(), RTL_TEXTENCODING_UTF8 ) );
pItem->setValue( "PrintDialog",
"CopyCount",
mpCopyCountField->GetText() );
pItem->setValue( "PrintDialog",
"Collate",
mpCollateBox->IsChecked() ? OUString("true") :
OUString("false") );
pItem->setValue( "PrintDialog",
"CollateSingleJobs",
mbSingleJobs ? OUString("true") :
OUString("false") );
pItem->setValue( "PrintDialog",
"HasPreview",
hasPreview() ? OUString("true") :
OUString("false") );
pItem->Commit();
}
void PrintDialog::readFromSettings()
{
SettingsConfigItem* pItem = SettingsConfigItem::get();
OUString aValue;
// read last selected tab page; if it exists, activate it
aValue = pItem->getValue( "PrintDialog",
"LastPage" );
sal_uInt16 nCount = mpTabCtrl->GetPageCount();
for( sal_uInt16 i = 0; i < nCount; i++ )
{
sal_uInt16 nPageId = mpTabCtrl->GetPageId( i );
if( aValue == mpTabCtrl->GetPageText( nPageId ) )
{
mpTabCtrl->SelectTabPage( nPageId );
break;
}
}
// persistent window state
aValue = pItem->getValue( "PrintDialog",
"WindowState" );
if( !aValue.isEmpty() )
SetWindowState( OUStringToOString( aValue, RTL_TEXTENCODING_UTF8 ) );
// collate
aValue = pItem->getValue( "PrintDialog",
"CollateBox" );
if( aValue.equalsIgnoreAsciiCase("alwaysoff") )
{
mnCollateUIMode = 1;
mpCollateBox->Check( false );
mpCollateBox->Enable( false );
}
else
{
mnCollateUIMode = 0;
aValue = pItem->getValue( "PrintDialog",
"Collate" );
mpCollateBox->Check( aValue.equalsIgnoreAsciiCase("true") );
}
// collate single jobs
aValue = pItem->getValue( "PrintDialog",
"CollateSingleJobs" );
if ( aValue.equalsIgnoreAsciiCase("true") )
mbSingleJobs = true;
else
mbSingleJobs = false;
// preview box
aValue = pItem->getValue( "PrintDialog",
"HasPreview" );
if ( aValue.equalsIgnoreAsciiCase("true") )
mpPreviewBox->Check( true );
else
mpPreviewBox->Check( false );
}
void PrintDialog::setPaperSizes() void PrintDialog::setPaperSizes()
{ {
mpPaperSizeBox->Clear(); mpPaperSizeBox->Clear();
...@@ -1681,7 +1784,7 @@ IMPL_LINK ( PrintDialog, ClickHdl, Button*, pButton, void ) ...@@ -1681,7 +1784,7 @@ IMPL_LINK ( PrintDialog, ClickHdl, Button*, pButton, void )
{ {
if( pButton == mpOKButton || pButton == mpCancelButton ) if( pButton == mpOKButton || pButton == mpCancelButton )
{ {
//storeToSettings(); storeToSettings();
EndDialog( pButton == mpOKButton ? RET_OK : RET_CANCEL ); EndDialog( pButton == mpOKButton ? RET_OK : RET_CANCEL );
} }
else if( pButton == mpHelpButton ) else if( pButton == mpHelpButton )
......
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