summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfe Gürkan YALAMAN <efeyalaman@gmail.com>2014-06-14 03:08:29 +0300
committerEfe Gürkan YALAMAN <efeyalaman@gmail.com>2014-08-08 18:22:33 +0300
commitf2b88f7f17de8e03394d9cfaf9342ee6e3da8c60 (patch)
tree8513e9ceb5a39858deac74e6025cc4fa0ecd5a9f
parent5d0c28f39e40ed725c43130481ca136ed43e306b (diff)
Some folder features moved to backingwindow
Create new folder and delete a folder moved from template manager dialog to startcenter. Change-Id: If89b9fd7ee499f7fccda08d3ac989728148a24a0
-rw-r--r--sfx2/source/dialog/backingwindow.cxx67
-rw-r--r--sfx2/source/dialog/backingwindow.hxx4
2 files changed, 63 insertions, 8 deletions
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index e58e347f5b2d..4d20df3fb30d 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;
@@ -595,6 +596,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())
@@ -731,15 +782,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,