summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-05-13 21:21:43 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-05-14 12:25:03 +0200
commitf08c5fbabf9f2b84786cd95131590be2e15bc604 (patch)
tree20f1bbdc8318407412378319eb6ff84de5f137ec
parentthis needs pdfium (diff)
downloadcore-f08c5fbabf9f2b84786cd95131590be2e15bc604.tar.gz
core-f08c5fbabf9f2b84786cd95131590be2e15bc604.zip
split PrintMonitor and weld SaveMonitor part
Change-Id: I72325530027df69cabe8a0ec85b7b77d239ad453 Reviewed-on: https://gerrit.libreoffice.org/54300 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/UIConfig_swriter.mk1
-rw-r--r--sw/source/ui/dbui/mmresultdialogs.cxx16
-rw-r--r--sw/source/ui/inc/mmresultdialogs.hxx2
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx3
-rw-r--r--sw/source/uibase/dbui/dbui.cxx28
-rw-r--r--sw/source/uibase/inc/dbui.hxx21
-rw-r--r--sw/uiconfig/swriter/ui/printmonitordialog.ui34
-rw-r--r--sw/uiconfig/swriter/ui/savemonitordialog.ui114
8 files changed, 164 insertions, 55 deletions
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index 02b81e3a268c..0ab905433e7d 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -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 \
diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx
index b0c82cbc2ac5..ff1487e2cd90 100644
--- a/sw/source/ui/dbui/mmresultdialogs.cxx
+++ b/sw/source/ui/dbui/mmresultdialogs.cxx
@@ -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 );
}
diff --git a/sw/source/ui/inc/mmresultdialogs.hxx b/sw/source/ui/inc/mmresultdialogs.hxx
index c08b9c067f30..cde6faee8f9f 100644
--- a/sw/source/ui/inc/mmresultdialogs.hxx
+++ b/sw/source/ui/inc/mmresultdialogs.hxx
@@ -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:
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 2083deff7b1f..c4ed68804959 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -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) );
}
diff --git a/sw/source/uibase/dbui/dbui.cxx b/sw/source/uibase/dbui/dbui.cxx
index 39b74c84d8cd..02ebdfdfc043 100644
--- a/sw/source/uibase/dbui/dbui.cxx
+++ b/sw/source/uibase/dbui/dbui.cxx
@@ -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()
diff --git a/sw/source/uibase/inc/dbui.hxx b/sw/source/uibase/inc/dbui.hxx
index b70d8e836dfd..b180b73beb66 100644
--- a/sw/source/uibase/inc/dbui.hxx
+++ b/sw/source/uibase/inc/dbui.hxx
@@ -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:
diff --git a/sw/uiconfig/swriter/ui/printmonitordialog.ui b/sw/uiconfig/swriter/ui/printmonitordialog.ui
index ae76c4c390d1..825490fcd657 100644
--- a/sw/uiconfig/swriter/ui/printmonitordialog.ui
+++ b/sw/uiconfig/swriter/ui/printmonitordialog.ui
@@ -1,11 +1,18 @@
<?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>
@@ -46,18 +53,6 @@
<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>
<property name="can_focus">False</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>
@@ -81,18 +77,6 @@
</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>
<property name="can_focus">False</property>
diff --git a/sw/uiconfig/swriter/ui/savemonitordialog.ui b/sw/uiconfig/swriter/ui/savemonitordialog.ui
new file mode 100644
index 000000000000..622b3673e3a8
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/savemonitordialog.ui
@@ -0,0 +1,114 @@
+<?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>