diff options
author | Efe Gürkan YALAMAN <efeyalaman@gmail.com> | 2014-06-14 03:08:29 +0300 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2014-08-14 22:20:24 +0200 |
commit | 9a4d86a0fd65876d5d456088bb6abbe047d9893a (patch) | |
tree | ef00ff6582d2f58354a203bf937902d635ed6df8 /sfx2/source | |
parent | f689f13c6c0b249e74a3bbb334b5e90d86abef7f (diff) |
Some folder features moved to backingwindow
Create new folder and delete a folder moved from template manager dialog
to startcenter.
Change-Id: If89b9fd7ee499f7fccda08d3ac989728148a24a0
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/dialog/backingwindow.cxx | 67 | ||||
-rw-r--r-- | sfx2/source/dialog/backingwindow.hxx | 4 |
2 files changed, 63 insertions, 8 deletions
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index de5105ca3ee8..5026b936a166 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -18,6 +18,7 @@ */ #include "backingwindow.hxx" +#include "inputdlg.hxx" #include <vcl/settings.hxx> #include <vcl/svapp.hxx> @@ -51,7 +52,7 @@ #include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> -//well find a better way for it. +//FIXME:well find a better way for it. #include "../doc/doc.hrc" using namespace ::com::sun::star; @@ -593,6 +594,56 @@ void BackingWindow::OnTemplateImport () } } +void BackingWindow::OnFolderDelete() +{ + QueryBox aQueryDlg(this, WB_YES_NO | WB_DEF_YES, SfxResId(STR_QMSG_SEL_FOLDER_DELETE).toString()); + + if ( aQueryDlg.Execute() == RET_NO ) + return; + + OUString aFolderList; + + std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter; + std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelFolders = maSelFolders; //Copy to avoid invalidating an iterator + + for (pIter = aSelFolders.begin(); pIter != aSelFolders.end(); ++pIter) + { + if (!mpLocalView->removeRegion((*pIter)->mnId)) + { + if (aFolderList.isEmpty()) + aFolderList = (*pIter)->maTitle; + else + aFolderList = aFolderList + "\n" + (*pIter)->maTitle; + + ++pIter; + if (pIter == aSelFolders.end()) + break; + } + } + + if (!aFolderList.isEmpty()) + { + OUString aMsg( SfxResId(STR_MSG_ERROR_DELETE_FOLDER).toString() ); + ErrorBox(this, WB_OK,aMsg.replaceFirst("$1",aFolderList)).Execute(); + } +} + + +void BackingWindow::OnFolderNew() +{ + InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this); + + int ret = dlg.Execute(); + + if (ret) + { + OUString aName = dlg.getEntryText(); + + mpCurrentView->createRegion(aName); + } +} + + void BackingWindow::OnRegionState (const ThumbnailViewItem *pItem) { if (pItem->isSelected()) @@ -729,15 +780,15 @@ IMPL_LINK_NOARG(BackingWindow,TBXViewHdl) if (nCurItemId == mpViewBar->GetItemId("import")) OnTemplateImport(); - //else if (nCurItemId == mpViewBar->GetItemId("delete")) - //{ - //if (mpCurView == mpLocalView) - ////OnFolderDelete(); + else if (nCurItemId == mpViewBar->GetItemId("delete")) + { + if (mpCurrentView == mpLocalView) + OnFolderDelete(); //else ////OnRepositoryDelete(); - //} - //else if (nCurItemId == mpViewBar->GetItemId("new_folder")) - ////OnFolderNew(); + } + else if (nCurItemId == mpViewBar->GetItemId("new_folder")) + OnFolderNew(); //else if (nCurItemId == mpViewBar->GetItemId("save")) ////OnTemplateSaveAs(); diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx index b80201a1ff0e..743954cac2ec 100644 --- a/sfx2/source/dialog/backingwindow.hxx +++ b/sfx2/source/dialog/backingwindow.hxx @@ -98,6 +98,10 @@ class BackingWindow void setupButton( PushButton* pButton ); void OnTemplateImport (); + + void OnFolderNew (); + void OnFolderDelete (); + void OnRegionState (const ThumbnailViewItem *pItem); void dispatchURL( const OUString& i_rURL, |