Kaydet (Commit) f08c5fba authored tarafından Caolán McNamara's avatar Caolán McNamara

split PrintMonitor and weld SaveMonitor part

Change-Id: I72325530027df69cabe8a0ec85b7b77d239ad453
Reviewed-on: https://gerrit.libreoffice.org/54300Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 5169a27d
......@@ -239,6 +239,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
sw/uiconfig/swriter/ui/rowheight \
sw/uiconfig/swriter/ui/saveashtmldialog \
sw/uiconfig/swriter/ui/savelabeldialog \
sw/uiconfig/swriter/ui/savemonitordialog \
sw/uiconfig/swriter/ui/sectionpage \
sw/uiconfig/swriter/ui/selectaddressdialog \
sw/uiconfig/swriter/ui/selectautotextdialog \
......
......@@ -462,7 +462,7 @@ IMPL_LINK_NOARG(SwMMResultEmailDialog, CopyToHdl_Impl, Button*, void)
}
}
IMPL_LINK_NOARG(SwMMResultSaveDialog, SaveCancelHdl_Impl, Button*, void)
IMPL_LINK_NOARG(SwMMResultSaveDialog, SaveCancelHdl_Impl, weld::Button&, void)
{
m_bCancelSaving = true;
}
......@@ -625,13 +625,12 @@ IMPL_LINK_NOARG(SwMMResultSaveDialog, SaveOutputHdl_Impl, weld::Button&, void)
}
SwView* pSourceView = xConfigItem->GetSourceView();
//TODO ScopedVclPtrInstance< PrintMonitor > aSaveMonitor(this, false, PrintMonitor::MONITOR_TYPE_SAVE);
ScopedVclPtrInstance< PrintMonitor > aSaveMonitor(nullptr, false, PrintMonitor::MONITOR_TYPE_SAVE);
aSaveMonitor->m_pDocName->SetText(pSourceView->GetDocShell()->GetTitle(22));
aSaveMonitor->SetCancelHdl(LINK(this, SwMMResultSaveDialog, SaveCancelHdl_Impl));
aSaveMonitor->m_pPrinter->SetText( INetURLObject( sPath ).getFSysPath( FSysStyle::Detect ) );
std::shared_ptr<SaveMonitor> xSaveMonitor(new SaveMonitor(m_xDialog.get()));
xSaveMonitor->m_xDocName->set_label(pSourceView->GetDocShell()->GetTitle(22));
xSaveMonitor->m_xCancel->connect_clicked(LINK(this, SwMMResultSaveDialog, SaveCancelHdl_Impl));
xSaveMonitor->m_xPrinter->set_label( INetURLObject( sPath ).getFSysPath( FSysStyle::Detect ) );
m_bCancelSaving = false;
aSaveMonitor->Show();
weld::DialogController::runAsync(xSaveMonitor, [](int) {});
for(sal_uInt32 nDoc = nBegin; nDoc < nEnd && !m_bCancelSaving; ++nDoc)
{
......@@ -643,7 +642,7 @@ IMPL_LINK_NOARG(SwMMResultSaveDialog, SaveOutputHdl_Impl, weld::Button&, void)
sPath += "." + sExtension;
}
OUString sStat = SwResId(STR_STATSTR_LETTER) + " " + OUString::number( nDoc );
aSaveMonitor->m_pPrintInfo->SetText(sStat);
xSaveMonitor->m_xPrintInfo->set_label(sStat);
//now extract a document from the target document
// the shell will be closed at the end, but it is more safe to use SfxObjectShellLock here
......@@ -708,6 +707,7 @@ IMPL_LINK_NOARG(SwMMResultSaveDialog, SaveOutputHdl_Impl, weld::Button&, void)
}
}
}
xSaveMonitor->response(RET_OK);
::osl::File::remove( sTargetTempURL );
}
......
......@@ -57,7 +57,7 @@ class SwMMResultSaveDialog : public weld::GenericDialogController
std::unique_ptr<weld::Button> m_xOKButton;
DECL_LINK(SaveOutputHdl_Impl, weld::Button& , void);
DECL_LINK(SaveCancelHdl_Impl, Button*, void);
DECL_LINK(SaveCancelHdl_Impl, weld::Button&, void);
DECL_LINK(DocumentSelectionHdl_Impl, weld::ToggleButton&, void);
public:
......
......@@ -1324,8 +1324,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
pParent, pParent != pSourceWindow );
else {
pProgressDlg = VclPtr<PrintMonitor>::Create(
pParent, pParent != pSourceWindow,
PrintMonitor::MONITOR_TYPE_PRINT );
pParent, pParent != pSourceWindow);
static_cast<PrintMonitor*>( pProgressDlg.get() )->SetText(
pSourceDocSh->GetTitle(22) );
}
......
......@@ -22,24 +22,28 @@
#include <dbui.hrc>
#include <dbui.hxx>
PrintMonitor::PrintMonitor(vcl::Window *pParent, bool modal, PrintMonitorType eType )
SaveMonitor::SaveMonitor(weld::Window *pParent)
: GenericDialogController(pParent, "modules/swriter/ui/savemonitordialog.ui",
"SaveMonitorDialog")
, m_xDocName(m_xBuilder->weld_label("docname"))
, m_xPrinter(m_xBuilder->weld_label("printer"))
, m_xPrintInfo(m_xBuilder->weld_label("printinfo"))
, m_xCancel(m_xBuilder->weld_button("cancel"))
{
}
SaveMonitor::~SaveMonitor()
{
}
PrintMonitor::PrintMonitor(vcl::Window *pParent, bool modal)
: CancelableDialog(pParent, modal, "PrintMonitorDialog",
"modules/swriter/ui/printmonitordialog.ui")
{
get(m_pDocName, "docname");
get(m_pPrinter, "printer");
get(m_pPrintInfo, "printinfo");
switch (eType)
{
case MONITOR_TYPE_SAVE:
SetText(get<FixedText>("alttitle")->GetText());
get(m_pPrinting, "saving");
break;
case MONITOR_TYPE_PRINT:
get(m_pPrinting, "printing");
break;
}
m_pPrinting->Show();
get(m_pPrinting, "printing");
}
PrintMonitor::~PrintMonitor()
......
......@@ -23,6 +23,7 @@
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
#include <vcl/weld.hxx>
class SW_DLLPUBLIC CancelableDialog : public Dialog
{
......@@ -47,22 +48,28 @@ public:
class SW_DLLPUBLIC PrintMonitor: public CancelableDialog
{
public:
enum PrintMonitorType
{
MONITOR_TYPE_PRINT,
MONITOR_TYPE_SAVE
};
VclPtr<FixedText> m_pDocName;
VclPtr<FixedText> m_pPrinting;
VclPtr<FixedText> m_pPrinter;
VclPtr<FixedText> m_pPrintInfo;
PrintMonitor( vcl::Window *pParent, bool modal, PrintMonitorType eType );
PrintMonitor(vcl::Window *pParent, bool modal);
virtual ~PrintMonitor() override;
virtual void dispose() override;
};
class SW_DLLPUBLIC SaveMonitor : public weld::GenericDialogController
{
public:
std::unique_ptr<weld::Label> m_xDocName;
std::unique_ptr<weld::Label> m_xPrinter;
std::unique_ptr<weld::Label> m_xPrintInfo;
std::unique_ptr<weld::Button> m_xCancel;
SaveMonitor(weld::Window *pParent);
virtual ~SaveMonitor() override;
};
class CreateMonitor : public CancelableDialog
{
public:
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface domain="sw">
<!-- interface-requires gtk+ 3.0 -->
<requires lib="gtk+" version="3.0"/>
<object class="GtkDialog" id="PrintMonitorDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="printmonitordialog|PrintMonitorDialog">Print monitor</property>
<property name="modal">True</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
......@@ -45,18 +52,6 @@
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="alttitle">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="label" translatable="yes" context="printmonitordialog|alttitle">Save-Monitor</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="docname">
<property name="visible">True</property>
......@@ -70,6 +65,7 @@
</child>
<child>
<object class="GtkLabel" id="printing">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="label" translatable="yes" context="printmonitordialog|printing">is being prepared for printing on</property>
......@@ -80,18 +76,6 @@
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="saving">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="label" translatable="yes" context="printmonitordialog|saving">is being saved to</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="printer">
<property name="visible">True</property>
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface domain="sw">
<requires lib="gtk+" version="3.0"/>
<object class="GtkDialog" id="SaveMonitorDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="printmonitordialog|PrintMonitorDialog">Save monitor</property>
<property name="modal">True</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="docname">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="saving">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="label" translatable="yes" context="printmonitordialog|saving">is being saved to</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="printer">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="printinfo">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-6">cancel</action-widget>
</action-widgets>
</object>
</interface>
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