summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2015-06-04 14:59:20 +0200
committerSzymon Kłos <eszkadev@gmail.com>2015-07-16 09:52:45 +0200
commitc9934f5b46922bd10406ec7e7687c87ed7153680 (patch)
tree5542e145941dbb1e8141cf0914cab097bf4f834b
parent168f21e42620be24daa07cad3ee2c5535c0c527f (diff)
new dialog type flags, resizable fileView
Change-Id: I1052b5edef3fa35678bcf2a6a4ac58090fd9e507
-rw-r--r--include/svtools/RemoteFilesDialog.hxx21
-rw-r--r--svtools/source/dialogs/RemoteFilesDialog.cxx105
-rw-r--r--svtools/uiconfig/ui/remotefilesdialog.ui12
3 files changed, 127 insertions, 11 deletions
diff --git a/include/svtools/RemoteFilesDialog.hxx b/include/svtools/RemoteFilesDialog.hxx
index ac96658bb000..2ad82af1f4ae 100644
--- a/include/svtools/RemoteFilesDialog.hxx
+++ b/include/svtools/RemoteFilesDialog.hxx
@@ -27,26 +27,40 @@
#include <vector>
+#define WB_MULTISELECTION 0x20000000L
+
enum SvtRemoteDlgMode
{
REMOTEDLG_MODE_OPEN = 0,
REMOTEDLG_MODE_SAVE = 1
};
+enum SvtRemoteDlgType
+{
+ REMOTEDLG_TYPE_FILEDLG = 0,
+ REMOTEDLG_TYPE_PATHDLG = 1
+};
+
typedef std::shared_ptr<Place> ServicePtr;
typedef ::com::sun::star::uno::Sequence<OUString> OUStringList;
+class FileViewContainer;
+
class SVT_DLLPUBLIC RemoteFilesDialog : public ModalDialog
{
public:
RemoteFilesDialog(vcl::Window* pParent, WinBits nBits);
+ ~RemoteFilesDialog();
virtual void dispose() SAL_OVERRIDE;
+ virtual void Resize() SAL_OVERRIDE;
private:
::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_context;
SvtRemoteDlgMode m_eMode;
+ SvtRemoteDlgType m_eType;
+ bool m_bMultiselection;
bool m_bIsUpdated;
VclPtr<PushButton> m_pOpen_btn;
@@ -55,7 +69,8 @@ private:
VclPtr<MenuButton> m_pAddService_btn;
VclPtr<ListBox> m_pServices_lb;
VclPtr<Edit> m_pPath_ed;
- VclPtr<SvtFileView> m_pView;
+ VclPtr<SvtFileView> m_pFileView;
+ VclPtr<FileViewContainer> m_pContainer;
std::vector<ServicePtr> m_aServices;
@@ -64,9 +79,13 @@ private:
/* If failure returns < 0 */
int GetSelectedServicePos();
+ void OpenURL( OUString sURL );
+
DECL_LINK ( AddServiceHdl, void * );
DECL_LINK ( SelectServiceHdl, void * );
DECL_LINK_TYPED ( EditServiceMenuHdl, MenuButton *, void );
+
+ DECL_LINK( DoubleClickHdl, void * );
};
#endif // INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX
diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index db3ab1ab8531..98ace3d67bf9 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -13,9 +13,51 @@ using namespace ::com::sun::star::uno;
#define NO_FILTER "*.*"
+class FileViewContainer : public vcl::Window
+{
+ private:
+ VclPtr<SvtFileView> m_pFileView;
+
+ public:
+ FileViewContainer(vcl::Window *pParent)
+ : Window(pParent)
+ , m_pFileView(NULL)
+ {
+ }
+
+ virtual ~FileViewContainer()
+ {
+ disposeOnce();
+ }
+
+ virtual void dispose() SAL_OVERRIDE
+ {
+ m_pFileView.clear();
+ vcl::Window::dispose();
+ }
+
+ void init(SvtFileView* pFileView)
+ {
+ m_pFileView = pFileView;
+ }
+
+ virtual void Resize() SAL_OVERRIDE
+ {
+ Window::Resize();
+
+ if(!m_pFileView)
+ return;
+
+ Size aSize = GetSizePixel();
+ m_pFileView->SetSizePixel( aSize );
+ }
+};
+
RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
: ModalDialog(pParent, "RemoteFilesDialog", "svt/ui/remotefilesdialog.ui")
, m_context(comphelper::getProcessComponentContext())
+ , m_pFileView(NULL)
+ , m_pContainer(NULL)
{
get(m_pOpen_btn, "open");
get(m_pSave_btn, "save");
@@ -23,9 +65,10 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
get(m_pAddService_btn, "add_service_btn");
get(m_pServices_lb, "services_lb");
get(m_pPath_ed, "path");
- get(m_pView, "files");
m_eMode = (nBits & WB_SAVEAS) ? REMOTEDLG_MODE_SAVE : REMOTEDLG_MODE_OPEN;
+ m_eType = (nBits & WB_PATH) ? REMOTEDLG_TYPE_PATHDLG : REMOTEDLG_TYPE_FILEDLG;
+ m_bMultiselection = (nBits & WB_MULTISELECTION) ? true : false;
m_bIsUpdated = false;
if(m_eMode == REMOTEDLG_MODE_OPEN)
@@ -39,6 +82,22 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
m_pOpen_btn->Hide();
}
+ m_pContainer = VclPtr<FileViewContainer>::Create( get<vcl::Window>("container") );
+
+ m_pContainer->set_hexpand(true);
+ m_pContainer->set_vexpand(true);
+
+ m_pFileView = VclPtr<SvtFileView>::Create( m_pContainer, WB_BORDER,
+ REMOTEDLG_TYPE_PATHDLG == m_eType,
+ m_bMultiselection );
+
+ m_pFileView->Show();
+ m_pFileView->EnableAutoResize();
+ m_pFileView->SetDoubleClickHdl( LINK( this, RemoteFilesDialog, DoubleClickHdl ) );
+
+ m_pContainer->init(m_pFileView);
+ m_pContainer->Show();
+
m_pAddService_btn->SetMenuMode(MENUBUTTON_MENUMODE_TIMED);
m_pAddService_btn->SetClickHdl( LINK( this, RemoteFilesDialog, AddServiceHdl ) );
m_pAddService_btn->SetSelectHdl( LINK( this, RemoteFilesDialog, EditServiceMenuHdl ) );
@@ -48,6 +107,11 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
m_pServices_lb->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectServiceHdl ) );
}
+RemoteFilesDialog::~RemoteFilesDialog()
+{
+ disposeOnce();
+}
+
void RemoteFilesDialog::dispose()
{
if(m_bIsUpdated)
@@ -72,6 +136,17 @@ void RemoteFilesDialog::dispose()
ModalDialog::dispose();
}
+void RemoteFilesDialog::Resize()
+{
+ ModalDialog::Resize();
+
+ if(m_pFileView && m_pContainer)
+ {
+ Size aSize = m_pContainer->GetSizePixel();
+ m_pFileView->SetSizePixel(aSize);
+ }
+}
+
void RemoteFilesDialog::FillServicesListbox()
{
m_pServices_lb->Clear();
@@ -121,6 +196,19 @@ int RemoteFilesDialog::GetSelectedServicePos()
return nPos;
}
+void RemoteFilesDialog::OpenURL( OUString sURL )
+{
+ if(m_pFileView)
+ {
+ OUStringList BlackList;
+ FileViewResult eResult = eFailure;
+
+ m_pFileView->EndInplaceEditing( false );
+ m_pPath_ed->SetText( sURL );
+ eResult = m_pFileView->Initialize( sURL, NO_FILTER, NULL, BlackList );
+ }
+}
+
IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl )
{
ScopedVclPtrInstance< PlaceEditDialog > aDlg(this);
@@ -154,13 +242,9 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, SelectServiceHdl )
if(nPos > 0)
{
- OUStringList BlackList;
OUString sURL = m_aServices[nPos]->GetUrl();
- FileViewResult eResult = eFailure;
-
- m_pPath_ed->SetText(sURL);
- eResult = m_pView->Initialize( sURL, NO_FILTER, NULL, BlackList );
+ OpenURL( sURL );
}
return 1;
@@ -227,4 +311,13 @@ IMPL_LINK_TYPED ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton,
}
}
+IMPL_LINK_NOARG ( RemoteFilesDialog, DoubleClickHdl )
+{
+ OUString sURL = m_pFileView->GetCurrentURL();
+
+ OpenURL( sURL );
+
+ return 1;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/uiconfig/ui/remotefilesdialog.ui b/svtools/uiconfig/ui/remotefilesdialog.ui
index 0c5936904a56..62ce906c0693 100644
--- a/svtools/uiconfig/ui/remotefilesdialog.ui
+++ b/svtools/uiconfig/ui/remotefilesdialog.ui
@@ -2,7 +2,6 @@
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.12"/>
- <requires lib="LibreOffice" version="1.0"/>
<object class="GtkDialog" id="RemoteFilesDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
@@ -135,11 +134,16 @@
</packing>
</child>
<child>
- <object class="svtlo-SvtFileView" id="files">
+ <object class="GtkBox" id="container">
+ <property name="width_request">500</property>
+ <property name="height_request">200</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="File View-selection1"/>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
</child>
</object>
<packing>